@@ -19,9 +19,9 @@ discard block  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 | $template_path = $oModule->getTemplatePath();  | 
                                                        
| 21 | 21 | |
| 22 | - if(!is_dir($template_path))  | 
                                                        |
| 22 | + if (!is_dir($template_path))  | 
                                                        |
| 23 | 23 |  		{ | 
                                                        
| 24 | - if($oModule->module_info->module == $oModule->module)  | 
                                                        |
| 24 | + if ($oModule->module_info->module == $oModule->module)  | 
                                                        |
| 25 | 25 |  			{ | 
                                                        
| 26 | 26 | $skin = $oModule->origin_module_info->skin;  | 
                                                        
| 27 | 27 | }  | 
                                                        
@@ -30,17 +30,17 @@ discard block  | 
                                                    ||
| 30 | 30 | $skin = $oModule->module_config->skin;  | 
                                                        
| 31 | 31 | }  | 
                                                        
| 32 | 32 | |
| 33 | -			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) | 
                                                        |
| 33 | +			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) | 
                                                        |
| 34 | 34 |  			{ | 
                                                        
| 35 | - if($skin && is_string($skin))  | 
                                                        |
| 35 | + if ($skin && is_string($skin))  | 
                                                        |
| 36 | 36 |  				{ | 
                                                        
| 37 | 37 |  					$theme_skin = explode('|@|', $skin); | 
                                                        
| 38 | 38 | $template_path = $oModule->getTemplatePath();  | 
                                                        
| 39 | - if(count($theme_skin) == 2)  | 
                                                        |
| 39 | + if (count($theme_skin) == 2)  | 
                                                        |
| 40 | 40 |  					{ | 
                                                        
| 41 | 41 |  						$theme_path = sprintf('./themes/%s', $theme_skin[0]); | 
                                                        
| 42 | 42 | // FIXME $theme_path $theme_path $theme_path ??  | 
                                                        
| 43 | - if(substr($theme_path, 0, strlen($theme_path)) != $theme_path)  | 
                                                        |
| 43 | + if (substr($theme_path, 0, strlen($theme_path)) != $theme_path)  | 
                                                        |
| 44 | 44 |  						{ | 
                                                        
| 45 | 45 |  							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); | 
                                                        
| 46 | 46 | }  | 
                                                        
@@ -61,16 +61,16 @@ discard block  | 
                                                    ||
| 61 | 61 | $output = $oTemplate->compile($template_path, $tpl_file);  | 
                                                        
| 62 | 62 | |
| 63 | 63 | // add .x div for adminitration pages  | 
                                                        
| 64 | - if(Context::getResponseMethod() == 'HTML')  | 
                                                        |
| 64 | + if (Context::getResponseMethod() == 'HTML')  | 
                                                        |
| 65 | 65 |  		{ | 
                                                        
| 66 | -			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') | 
                                                        |
| 66 | +			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') | 
                                                        |
| 67 | 67 |  			{ | 
                                                        
| 68 | - $output = '<div class="x">' . $output . '</div>';  | 
                                                        |
| 68 | + $output = '<div class="x">'.$output.'</div>';  | 
                                                        |
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
| 71 | -			if(Context::get('layout') != 'none') | 
                                                        |
| 71 | +			if (Context::get('layout') != 'none') | 
                                                        |
| 72 | 72 |  			{ | 
                                                        
| 73 | - if(__DEBUG__ == 3)  | 
                                                        |
| 73 | + if (__DEBUG__ == 3)  | 
                                                        |
| 74 | 74 |  				{ | 
                                                        
| 75 | 75 | $start = getMicroTime();  | 
                                                        
| 76 | 76 | }  | 
                                                        
@@ -88,11 +88,11 @@ discard block  | 
                                                    ||
| 88 | 88 | $layout_srl = $layout_info->layout_srl;  | 
                                                        
| 89 | 89 | |
| 90 | 90 | // compile if connected to the layout  | 
                                                        
| 91 | - if($layout_srl > 0)  | 
                                                        |
| 91 | + if ($layout_srl > 0)  | 
                                                        |
| 92 | 92 |  				{ | 
                                                        
| 93 | 93 | |
| 94 | 94 | // handle separately if the layout is faceoff  | 
                                                        
| 95 | - if($layout_info && $layout_info->type == 'faceoff')  | 
                                                        |
| 95 | + if ($layout_info && $layout_info->type == 'faceoff')  | 
                                                        |
| 96 | 96 |  					{ | 
                                                        
| 97 | 97 | $oLayoutModel->doActivateFaceOff($layout_info);  | 
                                                        
| 98 | 98 |  						Context::set('layout_info', $layout_info); | 
                                                        
@@ -101,16 +101,16 @@ discard block  | 
                                                    ||
| 101 | 101 | // search if the changes CSS exists in the admin layout edit window  | 
                                                        
| 102 | 102 | $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);  | 
                                                        
| 103 | 103 | |
| 104 | - if(FileHandler::exists($edited_layout_css))  | 
                                                        |
| 104 | + if (FileHandler::exists($edited_layout_css))  | 
                                                        |
| 105 | 105 |  					{ | 
                                                        
| 106 | 106 | Context::loadFile(array($edited_layout_css, 'all', '', 100));  | 
                                                        
| 107 | 107 | }  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | - if(!$layout_path)  | 
                                                        |
| 109 | + if (!$layout_path)  | 
                                                        |
| 110 | 110 |  				{ | 
                                                        
| 111 | 111 | $layout_path = './common/tpl';  | 
                                                        
| 112 | 112 | }  | 
                                                        
| 113 | - if(!$layout_file)  | 
                                                        |
| 113 | + if (!$layout_file)  | 
                                                        |
| 114 | 114 |  				{ | 
                                                        
| 115 | 115 | $layout_file = 'default_layout';  | 
                                                        
| 116 | 116 | }  | 
                                                        
@@ -118,7 +118,7 @@ discard block  | 
                                                    ||
| 118 | 118 | |
| 119 | 119 | // if popup_layout, remove admin bar.  | 
                                                        
| 120 | 120 | $realLayoutPath = FileHandler::getRealPath($layout_path);  | 
                                                        
| 121 | - if(substr_compare($realLayoutPath, '/', -1) !== 0)  | 
                                                        |
| 121 | + if (substr_compare($realLayoutPath, '/', -1) !== 0)  | 
                                                        |
| 122 | 122 |  				{ | 
                                                        
| 123 | 123 | $realLayoutPath .= '/';  | 
                                                        
| 124 | 124 | }  | 
                                                        
@@ -126,12 +126,12 @@ discard block  | 
                                                    ||
| 126 | 126 | $pathInfo = pathinfo($layout_file);  | 
                                                        
| 127 | 127 | $onlyLayoutFile = $pathInfo['filename'];  | 
                                                        
| 128 | 128 | |
| 129 | - if(__DEBUG__ == 3)  | 
                                                        |
| 129 | + if (__DEBUG__ == 3)  | 
                                                        |
| 130 | 130 |  				{ | 
                                                        
| 131 | 131 | $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start;  | 
                                                        
| 132 | 132 | }  | 
                                                        
| 133 | 133 | |
| 134 | -				if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) | 
                                                        |
| 134 | +				if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) | 
                                                        |
| 135 | 135 |  				{ | 
                                                        
| 136 | 136 |  					Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); | 
                                                        
| 137 | 137 | }  | 
                                                        
@@ -147,12 +147,12 @@ discard block  | 
                                                    ||
| 147 | 147 | */  | 
                                                        
| 148 | 148 | function prepareToPrint(&$output)  | 
                                                        
| 149 | 149 |  	{ | 
                                                        
| 150 | - if(Context::getResponseMethod() != 'HTML')  | 
                                                        |
| 150 | + if (Context::getResponseMethod() != 'HTML')  | 
                                                        |
| 151 | 151 |  		{ | 
                                                        
| 152 | 152 | return;  | 
                                                        
| 153 | 153 | }  | 
                                                        
| 154 | 154 | |
| 155 | - if(__DEBUG__ == 3)  | 
                                                        |
| 155 | + if (__DEBUG__ == 3)  | 
                                                        |
| 156 | 156 |  		{ | 
                                                        
| 157 | 157 | $start = getMicroTime();  | 
                                                        
| 158 | 158 | }  | 
                                                        
@@ -170,20 +170,20 @@ discard block  | 
                                                    ||
| 170 | 170 |  		$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output); | 
                                                        
| 171 | 171 | |
| 172 | 172 | // handles a relative path generated by using the rewrite module  | 
                                                        
| 173 | - if(Context::isAllowRewrite())  | 
                                                        |
| 173 | + if (Context::isAllowRewrite())  | 
                                                        |
| 174 | 174 |  		{ | 
                                                        
| 175 | 175 | $url = parse_url(Context::getRequestUri());  | 
                                                        
| 176 | 176 | $real_path = $url['path'];  | 
                                                        
| 177 | 177 | |
| 178 | 178 |  			$pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s'; | 
                                                        
| 179 | - $output = preg_replace($pattern, 'src=$1' . $real_path . '$2$3', $output);  | 
                                                        |
| 179 | + $output = preg_replace($pattern, 'src=$1'.$real_path.'$2$3', $output);  | 
                                                        |
| 180 | 180 | |
| 181 | 181 |  			$pattern = '/href=("|\'){1}(\?[^"\']+)/s'; | 
                                                        
| 182 | - $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);  | 
                                                        |
| 182 | + $output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output);  | 
                                                        |
| 183 | 183 | |
| 184 | -			if(Context::get('vid')) | 
                                                        |
| 184 | +			if (Context::get('vid')) | 
                                                        |
| 185 | 185 |  			{ | 
                                                        
| 186 | -				$pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is'; | 
                                                        |
| 186 | +				$pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is'; | 
                                                        |
| 187 | 187 | $output = preg_replace($pattern, '/?$1=', $output);  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | }  | 
                                                        
@@ -191,18 +191,18 @@ discard block  | 
                                                    ||
| 191 | 191 | // prevent the 2nd request due to url(none) of the background-image  | 
                                                        
| 192 | 192 |  		$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); | 
                                                        
| 193 | 193 | |
| 194 | -		if(is_array(Context::get('INPUT_ERROR'))) | 
                                                        |
| 194 | +		if (is_array(Context::get('INPUT_ERROR'))) | 
                                                        |
| 195 | 195 |  		{ | 
                                                        
| 196 | 196 |  			$INPUT_ERROR = Context::get('INPUT_ERROR'); | 
                                                        
| 197 | 197 | $keys = array_keys($INPUT_ERROR);  | 
                                                        
| 198 | -			$keys = '(' . implode('|', $keys) . ')'; | 
                                                        |
| 198 | +			$keys = '('.implode('|', $keys).')'; | 
                                                        |
| 199 | 199 | |
| 200 | -			$output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); | 
                                                        |
| 201 | -			$output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); | 
                                                        |
| 202 | -			$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); | 
                                                        |
| 200 | +			$output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); | 
                                                        |
| 201 | +			$output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); | 
                                                        |
| 202 | +			$output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | 204 | |
| 205 | - if(__DEBUG__ == 3)  | 
                                                        |
| 205 | + if (__DEBUG__ == 3)  | 
                                                        |
| 206 | 206 |  		{ | 
                                                        
| 207 | 207 | $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start;  | 
                                                        
| 208 | 208 | }  | 
                                                        
@@ -220,7 +220,7 @@ discard block  | 
                                                    ||
| 220 | 220 | // convert the final layout  | 
                                                        
| 221 | 221 |  		Context::set('content', $output); | 
                                                        
| 222 | 222 | $oTemplate = TemplateHandler::getInstance();  | 
                                                        
| 223 | - if(Mobile::isFromMobilePhone())  | 
                                                        |
| 223 | + if (Mobile::isFromMobilePhone())  | 
                                                        |
| 224 | 224 |  		{ | 
                                                        
| 225 | 225 | $this->_loadMobileJSCSS();  | 
                                                        
| 226 | 226 |  			$output = $oTemplate->compile('./common/tpl', 'mobile_layout'); | 
                                                        
@@ -245,16 +245,16 @@ discard block  | 
                                                    ||
| 245 | 245 |  	{ | 
                                                        
| 246 | 246 |  		$INPUT_ERROR = Context::get('INPUT_ERROR'); | 
                                                        
| 247 | 247 | |
| 248 | - $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4];  | 
                                                        |
| 248 | + $str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4];  | 
                                                        |
| 249 | 249 | |
| 250 | 250 | // get type  | 
                                                        
| 251 | 251 | $type = 'text';  | 
                                                        
| 252 | -		if(preg_match('/\stype="([a-z]+)"/i', $str, $m)) | 
                                                        |
| 252 | +		if (preg_match('/\stype="([a-z]+)"/i', $str, $m)) | 
                                                        |
| 253 | 253 |  		{ | 
                                                        
| 254 | 254 | $type = strtolower($m[1]);  | 
                                                        
| 255 | 255 | }  | 
                                                        
| 256 | 256 | |
| 257 | - switch($type)  | 
                                                        |
| 257 | + switch ($type)  | 
                                                        |
| 258 | 258 |  		{ | 
                                                        
| 259 | 259 | case 'text':  | 
                                                        
| 260 | 260 | case 'hidden':  | 
                                                        
@@ -272,7 +272,7 @@ discard block  | 
                                                    ||
| 272 | 272 | case 'number':  | 
                                                        
| 273 | 273 | case 'range':  | 
                                                        
| 274 | 274 | case 'color':  | 
                                                        
| 275 | -				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"'; | 
                                                        |
| 275 | +				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"'; | 
                                                        |
| 276 | 276 | break;  | 
                                                        
| 277 | 277 | case 'password':  | 
                                                        
| 278 | 278 |  				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str); | 
                                                        
@@ -280,14 +280,14 @@ discard block  | 
                                                    ||
| 280 | 280 | case 'radio':  | 
                                                        
| 281 | 281 | case 'checkbox':  | 
                                                        
| 282 | 282 |  				$str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); | 
                                                        
| 283 | -				if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) | 
                                                        |
| 283 | +				if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str)) | 
                                                        |
| 284 | 284 |  				{ | 
                                                        
| 285 | 285 | $str .= ' checked="checked"';  | 
                                                        
| 286 | 286 | }  | 
                                                        
| 287 | 287 | break;  | 
                                                        
| 288 | 288 | }  | 
                                                        
| 289 | 289 | |
| 290 | - return $str . ' />';  | 
                                                        |
| 290 | + return $str.' />';  | 
                                                        |
| 291 | 291 | }  | 
                                                        
| 292 | 292 | |
| 293 | 293 | /**  | 
                                                        
@@ -304,14 +304,14 @@ discard block  | 
                                                    ||
| 304 | 304 |  		preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m); | 
                                                        
| 305 | 305 | |
| 306 | 306 | $key = array_search($INPUT_ERROR[$matches[1]], $m[1]);  | 
                                                        
| 307 | - if($key === FALSE)  | 
                                                        |
| 307 | + if ($key === FALSE)  | 
                                                        |
| 308 | 308 |  		{ | 
                                                        
| 309 | 309 | return $matches[0];  | 
                                                        
| 310 | 310 | }  | 
                                                        
| 311 | 311 | |
| 312 | 312 |  		$m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); | 
                                                        
| 313 | 313 | |
| 314 | -		return $mm[0] . implode('', $m[0]) . '</select>'; | 
                                                        |
| 314 | +		return $mm[0].implode('', $m[0]).'</select>'; | 
                                                        |
| 315 | 315 | }  | 
                                                        
| 316 | 316 | |
| 317 | 317 | /**  | 
                                                        
@@ -323,7 +323,7 @@ discard block  | 
                                                    ||
| 323 | 323 |  	{ | 
                                                        
| 324 | 324 |  		$INPUT_ERROR = Context::get('INPUT_ERROR'); | 
                                                        
| 325 | 325 |  		preg_match('@<textarea.*?>@is', $matches[0], $mm); | 
                                                        
| 326 | - return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>';  | 
                                                        |
| 326 | + return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>';  | 
                                                        |
| 327 | 327 | }  | 
                                                        
| 328 | 328 | |
| 329 | 329 | /**  | 
                                                        
@@ -334,7 +334,7 @@ discard block  | 
                                                    ||
| 334 | 334 | */  | 
                                                        
| 335 | 335 | function _moveStyleToHeader($matches)  | 
                                                        
| 336 | 336 |  	{ | 
                                                        
| 337 | - if(isset($matches[1]) && stristr($matches[1], 'scoped'))  | 
                                                        |
| 337 | + if (isset($matches[1]) && stristr($matches[1], 'scoped'))  | 
                                                        |
| 338 | 338 |  		{ | 
                                                        
| 339 | 339 | return $matches[0];  | 
                                                        
| 340 | 340 | }  | 
                                                        
@@ -370,7 +370,7 @@ discard block  | 
                                                    ||
| 370 | 370 | */  | 
                                                        
| 371 | 371 | function _transMeta($matches)  | 
                                                        
| 372 | 372 |  	{ | 
                                                        
| 373 | - if($matches[1])  | 
                                                        |
| 373 | + if ($matches[1])  | 
                                                        |
| 374 | 374 |  		{ | 
                                                        
| 375 | 375 | return '';  | 
                                                        
| 376 | 376 | }  | 
                                                        
@@ -387,7 +387,7 @@ discard block  | 
                                                    ||
| 387 | 387 | $lang_type = Context::getLangType();  | 
                                                        
| 388 | 388 | |
| 389 | 389 | // add common JS/CSS files  | 
                                                        
| 390 | - if(__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 390 | + if (__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 391 | 391 |  		{ | 
                                                        
| 392 | 392 |  			$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true); | 
                                                        
| 393 | 393 |  			$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true); | 
                                                        
@@ -400,7 +400,7 @@ discard block  | 
                                                    ||
| 400 | 400 |  			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); | 
                                                        
| 401 | 401 |  			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); | 
                                                        
| 402 | 402 |  			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); | 
                                                        
| 403 | - if(!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 403 | + if (!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 404 | 404 |  			{ | 
                                                        
| 405 | 405 |  				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); | 
                                                        
| 406 | 406 | }  | 
                                                        
@@ -415,7 +415,7 @@ discard block  | 
                                                    ||
| 415 | 415 |  			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true); | 
                                                        
| 416 | 416 |  			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); | 
                                                        
| 417 | 417 |  			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); | 
                                                        
| 418 | - if(!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 418 | + if (!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 419 | 419 |  			{ | 
                                                        
| 420 | 420 |  				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); | 
                                                        
| 421 | 421 | }  | 
                                                        
@@ -426,9 +426,9 @@ discard block  | 
                                                    ||
| 426 | 426 | }  | 
                                                        
| 427 | 427 | |
| 428 | 428 | // for admin page, add admin css  | 
                                                        
| 429 | -		if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) | 
                                                        |
| 429 | +		if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) | 
                                                        |
| 430 | 430 |  		{ | 
                                                        
| 431 | - if(__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 431 | + if (__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 432 | 432 |  			{ | 
                                                        
| 433 | 433 |  				$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true); | 
                                                        
| 434 | 434 |  				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); | 
                                                        
@@ -460,7 +460,7 @@ discard block  | 
                                                    ||
| 460 | 460 | $lang_type = Context::getLangType();  | 
                                                        
| 461 | 461 | |
| 462 | 462 | // add common JS/CSS files  | 
                                                        
| 463 | - if(__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 463 | + if (__DEBUG__ || !__XE_VERSION_STABLE__)  | 
                                                        |
| 464 | 464 |  		{ | 
                                                        
| 465 | 465 |  			$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true); | 
                                                        
| 466 | 466 |  			$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true); | 
                                                        
@@ -472,7 +472,7 @@ discard block  | 
                                                    ||
| 472 | 472 |  			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true); | 
                                                        
| 473 | 473 |  			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true); | 
                                                        
| 474 | 474 |  			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true); | 
                                                        
| 475 | - if(!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 475 | + if (!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 476 | 476 |  			{ | 
                                                        
| 477 | 477 |  				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true); | 
                                                        
| 478 | 478 |  				$oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true); | 
                                                        
@@ -488,7 +488,7 @@ discard block  | 
                                                    ||
| 488 | 488 |  			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true); | 
                                                        
| 489 | 489 |  			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true); | 
                                                        
| 490 | 490 |  			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true); | 
                                                        
| 491 | - if(!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 491 | + if (!__DISABLE_DEFAULT_CSS__)  | 
                                                        |
| 492 | 492 |  			{ | 
                                                        
| 493 | 493 |  				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true); | 
                                                        
| 494 | 494 |  				$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true); | 
                                                        
@@ -29,30 +29,30 @@ discard block  | 
                                                    ||
| 29 | 29 | $file_info = $_FILES['Filedata'];  | 
                                                        
| 30 | 30 | |
| 31 | 31 | // An error appears if not a normally uploaded file  | 
                                                        
| 32 | - if(!is_uploaded_file($file_info['tmp_name'])) exit();  | 
                                                        |
| 32 | + if (!is_uploaded_file($file_info['tmp_name'])) exit();  | 
                                                        |
| 33 | 33 | |
| 34 | 34 | // Basic variables setting  | 
                                                        
| 35 | 35 |  		$oFileModel = getModel('file'); | 
                                                        
| 36 | 36 |  		$editor_sequence = Context::get('editor_sequence'); | 
                                                        
| 37 | 37 |  		$upload_target_srl = intval(Context::get('uploadTargetSrl')); | 
                                                        
| 38 | -		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); | 
                                                        |
| 38 | +		if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); | 
                                                        |
| 39 | 39 | $module_srl = $this->module_srl;  | 
                                                        
| 40 | 40 | // Exit a session if there is neither upload permission nor information  | 
                                                        
| 41 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 41 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 42 | 42 | // Extract from session information if upload_target_srl is not specified  | 
                                                        
| 43 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;  | 
                                                        |
| 43 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;  | 
                                                        |
| 44 | 44 | // Create if upload_target_srl is not defined in the session information  | 
                                                        
| 45 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();  | 
                                                        |
| 45 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();  | 
                                                        |
| 46 | 46 | |
| 47 | 47 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl);  | 
                                                        
| 48 | 48 |  		Context::setResponseMethod('JSON'); | 
                                                        
| 49 | -		$this->add('file_srl',$output->get('file_srl')); | 
                                                        |
| 50 | -		$this->add('file_size',$output->get('file_size')); | 
                                                        |
| 51 | -		$this->add('direct_download',$output->get('direct_download')); | 
                                                        |
| 52 | -		$this->add('source_filename',$output->get('source_filename')); | 
                                                        |
| 53 | -		$this->add('download_url',$output->get('uploaded_filename')); | 
                                                        |
| 54 | -		$this->add('upload_target_srl',$output->get('upload_target_srl')); | 
                                                        |
| 55 | - if($output->error != '0') $this->stop($output->message);  | 
                                                        |
| 49 | +		$this->add('file_srl', $output->get('file_srl')); | 
                                                        |
| 50 | +		$this->add('file_size', $output->get('file_size')); | 
                                                        |
| 51 | +		$this->add('direct_download', $output->get('direct_download')); | 
                                                        |
| 52 | +		$this->add('source_filename', $output->get('source_filename')); | 
                                                        |
| 53 | +		$this->add('download_url', $output->get('uploaded_filename')); | 
                                                        |
| 54 | +		$this->add('upload_target_srl', $output->get('upload_target_srl')); | 
                                                        |
| 55 | + if ($output->error != '0') $this->stop($output->message);  | 
                                                        |
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | 58 | /**  | 
                                                        
@@ -67,24 +67,24 @@ discard block  | 
                                                    ||
| 67 | 67 |  		$callback = Context::get('callback'); | 
                                                        
| 68 | 68 | $module_srl = $this->module_srl;  | 
                                                        
| 69 | 69 |  		$upload_target_srl = intval(Context::get('uploadTargetSrl')); | 
                                                        
| 70 | -		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); | 
                                                        |
| 70 | +		if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); | 
                                                        |
| 71 | 71 | |
| 72 | 72 | // Exit a session if there is neither upload permission nor information  | 
                                                        
| 73 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 73 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 74 | 74 | // Extract from session information if upload_target_srl is not specified  | 
                                                        
| 75 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;  | 
                                                        |
| 75 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;  | 
                                                        |
| 76 | 76 | // Create if upload_target_srl is not defined in the session information  | 
                                                        
| 77 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();  | 
                                                        |
| 77 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();  | 
                                                        |
| 78 | 78 | |
| 79 | 79 | // Delete and then attempt to re-upload if file_srl is requested  | 
                                                        
| 80 | 80 |  		$file_srl = Context::get('file_srl'); | 
                                                        
| 81 | - if($file_srl)  | 
                                                        |
| 81 | + if ($file_srl)  | 
                                                        |
| 82 | 82 |  		{ | 
                                                        
| 83 | 83 |  			$oFileModel = getModel('file'); | 
                                                        
| 84 | 84 |  			$logged_info = Context::get('logged_info'); | 
                                                        
| 85 | 85 | $file_info = $oFileModel->getFile($file_srl);  | 
                                                        
| 86 | 86 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info);  | 
                                                        
| 87 | - if($file_info->file_srl == $file_srl && $file_grant->is_deletable)  | 
                                                        |
| 87 | + if ($file_info->file_srl == $file_srl && $file_grant->is_deletable)  | 
                                                        |
| 88 | 88 |  			{ | 
                                                        
| 89 | 89 | $this->deleteFile($file_srl);  | 
                                                        
| 90 | 90 | }  | 
                                                        
@@ -92,12 +92,12 @@ discard block  | 
                                                    ||
| 92 | 92 | |
| 93 | 93 |  		$file_info = Context::get('Filedata'); | 
                                                        
| 94 | 94 | // An error appears if not a normally uploaded file  | 
                                                        
| 95 | -		if(is_uploaded_file($file_info['tmp_name'])) { | 
                                                        |
| 95 | +		if (is_uploaded_file($file_info['tmp_name'])) { | 
                                                        |
| 96 | 96 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl);  | 
                                                        
| 97 | -			Context::set('uploaded_fileinfo',$output); | 
                                                        |
| 97 | +			Context::set('uploaded_fileinfo', $output); | 
                                                        |
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
| 100 | -		Context::set('layout','none'); | 
                                                        |
| 100 | +		Context::set('layout', 'none'); | 
                                                        |
| 101 | 101 | |
| 102 | 102 | $this->setTemplatePath($this->module_path.'tpl');  | 
                                                        
| 103 | 103 |  		$this->setTemplateFile('iframe'); | 
                                                        
@@ -114,24 +114,24 @@ discard block  | 
                                                    ||
| 114 | 114 |  		$width = Context::get('width'); | 
                                                        
| 115 | 115 |  		$height = Context::get('height'); | 
                                                        
| 116 | 116 | |
| 117 | - if(!$file_srl || !$width)  | 
                                                        |
| 117 | + if (!$file_srl || !$width)  | 
                                                        |
| 118 | 118 |  		{ | 
                                                        
| 119 | - return new Object(-1,'msg_invalid_request');  | 
                                                        |
| 119 | + return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 120 | 120 | }  | 
                                                        
| 121 | 121 | |
| 122 | 122 |  		$oFileModel = getModel('file'); | 
                                                        
| 123 | 123 | $fileInfo = $oFileModel->getFile($file_srl);  | 
                                                        
| 124 | - if(!$fileInfo || $fileInfo->direct_download != 'Y')  | 
                                                        |
| 124 | + if (!$fileInfo || $fileInfo->direct_download != 'Y')  | 
                                                        |
| 125 | 125 |  		{ | 
                                                        
| 126 | - return new Object(-1,'msg_invalid_request');  | 
                                                        |
| 126 | + return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | 129 | $source_src = $fileInfo->uploaded_filename;  | 
                                                        
| 130 | - $output_src = $source_src . '.resized' . strrchr($source_src,'.');  | 
                                                        |
| 130 | + $output_src = $source_src.'.resized'.strrchr($source_src, '.');  | 
                                                        |
| 131 | 131 | |
| 132 | - if(!$height) $height = $width-1;  | 
                                                        |
| 132 | + if (!$height) $height = $width - 1;  | 
                                                        |
| 133 | 133 | |
| 134 | - if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio'))  | 
                                                        |
| 134 | + if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio'))  | 
                                                        |
| 135 | 135 |  		{ | 
                                                        
| 136 | 136 | $output = new stdClass();  | 
                                                        
| 137 | 137 | $output->info = getimagesize($output_src);  | 
                                                        
@@ -139,10 +139,10 @@ discard block  | 
                                                    ||
| 139 | 139 | }  | 
                                                        
| 140 | 140 | else  | 
                                                        
| 141 | 141 |  		{ | 
                                                        
| 142 | - return new Object(-1,'msg_invalid_request');  | 
                                                        |
| 142 | + return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | -		$this->add('resized_info',$output); | 
                                                        |
| 145 | +		$this->add('resized_info', $output); | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | 147 | |
| 148 | 148 | /**  | 
                                                        
@@ -180,7 +180,7 @@ discard block  | 
                                                    ||
| 180 | 180 |  	{ | 
                                                        
| 181 | 181 |  		$oFileModel = getModel('file'); | 
                                                        
| 182 | 182 | |
| 183 | - if(isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted');  | 
                                                        |
| 183 | + if (isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted');  | 
                                                        |
| 184 | 184 | |
| 185 | 185 |  		$file_srl = Context::get('file_srl'); | 
                                                        
| 186 | 186 |  		$sid = Context::get('sid'); | 
                                                        
@@ -189,26 +189,26 @@ discard block  | 
                                                    ||
| 189 | 189 |  		$columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); | 
                                                        
| 190 | 190 | $file_obj = $oFileModel->getFile($file_srl, $columnList);  | 
                                                        
| 191 | 191 | // If the requested file information is incorrect, an error that file cannot be found appears  | 
                                                        
| 192 | -		if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); | 
                                                        |
| 192 | +		if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found'); | 
                                                        |
| 193 | 193 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted)  | 
                                                        
| 194 | -		if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 194 | +		if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 195 | 195 | // File name  | 
                                                        
| 196 | 196 | $filename = $file_obj->source_filename;  | 
                                                        
| 197 | 197 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);  | 
                                                        
| 198 | 198 | // Not allow the file outlink  | 
                                                        
| 199 | - if($file_module_config->allow_outlink == 'N')  | 
                                                        |
| 199 | + if ($file_module_config->allow_outlink == 'N')  | 
                                                        |
| 200 | 200 |  		{ | 
                                                        
| 201 | 201 | // Handles extension to allow outlink  | 
                                                        
| 202 | - if($file_module_config->allow_outlink_format)  | 
                                                        |
| 202 | + if ($file_module_config->allow_outlink_format)  | 
                                                        |
| 203 | 203 |  			{ | 
                                                        
| 204 | 204 | $allow_outlink_format_array = array();  | 
                                                        
| 205 | 205 |  				$allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); | 
                                                        
| 206 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;  | 
                                                        |
| 206 | + if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;  | 
                                                        |
| 207 | 207 | |
| 208 | - foreach($allow_outlink_format_array as $val)  | 
                                                        |
| 208 | + foreach ($allow_outlink_format_array as $val)  | 
                                                        |
| 209 | 209 |  				{ | 
                                                        
| 210 | 210 | $val = trim($val);  | 
                                                        
| 211 | -					if(preg_match("/\.{$val}$/i", $filename)) | 
                                                        |
| 211 | +					if (preg_match("/\.{$val}$/i", $filename)) | 
                                                        |
| 212 | 212 |  					{ | 
                                                        
| 213 | 213 | $file_module_config->allow_outlink = 'Y';  | 
                                                        
| 214 | 214 | break;  | 
                                                        
@@ -216,21 +216,21 @@ discard block  | 
                                                    ||
| 216 | 216 | }  | 
                                                        
| 217 | 217 | }  | 
                                                        
| 218 | 218 | // Sites that outlink is allowed  | 
                                                        
| 219 | - if($file_module_config->allow_outlink != 'Y')  | 
                                                        |
| 219 | + if ($file_module_config->allow_outlink != 'Y')  | 
                                                        |
| 220 | 220 |  			{ | 
                                                        
| 221 | 221 | $referer = parse_url($_SERVER["HTTP_REFERER"]);  | 
                                                        
| 222 | - if($referer['host'] != $_SERVER['HTTP_HOST'])  | 
                                                        |
| 222 | + if ($referer['host'] != $_SERVER['HTTP_HOST'])  | 
                                                        |
| 223 | 223 |  				{ | 
                                                        
| 224 | - if($file_module_config->allow_outlink_site)  | 
                                                        |
| 224 | + if ($file_module_config->allow_outlink_site)  | 
                                                        |
| 225 | 225 |  					{ | 
                                                        
| 226 | 226 | $allow_outlink_site_array = array();  | 
                                                        
| 227 | 227 |  						$allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); | 
                                                        
| 228 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;  | 
                                                        |
| 228 | + if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;  | 
                                                        |
| 229 | 229 | |
| 230 | - foreach($allow_outlink_site_array as $val)  | 
                                                        |
| 230 | + foreach ($allow_outlink_site_array as $val)  | 
                                                        |
| 231 | 231 |  						{ | 
                                                        
| 232 | 232 | $site = parse_url(trim($val));  | 
                                                        
| 233 | - if($site['host'] == $referer['host'])  | 
                                                        |
| 233 | + if ($site['host'] == $referer['host'])  | 
                                                        |
| 234 | 234 |  							{ | 
                                                        
| 235 | 235 | $file_module_config->allow_outlink = 'Y';  | 
                                                        
| 236 | 236 | break;  | 
                                                        
@@ -240,49 +240,49 @@ discard block  | 
                                                    ||
| 240 | 240 | }  | 
                                                        
| 241 | 241 | else $file_module_config->allow_outlink = 'Y';  | 
                                                        
| 242 | 242 | }  | 
                                                        
| 243 | -			if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); | 
                                                        |
| 243 | +			if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); | 
                                                        |
| 244 | 244 | }  | 
                                                        
| 245 | 245 | |
| 246 | 246 | // Check if a permission for file download is granted  | 
                                                        
| 247 | 247 | $downloadGrantCount = 0;  | 
                                                        
| 248 | - if(is_array($file_module_config->download_grant))  | 
                                                        |
| 248 | + if (is_array($file_module_config->download_grant))  | 
                                                        |
| 249 | 249 |  		{ | 
                                                        
| 250 | - foreach($file_module_config->download_grant AS $value)  | 
                                                        |
| 251 | - if($value) $downloadGrantCount++;  | 
                                                        |
| 250 | + foreach ($file_module_config->download_grant AS $value)  | 
                                                        |
| 251 | + if ($value) $downloadGrantCount++;  | 
                                                        |
| 252 | 252 | }  | 
                                                        
| 253 | 253 | |
| 254 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0)  | 
                                                        |
| 254 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0)  | 
                                                        |
| 255 | 255 |  		{ | 
                                                        
| 256 | -			if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 256 | +			if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 257 | 257 |  			$logged_info = Context::get('logged_info'); | 
                                                        
| 258 | - if($logged_info->is_admin != 'Y')  | 
                                                        |
| 258 | + if ($logged_info->is_admin != 'Y')  | 
                                                        |
| 259 | 259 |  			{ | 
                                                        
| 260 | -				$oModuleModel =& getModel('module'); | 
                                                        |
| 260 | +				$oModuleModel = & getModel('module'); | 
                                                        |
| 261 | 261 |  				$columnList = array('module_srl', 'site_srl'); | 
                                                        
| 262 | 262 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList);  | 
                                                        
| 263 | 263 | |
| 264 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))  | 
                                                        |
| 264 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))  | 
                                                        |
| 265 | 265 |  				{ | 
                                                        
| 266 | -					$oMemberModel =& getModel('member'); | 
                                                        |
| 266 | +					$oMemberModel = & getModel('member'); | 
                                                        |
| 267 | 267 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl);  | 
                                                        
| 268 | 268 | |
| 269 | 269 | $is_permitted = false;  | 
                                                        
| 270 | - for($i=0;$i<count($file_module_config->download_grant);$i++)  | 
                                                        |
| 270 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++)  | 
                                                        |
| 271 | 271 |  					{ | 
                                                        
| 272 | 272 | $group_srl = $file_module_config->download_grant[$i];  | 
                                                        
| 273 | - if($member_groups[$group_srl])  | 
                                                        |
| 273 | + if ($member_groups[$group_srl])  | 
                                                        |
| 274 | 274 |  						{ | 
                                                        
| 275 | 275 | $is_permitted = true;  | 
                                                        
| 276 | 276 | break;  | 
                                                        
| 277 | 277 | }  | 
                                                        
| 278 | 278 | }  | 
                                                        
| 279 | -					if(!$is_permitted) return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 279 | +					if (!$is_permitted) return $this->stop('msg_not_permitted_download'); | 
                                                        |
| 280 | 280 | }  | 
                                                        
| 281 | 281 | }  | 
                                                        
| 282 | 282 | }  | 
                                                        
| 283 | 283 | // Call a trigger (before)  | 
                                                        
| 284 | 284 |  		$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); | 
                                                        
| 285 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');  | 
                                                        |
| 285 | + if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download');  | 
                                                        |
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | // 다운로드 후 (가상)  | 
                                                        
@@ -295,7 +295,7 @@ discard block  | 
                                                    ||
| 295 | 295 | |
| 296 | 296 | $random = new Password();  | 
                                                        
| 297 | 297 | $file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex');  | 
                                                        
| 298 | -		header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key)); | 
                                                        |
| 298 | +		header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key)); | 
                                                        |
| 299 | 299 | Context::close();  | 
                                                        
| 300 | 300 | exit();  | 
                                                        
| 301 | 301 | |
@@ -306,18 +306,18 @@ discard block  | 
                                                    ||
| 306 | 306 |  		$oFileModel = getModel('file'); | 
                                                        
| 307 | 307 |  		$file_srl = Context::get('file_srl'); | 
                                                        
| 308 | 308 |  		$file_key = Context::get('file_key'); | 
                                                        
| 309 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true;  | 
                                                        |
| 309 | + if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true;  | 
                                                        |
| 310 | 310 | |
| 311 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__';  | 
                                                        |
| 311 | + if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__';  | 
                                                        |
| 312 | 312 | else $session_key = '__XE_FILE_KEY__';  | 
                                                        
| 313 | 313 |  		$columnList = array('source_filename', 'uploaded_filename', 'file_size'); | 
                                                        
| 314 | 314 | $file_obj = $oFileModel->getFile($file_srl, $columnList);  | 
                                                        
| 315 | 315 | |
| 316 | 316 | $uploaded_filename = $file_obj->uploaded_filename;  | 
                                                        
| 317 | 317 | |
| 318 | -		if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); | 
                                                        |
| 318 | +		if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); | 
                                                        |
| 319 | 319 | |
| 320 | - if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)  | 
                                                        |
| 320 | + if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)  | 
                                                        |
| 321 | 321 |  		{ | 
                                                        
| 322 | 322 | unset($_SESSION[$session_key][$file_srl]);  | 
                                                        
| 323 | 323 |  			return $this->stop('msg_invalid_request'); | 
                                                        
@@ -326,34 +326,34 @@ discard block  | 
                                                    ||
| 326 | 326 | $file_size = $file_obj->file_size;  | 
                                                        
| 327 | 327 | $filename = $file_obj->source_filename;  | 
                                                        
| 328 | 328 | |
| 329 | -		if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) | 
                                                        |
| 329 | +		if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) | 
                                                        |
| 330 | 330 |  		{ | 
                                                        
| 331 | -			if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) | 
                                                        |
| 331 | +			if ($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) | 
                                                        |
| 332 | 332 |  			{ | 
                                                        
| 333 | - $filename_param = 'filename="' . $filename . '"';  | 
                                                        |
| 333 | + $filename_param = 'filename="'.$filename.'"';  | 
                                                        |
| 334 | 334 | }  | 
                                                        
| 335 | 335 | else  | 
                                                        
| 336 | 336 |  			{ | 
                                                        
| 337 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';  | 
                                                        |
| 337 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"';  | 
                                                        |
| 338 | 338 | }  | 
                                                        
| 339 | 339 | }  | 
                                                        
| 340 | -		elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) | 
                                                        |
| 340 | +		elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) | 
                                                        |
| 341 | 341 |  		{ | 
                                                        
| 342 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';  | 
                                                        |
| 342 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"';  | 
                                                        |
| 343 | 343 | }  | 
                                                        
| 344 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)  | 
                                                        |
| 344 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)  | 
                                                        |
| 345 | 345 |  		{ | 
                                                        
| 346 | 346 | $filename = rawurlencode($filename);  | 
                                                        
| 347 | -			$filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; | 
                                                        |
| 347 | +			$filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"'; | 
                                                        |
| 348 | 348 | }  | 
                                                        
| 349 | 349 | else  | 
                                                        
| 350 | 350 |  		{ | 
                                                        
| 351 | - $filename_param = 'filename="' . $filename . '"';  | 
                                                        |
| 351 | + $filename_param = 'filename="'.$filename.'"';  | 
                                                        |
| 352 | 352 | }  | 
                                                        
| 353 | 353 | |
| 354 | - if($is_android)  | 
                                                        |
| 354 | + if ($is_android)  | 
                                                        |
| 355 | 355 |  		{ | 
                                                        
| 356 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;  | 
                                                        |
| 356 | + if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;  | 
                                                        |
| 357 | 357 | }  | 
                                                        
| 358 | 358 | |
| 359 | 359 | unset($_SESSION[$session_key][$file_srl]);  | 
                                                        
@@ -361,21 +361,21 @@ discard block  | 
                                                    ||
| 361 | 361 | Context::close();  | 
                                                        
| 362 | 362 | |
| 363 | 363 | $fp = fopen($uploaded_filename, 'rb');  | 
                                                        
| 364 | -		if(!$fp) return $this->stop('msg_file_not_found'); | 
                                                        |
| 364 | +		if (!$fp) return $this->stop('msg_file_not_found'); | 
                                                        |
| 365 | 365 | |
| 366 | 366 |  		header("Cache-Control: "); | 
                                                        
| 367 | 367 |  		header("Pragma: "); | 
                                                        
| 368 | 368 |  		header("Content-Type: application/octet-stream"); | 
                                                        
| 369 | -		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | 
                                                        |
| 369 | +		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | 
                                                        |
| 370 | 370 | |
| 371 | -		header("Content-Length: " .(string)($file_size)); | 
                                                        |
| 372 | -		header('Content-Disposition: attachment; ' . $filename_param); | 
                                                        |
| 371 | +		header("Content-Length: ".(string) ($file_size)); | 
                                                        |
| 372 | +		header('Content-Disposition: attachment; '.$filename_param); | 
                                                        |
| 373 | 373 |  		header("Content-Transfer-Encoding: binary\n"); | 
                                                        
| 374 | 374 | |
| 375 | 375 | // if file size is lager than 10MB, use fread function (#18675748)  | 
                                                        
| 376 | - if(filesize($uploaded_filename) > 1024 * 1024)  | 
                                                        |
| 376 | + if (filesize($uploaded_filename) > 1024 * 1024)  | 
                                                        |
| 377 | 377 |  		{ | 
                                                        
| 378 | - while(!feof($fp)) echo fread($fp, 1024);  | 
                                                        |
| 378 | + while (!feof($fp)) echo fread($fp, 1024);  | 
                                                        |
| 379 | 379 | fclose($fp);  | 
                                                        
| 380 | 380 | }  | 
                                                        
| 381 | 381 | else  | 
                                                        
@@ -397,36 +397,36 @@ discard block  | 
                                                    ||
| 397 | 397 |  		$editor_sequence = Context::get('editor_sequence'); | 
                                                        
| 398 | 398 |  		$file_srl = Context::get('file_srl'); | 
                                                        
| 399 | 399 |  		$file_srls = Context::get('file_srls'); | 
                                                        
| 400 | - if($file_srls) $file_srl = $file_srls;  | 
                                                        |
| 400 | + if ($file_srls) $file_srl = $file_srls;  | 
                                                        |
| 401 | 401 | // Exit a session if there is neither upload permission nor information  | 
                                                        
| 402 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 402 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();  | 
                                                        |
| 403 | 403 | |
| 404 | 404 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;  | 
                                                        
| 405 | 405 | |
| 406 | 406 |  		$logged_info = Context::get('logged_info'); | 
                                                        
| 407 | 407 |  		$oFileModel = getModel('file'); | 
                                                        
| 408 | 408 | |
| 409 | -		$srls = explode(',',$file_srl); | 
                                                        |
| 410 | - if(!count($srls)) return;  | 
                                                        |
| 409 | +		$srls = explode(',', $file_srl); | 
                                                        |
| 410 | + if (!count($srls)) return;  | 
                                                        |
| 411 | 411 | |
| 412 | - for($i=0;$i<count($srls);$i++)  | 
                                                        |
| 412 | + for ($i = 0; $i < count($srls); $i++)  | 
                                                        |
| 413 | 413 |  		{ | 
                                                        
| 414 | - $srl = (int)$srls[$i];  | 
                                                        |
| 415 | - if(!$srl) continue;  | 
                                                        |
| 414 | + $srl = (int) $srls[$i];  | 
                                                        |
| 415 | + if (!$srl) continue;  | 
                                                        |
| 416 | 416 | |
| 417 | 417 | $args = new stdClass;  | 
                                                        
| 418 | 418 | $args->file_srl = $srl;  | 
                                                        
| 419 | 419 |  			$output = executeQuery('file.getFile', $args); | 
                                                        
| 420 | - if(!$output->toBool()) continue;  | 
                                                        |
| 420 | + if (!$output->toBool()) continue;  | 
                                                        |
| 421 | 421 | |
| 422 | 422 | $file_info = $output->data;  | 
                                                        
| 423 | - if(!$file_info) continue;  | 
                                                        |
| 423 | + if (!$file_info) continue;  | 
                                                        |
| 424 | 424 | |
| 425 | 425 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info);  | 
                                                        
| 426 | 426 | |
| 427 | - if(!$file_grant->is_deletable) continue;  | 
                                                        |
| 427 | + if (!$file_grant->is_deletable) continue;  | 
                                                        |
| 428 | 428 | |
| 429 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);  | 
                                                        |
| 429 | + if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);  | 
                                                        |
| 430 | 430 | }  | 
                                                        
| 431 | 431 | }  | 
                                                        
| 432 | 432 | |
@@ -437,32 +437,32 @@ discard block  | 
                                                    ||
| 437 | 437 | */  | 
                                                        
| 438 | 438 | function procFileGetList()  | 
                                                        
| 439 | 439 |  	{ | 
                                                        
| 440 | -		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); | 
                                                        |
| 440 | +		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); | 
                                                        |
| 441 | 441 | |
| 442 | 442 |  		$oModuleModel = getModel('module'); | 
                                                        
| 443 | 443 | |
| 444 | 444 |  		$logged_info = Context::get('logged_info'); | 
                                                        
| 445 | - if($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info))  | 
                                                        |
| 445 | + if ($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info))  | 
                                                        |
| 446 | 446 |  		{ | 
                                                        
| 447 | 447 | return new Object(-1, 'msg_not_permitted');  | 
                                                        
| 448 | 448 | }  | 
                                                        
| 449 | 449 | |
| 450 | 450 |  		$fileSrls = Context::get('file_srls'); | 
                                                        
| 451 | -		if($fileSrls) $fileSrlList = explode(',', $fileSrls); | 
                                                        |
| 451 | +		if ($fileSrls) $fileSrlList = explode(',', $fileSrls); | 
                                                        |
| 452 | 452 | |
| 453 | 453 | global $lang;  | 
                                                        
| 454 | - if(count($fileSrlList) > 0)  | 
                                                        |
| 454 | + if (count($fileSrlList) > 0)  | 
                                                        |
| 455 | 455 |  		{ | 
                                                        
| 456 | 456 |  			$oFileModel = getModel('file'); | 
                                                        
| 457 | 457 | $fileList = $oFileModel->getFile($fileSrlList);  | 
                                                        
| 458 | - if(!is_array($fileList)) $fileList = array($fileList);  | 
                                                        |
| 458 | + if (!is_array($fileList)) $fileList = array($fileList);  | 
                                                        |
| 459 | 459 | |
| 460 | - if(is_array($fileList))  | 
                                                        |
| 460 | + if (is_array($fileList))  | 
                                                        |
| 461 | 461 |  			{ | 
                                                        
| 462 | - foreach($fileList AS $key=>$value)  | 
                                                        |
| 462 | + foreach ($fileList AS $key=>$value)  | 
                                                        |
| 463 | 463 |  				{ | 
                                                        
| 464 | 464 | $value->human_file_size = FileHandler::filesize($value->file_size);  | 
                                                        
| 465 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid;  | 
                                                        |
| 465 | + if ($value->isvalid == 'Y') $value->validName = $lang->is_valid;  | 
                                                        |
| 466 | 466 | else $value->validName = $lang->is_stand_by;  | 
                                                        
| 467 | 467 | }  | 
                                                        
| 468 | 468 | }  | 
                                                        
@@ -484,7 +484,7 @@ discard block  | 
                                                    ||
| 484 | 484 | function triggerCheckAttached(&$obj)  | 
                                                        
| 485 | 485 |  	{ | 
                                                        
| 486 | 486 | $document_srl = $obj->document_srl;  | 
                                                        
| 487 | - if(!$document_srl) return new Object();  | 
                                                        |
| 487 | + if (!$document_srl) return new Object();  | 
                                                        |
| 488 | 488 | // Get numbers of attachments  | 
                                                        
| 489 | 489 |  		$oFileModel = getModel('file'); | 
                                                        
| 490 | 490 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl);  | 
                                                        
@@ -501,10 +501,10 @@ discard block  | 
                                                    ||
| 501 | 501 | function triggerAttachFiles(&$obj)  | 
                                                        
| 502 | 502 |  	{ | 
                                                        
| 503 | 503 | $document_srl = $obj->document_srl;  | 
                                                        
| 504 | - if(!$document_srl) return new Object();  | 
                                                        |
| 504 | + if (!$document_srl) return new Object();  | 
                                                        |
| 505 | 505 | |
| 506 | 506 | $output = $this->setFilesValid($document_srl);  | 
                                                        
| 507 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 507 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 508 | 508 | |
| 509 | 509 | return new Object();  | 
                                                        
| 510 | 510 | }  | 
                                                        
@@ -518,7 +518,7 @@ discard block  | 
                                                    ||
| 518 | 518 | function triggerDeleteAttached(&$obj)  | 
                                                        
| 519 | 519 |  	{ | 
                                                        
| 520 | 520 | $document_srl = $obj->document_srl;  | 
                                                        
| 521 | - if(!$document_srl) return new Object();  | 
                                                        |
| 521 | + if (!$document_srl) return new Object();  | 
                                                        |
| 522 | 522 | |
| 523 | 523 | $output = $this->deleteFiles($document_srl);  | 
                                                        
| 524 | 524 | return $output;  | 
                                                        
@@ -533,7 +533,7 @@ discard block  | 
                                                    ||
| 533 | 533 | function triggerCommentCheckAttached(&$obj)  | 
                                                        
| 534 | 534 |  	{ | 
                                                        
| 535 | 535 | $comment_srl = $obj->comment_srl;  | 
                                                        
| 536 | - if(!$comment_srl) return new Object();  | 
                                                        |
| 536 | + if (!$comment_srl) return new Object();  | 
                                                        |
| 537 | 537 | // Get numbers of attachments  | 
                                                        
| 538 | 538 |  		$oFileModel = getModel('file'); | 
                                                        
| 539 | 539 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);  | 
                                                        
@@ -551,10 +551,10 @@ discard block  | 
                                                    ||
| 551 | 551 |  	{ | 
                                                        
| 552 | 552 | $comment_srl = $obj->comment_srl;  | 
                                                        
| 553 | 553 | $uploaded_count = $obj->uploaded_count;  | 
                                                        
| 554 | - if(!$comment_srl || !$uploaded_count) return new Object();  | 
                                                        |
| 554 | + if (!$comment_srl || !$uploaded_count) return new Object();  | 
                                                        |
| 555 | 555 | |
| 556 | 556 | $output = $this->setFilesValid($comment_srl);  | 
                                                        
| 557 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 557 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 558 | 558 | |
| 559 | 559 | return new Object();  | 
                                                        
| 560 | 560 | }  | 
                                                        
@@ -568,9 +568,9 @@ discard block  | 
                                                    ||
| 568 | 568 | function triggerCommentDeleteAttached(&$obj)  | 
                                                        
| 569 | 569 |  	{ | 
                                                        
| 570 | 570 | $comment_srl = $obj->comment_srl;  | 
                                                        
| 571 | - if(!$comment_srl) return new Object();  | 
                                                        |
| 571 | + if (!$comment_srl) return new Object();  | 
                                                        |
| 572 | 572 | |
| 573 | - if($obj->isMoveToTrash) return new Object();  | 
                                                        |
| 573 | + if ($obj->isMoveToTrash) return new Object();  | 
                                                        |
| 574 | 574 | |
| 575 | 575 | $output = $this->deleteFiles($comment_srl);  | 
                                                        
| 576 | 576 | return $output;  | 
                                                        
@@ -585,7 +585,7 @@ discard block  | 
                                                    ||
| 585 | 585 | function triggerDeleteModuleFiles(&$obj)  | 
                                                        
| 586 | 586 |  	{ | 
                                                        
| 587 | 587 | $module_srl = $obj->module_srl;  | 
                                                        
| 588 | - if(!$module_srl) return new Object();  | 
                                                        |
| 588 | + if (!$module_srl) return new Object();  | 
                                                        |
| 589 | 589 | |
| 590 | 590 |  		$oFileController = getAdminController('file'); | 
                                                        
| 591 | 591 | return $oFileController->deleteModuleFiles($module_srl);  | 
                                                        
@@ -598,9 +598,9 @@ discard block  | 
                                                    ||
| 598 | 598 | * @param int $upload_target_srl  | 
                                                        
| 599 | 599 | * @return void  | 
                                                        
| 600 | 600 | */  | 
                                                        
| 601 | - function setUploadInfo($editor_sequence, $upload_target_srl=0)  | 
                                                        |
| 601 | + function setUploadInfo($editor_sequence, $upload_target_srl = 0)  | 
                                                        |
| 602 | 602 |  	{ | 
                                                        
| 603 | - if(!isset($_SESSION['upload_info'][$editor_sequence]))  | 
                                                        |
| 603 | + if (!isset($_SESSION['upload_info'][$editor_sequence]))  | 
                                                        |
| 604 | 604 |  		{ | 
                                                        
| 605 | 605 | $_SESSION['upload_info'][$editor_sequence] = new stdClass();  | 
                                                        
| 606 | 606 | }  | 
                                                        
@@ -660,36 +660,36 @@ discard block  | 
                                                    ||
| 660 | 660 | $trigger_obj->module_srl = $module_srl;  | 
                                                        
| 661 | 661 | $trigger_obj->upload_target_srl = $upload_target_srl;  | 
                                                        
| 662 | 662 |  		$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); | 
                                                        
| 663 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 663 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 664 | 664 | |
| 665 | 665 | // A workaround for Firefox upload bug  | 
                                                        
| 666 | -		if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) | 
                                                        |
| 666 | +		if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) | 
                                                        |
| 667 | 667 |  		{ | 
                                                        
| 668 | 668 | $file_info['name'] = base64_decode(strtr($match[1], ':', '/'));  | 
                                                        
| 669 | 669 | }  | 
                                                        
| 670 | 670 | |
| 671 | - if(!$manual_insert)  | 
                                                        |
| 671 | + if (!$manual_insert)  | 
                                                        |
| 672 | 672 |  		{ | 
                                                        
| 673 | 673 | // Get the file configurations  | 
                                                        
| 674 | 674 |  			$logged_info = Context::get('logged_info'); | 
                                                        
| 675 | - if($logged_info->is_admin != 'Y')  | 
                                                        |
| 675 | + if ($logged_info->is_admin != 'Y')  | 
                                                        |
| 676 | 676 |  			{ | 
                                                        
| 677 | 677 |  				$oFileModel = getModel('file'); | 
                                                        
| 678 | 678 | $config = $oFileModel->getFileConfig($module_srl);  | 
                                                        
| 679 | 679 | |
| 680 | 680 | // check file type  | 
                                                        
| 681 | - if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*')  | 
                                                        |
| 681 | + if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*')  | 
                                                        |
| 682 | 682 |  				{ | 
                                                        
| 683 | 683 |  					$filetypes = explode(';', $config->allowed_filetypes); | 
                                                        
| 684 | 684 | $ext = array();  | 
                                                        
| 685 | -					foreach($filetypes as $item) { | 
                                                        |
| 685 | +					foreach ($filetypes as $item) { | 
                                                        |
| 686 | 686 |  						$item = explode('.', $item); | 
                                                        
| 687 | 687 | $ext[] = strtolower($item[1]);  | 
                                                        
| 688 | 688 | }  | 
                                                        
| 689 | 689 |  					$uploaded_ext = explode('.', $file_info['name']); | 
                                                        
| 690 | 690 | $uploaded_ext = strtolower(array_pop($uploaded_ext));  | 
                                                        
| 691 | 691 | |
| 692 | - if(!in_array($uploaded_ext, $ext))  | 
                                                        |
| 692 | + if (!in_array($uploaded_ext, $ext))  | 
                                                        |
| 693 | 693 |  					{ | 
                                                        
| 694 | 694 |  						return $this->stop('msg_not_allowed_filetype'); | 
                                                        
| 695 | 695 | }  | 
                                                        
@@ -698,63 +698,63 @@ discard block  | 
                                                    ||
| 698 | 698 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024;  | 
                                                        
| 699 | 699 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;  | 
                                                        
| 700 | 700 | // An error appears if file size exceeds a limit  | 
                                                        
| 701 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size');  | 
                                                        |
| 701 | + if ($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size');  | 
                                                        |
| 702 | 702 | // Get total file size of all attachements (from DB)  | 
                                                        
| 703 | 703 | $size_args = new stdClass;  | 
                                                        
| 704 | 704 | $size_args->upload_target_srl = $upload_target_srl;  | 
                                                        
| 705 | 705 |  				$output = executeQuery('file.getAttachedFileSize', $size_args); | 
                                                        
| 706 | - $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);  | 
                                                        |
| 707 | - if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size');  | 
                                                        |
| 706 | + $attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']);  | 
                                                        |
| 707 | + if ($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size');  | 
                                                        |
| 708 | 708 | }  | 
                                                        
| 709 | 709 | }  | 
                                                        
| 710 | 710 | |
| 711 | 711 | // https://github.com/xpressengine/xe-core/issues/1713  | 
                                                        
| 712 | -		$file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); | 
                                                        |
| 712 | +		$file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); | 
                                                        |
| 713 | 713 | $file_info['name'] = removeHackTag($file_info['name']);  | 
                                                        
| 714 | -		$file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); | 
                                                        |
| 714 | +		$file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); | 
                                                        |
| 715 | 715 | |
| 716 | 716 | // Get random number generator  | 
                                                        
| 717 | 717 | $random = new Password();  | 
                                                        
| 718 | 718 | |
| 719 | 719 | // Set upload path by checking if the attachement is an image or other kinds of file  | 
                                                        
| 720 | -		if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) | 
                                                        |
| 720 | +		if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) | 
                                                        |
| 721 | 721 |  		{ | 
                                                        
| 722 | -			$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); | 
                                                        |
| 722 | +			$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        |
| 723 | 723 | |
| 724 | 724 | // special character to '_'  | 
                                                        
| 725 | 725 | // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter  | 
                                                        
| 726 | - $ext = substr(strrchr($file_info['name'],'.'),1);  | 
                                                        |
| 726 | + $ext = substr(strrchr($file_info['name'], '.'), 1);  | 
                                                        |
| 727 | 727 |  			//$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); | 
                                                        
| 728 | 728 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext;  | 
                                                        
| 729 | 729 | $filename = $path.$_filename;  | 
                                                        
| 730 | 730 | $idx = 1;  | 
                                                        
| 731 | - while(file_exists($filename))  | 
                                                        |
| 731 | + while (file_exists($filename))  | 
                                                        |
| 732 | 732 |  			{ | 
                                                        
| 733 | -				$filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename); | 
                                                        |
| 733 | +				$filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); | 
                                                        |
| 734 | 734 | $idx++;  | 
                                                        
| 735 | 735 | }  | 
                                                        
| 736 | 736 | $direct_download = 'Y';  | 
                                                        
| 737 | 737 | }  | 
                                                        
| 738 | 738 | else  | 
                                                        
| 739 | 739 |  		{ | 
                                                        
| 740 | -			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); | 
                                                        |
| 740 | +			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        |
| 741 | 741 | $filename = $path.$random->createSecureSalt(32, 'hex');  | 
                                                        
| 742 | 742 | $direct_download = 'N';  | 
                                                        
| 743 | 743 | }  | 
                                                        
| 744 | 744 | // Create a directory  | 
                                                        
| 745 | - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create');  | 
                                                        |
| 745 | + if (!FileHandler::makeDir($path)) return new Object(-1, 'msg_not_permitted_create');  | 
                                                        |
| 746 | 746 | |
| 747 | 747 | // Check uploaded file  | 
                                                        
| 748 | - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error');  | 
                                                        |
| 748 | + if (!checkUploadedFile($file_info['tmp_name'])) return new Object(-1, 'msg_file_upload_error');  | 
                                                        |
| 749 | 749 | |
| 750 | 750 | // Get random number generator  | 
                                                        
| 751 | 751 | $random = new Password();  | 
                                                        
| 752 | 752 | |
| 753 | 753 | // Move the file  | 
                                                        
| 754 | - if($manual_insert)  | 
                                                        |
| 754 | + if ($manual_insert)  | 
                                                        |
| 755 | 755 |  		{ | 
                                                        
| 756 | 756 | @copy($file_info['tmp_name'], $filename);  | 
                                                        
| 757 | - if(!file_exists($filename))  | 
                                                        |
| 757 | + if (!file_exists($filename))  | 
                                                        |
| 758 | 758 |  			{ | 
                                                        
| 759 | 759 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;  | 
                                                        
| 760 | 760 | @copy($file_info['tmp_name'], $filename);  | 
                                                        
@@ -762,10 +762,10 @@ discard block  | 
                                                    ||
| 762 | 762 | }  | 
                                                        
| 763 | 763 | else  | 
                                                        
| 764 | 764 |  		{ | 
                                                        
| 765 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename))  | 
                                                        |
| 765 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename))  | 
                                                        |
| 766 | 766 |  			{ | 
                                                        
| 767 | 767 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;  | 
                                                        
| 768 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error');  | 
                                                        |
| 768 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1, 'msg_file_upload_error');  | 
                                                        |
| 769 | 769 | }  | 
                                                        
| 770 | 770 | }  | 
                                                        
| 771 | 771 | // Get member information  | 
                                                        
@@ -786,10 +786,10 @@ discard block  | 
                                                    ||
| 786 | 786 | $args->sid = $random->createSecureSalt(32, 'hex');  | 
                                                        
| 787 | 787 | |
| 788 | 788 |  		$output = executeQuery('file.insertFile', $args); | 
                                                        
| 789 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 789 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 790 | 790 | // Call a trigger (after)  | 
                                                        
| 791 | 791 |  		$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); | 
                                                        
| 792 | - if(!$trigger_output->toBool()) return $trigger_output;  | 
                                                        |
| 792 | + if (!$trigger_output->toBool()) return $trigger_output;  | 
                                                        |
| 793 | 793 | |
| 794 | 794 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true;  | 
                                                        
| 795 | 795 | |
@@ -832,18 +832,18 @@ discard block  | 
                                                    ||
| 832 | 832 | */  | 
                                                        
| 833 | 833 | function deleteFile($file_srl)  | 
                                                        
| 834 | 834 |  	{ | 
                                                        
| 835 | - if(!$file_srl) return;  | 
                                                        |
| 835 | + if (!$file_srl) return;  | 
                                                        |
| 836 | 836 | |
| 837 | 837 |  		$srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); | 
                                                        
| 838 | - if(!count($srls)) return;  | 
                                                        |
| 838 | + if (!count($srls)) return;  | 
                                                        |
| 839 | 839 | |
| 840 | 840 |  		$oDocumentController = getController('document'); | 
                                                        
| 841 | 841 | $documentSrlList = array();  | 
                                                        
| 842 | 842 | |
| 843 | - foreach($srls as $srl)  | 
                                                        |
| 843 | + foreach ($srls as $srl)  | 
                                                        |
| 844 | 844 |  		{ | 
                                                        
| 845 | - $srl = (int)$srl;  | 
                                                        |
| 846 | - if(!$srl)  | 
                                                        |
| 845 | + $srl = (int) $srl;  | 
                                                        |
| 846 | + if (!$srl)  | 
                                                        |
| 847 | 847 |  			{ | 
                                                        
| 848 | 848 | continue;  | 
                                                        
| 849 | 849 | }  | 
                                                        
@@ -852,14 +852,14 @@ discard block  | 
                                                    ||
| 852 | 852 | $args->file_srl = $srl;  | 
                                                        
| 853 | 853 |  			$output = executeQuery('file.getFile', $args); | 
                                                        
| 854 | 854 | |
| 855 | - if(!$output->toBool() || !$output->data)  | 
                                                        |
| 855 | + if (!$output->toBool() || !$output->data)  | 
                                                        |
| 856 | 856 |  			{ | 
                                                        
| 857 | 857 | continue;  | 
                                                        
| 858 | 858 | }  | 
                                                        
| 859 | 859 | |
| 860 | 860 | $file_info = $output->data;  | 
                                                        
| 861 | 861 | |
| 862 | - if($file_info->upload_target_srl)  | 
                                                        |
| 862 | + if ($file_info->upload_target_srl)  | 
                                                        |
| 863 | 863 |  			{ | 
                                                        
| 864 | 864 | $documentSrlList[] = $file_info->upload_target_srl;  | 
                                                        
| 865 | 865 | }  | 
                                                        
@@ -870,15 +870,15 @@ discard block  | 
                                                    ||
| 870 | 870 | // Call a trigger (before)  | 
                                                        
| 871 | 871 | $trigger_obj = $output->data;  | 
                                                        
| 872 | 872 |  			$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); | 
                                                        
| 873 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 873 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 874 | 874 | |
| 875 | 875 | // Remove from the DB  | 
                                                        
| 876 | 876 |  			$output = executeQuery('file.deleteFile', $args); | 
                                                        
| 877 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 877 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 878 | 878 | |
| 879 | 879 | // Call a trigger (after)  | 
                                                        
| 880 | 880 |  			$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); | 
                                                        
| 881 | - if(!$trigger_output->toBool()) return $trigger_output;  | 
                                                        |
| 881 | + if (!$trigger_output->toBool()) return $trigger_output;  | 
                                                        |
| 882 | 882 | |
| 883 | 883 | // If successfully deleted, remove the file  | 
                                                        
| 884 | 884 | FileHandler::removeFile($uploaded_filename);  | 
                                                        
@@ -902,28 +902,28 @@ discard block  | 
                                                    ||
| 902 | 902 |  		$columnList = array('file_srl', 'uploaded_filename', 'module_srl'); | 
                                                        
| 903 | 903 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList);  | 
                                                        
| 904 | 904 | // Success returned if no attachement exists  | 
                                                        
| 905 | - if(!is_array($file_list)||!count($file_list)) return new Object();  | 
                                                        |
| 905 | + if (!is_array($file_list) || !count($file_list)) return new Object();  | 
                                                        |
| 906 | 906 | |
| 907 | 907 | // Delete the file  | 
                                                        
| 908 | 908 | $path = array();  | 
                                                        
| 909 | 909 | $file_count = count($file_list);  | 
                                                        
| 910 | - for($i=0;$i<$file_count;$i++)  | 
                                                        |
| 910 | + for ($i = 0; $i < $file_count; $i++)  | 
                                                        |
| 911 | 911 |  		{ | 
                                                        
| 912 | 912 | $this->deleteFile($file_list[$i]->file_srl);  | 
                                                        
| 913 | 913 | |
| 914 | 914 | $uploaded_filename = $file_list[$i]->uploaded_filename;  | 
                                                        
| 915 | 915 | $path_info = pathinfo($uploaded_filename);  | 
                                                        
| 916 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];  | 
                                                        |
| 916 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];  | 
                                                        |
| 917 | 917 | }  | 
                                                        
| 918 | 918 | |
| 919 | 919 | // Remove from the DB  | 
                                                        
| 920 | 920 | $args = new stdClass();  | 
                                                        
| 921 | 921 | $args->upload_target_srl = $upload_target_srl;  | 
                                                        
| 922 | 922 |  		$output = executeQuery('file.deleteFiles', $args); | 
                                                        
| 923 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 923 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 924 | 924 | |
| 925 | 925 | // Remove a file directory of the document  | 
                                                        
| 926 | - for($i=0, $c=count($path); $i<$c; $i++)  | 
                                                        |
| 926 | + for ($i = 0, $c = count($path); $i < $c; $i++)  | 
                                                        |
| 927 | 927 |  		{ | 
                                                        
| 928 | 928 | FileHandler::removeBlankDir($path[$i]);  | 
                                                        
| 929 | 929 | }  | 
                                                        
@@ -941,23 +941,23 @@ discard block  | 
                                                    ||
| 941 | 941 | */  | 
                                                        
| 942 | 942 | function moveFile($source_srl, $target_module_srl, $target_srl)  | 
                                                        
| 943 | 943 |  	{ | 
                                                        
| 944 | - if($source_srl == $target_srl) return;  | 
                                                        |
| 944 | + if ($source_srl == $target_srl) return;  | 
                                                        |
| 945 | 945 | |
| 946 | 946 |  		$oFileModel = getModel('file'); | 
                                                        
| 947 | 947 | $file_list = $oFileModel->getFiles($source_srl);  | 
                                                        
| 948 | - if(!$file_list) return;  | 
                                                        |
| 948 | + if (!$file_list) return;  | 
                                                        |
| 949 | 949 | |
| 950 | 950 | $file_count = count($file_list);  | 
                                                        
| 951 | 951 | |
| 952 | - for($i=0;$i<$file_count;$i++)  | 
                                                        |
| 952 | + for ($i = 0; $i < $file_count; $i++)  | 
                                                        |
| 953 | 953 |  		{ | 
                                                        
| 954 | 954 | unset($file_info);  | 
                                                        
| 955 | 955 | $file_info = $file_list[$i];  | 
                                                        
| 956 | 956 | $old_file = $file_info->uploaded_filename;  | 
                                                        
| 957 | 957 | // Determine the file path by checking if the file is an image or other kinds  | 
                                                        
| 958 | -			if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) | 
                                                        |
| 958 | +			if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) | 
                                                        |
| 959 | 959 |  			{ | 
                                                        
| 960 | -				$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); | 
                                                        |
| 960 | +				$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl); | 
                                                        |
| 961 | 961 | $new_file = $path.$file_info->source_filename;  | 
                                                        
| 962 | 962 | }  | 
                                                        
| 963 | 963 | else  | 
                                                        
@@ -967,7 +967,7 @@ discard block  | 
                                                    ||
| 967 | 967 | $new_file = $path.$random->createSecureSalt(32, 'hex');  | 
                                                        
| 968 | 968 | }  | 
                                                        
| 969 | 969 | // Pass if a target document to move is same  | 
                                                        
| 970 | - if($old_file == $new_file) continue;  | 
                                                        |
| 970 | + if ($old_file == $new_file) continue;  | 
                                                        |
| 971 | 971 | // Create a directory  | 
                                                        
| 972 | 972 | FileHandler::makeDir($path);  | 
                                                        
| 973 | 973 | // Move the file  | 
                                                        
@@ -987,18 +987,18 @@ discard block  | 
                                                    ||
| 987 | 987 | $vars = Context::getRequestVars();  | 
                                                        
| 988 | 988 |  		$logged_info = Context::get('logged_info'); | 
                                                        
| 989 | 989 | |
| 990 | - if(!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 990 | + if (!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 991 | 991 | |
| 992 | 992 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl;  | 
                                                        
| 993 | 993 | |
| 994 | 994 |  		$oFileModel = getModel('file'); | 
                                                        
| 995 | 995 | $file_info = $oFileModel->getFile($vars->file_srl);  | 
                                                        
| 996 | 996 | |
| 997 | - if(!$file_info) return new Object(-1, 'msg_not_founded');  | 
                                                        |
| 997 | + if (!$file_info) return new Object(-1, 'msg_not_founded');  | 
                                                        |
| 998 | 998 | |
| 999 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');  | 
                                                        |
| 999 | + if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted');  | 
                                                        |
| 1000 | 1000 | |
| 1001 | - $args = new stdClass();  | 
                                                        |
| 1001 | + $args = new stdClass();  | 
                                                        |
| 1002 | 1002 | $args->file_srl = $vars->file_srl;  | 
                                                        
| 1003 | 1003 | $args->upload_target_srl = $upload_target_srl;  | 
                                                        
| 1004 | 1004 | |
@@ -1007,18 +1007,18 @@ discard block  | 
                                                    ||
| 1007 | 1007 | |
| 1008 | 1008 | $args->cover_image = 'N';  | 
                                                        
| 1009 | 1009 |  		$output = executeQuery('file.updateClearCoverImage', $args); | 
                                                        
| 1010 | - if(!$output->toBool())  | 
                                                        |
| 1010 | + if (!$output->toBool())  | 
                                                        |
| 1011 | 1011 |  		{ | 
                                                        
| 1012 | 1012 | $oDB->rollback();  | 
                                                        
| 1013 | 1013 | return $output;  | 
                                                        
| 1014 | 1014 | }  | 
                                                        
| 1015 | 1015 | |
| 1016 | - if($file_info->cover_image != 'Y')  | 
                                                        |
| 1016 | + if ($file_info->cover_image != 'Y')  | 
                                                        |
| 1017 | 1017 |  		{ | 
                                                        
| 1018 | 1018 | |
| 1019 | 1019 | $args->cover_image = 'Y';  | 
                                                        
| 1020 | 1020 |  			$output = executeQuery('file.updateCoverImage', $args); | 
                                                        
| 1021 | - if(!$output->toBool())  | 
                                                        |
| 1021 | + if (!$output->toBool())  | 
                                                        |
| 1022 | 1022 |  			{ | 
                                                        
| 1023 | 1023 | $oDB->rollback();  | 
                                                        
| 1024 | 1024 | return $output;  | 
                                                        
@@ -1028,7 +1028,7 @@ discard block  | 
                                                    ||
| 1028 | 1028 | |
| 1029 | 1029 | $oDB->commit();  | 
                                                        
| 1030 | 1030 | |
| 1031 | -		$this->add('is_cover',$args->cover_image); | 
                                                        |
| 1031 | +		$this->add('is_cover', $args->cover_image); | 
                                                        |
| 1032 | 1032 | |
| 1033 | 1033 | // 썸네일 삭제  | 
                                                        
| 1034 | 1034 |  		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3)); | 
                                                        
@@ -1054,9 +1054,9 @@ discard block  | 
                                                    ||
| 1054 | 1054 |  		$fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl); | 
                                                        
| 1055 | 1055 | |
| 1056 | 1056 |  		$oModuleController = getController('module'); | 
                                                        
| 1057 | - if(is_array($obj->moduleSrlList))  | 
                                                        |
| 1057 | + if (is_array($obj->moduleSrlList))  | 
                                                        |
| 1058 | 1058 |  		{ | 
                                                        
| 1059 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl)  | 
                                                        |
| 1059 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl)  | 
                                                        |
| 1060 | 1060 |  			{ | 
                                                        
| 1061 | 1061 |  				$oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig); | 
                                                        
| 1062 | 1062 | }  | 
                                                        
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 | */  | 
                                                        
| 55 | 55 | function isSsl()  | 
                                                        
| 56 | 56 |  	{ | 
                                                        
| 57 | - if(!is_null(self::$isSSL))  | 
                                                        |
| 57 | + if (!is_null(self::$isSSL))  | 
                                                        |
| 58 | 58 |  		{ | 
                                                        
| 59 | 59 | return self::$isSSL;  | 
                                                        
| 60 | 60 | }  | 
                                                        
@@ -88,30 +88,30 @@ discard block  | 
                                                    ||
| 88 | 88 | * */  | 
                                                        
| 89 | 89 | function loadFile($args)  | 
                                                        
| 90 | 90 |  	{ | 
                                                        
| 91 | - if(!is_array($args))  | 
                                                        |
| 91 | + if (!is_array($args))  | 
                                                        |
| 92 | 92 |  		{ | 
                                                        
| 93 | 93 | $args = array($args);  | 
                                                        
| 94 | 94 | }  | 
                                                        
| 95 | 95 | $file = $this->getFileInfo($args[0], $args[2], $args[1]);  | 
                                                        
| 96 | 96 | |
| 97 | 97 |  		$availableExtension = array('css' => 1, 'js' => 1); | 
                                                        
| 98 | - if(!isset($availableExtension[$file->fileExtension]))  | 
                                                        |
| 98 | + if (!isset($availableExtension[$file->fileExtension]))  | 
                                                        |
| 99 | 99 |  		{ | 
                                                        
| 100 | 100 | return;  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | |
| 103 | 103 | $file->index = (int) $args[3];  | 
                                                        
| 104 | 104 | |
| 105 | - if($file->fileExtension == 'css')  | 
                                                        |
| 105 | + if ($file->fileExtension == 'css')  | 
                                                        |
| 106 | 106 |  		{ | 
                                                        
| 107 | 107 | $map = &$this->cssMap;  | 
                                                        
| 108 | 108 | $mapIndex = &$this->cssMapIndex;  | 
                                                        
| 109 | 109 | |
| 110 | 110 | $this->_arrangeCssIndex($pathInfo['dirname'], $file);  | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | - else if($file->fileExtension == 'js')  | 
                                                        |
| 112 | + else if ($file->fileExtension == 'js')  | 
                                                        |
| 113 | 113 |  		{ | 
                                                        
| 114 | - if($args[1] == 'body')  | 
                                                        |
| 114 | + if ($args[1] == 'body')  | 
                                                        |
| 115 | 115 |  			{ | 
                                                        
| 116 | 116 | $map = &$this->jsBodyMap;  | 
                                                        
| 117 | 117 | $mapIndex = &$this->jsBodyMapIndex;  | 
                                                        
@@ -124,7 +124,7 @@ discard block  | 
                                                    ||
| 124 | 124 | }  | 
                                                        
| 125 | 125 | |
| 126 | 126 | (is_null($file->index)) ? $file->index = 0 : $file->index = $file->index;  | 
                                                        
| 127 | - if(!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index)  | 
                                                        |
| 127 | + if (!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index)  | 
                                                        |
| 128 | 128 |  		{ | 
                                                        
| 129 | 129 | $this->unloadFile($args[0], $args[2], $args[1]);  | 
                                                        
| 130 | 130 | $map[$file->index][$file->key] = $file;  | 
                                                        
@@ -144,14 +144,14 @@ discard block  | 
                                                    ||
| 144 | 144 |  	{ | 
                                                        
| 145 | 145 | static $existsInfo = array();  | 
                                                        
| 146 | 146 | |
| 147 | - if(isset($existsInfo[$existsKey]))  | 
                                                        |
| 147 | + if (isset($existsInfo[$existsKey]))  | 
                                                        |
| 148 | 148 |  		{ | 
                                                        
| 149 | 149 | return $existsInfo[$existsKey];  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | 152 |  		$fileName = preg_replace('/(?:[\/]{3,})(.*)/', '//$1', $fileName); | 
                                                        
| 153 | 153 | $url_info = parse_url($fileName);  | 
                                                        
| 154 | -		$pathInfo = pathinfo(str_replace('?' . $url_info['query'], '', $fileName)); | 
                                                        |
| 154 | +		$pathInfo = pathinfo(str_replace('?'.$url_info['query'], '', $fileName)); | 
                                                        |
| 155 | 155 | |
| 156 | 156 | $file = new stdClass();  | 
                                                        
| 157 | 157 | $file->fileName = basename($url_info['path']);  | 
                                                        
@@ -164,14 +164,14 @@ discard block  | 
                                                    ||
| 164 | 164 |  		$file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension)); | 
                                                        
| 165 | 165 | $file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);  | 
                                                        
| 166 | 166 | |
| 167 | - if(!$file->external)  | 
                                                        |
| 167 | + if (!$file->external)  | 
                                                        |
| 168 | 168 |  		{ | 
                                                        
| 169 | - if(!__DEBUG__ && __XE_VERSION_STABLE__)  | 
                                                        |
| 169 | + if (!__DEBUG__ && __XE_VERSION_STABLE__)  | 
                                                        |
| 170 | 170 |  			{ | 
                                                        
| 171 | 171 | // if no debug mode, load minifed file  | 
                                                        
| 172 | 172 |  				$minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension)); | 
                                                        
| 173 | 173 |  				$minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName)); | 
                                                        
| 174 | - if(file_exists($minifiedRealPath))  | 
                                                        |
| 174 | + if (file_exists($minifiedRealPath))  | 
                                                        |
| 175 | 175 |  				{ | 
                                                        
| 176 | 176 | $file->fileName = $minifiedFileName;  | 
                                                        
| 177 | 177 | }  | 
                                                        
@@ -179,7 +179,7 @@ discard block  | 
                                                    ||
| 179 | 179 | else  | 
                                                        
| 180 | 180 |  			{ | 
                                                        
| 181 | 181 | // Remove .min  | 
                                                        
| 182 | -				if(file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) | 
                                                        |
| 182 | +				if (file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) | 
                                                        |
| 183 | 183 |  				{ | 
                                                        
| 184 | 184 | $file->fileName = $file->keyName;  | 
                                                        
| 185 | 185 | }  | 
                                                        
@@ -188,18 +188,18 @@ discard block  | 
                                                    ||
| 188 | 188 | |
| 189 | 189 | $file->targetIe = $targetIe;  | 
                                                        
| 190 | 190 | |
| 191 | - if($file->fileExtension == 'css')  | 
                                                        |
| 191 | + if ($file->fileExtension == 'css')  | 
                                                        |
| 192 | 192 |  		{ | 
                                                        
| 193 | 193 | $file->media = $media;  | 
                                                        
| 194 | - if(!$file->media)  | 
                                                        |
| 194 | + if (!$file->media)  | 
                                                        |
| 195 | 195 |  			{ | 
                                                        
| 196 | 196 | $file->media = 'all';  | 
                                                        
| 197 | 197 | }  | 
                                                        
| 198 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media;  | 
                                                        |
| 198 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe."\t".$file->media;  | 
                                                        |
| 199 | 199 | }  | 
                                                        
| 200 | - else if($file->fileExtension == 'js')  | 
                                                        |
| 200 | + else if ($file->fileExtension == 'js')  | 
                                                        |
| 201 | 201 |  		{ | 
                                                        
| 202 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe;  | 
                                                        |
| 202 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe;  | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | 204 | |
| 205 | 205 | return $file;  | 
                                                        
@@ -217,9 +217,9 @@ discard block  | 
                                                    ||
| 217 | 217 |  	{ | 
                                                        
| 218 | 218 | $file = $this->getFileInfo($fileName, $targetIe, $media);  | 
                                                        
| 219 | 219 | |
| 220 | - if($file->fileExtension == 'css')  | 
                                                        |
| 220 | + if ($file->fileExtension == 'css')  | 
                                                        |
| 221 | 221 |  		{ | 
                                                        
| 222 | - if(isset($this->cssMapIndex[$file->key]))  | 
                                                        |
| 222 | + if (isset($this->cssMapIndex[$file->key]))  | 
                                                        |
| 223 | 223 |  			{ | 
                                                        
| 224 | 224 | $index = $this->cssMapIndex[$file->key];  | 
                                                        
| 225 | 225 | unset($this->cssMap[$index][$file->key], $this->cssMapIndex[$file->key]);  | 
                                                        
@@ -227,12 +227,12 @@ discard block  | 
                                                    ||
| 227 | 227 | }  | 
                                                        
| 228 | 228 | else  | 
                                                        
| 229 | 229 |  		{ | 
                                                        
| 230 | - if(isset($this->jsHeadMapIndex[$file->key]))  | 
                                                        |
| 230 | + if (isset($this->jsHeadMapIndex[$file->key]))  | 
                                                        |
| 231 | 231 |  			{ | 
                                                        
| 232 | 232 | $index = $this->jsHeadMapIndex[$file->key];  | 
                                                        
| 233 | 233 | unset($this->jsHeadMap[$index][$file->key], $this->jsHeadMapIndex[$file->key]);  | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | - if(isset($this->jsBodyMapIndex[$file->key]))  | 
                                                        |
| 235 | + if (isset($this->jsBodyMapIndex[$file->key]))  | 
                                                        |
| 236 | 236 |  			{ | 
                                                        
| 237 | 237 | $index = $this->jsBodyMapIndex[$file->key];  | 
                                                        
| 238 | 238 | unset($this->jsBodyMap[$index][$file->key], $this->jsBodyMapIndex[$file->key]);  | 
                                                        
@@ -248,13 +248,13 @@ discard block  | 
                                                    ||
| 248 | 248 | */  | 
                                                        
| 249 | 249 | function unloadAllFiles($type = 'all')  | 
                                                        
| 250 | 250 |  	{ | 
                                                        
| 251 | - if($type == 'css' || $type == 'all')  | 
                                                        |
| 251 | + if ($type == 'css' || $type == 'all')  | 
                                                        |
| 252 | 252 |  		{ | 
                                                        
| 253 | 253 | $this->cssMap = array();  | 
                                                        
| 254 | 254 | $this->cssMapIndex = array();  | 
                                                        
| 255 | 255 | }  | 
                                                        
| 256 | 256 | |
| 257 | - if($type == 'js' || $type == 'all')  | 
                                                        |
| 257 | + if ($type == 'js' || $type == 'all')  | 
                                                        |
| 258 | 258 |  		{ | 
                                                        
| 259 | 259 | $this->jsHeadMap = array();  | 
                                                        
| 260 | 260 | $this->jsBodyMap = array();  | 
                                                        
@@ -276,23 +276,23 @@ discard block  | 
                                                    ||
| 276 | 276 | $this->_sortMap($map, $mapIndex);  | 
                                                        
| 277 | 277 | |
| 278 | 278 | $result = array();  | 
                                                        
| 279 | - foreach($map as $indexedMap)  | 
                                                        |
| 279 | + foreach ($map as $indexedMap)  | 
                                                        |
| 280 | 280 |  		{ | 
                                                        
| 281 | - foreach($indexedMap as $file)  | 
                                                        |
| 281 | + foreach ($indexedMap as $file)  | 
                                                        |
| 282 | 282 |  			{ | 
                                                        
| 283 | 283 | $query = '';  | 
                                                        
| 284 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName))  | 
                                                        |
| 284 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName))  | 
                                                        |
| 285 | 285 |  				{ | 
                                                        
| 286 | -					$query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); | 
                                                        |
| 286 | +					$query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); | 
                                                        |
| 287 | 287 | }  | 
                                                        
| 288 | - if($file->query)  | 
                                                        |
| 288 | + if ($file->query)  | 
                                                        |
| 289 | 289 |  				{ | 
                                                        
| 290 | - if($query) $query .= '&';  | 
                                                        |
| 290 | + if ($query) $query .= '&';  | 
                                                        |
| 291 | 291 | $query .= $file->query;  | 
                                                        
| 292 | 292 | }  | 
                                                        
| 293 | - $query = ($query) ? '?' . $query : '';  | 
                                                        |
| 293 | + $query = ($query) ? '?'.$query : '';  | 
                                                        |
| 294 | 294 | |
| 295 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query;  | 
                                                        |
| 295 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query;  | 
                                                        |
| 296 | 296 | $result[] = array(  | 
                                                        
| 297 | 297 | 'file' => $fullFilePath,  | 
                                                        
| 298 | 298 | 'media' => $file->media,  | 
                                                        
@@ -313,9 +313,9 @@ discard block  | 
                                                    ||
| 313 | 313 | function getJsFileList($type = 'head')  | 
                                                        
| 314 | 314 |  	{ | 
                                                        
| 315 | 315 |  		$ignore = array('modernizr.js', 'common.js', 'js_app.js', 'xml2json.js', 'xml_handler.js', 'xml_js_filter.js'); | 
                                                        
| 316 | - $pathCommonJs = getScriptPath() . 'common/js';  | 
                                                        |
| 316 | + $pathCommonJs = getScriptPath().'common/js';  | 
                                                        |
| 317 | 317 | |
| 318 | - if($type == 'head')  | 
                                                        |
| 318 | + if ($type == 'head')  | 
                                                        |
| 319 | 319 |  		{ | 
                                                        
| 320 | 320 | $map = &$this->jsHeadMap;  | 
                                                        
| 321 | 321 | $mapIndex = &$this->jsHeadMapIndex;  | 
                                                        
@@ -329,31 +329,31 @@ discard block  | 
                                                    ||
| 329 | 329 | $this->_sortMap($map, $mapIndex);  | 
                                                        
| 330 | 330 | |
| 331 | 331 | $result = array();  | 
                                                        
| 332 | - foreach($map as $indexedMap)  | 
                                                        |
| 332 | + foreach ($map as $indexedMap)  | 
                                                        |
| 333 | 333 |  		{ | 
                                                        
| 334 | - foreach($indexedMap as $file)  | 
                                                        |
| 334 | + foreach ($indexedMap as $file)  | 
                                                        |
| 335 | 335 |  			{ | 
                                                        
| 336 | - if((!__DEBUG__ && __XE_VERSION_STABLE__) && $file->filePath === $pathCommonJs)  | 
                                                        |
| 336 | + if ((!__DEBUG__ && __XE_VERSION_STABLE__) && $file->filePath === $pathCommonJs)  | 
                                                        |
| 337 | 337 |  				{ | 
                                                        
| 338 | - if(in_array($file->fileName, $ignore))  | 
                                                        |
| 338 | + if (in_array($file->fileName, $ignore))  | 
                                                        |
| 339 | 339 |  					{ | 
                                                        
| 340 | 340 | continue;  | 
                                                        
| 341 | 341 | }  | 
                                                        
| 342 | 342 | }  | 
                                                        
| 343 | 343 | |
| 344 | 344 | $query = '';  | 
                                                        
| 345 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName))  | 
                                                        |
| 345 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName))  | 
                                                        |
| 346 | 346 |  				{ | 
                                                        
| 347 | -					$query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); | 
                                                        |
| 347 | +					$query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); | 
                                                        |
| 348 | 348 | }  | 
                                                        
| 349 | - if($file->query)  | 
                                                        |
| 349 | + if ($file->query)  | 
                                                        |
| 350 | 350 |  				{ | 
                                                        
| 351 | - if($query) $query .= '&';  | 
                                                        |
| 351 | + if ($query) $query .= '&';  | 
                                                        |
| 352 | 352 | $query .= $file->query;  | 
                                                        
| 353 | 353 | }  | 
                                                        
| 354 | - $query = ($query) ? '?' . $query : '';  | 
                                                        |
| 354 | + $query = ($query) ? '?'.$query : '';  | 
                                                        |
| 355 | 355 | |
| 356 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query;  | 
                                                        |
| 356 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query;  | 
                                                        |
| 357 | 357 | $result[] = array(  | 
                                                        
| 358 | 358 | 'file' => $fullFilePath,  | 
                                                        
| 359 | 359 | 'targetie' => $file->targetIe  | 
                                                        
@@ -384,18 +384,18 @@ discard block  | 
                                                    ||
| 384 | 384 | */  | 
                                                        
| 385 | 385 | function _normalizeFilePath($path)  | 
                                                        
| 386 | 386 |  	{ | 
                                                        
| 387 | -		if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') | 
                                                        |
| 387 | +		if (strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') | 
                                                        |
| 388 | 388 |  		{ | 
                                                        
| 389 | - $path = './' . $path;  | 
                                                        |
| 389 | + $path = './'.$path;  | 
                                                        |
| 390 | 390 | }  | 
                                                        
| 391 | - elseif(!strncmp($path, '//', 2))  | 
                                                        |
| 391 | + elseif (!strncmp($path, '//', 2))  | 
                                                        |
| 392 | 392 |  		{ | 
                                                        
| 393 | 393 |  			return preg_replace('#^//+#', '//', $path); | 
                                                        
| 394 | 394 | }  | 
                                                        
| 395 | 395 | |
| 396 | 396 |  		$path = preg_replace('@/\./|(?<!:)\/\/@', '/', $path); | 
                                                        
| 397 | 397 | |
| 398 | - while(strpos($path, '/../'))  | 
                                                        |
| 398 | + while (strpos($path, '/../'))  | 
                                                        |
| 399 | 399 |  		{ | 
                                                        
| 400 | 400 |  			$path = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $path, 1); | 
                                                        
| 401 | 401 | }  | 
                                                        
@@ -414,20 +414,20 @@ discard block  | 
                                                    ||
| 414 | 414 | $path = $this->_normalizeFilePath($path);  | 
                                                        
| 415 | 415 | $script_path = getScriptPath();  | 
                                                        
| 416 | 416 | |
| 417 | - if(strpos($path, './') === 0)  | 
                                                        |
| 417 | + if (strpos($path, './') === 0)  | 
                                                        |
| 418 | 418 |  		{ | 
                                                        
| 419 | - if($script_path == '/' || $script_path == '\\')  | 
                                                        |
| 419 | + if ($script_path == '/' || $script_path == '\\')  | 
                                                        |
| 420 | 420 |  			{ | 
                                                        
| 421 | - $path = '/' . substr($path, 2);  | 
                                                        |
| 421 | + $path = '/'.substr($path, 2);  | 
                                                        |
| 422 | 422 | }  | 
                                                        
| 423 | 423 | else  | 
                                                        
| 424 | 424 |  			{ | 
                                                        
| 425 | - $path = $script_path . substr($path, 2);  | 
                                                        |
| 425 | + $path = $script_path.substr($path, 2);  | 
                                                        |
| 426 | 426 | }  | 
                                                        
| 427 | 427 | }  | 
                                                        
| 428 | - else if(strpos($file, '../') === 0)  | 
                                                        |
| 428 | + else if (strpos($file, '../') === 0)  | 
                                                        |
| 429 | 429 |  		{ | 
                                                        
| 430 | - $path = $this->_normalizeFilePath($script_path . $path);  | 
                                                        |
| 430 | + $path = $this->_normalizeFilePath($script_path.$path);  | 
                                                        |
| 431 | 431 | }  | 
                                                        
| 432 | 432 | |
| 433 | 433 | return $path;  | 
                                                        
@@ -442,7 +442,7 @@ discard block  | 
                                                    ||
| 442 | 442 | */  | 
                                                        
| 443 | 443 | function _arrangeCssIndex($dirName, &$file)  | 
                                                        
| 444 | 444 |  	{ | 
                                                        
| 445 | - if($file->index !== 0)  | 
                                                        |
| 445 | + if ($file->index !== 0)  | 
                                                        |
| 446 | 446 |  		{ | 
                                                        
| 447 | 447 | return;  | 
                                                        
| 448 | 448 | }  | 
                                                        
@@ -28,12 +28,12 @@ discard block  | 
                                                    ||
| 28 | 28 | *  | 
                                                        
| 29 | 29 | * @return Object output document list  | 
                                                        
| 30 | 30 | */  | 
                                                        
| 31 | - function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)  | 
                                                        |
| 31 | + function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page = 1, $list_count = 20)  | 
                                                        |
| 32 | 32 |  	{ | 
                                                        
| 33 | -		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); | 
                                                        |
| 33 | +		if (is_array($module_srls_list)) $module_srls_list = implode(',', $module_srls_list); | 
                                                        |
| 34 | 34 | |
| 35 | 35 | $args = new stdClass();  | 
                                                        
| 36 | - if($target == 'exclude')  | 
                                                        |
| 36 | + if ($target == 'exclude')  | 
                                                        |
| 37 | 37 |  		{ | 
                                                        
| 38 | 38 | $module_srls_list .= ',0'; // exclude 'trash'  | 
                                                        
| 39 | 39 |  			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); | 
                                                        
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | $args->sort_index = 'list_order';  | 
                                                        
| 54 | 54 | $args->order_type = 'asc';  | 
                                                        
| 55 | 55 |  		$args->statusList = array('PUBLIC'); | 
                                                        
| 56 | - if(!$args->module_srl) unset($args->module_srl);  | 
                                                        |
| 56 | + if (!$args->module_srl) unset($args->module_srl);  | 
                                                        |
| 57 | 57 | // Get a list of documents  | 
                                                        
| 58 | 58 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 59 | 59 | |
@@ -71,22 +71,22 @@ discard block  | 
                                                    ||
| 71 | 71 | *  | 
                                                        
| 72 | 72 | * @return Object output comment list  | 
                                                        
| 73 | 73 | */  | 
                                                        
| 74 | - function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)  | 
                                                        |
| 74 | + function getComments($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)  | 
                                                        |
| 75 | 75 |  	{ | 
                                                        
| 76 | 76 | $args = new stdClass();  | 
                                                        
| 77 | 77 | |
| 78 | - if(is_array($module_srls_list))  | 
                                                        |
| 78 | + if (is_array($module_srls_list))  | 
                                                        |
| 79 | 79 |  		{ | 
                                                        
| 80 | -			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 80 | +			if (count($module_srls_list) > 0) $module_srls = implode(',', $module_srls_list); | 
                                                        |
| 81 | 81 | }  | 
                                                        
| 82 | 82 | else  | 
                                                        
| 83 | 83 |  		{ | 
                                                        
| 84 | - if($module_srls_list)  | 
                                                        |
| 84 | + if ($module_srls_list)  | 
                                                        |
| 85 | 85 |  			{ | 
                                                        
| 86 | 86 | $module_srls = $module_srls_list;  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 89 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 90 | 90 | else $args->module_srl = $module_srls;  | 
                                                        
| 91 | 91 | |
| 92 | 92 | $args->page = $page;  | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | // Get a list of documents  | 
                                                        
| 100 | 100 |  		$oCommentModel = getModel('comment'); | 
                                                        
| 101 | 101 | $output = $oCommentModel->getTotalCommentList($args);  | 
                                                        
| 102 | - if(!$output->toBool()|| !$output->data) return $output;  | 
                                                        |
| 102 | + if (!$output->toBool() || !$output->data) return $output;  | 
                                                        |
| 103 | 103 | return $output;  | 
                                                        
| 104 | 104 | }  | 
                                                        
| 105 | 105 | |
@@ -115,15 +115,15 @@ discard block  | 
                                                    ||
| 115 | 115 | *  | 
                                                        
| 116 | 116 | * @return Object output trackback list  | 
                                                        
| 117 | 117 | */  | 
                                                        
| 118 | - function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)  | 
                                                        |
| 118 | + function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page = 1, $list_count = 20)  | 
                                                        |
| 119 | 119 |  	{ | 
                                                        
| 120 | 120 |  		$oTrackbackModel = getAdminModel('trackback'); | 
                                                        
| 121 | - if(!$oTrackbackModel) return new Object();  | 
                                                        |
| 121 | + if (!$oTrackbackModel) return new Object();  | 
                                                        |
| 122 | 122 | $args = new stdClass();  | 
                                                        
| 123 | 123 | |
| 124 | -		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 124 | +		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); | 
                                                        |
| 125 | 125 | else $module_srls = $module_srls_list;  | 
                                                        
| 126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 126 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 127 | 127 | else $args->module_srl = $module_srls;  | 
                                                        
| 128 | 128 | $args->page = $page;  | 
                                                        
| 129 | 129 | $args->list_count = $list_count;  | 
                                                        
@@ -134,7 +134,7 @@ discard block  | 
                                                    ||
| 134 | 134 | $args->order_type = 'asc';  | 
                                                        
| 135 | 135 | // Get a list of documents  | 
                                                        
| 136 | 136 | $output = $oTrackbackModel->getTotalTrackbackList($args);  | 
                                                        
| 137 | - if(!$output->toBool()|| !$output->data) return $output;  | 
                                                        |
| 137 | + if (!$output->toBool() || !$output->data) return $output;  | 
                                                        |
| 138 | 138 | return $output;  | 
                                                        
| 139 | 139 | }  | 
                                                        
| 140 | 140 | |
@@ -154,9 +154,9 @@ discard block  | 
                                                    ||
| 154 | 154 |  	{ | 
                                                        
| 155 | 155 | $args = new stdClass();  | 
                                                        
| 156 | 156 | |
| 157 | -		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 157 | +		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); | 
                                                        |
| 158 | 158 | else $module_srls = $module_srls_list;  | 
                                                        
| 159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 159 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 160 | 160 | else $args->module_srl = $module_srls;  | 
                                                        
| 161 | 161 | $args->page = $page;  | 
                                                        
| 162 | 162 | $args->list_count = $list_count;  | 
                                                        
@@ -166,32 +166,32 @@ discard block  | 
                                                    ||
| 166 | 166 | $args->sort_index = 'files.file_srl';  | 
                                                        
| 167 | 167 | $args->order_type = 'desc';  | 
                                                        
| 168 | 168 | $args->isvalid = 'Y';  | 
                                                        
| 169 | - $args->direct_download = $direct_download=='Y'?'Y':'N';  | 
                                                        |
| 169 | + $args->direct_download = $direct_download == 'Y' ? 'Y' : 'N';  | 
                                                        |
| 170 | 170 | // Get a list of documents  | 
                                                        
| 171 | 171 |  		$oFileAdminModel = getAdminModel('file'); | 
                                                        
| 172 | 172 | $output = $oFileAdminModel->getFileList($args);  | 
                                                        
| 173 | - if(!$output->toBool() || !$output->data) return $output;  | 
                                                        |
| 173 | + if (!$output->toBool() || !$output->data) return $output;  | 
                                                        |
| 174 | 174 | |
| 175 | 175 | $list = array();  | 
                                                        
| 176 | - foreach($output->data as $key => $val)  | 
                                                        |
| 176 | + foreach ($output->data as $key => $val)  | 
                                                        |
| 177 | 177 |  		{ | 
                                                        
| 178 | 178 | $obj = new stdClass;  | 
                                                        
| 179 | 179 | $obj->filename = $val->source_filename;  | 
                                                        
| 180 | 180 | $obj->download_count = $val->download_count;  | 
                                                        
| 181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);  | 
                                                        |
| 181 | + if (substr($val->download_url, 0, 2) == './') $val->download_url = substr($val->download_url, 2);  | 
                                                        |
| 182 | 182 | $obj->download_url = Context::getRequestUri().$val->download_url;  | 
                                                        
| 183 | 183 | $obj->target_srl = $val->upload_target_srl;  | 
                                                        
| 184 | 184 | $obj->file_size = $val->file_size;  | 
                                                        
| 185 | 185 | // Images  | 
                                                        
| 186 | -			if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) | 
                                                        |
| 186 | +			if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) | 
                                                        |
| 187 | 187 |  			{ | 
                                                        
| 188 | 188 | $obj->type = 'image';  | 
                                                        
| 189 | 189 | |
| 190 | -				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); | 
                                                        |
| 191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);  | 
                                                        |
| 190 | +				$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($val->file_srl, 3)); | 
                                                        |
| 191 | + if (!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);  | 
                                                        |
| 192 | 192 |  				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); | 
                                                        
| 193 | 193 | $thumbnail_url = Context::getRequestUri().$thumbnail_file;  | 
                                                        
| 194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');  | 
                                                        |
| 194 | + if (!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');  | 
                                                        |
| 195 | 195 |  				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); | 
                                                        
| 196 | 196 | }  | 
                                                        
| 197 | 197 | else  | 
                                                        
@@ -207,11 +207,11 @@ discard block  | 
                                                    ||
| 207 | 207 | |
| 208 | 208 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 209 | 209 | $document_list = $oDocumentModel->getDocuments($target_list);  | 
                                                        
| 210 | - if($document_list) foreach($document_list as $key => $val)  | 
                                                        |
| 210 | + if ($document_list) foreach ($document_list as $key => $val)  | 
                                                        |
| 211 | 211 |  		{ | 
                                                        
| 212 | - foreach($output->data as $k => $v)  | 
                                                        |
| 212 | + foreach ($output->data as $k => $v)  | 
                                                        |
| 213 | 213 |  			{ | 
                                                        
| 214 | - if($v->target_srl== $val->document_srl)  | 
                                                        |
| 214 | + if ($v->target_srl == $val->document_srl)  | 
                                                        |
| 215 | 215 |  				{ | 
                                                        
| 216 | 216 | $output->data[$k]->url = $val->getPermanentUrl();  | 
                                                        
| 217 | 217 |  					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); | 
                                                        
@@ -222,11 +222,11 @@ discard block  | 
                                                    ||
| 222 | 222 | |
| 223 | 223 |  		$oCommentModel = getModel('comment'); | 
                                                        
| 224 | 224 | $comment_list = $oCommentModel->getComments($target_list);  | 
                                                        
| 225 | - if($comment_list) foreach($comment_list as $key => $val)  | 
                                                        |
| 225 | + if ($comment_list) foreach ($comment_list as $key => $val)  | 
                                                        |
| 226 | 226 |  		{ | 
                                                        
| 227 | - foreach($output->data as $k => $v)  | 
                                                        |
| 227 | + foreach ($output->data as $k => $v)  | 
                                                        |
| 228 | 228 |  			{ | 
                                                        
| 229 | - if($v->target_srl== $val->comment_srl)  | 
                                                        |
| 229 | + if ($v->target_srl == $val->comment_srl)  | 
                                                        |
| 230 | 230 |  				{ | 
                                                        
| 231 | 231 | $output->data[$k]->url = $val->getPermanentUrl();  | 
                                                        
| 232 | 232 |  					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); | 
                                                        
@@ -249,7 +249,7 @@ discard block  | 
                                                    ||
| 249 | 249 | *  | 
                                                        
| 250 | 250 | * @return Object  | 
                                                        
| 251 | 251 | */  | 
                                                        
| 252 | - function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)  | 
                                                        |
| 252 | + function getImages($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)  | 
                                                        |
| 253 | 253 |  	{ | 
                                                        
| 254 | 254 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);  | 
                                                        
| 255 | 255 | }  | 
                                                        
@@ -265,7 +265,7 @@ discard block  | 
                                                    ||
| 265 | 265 | *  | 
                                                        
| 266 | 266 | * @return Object  | 
                                                        
| 267 | 267 | */  | 
                                                        
| 268 | - function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)  | 
                                                        |
| 268 | + function getFiles($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)  | 
                                                        |
| 269 | 269 |  	{ | 
                                                        
| 270 | 270 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');  | 
                                                        
| 271 | 271 | }  | 
                                                        
@@ -30,16 +30,19 @@ discard block  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 | function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)  | 
                                                        
| 32 | 32 |  	{ | 
                                                        
| 33 | -		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); | 
                                                        |
| 33 | +		if(is_array($module_srls_list)) { | 
                                                        |
| 34 | +			$module_srls_list = implode(',',$module_srls_list); | 
                                                        |
| 35 | + }  | 
                                                        |
| 34 | 36 | |
| 35 | 37 | $args = new stdClass();  | 
                                                        
| 36 | 38 | if($target == 'exclude')  | 
                                                        
| 37 | 39 |  		{ | 
                                                        
| 38 | 40 | $module_srls_list .= ',0'; // exclude 'trash'  | 
                                                        
| 39 | -			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); | 
                                                        |
| 41 | +			if ($module_srls_list{0} == ',') { | 
                                                        |
| 42 | + $module_srls_list = substr($module_srls_list, 1);  | 
                                                        |
| 43 | + }  | 
                                                        |
| 40 | 44 | $args->exclude_module_srl = $module_srls_list;  | 
                                                        
| 41 | - }  | 
                                                        |
| 42 | - else  | 
                                                        |
| 45 | + } else  | 
                                                        |
| 43 | 46 |  		{ | 
                                                        
| 44 | 47 | $args->module_srl = $module_srls_list;  | 
                                                        
| 45 | 48 | $args->exclude_module_srl = '0'; // exclude 'trash'  | 
                                                        
@@ -53,7 +56,9 @@ discard block  | 
                                                    ||
| 53 | 56 | $args->sort_index = 'list_order';  | 
                                                        
| 54 | 57 | $args->order_type = 'asc';  | 
                                                        
| 55 | 58 |  		$args->statusList = array('PUBLIC'); | 
                                                        
| 56 | - if(!$args->module_srl) unset($args->module_srl);  | 
                                                        |
| 59 | +		if(!$args->module_srl) { | 
                                                        |
| 60 | + unset($args->module_srl);  | 
                                                        |
| 61 | + }  | 
                                                        |
| 57 | 62 | // Get a list of documents  | 
                                                        
| 58 | 63 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 59 | 64 | |
@@ -77,17 +82,21 @@ discard block  | 
                                                    ||
| 77 | 82 | |
| 78 | 83 | if(is_array($module_srls_list))  | 
                                                        
| 79 | 84 |  		{ | 
                                                        
| 80 | -			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 81 | - }  | 
                                                        |
| 82 | - else  | 
                                                        |
| 85 | +			if (count($module_srls_list) > 0) { | 
                                                        |
| 86 | +				$module_srls = implode(',',$module_srls_list); | 
                                                        |
| 87 | + }  | 
                                                        |
| 88 | + } else  | 
                                                        |
| 83 | 89 |  		{ | 
                                                        
| 84 | 90 | if($module_srls_list)  | 
                                                        
| 85 | 91 |  			{ | 
                                                        
| 86 | 92 | $module_srls = $module_srls_list;  | 
                                                        
| 87 | 93 | }  | 
                                                        
| 88 | 94 | }  | 
                                                        
| 89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 90 | - else $args->module_srl = $module_srls;  | 
                                                        |
| 95 | +		if($target == 'exclude') { | 
                                                        |
| 96 | + $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 97 | +		} else { | 
                                                        |
| 98 | + $args->module_srl = $module_srls;  | 
                                                        |
| 99 | + }  | 
                                                        |
| 91 | 100 | |
| 92 | 101 | $args->page = $page;  | 
                                                        
| 93 | 102 | $args->list_count = $list_count;  | 
                                                        
@@ -99,7 +108,9 @@ discard block  | 
                                                    ||
| 99 | 108 | // Get a list of documents  | 
                                                        
| 100 | 109 |  		$oCommentModel = getModel('comment'); | 
                                                        
| 101 | 110 | $output = $oCommentModel->getTotalCommentList($args);  | 
                                                        
| 102 | - if(!$output->toBool()|| !$output->data) return $output;  | 
                                                        |
| 111 | +		if(!$output->toBool()|| !$output->data) { | 
                                                        |
| 112 | + return $output;  | 
                                                        |
| 113 | + }  | 
                                                        |
| 103 | 114 | return $output;  | 
                                                        
| 104 | 115 | }  | 
                                                        
| 105 | 116 | |
@@ -118,13 +129,21 @@ discard block  | 
                                                    ||
| 118 | 129 | function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)  | 
                                                        
| 119 | 130 |  	{ | 
                                                        
| 120 | 131 |  		$oTrackbackModel = getAdminModel('trackback'); | 
                                                        
| 121 | - if(!$oTrackbackModel) return new Object();  | 
                                                        |
| 132 | +		if(!$oTrackbackModel) { | 
                                                        |
| 133 | + return new Object();  | 
                                                        |
| 134 | + }  | 
                                                        |
| 122 | 135 | $args = new stdClass();  | 
                                                        
| 123 | 136 | |
| 124 | -		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 125 | - else $module_srls = $module_srls_list;  | 
                                                        |
| 126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 127 | - else $args->module_srl = $module_srls;  | 
                                                        |
| 137 | +		if(is_array($module_srls_list)) { | 
                                                        |
| 138 | +			$module_srls = implode(',',$module_srls_list); | 
                                                        |
| 139 | +		} else { | 
                                                        |
| 140 | + $module_srls = $module_srls_list;  | 
                                                        |
| 141 | + }  | 
                                                        |
| 142 | +		if($target == 'exclude') { | 
                                                        |
| 143 | + $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 144 | +		} else { | 
                                                        |
| 145 | + $args->module_srl = $module_srls;  | 
                                                        |
| 146 | + }  | 
                                                        |
| 128 | 147 | $args->page = $page;  | 
                                                        
| 129 | 148 | $args->list_count = $list_count;  | 
                                                        
| 130 | 149 | $args->page_count = 10;  | 
                                                        
@@ -134,7 +153,9 @@ discard block  | 
                                                    ||
| 134 | 153 | $args->order_type = 'asc';  | 
                                                        
| 135 | 154 | // Get a list of documents  | 
                                                        
| 136 | 155 | $output = $oTrackbackModel->getTotalTrackbackList($args);  | 
                                                        
| 137 | - if(!$output->toBool()|| !$output->data) return $output;  | 
                                                        |
| 156 | +		if(!$output->toBool()|| !$output->data) { | 
                                                        |
| 157 | + return $output;  | 
                                                        |
| 158 | + }  | 
                                                        |
| 138 | 159 | return $output;  | 
                                                        
| 139 | 160 | }  | 
                                                        
| 140 | 161 | |
@@ -154,10 +175,16 @@ discard block  | 
                                                    ||
| 154 | 175 |  	{ | 
                                                        
| 155 | 176 | $args = new stdClass();  | 
                                                        
| 156 | 177 | |
| 157 | -		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); | 
                                                        |
| 158 | - else $module_srls = $module_srls_list;  | 
                                                        |
| 159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 160 | - else $args->module_srl = $module_srls;  | 
                                                        |
| 178 | +		if(is_array($module_srls_list)) { | 
                                                        |
| 179 | +			$module_srls = implode(',',$module_srls_list); | 
                                                        |
| 180 | +		} else { | 
                                                        |
| 181 | + $module_srls = $module_srls_list;  | 
                                                        |
| 182 | + }  | 
                                                        |
| 183 | +		if($target == 'exclude') { | 
                                                        |
| 184 | + $args->exclude_module_srl = $module_srls;  | 
                                                        |
| 185 | +		} else { | 
                                                        |
| 186 | + $args->module_srl = $module_srls;  | 
                                                        |
| 187 | + }  | 
                                                        |
| 161 | 188 | $args->page = $page;  | 
                                                        
| 162 | 189 | $args->list_count = $list_count;  | 
                                                        
| 163 | 190 | $args->page_count = 10;  | 
                                                        
@@ -170,7 +197,9 @@ discard block  | 
                                                    ||
| 170 | 197 | // Get a list of documents  | 
                                                        
| 171 | 198 |  		$oFileAdminModel = getAdminModel('file'); | 
                                                        
| 172 | 199 | $output = $oFileAdminModel->getFileList($args);  | 
                                                        
| 173 | - if(!$output->toBool() || !$output->data) return $output;  | 
                                                        |
| 200 | +		if(!$output->toBool() || !$output->data) { | 
                                                        |
| 201 | + return $output;  | 
                                                        |
| 202 | + }  | 
                                                        |
| 174 | 203 | |
| 175 | 204 | $list = array();  | 
                                                        
| 176 | 205 | foreach($output->data as $key => $val)  | 
                                                        
@@ -178,7 +207,9 @@ discard block  | 
                                                    ||
| 178 | 207 | $obj = new stdClass;  | 
                                                        
| 179 | 208 | $obj->filename = $val->source_filename;  | 
                                                        
| 180 | 209 | $obj->download_count = $val->download_count;  | 
                                                        
| 181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);  | 
                                                        |
| 210 | +			if(substr($val->download_url,0,2)=='./') { | 
                                                        |
| 211 | + $val->download_url = substr($val->download_url,2);  | 
                                                        |
| 212 | + }  | 
                                                        |
| 182 | 213 | $obj->download_url = Context::getRequestUri().$val->download_url;  | 
                                                        
| 183 | 214 | $obj->target_srl = $val->upload_target_srl;  | 
                                                        
| 184 | 215 | $obj->file_size = $val->file_size;  | 
                                                        
@@ -188,13 +219,16 @@ discard block  | 
                                                    ||
| 188 | 219 | $obj->type = 'image';  | 
                                                        
| 189 | 220 | |
| 190 | 221 |  				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); | 
                                                        
| 191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);  | 
                                                        |
| 222 | +				if(!is_dir($thumbnail_path)) { | 
                                                        |
| 223 | + FileHandler::makeDir($thumbnail_path);  | 
                                                        |
| 224 | + }  | 
                                                        |
| 192 | 225 |  				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); | 
                                                        
| 193 | 226 | $thumbnail_url = Context::getRequestUri().$thumbnail_file;  | 
                                                        
| 194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');  | 
                                                        |
| 227 | +				if(!file_exists($thumbnail_file)) { | 
                                                        |
| 228 | + FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');  | 
                                                        |
| 229 | + }  | 
                                                        |
| 195 | 230 |  				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); | 
                                                        
| 196 | - }  | 
                                                        |
| 197 | - else  | 
                                                        |
| 231 | + } else  | 
                                                        |
| 198 | 232 |  			{ | 
                                                        
| 199 | 233 | $obj->type = 'binary';  | 
                                                        
| 200 | 234 | $obj->src = '';  | 
                                                        
@@ -207,13 +241,15 @@ discard block  | 
                                                    ||
| 207 | 241 | |
| 208 | 242 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 209 | 243 | $document_list = $oDocumentModel->getDocuments($target_list);  | 
                                                        
| 210 | - if($document_list) foreach($document_list as $key => $val)  | 
                                                        |
| 244 | +		if($document_list) { | 
                                                        |
| 245 | + foreach($document_list as $key => $val)  | 
                                                        |
| 211 | 246 |  		{ | 
                                                        
| 212 | 247 | foreach($output->data as $k => $v)  | 
                                                        
| 213 | 248 |  			{ | 
                                                        
| 214 | 249 | if($v->target_srl== $val->document_srl)  | 
                                                        
| 215 | 250 |  				{ | 
                                                        
| 216 | 251 | $output->data[$k]->url = $val->getPermanentUrl();  | 
                                                        
| 252 | + }  | 
                                                        |
| 217 | 253 |  					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); | 
                                                        
| 218 | 254 | $output->data[$k]->nick_name = $val->getNickName();  | 
                                                        
| 219 | 255 | }  | 
                                                        
@@ -222,13 +258,15 @@ discard block  | 
                                                    ||
| 222 | 258 | |
| 223 | 259 |  		$oCommentModel = getModel('comment'); | 
                                                        
| 224 | 260 | $comment_list = $oCommentModel->getComments($target_list);  | 
                                                        
| 225 | - if($comment_list) foreach($comment_list as $key => $val)  | 
                                                        |
| 261 | +		if($comment_list) { | 
                                                        |
| 262 | + foreach($comment_list as $key => $val)  | 
                                                        |
| 226 | 263 |  		{ | 
                                                        
| 227 | 264 | foreach($output->data as $k => $v)  | 
                                                        
| 228 | 265 |  			{ | 
                                                        
| 229 | 266 | if($v->target_srl== $val->comment_srl)  | 
                                                        
| 230 | 267 |  				{ | 
                                                        
| 231 | 268 | $output->data[$k]->url = $val->getPermanentUrl();  | 
                                                        
| 269 | + }  | 
                                                        |
| 232 | 270 |  					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); | 
                                                        
| 233 | 271 | $output->data[$k]->nick_name = $val->getNickName();  | 
                                                        
| 234 | 272 | }  | 
                                                        
@@ -27,41 +27,41 @@ discard block  | 
                                                    ||
| 27 | 27 |  		$total_config = $oModuleModel->getModuleConfig('rss'); | 
                                                        
| 28 | 28 | |
| 29 | 29 | $config_vars = Context::getRequestVars();  | 
                                                        
| 30 | - $config_vars->feed_document_count = (int)$config_vars->feed_document_count;  | 
                                                        |
| 30 | + $config_vars->feed_document_count = (int) $config_vars->feed_document_count;  | 
                                                        |
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';  | 
                                                        |
| 33 | -		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; | 
                                                        |
| 32 | + if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';  | 
                                                        |
| 33 | +		if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y'; | 
                                                        |
| 34 | 34 | |
| 35 | - if($config_vars->image || $config_vars->del_image)  | 
                                                        |
| 35 | + if ($config_vars->image || $config_vars->del_image)  | 
                                                        |
| 36 | 36 |  		{ | 
                                                        
| 37 | 37 | $image_obj = $config_vars->image;  | 
                                                        
| 38 | 38 | $config_vars->image = $total_config->image;  | 
                                                        
| 39 | 39 | // Get a variable for the delete request  | 
                                                        
| 40 | - if($config_vars->del_image == 'Y' || $image_obj)  | 
                                                        |
| 40 | + if ($config_vars->del_image == 'Y' || $image_obj)  | 
                                                        |
| 41 | 41 |  			{ | 
                                                        
| 42 | 42 | FileHandler::removeFile($config_vars->image);  | 
                                                        
| 43 | 43 | $config_vars->image = '';  | 
                                                        
| 44 | 44 | $total_config->image = '';  | 
                                                        
| 45 | 45 | }  | 
                                                        
| 46 | 46 | // Ignore if the file is not the one which has been successfully uploaded  | 
                                                        
| 47 | - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))  | 
                                                        |
| 47 | + if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))  | 
                                                        |
| 48 | 48 |  			{ | 
                                                        
| 49 | 49 | // Ignore if the file is not an image  | 
                                                        
| 50 | 50 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']);  | 
                                                        
| 51 | 51 | |
| 52 | -				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; | 
                                                        |
| 52 | +				if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; | 
                                                        |
| 53 | 53 | else  | 
                                                        
| 54 | 54 |  				{ | 
                                                        
| 55 | 55 | // Upload the file to a path  | 
                                                        
| 56 | 56 | $path = './files/attach/images/rss/';  | 
                                                        
| 57 | 57 | // Create a directory  | 
                                                        
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 58 | + if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 59 | 59 | else  | 
                                                        
| 60 | 60 |  					{ | 
                                                        
| 61 | 61 | $filename = $path.$image_obj['name'];  | 
                                                        
| 62 | 62 | |
| 63 | 63 | // Move the file  | 
                                                        
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 64 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 65 | 65 | else  | 
                                                        
| 66 | 66 |  						{ | 
                                                        
| 67 | 67 | $config_vars->image = $filename;  | 
                                                        
@@ -70,11 +70,11 @@ discard block  | 
                                                    ||
| 70 | 70 | }  | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;  | 
                                                        |
| 73 | + if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;  | 
                                                        |
| 74 | 74 | |
| 75 | 75 | $output = $this->setFeedConfig($config_vars);  | 
                                                        
| 76 | 76 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated';  | 
                                                        |
| 77 | + if (!$alt_message) $alt_message = 'success_updated';  | 
                                                        |
| 78 | 78 | |
| 79 | 79 | $alt_message = Context::getLang($alt_message);  | 
                                                        
| 80 | 80 | $this->setMessage($alt_message, 'info');  | 
                                                        
@@ -96,7 +96,7 @@ discard block  | 
                                                    ||
| 96 | 96 |  		$originConfig = $oModuleModel->getModuleConfig('rss'); | 
                                                        
| 97 | 97 | |
| 98 | 98 | // Get a variable for the delete request  | 
                                                        
| 99 | - if($delImage == 'Y')  | 
                                                        |
| 99 | + if ($delImage == 'Y')  | 
                                                        |
| 100 | 100 |  		{ | 
                                                        
| 101 | 101 | FileHandler::removeFile($originConfig->image);  | 
                                                        
| 102 | 102 | |
@@ -122,7 +122,7 @@ discard block  | 
                                                    ||
| 122 | 122 | $feedCopyrightList = $config_vars->feed_copyright;  | 
                                                        
| 123 | 123 | $targetModuleSrl = $config_vars->target_module_srl;  | 
                                                        
| 124 | 124 | |
| 125 | - if($targetModuleSrl && !is_array($openRssList))  | 
                                                        |
| 125 | + if ($targetModuleSrl && !is_array($openRssList))  | 
                                                        |
| 126 | 126 |  		{ | 
                                                        
| 127 | 127 | $openRssList = array($targetModuleSrl => $openRssList);  | 
                                                        
| 128 | 128 | $openTotalFeedList = array($targetModuleSrl => $openTotalFeedList);  | 
                                                        
@@ -130,16 +130,16 @@ discard block  | 
                                                    ||
| 130 | 130 | $feedCopyrightList = array($targetModuleSrl => $feedCopyrightList);  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | - if(is_array($openRssList))  | 
                                                        |
| 133 | + if (is_array($openRssList))  | 
                                                        |
| 134 | 134 |  		{ | 
                                                        
| 135 | - foreach($openRssList AS $module_srl=>$open_rss)  | 
                                                        |
| 135 | + foreach ($openRssList AS $module_srl=>$open_rss)  | 
                                                        |
| 136 | 136 |  			{ | 
                                                        
| 137 | - if(!$module_srl || !$open_rss)  | 
                                                        |
| 137 | + if (!$module_srl || !$open_rss)  | 
                                                        |
| 138 | 138 |  				{ | 
                                                        
| 139 | 139 | return new Object(-1, 'msg_invalid_request');  | 
                                                        
| 140 | 140 | }  | 
                                                        
| 141 | 141 | |
| 142 | -				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; | 
                                                        |
| 142 | +				if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N'; | 
                                                        |
| 143 | 143 | |
| 144 | 144 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);  | 
                                                        
| 145 | 145 | }  | 
                                                        
@@ -161,7 +161,7 @@ discard block  | 
                                                    ||
| 161 | 161 | function setFeedConfig($config)  | 
                                                        
| 162 | 162 |  	{ | 
                                                        
| 163 | 163 |  		$oModuleController = getController('module'); | 
                                                        
| 164 | -		$oModuleController->insertModuleConfig('rss',$config); | 
                                                        |
| 164 | +		$oModuleController->insertModuleConfig('rss', $config); | 
                                                        |
| 165 | 165 | return new Object();  | 
                                                        
| 166 | 166 | }  | 
                                                        
| 167 | 167 | |
@@ -181,9 +181,9 @@ discard block  | 
                                                    ||
| 181 | 181 | $config = new stdClass;  | 
                                                        
| 182 | 182 | $config->open_rss = $open_rss;  | 
                                                        
| 183 | 183 | $config->open_total_feed = $open_total_feed;  | 
                                                        
| 184 | -		if($feed_description != 'N') { $config->feed_description = $feed_description; } | 
                                                        |
| 185 | -		if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } | 
                                                        |
| 186 | -		$oModuleController->insertModulePartConfig('rss',$module_srl,$config); | 
                                                        |
| 184 | +		if ($feed_description != 'N') { $config->feed_description = $feed_description; } | 
                                                        |
| 185 | +		if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } | 
                                                        |
| 186 | +		$oModuleController->insertModulePartConfig('rss', $module_srl, $config); | 
                                                        |
| 187 | 187 | return new Object();  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | }  | 
                                                        
@@ -29,8 +29,12 @@ discard block  | 
                                                    ||
| 29 | 29 | $config_vars = Context::getRequestVars();  | 
                                                        
| 30 | 30 | $config_vars->feed_document_count = (int)$config_vars->feed_document_count;  | 
                                                        
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';  | 
                                                        |
| 33 | -		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; | 
                                                        |
| 32 | +		if(!$config_vars->use_total_feed) { | 
                                                        |
| 33 | + $alt_message = 'msg_invalid_request';  | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | +		if(!in_array($config_vars->use_total_feed, array('Y','N'))) { | 
                                                        |
| 36 | + $config_vars->open_rss = 'Y';  | 
                                                        |
| 37 | + }  | 
                                                        |
| 34 | 38 | |
| 35 | 39 | if($config_vars->image || $config_vars->del_image)  | 
                                                        
| 36 | 40 |  		{ | 
                                                        
@@ -49,20 +53,23 @@ discard block  | 
                                                    ||
| 49 | 53 | // Ignore if the file is not an image  | 
                                                        
| 50 | 54 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']);  | 
                                                        
| 51 | 55 | |
| 52 | -				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; | 
                                                        |
| 53 | - else  | 
                                                        |
| 56 | +				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { | 
                                                        |
| 57 | + $alt_message = 'msg_rss_invalid_image_format';  | 
                                                        |
| 58 | + } else  | 
                                                        |
| 54 | 59 |  				{ | 
                                                        
| 55 | 60 | // Upload the file to a path  | 
                                                        
| 56 | 61 | $path = './files/attach/images/rss/';  | 
                                                        
| 57 | 62 | // Create a directory  | 
                                                        
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 59 | - else  | 
                                                        |
| 63 | +					if(!FileHandler::makeDir($path)) { | 
                                                        |
| 64 | + $alt_message = 'msg_error_occured';  | 
                                                        |
| 65 | + } else  | 
                                                        |
| 60 | 66 |  					{ | 
                                                        
| 61 | 67 | $filename = $path.$image_obj['name'];  | 
                                                        
| 62 | 68 | |
| 63 | 69 | // Move the file  | 
                                                        
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';  | 
                                                        |
| 65 | - else  | 
                                                        |
| 70 | +						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { | 
                                                        |
| 71 | + $alt_message = 'msg_error_occured';  | 
                                                        |
| 72 | + } else  | 
                                                        |
| 66 | 73 |  						{ | 
                                                        
| 67 | 74 | $config_vars->image = $filename;  | 
                                                        
| 68 | 75 | }  | 
                                                        
@@ -70,11 +77,15 @@ discard block  | 
                                                    ||
| 70 | 77 | }  | 
                                                        
| 71 | 78 | }  | 
                                                        
| 72 | 79 | }  | 
                                                        
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;  | 
                                                        |
| 80 | +		if(!$config_vars->image && $config_vars->del_image != 'Y') { | 
                                                        |
| 81 | + $config_vars->image = $total_config->image;  | 
                                                        |
| 82 | + }  | 
                                                        |
| 74 | 83 | |
| 75 | 84 | $output = $this->setFeedConfig($config_vars);  | 
                                                        
| 76 | 85 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated';  | 
                                                        |
| 86 | +		if(!$alt_message) { | 
                                                        |
| 87 | + $alt_message = 'success_updated';  | 
                                                        |
| 88 | + }  | 
                                                        |
| 78 | 89 | |
| 79 | 90 | $alt_message = Context::getLang($alt_message);  | 
                                                        
| 80 | 91 | $this->setMessage($alt_message, 'info');  | 
                                                        
@@ -139,7 +150,9 @@ discard block  | 
                                                    ||
| 139 | 150 | return new Object(-1, 'msg_invalid_request');  | 
                                                        
| 140 | 151 | }  | 
                                                        
| 141 | 152 | |
| 142 | -				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; | 
                                                        |
| 153 | +				if(!in_array($open_rss, array('Y','H','N'))) { | 
                                                        |
| 154 | + $open_rss = 'N';  | 
                                                        |
| 155 | + }  | 
                                                        |
| 143 | 156 | |
| 144 | 157 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);  | 
                                                        
| 145 | 158 | }  | 
                                                        
@@ -23,20 +23,20 @@ discard block  | 
                                                    ||
| 23 | 23 | */  | 
                                                        
| 24 | 24 | function procLayoutAdminInsert()  | 
                                                        
| 25 | 25 |  	{ | 
                                                        
| 26 | -		if(Context::get('layout') == 'faceoff') return $this->stop('not supported'); | 
                                                        |
| 26 | +		if (Context::get('layout') == 'faceoff') return $this->stop('not supported'); | 
                                                        |
| 27 | 27 | |
| 28 | 28 | // Get information to create a layout  | 
                                                        
| 29 | 29 |  		$site_module_info = Context::get('site_module_info'); | 
                                                        
| 30 | - $args->site_srl = (int)$site_module_info->site_srl;  | 
                                                        |
| 30 | + $args->site_srl = (int) $site_module_info->site_srl;  | 
                                                        |
| 31 | 31 | $args->layout_srl = getNextSequence();  | 
                                                        
| 32 | 32 |  		$args->layout = Context::get('layout'); | 
                                                        
| 33 | 33 |  		$args->title = Context::get('title'); | 
                                                        
| 34 | 34 |  		$args->layout_type = Context::get('_layout_type'); | 
                                                        
| 35 | - if(!$args->layout_type) $args->layout_type = "P";  | 
                                                        |
| 35 | + if (!$args->layout_type) $args->layout_type = "P";  | 
                                                        |
| 36 | 36 | |
| 37 | 37 | // Insert into the DB  | 
                                                        
| 38 | 38 | $output = $this->insertLayout($args);  | 
                                                        
| 39 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 39 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 40 | 40 | |
| 41 | 41 | // initiate if it is faceoff layout  | 
                                                        
| 42 | 42 | $this->initLayout($args->layout_srl, $args->layout);  | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 |  	{ | 
                                                        
| 71 | 71 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 72 | 72 | // Import a sample layout if it is faceoff  | 
                                                        
| 73 | - if($oLayoutModel->useDefaultLayout($layout_name))  | 
                                                        |
| 73 | + if ($oLayoutModel->useDefaultLayout($layout_name))  | 
                                                        |
| 74 | 74 |  		{ | 
                                                        
| 75 | 75 | $this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar');  | 
                                                        
| 76 | 76 | // Remove a directory  | 
                                                        
@@ -101,25 +101,25 @@ discard block  | 
                                                    ||
| 101 | 101 | $is_sitemap = $extra_vars->is_sitemap;  | 
                                                        
| 102 | 102 | unset($extra_vars->is_sitemap);  | 
                                                        
| 103 | 103 | |
| 104 | -		$args = Context::gets('layout_srl','title'); | 
                                                        |
| 104 | +		$args = Context::gets('layout_srl', 'title'); | 
                                                        |
| 105 | 105 | // Get layout information  | 
                                                        
| 106 | 106 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 107 | 107 |  		$oMenuAdminModel = getAdminModel('menu'); | 
                                                        
| 108 | 108 | $layout_info = $oLayoutModel->getLayout($args->layout_srl);  | 
                                                        
| 109 | 109 | |
| 110 | - if($layout_info->menu)  | 
                                                        |
| 110 | + if ($layout_info->menu)  | 
                                                        |
| 111 | 111 |  		{ | 
                                                        
| 112 | 112 | $menus = get_object_vars($layout_info->menu);  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | - if(count($menus))  | 
                                                        |
| 114 | + if (count($menus))  | 
                                                        |
| 115 | 115 |  		{ | 
                                                        
| 116 | - foreach($menus as $menu_id => $val)  | 
                                                        |
| 116 | + foreach ($menus as $menu_id => $val)  | 
                                                        |
| 117 | 117 |  			{ | 
                                                        
| 118 | 118 | $menu_srl = Context::get($menu_id);  | 
                                                        
| 119 | - if(!$menu_srl) continue;  | 
                                                        |
| 119 | + if (!$menu_srl) continue;  | 
                                                        |
| 120 | 120 | |
| 121 | 121 | // if menu is -1, get default menu in site  | 
                                                        
| 122 | - if($menu_srl == -1)  | 
                                                        |
| 122 | + if ($menu_srl == -1)  | 
                                                        |
| 123 | 123 |  				{ | 
                                                        
| 124 | 124 |  					$oModuleModel = getModel('module'); | 
                                                        
| 125 | 125 | $start_module = $oModuleModel->getSiteInfo(0, $columnList);  | 
                                                        
@@ -127,7 +127,7 @@ discard block  | 
                                                    ||
| 127 | 127 | $tmpArgs->url = $start_module->mid;  | 
                                                        
| 128 | 128 | $tmpArgs->site_srl = 0;  | 
                                                        
| 129 | 129 |  					$output = executeQuery('menu.getMenuItemByUrl', $tmpArgs); | 
                                                        
| 130 | - if(!$output->toBool())  | 
                                                        |
| 130 | + if (!$output->toBool())  | 
                                                        |
| 131 | 131 |  					{ | 
                                                        
| 132 | 132 | return new Object(-1, 'fail_to_update');  | 
                                                        
| 133 | 133 | }  | 
                                                        
@@ -143,31 +143,31 @@ discard block  | 
                                                    ||
| 143 | 143 |  				$apply_layout = Context::get('apply_layout'); | 
                                                        
| 144 | 144 |  				$apply_mobile_view = Context::get('apply_mobile_view'); | 
                                                        
| 145 | 145 | |
| 146 | - if($apply_layout=='Y' || $apply_mobile_view=='Y')  | 
                                                        |
| 146 | + if ($apply_layout == 'Y' || $apply_mobile_view == 'Y')  | 
                                                        |
| 147 | 147 |  				{ | 
                                                        
| 148 | 148 | $menu_args = new stdClass();  | 
                                                        
| 149 | 149 | $menu_args->menu_srl = $menu_srl;  | 
                                                        
| 150 | 150 | $menu_args->site_srl = $layout_info->site_srl;  | 
                                                        
| 151 | 151 |  					$output = executeQueryArray('layout.getLayoutModules', $menu_args); | 
                                                        
| 152 | - if($output->data)  | 
                                                        |
| 152 | + if ($output->data)  | 
                                                        |
| 153 | 153 |  					{ | 
                                                        
| 154 | 154 | $modules = array();  | 
                                                        
| 155 | - for($i=0;$i<count($output->data);$i++)  | 
                                                        |
| 155 | + for ($i = 0; $i < count($output->data); $i++)  | 
                                                        |
| 156 | 156 |  						{ | 
                                                        
| 157 | 157 | $modules[] = $output->data[$i]->module_srl;  | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | 159 | |
| 160 | - if(count($modules))  | 
                                                        |
| 160 | + if (count($modules))  | 
                                                        |
| 161 | 161 |  						{ | 
                                                        
| 162 | 162 | $update_args = new stdClass();  | 
                                                        
| 163 | -							$update_args->module_srls = implode(',',$modules); | 
                                                        |
| 164 | - if($apply_layout == "Y")  | 
                                                        |
| 163 | +							$update_args->module_srls = implode(',', $modules); | 
                                                        |
| 164 | + if ($apply_layout == "Y")  | 
                                                        |
| 165 | 165 |  							{ | 
                                                        
| 166 | 166 | $update_args->layout_srl = $args->layout_srl;  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | - if($layout_info->layout_type == "M")  | 
                                                        |
| 168 | + if ($layout_info->layout_type == "M")  | 
                                                        |
| 169 | 169 |  							{ | 
                                                        
| 170 | -								if(Context::get('apply_mobile_view') == "Y") | 
                                                        |
| 170 | +								if (Context::get('apply_mobile_view') == "Y") | 
                                                        |
| 171 | 171 |  								{ | 
                                                        
| 172 | 172 | $update_args->use_mobile = "Y";  | 
                                                        
| 173 | 173 | }  | 
                                                        
@@ -179,7 +179,7 @@ discard block  | 
                                                    ||
| 179 | 179 | }  | 
                                                        
| 180 | 180 | |
| 181 | 181 |  							$oCacheHandler = CacheHandler::getInstance('object', null, true); | 
                                                        
| 182 | - if($oCacheHandler->isSupport())  | 
                                                        |
| 182 | + if ($oCacheHandler->isSupport())  | 
                                                        |
| 183 | 183 |  							{ | 
                                                        
| 184 | 184 |  								$oCacheHandler->invalidateGroupKey('site_and_module'); | 
                                                        
| 185 | 185 | }  | 
                                                        
@@ -191,21 +191,21 @@ discard block  | 
                                                    ||
| 191 | 191 | |
| 192 | 192 |  		$tmpDir = sprintf('./files/attach/images/%s/tmp', $args->layout_srl); | 
                                                        
| 193 | 193 | // Separately handle if a type of extra_vars is an image  | 
                                                        
| 194 | - if($layout_info->extra_var)  | 
                                                        |
| 194 | + if ($layout_info->extra_var)  | 
                                                        |
| 195 | 195 |  		{ | 
                                                        
| 196 | - foreach($layout_info->extra_var as $name => $vars)  | 
                                                        |
| 196 | + foreach ($layout_info->extra_var as $name => $vars)  | 
                                                        |
| 197 | 197 |  			{ | 
                                                        
| 198 | - if($vars->type!='image') continue;  | 
                                                        |
| 198 | + if ($vars->type != 'image') continue;  | 
                                                        |
| 199 | 199 | |
| 200 | 200 |  				$fileName = $extra_vars->{$name}; | 
                                                        
| 201 | - if($vars->value == $fileName)  | 
                                                        |
| 201 | + if ($vars->value == $fileName)  | 
                                                        |
| 202 | 202 |  				{ | 
                                                        
| 203 | 203 | continue;  | 
                                                        
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
| 206 | 206 | FileHandler::removeFile($vars->value);  | 
                                                        
| 207 | 207 | |
| 208 | - if(!$fileName)  | 
                                                        |
| 208 | + if (!$fileName)  | 
                                                        |
| 209 | 209 |  				{ | 
                                                        
| 210 | 210 | continue;  | 
                                                        
| 211 | 211 | }  | 
                                                        
@@ -213,7 +213,7 @@ discard block  | 
                                                    ||
| 213 | 213 | $pathInfo = pathinfo($fileName);  | 
                                                        
| 214 | 214 |  				$tmpFileName = sprintf('%s/tmp/%s', $pathInfo['dirname'], $pathInfo['basename']); | 
                                                        
| 215 | 215 | |
| 216 | - if(!FileHandler::moveFile($tmpFileName, $fileName))  | 
                                                        |
| 216 | + if (!FileHandler::moveFile($tmpFileName, $fileName))  | 
                                                        |
| 217 | 217 |  				{ | 
                                                        
| 218 | 218 |  					unset($extra_vars->{$name}); | 
                                                        
| 219 | 219 | }  | 
                                                        
@@ -225,21 +225,21 @@ discard block  | 
                                                    ||
| 225 | 225 |  		$oModuleController = getController('module'); | 
                                                        
| 226 | 226 | $layout_config = new stdClass();  | 
                                                        
| 227 | 227 |  		$layout_config->header_script = Context::get('header_script'); | 
                                                        
| 228 | -		$oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config); | 
                                                        |
| 228 | +		$oModuleController->insertModulePartConfig('layout', $args->layout_srl, $layout_config); | 
                                                        |
| 229 | 229 | // Save a title of the menu  | 
                                                        
| 230 | 230 | $extra_vars->menu_name_list = $menu_name_list;  | 
                                                        
| 231 | 231 | // Variable setting for DB insert  | 
                                                        
| 232 | 232 | $args->extra_vars = serialize($extra_vars);  | 
                                                        
| 233 | 233 | |
| 234 | 234 | $output = $this->updateLayout($args);  | 
                                                        
| 235 | - if(!$output->toBool())  | 
                                                        |
| 235 | + if (!$output->toBool())  | 
                                                        |
| 236 | 236 |  		{ | 
                                                        
| 237 | 237 | return $output;  | 
                                                        
| 238 | 238 | }  | 
                                                        
| 239 | 239 | |
| 240 | 240 | FileHandler::removeDir($tmpDir);  | 
                                                        
| 241 | 241 | |
| 242 | - if(!$is_sitemap)  | 
                                                        |
| 242 | + if (!$is_sitemap)  | 
                                                        |
| 243 | 243 |  		{ | 
                                                        
| 244 | 244 |  			return $this->setRedirectUrl(Context::get('error_return_url'), $output); | 
                                                        
| 245 | 245 | }  | 
                                                        
@@ -258,7 +258,7 @@ discard block  | 
                                                    ||
| 258 | 258 | */  | 
                                                        
| 259 | 259 |  	function updateLayout($args) { | 
                                                        
| 260 | 260 |  		$output = executeQuery('layout.updateLayout', $args); | 
                                                        
| 261 | - if($output->toBool())  | 
                                                        |
| 261 | + if ($output->toBool())  | 
                                                        |
| 262 | 262 |  		{ | 
                                                        
| 263 | 263 |  			$oLayoutModel = getModel('layout'); | 
                                                        
| 264 | 264 | $cache_file = $oLayoutModel->getUserLayoutCache($args->layout_srl, Context::getLangType());  | 
                                                        
@@ -289,13 +289,13 @@ discard block  | 
                                                    ||
| 289 | 289 |  	{ | 
                                                        
| 290 | 290 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 291 | 291 | |
| 292 | - if($force)  | 
                                                        |
| 292 | + if ($force)  | 
                                                        |
| 293 | 293 |  		{ | 
                                                        
| 294 | 294 | $layoutInfo = $oLayoutModel->getLayout($layout_srl);  | 
                                                        
| 295 | - if($layoutInfo)  | 
                                                        |
| 295 | + if ($layoutInfo)  | 
                                                        |
| 296 | 296 |  			{ | 
                                                        
| 297 | 297 |  				$layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl', 'layout')); | 
                                                        
| 298 | - if(count($layoutList) <= 1)  | 
                                                        |
| 298 | + if (count($layoutList) <= 1)  | 
                                                        |
| 299 | 299 |  				{ | 
                                                        
| 300 | 300 | // uninstall package  | 
                                                        
| 301 | 301 | $path = $layoutInfo->path;  | 
                                                        
@@ -304,7 +304,7 @@ discard block  | 
                                                    ||
| 304 | 304 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($path);  | 
                                                        
| 305 | 305 |  					$oAutoinstallAdminController = getAdminController('autoinstall'); | 
                                                        
| 306 | 306 | |
| 307 | - if($packageSrl)  | 
                                                        |
| 307 | + if ($packageSrl)  | 
                                                        |
| 308 | 308 |  					{ | 
                                                        
| 309 | 309 | $output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);  | 
                                                        
| 310 | 310 | }  | 
                                                        
@@ -313,7 +313,7 @@ discard block  | 
                                                    ||
| 313 | 313 | $output = $oAutoinstallAdminController->uninstallPackageByPath($path);  | 
                                                        
| 314 | 314 | }  | 
                                                        
| 315 | 315 | |
| 316 | - if(!$output->toBool())  | 
                                                        |
| 316 | + if (!$output->toBool())  | 
                                                        |
| 317 | 317 |  					{ | 
                                                        
| 318 | 318 | return new Object(-1, $output->message);  | 
                                                        
| 319 | 319 | }  | 
                                                        
@@ -331,9 +331,9 @@ discard block  | 
                                                    ||
| 331 | 331 | $args->layout_srl = $layout_srl;  | 
                                                        
| 332 | 332 |  		$output = executeQuery("layout.deleteLayout", $args); | 
                                                        
| 333 | 333 | |
| 334 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 334 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 335 | 335 | |
| 336 | - return new Object(0,'success_deleted');  | 
                                                        |
| 336 | + return new Object(0, 'success_deleted');  | 
                                                        |
| 337 | 337 | }  | 
                                                        
| 338 | 338 | |
| 339 | 339 | /**  | 
                                                        
@@ -353,7 +353,7 @@ discard block  | 
                                                    ||
| 353 | 353 |  		$code_css   = Context::get('code_css'); | 
                                                        
| 354 | 354 | $is_post = ($_SERVER['REQUEST_METHOD'] == 'POST');  | 
                                                        
| 355 | 355 | |
| 356 | - if(!$layout_srl || !$code || !$is_post)  | 
                                                        |
| 356 | + if (!$layout_srl || !$code || !$is_post)  | 
                                                        |
| 357 | 357 |  		{ | 
                                                        
| 358 | 358 | return new Object(-1, 'msg_invalid_request');  | 
                                                        
| 359 | 359 | }  | 
                                                        
@@ -376,7 +376,7 @@ discard block  | 
                                                    ||
| 376 | 376 | function procLayoutAdminCodeReset()  | 
                                                        
| 377 | 377 |  	{ | 
                                                        
| 378 | 378 |  		$layout_srl = Context::get('layout_srl'); | 
                                                        
| 379 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 379 | + if (!$layout_srl) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 380 | 380 | |
| 381 | 381 | // delete user layout file  | 
                                                        
| 382 | 382 |  		$oLayoutModel = getModel('layout'); | 
                                                        
@@ -386,7 +386,7 @@ discard block  | 
                                                    ||
| 386 | 386 | $info = $oLayoutModel->getLayout($layout_srl);  | 
                                                        
| 387 | 387 | |
| 388 | 388 | // if face off delete, tmp file  | 
                                                        
| 389 | - if($oLayoutModel->useDefaultLayout($info->layout))  | 
                                                        |
| 389 | + if ($oLayoutModel->useDefaultLayout($info->layout))  | 
                                                        |
| 390 | 390 |  		{ | 
                                                        
| 391 | 391 | $this->deleteUserLayoutTempFile($layout_srl);  | 
                                                        
| 392 | 392 | $faceoff_css = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl);  | 
                                                        
@@ -404,11 +404,11 @@ discard block  | 
                                                    ||
| 404 | 404 | */  | 
                                                        
| 405 | 405 | function procLayoutAdminUserImageUpload()  | 
                                                        
| 406 | 406 |  	{ | 
                                                        
| 407 | - if(!Context::isUploaded()) exit();  | 
                                                        |
| 407 | + if (!Context::isUploaded()) exit();  | 
                                                        |
| 408 | 408 | |
| 409 | 409 |  		$image = Context::get('user_layout_image'); | 
                                                        
| 410 | 410 |  		$layout_srl = Context::get('layout_srl'); | 
                                                        
| 411 | - if(!is_uploaded_file($image['tmp_name'])) exit();  | 
                                                        |
| 411 | + if (!is_uploaded_file($image['tmp_name'])) exit();  | 
                                                        |
| 412 | 412 | |
| 413 | 413 | $this->insertUserLayoutImage($layout_srl, $image);  | 
                                                        
| 414 | 414 | $this->setTemplatePath($this->module_path.'tpl');  | 
                                                        
@@ -423,24 +423,24 @@ discard block  | 
                                                    ||
| 423 | 423 | * @param object $source file data  | 
                                                        
| 424 | 424 | * @return boolean (true : success, false : fail)  | 
                                                        
| 425 | 425 | */  | 
                                                        
| 426 | - function insertUserLayoutImage($layout_srl,$source)  | 
                                                        |
| 426 | + function insertUserLayoutImage($layout_srl, $source)  | 
                                                        |
| 427 | 427 |  	{ | 
                                                        
| 428 | 428 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 429 | 429 | $path = $oLayoutModel->getUserLayoutImagePath($layout_srl);  | 
                                                        
| 430 | - if(!is_dir($path)) FileHandler::makeDir($path);  | 
                                                        |
| 430 | + if (!is_dir($path)) FileHandler::makeDir($path);  | 
                                                        |
| 431 | 431 | |
| 432 | 432 | $filename = strtolower($source['name']);  | 
                                                        
| 433 | - if($filename != urlencode($filename))  | 
                                                        |
| 433 | + if ($filename != urlencode($filename))  | 
                                                        |
| 434 | 434 |  		{ | 
                                                        
| 435 | - $ext = substr(strrchr($filename,'.'),1);  | 
                                                        |
| 435 | + $ext = substr(strrchr($filename, '.'), 1);  | 
                                                        |
| 436 | 436 |  			$filename = sprintf('%s.%s', md5($filename), $ext); | 
                                                        
| 437 | 437 | }  | 
                                                        
| 438 | 438 | |
| 439 | 439 | // Check uploaded file  | 
                                                        
| 440 | - if(!checkUploadedFile($source['tmp_name'])) return false;  | 
                                                        |
| 440 | + if (!checkUploadedFile($source['tmp_name'])) return false;  | 
                                                        |
| 441 | 441 | |
| 442 | - if(file_exists($path .'/'. $filename)) @unlink($path . $filename);  | 
                                                        |
| 443 | - if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false;  | 
                                                        |
| 442 | + if (file_exists($path.'/'.$filename)) @unlink($path.$filename);  | 
                                                        |
| 443 | + if (!move_uploaded_file($source['tmp_name'], $path.$filename)) return false;  | 
                                                        |
| 444 | 444 | return true;  | 
                                                        
| 445 | 445 | }  | 
                                                        
| 446 | 446 | |
@@ -452,7 +452,7 @@ discard block  | 
                                                    ||
| 452 | 452 |  	{ | 
                                                        
| 453 | 453 |  		$filename = Context::get('filename'); | 
                                                        
| 454 | 454 |  		$layout_srl = Context::get('layout_srl'); | 
                                                        
| 455 | - $this->removeUserLayoutImage($layout_srl,$filename);  | 
                                                        |
| 455 | + $this->removeUserLayoutImage($layout_srl, $filename);  | 
                                                        |
| 456 | 456 |  		$this->setMessage('success_deleted'); | 
                                                        
| 457 | 457 |  		$this->setRedirectUrl(Context::get('error_return_url')); | 
                                                        
| 458 | 458 | }  | 
                                                        
@@ -463,11 +463,11 @@ discard block  | 
                                                    ||
| 463 | 463 | * @param string $filename  | 
                                                        
| 464 | 464 | * @return void  | 
                                                        
| 465 | 465 | */  | 
                                                        
| 466 | - function removeUserLayoutImage($layout_srl,$filename)  | 
                                                        |
| 466 | + function removeUserLayoutImage($layout_srl, $filename)  | 
                                                        |
| 467 | 467 |  	{ | 
                                                        
| 468 | 468 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 469 | 469 | $path = $oLayoutModel->getUserLayoutImagePath($layout_srl);  | 
                                                        
| 470 | - @unlink($path . $filename);  | 
                                                        |
| 470 | + @unlink($path.$filename);  | 
                                                        |
| 471 | 471 | }  | 
                                                        
| 472 | 472 | |
| 473 | 473 | // deprecated  | 
                                                        
@@ -482,19 +482,19 @@ discard block  | 
                                                    ||
| 482 | 482 |  		$oModuleModel = getModel('module'); | 
                                                        
| 483 | 483 | |
| 484 | 484 |  		$mid = Context::get('mid'); | 
                                                        
| 485 | - if(!$mid) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 485 | + if (!$mid) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 486 | 486 | |
| 487 | 487 |  		$site_module_info = Context::get('site_module_info'); | 
                                                        
| 488 | 488 |  		$columnList = array('layout_srl'); | 
                                                        
| 489 | 489 | $module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList);  | 
                                                        
| 490 | 490 | $layout_srl = $module_info->layout_srl;  | 
                                                        
| 491 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 491 | + if (!$layout_srl) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 492 | 492 | |
| 493 | 493 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 494 | 494 | |
| 495 | 495 | // save tmp?  | 
                                                        
| 496 | 496 |  		$temp = Context::get('saveTemp'); | 
                                                        
| 497 | - if($temp =='Y')  | 
                                                        |
| 497 | + if ($temp == 'Y')  | 
                                                        |
| 498 | 498 |  		{ | 
                                                        
| 499 | 499 | $oLayoutModel->setUseUserLayoutTemp();  | 
                                                        
| 500 | 500 | }  | 
                                                        
@@ -504,28 +504,28 @@ discard block  | 
                                                    ||
| 504 | 504 | $this->deleteUserLayoutTempFile($layout_srl);  | 
                                                        
| 505 | 505 | }  | 
                                                        
| 506 | 506 | |
| 507 | -		$this->add('saveTemp',$temp); | 
                                                        |
| 507 | +		$this->add('saveTemp', $temp); | 
                                                        |
| 508 | 508 | |
| 509 | 509 | // write user layout  | 
                                                        
| 510 | -		$extension_obj = Context::gets('e1','e2','neck','knee'); | 
                                                        |
| 510 | +		$extension_obj = Context::gets('e1', 'e2', 'neck', 'knee'); | 
                                                        |
| 511 | 511 | |
| 512 | 512 | $file = $oLayoutModel->getUserLayoutHtml($layout_srl);  | 
                                                        
| 513 | 513 | $content = FileHandler::readFile($file);  | 
                                                        
| 514 | - $content = $this->addExtension($layout_srl,$extension_obj,$content);  | 
                                                        |
| 515 | - FileHandler::writeFile($file,$content);  | 
                                                        |
| 514 | + $content = $this->addExtension($layout_srl, $extension_obj, $content);  | 
                                                        |
| 515 | + FileHandler::writeFile($file, $content);  | 
                                                        |
| 516 | 516 | |
| 517 | 517 | // write faceoff.css  | 
                                                        
| 518 | 518 |  		$css = stripslashes(Context::get('css')); | 
                                                        
| 519 | 519 | |
| 520 | 520 | $css_file = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl);  | 
                                                        
| 521 | - FileHandler::writeFile($css_file,$css);  | 
                                                        |
| 521 | + FileHandler::writeFile($css_file, $css);  | 
                                                        |
| 522 | 522 | |
| 523 | 523 | // write ini  | 
                                                        
| 524 | -		$obj = Context::gets('type','align','column'); | 
                                                        |
| 525 | - $obj = (array)$obj;  | 
                                                        |
| 524 | +		$obj = Context::gets('type', 'align', 'column'); | 
                                                        |
| 525 | + $obj = (array) $obj;  | 
                                                        |
| 526 | 526 | $src = $oLayoutModel->getUserLayoutIniConfig($layout_srl);  | 
                                                        
| 527 | - foreach($obj as $key => $val) $src[$key] = $val;  | 
                                                        |
| 528 | - $this->insertUserLayoutValue($layout_srl,$src);  | 
                                                        |
| 527 | + foreach ($obj as $key => $val) $src[$key] = $val;  | 
                                                        |
| 528 | + $this->insertUserLayoutValue($layout_srl, $src);  | 
                                                        |
| 529 | 529 | }  | 
                                                        
| 530 | 530 | |
| 531 | 531 | /**  | 
                                                        
@@ -534,7 +534,7 @@ discard block  | 
                                                    ||
| 534 | 534 | * @param object $arr layout ini  | 
                                                        
| 535 | 535 | * @return void  | 
                                                        
| 536 | 536 | */  | 
                                                        
| 537 | - function insertUserLayoutValue($layout_srl,$arr)  | 
                                                        |
| 537 | + function insertUserLayoutValue($layout_srl, $arr)  | 
                                                        |
| 538 | 538 |  	{ | 
                                                        
| 539 | 539 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 540 | 540 | $file = $oLayoutModel->getUserLayoutIni($layout_srl);  | 
                                                        
@@ -548,24 +548,24 @@ discard block  | 
                                                    ||
| 548 | 548 | * @param string $content  | 
                                                        
| 549 | 549 | * @return string  | 
                                                        
| 550 | 550 | */  | 
                                                        
| 551 | - function addExtension($layout_srl,$arg,$content)  | 
                                                        |
| 551 | + function addExtension($layout_srl, $arg, $content)  | 
                                                        |
| 552 | 552 |  	{ | 
                                                        
| 553 | 553 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 554 | 554 | $reg = '/(<\!\-\- start\-e1 \-\->)(.*)(<\!\-\- end\-e1 \-\->)/i';  | 
                                                        
| 555 | - $extension_content = '\1' .stripslashes($arg->e1) . '\3';  | 
                                                        |
| 556 | - $content = preg_replace($reg,$extension_content,$content);  | 
                                                        |
| 555 | + $extension_content = '\1'.stripslashes($arg->e1).'\3';  | 
                                                        |
| 556 | + $content = preg_replace($reg, $extension_content, $content);  | 
                                                        |
| 557 | 557 | |
| 558 | 558 | $reg = '/(<\!\-\- start\-e2 \-\->)(.*)(<\!\-\- end\-e2 \-\->)/i';  | 
                                                        
| 559 | - $extension_content = '\1' .stripslashes($arg->e2) . '\3';  | 
                                                        |
| 560 | - $content = preg_replace($reg,$extension_content,$content);  | 
                                                        |
| 559 | + $extension_content = '\1'.stripslashes($arg->e2).'\3';  | 
                                                        |
| 560 | + $content = preg_replace($reg, $extension_content, $content);  | 
                                                        |
| 561 | 561 | |
| 562 | 562 | $reg = '/(<\!\-\- start\-neck \-\->)(.*)(<\!\-\- end\-neck \-\->)/i';  | 
                                                        
| 563 | - $extension_content = '\1' .stripslashes($arg->neck) . '\3';  | 
                                                        |
| 564 | - $content = preg_replace($reg,$extension_content,$content);  | 
                                                        |
| 563 | + $extension_content = '\1'.stripslashes($arg->neck).'\3';  | 
                                                        |
| 564 | + $content = preg_replace($reg, $extension_content, $content);  | 
                                                        |
| 565 | 565 | |
| 566 | 566 | $reg = '/(<\!\-\- start\-knee \-\->)(.*)(<\!\-\- end\-knee \-\->)/i';  | 
                                                        
| 567 | - $extension_content = '\1' .stripslashes($arg->knee) . '\3';  | 
                                                        |
| 568 | - $content = preg_replace($reg,$extension_content,$content);  | 
                                                        |
| 567 | + $extension_content = '\1'.stripslashes($arg->knee).'\3';  | 
                                                        |
| 568 | + $content = preg_replace($reg, $extension_content, $content);  | 
                                                        |
| 569 | 569 | return $content;  | 
                                                        
| 570 | 570 | }  | 
                                                        
| 571 | 571 | |
@@ -578,7 +578,7 @@ discard block  | 
                                                    ||
| 578 | 578 |  	{ | 
                                                        
| 579 | 579 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 580 | 580 | $file_list = $oLayoutModel->getUserLayoutTempFileList($layout_srl);  | 
                                                        
| 581 | - foreach($file_list as $key => $file)  | 
                                                        |
| 581 | + foreach ($file_list as $key => $file)  | 
                                                        |
| 582 | 582 |  		{ | 
                                                        
| 583 | 583 | FileHandler::removeFile($file);  | 
                                                        
| 584 | 584 | }  | 
                                                        
@@ -591,7 +591,7 @@ discard block  | 
                                                    ||
| 591 | 591 | function procLayoutAdminUserLayoutExport()  | 
                                                        
| 592 | 592 |  	{ | 
                                                        
| 593 | 593 |  		$layout_srl = Context::get('layout_srl'); | 
                                                        
| 594 | -		if(!$layout_srl) return new Object('-1','msg_invalid_request'); | 
                                                        |
| 594 | +		if (!$layout_srl) return new Object('-1', 'msg_invalid_request'); | 
                                                        |
| 595 | 595 | |
| 596 | 596 | require_once(_XE_PATH_.'libs/tar.class.php');  | 
                                                        
| 597 | 597 |  		$oLayoutModel = getModel('layout'); | 
                                                        
@@ -606,30 +606,30 @@ discard block  | 
                                                    ||
| 606 | 606 | $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);  | 
                                                        
| 607 | 607 | unset($file_list[2]);  | 
                                                        
| 608 | 608 | |
| 609 | - foreach($file_list as $file)  | 
                                                        |
| 609 | + foreach ($file_list as $file)  | 
                                                        |
| 610 | 610 |  		{ | 
                                                        
| 611 | -			if(strncasecmp('images', $file, 6) === 0) continue; | 
                                                        |
| 611 | +			if (strncasecmp('images', $file, 6) === 0) continue; | 
                                                        |
| 612 | 612 | |
| 613 | 613 | // replace path  | 
                                                        
| 614 | - $file = $target_path . $file;  | 
                                                        |
| 614 | + $file = $target_path.$file;  | 
                                                        |
| 615 | 615 | $content = FileHandler::readFile($file);  | 
                                                        
| 616 | -			$pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/'; | 
                                                        |
| 617 | - if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css')  | 
                                                        |
| 616 | +			$pattern = '/(http:\/\/[^ ]+)?(\.\/)?'.str_replace('/', '\/', (str_replace('./', '', $file_path))).'/'; | 
                                                        |
| 617 | + if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css')  | 
                                                        |
| 618 | 618 | $content = preg_replace($pattern, '../', $content);  | 
                                                        
| 619 | 619 | else  | 
                                                        
| 620 | 620 | $content = preg_replace($pattern, './', $content);  | 
                                                        
| 621 | 621 | |
| 622 | 622 | // replace ini config  | 
                                                        
| 623 | - foreach($ini_config as $key => $value)  | 
                                                        |
| 623 | + foreach ($ini_config as $key => $value)  | 
                                                        |
| 624 | 624 |  			{ | 
                                                        
| 625 | -				$content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content); | 
                                                        |
| 625 | +				$content = str_replace('{$layout_info->faceoff_ini_config[\''.$key.'\']}', $value, $content); | 
                                                        |
| 626 | 626 | }  | 
                                                        
| 627 | 627 | |
| 628 | 628 | FileHandler::writeFile($file, $content);  | 
                                                        
| 629 | 629 | }  | 
                                                        
| 630 | 630 | |
| 631 | 631 | // make info.xml  | 
                                                        
| 632 | - $info_file = $target_path . 'conf/info.xml';  | 
                                                        |
| 632 | + $info_file = $target_path.'conf/info.xml';  | 
                                                        |
| 633 | 633 |  		FileHandler::copyFile('./modules/layout/faceoff/conf/info.xml', $info_file); | 
                                                        
| 634 | 634 | $content = FileHandler::readFile($info_file);  | 
                                                        
| 635 | 635 |  		$content = str_replace('type="faceoff"', '', $content); | 
                                                        
@@ -637,19 +637,19 @@ discard block  | 
                                                    ||
| 637 | 637 | $file_list[] = 'conf/info.xml';  | 
                                                        
| 638 | 638 | |
| 639 | 639 | // make css file  | 
                                                        
| 640 | - $css_file = $target_path . 'css/layout.css';  | 
                                                        |
| 640 | + $css_file = $target_path.'css/layout.css';  | 
                                                        |
| 641 | 641 |  		FileHandler::copyFile('./modules/layout/faceoff/css/layout.css', $css_file); | 
                                                        
| 642 | 642 |  		$content = FileHandler::readFile('./modules/layout/tpl/css/widget.css'); | 
                                                        
| 643 | - FileHandler::writeFile($css_file, "\n" . $content, 'a');  | 
                                                        |
| 644 | - $content = FileHandler::readFile($target_path . 'faceoff.css');  | 
                                                        |
| 645 | - FileHandler::writeFile($css_file, "\n" . $content, 'a');  | 
                                                        |
| 646 | - $content = FileHandler::readFile($target_path . 'layout.css');  | 
                                                        |
| 647 | - FileHandler::writeFile($css_file, "\n" . $content, 'a');  | 
                                                        |
| 643 | + FileHandler::writeFile($css_file, "\n".$content, 'a');  | 
                                                        |
| 644 | + $content = FileHandler::readFile($target_path.'faceoff.css');  | 
                                                        |
| 645 | + FileHandler::writeFile($css_file, "\n".$content, 'a');  | 
                                                        |
| 646 | + $content = FileHandler::readFile($target_path.'layout.css');  | 
                                                        |
| 647 | + FileHandler::writeFile($css_file, "\n".$content, 'a');  | 
                                                        |
| 648 | 648 | |
| 649 | 649 | // css load  | 
                                                        
| 650 | - $content = FileHandler::readFile($target_path . 'layout.html');  | 
                                                        |
| 651 | - $content = "<load target=\"css/layout.css\" />\n" . $content;  | 
                                                        |
| 652 | - FileHandler::writeFile($target_path . 'layout.html', $content);  | 
                                                        |
| 650 | + $content = FileHandler::readFile($target_path.'layout.html');  | 
                                                        |
| 651 | + $content = "<load target=\"css/layout.css\" />\n".$content;  | 
                                                        |
| 652 | + FileHandler::writeFile($target_path.'layout.html', $content);  | 
                                                        |
| 653 | 653 | unset($file_list[3]);  | 
                                                        
| 654 | 654 | unset($file_list[1]);  | 
                                                        
| 655 | 655 | $file_list[] = 'css/layout.css';  | 
                                                        
@@ -658,16 +658,16 @@ discard block  | 
                                                    ||
| 658 | 658 | $tar = new tar();  | 
                                                        
| 659 | 659 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));  | 
                                                        
| 660 | 660 | chdir($user_layout_path);  | 
                                                        
| 661 | - foreach($file_list as $key => $file) $tar->addFile($file);  | 
                                                        |
| 661 | + foreach ($file_list as $key => $file) $tar->addFile($file);  | 
                                                        |
| 662 | 662 | |
| 663 | 663 | $stream = $tar->toTarStream();  | 
                                                        
| 664 | -		$filename = 'faceoff_' . date('YmdHis') . '.tar'; | 
                                                        |
| 664 | +		$filename = 'faceoff_'.date('YmdHis').'.tar'; | 
                                                        |
| 665 | 665 |  		header("Cache-Control: "); | 
                                                        
| 666 | 666 |  		header("Pragma: "); | 
                                                        
| 667 | 667 |  		header("Content-Type: application/x-compressed"); | 
                                                        
| 668 | -		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | 
                                                        |
| 668 | +		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); | 
                                                        |
| 669 | 669 |  		//            header("Content-Length: " .strlen($stream)); ?? why?? | 
                                                        
| 670 | -		header('Content-Disposition: attachment; filename="'. $filename .'"'); | 
                                                        |
| 670 | +		header('Content-Disposition: attachment; filename="'.$filename.'"'); | 
                                                        |
| 671 | 671 |  		header("Content-Transfer-Encoding: binary\n"); | 
                                                        
| 672 | 672 | echo $stream;  | 
                                                        
| 673 | 673 | // Close Context and then exit  | 
                                                        
@@ -689,18 +689,18 @@ discard block  | 
                                                    ||
| 689 | 689 |  		return $this->stop('not supported'); | 
                                                        
| 690 | 690 | |
| 691 | 691 | // check upload  | 
                                                        
| 692 | - if(!Context::isUploaded()) exit();  | 
                                                        |
| 692 | + if (!Context::isUploaded()) exit();  | 
                                                        |
| 693 | 693 |  		$file = Context::get('file'); | 
                                                        
| 694 | - if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit();  | 
                                                        |
| 694 | + if (!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit();  | 
                                                        |
| 695 | 695 | |
| 696 | - if(substr_compare($file['name'], '.tar', -4) !== 0) exit();  | 
                                                        |
| 696 | + if (substr_compare($file['name'], '.tar', -4) !== 0) exit();  | 
                                                        |
| 697 | 697 | |
| 698 | 698 |  		$layout_srl = Context::get('layout_srl'); | 
                                                        
| 699 | - if(!$layout_srl) exit();  | 
                                                        |
| 699 | + if (!$layout_srl) exit();  | 
                                                        |
| 700 | 700 | |
| 701 | 701 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 702 | 702 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));  | 
                                                        
| 703 | - if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit();  | 
                                                        |
| 703 | + if (!move_uploaded_file($file['tmp_name'], $user_layout_path.'faceoff.tar')) exit();  | 
                                                        |
| 704 | 704 | |
| 705 | 705 | $this->importLayout($layout_srl, $user_layout_path.'faceoff.tar');  | 
                                                        
| 706 | 706 | |
@@ -714,12 +714,12 @@ discard block  | 
                                                    ||
| 714 | 714 | function procLayoutAdminCopyLayout()  | 
                                                        
| 715 | 715 |  	{ | 
                                                        
| 716 | 716 | $sourceArgs = Context::getRequestVars();  | 
                                                        
| 717 | - if($sourceArgs->layout == 'faceoff')  | 
                                                        |
| 717 | + if ($sourceArgs->layout == 'faceoff')  | 
                                                        |
| 718 | 718 |  		{ | 
                                                        
| 719 | 719 |  			return $this->stop('not supported'); | 
                                                        
| 720 | 720 | }  | 
                                                        
| 721 | 721 | |
| 722 | - if(!$sourceArgs->layout_srl)  | 
                                                        |
| 722 | + if (!$sourceArgs->layout_srl)  | 
                                                        |
| 723 | 723 |  		{ | 
                                                        
| 724 | 724 |  			return $this->stop('msg_empty_origin_layout'); | 
                                                        
| 725 | 725 | }  | 
                                                        
@@ -727,12 +727,12 @@ discard block  | 
                                                    ||
| 727 | 727 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 728 | 728 | $layout = $oLayoutModel->getLayout($sourceArgs->layout_srl);  | 
                                                        
| 729 | 729 | |
| 730 | - if(!$sourceArgs->title)  | 
                                                        |
| 730 | + if (!$sourceArgs->title)  | 
                                                        |
| 731 | 731 |  		{ | 
                                                        
| 732 | 732 | $sourceArgs->title = array($layout->title.'_'.$this->_makeRandomMid());  | 
                                                        
| 733 | 733 | }  | 
                                                        
| 734 | 734 | |
| 735 | - if(!is_array($sourceArgs->title) || count($sourceArgs->title) == 0)  | 
                                                        |
| 735 | + if (!is_array($sourceArgs->title) || count($sourceArgs->title) == 0)  | 
                                                        |
| 736 | 736 |  		{ | 
                                                        
| 737 | 737 |  			return $this->stop('msg_empty_target_layout'); | 
                                                        
| 738 | 738 | }  | 
                                                        
@@ -742,11 +742,11 @@ discard block  | 
                                                    ||
| 742 | 742 | $args->extra_vars = $output->extra_vars;  | 
                                                        
| 743 | 743 | $extra_vars = unserialize($args->extra_vars);  | 
                                                        
| 744 | 744 | |
| 745 | -		if($layout->extra_var_count) { | 
                                                        |
| 745 | +		if ($layout->extra_var_count) { | 
                                                        |
| 746 | 746 | $reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/";  | 
                                                        
| 747 | -			if($extra_vars) foreach($extra_vars as $key => $val) { | 
                                                        |
| 748 | -				if($layout->extra_var->{$key}->type == 'image') { | 
                                                        |
| 749 | - if(!preg_match($reg,$val,$matches)) continue;  | 
                                                        |
| 747 | +			if ($extra_vars) foreach ($extra_vars as $key => $val) { | 
                                                        |
| 748 | +				if ($layout->extra_var->{$key}->type == 'image') { | 
                                                        |
| 749 | + if (!preg_match($reg, $val, $matches)) continue;  | 
                                                        |
| 750 | 750 | $image_list[$key]->filename = $matches[2];  | 
                                                        
| 751 | 751 | $image_list[$key]->old_file = $val;  | 
                                                        
| 752 | 752 | }  | 
                                                        
@@ -758,19 +758,19 @@ discard block  | 
                                                    ||
| 758 | 758 | $layout_config->header_script = $extra_vars->header_script;  | 
                                                        
| 759 | 759 | |
| 760 | 760 | // Get information to create a layout  | 
                                                        
| 761 | - $args->site_srl = (int)$layout->site_srl;  | 
                                                        |
| 761 | + $args->site_srl = (int) $layout->site_srl;  | 
                                                        |
| 762 | 762 | $args->layout = $layout->layout;  | 
                                                        
| 763 | 763 | $args->layout_type = $layout->layout_type;  | 
                                                        
| 764 | - if(!$args->layout_type) $args->layout_type = "P";  | 
                                                        |
| 764 | + if (!$args->layout_type) $args->layout_type = "P";  | 
                                                        |
| 765 | 765 | |
| 766 | 766 | $oDB = &DB::getInstance();  | 
                                                        
| 767 | 767 | $oDB->begin();  | 
                                                        
| 768 | 768 | |
| 769 | - if(is_array($sourceArgs->title))  | 
                                                        |
| 769 | + if (is_array($sourceArgs->title))  | 
                                                        |
| 770 | 770 |  		{ | 
                                                        
| 771 | - foreach($sourceArgs->title AS $key=>$value)  | 
                                                        |
| 771 | + foreach ($sourceArgs->title AS $key=>$value)  | 
                                                        |
| 772 | 772 |  			{ | 
                                                        
| 773 | - if(!trim($value))  | 
                                                        |
| 773 | + if (!trim($value))  | 
                                                        |
| 774 | 774 |  				{ | 
                                                        
| 775 | 775 | continue;  | 
                                                        
| 776 | 776 | }  | 
                                                        
@@ -778,9 +778,9 @@ discard block  | 
                                                    ||
| 778 | 778 | $args->layout_srl = getNextSequence();  | 
                                                        
| 779 | 779 | $args->title = $value;  | 
                                                        
| 780 | 780 | |
| 781 | -				if(is_array($image_list)) { | 
                                                        |
| 782 | -					foreach($image_list as $key=>$val) { | 
                                                        |
| 783 | -						$new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl,$val->filename); | 
                                                        |
| 781 | +				if (is_array($image_list)) { | 
                                                        |
| 782 | +					foreach ($image_list as $key=>$val) { | 
                                                        |
| 783 | +						$new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl, $val->filename); | 
                                                        |
| 784 | 784 | FileHandler::copyFile($val->old_file, $new_file);  | 
                                                        
| 785 | 785 |  						$extra_vars->{$key} = $new_file; | 
                                                        
| 786 | 786 | }  | 
                                                        
@@ -792,7 +792,7 @@ discard block  | 
                                                    ||
| 792 | 792 | |
| 793 | 793 | // Insert into the DB  | 
                                                        
| 794 | 794 | $output = $this->insertLayout($args);  | 
                                                        
| 795 | - if(!$output->toBool())  | 
                                                        |
| 795 | + if (!$output->toBool())  | 
                                                        |
| 796 | 796 |  				{ | 
                                                        
| 797 | 797 | $oDB->rollback();  | 
                                                        
| 798 | 798 | return $output;  | 
                                                        
@@ -815,7 +815,7 @@ discard block  | 
                                                    ||
| 815 | 815 | $oDB->commit();  | 
                                                        
| 816 | 816 | |
| 817 | 817 |  		$this->setMessage('success_registed'); | 
                                                        
| 818 | -		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { | 
                                                        |
| 818 | +		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { | 
                                                        |
| 819 | 819 | global $lang;  | 
                                                        
| 820 | 820 | htmlHeader();  | 
                                                        
| 821 | 821 | alertScript($lang->success_registed);  | 
                                                        
@@ -831,9 +831,9 @@ discard block  | 
                                                    ||
| 831 | 831 |  	{ | 
                                                        
| 832 | 832 | $time = $_SERVER['REQUEST_TIME'];  | 
                                                        
| 833 | 833 | $randomString = "";  | 
                                                        
| 834 | - for($i=0;$i<4;$i++)  | 
                                                        |
| 834 | + for ($i = 0; $i < 4; $i++)  | 
                                                        |
| 835 | 835 |  		{ | 
                                                        
| 836 | - $doc = rand()%26+65;  | 
                                                        |
| 836 | + $doc = rand() % 26 + 65;  | 
                                                        |
| 837 | 837 | $randomString .= chr($doc);  | 
                                                        
| 838 | 838 | }  | 
                                                        
| 839 | 839 | |
@@ -857,12 +857,12 @@ discard block  | 
                                                    ||
| 857 | 857 | FileHandler::makeDir($targetImagePath);  | 
                                                        
| 858 | 858 | |
| 859 | 859 | $sourceFileList = $oLayoutModel->getUserLayoutFileList($sourceLayoutSrl);  | 
                                                        
| 860 | - foreach($sourceFileList as $key => $file)  | 
                                                        |
| 860 | + foreach ($sourceFileList as $key => $file)  | 
                                                        |
| 861 | 861 |  		{ | 
                                                        
| 862 | - if(is_readable($sourceLayoutPath.$file))  | 
                                                        |
| 862 | + if (is_readable($sourceLayoutPath.$file))  | 
                                                        |
| 863 | 863 |  			{ | 
                                                        
| 864 | 864 | FileHandler::copyFile($sourceLayoutPath.$file, $targetLayoutPath.$file);  | 
                                                        
| 865 | - if($file == 'layout.html' || $file == 'layout.css')  | 
                                                        |
| 865 | + if ($file == 'layout.html' || $file == 'layout.css')  | 
                                                        |
| 866 | 866 |  				{ | 
                                                        
| 867 | 867 | $this->_changeFilepathInSource($targetLayoutPath.$file, $sourceImagePath, $targetImagePath);  | 
                                                        
| 868 | 868 | }  | 
                                                        
@@ -893,9 +893,9 @@ discard block  | 
                                                    ||
| 893 | 893 |  		$oLayoutModel = getModel('layout'); | 
                                                        
| 894 | 894 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));  | 
                                                        
| 895 | 895 | $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);  | 
                                                        
| 896 | - foreach($file_list as $key => $file)  | 
                                                        |
| 896 | + foreach ($file_list as $key => $file)  | 
                                                        |
| 897 | 897 |  		{ | 
                                                        
| 898 | - FileHandler::removeFile($user_layout_path . $file);  | 
                                                        |
| 898 | + FileHandler::removeFile($user_layout_path.$file);  | 
                                                        |
| 899 | 899 | }  | 
                                                        
| 900 | 900 | |
| 901 | 901 | require_once(_XE_PATH_.'libs/tar.class.php');  | 
                                                        
@@ -904,12 +904,12 @@ discard block  | 
                                                    ||
| 904 | 904 | $tar = new tar();  | 
                                                        
| 905 | 905 | $tar->openTAR($source_file);  | 
                                                        
| 906 | 906 | // If layout.ini file does not exist  | 
                                                        
| 907 | -		if(!$tar->getFile('layout.ini')) return; | 
                                                        |
| 907 | +		if (!$tar->getFile('layout.ini')) return; | 
                                                        |
| 908 | 908 | |
| 909 | - $replace_path = getNumberingPath($layout_srl,3);  | 
                                                        |
| 910 | - foreach($tar->files as $key => $info)  | 
                                                        |
| 909 | + $replace_path = getNumberingPath($layout_srl, 3);  | 
                                                        |
| 910 | + foreach ($tar->files as $key => $info)  | 
                                                        |
| 911 | 911 |  		{ | 
                                                        
| 912 | -			FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file'])); | 
                                                        |
| 912 | +			FileHandler::writeFile($user_layout_path.$info['name'], str_replace('__LAYOUT_PATH__', $replace_path, $info['file'])); | 
                                                        |
| 913 | 913 | }  | 
                                                        
| 914 | 914 | // Remove uploaded file  | 
                                                        
| 915 | 915 | FileHandler::removeFile($source_file);  | 
                                                        
@@ -927,32 +927,32 @@ discard block  | 
                                                    ||
| 927 | 927 | $this->setTemplatePath($this->module_path.'tpl');  | 
                                                        
| 928 | 928 |  		$this->setTemplateFile("after_upload_config_image.html"); | 
                                                        
| 929 | 929 | |
| 930 | - if(!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name']))  | 
                                                        |
| 930 | + if (!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name']))  | 
                                                        |
| 931 | 931 |  		{ | 
                                                        
| 932 | 932 |  			Context::set('msg', Context::getLang('upload failed')); | 
                                                        
| 933 | 933 | return;  | 
                                                        
| 934 | 934 | }  | 
                                                        
| 935 | 935 | |
| 936 | -		if(!preg_match('/\.(jpg|jpeg|gif|png)$/i', $img['name'])) | 
                                                        |
| 936 | +		if (!preg_match('/\.(jpg|jpeg|gif|png)$/i', $img['name'])) | 
                                                        |
| 937 | 937 |  		{ | 
                                                        
| 938 | 938 |  			Context::set('msg', Context::getLang('msg_layout_image_target')); | 
                                                        
| 939 | 939 | return;  | 
                                                        
| 940 | 940 | }  | 
                                                        
| 941 | 941 | |
| 942 | 942 |  		$path = sprintf('./files/attach/images/%s/', $layoutSrl); | 
                                                        
| 943 | - $tmpPath = $path . 'tmp/';  | 
                                                        |
| 944 | - if(!FileHandler::makeDir($tmpPath))  | 
                                                        |
| 943 | + $tmpPath = $path.'tmp/';  | 
                                                        |
| 944 | + if (!FileHandler::makeDir($tmpPath))  | 
                                                        |
| 945 | 945 |  		{ | 
                                                        
| 946 | 946 |  			Context::set('msg', Context::getLang('make directory failed')); | 
                                                        
| 947 | 947 | return;  | 
                                                        
| 948 | 948 | }  | 
                                                        
| 949 | 949 | |
| 950 | - $ext = substr(strrchr($img['name'],'.'),1);  | 
                                                        |
| 951 | - $_fileName = md5(crypt(rand(1000000,900000), rand(0,100))).'.'.$ext;  | 
                                                        |
| 952 | - $fileName = $path . $_fileName;  | 
                                                        |
| 953 | - $tmpFileName = $tmpPath . $_fileName;  | 
                                                        |
| 950 | + $ext = substr(strrchr($img['name'], '.'), 1);  | 
                                                        |
| 951 | + $_fileName = md5(crypt(rand(1000000, 900000), rand(0, 100))).'.'.$ext;  | 
                                                        |
| 952 | + $fileName = $path.$_fileName;  | 
                                                        |
| 953 | + $tmpFileName = $tmpPath.$_fileName;  | 
                                                        |
| 954 | 954 | |
| 955 | - if(!move_uploaded_file($img['tmp_name'], $tmpFileName))  | 
                                                        |
| 955 | + if (!move_uploaded_file($img['tmp_name'], $tmpFileName))  | 
                                                        |
| 956 | 956 |  		{ | 
                                                        
| 957 | 957 |  			Context::set('msg', Context::getLang('move file failed')); | 
                                                        
| 958 | 958 | return;  | 
                                                        
@@ -977,9 +977,9 @@ discard block  | 
                                                    ||
| 977 | 977 |  		$oModel = getModel('layout'); | 
                                                        
| 978 | 978 | $layoutInfo = $oModel->getLayout($layoutSrl);  | 
                                                        
| 979 | 979 | |
| 980 | - if($layoutInfo->extra_var_count)  | 
                                                        |
| 980 | + if ($layoutInfo->extra_var_count)  | 
                                                        |
| 981 | 981 |  		{ | 
                                                        
| 982 | - foreach($layoutInfo->extra_var as $varId => $val)  | 
                                                        |
| 982 | + foreach ($layoutInfo->extra_var as $varId => $val)  | 
                                                        |
| 983 | 983 |  			{ | 
                                                        
| 984 | 984 |  				$newLayoutInfo->{$varId} = $val->value; | 
                                                        
| 985 | 985 | }  | 
                                                        
@@ -990,7 +990,7 @@ discard block  | 
                                                    ||
| 990 | 990 | $args->layout_srl = $layoutSrl;  | 
                                                        
| 991 | 991 | $args->extra_vars = serialize($newLayoutInfo);  | 
                                                        
| 992 | 992 | $output = $this->updateLayout($args);  | 
                                                        
| 993 | - if(!$output->toBool())  | 
                                                        |
| 993 | + if (!$output->toBool())  | 
                                                        |
| 994 | 994 |  		{ | 
                                                        
| 995 | 995 |  			Context::set('msg', Context::getLang($output->getMessage())); | 
                                                        
| 996 | 996 | return $output;  | 
                                                        
@@ -31,21 +31,21 @@ discard block  | 
                                                    ||
| 31 | 31 | * @param array $columnList  | 
                                                        
| 32 | 32 | * @return array layout lists in site  | 
                                                        
| 33 | 33 | */  | 
                                                        
| 34 | - function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array())  | 
                                                        |
| 34 | + function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array())  | 
                                                        |
| 35 | 35 |  	{ | 
                                                        
| 36 | - if(!$site_srl)  | 
                                                        |
| 36 | + if (!$site_srl)  | 
                                                        |
| 37 | 37 |  		{ | 
                                                        
| 38 | 38 |  			$site_module_info = Context::get('site_module_info'); | 
                                                        
| 39 | - $site_srl = (int)$site_module_info->site_srl;  | 
                                                        |
| 39 | + $site_srl = (int) $site_module_info->site_srl;  | 
                                                        |
| 40 | 40 | }  | 
                                                        
| 41 | 41 | $args = new stdClass();  | 
                                                        
| 42 | 42 | $args->site_srl = $site_srl;  | 
                                                        
| 43 | 43 | $args->layout_type = $layout_type;  | 
                                                        
| 44 | 44 |  		$output = executeQueryArray('layout.getLayoutList', $args, $columnList); | 
                                                        
| 45 | 45 | |
| 46 | - foreach($output->data as $no => &$val)  | 
                                                        |
| 46 | + foreach ($output->data as $no => &$val)  | 
                                                        |
| 47 | 47 |  		{ | 
                                                        
| 48 | - if(!$this->isExistsLayoutFile($val->layout, $layout_type))  | 
                                                        |
| 48 | + if (!$this->isExistsLayoutFile($val->layout, $layout_type))  | 
                                                        |
| 49 | 49 |  			{ | 
                                                        
| 50 | 50 | unset($output->data[$no]);  | 
                                                        
| 51 | 51 | }  | 
                                                        
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | |
| 54 | 54 |  		$oLayoutAdminModel = getAdminModel('layout'); | 
                                                        
| 55 | 55 | $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl);  | 
                                                        
| 56 | - if($siteDefaultLayoutSrl)  | 
                                                        |
| 56 | + if ($siteDefaultLayoutSrl)  | 
                                                        |
| 57 | 57 |  		{ | 
                                                        
| 58 | 58 | $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl);  | 
                                                        
| 59 | 59 |  			$newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout); | 
                                                        
@@ -80,24 +80,24 @@ discard block  | 
                                                    ||
| 80 | 80 | $layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType);  | 
                                                        
| 81 | 81 | $thumbs = array();  | 
                                                        
| 82 | 82 | |
| 83 | - foreach($layoutList as $key => $val)  | 
                                                        |
| 83 | + foreach ($layoutList as $key => $val)  | 
                                                        |
| 84 | 84 |  		{ | 
                                                        
| 85 | - if($thumbs[$val->layouts])  | 
                                                        |
| 85 | + if ($thumbs[$val->layouts])  | 
                                                        |
| 86 | 86 |  			{ | 
                                                        
| 87 | 87 | $val->thumbnail = $thumbs[$val->layouts];  | 
                                                        
| 88 | 88 | continue;  | 
                                                        
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
| 91 | 91 |  			$token = explode('|@|', $val->layout); | 
                                                        
| 92 | - if(count($token) == 2)  | 
                                                        |
| 92 | + if (count($token) == 2)  | 
                                                        |
| 93 | 93 |  			{ | 
                                                        
| 94 | -				$thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); | 
                                                        |
| 94 | +				$thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]); | 
                                                        |
| 95 | 95 | }  | 
                                                        
| 96 | 96 | else  | 
                                                        
| 97 | 97 |  			{ | 
                                                        
| 98 | -				$thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); | 
                                                        |
| 98 | +				$thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout); | 
                                                        |
| 99 | 99 | }  | 
                                                        
| 100 | - if(is_readable($thumbnailPath))  | 
                                                        |
| 100 | + if (is_readable($thumbnailPath))  | 
                                                        |
| 101 | 101 |  			{ | 
                                                        
| 102 | 102 | $val->thumbnail = $thumbnailPath;  | 
                                                        
| 103 | 103 | }  | 
                                                        
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | if (!$siteSrl)  | 
                                                        
| 124 | 124 |  		{ | 
                                                        
| 125 | 125 |  			$siteModuleInfo = Context::get('site_module_info'); | 
                                                        
| 126 | - $siteSrl = (int)$siteModuleInfo->site_srl;  | 
                                                        |
| 126 | + $siteSrl = (int) $siteModuleInfo->site_srl;  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | $args = new stdClass();  | 
                                                        
| 129 | 129 | $args->site_srl = $siteSrl;  | 
                                                        
@@ -133,11 +133,11 @@ discard block  | 
                                                    ||
| 133 | 133 | |
| 134 | 134 | // Create instance name list  | 
                                                        
| 135 | 135 | $instanceList = array();  | 
                                                        
| 136 | - if(is_array($output->data))  | 
                                                        |
| 136 | + if (is_array($output->data))  | 
                                                        |
| 137 | 137 |  		{ | 
                                                        
| 138 | - foreach($output->data as $no => $iInfo)  | 
                                                        |
| 138 | + foreach ($output->data as $no => $iInfo)  | 
                                                        |
| 139 | 139 |  			{ | 
                                                        
| 140 | - if($this->isExistsLayoutFile($iInfo->layout, $layoutType))  | 
                                                        |
| 140 | + if ($this->isExistsLayoutFile($iInfo->layout, $layoutType))  | 
                                                        |
| 141 | 141 |  				{ | 
                                                        
| 142 | 142 | $instanceList[] = $iInfo->layout;  | 
                                                        
| 143 | 143 | }  | 
                                                        
@@ -152,18 +152,18 @@ discard block  | 
                                                    ||
| 152 | 152 | $downloadedList = array();  | 
                                                        
| 153 | 153 | $titleList = array();  | 
                                                        
| 154 | 154 | $_downloadedList = $this->getDownloadedLayoutList($layoutType);  | 
                                                        
| 155 | - if(is_array($_downloadedList))  | 
                                                        |
| 155 | + if (is_array($_downloadedList))  | 
                                                        |
| 156 | 156 |  		{ | 
                                                        
| 157 | - foreach($_downloadedList as $dLayoutInfo)  | 
                                                        |
| 157 | + foreach ($_downloadedList as $dLayoutInfo)  | 
                                                        |
| 158 | 158 |  			{ | 
                                                        
| 159 | 159 | $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout;  | 
                                                        
| 160 | 160 | $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title;  | 
                                                        
| 161 | 161 | }  | 
                                                        
| 162 | 162 | }  | 
                                                        
| 163 | 163 | |
| 164 | - if($layout)  | 
                                                        |
| 164 | + if ($layout)  | 
                                                        |
| 165 | 165 |  		{ | 
                                                        
| 166 | - if(count($instanceList) < 1 && $downloadedList[$layout])  | 
                                                        |
| 166 | + if (count($instanceList) < 1 && $downloadedList[$layout])  | 
                                                        |
| 167 | 167 |  			{ | 
                                                        
| 168 | 168 | $insertArgs = new stdClass();  | 
                                                        
| 169 | 169 | $insertArgs->site_srl = $siteSrl;  | 
                                                        
@@ -181,7 +181,7 @@ discard block  | 
                                                    ||
| 181 | 181 |  		{ | 
                                                        
| 182 | 182 | // Get downloaded name list have no instance  | 
                                                        
| 183 | 183 | $noInstanceList = array_diff($downloadedList, $instanceList);  | 
                                                        
| 184 | - foreach($noInstanceList as $layoutName)  | 
                                                        |
| 184 | + foreach ($noInstanceList as $layoutName)  | 
                                                        |
| 185 | 185 |  			{ | 
                                                        
| 186 | 186 | $insertArgs = new stdClass();  | 
                                                        
| 187 | 187 | $insertArgs->site_srl = $siteSrl;  | 
                                                        
@@ -197,15 +197,15 @@ discard block  | 
                                                    ||
| 197 | 197 | }  | 
                                                        
| 198 | 198 | |
| 199 | 199 | // If create layout instance, reload instance list  | 
                                                        
| 200 | - if($isCreateInstance)  | 
                                                        |
| 200 | + if ($isCreateInstance)  | 
                                                        |
| 201 | 201 |  		{ | 
                                                        
| 202 | 202 |  			$output = executeQueryArray('layout.getLayoutList', $args, $columnList); | 
                                                        
| 203 | 203 | |
| 204 | - if(is_array($output->data))  | 
                                                        |
| 204 | + if (is_array($output->data))  | 
                                                        |
| 205 | 205 |  			{ | 
                                                        
| 206 | - foreach($output->data as $no => $iInfo)  | 
                                                        |
| 206 | + foreach ($output->data as $no => $iInfo)  | 
                                                        |
| 207 | 207 |  				{ | 
                                                        
| 208 | - if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType))  | 
                                                        |
| 208 | + if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType))  | 
                                                        |
| 209 | 209 |  					{ | 
                                                        
| 210 | 210 | unset($output->data[$no]);  | 
                                                        
| 211 | 211 | }  | 
                                                        
@@ -226,28 +226,28 @@ discard block  | 
                                                    ||
| 226 | 226 | function isExistsLayoutFile($layout, $layoutType)  | 
                                                        
| 227 | 227 |  	{ | 
                                                        
| 228 | 228 | //TODO If remove a support themes, remove this codes also.  | 
                                                        
| 229 | - if($layoutType == 'P')  | 
                                                        |
| 229 | + if ($layoutType == 'P')  | 
                                                        |
| 230 | 230 |  		{ | 
                                                        
| 231 | - $pathPrefix = _XE_PATH_ . 'layouts/';  | 
                                                        |
| 232 | - $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s';  | 
                                                        |
| 231 | + $pathPrefix = _XE_PATH_.'layouts/';  | 
                                                        |
| 232 | + $themePathFormat = _XE_PATH_.'themes/%s/layouts/%s';  | 
                                                        |
| 233 | 233 | }  | 
                                                        
| 234 | 234 | else  | 
                                                        
| 235 | 235 |  		{ | 
                                                        
| 236 | - $pathPrefix = _XE_PATH_ . 'm.layouts/';  | 
                                                        |
| 237 | - $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s';  | 
                                                        |
| 236 | + $pathPrefix = _XE_PATH_.'m.layouts/';  | 
                                                        |
| 237 | + $themePathFormat = _XE_PATH_.'themes/%s/m.layouts/%s';  | 
                                                        |
| 238 | 238 | }  | 
                                                        
| 239 | 239 | |
| 240 | - if(strpos($layout, '|@|') !== FALSE)  | 
                                                        |
| 240 | + if (strpos($layout, '|@|') !== FALSE)  | 
                                                        |
| 241 | 241 |  		{ | 
                                                        
| 242 | 242 |  			list($themeName, $layoutName) = explode('|@|', $layout); | 
                                                        
| 243 | 243 | $path = sprintf($themePathFormat, $themeName, $layoutName);  | 
                                                        
| 244 | 244 | }  | 
                                                        
| 245 | 245 | else  | 
                                                        
| 246 | 246 |  		{ | 
                                                        
| 247 | - $path = $pathPrefix . $layout;  | 
                                                        |
| 247 | + $path = $pathPrefix.$layout;  | 
                                                        |
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | - return is_readable($path . '/layout.html');  | 
                                                        |
| 250 | + return is_readable($path.'/layout.html');  | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | 253 | /**  | 
                                                        
@@ -262,7 +262,7 @@ discard block  | 
                                                    ||
| 262 | 262 | $args = new stdClass();  | 
                                                        
| 263 | 263 | $args->layout_srl = $layout_srl;  | 
                                                        
| 264 | 264 |  		$output = executeQuery('layout.getLayout', $args); | 
                                                        
| 265 | - if(!$output->data) return;  | 
                                                        |
| 265 | + if (!$output->data) return;  | 
                                                        |
| 266 | 266 | |
| 267 | 267 | // Return xml file informaton after listing up the layout and extra_vars  | 
                                                        
| 268 | 268 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);  | 
                                                        
@@ -275,7 +275,7 @@ discard block  | 
                                                    ||
| 275 | 275 | $args = new stdClass();  | 
                                                        
| 276 | 276 | $args->layout_srl = $layout_srl;  | 
                                                        
| 277 | 277 |  		$output = executeQuery('layout.getLayout', $args, $columnList); | 
                                                        
| 278 | - if(!$output->toBool())  | 
                                                        |
| 278 | + if (!$output->toBool())  | 
                                                        |
| 279 | 279 |  		{ | 
                                                        
| 280 | 280 | return;  | 
                                                        
| 281 | 281 | }  | 
                                                        
@@ -292,15 +292,15 @@ discard block  | 
                                                    ||
| 292 | 292 | function getLayoutPath($layout_name = "", $layout_type = "P")  | 
                                                        
| 293 | 293 |  	{ | 
                                                        
| 294 | 294 |  		$layout_parse = explode('|@|', $layout_name); | 
                                                        
| 295 | - if(count($layout_parse) > 1)  | 
                                                        |
| 295 | + if (count($layout_parse) > 1)  | 
                                                        |
| 296 | 296 |  		{ | 
                                                        
| 297 | 297 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/';  | 
                                                        
| 298 | 298 | }  | 
                                                        
| 299 | - else if($layout_name == 'faceoff')  | 
                                                        |
| 299 | + else if ($layout_name == 'faceoff')  | 
                                                        |
| 300 | 300 |  		{ | 
                                                        
| 301 | 301 | $class_path = './modules/layout/faceoff/';  | 
                                                        
| 302 | 302 | }  | 
                                                        
| 303 | - else if($layout_type == "M")  | 
                                                        |
| 303 | + else if ($layout_type == "M")  | 
                                                        |
| 304 | 304 |  		{ | 
                                                        
| 305 | 305 |  			$class_path = sprintf("./m.layouts/%s/", $layout_name); | 
                                                        
| 306 | 306 | }  | 
                                                        
@@ -308,7 +308,7 @@ discard block  | 
                                                    ||
| 308 | 308 |  		{ | 
                                                        
| 309 | 309 |  			$class_path = sprintf('./layouts/%s/', $layout_name); | 
                                                        
| 310 | 310 | }  | 
                                                        
| 311 | - if(is_dir($class_path)) return $class_path;  | 
                                                        |
| 311 | + if (is_dir($class_path)) return $class_path;  | 
                                                        |
| 312 | 312 | return "";  | 
                                                        
| 313 | 313 | }  | 
                                                        
| 314 | 314 | |
@@ -326,24 +326,24 @@ discard block  | 
                                                    ||
| 326 | 326 | // Get a list of downloaded layout and installed layout  | 
                                                        
| 327 | 327 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type);  | 
                                                        
| 328 | 328 | $searched_count = count($searched_list);  | 
                                                        
| 329 | - if(!$searched_count) return;  | 
                                                        |
| 329 | + if (!$searched_count) return;  | 
                                                        |
| 330 | 330 | |
| 331 | 331 | // natcasesort($searched_list);  | 
                                                        
| 332 | 332 | // Return information for looping searched list of layouts  | 
                                                        
| 333 | 333 | $list = array();  | 
                                                        
| 334 | - for($i=0;$i<$searched_count;$i++)  | 
                                                        |
| 334 | + for ($i = 0; $i < $searched_count; $i++)  | 
                                                        |
| 335 | 335 |  		{ | 
                                                        
| 336 | 336 | // Name of the layout  | 
                                                        
| 337 | 337 | $layout = $searched_list[$i];  | 
                                                        
| 338 | 338 | // Get information of the layout  | 
                                                        
| 339 | 339 | $layout_info = $this->getLayoutInfo($layout, null, $layout_type);  | 
                                                        
| 340 | 340 | |
| 341 | - if(!$layout_info)  | 
                                                        |
| 341 | + if (!$layout_info)  | 
                                                        |
| 342 | 342 |  			{ | 
                                                        
| 343 | 343 | continue;  | 
                                                        
| 344 | 344 | }  | 
                                                        
| 345 | 345 | |
| 346 | - if($withAutoinstallInfo)  | 
                                                        |
| 346 | + if ($withAutoinstallInfo)  | 
                                                        |
| 347 | 347 |  			{ | 
                                                        
| 348 | 348 | // get easyinstall remove url  | 
                                                        
| 349 | 349 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path);  | 
                                                        
@@ -354,7 +354,7 @@ discard block  | 
                                                    ||
| 354 | 354 | $layout_info->need_update = $package[$packageSrl]->need_update;  | 
                                                        
| 355 | 355 | |
| 356 | 356 | // get easyinstall update url  | 
                                                        
| 357 | - if($layout_info->need_update)  | 
                                                        |
| 357 | + if ($layout_info->need_update)  | 
                                                        |
| 358 | 358 |  				{ | 
                                                        
| 359 | 359 | $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);  | 
                                                        
| 360 | 360 | }  | 
                                                        
@@ -371,12 +371,12 @@ discard block  | 
                                                    ||
| 371 | 371 | */  | 
                                                        
| 372 | 372 | function sortLayoutByTitle($a, $b)  | 
                                                        
| 373 | 373 |  	{ | 
                                                        
| 374 | - if(!$a->title)  | 
                                                        |
| 374 | + if (!$a->title)  | 
                                                        |
| 375 | 375 |  		{ | 
                                                        
| 376 | 376 | $a->title = $a->layout;  | 
                                                        
| 377 | 377 | }  | 
                                                        
| 378 | 378 | |
| 379 | - if(!$b->title)  | 
                                                        |
| 379 | + if (!$b->title)  | 
                                                        |
| 380 | 380 |  		{ | 
                                                        
| 381 | 381 | $b->title = $b->layout;  | 
                                                        
| 382 | 382 | }  | 
                                                        
@@ -384,7 +384,7 @@ discard block  | 
                                                    ||
| 384 | 384 | $aTitle = strtolower($a->title);  | 
                                                        
| 385 | 385 | $bTitle = strtolower($b->title);  | 
                                                        
| 386 | 386 | |
| 387 | - if($aTitle == $bTitle)  | 
                                                        |
| 387 | + if ($aTitle == $bTitle)  | 
                                                        |
| 388 | 388 |  		{ | 
                                                        
| 389 | 389 | return 0;  | 
                                                        
| 390 | 390 | }  | 
                                                        
@@ -410,7 +410,7 @@ discard block  | 
                                                    ||
| 410 | 410 | */  | 
                                                        
| 411 | 411 | function _getInstalledLayoutDirectories($layoutType = 'P')  | 
                                                        
| 412 | 412 |  	{ | 
                                                        
| 413 | - if($layoutType == 'M')  | 
                                                        |
| 413 | + if ($layoutType == 'M')  | 
                                                        |
| 414 | 414 |  		{ | 
                                                        
| 415 | 415 | $directory = './m.layouts';  | 
                                                        
| 416 | 416 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES';  | 
                                                        
@@ -421,7 +421,7 @@ discard block  | 
                                                    ||
| 421 | 421 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES';  | 
                                                        
| 422 | 422 | }  | 
                                                        
| 423 | 423 | |
| 424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey];  | 
                                                        |
| 424 | + if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey];  | 
                                                        |
| 425 | 425 | |
| 426 | 426 | $searchedList = FileHandler::readDir($directory);  | 
                                                        
| 427 | 427 | if (!$searchedList) $searchedList = array();  | 
                                                        
@@ -440,7 +440,7 @@ discard block  | 
                                                    ||
| 440 | 440 | */  | 
                                                        
| 441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P")  | 
                                                        
| 442 | 442 |  	{ | 
                                                        
| 443 | - if($info)  | 
                                                        |
| 443 | + if ($info)  | 
                                                        |
| 444 | 444 |  		{ | 
                                                        
| 445 | 445 | $layout_title = $info->title;  | 
                                                        
| 446 | 446 | $layout = $info->layout;  | 
                                                        
@@ -448,35 +448,35 @@ discard block  | 
                                                    ||
| 448 | 448 | $site_srl = $info->site_srl;  | 
                                                        
| 449 | 449 | $vars = unserialize($info->extra_vars);  | 
                                                        
| 450 | 450 | |
| 451 | - if($info->module_srl)  | 
                                                        |
| 451 | + if ($info->module_srl)  | 
                                                        |
| 452 | 452 |  			{ | 
                                                        
| 453 | -				$layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path); | 
                                                        |
| 453 | +				$layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path); | 
                                                        |
| 454 | 454 |  				$xml_file = sprintf('%sskin.xml', $layout_path); | 
                                                        
| 455 | 455 | }  | 
                                                        
| 456 | 456 | }  | 
                                                        
| 457 | 457 | |
| 458 | 458 | // Get a path of the requested module. Return if not exists.  | 
                                                        
| 459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);  | 
                                                        |
| 460 | - if(!is_dir($layout_path)) return;  | 
                                                        |
| 459 | + if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);  | 
                                                        |
| 460 | + if (!is_dir($layout_path)) return;  | 
                                                        |
| 461 | 461 | |
| 462 | 462 | // Read the xml file for module skin information  | 
                                                        
| 463 | -		if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); | 
                                                        |
| 464 | - if(!file_exists($xml_file))  | 
                                                        |
| 463 | +		if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); | 
                                                        |
| 464 | + if (!file_exists($xml_file))  | 
                                                        |
| 465 | 465 |  		{ | 
                                                        
| 466 | 466 | $layout_info = new stdClass;  | 
                                                        
| 467 | 467 | $layout_info->title = $layout;  | 
                                                        
| 468 | 468 | $layout_info->layout = $layout;  | 
                                                        
| 469 | 469 | $layout_info->path = $layout_path;  | 
                                                        
| 470 | 470 | $layout_info->layout_title = $layout_title;  | 
                                                        
| 471 | - if(!$layout_info->layout_type)  | 
                                                        |
| 471 | + if (!$layout_info->layout_type)  | 
                                                        |
| 472 | 472 |  			{ | 
                                                        
| 473 | - $layout_info->layout_type = $layout_type;  | 
                                                        |
| 473 | + $layout_info->layout_type = $layout_type;  | 
                                                        |
| 474 | 474 | }  | 
                                                        
| 475 | 475 | return $layout_info;  | 
                                                        
| 476 | 476 | }  | 
                                                        
| 477 | 477 | |
| 478 | 478 | // Include the cache file if it is valid and then return $layout_info variable  | 
                                                        
| 479 | - if(!$layout_srl)  | 
                                                        |
| 479 | + if (!$layout_srl)  | 
                                                        |
| 480 | 480 |  		{ | 
                                                        
| 481 | 481 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type);  | 
                                                        
| 482 | 482 | }  | 
                                                        
@@ -485,22 +485,22 @@ discard block  | 
                                                    ||
| 485 | 485 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType());  | 
                                                        
| 486 | 486 | }  | 
                                                        
| 487 | 487 | |
| 488 | - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))  | 
                                                        |
| 488 | + if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file))  | 
                                                        |
| 489 | 489 |  		{ | 
                                                        
| 490 | 490 | include($cache_file);  | 
                                                        
| 491 | 491 | |
| 492 | - if($layout_info->extra_var && $vars)  | 
                                                        |
| 492 | + if ($layout_info->extra_var && $vars)  | 
                                                        |
| 493 | 493 |  			{ | 
                                                        
| 494 | - foreach($vars as $key => $value)  | 
                                                        |
| 494 | + foreach ($vars as $key => $value)  | 
                                                        |
| 495 | 495 |  				{ | 
                                                        
| 496 | -					if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) | 
                                                        |
| 496 | +					if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) | 
                                                        |
| 497 | 497 |  					{ | 
                                                        
| 498 | 498 |  						$layout_info->{$key} = $value; | 
                                                        
| 499 | 499 | }  | 
                                                        
| 500 | 500 | }  | 
                                                        
| 501 | 501 | }  | 
                                                        
| 502 | 502 | |
| 503 | - if(!$layout_info->title)  | 
                                                        |
| 503 | + if (!$layout_info->title)  | 
                                                        |
| 504 | 504 |  			{ | 
                                                        
| 505 | 505 | $layout_info->title = $layout;  | 
                                                        
| 506 | 506 | }  | 
                                                        
@@ -511,16 +511,16 @@ discard block  | 
                                                    ||
| 511 | 511 | $oXmlParser = new XmlParser();  | 
                                                        
| 512 | 512 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);  | 
                                                        
| 513 | 513 | |
| 514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;  | 
                                                        |
| 515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin;  | 
                                                        |
| 514 | + if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;  | 
                                                        |
| 515 | + elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin;  | 
                                                        |
| 516 | 516 | |
| 517 | - if(!$xml_obj) return;  | 
                                                        |
| 517 | + if (!$xml_obj) return;  | 
                                                        |
| 518 | 518 | |
| 519 | 519 | $buff = array();  | 
                                                        
| 520 | 520 | $buff[] = '$layout_info = new stdClass;';  | 
                                                        
| 521 | 521 |  		$buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl); | 
                                                        
| 522 | 522 | |
| 523 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2')  | 
                                                        |
| 523 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2')  | 
                                                        |
| 524 | 524 |  		{ | 
                                                        
| 525 | 525 | // Layout title, version and other information  | 
                                                        
| 526 | 526 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);  | 
                                                        
@@ -540,11 +540,11 @@ discard block  | 
                                                    ||
| 540 | 540 |  			$buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); | 
                                                        
| 541 | 541 | |
| 542 | 542 | // Author information  | 
                                                        
| 543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;  | 
                                                        |
| 543 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;  | 
                                                        |
| 544 | 544 | else $author_list = $xml_obj->author;  | 
                                                        
| 545 | 545 | |
| 546 | 546 | $buff[] = '$layout_info->author = array();';  | 
                                                        
| 547 | - for($i=0, $c=count($author_list); $i<$c; $i++)  | 
                                                        |
| 547 | + for ($i = 0, $c = count($author_list); $i < $c; $i++)  | 
                                                        |
| 548 | 548 |  			{ | 
                                                        
| 549 | 549 |  				$buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); | 
                                                        
| 550 | 550 |  				$buff[] = sprintf('$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body); | 
                                                        
@@ -554,22 +554,22 @@ discard block  | 
                                                    ||
| 554 | 554 | |
| 555 | 555 | // Extra vars (user defined variables to use in a template)  | 
                                                        
| 556 | 556 | $extra_var_groups = $xml_obj->extra_vars->group;  | 
                                                        
| 557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;  | 
                                                        |
| 558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);  | 
                                                        |
| 557 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;  | 
                                                        |
| 558 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);  | 
                                                        |
| 559 | 559 | |
| 560 | 560 | $buff[] = '$layout_info->extra_var = new stdClass;';  | 
                                                        
| 561 | 561 | $extra_var_count = 0;  | 
                                                        
| 562 | - foreach($extra_var_groups as $group)  | 
                                                        |
| 562 | + foreach ($extra_var_groups as $group)  | 
                                                        |
| 563 | 563 |  			{ | 
                                                        
| 564 | 564 | $extra_vars = $group->var;  | 
                                                        
| 565 | - if($extra_vars)  | 
                                                        |
| 565 | + if ($extra_vars)  | 
                                                        |
| 566 | 566 |  				{ | 
                                                        
| 567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars);  | 
                                                        |
| 567 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars);  | 
                                                        |
| 568 | 568 | |
| 569 | 569 | $count = count($extra_vars);  | 
                                                        
| 570 | 570 | $extra_var_count += $count;  | 
                                                        
| 571 | 571 | |
| 572 | - for($i=0;$i<$count;$i++)  | 
                                                        |
| 572 | + for ($i = 0; $i < $count; $i++)  | 
                                                        |
| 573 | 573 |  					{ | 
                                                        
| 574 | 574 | unset($var, $options);  | 
                                                        
| 575 | 575 | $var = $extra_vars[$i];  | 
                                                        
@@ -580,26 +580,26 @@ discard block  | 
                                                    ||
| 580 | 580 |  						$buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); | 
                                                        
| 581 | 581 |  						$buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); | 
                                                        
| 582 | 582 |  						$buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); | 
                                                        
| 583 | -						$buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); | 
                                                        |
| 583 | +						$buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); | 
                                                        |
| 584 | 584 | |
| 585 | 585 | $options = $var->options;  | 
                                                        
| 586 | - if(!$options) continue;  | 
                                                        |
| 587 | - if(!is_array($options)) $options = array($options);  | 
                                                        |
| 586 | + if (!$options) continue;  | 
                                                        |
| 587 | + if (!is_array($options)) $options = array($options);  | 
                                                        |
| 588 | 588 | |
| 589 | 589 |  						$buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); | 
                                                        
| 590 | 590 | $options_count = count($options);  | 
                                                        
| 591 | 591 | $thumbnail_exist = false;  | 
                                                        
| 592 | - for($j=0; $j < $options_count; $j++)  | 
                                                        |
| 592 | + for ($j = 0; $j < $options_count; $j++)  | 
                                                        |
| 593 | 593 |  						{ | 
                                                        
| 594 | 594 |  							$buff[] = sprintf('$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value); | 
                                                        
| 595 | 595 | $thumbnail = $options[$j]->attrs->src;  | 
                                                        
| 596 | - if($thumbnail)  | 
                                                        |
| 596 | + if ($thumbnail)  | 
                                                        |
| 597 | 597 |  							{ | 
                                                        
| 598 | 598 | $thumbnail = $layout_path.$thumbnail;  | 
                                                        
| 599 | - if(file_exists($thumbnail))  | 
                                                        |
| 599 | + if (file_exists($thumbnail))  | 
                                                        |
| 600 | 600 |  								{ | 
                                                        
| 601 | 601 |  									$buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail); | 
                                                        
| 602 | - if(!$thumbnail_exist)  | 
                                                        |
| 602 | + if (!$thumbnail_exist)  | 
                                                        |
| 603 | 603 |  									{ | 
                                                        
| 604 | 604 |  										$buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name); | 
                                                        
| 605 | 605 | $thumbnail_exist = true;  | 
                                                        
@@ -613,26 +613,26 @@ discard block  | 
                                                    ||
| 613 | 613 | }  | 
                                                        
| 614 | 614 |  			$buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); | 
                                                        
| 615 | 615 | // Menu  | 
                                                        
| 616 | - if($xml_obj->menus->menu)  | 
                                                        |
| 616 | + if ($xml_obj->menus->menu)  | 
                                                        |
| 617 | 617 |  			{ | 
                                                        
| 618 | 618 | $menus = $xml_obj->menus->menu;  | 
                                                        
| 619 | - if(!is_array($menus)) $menus = array($menus);  | 
                                                        |
| 619 | + if (!is_array($menus)) $menus = array($menus);  | 
                                                        |
| 620 | 620 | |
| 621 | 621 | $menu_count = count($menus);  | 
                                                        
| 622 | 622 |  				$buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); | 
                                                        
| 623 | 623 | $buff[] = '$layout_info->menu = new stdClass;';  | 
                                                        
| 624 | - for($i=0;$i<$menu_count;$i++)  | 
                                                        |
| 624 | + for ($i = 0; $i < $menu_count; $i++)  | 
                                                        |
| 625 | 625 |  				{ | 
                                                        
| 626 | 626 | $name = $menus[$i]->attrs->name;  | 
                                                        
| 627 | -					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); | 
                                                        |
| 627 | +					if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); | 
                                                        |
| 628 | 628 |  					$buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); | 
                                                        
| 629 | -					$buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); | 
                                                        |
| 630 | -					$buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); | 
                                                        |
| 631 | -					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth); | 
                                                        |
| 629 | +					$buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $menus[$i]->attrs->name); | 
                                                        |
| 630 | +					$buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); | 
                                                        |
| 631 | +					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->attrs->maxdepth); | 
                                                        |
| 632 | 632 | |
| 633 | 633 |  					$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); | 
                                                        
| 634 | -					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); | 
                                                        |
| 635 | -					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); | 
                                                        |
| 634 | +					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); | 
                                                        |
| 635 | +					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); | 
                                                        |
| 636 | 636 | }  | 
                                                        
| 637 | 637 | }  | 
                                                        
| 638 | 638 | }  | 
                                                        
@@ -655,19 +655,19 @@ discard block  | 
                                                    ||
| 655 | 655 |  			$buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); | 
                                                        
| 656 | 656 | // Extra vars (user defined variables to use in a template)  | 
                                                        
| 657 | 657 | $extra_var_groups = $xml_obj->extra_vars->group;  | 
                                                        
| 658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;  | 
                                                        |
| 659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);  | 
                                                        |
| 660 | - foreach($extra_var_groups as $group)  | 
                                                        |
| 658 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;  | 
                                                        |
| 659 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);  | 
                                                        |
| 660 | + foreach ($extra_var_groups as $group)  | 
                                                        |
| 661 | 661 |  			{ | 
                                                        
| 662 | 662 | $extra_vars = $group->var;  | 
                                                        
| 663 | - if($extra_vars)  | 
                                                        |
| 663 | + if ($extra_vars)  | 
                                                        |
| 664 | 664 |  				{ | 
                                                        
| 665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars);  | 
                                                        |
| 665 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars);  | 
                                                        |
| 666 | 666 | |
| 667 | 667 | $extra_var_count = count($extra_vars);  | 
                                                        
| 668 | 668 | |
| 669 | 669 |  					$buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); | 
                                                        
| 670 | - for($i=0;$i<$extra_var_count;$i++)  | 
                                                        |
| 670 | + for ($i = 0; $i < $extra_var_count; $i++)  | 
                                                        |
| 671 | 671 |  					{ | 
                                                        
| 672 | 672 | unset($var, $options);  | 
                                                        
| 673 | 673 | $var = $extra_vars[$i];  | 
                                                        
@@ -677,14 +677,14 @@ discard block  | 
                                                    ||
| 677 | 677 |  						$buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); | 
                                                        
| 678 | 678 |  						$buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); | 
                                                        
| 679 | 679 |  						$buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); | 
                                                        
| 680 | -						$buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); | 
                                                        |
| 680 | +						$buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); | 
                                                        |
| 681 | 681 | |
| 682 | 682 | $options = $var->options;  | 
                                                        
| 683 | - if(!$options) continue;  | 
                                                        |
| 683 | + if (!$options) continue;  | 
                                                        |
| 684 | 684 | |
| 685 | - if(!is_array($options)) $options = array($options);  | 
                                                        |
| 685 | + if (!is_array($options)) $options = array($options);  | 
                                                        |
| 686 | 686 | $options_count = count($options);  | 
                                                        
| 687 | - for($j=0;$j<$options_count;$j++)  | 
                                                        |
| 687 | + for ($j = 0; $j < $options_count; $j++)  | 
                                                        |
| 688 | 688 |  						{ | 
                                                        
| 689 | 689 |  							$buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body); | 
                                                        
| 690 | 690 | }  | 
                                                        
@@ -692,23 +692,23 @@ discard block  | 
                                                    ||
| 692 | 692 | }  | 
                                                        
| 693 | 693 | }  | 
                                                        
| 694 | 694 | // Menu  | 
                                                        
| 695 | - if($xml_obj->menus->menu)  | 
                                                        |
| 695 | + if ($xml_obj->menus->menu)  | 
                                                        |
| 696 | 696 |  			{ | 
                                                        
| 697 | 697 | $menus = $xml_obj->menus->menu;  | 
                                                        
| 698 | - if(!is_array($menus)) $menus = array($menus);  | 
                                                        |
| 698 | + if (!is_array($menus)) $menus = array($menus);  | 
                                                        |
| 699 | 699 | |
| 700 | 700 | $menu_count = count($menus);  | 
                                                        
| 701 | 701 |  				$buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); | 
                                                        
| 702 | - for($i=0;$i<$menu_count;$i++)  | 
                                                        |
| 702 | + for ($i = 0; $i < $menu_count; $i++)  | 
                                                        |
| 703 | 703 |  				{ | 
                                                        
| 704 | 704 | $name = $menus[$i]->attrs->name;  | 
                                                        
| 705 | -					if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); | 
                                                        |
| 706 | -					$buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); | 
                                                        |
| 707 | -					$buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); | 
                                                        |
| 708 | -					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); | 
                                                        |
| 705 | +					if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); | 
                                                        |
| 706 | +					$buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $name); | 
                                                        |
| 707 | +					$buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); | 
                                                        |
| 708 | +					$buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->maxdepth->body); | 
                                                        |
| 709 | 709 |  					$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); | 
                                                        
| 710 | -					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); | 
                                                        |
| 711 | -					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); | 
                                                        |
| 710 | +					$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); | 
                                                        |
| 711 | +					$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); | 
                                                        |
| 712 | 712 | }  | 
                                                        
| 713 | 713 | }  | 
                                                        
| 714 | 714 | }  | 
                                                        
@@ -718,15 +718,15 @@ discard block  | 
                                                    ||
| 718 | 718 |  		$layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); | 
                                                        
| 719 | 719 | $header_script = trim($layout_config->header_script);  | 
                                                        
| 720 | 720 | |
| 721 | - if($header_script)  | 
                                                        |
| 721 | + if ($header_script)  | 
                                                        |
| 722 | 722 |  		{ | 
                                                        
| 723 | -			$buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$','"'),array('\$','\\"'),$header_script)); | 
                                                        |
| 723 | +			$buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$', '"'), array('\$', '\\"'), $header_script)); | 
                                                        |
| 724 | 724 | }  | 
                                                        
| 725 | 725 | |
| 726 | -		FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); | 
                                                        |
| 727 | - if(FileHandler::exists($cache_file)) include($cache_file);  | 
                                                        |
| 726 | +		FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); '.join(PHP_EOL, $buff)); | 
                                                        |
| 727 | + if (FileHandler::exists($cache_file)) include($cache_file);  | 
                                                        |
| 728 | 728 | |
| 729 | - if(!$layout_info->title)  | 
                                                        |
| 729 | + if (!$layout_info->title)  | 
                                                        |
| 730 | 730 |  		{ | 
                                                        
| 731 | 731 | $layout_info->title = $layout;  | 
                                                        
| 732 | 732 | }  | 
                                                        
@@ -750,12 +750,12 @@ discard block  | 
                                                    ||
| 750 | 750 | * @param string $layout_name  | 
                                                        
| 751 | 751 | * @return array  | 
                                                        
| 752 | 752 | */  | 
                                                        
| 753 | - function getUserLayoutIniConfig($layout_srl, $layout_name=null)  | 
                                                        |
| 753 | + function getUserLayoutIniConfig($layout_srl, $layout_name = null)  | 
                                                        |
| 754 | 754 |  	{ | 
                                                        
| 755 | 755 | $file = $this->getUserLayoutIni($layout_srl);  | 
                                                        
| 756 | - if($layout_name && FileHandler::exists($file) === FALSE)  | 
                                                        |
| 756 | + if ($layout_name && FileHandler::exists($file) === FALSE)  | 
                                                        |
| 757 | 757 |  		{ | 
                                                        
| 758 | - FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl));  | 
                                                        |
| 758 | + FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl));  | 
                                                        |
| 759 | 759 | }  | 
                                                        
| 760 | 760 | |
| 761 | 761 | return FileHandler::readIniFile($file);  | 
                                                        
@@ -768,7 +768,7 @@ discard block  | 
                                                    ||
| 768 | 768 | */  | 
                                                        
| 769 | 769 | function getUserLayoutPath($layout_srl)  | 
                                                        
| 770 | 770 |  	{ | 
                                                        
| 771 | -		return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3)); | 
                                                        |
| 771 | +		return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3)); | 
                                                        |
| 772 | 772 | }  | 
                                                        
| 773 | 773 | |
| 774 | 774 | /**  | 
                                                        
@@ -778,7 +778,7 @@ discard block  | 
                                                    ||
| 778 | 778 | */  | 
                                                        
| 779 | 779 | function getUserLayoutImagePath($layout_srl)  | 
                                                        
| 780 | 780 |  	{ | 
                                                        
| 781 | - return $this->getUserLayoutPath($layout_srl). 'images/';  | 
                                                        |
| 781 | + return $this->getUserLayoutPath($layout_srl).'images/';  | 
                                                        |
| 782 | 782 | }  | 
                                                        
| 783 | 783 | |
| 784 | 784 | /**  | 
                                                        
@@ -788,7 +788,7 @@ discard block  | 
                                                    ||
| 788 | 788 | */  | 
                                                        
| 789 | 789 | function getUserLayoutCss($layout_srl)  | 
                                                        
| 790 | 790 |  	{ | 
                                                        
| 791 | - return $this->getUserLayoutPath($layout_srl). 'layout.css';  | 
                                                        |
| 791 | + return $this->getUserLayoutPath($layout_srl).'layout.css';  | 
                                                        |
| 792 | 792 | }  | 
                                                        
| 793 | 793 | |
| 794 | 794 | /**  | 
                                                        
@@ -798,7 +798,7 @@ discard block  | 
                                                    ||
| 798 | 798 | */  | 
                                                        
| 799 | 799 | function getUserLayoutFaceOffCss($layout_srl)  | 
                                                        
| 800 | 800 |  	{ | 
                                                        
| 801 | - if($this->useUserLayoutTemp == 'temp') return;  | 
                                                        |
| 801 | + if ($this->useUserLayoutTemp == 'temp') return;  | 
                                                        |
| 802 | 802 | return $this->_getUserLayoutFaceOffCss($layout_srl);  | 
                                                        
| 803 | 803 | }  | 
                                                        
| 804 | 804 | |
@@ -809,7 +809,7 @@ discard block  | 
                                                    ||
| 809 | 809 | */  | 
                                                        
| 810 | 810 | function _getUserLayoutFaceOffCss($layout_srl)  | 
                                                        
| 811 | 811 |  	{ | 
                                                        
| 812 | - return $this->getUserLayoutPath($layout_srl). 'faceoff.css';  | 
                                                        |
| 812 | + return $this->getUserLayoutPath($layout_srl).'faceoff.css';  | 
                                                        |
| 813 | 813 | }  | 
                                                        
| 814 | 814 | |
| 815 | 815 | /**  | 
                                                        
@@ -819,7 +819,7 @@ discard block  | 
                                                    ||
| 819 | 819 | */  | 
                                                        
| 820 | 820 | function getUserLayoutTempFaceOffCss($layout_srl)  | 
                                                        
| 821 | 821 |  	{ | 
                                                        
| 822 | - return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css';  | 
                                                        |
| 822 | + return $this->getUserLayoutPath($layout_srl).'tmp.faceoff.css';  | 
                                                        |
| 823 | 823 | }  | 
                                                        
| 824 | 824 | |
| 825 | 825 | /**  | 
                                                        
@@ -829,11 +829,11 @@ discard block  | 
                                                    ||
| 829 | 829 | */  | 
                                                        
| 830 | 830 | function getUserLayoutHtml($layout_srl)  | 
                                                        
| 831 | 831 |  	{ | 
                                                        
| 832 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.html';  | 
                                                        |
| 833 | - if($this->useUserLayoutTemp == 'temp')  | 
                                                        |
| 832 | + $src = $this->getUserLayoutPath($layout_srl).'layout.html';  | 
                                                        |
| 833 | + if ($this->useUserLayoutTemp == 'temp')  | 
                                                        |
| 834 | 834 |  		{ | 
                                                        
| 835 | 835 | $temp = $this->getUserLayoutTempHtml($layout_srl);  | 
                                                        
| 836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp);  | 
                                                        |
| 836 | + if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp);  | 
                                                        |
| 837 | 837 | return $temp;  | 
                                                        
| 838 | 838 | }  | 
                                                        
| 839 | 839 | |
@@ -847,7 +847,7 @@ discard block  | 
                                                    ||
| 847 | 847 | */  | 
                                                        
| 848 | 848 | function getUserLayoutTempHtml($layout_srl)  | 
                                                        
| 849 | 849 |  	{ | 
                                                        
| 850 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html';  | 
                                                        |
| 850 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.html';  | 
                                                        |
| 851 | 851 | }  | 
                                                        
| 852 | 852 | |
| 853 | 853 | /**  | 
                                                        
@@ -857,11 +857,11 @@ discard block  | 
                                                    ||
| 857 | 857 | */  | 
                                                        
| 858 | 858 | function getUserLayoutIni($layout_srl)  | 
                                                        
| 859 | 859 |  	{ | 
                                                        
| 860 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.ini';  | 
                                                        |
| 861 | - if($this->useUserLayoutTemp == 'temp')  | 
                                                        |
| 860 | + $src = $this->getUserLayoutPath($layout_srl).'layout.ini';  | 
                                                        |
| 861 | + if ($this->useUserLayoutTemp == 'temp')  | 
                                                        |
| 862 | 862 |  		{ | 
                                                        
| 863 | 863 | $temp = $this->getUserLayoutTempIni($layout_srl);  | 
                                                        
| 864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp);  | 
                                                        |
| 864 | + if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp);  | 
                                                        |
| 865 | 865 | return $temp;  | 
                                                        
| 866 | 866 | }  | 
                                                        
| 867 | 867 | |
@@ -875,7 +875,7 @@ discard block  | 
                                                    ||
| 875 | 875 | */  | 
                                                        
| 876 | 876 | function getUserLayoutTempIni($layout_srl)  | 
                                                        
| 877 | 877 |  	{ | 
                                                        
| 878 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini';  | 
                                                        |
| 878 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.ini';  | 
                                                        |
| 879 | 879 | }  | 
                                                        
| 880 | 880 | |
| 881 | 881 | /**  | 
                                                        
@@ -885,9 +885,9 @@ discard block  | 
                                                    ||
| 885 | 885 | * @param string $lang_type  | 
                                                        
| 886 | 886 | * @return string  | 
                                                        
| 887 | 887 | */  | 
                                                        
| 888 | - function getUserLayoutCache($layout_srl,$lang_type)  | 
                                                        |
| 888 | + function getUserLayoutCache($layout_srl, $lang_type)  | 
                                                        |
| 889 | 889 |  	{ | 
                                                        
| 890 | -		return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; | 
                                                        |
| 890 | +		return $this->getUserLayoutPath($layout_srl)."{$lang_type}.cache.php"; | 
                                                        |
| 891 | 891 | }  | 
                                                        
| 892 | 892 | |
| 893 | 893 | /**  | 
                                                        
@@ -896,15 +896,15 @@ discard block  | 
                                                    ||
| 896 | 896 | * @param string $lang_type  | 
                                                        
| 897 | 897 | * @return string  | 
                                                        
| 898 | 898 | */  | 
                                                        
| 899 | - function getLayoutCache($layout_name,$lang_type,$layout_type='P')  | 
                                                        |
| 899 | + function getLayoutCache($layout_name, $lang_type, $layout_type = 'P')  | 
                                                        |
| 900 | 900 |  	{ | 
                                                        
| 901 | - if($layout_type=='P')  | 
                                                        |
| 901 | + if ($layout_type == 'P')  | 
                                                        |
| 902 | 902 |  		{ | 
                                                        
| 903 | -			return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); | 
                                                        |
| 903 | +			return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); | 
                                                        |
| 904 | 904 | }  | 
                                                        
| 905 | 905 | else  | 
                                                        
| 906 | 906 |  		{ | 
                                                        
| 907 | -			return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); | 
                                                        |
| 907 | +			return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); | 
                                                        |
| 908 | 908 | }  | 
                                                        
| 909 | 909 | }  | 
                                                        
| 910 | 910 | |
@@ -915,7 +915,7 @@ discard block  | 
                                                    ||
| 915 | 915 | */  | 
                                                        
| 916 | 916 | function getDefaultLayoutIni($layout_name)  | 
                                                        
| 917 | 917 |  	{ | 
                                                        
| 918 | - return $this->getDefaultLayoutPath($layout_name). 'layout.ini';  | 
                                                        |
| 918 | + return $this->getDefaultLayoutPath($layout_name).'layout.ini';  | 
                                                        |
| 919 | 919 | }  | 
                                                        
| 920 | 920 | |
| 921 | 921 | /**  | 
                                                        
@@ -925,7 +925,7 @@ discard block  | 
                                                    ||
| 925 | 925 | */  | 
                                                        
| 926 | 926 | function getDefaultLayoutHtml($layout_name)  | 
                                                        
| 927 | 927 |  	{ | 
                                                        
| 928 | - return $this->getDefaultLayoutPath($layout_name). 'layout.html';  | 
                                                        |
| 928 | + return $this->getDefaultLayoutPath($layout_name).'layout.html';  | 
                                                        |
| 929 | 929 | }  | 
                                                        
| 930 | 930 | |
| 931 | 931 | /**  | 
                                                        
@@ -935,7 +935,7 @@ discard block  | 
                                                    ||
| 935 | 935 | */  | 
                                                        
| 936 | 936 | function getDefaultLayoutCss($layout_name)  | 
                                                        
| 937 | 937 |  	{ | 
                                                        
| 938 | - return $this->getDefaultLayoutPath($layout_name). 'css/layout.css';  | 
                                                        |
| 938 | + return $this->getDefaultLayoutPath($layout_name).'css/layout.css';  | 
                                                        |
| 939 | 939 | }  | 
                                                        
| 940 | 940 | |
| 941 | 941 | /**  | 
                                                        
@@ -964,7 +964,7 @@ discard block  | 
                                                    ||
| 964 | 964 | * @param string $flag (default 'temp')  | 
                                                        
| 965 | 965 | * @return void  | 
                                                        
| 966 | 966 | */  | 
                                                        
| 967 | - function setUseUserLayoutTemp($flag='temp')  | 
                                                        |
| 967 | + function setUseUserLayoutTemp($flag = 'temp')  | 
                                                        |
| 968 | 968 |  	{ | 
                                                        
| 969 | 969 | $this->useUserLayoutTemp = $flag;  | 
                                                        
| 970 | 970 | }  | 
                                                        
@@ -998,11 +998,11 @@ discard block  | 
                                                    ||
| 998 | 998 | );  | 
                                                        
| 999 | 999 | |
| 1000 | 1000 | $image_path = $this->getUserLayoutImagePath($layout_srl);  | 
                                                        
| 1001 | - $image_list = FileHandler::readDir($image_path,'/(.*(?:jpg|jpeg|gif|bmp|png)$)/i');  | 
                                                        |
| 1001 | + $image_list = FileHandler::readDir($image_path, '/(.*(?:jpg|jpeg|gif|bmp|png)$)/i');  | 
                                                        |
| 1002 | 1002 | |
| 1003 | - foreach($image_list as $image)  | 
                                                        |
| 1003 | + foreach ($image_list as $image)  | 
                                                        |
| 1004 | 1004 |  		{ | 
                                                        
| 1005 | - $file_list[] = 'images/' . $image;  | 
                                                        |
| 1005 | + $file_list[] = 'images/'.$image;  | 
                                                        |
| 1006 | 1006 | }  | 
                                                        
| 1007 | 1007 | return $file_list;  | 
                                                        
| 1008 | 1008 | }  | 
                                                        
@@ -1020,20 +1020,20 @@ discard block  | 
                                                    ||
| 1020 | 1020 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));  | 
                                                        
| 1021 | 1021 | // CSS generated in the layout manager  | 
                                                        
| 1022 | 1022 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);  | 
                                                        
| 1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);  | 
                                                        |
| 1023 | + if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);  | 
                                                        |
| 1024 | 1024 | // CSS output for the widget  | 
                                                        
| 1025 | 1025 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true);  | 
                                                        
| 1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);  | 
                                                        |
| 1026 | + if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);  | 
                                                        |
| 1027 | 1027 | else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true);  | 
                                                        
| 1028 | 1028 | // Different page displayed upon user's permission  | 
                                                        
| 1029 | 1029 |  		$logged_info = Context::get('logged_info'); | 
                                                        
| 1030 | 1030 | // Display edit button for faceoff layout  | 
                                                        
| 1031 | -		if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) | 
                                                        |
| 1031 | +		if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) | 
                                                        |
| 1032 | 1032 |  		{ | 
                                                        
| 1033 | -			Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); | 
                                                        |
| 1033 | +			Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); | 
                                                        |
| 1034 | 1034 | }  | 
                                                        
| 1035 | 1035 | // Display menu when editing the faceOff page  | 
                                                        
| 1036 | -		if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) | 
                                                        |
| 1036 | +		if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) | 
                                                        |
| 1037 | 1037 |  		{ | 
                                                        
| 1038 | 1038 | $oTemplate = &TemplateHandler::getInstance();  | 
                                                        
| 1039 | 1039 | Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu'));  | 
                                                        
@@ -31,7 +31,7 @@ discard block  | 
                                                    ||
| 31 | 31 | * @param string $module_name  | 
                                                        
| 32 | 32 | * @return int  | 
                                                        
| 33 | 33 | */  | 
                                                        
| 34 | - function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null)  | 
                                                        |
| 34 | + function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name = null)  | 
                                                        |
| 35 | 35 |  	{ | 
                                                        
| 36 | 36 | // Pre-create the objects needed  | 
                                                        
| 37 | 37 | $this->oXmlParser = new XmlParser();  | 
                                                        
@@ -40,33 +40,33 @@ discard block  | 
                                                    ||
| 40 | 40 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 41 | 41 | $category_list = $category_titles = array();  | 
                                                        
| 42 | 42 | $category_list = $oDocumentModel->getCategoryList($module_srl);  | 
                                                        
| 43 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 43 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 44 | 44 | // First handle categorty information  | 
                                                        
| 45 | 45 |  		$category_file = preg_replace('/index$/i', 'category.xml', $index_file); | 
                                                        
| 46 | - if(file_exists($category_file))  | 
                                                        |
| 46 | + if (file_exists($category_file))  | 
                                                        |
| 47 | 47 |  		{ | 
                                                        
| 48 | 48 | // Create the xmlParser object  | 
                                                        
| 49 | 49 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file);  | 
                                                        
| 50 | 50 | // List category information  | 
                                                        
| 51 | - if($xmlDoc->categories->category)  | 
                                                        |
| 51 | + if ($xmlDoc->categories->category)  | 
                                                        |
| 52 | 52 |  			{ | 
                                                        
| 53 | 53 | $categories = array();  | 
                                                        
| 54 | 54 | $idx = 0;  | 
                                                        
| 55 | 55 | $this->arrangeCategory($xmlDoc->categories, $categories, $idx, 0);  | 
                                                        
| 56 | 56 | |
| 57 | 57 | $match_sequence = array();  | 
                                                        
| 58 | - foreach($categories as $k => $v)  | 
                                                        |
| 58 | + foreach ($categories as $k => $v)  | 
                                                        |
| 59 | 59 |  				{ | 
                                                        
| 60 | 60 | $category = $v->name;  | 
                                                        
| 61 | - if(!$category || $category_titles[$category]) continue;  | 
                                                        |
| 61 | + if (!$category || $category_titles[$category]) continue;  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | $obj = null;  | 
                                                        
| 64 | 64 | $obj->title = $category;  | 
                                                        
| 65 | 65 | $obj->module_srl = $module_srl;  | 
                                                        
| 66 | - if($v->parent) $obj->parent_srl = $match_sequence[$v->parent];  | 
                                                        |
| 66 | + if ($v->parent) $obj->parent_srl = $match_sequence[$v->parent];  | 
                                                        |
| 67 | 67 | $output = $oDocumentController->insertCategory($obj);  | 
                                                        
| 68 | 68 | |
| 69 | -					if($output->toBool()) $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); | 
                                                        |
| 69 | +					if ($output->toBool()) $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); | 
                                                        |
| 70 | 70 | }  | 
                                                        
| 71 | 71 | $oDocumentController->makeCategoryFile($module_srl);  | 
                                                        
| 72 | 72 | }  | 
                                                        
@@ -74,28 +74,28 @@ discard block  | 
                                                    ||
| 74 | 74 | }  | 
                                                        
| 75 | 75 | $category_list = $category_titles = array();  | 
                                                        
| 76 | 76 | $category_list = $oDocumentModel->getCategoryList($module_srl);  | 
                                                        
| 77 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 77 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 78 | 78 | // Get administrator information  | 
                                                        
| 79 | 79 |  		$oMemberModel = getModel('member'); | 
                                                        
| 80 | 80 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id);  | 
                                                        
| 81 | 81 | $author_xml_id = 0;  | 
                                                        
| 82 | 82 | |
| 83 | - if(!$cur) $cur = 0;  | 
                                                        |
| 83 | + if (!$cur) $cur = 0;  | 
                                                        |
| 84 | 84 | // Open an index file  | 
                                                        
| 85 | - $f = fopen($index_file,"r");  | 
                                                        |
| 85 | + $f = fopen($index_file, "r");  | 
                                                        |
| 86 | 86 | // Pass if already read  | 
                                                        
| 87 | - for($i=0;$i<$cur;$i++) fgets($f, 1024);  | 
                                                        |
| 87 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024);  | 
                                                        |
| 88 | 88 | // Read each line until the codition meets  | 
                                                        
| 89 | - for($idx=$cur;$idx<$cur+$unit_count;$idx++)  | 
                                                        |
| 89 | + for ($idx = $cur; $idx < $cur + $unit_count; $idx++)  | 
                                                        |
| 90 | 90 |  		{ | 
                                                        
| 91 | - if(feof($f)) break;  | 
                                                        |
| 91 | + if (feof($f)) break;  | 
                                                        |
| 92 | 92 | // Find a location  | 
                                                        
| 93 | 93 | $target_file = trim(fgets($f, 1024));  | 
                                                        
| 94 | 94 | |
| 95 | - if(!file_exists($target_file)) continue;  | 
                                                        |
| 95 | + if (!file_exists($target_file)) continue;  | 
                                                        |
| 96 | 96 | // Start importing data  | 
                                                        
| 97 | - $fp = fopen($target_file,"r");  | 
                                                        |
| 98 | - if(!$fp) continue;  | 
                                                        |
| 97 | + $fp = fopen($target_file, "r");  | 
                                                        |
| 98 | + if (!$fp) continue;  | 
                                                        |
| 99 | 99 | |
| 100 | 100 | $obj = null;  | 
                                                        
| 101 | 101 | $obj->module_srl = $module_srl;  | 
                                                        
@@ -107,57 +107,57 @@ discard block  | 
                                                    ||
| 107 | 107 | $started = false;  | 
                                                        
| 108 | 108 | $buff = null;  | 
                                                        
| 109 | 109 | // Start importing from the body data  | 
                                                        
| 110 | - while(!feof($fp))  | 
                                                        |
| 110 | + while (!feof($fp))  | 
                                                        |
| 111 | 111 |  			{ | 
                                                        
| 112 | 112 | $str = fgets($fp, 1024);  | 
                                                        
| 113 | 113 | // Prepare an item  | 
                                                        
| 114 | - if(substr($str,0,5) == '<post')  | 
                                                        |
| 114 | + if (substr($str, 0, 5) == '<post')  | 
                                                        |
| 115 | 115 |  				{ | 
                                                        
| 116 | 116 | $started = true;  | 
                                                        
| 117 | 117 | continue;  | 
                                                        
| 118 | 118 | // Import the attachment  | 
                                                        
| 119 | 119 | }  | 
                                                        
| 120 | - else if(substr($str,0,12) == '<attachment ')  | 
                                                        |
| 120 | + else if (substr($str, 0, 12) == '<attachment ')  | 
                                                        |
| 121 | 121 |  				{ | 
                                                        
| 122 | - if($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++;  | 
                                                        |
| 122 | + if ($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++;  | 
                                                        |
| 123 | 123 | continue;  | 
                                                        
| 124 | 124 | }  | 
                                                        
| 125 | 125 | |
| 126 | - if($started) $buff .= $str;  | 
                                                        |
| 126 | + if ($started) $buff .= $str;  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | 129 |  			$xmlDoc = $this->oXmlParser->parse('<post>'.$buff); | 
                                                        
| 130 | 130 | |
| 131 | 131 | $author_xml_id = $xmlDoc->post->author->body;  | 
                                                        
| 132 | 132 | |
| 133 | - if($xmlDoc->post->category->body)  | 
                                                        |
| 133 | + if ($xmlDoc->post->category->body)  | 
                                                        |
| 134 | 134 |  			{ | 
                                                        
| 135 | -				$tmp_arr = explode('/',$xmlDoc->post->category->body); | 
                                                        |
| 136 | - $category = trim($tmp_arr[count($tmp_arr)-1]);  | 
                                                        |
| 137 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category];  | 
                                                        |
| 135 | +				$tmp_arr = explode('/', $xmlDoc->post->category->body); | 
                                                        |
| 136 | + $category = trim($tmp_arr[count($tmp_arr) - 1]);  | 
                                                        |
| 137 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category];  | 
                                                        |
| 138 | 138 | }  | 
                                                        
| 139 | 139 | |
| 140 | 140 | $obj->is_notice = 'N';  | 
                                                        
| 141 | -			$obj->status = in_array($xmlDoc->post->visibility->body, array('public','syndicated'))?$oDocumentModel->getConfigStatus('public'):$oDocumentModel->getConfigStatus('secret'); | 
                                                        |
| 141 | +			$obj->status = in_array($xmlDoc->post->visibility->body, array('public', 'syndicated')) ? $oDocumentModel->getConfigStatus('public') : $oDocumentModel->getConfigStatus('secret'); | 
                                                        |
| 142 | 142 | $obj->title = $xmlDoc->post->title->body;  | 
                                                        
| 143 | 143 | $obj->content = $xmlDoc->post->content->body;  | 
                                                        
| 144 | 144 | $obj->password = md5($xmlDoc->post->password->body);  | 
                                                        
| 145 | - $obj->commentStatus = $xmlDoc->post->acceptcomment->body=='1'?'ALLOW':'DENY';  | 
                                                        |
| 146 | - $obj->allow_trackback = $xmlDoc->post->accepttrackback->body=='1'?'Y':'N';  | 
                                                        |
| 145 | + $obj->commentStatus = $xmlDoc->post->acceptcomment->body == '1' ? 'ALLOW' : 'DENY';  | 
                                                        |
| 146 | + $obj->allow_trackback = $xmlDoc->post->accepttrackback->body == '1' ? 'Y' : 'N';  | 
                                                        |
| 147 | 147 | //$obj->allow_comment = $xmlDoc->post->acceptComment->body=='1'?'Y':'N';  | 
                                                        
| 148 | 148 | //$obj->allow_trackback = $xmlDoc->post->acceptTrackback->body=='1'?'Y':'N';  | 
                                                        
| 149 | -			$obj->regdate = date("YmdHis",$xmlDoc->post->published->body); | 
                                                        |
| 149 | +			$obj->regdate = date("YmdHis", $xmlDoc->post->published->body); | 
                                                        |
| 150 | 150 |  			$obj->last_update = date("YmdHis", $xmlDoc->post->modified->body); | 
                                                        
| 151 | - if(!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 151 | + if (!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 152 | 152 | |
| 153 | 153 | $tag = null;  | 
                                                        
| 154 | 154 | $tmp_tags = null;  | 
                                                        
| 155 | 155 | $tag = $xmlDoc->post->tag;  | 
                                                        
| 156 | - if($tag)  | 
                                                        |
| 156 | + if ($tag)  | 
                                                        |
| 157 | 157 |  			{ | 
                                                        
| 158 | - if(!is_array($tag)) $tag = array($tag);  | 
                                                        |
| 159 | - foreach($tag as $key => $val) $tmp_tags[] = $val->body;  | 
                                                        |
| 160 | -				$obj->tags = implode(',',$tmp_tags); | 
                                                        |
| 158 | + if (!is_array($tag)) $tag = array($tag);  | 
                                                        |
| 159 | + foreach ($tag as $key => $val) $tmp_tags[] = $val->body;  | 
                                                        |
| 160 | +				$obj->tags = implode(',', $tmp_tags); | 
                                                        |
| 161 | 161 | }  | 
                                                        
| 162 | 162 | |
| 163 | 163 | $obj->readed_count = 0;  | 
                                                        
@@ -169,33 +169,33 @@ discard block  | 
                                                    ||
| 169 | 169 | $obj->email_address = $member_info->email_address;  | 
                                                        
| 170 | 170 | $obj->homepage = $member_info->homepage;  | 
                                                        
| 171 | 171 | $obj->ipaddress = $_REMOTE['SERVER_ADDR'];  | 
                                                        
| 172 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1;  | 
                                                        |
| 172 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1;  | 
                                                        |
| 173 | 173 | $obj->notify_message = 'N';  | 
                                                        
| 174 | 174 | // Change content information (attachment)  | 
                                                        
| 175 | -			$obj->content = str_replace('[##_ATTACH_PATH_##]/','',$obj->content); | 
                                                        |
| 176 | - if(count($files))  | 
                                                        |
| 175 | +			$obj->content = str_replace('[##_ATTACH_PATH_##]/', '', $obj->content); | 
                                                        |
| 176 | + if (count($files))  | 
                                                        |
| 177 | 177 |  			{ | 
                                                        
| 178 | -				foreach($files as $key => $val) { | 
                                                        |
| 179 | -					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val->url.'"',$obj->content); | 
                                                        |
| 178 | +				foreach ($files as $key => $val) { | 
                                                        |
| 179 | +					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val->url.'"', $obj->content); | 
                                                        |
| 180 | 180 | }  | 
                                                        
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
| 183 | 183 |  			$obj->content = preg_replace_callback('!\[##_Movie\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTMovie'), $obj->content); | 
                                                        
| 184 | 184 | |
| 185 | - if(count($files))  | 
                                                        |
| 185 | + if (count($files))  | 
                                                        |
| 186 | 186 |  			{ | 
                                                        
| 187 | 187 | $this->files = $files;  | 
                                                        
| 188 | 188 |  				$obj->content = preg_replace_callback('!\[##_([a-z0-9]+)\|([^\|]*)\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTAttach'), $obj->content); | 
                                                        
| 189 | 189 | }  | 
                                                        
| 190 | 190 | // Trackback inserted  | 
                                                        
| 191 | 191 | $obj->trackback_count = 0;  | 
                                                        
| 192 | - if($xmlDoc->post->trackback)  | 
                                                        |
| 192 | + if ($xmlDoc->post->trackback)  | 
                                                        |
| 193 | 193 |  			{ | 
                                                        
| 194 | 194 | $trackbacks = $xmlDoc->post->trackback;  | 
                                                        
| 195 | - if(!is_array($trackbacks)) $trackbacks = array($trackbacks);  | 
                                                        |
| 196 | - if(count($trackbacks))  | 
                                                        |
| 195 | + if (!is_array($trackbacks)) $trackbacks = array($trackbacks);  | 
                                                        |
| 196 | + if (count($trackbacks))  | 
                                                        |
| 197 | 197 |  				{ | 
                                                        
| 198 | - foreach($trackbacks as $key => $val)  | 
                                                        |
| 198 | + foreach ($trackbacks as $key => $val)  | 
                                                        |
| 199 | 199 |  					{ | 
                                                        
| 200 | 200 | $tobj = null;  | 
                                                        
| 201 | 201 | $tobj->trackback_srl = getNextSequence();  | 
                                                        
@@ -205,40 +205,40 @@ discard block  | 
                                                    ||
| 205 | 205 | $tobj->title = $val->title->body;  | 
                                                        
| 206 | 206 | $tobj->blog_name = $val->site->body;  | 
                                                        
| 207 | 207 | $tobj->excerpt = $val->excerpt->body;  | 
                                                        
| 208 | -						$tobj->regdate = date("YmdHis",$val->received->body); | 
                                                        |
| 208 | +						$tobj->regdate = date("YmdHis", $val->received->body); | 
                                                        |
| 209 | 209 | $tobj->ipaddress = $val->ip->body;  | 
                                                        
| 210 | - $tobj->list_order = -1*$tobj->trackback_srl;  | 
                                                        |
| 210 | + $tobj->list_order = -1 * $tobj->trackback_srl;  | 
                                                        |
| 211 | 211 |  						$output = executeQuery('trackback.insertTrackback', $tobj); | 
                                                        
| 212 | - if($output->toBool()) $obj->trackback_count++;  | 
                                                        |
| 212 | + if ($output->toBool()) $obj->trackback_count++;  | 
                                                        |
| 213 | 213 | }  | 
                                                        
| 214 | 214 | }  | 
                                                        
| 215 | 215 | }  | 
                                                        
| 216 | 216 | // Comment  | 
                                                        
| 217 | 217 | $obj->comment_count = 0;  | 
                                                        
| 218 | - if($xmlDoc->post->comment)  | 
                                                        |
| 218 | + if ($xmlDoc->post->comment)  | 
                                                        |
| 219 | 219 |  			{ | 
                                                        
| 220 | 220 | $comment = $xmlDoc->post->comment;  | 
                                                        
| 221 | - if(!is_array($comment)) $comment = array($comment);  | 
                                                        |
| 222 | - foreach($comment as $key => $val)  | 
                                                        |
| 221 | + if (!is_array($comment)) $comment = array($comment);  | 
                                                        |
| 222 | + foreach ($comment as $key => $val)  | 
                                                        |
| 223 | 223 |  				{ | 
                                                        
| 224 | 224 | $parent_srl = $this->insertComment($val, $module_srl, $obj->document_srl, $member_info, 0, $author_xml_id);  | 
                                                        
| 225 | - if($parent_srl === false) continue;  | 
                                                        |
| 225 | + if ($parent_srl === false) continue;  | 
                                                        |
| 226 | 226 | |
| 227 | 227 | $obj->comment_count++;  | 
                                                        
| 228 | - if($val->comment)  | 
                                                        |
| 228 | + if ($val->comment)  | 
                                                        |
| 229 | 229 |  					{ | 
                                                        
| 230 | 230 | $child_comment = $val->comment;  | 
                                                        
| 231 | - if(!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 232 | - foreach($child_comment as $k => $v)  | 
                                                        |
| 231 | + if (!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 232 | + foreach ($child_comment as $k => $v)  | 
                                                        |
| 233 | 233 |  						{ | 
                                                        
| 234 | 234 | $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, $parent_srl, $author_xml_id);  | 
                                                        
| 235 | - if($result !== false) $obj->comment_count++;  | 
                                                        |
| 235 | + if ($result !== false) $obj->comment_count++;  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | 237 | }  | 
                                                        
| 238 | 238 | }  | 
                                                        
| 239 | 239 | }  | 
                                                        
| 240 | 240 | |
| 241 | - if($module_name == 'textyle')  | 
                                                        |
| 241 | + if ($module_name == 'textyle')  | 
                                                        |
| 242 | 242 |  			{ | 
                                                        
| 243 | 243 | $args->document_srl = $obj->document_srl;  | 
                                                        
| 244 | 244 | $args->module_srl = $obj->module_srl;  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | // Visibility value of published state  | 
                                                        
| 248 | 248 |  				$status_published = array('public', 'syndicated'); | 
                                                        
| 249 | 249 | // Save state if not published  | 
                                                        
| 250 | - if(!in_array($xmlDoc->post->visibility->body, $status_published))  | 
                                                        |
| 250 | + if (!in_array($xmlDoc->post->visibility->body, $status_published))  | 
                                                        |
| 251 | 251 |  				{ | 
                                                        
| 252 | 252 | $obj->module_srl = $member_info->member_srl;  | 
                                                        
| 253 | 253 | }  | 
                                                        
@@ -255,14 +255,14 @@ discard block  | 
                                                    ||
| 255 | 255 | // Document  | 
                                                        
| 256 | 256 |  			$output = executeQuery('document.insertDocument', $obj); | 
                                                        
| 257 | 257 | |
| 258 | - if($output->toBool())  | 
                                                        |
| 258 | + if ($output->toBool())  | 
                                                        |
| 259 | 259 |  			{ | 
                                                        
| 260 | 260 | // Tags  | 
                                                        
| 261 | - if($obj->tags)  | 
                                                        |
| 261 | + if ($obj->tags)  | 
                                                        |
| 262 | 262 |  				{ | 
                                                        
| 263 | -					$tag_list = explode(',',$obj->tags); | 
                                                        |
| 263 | +					$tag_list = explode(',', $obj->tags); | 
                                                        |
| 264 | 264 | $tag_count = count($tag_list);  | 
                                                        
| 265 | - for($i=0;$i<$tag_count;$i++)  | 
                                                        |
| 265 | + for ($i = 0; $i < $tag_count; $i++)  | 
                                                        |
| 266 | 266 |  					{ | 
                                                        
| 267 | 267 | $args = new stdClass;  | 
                                                        
| 268 | 268 | $args->tag_srl = getNextSequence();  | 
                                                        
@@ -270,7 +270,7 @@ discard block  | 
                                                    ||
| 270 | 270 | $args->document_srl = $obj->document_srl;  | 
                                                        
| 271 | 271 | $args->tag = trim($tag_list[$i]);  | 
                                                        
| 272 | 272 | $args->regdate = $obj->regdate;  | 
                                                        
| 273 | - if(!$args->tag) continue;  | 
                                                        |
| 273 | + if (!$args->tag) continue;  | 
                                                        |
| 274 | 274 |  						$output = executeQuery('tag.insertTag', $args); | 
                                                        
| 275 | 275 | }  | 
                                                        
| 276 | 276 | }  | 
                                                        
@@ -282,63 +282,63 @@ discard block  | 
                                                    ||
| 282 | 282 | |
| 283 | 283 | fclose($f);  | 
                                                        
| 284 | 284 | |
| 285 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);  | 
                                                        |
| 285 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);  | 
                                                        |
| 286 | 286 | // Guestbook information  | 
                                                        
| 287 | 287 |  		$guestbook_file = preg_replace('/index$/i', 'guestbook.xml', $index_file); | 
                                                        
| 288 | - if(file_exists($guestbook_file))  | 
                                                        |
| 288 | + if (file_exists($guestbook_file))  | 
                                                        |
| 289 | 289 |  		{ | 
                                                        
| 290 | 290 | // Create the xmlParser object  | 
                                                        
| 291 | 291 | $xmlDoc = $this->oXmlParser->loadXmlFile($guestbook_file);  | 
                                                        
| 292 | 292 | // Handle guest book information  | 
                                                        
| 293 | - if($guestbook_module_srl && $xmlDoc->guestbook->comment)  | 
                                                        |
| 293 | + if ($guestbook_module_srl && $xmlDoc->guestbook->comment)  | 
                                                        |
| 294 | 294 |  			{ | 
                                                        
| 295 | 295 | $comment = $xmlDoc->guestbook->comment;  | 
                                                        
| 296 | - if(!is_array($comment)) $comment = array($comment);  | 
                                                        |
| 296 | + if (!is_array($comment)) $comment = array($comment);  | 
                                                        |
| 297 | 297 | |
| 298 | - if($module_name =='textyle')  | 
                                                        |
| 298 | + if ($module_name == 'textyle')  | 
                                                        |
| 299 | 299 |  				{ | 
                                                        
| 300 | - foreach($comment as $key => $val)  | 
                                                        |
| 300 | + foreach ($comment as $key => $val)  | 
                                                        |
| 301 | 301 |  					{ | 
                                                        
| 302 | - $textyle_guestbook_srl = getNextSequence();  | 
                                                        |
| 302 | + $textyle_guestbook_srl = getNextSequence();  | 
                                                        |
| 303 | 303 | |
| 304 | - if($val->comment)  | 
                                                        |
| 304 | + if ($val->comment)  | 
                                                        |
| 305 | 305 |  						{ | 
                                                        
| 306 | 306 | $child_comment = $val->comment;  | 
                                                        
| 307 | - if(!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 308 | - foreach($child_comment as $k => $v)  | 
                                                        |
| 307 | + if (!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 308 | + foreach ($child_comment as $k => $v)  | 
                                                        |
| 309 | 309 |  							{ | 
                                                        
| 310 | - $result = $this->insertTextyleGuestbookItem($v, $module_srl, $member_info,0,$textyle_guestbook_srl,$author_xml_id);  | 
                                                        |
| 310 | + $result = $this->insertTextyleGuestbookItem($v, $module_srl, $member_info, 0, $textyle_guestbook_srl, $author_xml_id);  | 
                                                        |
| 311 | 311 | }  | 
                                                        
| 312 | 312 | }  | 
                                                        
| 313 | 313 | |
| 314 | - $result = $this->insertTextyleGuestbookItem($val, $module_srl, $member_info,$textyle_guestbook_srl,0,$author_xml_id);  | 
                                                        |
| 314 | + $result = $this->insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl, 0, $author_xml_id);  | 
                                                        |
| 315 | 315 | }  | 
                                                        
| 316 | 316 | }  | 
                                                        
| 317 | 317 | else  | 
                                                        
| 318 | 318 |  				{ | 
                                                        
| 319 | - foreach($comment as $key => $val)  | 
                                                        |
| 319 | + foreach ($comment as $key => $val)  | 
                                                        |
| 320 | 320 |  					{ | 
                                                        
| 321 | 321 | $obj = null;  | 
                                                        
| 322 | 322 | $obj->module_srl = $guestbook_module_srl;  | 
                                                        
| 323 | 323 | $obj->document_srl = getNextSequence();  | 
                                                        
| 324 | 324 | $obj->uploaded_count = 0;  | 
                                                        
| 325 | 325 | $obj->is_notice = 'N';  | 
                                                        
| 326 | -						$obj->status = $val->secret->body=='1'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); | 
                                                        |
| 326 | +						$obj->status = $val->secret->body == '1' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); | 
                                                        |
| 327 | 327 | $obj->content = nl2br($val->content->body);  | 
                                                        
| 328 | 328 | |
| 329 | 329 | // Extract a title form the bocy  | 
                                                        
| 330 | - $obj->title = cut_str(strip_tags($obj->content),20,'...');  | 
                                                        |
| 330 | + $obj->title = cut_str(strip_tags($obj->content), 20, '...');  | 
                                                        |
| 331 | 331 | if ($obj->title == '') $obj->title = 'Untitled';  | 
                                                        
| 332 | 332 | |
| 333 | 333 | $obj->commentStatus = 'ALLOW';  | 
                                                        
| 334 | 334 | $obj->allow_trackback = 'N';  | 
                                                        
| 335 | -						$obj->regdate = date("YmdHis",$val->written->body); | 
                                                        |
| 335 | +						$obj->regdate = date("YmdHis", $val->written->body); | 
                                                        |
| 336 | 336 |  						$obj->last_update = date("YmdHis", $val->written->body); | 
                                                        
| 337 | - if(!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 337 | + if (!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 338 | 338 | $obj->tags = '';  | 
                                                        
| 339 | 339 | $obj->readed_count = 0;  | 
                                                        
| 340 | 340 | $obj->voted_count = 0;  | 
                                                        
| 341 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 341 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 342 | 342 |  						{ | 
                                                        
| 343 | 343 | $obj->password = '';  | 
                                                        
| 344 | 344 | $obj->nick_name = $member_info->nick_name;  | 
                                                        
@@ -356,19 +356,19 @@ discard block  | 
                                                    ||
| 356 | 356 | $homepage = $val->commenter->homepage->body;  | 
                                                        
| 357 | 357 | }  | 
                                                        
| 358 | 358 | $obj->ipaddress = $val->commenter->ip->body;  | 
                                                        
| 359 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1;  | 
                                                        |
| 359 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1;  | 
                                                        |
| 360 | 360 | $obj->notify_message = 'N';  | 
                                                        
| 361 | 361 | $obj->trackback_count = 0;  | 
                                                        
| 362 | 362 | |
| 363 | 363 | $obj->comment_count = 0;  | 
                                                        
| 364 | - if($val->comment)  | 
                                                        |
| 364 | + if ($val->comment)  | 
                                                        |
| 365 | 365 |  						{ | 
                                                        
| 366 | 366 | $child_comment = $val->comment;  | 
                                                        
| 367 | - if(!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 368 | - foreach($child_comment as $k => $v)  | 
                                                        |
| 367 | + if (!is_array($child_comment)) $child_comment = array($child_comment);  | 
                                                        |
| 368 | + foreach ($child_comment as $k => $v)  | 
                                                        |
| 369 | 369 |  							{ | 
                                                        
| 370 | - $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, 0,$author_xml_id);  | 
                                                        |
| 371 | - if($result !== false) $obj->comment_count++;  | 
                                                        |
| 370 | + $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, 0, $author_xml_id);  | 
                                                        |
| 371 | + if ($result !== false) $obj->comment_count++;  | 
                                                        |
| 372 | 372 | }  | 
                                                        
| 373 | 373 | }  | 
                                                        
| 374 | 374 | |
@@ -380,7 +380,7 @@ discard block  | 
                                                    ||
| 380 | 380 | FileHandler::removeFile($guestbook_file);  | 
                                                        
| 381 | 381 | }  | 
                                                        
| 382 | 382 | |
| 383 | - return $idx-1;  | 
                                                        |
| 383 | + return $idx - 1;  | 
                                                        |
| 384 | 384 | }  | 
                                                        
| 385 | 385 | |
| 386 | 386 | /**  | 
                                                        
@@ -393,10 +393,10 @@ discard block  | 
                                                    ||
| 393 | 393 | * @param int $author_xml_id  | 
                                                        
| 394 | 394 | * @return int|bool  | 
                                                        
| 395 | 395 | */  | 
                                                        
| 396 | - function insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl,$parent_srl = 0, $author_xml_id=null)  | 
                                                        |
| 396 | + function insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl, $parent_srl = 0, $author_xml_id = null)  | 
                                                        |
| 397 | 397 |  	{ | 
                                                        
| 398 | 398 | $tobj = null;  | 
                                                        
| 399 | - if($textyle_guestbook_srl>0)  | 
                                                        |
| 399 | + if ($textyle_guestbook_srl > 0)  | 
                                                        |
| 400 | 400 |  		{ | 
                                                        
| 401 | 401 | $tobj->textyle_guestbook_srl = $textyle_guestbook_srl;  | 
                                                        
| 402 | 402 | }  | 
                                                        
@@ -405,9 +405,9 @@ discard block  | 
                                                    ||
| 405 | 405 | $tobj->textyle_guestbook_srl = getNextSequence();  | 
                                                        
| 406 | 406 | }  | 
                                                        
| 407 | 407 | $tobj->module_srl = $module_srl;  | 
                                                        
| 408 | - $tobj->is_secret = $val->secret->body=='1'?1:-1;  | 
                                                        |
| 408 | + $tobj->is_secret = $val->secret->body == '1' ? 1 : -1;  | 
                                                        |
| 409 | 409 | $tobj->content = nl2br($val->content->body);  | 
                                                        
| 410 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 410 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 411 | 411 |  		{ | 
                                                        
| 412 | 412 | $tobj->password = '';  | 
                                                        
| 413 | 413 | $tobj->nick_name = $member_info->nick_name;  | 
                                                        
@@ -424,22 +424,22 @@ discard block  | 
                                                    ||
| 424 | 424 | $tobj->homepage = $val->commenter->homepage->body;  | 
                                                        
| 425 | 425 | $tobj->member_srl = 0;  | 
                                                        
| 426 | 426 | }  | 
                                                        
| 427 | -		$tobj->last_update = $tobj->regdate = date("YmdHis",$val->written->body); | 
                                                        |
| 427 | +		$tobj->last_update = $tobj->regdate = date("YmdHis", $val->written->body); | 
                                                        |
| 428 | 428 | $tobj->ipaddress = $val->commenter->ip->body;  | 
                                                        
| 429 | 429 | |
| 430 | - if($parent_srl>0)  | 
                                                        |
| 430 | + if ($parent_srl > 0)  | 
                                                        |
| 431 | 431 |  		{ | 
                                                        
| 432 | 432 | $tobj->parent_srl = $parent_srl;  | 
                                                        
| 433 | 433 | $tobj->list_order = $tobj->parent_srl * -1;  | 
                                                        
| 434 | 434 | }  | 
                                                        
| 435 | 435 | else  | 
                                                        
| 436 | 436 |  		{ | 
                                                        
| 437 | - $tobj->list_order = $tobj->textyle_guestbook_srl*-1;  | 
                                                        |
| 437 | + $tobj->list_order = $tobj->textyle_guestbook_srl * -1;  | 
                                                        |
| 438 | 438 | }  | 
                                                        
| 439 | 439 | |
| 440 | 440 |  		$output = executeQuery('textyle.insertTextyleGuestbook', $tobj); | 
                                                        
| 441 | 441 | |
| 442 | - if($output->toBool()) return $tobj->textyle_guestbook_srl;  | 
                                                        |
| 442 | + if ($output->toBool()) return $tobj->textyle_guestbook_srl;  | 
                                                        |
| 443 | 443 | return false;  | 
                                                        
| 444 | 444 | }  | 
                                                        
| 445 | 445 | |
@@ -456,18 +456,18 @@ discard block  | 
                                                    ||
| 456 | 456 |  	{ | 
                                                        
| 457 | 457 | $uploaded_count = 0;  | 
                                                        
| 458 | 458 | |
| 459 | - $file_obj = null;  | 
                                                        |
| 459 | + $file_obj = null;  | 
                                                        |
| 460 | 460 | $file_obj->file_srl = getNextSequence();  | 
                                                        
| 461 | 461 | $file_obj->upload_target_srl = $upload_target_srl;  | 
                                                        
| 462 | 462 | $file_obj->module_srl = $module_srl;  | 
                                                        
| 463 | 463 | |
| 464 | - while(!feof($fp))  | 
                                                        |
| 464 | + while (!feof($fp))  | 
                                                        |
| 465 | 465 |  		{ | 
                                                        
| 466 | 466 | $str = fgets($fp, 1024);  | 
                                                        
| 467 | 467 | // If it ends with </attaches>, break  | 
                                                        
| 468 | - if(trim($str) == '</attachment>') break;  | 
                                                        |
| 468 | + if (trim($str) == '</attachment>') break;  | 
                                                        |
| 469 | 469 | // If it starts with <file>, handle the attachement in the xml file  | 
                                                        
| 470 | - if(substr($str, 0, 9)=='<content>')  | 
                                                        |
| 470 | + if (substr($str, 0, 9) == '<content>')  | 
                                                        |
| 471 | 471 |  			{ | 
                                                        
| 472 | 472 | $file_obj->file = $this->saveTemporaryFile($fp, $str);  | 
                                                        
| 473 | 473 | continue;  | 
                                                        
@@ -475,7 +475,7 @@ discard block  | 
                                                    ||
| 475 | 475 | |
| 476 | 476 | $buff .= $str;  | 
                                                        
| 477 | 477 | }  | 
                                                        
| 478 | - if(!file_exists($file_obj->file)) return false;  | 
                                                        |
| 478 | + if (!file_exists($file_obj->file)) return false;  | 
                                                        |
| 479 | 479 | |
| 480 | 480 | $buff .= '</attachment>';  | 
                                                        
| 481 | 481 | |
@@ -485,20 +485,20 @@ discard block  | 
                                                    ||
| 485 | 485 | $file_obj->download_count = $xmlDoc->attachment->downloads->body;  | 
                                                        
| 486 | 486 | $name = $xmlDoc->attachment->name->body;  | 
                                                        
| 487 | 487 | // Set upload path by checking if the attachement is an image or other kind of file  | 
                                                        
| 488 | -		if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_obj->source_filename)) | 
                                                        |
| 488 | +		if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_obj->source_filename)) | 
                                                        |
| 489 | 489 |  		{ | 
                                                        
| 490 | -			$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); | 
                                                        |
| 490 | +			$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        |
| 491 | 491 | $filename = $path.$file_obj->source_filename;  | 
                                                        
| 492 | 492 | $file_obj->direct_download = 'Y';  | 
                                                        
| 493 | 493 | }  | 
                                                        
| 494 | 494 | else  | 
                                                        
| 495 | 495 |  		{ | 
                                                        
| 496 | -			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); | 
                                                        |
| 497 | - $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));  | 
                                                        |
| 496 | +			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        |
| 497 | + $filename = $path.md5(crypt(rand(1000000, 900000), rand(0, 100)));  | 
                                                        |
| 498 | 498 | $file_obj->direct_download = 'N';  | 
                                                        
| 499 | 499 | }  | 
                                                        
| 500 | 500 | // Create a directory  | 
                                                        
| 501 | - if(!FileHandler::makeDir($path)) return;  | 
                                                        |
| 501 | + if (!FileHandler::makeDir($path)) return;  | 
                                                        |
| 502 | 502 | |
| 503 | 503 | FileHandler::rename($file_obj->file, $filename);  | 
                                                        
| 504 | 504 | // Insert to the DB  | 
                                                        
@@ -507,16 +507,16 @@ discard block  | 
                                                    ||
| 507 | 507 | $file_obj->file_size = filesize($filename);  | 
                                                        
| 508 | 508 | $file_obj->comment = NULL;  | 
                                                        
| 509 | 509 | $file_obj->member_srl = 0;  | 
                                                        
| 510 | - $file_obj->sid = md5(rand(rand(1111111,4444444),rand(4444445,9999999)));  | 
                                                        |
| 510 | + $file_obj->sid = md5(rand(rand(1111111, 4444444), rand(4444445, 9999999)));  | 
                                                        |
| 511 | 511 | $file_obj->isvalid = 'Y';  | 
                                                        
| 512 | 512 |  		$output = executeQuery('file.insertFile', $file_obj); | 
                                                        
| 513 | 513 | |
| 514 | - if($output->toBool())  | 
                                                        |
| 514 | + if ($output->toBool())  | 
                                                        |
| 515 | 515 |  		{ | 
                                                        
| 516 | 516 | $uploaded_count++;  | 
                                                        
| 517 | 517 | $tmp_obj = null;  | 
                                                        
| 518 | - if($file_obj->direct_download == 'Y') $files[$name]->url = $file_obj->uploaded_filename;  | 
                                                        |
| 519 | -			else $files[$name]->url = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); | 
                                                        |
| 518 | + if ($file_obj->direct_download == 'Y') $files[$name]->url = $file_obj->uploaded_filename;  | 
                                                        |
| 519 | +			else $files[$name]->url = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); | 
                                                        |
| 520 | 520 | $files[$name]->direct_download = $file_obj->direct_download;  | 
                                                        
| 521 | 521 | $files[$name]->source_filename = $file_obj->source_filename;  | 
                                                        
| 522 | 522 | return true;  | 
                                                        
@@ -532,9 +532,9 @@ discard block  | 
                                                    ||
| 532 | 532 | function getTmpFilename()  | 
                                                        
| 533 | 533 |  	{ | 
                                                        
| 534 | 534 | $path = "./files/cache/importer";  | 
                                                        
| 535 | - if(!is_dir($path)) FileHandler::makeDir($path);  | 
                                                        |
| 536 | -		$filename = sprintf("%s/%d", $path, rand(11111111,99999999)); | 
                                                        |
| 537 | - if(file_exists($filename)) $filename .= rand(111,999);  | 
                                                        |
| 535 | + if (!is_dir($path)) FileHandler::makeDir($path);  | 
                                                        |
| 536 | +		$filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); | 
                                                        |
| 537 | + if (file_exists($filename)) $filename .= rand(111, 999);  | 
                                                        |
| 538 | 538 | return $filename;  | 
                                                        
| 539 | 539 | }  | 
                                                        
| 540 | 540 | |
@@ -549,11 +549,11 @@ discard block  | 
                                                    ||
| 549 | 549 | $temp_filename = $this->getTmpFilename();  | 
                                                        
| 550 | 550 | $buff = substr($buff, 9);  | 
                                                        
| 551 | 551 | |
| 552 | - while(!feof($fp))  | 
                                                        |
| 552 | + while (!feof($fp))  | 
                                                        |
| 553 | 553 |  		{ | 
                                                        
| 554 | 554 | $str = trim(fgets($fp, 1024));  | 
                                                        
| 555 | 555 | $buff .= $str;  | 
                                                        
| 556 | - if(substr($str, -10) == '</content>') break;  | 
                                                        |
| 556 | + if (substr($str, -10) == '</content>') break;  | 
                                                        |
| 557 | 557 | }  | 
                                                        
| 558 | 558 | |
| 559 | 559 | $buff = substr($buff, 0, -10);  | 
                                                        
@@ -572,16 +572,16 @@ discard block  | 
                                                    ||
| 572 | 572 | function _replaceTTAttach($matches)  | 
                                                        
| 573 | 573 |  	{ | 
                                                        
| 574 | 574 | $name = $matches[2];  | 
                                                        
| 575 | - if(!$name) return $matches[0];  | 
                                                        |
| 575 | + if (!$name) return $matches[0];  | 
                                                        |
| 576 | 576 | |
| 577 | 577 | $obj = $this->files[$name];  | 
                                                        
| 578 | 578 | // If multimedia file is,  | 
                                                        
| 579 | - if($obj->direct_download == 'Y')  | 
                                                        |
| 579 | + if ($obj->direct_download == 'Y')  | 
                                                        |
| 580 | 580 |  		{ | 
                                                        
| 581 | 581 | // If image file is  | 
                                                        
| 582 | -			if(preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) | 
                                                        |
| 582 | +			if (preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) | 
                                                        |
| 583 | 583 |  			{ | 
                                                        
| 584 | -				return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"','\\"',$matches[4])); | 
                                                        |
| 584 | +				return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"', '\\"', $matches[4])); | 
                                                        |
| 585 | 585 | // If other multimedia file but image is,  | 
                                                        
| 586 | 586 | }  | 
                                                        
| 587 | 587 | else  | 
                                                        
@@ -603,7 +603,7 @@ discard block  | 
                                                    ||
| 603 | 603 | function _replaceTTMovie($matches)  | 
                                                        
| 604 | 604 |  	{ | 
                                                        
| 605 | 605 | $key = $matches[1];  | 
                                                        
| 606 | - if(!$key) return $matches[0];  | 
                                                        |
| 606 | + if (!$key) return $matches[0];  | 
                                                        |
| 607 | 607 | |
| 608 | 608 | return  | 
                                                        
| 609 | 609 | '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="402">'.  | 
                                                        
@@ -631,12 +631,12 @@ discard block  | 
                                                    ||
| 631 | 631 | $tobj->comment_srl = getNextSequence();  | 
                                                        
| 632 | 632 | $tobj->module_srl = $module_srl;  | 
                                                        
| 633 | 633 | $tobj->document_srl = $document_srl;  | 
                                                        
| 634 | - $tobj->is_secret = $val->secret->body=='1'?'Y':'N';  | 
                                                        |
| 634 | + $tobj->is_secret = $val->secret->body == '1' ? 'Y' : 'N';  | 
                                                        |
| 635 | 635 | $tobj->notify_message = 'N';  | 
                                                        
| 636 | 636 | $tobj->content = nl2br($val->content->body);  | 
                                                        
| 637 | 637 | $tobj->voted_count = 0;  | 
                                                        
| 638 | 638 | $tobj->status = 1;  | 
                                                        
| 639 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 639 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id)  | 
                                                        |
| 640 | 640 |  		{ | 
                                                        
| 641 | 641 | $tobj->password = '';  | 
                                                        
| 642 | 642 | $tobj->nick_name = $member_info->nick_name;  | 
                                                        
@@ -653,9 +653,9 @@ discard block  | 
                                                    ||
| 653 | 653 | $tobj->homepage = $val->commenter->homepage->body;  | 
                                                        
| 654 | 654 | $tobj->member_srl = 0;  | 
                                                        
| 655 | 655 | }  | 
                                                        
| 656 | -		$tobj->last_update = $tobj->regdate = date("YmdHis",$val->written->body); | 
                                                        |
| 656 | +		$tobj->last_update = $tobj->regdate = date("YmdHis", $val->written->body); | 
                                                        |
| 657 | 657 | $tobj->ipaddress = $val->commenter->ip->body;  | 
                                                        
| 658 | - $tobj->list_order = $tobj->comment_srl*-1;  | 
                                                        |
| 658 | + $tobj->list_order = $tobj->comment_srl * -1;  | 
                                                        |
| 659 | 659 | $tobj->sequence = $sequence;  | 
                                                        
| 660 | 660 | $tobj->parent_srl = $parent_srl;  | 
                                                        
| 661 | 661 | // Comment list first  | 
                                                        
@@ -665,7 +665,7 @@ discard block  | 
                                                    ||
| 665 | 665 | $list_args->module_srl = $tobj->module_srl;  | 
                                                        
| 666 | 666 | $list_args->regdate = $tobj->regdate;  | 
                                                        
| 667 | 667 | // Set data directly if parent comment doesn't exist  | 
                                                        
| 668 | - if(!$tobj->parent_srl)  | 
                                                        |
| 668 | + if (!$tobj->parent_srl)  | 
                                                        |
| 669 | 669 |  		{ | 
                                                        
| 670 | 670 | $list_args->head = $list_args->arrange = $tobj->comment_srl;  | 
                                                        
| 671 | 671 | $list_args->depth = 0;  | 
                                                        
@@ -677,25 +677,25 @@ discard block  | 
                                                    ||
| 677 | 677 | $parent_args->comment_srl = $tobj->parent_srl;  | 
                                                        
| 678 | 678 |  			$parent_output = executeQuery('comment.getCommentListItem', $parent_args); | 
                                                        
| 679 | 679 | // Return if parent comment doesn't exist  | 
                                                        
| 680 | - if(!$parent_output->toBool() || !$parent_output->data) return false;  | 
                                                        |
| 680 | + if (!$parent_output->toBool() || !$parent_output->data) return false;  | 
                                                        |
| 681 | 681 | $parent = $parent_output->data;  | 
                                                        
| 682 | 682 | |
| 683 | 683 | $list_args->head = $parent->head;  | 
                                                        
| 684 | - $list_args->depth = $parent->depth+1;  | 
                                                        |
| 685 | - if($list_args->depth<2) $list_args->arrange = $tobj->comment_srl;  | 
                                                        |
| 684 | + $list_args->depth = $parent->depth + 1;  | 
                                                        |
| 685 | + if ($list_args->depth < 2) $list_args->arrange = $tobj->comment_srl;  | 
                                                        |
| 686 | 686 | else  | 
                                                        
| 687 | 687 |  			{ | 
                                                        
| 688 | 688 | $list_args->arrange = $parent->arrange;  | 
                                                        
| 689 | 689 |  				$output = executeQuery('comment.updateCommentListArrange', $list_args); | 
                                                        
| 690 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 690 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 691 | 691 | }  | 
                                                        
| 692 | 692 | }  | 
                                                        
| 693 | 693 | |
| 694 | 694 |  		$output = executeQuery('comment.insertCommentList', $list_args); | 
                                                        
| 695 | - if($output->toBool())  | 
                                                        |
| 695 | + if ($output->toBool())  | 
                                                        |
| 696 | 696 |  		{ | 
                                                        
| 697 | 697 |  			$output = executeQuery('comment.insertComment', $tobj); | 
                                                        
| 698 | - if($output->toBool()) return $tobj->comment_srl;  | 
                                                        |
| 698 | + if ($output->toBool()) return $tobj->comment_srl;  | 
                                                        |
| 699 | 699 | }  | 
                                                        
| 700 | 700 | return false;  | 
                                                        
| 701 | 701 | }  | 
                                                        
@@ -710,10 +710,10 @@ discard block  | 
                                                    ||
| 710 | 710 | */  | 
                                                        
| 711 | 711 | function arrangeCategory($obj, &$category, &$idx, $parent = 0)  | 
                                                        
| 712 | 712 |  	{ | 
                                                        
| 713 | - if(!$obj->category) return;  | 
                                                        |
| 714 | - if(!is_array($obj->category)) $c = array($obj->category);  | 
                                                        |
| 713 | + if (!$obj->category) return;  | 
                                                        |
| 714 | + if (!is_array($obj->category)) $c = array($obj->category);  | 
                                                        |
| 715 | 715 | else $c = $obj->category;  | 
                                                        
| 716 | - foreach($c as $val)  | 
                                                        |
| 716 | + foreach ($c as $val)  | 
                                                        |
| 717 | 717 |  		{ | 
                                                        
| 718 | 718 | $idx++;  | 
                                                        
| 719 | 719 | $priority = $val->priority->body;  | 
                                                        
@@ -43,19 +43,19 @@ discard block  | 
                                                    ||
| 43 | 43 |  		$filename = Context::get('filename'); | 
                                                        
| 44 | 44 | $isExists = 'false';  | 
                                                        
| 45 | 45 | |
| 46 | -		if(strncasecmp('http://', $filename, 7) === 0) | 
                                                        |
| 46 | +		if (strncasecmp('http://', $filename, 7) === 0) | 
                                                        |
| 47 | 47 |  		{ | 
                                                        
| 48 | -			if(ini_get('allow_url_fopen')) | 
                                                        |
| 48 | +			if (ini_get('allow_url_fopen')) | 
                                                        |
| 49 | 49 |  			{ | 
                                                        
| 50 | 50 | $fp = @fopen($filename, "r");  | 
                                                        
| 51 | - if($fp)  | 
                                                        |
| 51 | + if ($fp)  | 
                                                        |
| 52 | 52 |  				{ | 
                                                        
| 53 | 53 | $str = fgets($fp, 100);  | 
                                                        
| 54 | - if(strlen($str) > 0)  | 
                                                        |
| 54 | + if (strlen($str) > 0)  | 
                                                        |
| 55 | 55 |  					{ | 
                                                        
| 56 | 56 | $isExists = 'true';  | 
                                                        
| 57 | 57 | $type = 'XML';  | 
                                                        
| 58 | - if(stristr($str, 'tattertools')) $type = 'TTXML';  | 
                                                        |
| 58 | + if (stristr($str, 'tattertools')) $type = 'TTXML';  | 
                                                        |
| 59 | 59 | |
| 60 | 60 |  						$this->add('type', $type); | 
                                                        
| 61 | 61 | }  | 
                                                        
@@ -72,16 +72,16 @@ discard block  | 
                                                    ||
| 72 | 72 |  		{ | 
                                                        
| 73 | 73 | $realPath = FileHandler::getRealPath($filename);  | 
                                                        
| 74 | 74 | |
| 75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true';  | 
                                                        |
| 75 | + if (file_exists($realPath) && is_file($realPath)) $isExists = 'true';  | 
                                                        |
| 76 | 76 |  			$this->add('exists', $isExists); | 
                                                        
| 77 | 77 | |
| 78 | - if($isExists == 'true')  | 
                                                        |
| 78 | + if ($isExists == 'true')  | 
                                                        |
| 79 | 79 |  			{ | 
                                                        
| 80 | 80 | $type = 'XML';  | 
                                                        
| 81 | 81 | |
| 82 | 82 | $fp = fopen($realPath, "r");  | 
                                                        
| 83 | 83 | $str = fgets($fp, 100);  | 
                                                        
| 84 | - if(stristr($str, 'tattertools')) $type = 'TTXML';  | 
                                                        |
| 84 | + if (stristr($str, 'tattertools')) $type = 'TTXML';  | 
                                                        |
| 85 | 85 | fclose($fp);  | 
                                                        
| 86 | 86 | |
| 87 | 87 |  				$this->add('type', $type); | 
                                                        
@@ -107,16 +107,16 @@ discard block  | 
                                                    ||
| 107 | 107 | |
| 108 | 108 | /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다.  | 
                                                        
| 109 | 109 | CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */  | 
                                                        
| 110 | - $db_info = Context::getDBInfo ();  | 
                                                        |
| 111 | - if($db_info->db_type != "cubrid")  | 
                                                        |
| 110 | + $db_info = Context::getDBInfo();  | 
                                                        |
| 111 | + if ($db_info->db_type != "cubrid")  | 
                                                        |
| 112 | 112 |  		{ | 
                                                        
| 113 | 113 |  			$output = executeQuery('importer.updateDocumentSync'.$postFix); | 
                                                        
| 114 | 114 |  			$output = executeQuery('importer.updateCommentSync'.$postFix); | 
                                                        
| 115 | 115 | }  | 
                                                        
| 116 | 116 | else  | 
                                                        
| 117 | 117 |  		{ | 
                                                        
| 118 | -			$output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); | 
                                                        |
| 119 | - if(is_array ($output->data) && count ($output->data))  | 
                                                        |
| 118 | +			$output = executeQueryArray('importer.getDocumentMemberSrlWithUserID'.$postFix); | 
                                                        |
| 119 | + if (is_array($output->data) && count($output->data))  | 
                                                        |
| 120 | 120 |  			{ | 
                                                        
| 121 | 121 | $success_count = 0;  | 
                                                        
| 122 | 122 | $error_count = 0;  | 
                                                        
@@ -125,8 +125,8 @@ discard block  | 
                                                    ||
| 125 | 125 |  				{ | 
                                                        
| 126 | 126 | $args->user_id = $val->user_id;  | 
                                                        
| 127 | 127 | $args->member_srl = $val->member_srl;  | 
                                                        
| 128 | -					$tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args); | 
                                                        |
| 129 | - if($tmp->toBool () === true)  | 
                                                        |
| 128 | +					$tmp = executeQuery('importer.updateDocumentSyncForCUBRID'.$postFix, $args); | 
                                                        |
| 129 | + if ($tmp->toBool() === true)  | 
                                                        |
| 130 | 130 |  					{ | 
                                                        
| 131 | 131 | $success_count++;  | 
                                                        
| 132 | 132 | }  | 
                                                        
@@ -138,8 +138,8 @@ discard block  | 
                                                    ||
| 138 | 138 | }  | 
                                                        
| 139 | 139 | } // documents section  | 
                                                        
| 140 | 140 | |
| 141 | -			$output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix); | 
                                                        |
| 142 | - if(is_array ($output->data) && count ($output->data))  | 
                                                        |
| 141 | +			$output = executeQueryArray('importer.getCommentMemberSrlWithUserID'.$postFix); | 
                                                        |
| 142 | + if (is_array($output->data) && count($output->data))  | 
                                                        |
| 143 | 143 |  			{ | 
                                                        
| 144 | 144 | $success_count = 0;  | 
                                                        
| 145 | 145 | $error_count = 0;  | 
                                                        
@@ -148,8 +148,8 @@ discard block  | 
                                                    ||
| 148 | 148 |  				{ | 
                                                        
| 149 | 149 | $args->user_id = $val->user_id;  | 
                                                        
| 150 | 150 | $args->member_srl = $val->member_srl;  | 
                                                        
| 151 | -					$tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args); | 
                                                        |
| 152 | - if($tmp->toBool () === true)  | 
                                                        |
| 151 | +					$tmp = executeQuery('importer.updateCommentSyncForCUBRID'.$postFix, $args); | 
                                                        |
| 152 | + if ($tmp->toBool() === true)  | 
                                                        |
| 153 | 153 |  					{ | 
                                                        
| 154 | 154 | $success_count++;  | 
                                                        
| 155 | 155 | }  | 
                                                        
@@ -178,15 +178,15 @@ discard block  | 
                                                    ||
| 178 | 178 | // Extract and cache information from the xml file  | 
                                                        
| 179 | 179 | $oExtract = new extract();  | 
                                                        
| 180 | 180 | |
| 181 | - switch($type)  | 
                                                        |
| 181 | + switch ($type)  | 
                                                        |
| 182 | 182 |  		{ | 
                                                        
| 183 | 183 | case 'member' :  | 
                                                        
| 184 | - $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>');  | 
                                                        |
| 185 | - if($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 184 | + $output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>');  | 
                                                        |
| 185 | + if ($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 186 | 186 | break;  | 
                                                        
| 187 | 187 | case 'message' :  | 
                                                        
| 188 | - $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>');  | 
                                                        |
| 189 | - if($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 188 | + $output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>');  | 
                                                        |
| 189 | + if ($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 190 | 190 | break;  | 
                                                        
| 191 | 191 | case 'ttxml' :  | 
                                                        
| 192 | 192 | // Category information  | 
                                                        
@@ -199,12 +199,12 @@ discard block  | 
                                                    ||
| 199 | 199 | while (!feof($oExtract->fd))  | 
                                                        
| 200 | 200 |  					{ | 
                                                        
| 201 | 201 | $str = fgets($oExtract->fd, 1024);  | 
                                                        
| 202 | - if(strstr($str, '<category>'))  | 
                                                        |
| 202 | + if (strstr($str, '<category>'))  | 
                                                        |
| 203 | 203 |  						{ | 
                                                        
| 204 | 204 | $started = true;  | 
                                                        
| 205 | 205 | $str = strstr($str, '<category>');  | 
                                                        
| 206 | 206 | }  | 
                                                        
| 207 | -						if(substr($str,0,strlen('<post ')) == '<post ') break; | 
                                                        |
| 207 | +						if (substr($str, 0, strlen('<post ')) == '<post ') break; | 
                                                        |
| 208 | 208 | if ($started) $buff .= $str;  | 
                                                        
| 209 | 209 | }  | 
                                                        
| 210 | 210 | $buff = '<categories>'.$buff.'</categories>';  | 
                                                        
@@ -214,22 +214,22 @@ discard block  | 
                                                    ||
| 214 | 214 | |
| 215 | 215 | // Guestbook information  | 
                                                        
| 216 | 216 | $output = $oExtract->set($xml_file, '', '', '', '');  | 
                                                        
| 217 | - if($output->toBool())  | 
                                                        |
| 217 | + if ($output->toBool())  | 
                                                        |
| 218 | 218 |  					{ | 
                                                        
| 219 | 219 | $started = false;  | 
                                                        
| 220 | 220 | $buff = '';  | 
                                                        
| 221 | 221 | while (!feof($oExtract->fd))  | 
                                                        
| 222 | 222 |  						{ | 
                                                        
| 223 | 223 | $str = fgets($oExtract->fd, 1024);  | 
                                                        
| 224 | - if(strstr($str, '<guestbook>'))  | 
                                                        |
| 224 | + if (strstr($str, '<guestbook>'))  | 
                                                        |
| 225 | 225 |  							{ | 
                                                        
| 226 | 226 | $started = true;  | 
                                                        
| 227 | 227 | $str = strstr($str, '<guestbook>');  | 
                                                        
| 228 | 228 | }  | 
                                                        
| 229 | - if($started)  | 
                                                        |
| 229 | + if ($started)  | 
                                                        |
| 230 | 230 |  							{ | 
                                                        
| 231 | 231 | $pos = strpos($str, '</guestbook>');  | 
                                                        
| 232 | - if($pos !== false)  | 
                                                        |
| 232 | + if ($pos !== false)  | 
                                                        |
| 233 | 233 |  								{ | 
                                                        
| 234 | 234 |  									$buff .= substr($str, 0, $pos + strlen('</guestbook>')); | 
                                                        
| 235 | 235 | break;  | 
                                                        
@@ -241,37 +241,37 @@ discard block  | 
                                                    ||
| 241 | 241 |  						$guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); | 
                                                        
| 242 | 242 | FileHandler::writeFile($guestbook_filename, $buff);  | 
                                                        
| 243 | 243 | // Individual items  | 
                                                        
| 244 | - $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>');  | 
                                                        |
| 245 | - if($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 244 | + $output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>');  | 
                                                        |
| 245 | + if ($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 246 | 246 | }  | 
                                                        
| 247 | 247 | }  | 
                                                        
| 248 | 248 | break;  | 
                                                        
| 249 | 249 | default :  | 
                                                        
| 250 | 250 | // First get category information  | 
                                                        
| 251 | - $output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>');  | 
                                                        |
| 252 | - if($output->toBool())  | 
                                                        |
| 251 | + $output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>');  | 
                                                        |
| 252 | + if ($output->toBool())  | 
                                                        |
| 253 | 253 |  				{ | 
                                                        
| 254 | 254 |  					$oExtract->mergeItems('category.xml'); | 
                                                        
| 255 | 255 | // Get each item  | 
                                                        
| 256 | - $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>');  | 
                                                        |
| 257 | - if($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 256 | + $output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>');  | 
                                                        |
| 257 | + if ($output->toBool()) $oExtract->saveItems();  | 
                                                        |
| 258 | 258 | }  | 
                                                        
| 259 | 259 | break;  | 
                                                        
| 260 | 260 | }  | 
                                                        
| 261 | 261 | |
| 262 | - if(!$output->toBool())  | 
                                                        |
| 262 | + if (!$output->toBool())  | 
                                                        |
| 263 | 263 |  		{ | 
                                                        
| 264 | -			$this->add('error',0); | 
                                                        |
| 265 | -			$this->add('status',-1); | 
                                                        |
| 264 | +			$this->add('error', 0); | 
                                                        |
| 265 | +			$this->add('status', -1); | 
                                                        |
| 266 | 266 | $this->setMessage($output->getMessage());  | 
                                                        
| 267 | 267 | return;  | 
                                                        
| 268 | 268 | }  | 
                                                        
| 269 | 269 | // Notify that all data completely extracted  | 
                                                        
| 270 | -		$this->add('type',$type); | 
                                                        |
| 271 | -		$this->add('total',$oExtract->getTotalCount()); | 
                                                        |
| 272 | -		$this->add('cur',0); | 
                                                        |
| 270 | +		$this->add('type', $type); | 
                                                        |
| 271 | +		$this->add('total', $oExtract->getTotalCount()); | 
                                                        |
| 272 | +		$this->add('cur', 0); | 
                                                        |
| 273 | 273 |  		$this->add('key', $oExtract->getKey()); | 
                                                        
| 274 | -		$this->add('status',0); | 
                                                        |
| 274 | +		$this->add('status', 0); | 
                                                        |
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
| 277 | 277 | /**  | 
                                                        
@@ -291,19 +291,19 @@ discard block  | 
                                                    ||
| 291 | 291 |  		$this->unit_count = Context::get('unit_count'); | 
                                                        
| 292 | 292 | // Check if an index file exists  | 
                                                        
| 293 | 293 | $index_file = './files/cache/importer/'.$key.'/index';  | 
                                                        
| 294 | - if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file');  | 
                                                        |
| 294 | + if (!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file');  | 
                                                        |
| 295 | 295 | |
| 296 | - switch($type)  | 
                                                        |
| 296 | + switch ($type)  | 
                                                        |
| 297 | 297 |  		{ | 
                                                        
| 298 | 298 | case 'ttxml' :  | 
                                                        
| 299 | - if(!$target_module) return new Object(-1,'msg_invalid_request');  | 
                                                        |
| 299 | + if (!$target_module) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 300 | 300 | |
| 301 | 301 |  				$oModuleModel = getModel('module'); | 
                                                        
| 302 | 302 |  				$columnList = array('module_srl', 'module'); | 
                                                        
| 303 | 303 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList);  | 
                                                        
| 304 | 304 | |
| 305 | - $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php');  | 
                                                        |
| 306 | - if($ttimporter) require_once($ttimporter);  | 
                                                        |
| 305 | + $ttimporter = FileHandler::exists(_XE_PATH_.'modules/importer/ttimport.class.php');  | 
                                                        |
| 306 | + if ($ttimporter) require_once($ttimporter);  | 
                                                        |
| 307 | 307 | |
| 308 | 308 | $oTT = new ttimport();  | 
                                                        
| 309 | 309 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module);  | 
                                                        
@@ -316,23 +316,23 @@ discard block  | 
                                                    ||
| 316 | 316 | break;  | 
                                                        
| 317 | 317 | case 'module' :  | 
                                                        
| 318 | 318 | // Check if the target module exists  | 
                                                        
| 319 | - if(!$target_module) return new Object(-1,'msg_invalid_request');  | 
                                                        |
| 319 | + if (!$target_module) return new Object(-1, 'msg_invalid_request');  | 
                                                        |
| 320 | 320 | $cur = $this->importModule($key, $cur, $index_file, $target_module);  | 
                                                        
| 321 | 321 | break;  | 
                                                        
| 322 | 322 | }  | 
                                                        
| 323 | 323 | // Notify that all data completely extracted  | 
                                                        
| 324 | -		$this->add('type',$type); | 
                                                        |
| 325 | -		$this->add('total',$total); | 
                                                        |
| 326 | -		$this->add('cur',$cur); | 
                                                        |
| 324 | +		$this->add('type', $type); | 
                                                        |
| 325 | +		$this->add('total', $total); | 
                                                        |
| 326 | +		$this->add('cur', $cur); | 
                                                        |
| 327 | 327 |  		$this->add('key', $key); | 
                                                        
| 328 | 328 |  		$this->add('target_module', $target_module); | 
                                                        
| 329 | 329 | // When completing, success message appears and remove the cache files  | 
                                                        
| 330 | - if($total <= $cur)  | 
                                                        |
| 330 | + if ($total <= $cur)  | 
                                                        |
| 331 | 331 |  		{ | 
                                                        
| 332 | -			$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); | 
                                                        |
| 332 | +			$this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); | 
                                                        |
| 333 | 333 |  			FileHandler::removeDir('./files/cache/importer/'.$key); | 
                                                        
| 334 | 334 | }  | 
                                                        
| 335 | -		else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); | 
                                                        |
| 335 | +		else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur)); | 
                                                        |
| 336 | 336 | }  | 
                                                        
| 337 | 337 | |
| 338 | 338 | /**  | 
                                                        
@@ -344,7 +344,7 @@ discard block  | 
                                                    ||
| 344 | 344 | */  | 
                                                        
| 345 | 345 | function importMember($key, $cur, $index_file)  | 
                                                        
| 346 | 346 |  	{ | 
                                                        
| 347 | - if(!$cur) $cur = 0;  | 
                                                        |
| 347 | + if (!$cur) $cur = 0;  | 
                                                        |
| 348 | 348 | // Create the xmlParser object  | 
                                                        
| 349 | 349 | $oXmlParser = new XmlParser();  | 
                                                        
| 350 | 350 | // Create objects for importing member information  | 
                                                        
@@ -357,30 +357,30 @@ discard block  | 
                                                    ||
| 357 | 357 |  		$oModuleModel = getModel('module'); | 
                                                        
| 358 | 358 |  		$member_config = $oModuleModel->getModuleConfig('member'); | 
                                                        
| 359 | 359 | // Open an index file  | 
                                                        
| 360 | - $f = fopen($index_file,"r");  | 
                                                        |
| 360 | + $f = fopen($index_file, "r");  | 
                                                        |
| 361 | 361 | // Pass if already read  | 
                                                        
| 362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024);  | 
                                                        |
| 362 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024);  | 
                                                        |
| 363 | 363 | // Read by each line until the condition meets  | 
                                                        
| 364 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)  | 
                                                        |
| 364 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)  | 
                                                        |
| 365 | 365 |  		{ | 
                                                        
| 366 | - if(feof($f)) break;  | 
                                                        |
| 366 | + if (feof($f)) break;  | 
                                                        |
| 367 | 367 | // Find a given location  | 
                                                        
| 368 | 368 | $target_file = trim(fgets($f, 1024));  | 
                                                        
| 369 | 369 | // Load and parse the file  | 
                                                        
| 370 | 370 | $xmlObj = $oXmlParser->loadXmlFile($target_file);  | 
                                                        
| 371 | 371 | FileHandler::removeFile($target_file);  | 
                                                        
| 372 | - if(!$xmlObj) continue;  | 
                                                        |
| 372 | + if (!$xmlObj) continue;  | 
                                                        |
| 373 | 373 | // List Objects  | 
                                                        
| 374 | 374 | $obj = null;  | 
                                                        
| 375 | 375 | $obj->user_id = base64_decode($xmlObj->member->user_id->body);  | 
                                                        
| 376 | 376 | $obj->password = base64_decode($xmlObj->member->password->body);  | 
                                                        
| 377 | 377 | $obj->user_name = base64_decode($xmlObj->member->user_name->body);  | 
                                                        
| 378 | 378 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body);  | 
                                                        
| 379 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 379 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 380 | 380 | $obj->email = base64_decode($xmlObj->member->email->body);  | 
                                                        
| 381 | 381 | $obj->homepage = base64_decode($xmlObj->member->homepage->body);  | 
                                                        
| 382 | 382 | $obj->blog = base64_decode($xmlObj->member->blog->body);  | 
                                                        
| 383 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8);  | 
                                                        |
| 383 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8);  | 
                                                        |
| 384 | 384 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body);  | 
                                                        
| 385 | 385 | $obj->point = base64_decode($xmlObj->member->point->body);  | 
                                                        
| 386 | 386 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body);  | 
                                                        
@@ -390,26 +390,26 @@ discard block  | 
                                                    ||
| 390 | 390 | $obj->regdate = base64_decode($xmlObj->member->regdate->body);  | 
                                                        
| 391 | 391 | $obj->last_login = base64_decode($xmlObj->member->last_login->body);  | 
                                                        
| 392 | 392 | |
| 393 | - if($xmlObj->member->extra_vars)  | 
                                                        |
| 393 | + if ($xmlObj->member->extra_vars)  | 
                                                        |
| 394 | 394 |  			{ | 
                                                        
| 395 | - foreach($xmlObj->member->extra_vars as $key => $val)  | 
                                                        |
| 395 | + foreach ($xmlObj->member->extra_vars as $key => $val)  | 
                                                        |
| 396 | 396 |  				{ | 
                                                        
| 397 | -					if(in_array($key, array('node_name','attrs','body'))) continue; | 
                                                        |
| 397 | +					if (in_array($key, array('node_name', 'attrs', 'body'))) continue; | 
                                                        |
| 398 | 398 |  					$obj->extra_vars->{$key} = base64_decode($val->body); | 
                                                        
| 399 | 399 | }  | 
                                                        
| 400 | 400 | }  | 
                                                        
| 401 | 401 | // Create url for homepage and blog  | 
                                                        
| 402 | -			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; | 
                                                        |
| 402 | +			if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; | 
                                                        |
| 403 | 403 | // email address column  | 
                                                        
| 404 | 404 | $obj->email_address = $obj->email;  | 
                                                        
| 405 | 405 |  			list($obj->email_id, $obj->email_host) = explode('@', $obj->email); | 
                                                        
| 406 | 406 | // Set the mailing option  | 
                                                        
| 407 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N';  | 
                                                        |
| 407 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N';  | 
                                                        |
| 408 | 408 | // Set the message option  | 
                                                        
| 409 | 409 | $obj->allow_message = 'Y';  | 
                                                        
| 410 | -			if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; | 
                                                        |
| 410 | +			if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; | 
                                                        |
| 411 | 411 | // Get member-join date if the last login time is not found  | 
                                                        
| 412 | - if(!$obj->last_login) $obj->last_login = $obj->regdate;  | 
                                                        |
| 412 | + if (!$obj->last_login) $obj->last_login = $obj->regdate;  | 
                                                        |
| 413 | 413 | // Get a member_srl  | 
                                                        
| 414 | 414 | $obj->member_srl = getNextSequence();  | 
                                                        
| 415 | 415 | $obj->list_order = -1 * $obj->member_srl;  | 
                                                        
@@ -421,63 +421,63 @@ discard block  | 
                                                    ||
| 421 | 421 | $nick_args = new stdClass;  | 
                                                        
| 422 | 422 | $nick_args->nick_name = $obj->nick_name;  | 
                                                        
| 423 | 423 |  			$nick_output = executeQuery('member.getMemberSrl', $nick_args); | 
                                                        
| 424 | - if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;  | 
                                                        |
| 424 | + if (!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;  | 
                                                        |
| 425 | 425 | // Add a member  | 
                                                        
| 426 | 426 |  			$output = executeQuery('member.insertMember', $obj); | 
                                                        
| 427 | 427 | |
| 428 | - if($output->toBool() && !($obj->password))  | 
                                                        |
| 428 | + if ($output->toBool() && !($obj->password))  | 
                                                        |
| 429 | 429 |  			{ | 
                                                        
| 430 | 430 | // Send a mail telling the user to reset his password.  | 
                                                        
| 431 | 431 | $oMail = new Mail();  | 
                                                        
| 432 | -				$oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); | 
                                                        |
| 433 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster';  | 
                                                        |
| 432 | +				$oMail->setTitle("Password update for your ".getFullSiteUrl()." account"); | 
                                                        |
| 433 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster';  | 
                                                        |
| 434 | 434 |  				$oMail->setContent("Dear $obj->user_name, <br /><br /> | 
                                                        
| 435 | 435 | We recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link:  | 
                                                        
| 436 | - <a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />  | 
                                                        |
| 436 | + <a href='".getFullSiteUrl()."/?act=dispMemberFindAccount' >".getFullSiteUrl()."?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />  | 
                                                        |
| 437 | 437 | |
| 438 | 438 | Thank you for your understanding,<br />  | 
                                                        
| 439 | 439 |  						{$webmaster_name}" | 
                                                        
| 440 | 440 | );  | 
                                                        
| 441 | 441 | $oMail->setSender($webmaster_name, $member_config->webmaster_email);  | 
                                                        
| 442 | - $oMail->setReceiptor( $obj->user_name, $obj->email);  | 
                                                        |
| 442 | + $oMail->setReceiptor($obj->user_name, $obj->email);  | 
                                                        |
| 443 | 443 | $oMail->send();  | 
                                                        
| 444 | 444 | }  | 
                                                        
| 445 | 445 | |
| 446 | 446 | // add group join/image name-mark-signiture and so on if a new member successfully added  | 
                                                        
| 447 | - if($output->toBool())  | 
                                                        |
| 447 | + if ($output->toBool())  | 
                                                        |
| 448 | 448 |  			{ | 
                                                        
| 449 | 449 | // Join to the default group  | 
                                                        
| 450 | 450 | $obj->group_srl = $default_group_srl;  | 
                                                        
| 451 | -				executeQuery('member.addMemberToGroup',$obj); | 
                                                        |
| 451 | +				executeQuery('member.addMemberToGroup', $obj); | 
                                                        |
| 452 | 452 | // Image name  | 
                                                        
| 453 | - if($obj->image_nickname)  | 
                                                        |
| 453 | + if ($obj->image_nickname)  | 
                                                        |
| 454 | 454 |  				{ | 
                                                        
| 455 | 455 |  					$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); | 
                                                        
| 456 | 456 |  					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); | 
                                                        
| 457 | 457 | FileHandler::writeFile($target_filename, $obj->image_nickname);  | 
                                                        
| 458 | 458 | }  | 
                                                        
| 459 | 459 | // Image mark  | 
                                                        
| 460 | - if($obj->image_mark && file_exists($obj->image_mark))  | 
                                                        |
| 460 | + if ($obj->image_mark && file_exists($obj->image_mark))  | 
                                                        |
| 461 | 461 |  				{ | 
                                                        
| 462 | 462 |  					$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); | 
                                                        
| 463 | 463 |  					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); | 
                                                        
| 464 | 464 | FileHandler::writeFile($target_filename, $obj->image_mark);  | 
                                                        
| 465 | 465 | }  | 
                                                        
| 466 | 466 | // Profile image  | 
                                                        
| 467 | - if($obj->profile_image)  | 
                                                        |
| 467 | + if ($obj->profile_image)  | 
                                                        |
| 468 | 468 |  				{ | 
                                                        
| 469 | 469 |  					$target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); | 
                                                        
| 470 | 470 |  					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); | 
                                                        
| 471 | 471 | FileHandler::writeFile($target_filename, $obj->profile_image);  | 
                                                        
| 472 | 472 | }  | 
                                                        
| 473 | 473 | // Signiture  | 
                                                        
| 474 | - if($obj->signature)  | 
                                                        |
| 474 | + if ($obj->signature)  | 
                                                        |
| 475 | 475 |  				{ | 
                                                        
| 476 | 476 | $signature = removeHackTag($obj->signature);  | 
                                                        
| 477 | 477 |  					$signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); | 
                                                        
| 478 | 478 | |
| 479 | 479 |  					$target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); | 
                                                        
| 480 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path);  | 
                                                        |
| 480 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path);  | 
                                                        |
| 481 | 481 |  					$target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); | 
                                                        
| 482 | 482 | |
| 483 | 483 | FileHandler::writeFile($target_filename, $signature_buff);  | 
                                                        
@@ -487,7 +487,7 @@ discard block  | 
                                                    ||
| 487 | 487 | |
| 488 | 488 | fclose($f);  | 
                                                        
| 489 | 489 | |
| 490 | - return $idx-1;  | 
                                                        |
| 490 | + return $idx - 1;  | 
                                                        |
| 491 | 491 | }  | 
                                                        
| 492 | 492 | |
| 493 | 493 | /**  | 
                                                        
@@ -499,58 +499,58 @@ discard block  | 
                                                    ||
| 499 | 499 | */  | 
                                                        
| 500 | 500 | function importMessage($key, $cur, $index_file)  | 
                                                        
| 501 | 501 |  	{ | 
                                                        
| 502 | - if(!$cur) $cur = 0;  | 
                                                        |
| 502 | + if (!$cur) $cur = 0;  | 
                                                        |
| 503 | 503 | // Create the xmlParser object  | 
                                                        
| 504 | 504 | $oXmlParser = new XmlParser();  | 
                                                        
| 505 | 505 | // Open an index file  | 
                                                        
| 506 | - $f = fopen($index_file,"r");  | 
                                                        |
| 506 | + $f = fopen($index_file, "r");  | 
                                                        |
| 507 | 507 | // Pass if already read  | 
                                                        
| 508 | - for($i=0;$i<$cur;$i++) fgets($f, 1024);  | 
                                                        |
| 508 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024);  | 
                                                        |
| 509 | 509 | // Read each line until the condition meets  | 
                                                        
| 510 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)  | 
                                                        |
| 510 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)  | 
                                                        |
| 511 | 511 |  		{ | 
                                                        
| 512 | - if(feof($f)) break;  | 
                                                        |
| 512 | + if (feof($f)) break;  | 
                                                        |
| 513 | 513 | // Find a location  | 
                                                        
| 514 | 514 | $target_file = trim(fgets($f, 1024));  | 
                                                        
| 515 | 515 | // Load and parse the file  | 
                                                        
| 516 | 516 | $xmlObj = $oXmlParser->loadXmlFile($target_file);  | 
                                                        
| 517 | 517 | FileHandler::removeFile($target_file);  | 
                                                        
| 518 | - if(!$xmlObj) continue;  | 
                                                        |
| 518 | + if (!$xmlObj) continue;  | 
                                                        |
| 519 | 519 | // List objects  | 
                                                        
| 520 | 520 | $obj = null;  | 
                                                        
| 521 | 521 | $obj->receiver = base64_decode($xmlObj->message->receiver->body);  | 
                                                        
| 522 | 522 | $obj->sender = base64_decode($xmlObj->message->sender->body);  | 
                                                        
| 523 | 523 | $obj->title = base64_decode($xmlObj->message->title->body);  | 
                                                        
| 524 | 524 | $obj->content = base64_decode($xmlObj->message->content->body);  | 
                                                        
| 525 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N';  | 
                                                        |
| 525 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N';  | 
                                                        |
| 526 | 526 | $obj->regdate = base64_decode($xmlObj->message->regdate->body);  | 
                                                        
| 527 | 527 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body);  | 
                                                        
| 528 | 528 | // Get member_srl of sender/recipient (If not exists, pass)  | 
                                                        
| 529 | - if(!$obj->sender) continue;  | 
                                                        |
| 529 | + if (!$obj->sender) continue;  | 
                                                        |
| 530 | 530 | $sender_args->user_id = $obj->sender;  | 
                                                        
| 531 | -			$sender_output = executeQuery('member.getMemberInfo',$sender_args); | 
                                                        |
| 531 | +			$sender_output = executeQuery('member.getMemberInfo', $sender_args); | 
                                                        |
| 532 | 532 | $sender_srl = $sender_output->data->member_srl;  | 
                                                        
| 533 | - if(!$sender_srl)  | 
                                                        |
| 533 | + if (!$sender_srl)  | 
                                                        |
| 534 | 534 |  			{ | 
                                                        
| 535 | 535 | unset($sender_args);  | 
                                                        
| 536 | 536 | $sender_args->email_address = $obj->sender;  | 
                                                        
| 537 | -				$sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); | 
                                                        |
| 537 | +				$sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); | 
                                                        |
| 538 | 538 | $sender_srl = $sender_output->data->member_srl;  | 
                                                        
| 539 | 539 | }  | 
                                                        
| 540 | - if(!$sender_srl) continue;  | 
                                                        |
| 540 | + if (!$sender_srl) continue;  | 
                                                        |
| 541 | 541 | |
| 542 | 542 | $receiver_args->user_id = $obj->receiver;  | 
                                                        
| 543 | - if(!$obj->receiver) continue;  | 
                                                        |
| 544 | -			$receiver_output = executeQuery('member.getMemberInfo',$receiver_args); | 
                                                        |
| 543 | + if (!$obj->receiver) continue;  | 
                                                        |
| 544 | +			$receiver_output = executeQuery('member.getMemberInfo', $receiver_args); | 
                                                        |
| 545 | 545 | $receiver_srl = $receiver_output->data->member_srl;  | 
                                                        
| 546 | - if(!$receiver_srl)  | 
                                                        |
| 546 | + if (!$receiver_srl)  | 
                                                        |
| 547 | 547 |  			{ | 
                                                        
| 548 | 548 | unset($receiver_args);  | 
                                                        
| 549 | 549 | $receiver_args->email_address = $obj->receiver;  | 
                                                        
| 550 | -				$receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); | 
                                                        |
| 550 | +				$receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); | 
                                                        |
| 551 | 551 | $receiver_srl = $receiver_output->data->member_srl;  | 
                                                        
| 552 | 552 | }  | 
                                                        
| 553 | - if(!$receiver_srl) continue;  | 
                                                        |
| 553 | + if (!$receiver_srl) continue;  | 
                                                        |
| 554 | 554 | // Message to save into sender's message box  | 
                                                        
| 555 | 555 | $sender_args->sender_srl = $sender_srl;  | 
                                                        
| 556 | 556 | $sender_args->receiver_srl = $receiver_srl;  | 
                                                        
@@ -565,13 +565,13 @@ discard block  | 
                                                    ||
| 565 | 565 | $sender_args->list_order = $sender_args->message_srl * -1;  | 
                                                        
| 566 | 566 | |
| 567 | 567 |  			$output = executeQuery('communication.sendMessage', $sender_args); | 
                                                        
| 568 | - if($output->toBool())  | 
                                                        |
| 568 | + if ($output->toBool())  | 
                                                        |
| 569 | 569 |  			{ | 
                                                        
| 570 | 570 | // Message to save into recipient's massage box  | 
                                                        
| 571 | 571 | $receiver_args->message_srl = $sender_args->related_srl;  | 
                                                        
| 572 | - $receiver_args->list_order = $sender_args->related_srl*-1;  | 
                                                        |
| 572 | + $receiver_args->list_order = $sender_args->related_srl * -1;  | 
                                                        |
| 573 | 573 | $receiver_args->sender_srl = $sender_srl;  | 
                                                        
| 574 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;  | 
                                                        |
| 574 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;  | 
                                                        |
| 575 | 575 | $receiver_args->receiver_srl = $receiver_srl;  | 
                                                        
| 576 | 576 | $receiver_args->message_type = 'R';  | 
                                                        
| 577 | 577 | $receiver_args->title = $obj->title;  | 
                                                        
@@ -585,7 +585,7 @@ discard block  | 
                                                    ||
| 585 | 585 | |
| 586 | 586 | fclose($f);  | 
                                                        
| 587 | 587 | |
| 588 | - return $idx-1;  | 
                                                        |
| 588 | + return $idx - 1;  | 
                                                        |
| 589 | 589 | }  | 
                                                        
| 590 | 590 | |
| 591 | 591 | /**  | 
                                                        
@@ -605,10 +605,10 @@ discard block  | 
                                                    ||
| 605 | 605 |  		$oDocumentModel = getModel('document'); | 
                                                        
| 606 | 606 | $category_list = $category_titles = array();  | 
                                                        
| 607 | 607 | $category_list = $oDocumentModel->getCategoryList($module_srl);  | 
                                                        
| 608 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 608 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 609 | 609 | // Extract category information  | 
                                                        
| 610 | 610 |  		$category_file = preg_replace('/index$/i', 'category.xml', $index_file); | 
                                                        
| 611 | - if(file_exists($category_file))  | 
                                                        |
| 611 | + if (file_exists($category_file))  | 
                                                        |
| 612 | 612 |  		{ | 
                                                        
| 613 | 613 | $buff = FileHandler::readFile($category_file);  | 
                                                        
| 614 | 614 | |
@@ -616,14 +616,14 @@ discard block  | 
                                                    ||
| 616 | 616 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file);  | 
                                                        
| 617 | 617 | |
| 618 | 618 | $categories = $xmlDoc->items->category;  | 
                                                        
| 619 | - if($categories)  | 
                                                        |
| 619 | + if ($categories)  | 
                                                        |
| 620 | 620 |  			{ | 
                                                        
| 621 | - if(!is_array($categories)) $categories = array($categories);  | 
                                                        |
| 621 | + if (!is_array($categories)) $categories = array($categories);  | 
                                                        |
| 622 | 622 | $match_sequence = array();  | 
                                                        
| 623 | - foreach($categories as $k => $v)  | 
                                                        |
| 623 | + foreach ($categories as $k => $v)  | 
                                                        |
| 624 | 624 |  				{ | 
                                                        
| 625 | 625 | $category = trim(base64_decode($v->body));  | 
                                                        
| 626 | - if(!$category || $category_titles[$category]) continue;  | 
                                                        |
| 626 | + if (!$category || $category_titles[$category]) continue;  | 
                                                        |
| 627 | 627 | |
| 628 | 628 | $sequence = $v->attrs->sequence;  | 
                                                        
| 629 | 629 | $parent = $v->attrs->parent;  | 
                                                        
@@ -631,10 +631,10 @@ discard block  | 
                                                    ||
| 631 | 631 | $obj = null;  | 
                                                        
| 632 | 632 | $obj->title = $category;  | 
                                                        
| 633 | 633 | $obj->module_srl = $module_srl;  | 
                                                        
| 634 | - if($parent) $obj->parent_srl = $match_sequence[$parent];  | 
                                                        |
| 634 | + if ($parent) $obj->parent_srl = $match_sequence[$parent];  | 
                                                        |
| 635 | 635 | |
| 636 | 636 | $output = $oDocumentController->insertCategory($obj);  | 
                                                        
| 637 | -					if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); | 
                                                        |
| 637 | +					if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); | 
                                                        |
| 638 | 638 | }  | 
                                                        
| 639 | 639 |  				$oDocumentController = getController('document'); | 
                                                        
| 640 | 640 | $oDocumentController->makeCategoryFile($module_srl);  | 
                                                        
@@ -644,31 +644,31 @@ discard block  | 
                                                    ||
| 644 | 644 | |
| 645 | 645 | $category_list = $category_titles = array();  | 
                                                        
| 646 | 646 | $category_list = $oDocumentModel->getCategoryList($module_srl);  | 
                                                        
| 647 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 647 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;  | 
                                                        |
| 648 | 648 | |
| 649 | 649 | $ek_args->module_srl = $module_srl;  | 
                                                        
| 650 | 650 |  		$output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); | 
                                                        
| 651 | - if($output->data)  | 
                                                        |
| 651 | + if ($output->data)  | 
                                                        |
| 652 | 652 |  		{ | 
                                                        
| 653 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true;  | 
                                                        |
| 653 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true;  | 
                                                        |
| 654 | 654 | }  | 
                                                        
| 655 | 655 | |
| 656 | - if(!$cur) $cur = 0;  | 
                                                        |
| 656 | + if (!$cur) $cur = 0;  | 
                                                        |
| 657 | 657 | // Open an index file  | 
                                                        
| 658 | - $f = fopen($index_file,"r");  | 
                                                        |
| 658 | + $f = fopen($index_file, "r");  | 
                                                        |
| 659 | 659 | // Pass if already read  | 
                                                        
| 660 | - for($i=0;$i<$cur;$i++) fgets($f, 1024);  | 
                                                        |
| 660 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024);  | 
                                                        |
| 661 | 661 | // Read each line until the condition meets  | 
                                                        
| 662 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)  | 
                                                        |
| 662 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)  | 
                                                        |
| 663 | 663 |  		{ | 
                                                        
| 664 | - if(feof($f)) break;  | 
                                                        |
| 664 | + if (feof($f)) break;  | 
                                                        |
| 665 | 665 | // Find a location  | 
                                                        
| 666 | 666 | $target_file = trim(fgets($f, 1024));  | 
                                                        
| 667 | 667 | |
| 668 | - if(!file_exists($target_file)) continue;  | 
                                                        |
| 668 | + if (!file_exists($target_file)) continue;  | 
                                                        |
| 669 | 669 | // Importing data from now on  | 
                                                        
| 670 | - $fp = fopen($target_file,"r");  | 
                                                        |
| 671 | - if(!$fp) continue;  | 
                                                        |
| 670 | + $fp = fopen($target_file, "r");  | 
                                                        |
| 671 | + if (!$fp) continue;  | 
                                                        |
| 672 | 672 | |
| 673 | 673 | $obj = new stdClass;  | 
                                                        
| 674 | 674 | $obj->module_srl = $module_srl;  | 
                                                        
@@ -680,51 +680,51 @@ discard block  | 
                                                    ||
| 680 | 680 | $started = false;  | 
                                                        
| 681 | 681 | $buff = array();  | 
                                                        
| 682 | 682 | // Start from the body data  | 
                                                        
| 683 | - while(!feof($fp))  | 
                                                        |
| 683 | + while (!feof($fp))  | 
                                                        |
| 684 | 684 |  			{ | 
                                                        
| 685 | 685 | $str = fgets($fp, 1024);  | 
                                                        
| 686 | 686 | // Prepare an item  | 
                                                        
| 687 | - if(trim($str) == '<post>')  | 
                                                        |
| 687 | + if (trim($str) == '<post>')  | 
                                                        |
| 688 | 688 |  				{ | 
                                                        
| 689 | 689 | $started = true;  | 
                                                        
| 690 | 690 | // Trackback inserted  | 
                                                        
| 691 | 691 | }  | 
                                                        
| 692 | - else if(substr($str,0,11) == '<trackbacks')  | 
                                                        |
| 692 | + else if (substr($str, 0, 11) == '<trackbacks')  | 
                                                        |
| 693 | 693 |  				{ | 
                                                        
| 694 | 694 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl);  | 
                                                        
| 695 | 695 | continue;  | 
                                                        
| 696 | 696 | // Comments inserted  | 
                                                        
| 697 | 697 | }  | 
                                                        
| 698 | - else if(substr($str,0,9) == '<comments')  | 
                                                        |
| 698 | + else if (substr($str, 0, 9) == '<comments')  | 
                                                        |
| 699 | 699 |  				{ | 
                                                        
| 700 | 700 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl);  | 
                                                        
| 701 | 701 | continue;  | 
                                                        
| 702 | 702 | // Attachment inserted  | 
                                                        
| 703 | 703 | }  | 
                                                        
| 704 | - else if(substr($str,0,9) == '<attaches')  | 
                                                        |
| 704 | + else if (substr($str, 0, 9) == '<attaches')  | 
                                                        |
| 705 | 705 |  				{ | 
                                                        
| 706 | 706 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files);  | 
                                                        
| 707 | 707 | continue;  | 
                                                        
| 708 | 708 | // When starting extra variabls  | 
                                                        
| 709 | 709 | }  | 
                                                        
| 710 | - elseif(trim($str) == '<extra_vars>')  | 
                                                        |
| 710 | + elseif (trim($str) == '<extra_vars>')  | 
                                                        |
| 711 | 711 |  				{ | 
                                                        
| 712 | 712 | $extra_vars = $this->importExtraVars($fp);  | 
                                                        
| 713 | 713 | continue;  | 
                                                        
| 714 | 714 | }  | 
                                                        
| 715 | 715 | |
| 716 | - if($started) $buff[] = $str;  | 
                                                        |
| 716 | + if ($started) $buff[] = $str;  | 
                                                        |
| 717 | 717 | }  | 
                                                        
| 718 | 718 | |
| 719 | 719 |  			$xmlDoc = $this->oXmlParser->parse(implode('', $buff)); | 
                                                        
| 720 | 720 | |
| 721 | 721 | $category = base64_decode($xmlDoc->post->category->body);  | 
                                                        
| 722 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category];  | 
                                                        |
| 722 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category];  | 
                                                        |
| 723 | 723 | |
| 724 | 724 | $obj->member_srl = 0;  | 
                                                        
| 725 | 725 | |
| 726 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N';  | 
                                                        |
| 727 | -			$obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); | 
                                                        |
| 726 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N';  | 
                                                        |
| 727 | +			$obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); | 
                                                        |
| 728 | 728 | $obj->title = base64_decode($xmlDoc->post->title->body);  | 
                                                        
| 729 | 729 | $obj->content = base64_decode($xmlDoc->post->content->body);  | 
                                                        
| 730 | 730 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body);  | 
                                                        
@@ -733,39 +733,39 @@ discard block  | 
                                                    ||
| 733 | 733 | $obj->password = base64_decode($xmlDoc->post->password->body);  | 
                                                        
| 734 | 734 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body);  | 
                                                        
| 735 | 735 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body);  | 
                                                        
| 736 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 736 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 737 | 737 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body);  | 
                                                        
| 738 | 738 | $obj->email_address = base64_decode($xmlDoc->post->email->body);  | 
                                                        
| 739 | 739 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body);  | 
                                                        
| 740 | -			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; | 
                                                        |
| 740 | +			if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; | 
                                                        |
| 741 | 741 | $obj->tags = base64_decode($xmlDoc->post->tags->body);  | 
                                                        
| 742 | 742 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body);  | 
                                                        
| 743 | 743 | $obj->last_update = base64_decode($xmlDoc->post->update->body);  | 
                                                        
| 744 | 744 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body);  | 
                                                        
| 745 | - if(!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 745 | + if (!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 746 | 746 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body);  | 
                                                        
| 747 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1;  | 
                                                        |
| 748 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY';  | 
                                                        |
| 749 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N';  | 
                                                        |
| 747 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1;  | 
                                                        |
| 748 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY';  | 
                                                        |
| 749 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N';  | 
                                                        |
| 750 | 750 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body);  | 
                                                        
| 751 | 751 | // Change content information (attachment)  | 
                                                        
| 752 | - if(count($files))  | 
                                                        |
| 752 | + if (count($files))  | 
                                                        |
| 753 | 753 |  			{ | 
                                                        
| 754 | - foreach($files as $key => $val)  | 
                                                        |
| 754 | + foreach ($files as $key => $val)  | 
                                                        |
| 755 | 755 |  				{ | 
                                                        
| 756 | -					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); | 
                                                        |
| 757 | -					$obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); | 
                                                        |
| 758 | -					$obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); | 
                                                        |
| 756 | +					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); | 
                                                        |
| 757 | +					$obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); | 
                                                        |
| 758 | +					$obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); | 
                                                        |
| 759 | 759 | }  | 
                                                        
| 760 | 760 | }  | 
                                                        
| 761 | 761 | |
| 762 | 762 |  			$output = executeQuery('document.insertDocument', $obj); | 
                                                        
| 763 | 763 | |
| 764 | - if($output->toBool() && $obj->tags)  | 
                                                        |
| 764 | + if ($output->toBool() && $obj->tags)  | 
                                                        |
| 765 | 765 |  			{ | 
                                                        
| 766 | -				$tag_list = explode(',',$obj->tags); | 
                                                        |
| 766 | +				$tag_list = explode(',', $obj->tags); | 
                                                        |
| 767 | 767 | $tag_count = count($tag_list);  | 
                                                        
| 768 | - for($i=0;$i<$tag_count;$i++)  | 
                                                        |
| 768 | + for ($i = 0; $i < $tag_count; $i++)  | 
                                                        |
| 769 | 769 |  				{ | 
                                                        
| 770 | 770 | $args = new stdClass;  | 
                                                        
| 771 | 771 | $args->tag_srl = getNextSequence();  | 
                                                        
@@ -773,17 +773,17 @@ discard block  | 
                                                    ||
| 773 | 773 | $args->document_srl = $obj->document_srl;  | 
                                                        
| 774 | 774 | $args->tag = trim($tag_list[$i]);  | 
                                                        
| 775 | 775 | $args->regdate = $obj->regdate;  | 
                                                        
| 776 | - if(!$args->tag) continue;  | 
                                                        |
| 776 | + if (!$args->tag) continue;  | 
                                                        |
| 777 | 777 |  					$output = executeQuery('tag.insertTag', $args); | 
                                                        
| 778 | 778 | }  | 
                                                        
| 779 | 779 | |
| 780 | 780 | }  | 
                                                        
| 781 | 781 | // Add extra variables  | 
                                                        
| 782 | - if(count($extra_vars))  | 
                                                        |
| 782 | + if (count($extra_vars))  | 
                                                        |
| 783 | 783 |  			{ | 
                                                        
| 784 | - foreach($extra_vars as $key => $val)  | 
                                                        |
| 784 | + foreach ($extra_vars as $key => $val)  | 
                                                        |
| 785 | 785 |  				{ | 
                                                        
| 786 | - if(!$val->value) continue;  | 
                                                        |
| 786 | + if (!$val->value) continue;  | 
                                                        |
| 787 | 787 | unset($e_args);  | 
                                                        
| 788 | 788 | $e_args->module_srl = $module_srl;  | 
                                                        
| 789 | 789 | $e_args->document_srl = $obj->document_srl;  | 
                                                        
@@ -792,7 +792,7 @@ discard block  | 
                                                    ||
| 792 | 792 | $e_args->lang_code = $val->lang_code;  | 
                                                        
| 793 | 793 | $e_args->eid = $val->eid;  | 
                                                        
| 794 | 794 | // Create a key for extra vars if not exists (except vars for title and content)  | 
                                                        
| 795 | -					if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) | 
                                                        |
| 795 | +					if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) | 
                                                        |
| 796 | 796 |  					{ | 
                                                        
| 797 | 797 | unset($ek_args);  | 
                                                        
| 798 | 798 | $ek_args->module_srl = $module_srl;  | 
                                                        
@@ -816,9 +816,9 @@ discard block  | 
                                                    ||
| 816 | 816 | |
| 817 | 817 | fclose($f);  | 
                                                        
| 818 | 818 | // Sync category counts  | 
                                                        
| 819 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);  | 
                                                        |
| 819 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);  | 
                                                        |
| 820 | 820 | |
| 821 | - return $idx-1;  | 
                                                        |
| 821 | + return $idx - 1;  | 
                                                        |
| 822 | 822 | }  | 
                                                        
| 823 | 823 | |
| 824 | 824 | /**  | 
                                                        
@@ -834,17 +834,17 @@ discard block  | 
                                                    ||
| 834 | 834 | $buff = null;  | 
                                                        
| 835 | 835 | $cnt = 0;  | 
                                                        
| 836 | 836 | |
| 837 | - while(!feof($fp))  | 
                                                        |
| 837 | + while (!feof($fp))  | 
                                                        |
| 838 | 838 |  		{ | 
                                                        
| 839 | 839 | $str = fgets($fp, 1024);  | 
                                                        
| 840 | 840 | // If </trackbacks> is, break  | 
                                                        
| 841 | - if(trim($str) == '</trackbacks>') break;  | 
                                                        |
| 841 | + if (trim($str) == '</trackbacks>') break;  | 
                                                        |
| 842 | 842 | // If <trackback>, start importing  | 
                                                        
| 843 | - if(trim($str) == '<trackback>') $started = true;  | 
                                                        |
| 843 | + if (trim($str) == '<trackback>') $started = true;  | 
                                                        |
| 844 | 844 | |
| 845 | - if($started) $buff .= $str;  | 
                                                        |
| 845 | + if ($started) $buff .= $str;  | 
                                                        |
| 846 | 846 | // If </trackback>, insert to the DB  | 
                                                        
| 847 | - if(trim($str) == '</trackback>')  | 
                                                        |
| 847 | + if (trim($str) == '</trackback>')  | 
                                                        |
| 848 | 848 |  			{ | 
                                                        
| 849 | 849 | $xmlDoc = $this->oXmlParser->parse($buff);  | 
                                                        
| 850 | 850 | |
@@ -858,9 +858,9 @@ discard block  | 
                                                    ||
| 858 | 858 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body);  | 
                                                        
| 859 | 859 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body);  | 
                                                        
| 860 | 860 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body);  | 
                                                        
| 861 | - $obj->list_order = -1*$obj->trackback_srl;  | 
                                                        |
| 861 | + $obj->list_order = -1 * $obj->trackback_srl;  | 
                                                        |
| 862 | 862 |  				$output = executeQuery('trackback.insertTrackback', $obj); | 
                                                        
| 863 | - if($output->toBool()) $cnt++;  | 
                                                        |
| 863 | + if ($output->toBool()) $cnt++;  | 
                                                        |
| 864 | 864 | |
| 865 | 865 | $buff = null;  | 
                                                        
| 866 | 866 | $started = false;  | 
                                                        
@@ -884,13 +884,13 @@ discard block  | 
                                                    ||
| 884 | 884 | |
| 885 | 885 | $sequences = array();  | 
                                                        
| 886 | 886 | |
| 887 | - while(!feof($fp))  | 
                                                        |
| 887 | + while (!feof($fp))  | 
                                                        |
| 888 | 888 |  		{ | 
                                                        
| 889 | 889 | $str = fgets($fp, 1024);  | 
                                                        
| 890 | 890 | // If </comments> is, break  | 
                                                        
| 891 | - if(trim($str) == '</comments>') break;  | 
                                                        |
| 891 | + if (trim($str) == '</comments>') break;  | 
                                                        |
| 892 | 892 | // If <comment> is, start importing  | 
                                                        
| 893 | - if(trim($str) == '<comment>')  | 
                                                        |
| 893 | + if (trim($str) == '<comment>')  | 
                                                        |
| 894 | 894 |  			{ | 
                                                        
| 895 | 895 | $started = true;  | 
                                                        
| 896 | 896 | $obj = new stdClass;  | 
                                                        
@@ -898,15 +898,15 @@ discard block  | 
                                                    ||
| 898 | 898 | $files = array();  | 
                                                        
| 899 | 899 | }  | 
                                                        
| 900 | 900 | // If <attaches is, start importing attachments  | 
                                                        
| 901 | - if(substr($str,0,9) == '<attaches')  | 
                                                        |
| 901 | + if (substr($str, 0, 9) == '<attaches')  | 
                                                        |
| 902 | 902 |  			{ | 
                                                        
| 903 | 903 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files);  | 
                                                        
| 904 | 904 | continue;  | 
                                                        
| 905 | 905 | }  | 
                                                        
| 906 | 906 | |
| 907 | - if($started) $buff .= $str;  | 
                                                        |
| 907 | + if ($started) $buff .= $str;  | 
                                                        |
| 908 | 908 | // If </comment> is, insert to the DB  | 
                                                        
| 909 | - if(trim($str) == '</comment>')  | 
                                                        |
| 909 | + if (trim($str) == '</comment>')  | 
                                                        |
| 910 | 910 |  			{ | 
                                                        
| 911 | 911 | $xmlDoc = $this->oXmlParser->parse($buff);  | 
                                                        
| 912 | 912 | |
@@ -916,35 +916,35 @@ discard block  | 
                                                    ||
| 916 | 916 | |
| 917 | 917 | $obj->module_srl = $module_srl;  | 
                                                        
| 918 | 918 | |
| 919 | - if($parent) $obj->parent_srl = $sequences[$parent];  | 
                                                        |
| 919 | + if ($parent) $obj->parent_srl = $sequences[$parent];  | 
                                                        |
| 920 | 920 | else $obj->parent_srl = 0;  | 
                                                        
| 921 | 921 | |
| 922 | 922 | $obj->document_srl = $document_srl;  | 
                                                        
| 923 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N';  | 
                                                        |
| 924 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N';  | 
                                                        |
| 923 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N';  | 
                                                        |
| 924 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N';  | 
                                                        |
| 925 | 925 | $obj->content = base64_decode($xmlDoc->comment->content->body);  | 
                                                        
| 926 | 926 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body);  | 
                                                        
| 927 | 927 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body);  | 
                                                        
| 928 | 928 | $obj->password = base64_decode($xmlDoc->comment->password->body);  | 
                                                        
| 929 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body);  | 
                                                        |
| 929 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body);  | 
                                                        |
| 930 | 930 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body);  | 
                                                        
| 931 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 931 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name;  | 
                                                        |
| 932 | 932 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body);  | 
                                                        
| 933 | 933 | $obj->member_srl = 0;  | 
                                                        
| 934 | 934 | $obj->email_address = base64_decode($xmlDoc->comment->email->body);  | 
                                                        
| 935 | 935 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body);  | 
                                                        
| 936 | 936 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body);  | 
                                                        
| 937 | 937 | $obj->last_update = base64_decode($xmlDoc->comment->update->body);  | 
                                                        
| 938 | - if(!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 938 | + if (!$obj->last_update) $obj->last_update = $obj->regdate;  | 
                                                        |
| 939 | 939 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body);  | 
                                                        
| 940 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body);  | 
                                                        |
| 941 | - $obj->list_order = $obj->comment_srl*-1;  | 
                                                        |
| 940 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body);  | 
                                                        |
| 941 | + $obj->list_order = $obj->comment_srl * -1;  | 
                                                        |
| 942 | 942 | // Change content information (attachment)  | 
                                                        
| 943 | - if(count($files))  | 
                                                        |
| 943 | + if (count($files))  | 
                                                        |
| 944 | 944 |  				{ | 
                                                        
| 945 | - foreach($files as $key => $val)  | 
                                                        |
| 945 | + foreach ($files as $key => $val)  | 
                                                        |
| 946 | 946 |  					{ | 
                                                        
| 947 | -						$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); | 
                                                        |
| 947 | +						$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); | 
                                                        |
| 948 | 948 | }  | 
                                                        
| 949 | 949 | }  | 
                                                        
| 950 | 950 | // Comment list first  | 
                                                        
@@ -954,7 +954,7 @@ discard block  | 
                                                    ||
| 954 | 954 | $list_args->module_srl = $obj->module_srl;  | 
                                                        
| 955 | 955 | $list_args->regdate = $obj->regdate;  | 
                                                        
| 956 | 956 | // Set data directly if parent comment doesn't exist  | 
                                                        
| 957 | - if(!$obj->parent_srl)  | 
                                                        |
| 957 | + if (!$obj->parent_srl)  | 
                                                        |
| 958 | 958 |  				{ | 
                                                        
| 959 | 959 | $list_args->head = $list_args->arrange = $obj->comment_srl;  | 
                                                        
| 960 | 960 | $list_args->depth = 0;  | 
                                                        
@@ -966,25 +966,25 @@ discard block  | 
                                                    ||
| 966 | 966 | $parent_args->comment_srl = $obj->parent_srl;  | 
                                                        
| 967 | 967 |  					$parent_output = executeQuery('comment.getCommentListItem', $parent_args); | 
                                                        
| 968 | 968 | // Return if parent comment doesn't exist  | 
                                                        
| 969 | - if(!$parent_output->toBool() || !$parent_output->data) continue;  | 
                                                        |
| 969 | + if (!$parent_output->toBool() || !$parent_output->data) continue;  | 
                                                        |
| 970 | 970 | $parent = $parent_output->data;  | 
                                                        
| 971 | 971 | |
| 972 | 972 | $list_args->head = $parent->head;  | 
                                                        
| 973 | - $list_args->depth = $parent->depth+1;  | 
                                                        |
| 974 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl;  | 
                                                        |
| 973 | + $list_args->depth = $parent->depth + 1;  | 
                                                        |
| 974 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl;  | 
                                                        |
| 975 | 975 | else  | 
                                                        
| 976 | 976 |  					{ | 
                                                        
| 977 | 977 | $list_args->arrange = $parent->arrange;  | 
                                                        
| 978 | 978 |  						$output = executeQuery('comment.updateCommentListArrange', $list_args); | 
                                                        
| 979 | - if(!$output->toBool()) return $output;  | 
                                                        |
| 979 | + if (!$output->toBool()) return $output;  | 
                                                        |
| 980 | 980 | }  | 
                                                        
| 981 | 981 | }  | 
                                                        
| 982 | 982 | |
| 983 | 983 |  				$output = executeQuery('comment.insertCommentList', $list_args); | 
                                                        
| 984 | - if($output->toBool())  | 
                                                        |
| 984 | + if ($output->toBool())  | 
                                                        |
| 985 | 985 |  				{ | 
                                                        
| 986 | 986 |  					$output = executeQuery('comment.insertComment', $obj); | 
                                                        
| 987 | - if($output->toBool()) $cnt++;  | 
                                                        |
| 987 | + if ($output->toBool()) $cnt++;  | 
                                                        |
| 988 | 988 | }  | 
                                                        
| 989 | 989 | |
| 990 | 990 | $buff = null;  | 
                                                        
@@ -1010,13 +1010,13 @@ discard block  | 
                                                    ||
| 1010 | 1010 | $buff = null;  | 
                                                        
| 1011 | 1011 | |
| 1012 | 1012 | $file_obj = new stdClass;  | 
                                                        
| 1013 | - while(!feof($fp))  | 
                                                        |
| 1013 | + while (!feof($fp))  | 
                                                        |
| 1014 | 1014 |  		{ | 
                                                        
| 1015 | 1015 | $str = trim(fgets($fp, 1024));  | 
                                                        
| 1016 | 1016 | // If it ends with </attaches>, break  | 
                                                        
| 1017 | - if(trim($str) == '</attaches>') break;  | 
                                                        |
| 1017 | + if (trim($str) == '</attaches>') break;  | 
                                                        |
| 1018 | 1018 | // If it starts with <attach>, collect attachments  | 
                                                        
| 1019 | - if(trim($str) == '<attach>')  | 
                                                        |
| 1019 | + if (trim($str) == '<attach>')  | 
                                                        |
| 1020 | 1020 |  			{ | 
                                                        
| 1021 | 1021 | $file_obj->file_srl = getNextSequence();  | 
                                                        
| 1022 | 1022 | $file_obj->upload_target_srl = $upload_target_srl;  | 
                                                        
@@ -1026,26 +1026,26 @@ discard block  | 
                                                    ||
| 1026 | 1026 | $buff = null;  | 
                                                        
| 1027 | 1027 | // If it starts with <file>, handle the attachement in xml file  | 
                                                        
| 1028 | 1028 | }  | 
                                                        
| 1029 | - else if(trim($str) == '<file>')  | 
                                                        |
| 1029 | + else if (trim($str) == '<file>')  | 
                                                        |
| 1030 | 1030 |  			{ | 
                                                        
| 1031 | 1031 | $file_obj->file = $this->saveTemporaryFile($fp);  | 
                                                        
| 1032 | 1032 | continue;  | 
                                                        
| 1033 | 1033 | }  | 
                                                        
| 1034 | 1034 | |
| 1035 | - if($started) $buff .= $str;  | 
                                                        |
| 1035 | + if ($started) $buff .= $str;  | 
                                                        |
| 1036 | 1036 | // If it ends with </attach>, handle attachements  | 
                                                        
| 1037 | - if(trim($str) == '</attach>')  | 
                                                        |
| 1037 | + if (trim($str) == '</attach>')  | 
                                                        |
| 1038 | 1038 |  			{ | 
                                                        
| 1039 | 1039 | $xmlDoc = $this->oXmlParser->parse($buff.$str);  | 
                                                        
| 1040 | 1040 | |
| 1041 | 1041 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body);  | 
                                                        
| 1042 | 1042 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body);  | 
                                                        
| 1043 | 1043 | |
| 1044 | - if(!$file_obj->file)  | 
                                                        |
| 1044 | + if (!$file_obj->file)  | 
                                                        |
| 1045 | 1045 |  				{ | 
                                                        
| 1046 | 1046 | $url = base64_decode($xmlDoc->attach->url->body);  | 
                                                        
| 1047 | 1047 | $path = base64_decode($xmlDoc->attach->path->body);  | 
                                                        
| 1048 | - if($path && file_exists($path)) $file_obj->file = $path;  | 
                                                        |
| 1048 | + if ($path && file_exists($path)) $file_obj->file = $path;  | 
                                                        |
| 1049 | 1049 | else  | 
                                                        
| 1050 | 1050 |  					{ | 
                                                        
| 1051 | 1051 | $file_obj->file = $this->getTmpFilename();  | 
                                                        
@@ -1053,11 +1053,11 @@ discard block  | 
                                                    ||
| 1053 | 1053 | }  | 
                                                        
| 1054 | 1054 | }  | 
                                                        
| 1055 | 1055 | |
| 1056 | - if(file_exists($file_obj->file))  | 
                                                        |
| 1056 | + if (file_exists($file_obj->file))  | 
                                                        |
| 1057 | 1057 |  				{ | 
                                                        
| 1058 | 1058 | $random = new Password();  | 
                                                        
| 1059 | 1059 | // Set upload path by checking if the attachement is an image or other kind of file  | 
                                                        
| 1060 | -					if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) | 
                                                        |
| 1060 | +					if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) | 
                                                        |
| 1061 | 1061 |  					{ | 
                                                        
| 1062 | 1062 | // Immediately remove the direct file if it has any kind of extensions for hacking  | 
                                                        
| 1063 | 1063 |  						$file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); | 
                                                        
@@ -1065,14 +1065,14 @@ discard block  | 
                                                    ||
| 1065 | 1065 | |
| 1066 | 1066 |  						$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        
| 1067 | 1067 | |
| 1068 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1);  | 
                                                        |
| 1068 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1);  | 
                                                        |
| 1069 | 1069 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext;  | 
                                                        
| 1070 | 1070 | $filename = $path.$_filename;  | 
                                                        
| 1071 | 1071 | |
| 1072 | 1072 | $idx = 1;  | 
                                                        
| 1073 | - while(file_exists($filename))  | 
                                                        |
| 1073 | + while (file_exists($filename))  | 
                                                        |
| 1074 | 1074 |  						{ | 
                                                        
| 1075 | -							$filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); | 
                                                        |
| 1075 | +							$filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); | 
                                                        |
| 1076 | 1076 | $idx++;  | 
                                                        
| 1077 | 1077 | }  | 
                                                        
| 1078 | 1078 | |
@@ -1080,14 +1080,14 @@ discard block  | 
                                                    ||
| 1080 | 1080 | }  | 
                                                        
| 1081 | 1081 | else  | 
                                                        
| 1082 | 1082 |  					{ | 
                                                        
| 1083 | -						$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); | 
                                                        |
| 1083 | +						$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); | 
                                                        |
| 1084 | 1084 | $filename = $path.$random->createSecureSalt(32, 'hex');  | 
                                                        
| 1085 | 1085 | $file_obj->direct_download = 'N';  | 
                                                        
| 1086 | 1086 | }  | 
                                                        
| 1087 | 1087 | // Create a directory  | 
                                                        
| 1088 | - if(!FileHandler::makeDir($path)) continue;  | 
                                                        |
| 1088 | + if (!FileHandler::makeDir($path)) continue;  | 
                                                        |
| 1089 | 1089 | |
| 1090 | -					if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) | 
                                                        |
| 1090 | +					if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) | 
                                                        |
| 1091 | 1091 |  					{ | 
                                                        
| 1092 | 1092 | FileHandler::rename($file_obj->file, $filename);  | 
                                                        
| 1093 | 1093 | }  | 
                                                        
@@ -1098,7 +1098,7 @@ discard block  | 
                                                    ||
| 1098 | 1098 | |
| 1099 | 1099 | // Insert the file to the DB  | 
                                                        
| 1100 | 1100 | unset($file_obj->file);  | 
                                                        
| 1101 | - if(file_exists($filename))  | 
                                                        |
| 1101 | + if (file_exists($filename))  | 
                                                        |
| 1102 | 1102 |  					{ | 
                                                        
| 1103 | 1103 | $file_obj->uploaded_filename = $filename;  | 
                                                        
| 1104 | 1104 | $file_obj->file_size = filesize($filename);  | 
                                                        
@@ -1108,13 +1108,13 @@ discard block  | 
                                                    ||
| 1108 | 1108 | $file_obj->isvalid = 'Y';  | 
                                                        
| 1109 | 1109 |  						$output = executeQuery('file.insertFile', $file_obj); | 
                                                        
| 1110 | 1110 | |
| 1111 | - if($output->toBool())  | 
                                                        |
| 1111 | + if ($output->toBool())  | 
                                                        |
| 1112 | 1112 |  						{ | 
                                                        
| 1113 | 1113 | $uploaded_count++;  | 
                                                        
| 1114 | 1114 | $tmp_obj = null;  | 
                                                        
| 1115 | 1115 | $tmp_obj->source_filename = $file_obj->source_filename;  | 
                                                        
| 1116 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename;  | 
                                                        |
| 1117 | -							else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); | 
                                                        |
| 1116 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename;  | 
                                                        |
| 1117 | +							else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); | 
                                                        |
| 1118 | 1118 | }  | 
                                                        
| 1119 | 1119 | }  | 
                                                        
| 1120 | 1120 | }  | 
                                                        
@@ -1131,8 +1131,8 @@ discard block  | 
                                                    ||
| 1131 | 1131 |  	{ | 
                                                        
| 1132 | 1132 | $path = "./files/cache/importer";  | 
                                                        
| 1133 | 1133 | FileHandler::makeDir($path);  | 
                                                        
| 1134 | -		$filename = sprintf("%s/%d", $path, rand(11111111,99999999)); | 
                                                        |
| 1135 | - if(file_exists($filename)) $filename .= rand(111,999);  | 
                                                        |
| 1134 | +		$filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); | 
                                                        |
| 1135 | + if (file_exists($filename)) $filename .= rand(111, 999);  | 
                                                        |
| 1136 | 1136 | return $filename;  | 
                                                        
| 1137 | 1137 | }  | 
                                                        
| 1138 | 1138 | |
@@ -1147,14 +1147,14 @@ discard block  | 
                                                    ||
| 1147 | 1147 | $f = fopen($temp_filename, "w");  | 
                                                        
| 1148 | 1148 | |
| 1149 | 1149 | $buff = '';  | 
                                                        
| 1150 | - while(!feof($fp))  | 
                                                        |
| 1150 | + while (!feof($fp))  | 
                                                        |
| 1151 | 1151 |  		{ | 
                                                        
| 1152 | 1152 | $str = trim(fgets($fp, 1024));  | 
                                                        
| 1153 | - if(trim($str) == '</file>') break;  | 
                                                        |
| 1153 | + if (trim($str) == '</file>') break;  | 
                                                        |
| 1154 | 1154 | |
| 1155 | 1155 | $buff .= $str;  | 
                                                        
| 1156 | 1156 | |
| 1157 | - if(substr($buff,-7)=='</buff>')  | 
                                                        |
| 1157 | + if (substr($buff, -7) == '</buff>')  | 
                                                        |
| 1158 | 1158 |  			{ | 
                                                        
| 1159 | 1159 | fwrite($f, base64_decode(substr($buff, 6, -7)));  | 
                                                        
| 1160 | 1160 | $buff = '';  | 
                                                        
@@ -1173,23 +1173,23 @@ discard block  | 
                                                    ||
| 1173 | 1173 | function importExtraVars($fp)  | 
                                                        
| 1174 | 1174 |  	{ | 
                                                        
| 1175 | 1175 | $buff = null;  | 
                                                        
| 1176 | - while(!feof($fp))  | 
                                                        |
| 1176 | + while (!feof($fp))  | 
                                                        |
| 1177 | 1177 |  		{ | 
                                                        
| 1178 | 1178 | $buff .= $str = trim(fgets($fp, 1024));  | 
                                                        
| 1179 | - if(trim($str) == '</extra_vars>') break;  | 
                                                        |
| 1179 | + if (trim($str) == '</extra_vars>') break;  | 
                                                        |
| 1180 | 1180 | }  | 
                                                        
| 1181 | - if(!$buff) return array();  | 
                                                        |
| 1181 | + if (!$buff) return array();  | 
                                                        |
| 1182 | 1182 | |
| 1183 | 1183 | $buff = '<extra_vars>'.$buff;  | 
                                                        
| 1184 | 1184 | $oXmlParser = new XmlParser();  | 
                                                        
| 1185 | 1185 | $xmlDoc = $this->oXmlParser->parse($buff);  | 
                                                        
| 1186 | - if(!count($xmlDoc->extra_vars->key)) return array();  | 
                                                        |
| 1186 | + if (!count($xmlDoc->extra_vars->key)) return array();  | 
                                                        |
| 1187 | 1187 | |
| 1188 | 1188 | $index = 1;  | 
                                                        
| 1189 | - foreach($xmlDoc->extra_vars->key as $k => $v)  | 
                                                        |
| 1189 | + foreach ($xmlDoc->extra_vars->key as $k => $v)  | 
                                                        |
| 1190 | 1190 |  		{ | 
                                                        
| 1191 | 1191 | unset($vobj);  | 
                                                        
| 1192 | - if($v->var_idx)  | 
                                                        |
| 1192 | + if ($v->var_idx)  | 
                                                        |
| 1193 | 1193 |  			{ | 
                                                        
| 1194 | 1194 | $vobj->var_idx = base64_decode($v->var_idx->body);  | 
                                                        
| 1195 | 1195 | $vobj->lang_code = base64_decode($v->lang_code->body);  | 
                                                        
@@ -1197,7 +1197,7 @@ discard block  | 
                                                    ||
| 1197 | 1197 | $vobj->eid = base64_decode($v->eid->body);  | 
                                                        
| 1198 | 1198 | |
| 1199 | 1199 | }  | 
                                                        
| 1200 | - else if($v->body)  | 
                                                        |
| 1200 | + else if ($v->body)  | 
                                                        |
| 1201 | 1201 |  			{ | 
                                                        
| 1202 | 1202 | $vobj->var_idx = $index;  | 
                                                        
| 1203 | 1203 | $vobj->lang_code = Context::getLangType();  |