@@ -29,24 +29,24 @@ 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 | - if($output->error != '0') $this->stop($output->message); |
|
| 49 | + if ($output->error != '0') $this->stop($output->message); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -61,26 +61,26 @@ discard block |
||
| 61 | 61 | $callback = Context::get('callback'); |
| 62 | 62 | $module_srl = $this->module_srl; |
| 63 | 63 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 64 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 64 | + if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 65 | 65 | |
| 66 | 66 | // Exit a session if there is neither upload permission nor information |
| 67 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 67 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 68 | 68 | // Extract from session information if upload_target_srl is not specified |
| 69 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 69 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 70 | 70 | // Create if upload_target_srl is not defined in the session information |
| 71 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 71 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 72 | 72 | // Delete and then attempt to re-upload if file_srl is requested |
| 73 | 73 | $file_srl = Context::get('file_srl'); |
| 74 | - if($file_srl) $this->deleteFile($file_srl); |
|
| 74 | + if ($file_srl) $this->deleteFile($file_srl); |
|
| 75 | 75 | |
| 76 | 76 | $file_info = Context::get('Filedata'); |
| 77 | 77 | // An error appears if not a normally uploaded file |
| 78 | - if(is_uploaded_file($file_info['tmp_name'])) { |
|
| 78 | + if (is_uploaded_file($file_info['tmp_name'])) { |
|
| 79 | 79 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 80 | - Context::set('uploaded_fileinfo',$output); |
|
| 80 | + Context::set('uploaded_fileinfo', $output); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - Context::set('layout','none'); |
|
| 83 | + Context::set('layout', 'none'); |
|
| 84 | 84 | |
| 85 | 85 | $this->setTemplatePath($this->module_path.'tpl'); |
| 86 | 86 | $this->setTemplateFile('iframe'); |
@@ -97,24 +97,24 @@ discard block |
||
| 97 | 97 | $width = Context::get('width'); |
| 98 | 98 | $height = Context::get('height'); |
| 99 | 99 | |
| 100 | - if(!$file_srl || !$width) |
|
| 100 | + if (!$file_srl || !$width) |
|
| 101 | 101 | { |
| 102 | - return new Object(-1,'msg_invalid_request'); |
|
| 102 | + return new Object(-1, 'msg_invalid_request'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $oFileModel = getModel('file'); |
| 106 | 106 | $fileInfo = $oFileModel->getFile($file_srl); |
| 107 | - if(!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 107 | + if (!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 108 | 108 | { |
| 109 | - return new Object(-1,'msg_invalid_request'); |
|
| 109 | + return new Object(-1, 'msg_invalid_request'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $source_src = $fileInfo->uploaded_filename; |
| 113 | - $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
|
| 113 | + $output_src = $source_src.'.resized'.strrchr($source_src, '.'); |
|
| 114 | 114 | |
| 115 | - if(!$height) $height = $width-1; |
|
| 115 | + if (!$height) $height = $width - 1; |
|
| 116 | 116 | |
| 117 | - if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
|
| 117 | + if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio')) |
|
| 118 | 118 | { |
| 119 | 119 | $output = new stdClass(); |
| 120 | 120 | $output->info = getimagesize($output_src); |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | else |
| 124 | 124 | { |
| 125 | - return new Object(-1,'msg_invalid_request'); |
|
| 125 | + return new Object(-1, 'msg_invalid_request'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $this->add('resized_info',$output); |
|
| 128 | + $this->add('resized_info', $output); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $oFileModel = getModel('file'); |
| 165 | 165 | |
| 166 | - if(isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
| 166 | + if (isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
| 167 | 167 | |
| 168 | 168 | $file_srl = Context::get('file_srl'); |
| 169 | 169 | $sid = Context::get('sid'); |
@@ -172,26 +172,26 @@ discard block |
||
| 172 | 172 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
| 173 | 173 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 174 | 174 | // If the requested file information is incorrect, an error that file cannot be found appears |
| 175 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
| 175 | + if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found'); |
|
| 176 | 176 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
| 177 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
| 177 | + if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download'); |
|
| 178 | 178 | // File name |
| 179 | 179 | $filename = $file_obj->source_filename; |
| 180 | 180 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
| 181 | 181 | // Not allow the file outlink |
| 182 | - if($file_module_config->allow_outlink == 'N') |
|
| 182 | + if ($file_module_config->allow_outlink == 'N') |
|
| 183 | 183 | { |
| 184 | 184 | // Handles extension to allow outlink |
| 185 | - if($file_module_config->allow_outlink_format) |
|
| 185 | + if ($file_module_config->allow_outlink_format) |
|
| 186 | 186 | { |
| 187 | 187 | $allow_outlink_format_array = array(); |
| 188 | 188 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
| 189 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 189 | + if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 190 | 190 | |
| 191 | - foreach($allow_outlink_format_array as $val) |
|
| 191 | + foreach ($allow_outlink_format_array as $val) |
|
| 192 | 192 | { |
| 193 | 193 | $val = trim($val); |
| 194 | - if(preg_match("/\.{$val}$/i", $filename)) |
|
| 194 | + if (preg_match("/\.{$val}$/i", $filename)) |
|
| 195 | 195 | { |
| 196 | 196 | $file_module_config->allow_outlink = 'Y'; |
| 197 | 197 | break; |
@@ -199,21 +199,21 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | // Sites that outlink is allowed |
| 202 | - if($file_module_config->allow_outlink != 'Y') |
|
| 202 | + if ($file_module_config->allow_outlink != 'Y') |
|
| 203 | 203 | { |
| 204 | 204 | $referer = parse_url($_SERVER["HTTP_REFERER"]); |
| 205 | - if($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 205 | + if ($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 206 | 206 | { |
| 207 | - if($file_module_config->allow_outlink_site) |
|
| 207 | + if ($file_module_config->allow_outlink_site) |
|
| 208 | 208 | { |
| 209 | 209 | $allow_outlink_site_array = array(); |
| 210 | 210 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
| 211 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 211 | + if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 212 | 212 | |
| 213 | - foreach($allow_outlink_site_array as $val) |
|
| 213 | + foreach ($allow_outlink_site_array as $val) |
|
| 214 | 214 | { |
| 215 | 215 | $site = parse_url(trim($val)); |
| 216 | - if($site['host'] == $referer['host']) |
|
| 216 | + if ($site['host'] == $referer['host']) |
|
| 217 | 217 | { |
| 218 | 218 | $file_module_config->allow_outlink = 'Y'; |
| 219 | 219 | break; |
@@ -223,49 +223,49 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | else $file_module_config->allow_outlink = 'Y'; |
| 225 | 225 | } |
| 226 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 226 | + if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // Check if a permission for file download is granted |
| 230 | 230 | $downloadGrantCount = 0; |
| 231 | - if(is_array($file_module_config->download_grant)) |
|
| 231 | + if (is_array($file_module_config->download_grant)) |
|
| 232 | 232 | { |
| 233 | - foreach($file_module_config->download_grant AS $value) |
|
| 234 | - if($value) $downloadGrantCount++; |
|
| 233 | + foreach ($file_module_config->download_grant AS $value) |
|
| 234 | + if ($value) $downloadGrantCount++; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
| 237 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
| 238 | 238 | { |
| 239 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 239 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 240 | 240 | $logged_info = Context::get('logged_info'); |
| 241 | - if($logged_info->is_admin != 'Y') |
|
| 241 | + if ($logged_info->is_admin != 'Y') |
|
| 242 | 242 | { |
| 243 | - $oModuleModel =& getModel('module'); |
|
| 243 | + $oModuleModel = & getModel('module'); |
|
| 244 | 244 | $columnList = array('module_srl', 'site_srl'); |
| 245 | 245 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList); |
| 246 | 246 | |
| 247 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 247 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 248 | 248 | { |
| 249 | - $oMemberModel =& getModel('member'); |
|
| 249 | + $oMemberModel = & getModel('member'); |
|
| 250 | 250 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
| 251 | 251 | |
| 252 | 252 | $is_permitted = false; |
| 253 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
| 253 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
| 254 | 254 | { |
| 255 | 255 | $group_srl = $file_module_config->download_grant[$i]; |
| 256 | - if($member_groups[$group_srl]) |
|
| 256 | + if ($member_groups[$group_srl]) |
|
| 257 | 257 | { |
| 258 | 258 | $is_permitted = true; |
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 262 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | // Call a trigger (before) |
| 267 | 267 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
| 268 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 268 | + if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download'); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | // 다운로드 후 (가상) |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $random = new Password(); |
| 280 | 280 | $file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex'); |
| 281 | - header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key)); |
|
| 281 | + header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key)); |
|
| 282 | 282 | Context::close(); |
| 283 | 283 | exit(); |
| 284 | 284 | |
@@ -289,18 +289,18 @@ discard block |
||
| 289 | 289 | $oFileModel = getModel('file'); |
| 290 | 290 | $file_srl = Context::get('file_srl'); |
| 291 | 291 | $file_key = Context::get('file_key'); |
| 292 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 292 | + if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 293 | 293 | |
| 294 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 294 | + if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 295 | 295 | else $session_key = '__XE_FILE_KEY__'; |
| 296 | 296 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
| 297 | 297 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 298 | 298 | |
| 299 | 299 | $uploaded_filename = $file_obj->uploaded_filename; |
| 300 | 300 | |
| 301 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 301 | + if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 302 | 302 | |
| 303 | - if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 303 | + if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 304 | 304 | { |
| 305 | 305 | unset($_SESSION[$session_key][$file_srl]); |
| 306 | 306 | return $this->stop('msg_invalid_request'); |
@@ -308,28 +308,28 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $file_size = $file_obj->file_size; |
| 310 | 310 | $filename = $file_obj->source_filename; |
| 311 | - if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 311 | + if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 312 | 312 | { |
| 313 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
| 313 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
| 314 | 314 | } |
| 315 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 315 | + elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 316 | 316 | { |
| 317 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
| 317 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
| 318 | 318 | } |
| 319 | 319 | // Filename encoding for browsers that do not support RFC 5987 |
| 320 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 320 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 321 | 321 | { |
| 322 | 322 | $filename = rawurlencode($filename); |
| 323 | - $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
|
| 323 | + $filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"'; |
|
| 324 | 324 | } |
| 325 | 325 | else |
| 326 | 326 | { |
| 327 | - $filename_param = 'filename="' . $filename . '"'; |
|
| 327 | + $filename_param = 'filename="'.$filename.'"'; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if($is_android) |
|
| 330 | + if ($is_android) |
|
| 331 | 331 | { |
| 332 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 332 | + if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | unset($_SESSION[$session_key][$file_srl]); |
@@ -337,21 +337,21 @@ discard block |
||
| 337 | 337 | Context::close(); |
| 338 | 338 | |
| 339 | 339 | $fp = fopen($uploaded_filename, 'rb'); |
| 340 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
| 340 | + if (!$fp) return $this->stop('msg_file_not_found'); |
|
| 341 | 341 | |
| 342 | 342 | header("Cache-Control: "); |
| 343 | 343 | header("Pragma: "); |
| 344 | 344 | header("Content-Type: application/octet-stream"); |
| 345 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 345 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 346 | 346 | |
| 347 | - header("Content-Length: " .(string)($file_size)); |
|
| 348 | - header('Content-Disposition: attachment; ' . $filename_param); |
|
| 347 | + header("Content-Length: ".(string) ($file_size)); |
|
| 348 | + header('Content-Disposition: attachment; '.$filename_param); |
|
| 349 | 349 | header("Content-Transfer-Encoding: binary\n"); |
| 350 | 350 | |
| 351 | 351 | // if file size is lager than 10MB, use fread function (#18675748) |
| 352 | - if(filesize($uploaded_filename) > 1024 * 1024) |
|
| 352 | + if (filesize($uploaded_filename) > 1024 * 1024) |
|
| 353 | 353 | { |
| 354 | - while(!feof($fp)) echo fread($fp, 1024); |
|
| 354 | + while (!feof($fp)) echo fread($fp, 1024); |
|
| 355 | 355 | fclose($fp); |
| 356 | 356 | } |
| 357 | 357 | else |
@@ -373,36 +373,36 @@ discard block |
||
| 373 | 373 | $editor_sequence = Context::get('editor_sequence'); |
| 374 | 374 | $file_srl = Context::get('file_srl'); |
| 375 | 375 | $file_srls = Context::get('file_srls'); |
| 376 | - if($file_srls) $file_srl = $file_srls; |
|
| 376 | + if ($file_srls) $file_srl = $file_srls; |
|
| 377 | 377 | // Exit a session if there is neither upload permission nor information |
| 378 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 378 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 379 | 379 | |
| 380 | 380 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
| 381 | 381 | |
| 382 | 382 | $logged_info = Context::get('logged_info'); |
| 383 | 383 | $oFileModel = getModel('file'); |
| 384 | 384 | |
| 385 | - $srls = explode(',',$file_srl); |
|
| 386 | - if(!count($srls)) return; |
|
| 385 | + $srls = explode(',', $file_srl); |
|
| 386 | + if (!count($srls)) return; |
|
| 387 | 387 | |
| 388 | - for($i=0;$i<count($srls);$i++) |
|
| 388 | + for ($i = 0; $i < count($srls); $i++) |
|
| 389 | 389 | { |
| 390 | - $srl = (int)$srls[$i]; |
|
| 391 | - if(!$srl) continue; |
|
| 390 | + $srl = (int) $srls[$i]; |
|
| 391 | + if (!$srl) continue; |
|
| 392 | 392 | |
| 393 | 393 | $args = new stdClass; |
| 394 | 394 | $args->file_srl = $srl; |
| 395 | 395 | $output = executeQuery('file.getFile', $args); |
| 396 | - if(!$output->toBool()) continue; |
|
| 396 | + if (!$output->toBool()) continue; |
|
| 397 | 397 | |
| 398 | 398 | $file_info = $output->data; |
| 399 | - if(!$file_info) continue; |
|
| 399 | + if (!$file_info) continue; |
|
| 400 | 400 | |
| 401 | 401 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 402 | 402 | |
| 403 | - if(!$file_grant->is_deletable) continue; |
|
| 403 | + if (!$file_grant->is_deletable) continue; |
|
| 404 | 404 | |
| 405 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 405 | + if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | |
@@ -413,23 +413,23 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | function procFileGetList() |
| 415 | 415 | { |
| 416 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 416 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 417 | 417 | $fileSrls = Context::get('file_srls'); |
| 418 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 418 | + if ($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 419 | 419 | |
| 420 | 420 | global $lang; |
| 421 | - if(count($fileSrlList) > 0) |
|
| 421 | + if (count($fileSrlList) > 0) |
|
| 422 | 422 | { |
| 423 | 423 | $oFileModel = getModel('file'); |
| 424 | 424 | $fileList = $oFileModel->getFile($fileSrlList); |
| 425 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
| 425 | + if (!is_array($fileList)) $fileList = array($fileList); |
|
| 426 | 426 | |
| 427 | - if(is_array($fileList)) |
|
| 427 | + if (is_array($fileList)) |
|
| 428 | 428 | { |
| 429 | - foreach($fileList AS $key=>$value) |
|
| 429 | + foreach ($fileList AS $key=>$value) |
|
| 430 | 430 | { |
| 431 | 431 | $value->human_file_size = FileHandler::filesize($value->file_size); |
| 432 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
| 432 | + if ($value->isvalid == 'Y') $value->validName = $lang->is_valid; |
|
| 433 | 433 | else $value->validName = $lang->is_stand_by; |
| 434 | 434 | } |
| 435 | 435 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | function triggerCheckAttached(&$obj) |
| 452 | 452 | { |
| 453 | 453 | $document_srl = $obj->document_srl; |
| 454 | - if(!$document_srl) return new Object(); |
|
| 454 | + if (!$document_srl) return new Object(); |
|
| 455 | 455 | // Get numbers of attachments |
| 456 | 456 | $oFileModel = getModel('file'); |
| 457 | 457 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -468,10 +468,10 @@ discard block |
||
| 468 | 468 | function triggerAttachFiles(&$obj) |
| 469 | 469 | { |
| 470 | 470 | $document_srl = $obj->document_srl; |
| 471 | - if(!$document_srl) return new Object(); |
|
| 471 | + if (!$document_srl) return new Object(); |
|
| 472 | 472 | |
| 473 | 473 | $output = $this->setFilesValid($document_srl); |
| 474 | - if(!$output->toBool()) return $output; |
|
| 474 | + if (!$output->toBool()) return $output; |
|
| 475 | 475 | |
| 476 | 476 | return new Object(); |
| 477 | 477 | } |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | function triggerDeleteAttached(&$obj) |
| 486 | 486 | { |
| 487 | 487 | $document_srl = $obj->document_srl; |
| 488 | - if(!$document_srl) return new Object(); |
|
| 488 | + if (!$document_srl) return new Object(); |
|
| 489 | 489 | |
| 490 | 490 | $output = $this->deleteFiles($document_srl); |
| 491 | 491 | return $output; |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | function triggerCommentCheckAttached(&$obj) |
| 501 | 501 | { |
| 502 | 502 | $comment_srl = $obj->comment_srl; |
| 503 | - if(!$comment_srl) return new Object(); |
|
| 503 | + if (!$comment_srl) return new Object(); |
|
| 504 | 504 | // Get numbers of attachments |
| 505 | 505 | $oFileModel = getModel('file'); |
| 506 | 506 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | { |
| 519 | 519 | $comment_srl = $obj->comment_srl; |
| 520 | 520 | $uploaded_count = $obj->uploaded_count; |
| 521 | - if(!$comment_srl || !$uploaded_count) return new Object(); |
|
| 521 | + if (!$comment_srl || !$uploaded_count) return new Object(); |
|
| 522 | 522 | |
| 523 | 523 | $output = $this->setFilesValid($comment_srl); |
| 524 | - if(!$output->toBool()) return $output; |
|
| 524 | + if (!$output->toBool()) return $output; |
|
| 525 | 525 | |
| 526 | 526 | return new Object(); |
| 527 | 527 | } |
@@ -535,9 +535,9 @@ discard block |
||
| 535 | 535 | function triggerCommentDeleteAttached(&$obj) |
| 536 | 536 | { |
| 537 | 537 | $comment_srl = $obj->comment_srl; |
| 538 | - if(!$comment_srl) return new Object(); |
|
| 538 | + if (!$comment_srl) return new Object(); |
|
| 539 | 539 | |
| 540 | - if($obj->isMoveToTrash) return new Object(); |
|
| 540 | + if ($obj->isMoveToTrash) return new Object(); |
|
| 541 | 541 | |
| 542 | 542 | $output = $this->deleteFiles($comment_srl); |
| 543 | 543 | return $output; |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | function triggerDeleteModuleFiles(&$obj) |
| 553 | 553 | { |
| 554 | 554 | $module_srl = $obj->module_srl; |
| 555 | - if(!$module_srl) return new Object(); |
|
| 555 | + if (!$module_srl) return new Object(); |
|
| 556 | 556 | |
| 557 | 557 | $oFileController = getAdminController('file'); |
| 558 | 558 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -565,9 +565,9 @@ discard block |
||
| 565 | 565 | * @param int $upload_target_srl |
| 566 | 566 | * @return void |
| 567 | 567 | */ |
| 568 | - function setUploadInfo($editor_sequence, $upload_target_srl=0) |
|
| 568 | + function setUploadInfo($editor_sequence, $upload_target_srl = 0) |
|
| 569 | 569 | { |
| 570 | - if(!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 570 | + if (!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 571 | 571 | { |
| 572 | 572 | $_SESSION['upload_info'][$editor_sequence] = new stdClass(); |
| 573 | 573 | } |
@@ -627,36 +627,36 @@ discard block |
||
| 627 | 627 | $trigger_obj->module_srl = $module_srl; |
| 628 | 628 | $trigger_obj->upload_target_srl = $upload_target_srl; |
| 629 | 629 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
| 630 | - if(!$output->toBool()) return $output; |
|
| 630 | + if (!$output->toBool()) return $output; |
|
| 631 | 631 | |
| 632 | 632 | // A workaround for Firefox upload bug |
| 633 | - if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 633 | + if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 634 | 634 | { |
| 635 | 635 | $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - if(!$manual_insert) |
|
| 638 | + if (!$manual_insert) |
|
| 639 | 639 | { |
| 640 | 640 | // Get the file configurations |
| 641 | 641 | $logged_info = Context::get('logged_info'); |
| 642 | - if($logged_info->is_admin != 'Y') |
|
| 642 | + if ($logged_info->is_admin != 'Y') |
|
| 643 | 643 | { |
| 644 | 644 | $oFileModel = getModel('file'); |
| 645 | 645 | $config = $oFileModel->getFileConfig($module_srl); |
| 646 | 646 | |
| 647 | 647 | // check file type |
| 648 | - if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 648 | + if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 649 | 649 | { |
| 650 | 650 | $filetypes = explode(';', $config->allowed_filetypes); |
| 651 | 651 | $ext = array(); |
| 652 | - foreach($filetypes as $item) { |
|
| 652 | + foreach ($filetypes as $item) { |
|
| 653 | 653 | $item = explode('.', $item); |
| 654 | 654 | $ext[] = strtolower($item[1]); |
| 655 | 655 | } |
| 656 | 656 | $uploaded_ext = explode('.', $file_info['name']); |
| 657 | 657 | $uploaded_ext = strtolower(array_pop($uploaded_ext)); |
| 658 | 658 | |
| 659 | - if(!in_array($uploaded_ext, $ext)) |
|
| 659 | + if (!in_array($uploaded_ext, $ext)) |
|
| 660 | 660 | { |
| 661 | 661 | return $this->stop('msg_not_allowed_filetype'); |
| 662 | 662 | } |
@@ -665,63 +665,63 @@ discard block |
||
| 665 | 665 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
| 666 | 666 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
| 667 | 667 | // An error appears if file size exceeds a limit |
| 668 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 668 | + if ($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 669 | 669 | // Get total file size of all attachements (from DB) |
| 670 | 670 | $size_args = new stdClass; |
| 671 | 671 | $size_args->upload_target_srl = $upload_target_srl; |
| 672 | 672 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
| 673 | - $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 674 | - if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 673 | + $attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 674 | + if ($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // https://github.com/xpressengine/xe-core/issues/1713 |
| 679 | - $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); |
|
| 679 | + $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); |
|
| 680 | 680 | $file_info['name'] = removeHackTag($file_info['name']); |
| 681 | - $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); |
|
| 681 | + $file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); |
|
| 682 | 682 | |
| 683 | 683 | // Get random number generator |
| 684 | 684 | $random = new Password(); |
| 685 | 685 | |
| 686 | 686 | // Set upload path by checking if the attachement is an image or other kinds of file |
| 687 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 687 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 688 | 688 | { |
| 689 | - $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
|
| 689 | + $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 690 | 690 | |
| 691 | 691 | // special character to '_' |
| 692 | 692 | // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter |
| 693 | - $ext = substr(strrchr($file_info['name'],'.'),1); |
|
| 693 | + $ext = substr(strrchr($file_info['name'], '.'), 1); |
|
| 694 | 694 | //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); |
| 695 | 695 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
| 696 | 696 | $filename = $path.$_filename; |
| 697 | 697 | $idx = 1; |
| 698 | - while(file_exists($filename)) |
|
| 698 | + while (file_exists($filename)) |
|
| 699 | 699 | { |
| 700 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename); |
|
| 700 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
| 701 | 701 | $idx++; |
| 702 | 702 | } |
| 703 | 703 | $direct_download = 'Y'; |
| 704 | 704 | } |
| 705 | 705 | else |
| 706 | 706 | { |
| 707 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
| 707 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 708 | 708 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 709 | 709 | $direct_download = 'N'; |
| 710 | 710 | } |
| 711 | 711 | // Create a directory |
| 712 | - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); |
|
| 712 | + if (!FileHandler::makeDir($path)) return new Object(-1, 'msg_not_permitted_create'); |
|
| 713 | 713 | |
| 714 | 714 | // Check uploaded file |
| 715 | - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error'); |
|
| 715 | + if (!checkUploadedFile($file_info['tmp_name'])) return new Object(-1, 'msg_file_upload_error'); |
|
| 716 | 716 | |
| 717 | 717 | // Get random number generator |
| 718 | 718 | $random = new Password(); |
| 719 | 719 | |
| 720 | 720 | // Move the file |
| 721 | - if($manual_insert) |
|
| 721 | + if ($manual_insert) |
|
| 722 | 722 | { |
| 723 | 723 | @copy($file_info['tmp_name'], $filename); |
| 724 | - if(!file_exists($filename)) |
|
| 724 | + if (!file_exists($filename)) |
|
| 725 | 725 | { |
| 726 | 726 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 727 | 727 | @copy($file_info['tmp_name'], $filename); |
@@ -729,10 +729,10 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | else |
| 731 | 731 | { |
| 732 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 732 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 733 | 733 | { |
| 734 | 734 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 735 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); |
|
| 735 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1, 'msg_file_upload_error'); |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | // Get member information |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | $args->sid = $random->createSecureSalt(32, 'hex'); |
| 754 | 754 | |
| 755 | 755 | $output = executeQuery('file.insertFile', $args); |
| 756 | - if(!$output->toBool()) return $output; |
|
| 756 | + if (!$output->toBool()) return $output; |
|
| 757 | 757 | // Call a trigger (after) |
| 758 | 758 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
| 759 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 759 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 760 | 760 | |
| 761 | 761 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
| 762 | 762 | |
@@ -799,18 +799,18 @@ discard block |
||
| 799 | 799 | */ |
| 800 | 800 | function deleteFile($file_srl) |
| 801 | 801 | { |
| 802 | - if(!$file_srl) return; |
|
| 802 | + if (!$file_srl) return; |
|
| 803 | 803 | |
| 804 | 804 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
| 805 | - if(!count($srls)) return; |
|
| 805 | + if (!count($srls)) return; |
|
| 806 | 806 | |
| 807 | 807 | $oDocumentController = getController('document'); |
| 808 | 808 | $documentSrlList = array(); |
| 809 | 809 | |
| 810 | - foreach($srls as $srl) |
|
| 810 | + foreach ($srls as $srl) |
|
| 811 | 811 | { |
| 812 | - $srl = (int)$srl; |
|
| 813 | - if(!$srl) |
|
| 812 | + $srl = (int) $srl; |
|
| 813 | + if (!$srl) |
|
| 814 | 814 | { |
| 815 | 815 | continue; |
| 816 | 816 | } |
@@ -819,14 +819,14 @@ discard block |
||
| 819 | 819 | $args->file_srl = $srl; |
| 820 | 820 | $output = executeQuery('file.getFile', $args); |
| 821 | 821 | |
| 822 | - if(!$output->toBool() || !$output->data) |
|
| 822 | + if (!$output->toBool() || !$output->data) |
|
| 823 | 823 | { |
| 824 | 824 | continue; |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | $file_info = $output->data; |
| 828 | 828 | |
| 829 | - if($file_info->upload_target_srl) |
|
| 829 | + if ($file_info->upload_target_srl) |
|
| 830 | 830 | { |
| 831 | 831 | $documentSrlList[] = $file_info->upload_target_srl; |
| 832 | 832 | } |
@@ -837,15 +837,15 @@ discard block |
||
| 837 | 837 | // Call a trigger (before) |
| 838 | 838 | $trigger_obj = $output->data; |
| 839 | 839 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
| 840 | - if(!$output->toBool()) return $output; |
|
| 840 | + if (!$output->toBool()) return $output; |
|
| 841 | 841 | |
| 842 | 842 | // Remove from the DB |
| 843 | 843 | $output = executeQuery('file.deleteFile', $args); |
| 844 | - if(!$output->toBool()) return $output; |
|
| 844 | + if (!$output->toBool()) return $output; |
|
| 845 | 845 | |
| 846 | 846 | // Call a trigger (after) |
| 847 | 847 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
| 848 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 848 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 849 | 849 | |
| 850 | 850 | // If successfully deleted, remove the file |
| 851 | 851 | FileHandler::removeFile($uploaded_filename); |
@@ -869,28 +869,28 @@ discard block |
||
| 869 | 869 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
| 870 | 870 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
| 871 | 871 | // Success returned if no attachement exists |
| 872 | - if(!is_array($file_list)||!count($file_list)) return new Object(); |
|
| 872 | + if (!is_array($file_list) || !count($file_list)) return new Object(); |
|
| 873 | 873 | |
| 874 | 874 | // Delete the file |
| 875 | 875 | $path = array(); |
| 876 | 876 | $file_count = count($file_list); |
| 877 | - for($i=0;$i<$file_count;$i++) |
|
| 877 | + for ($i = 0; $i < $file_count; $i++) |
|
| 878 | 878 | { |
| 879 | 879 | $this->deleteFile($file_list[$i]->file_srl); |
| 880 | 880 | |
| 881 | 881 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
| 882 | 882 | $path_info = pathinfo($uploaded_filename); |
| 883 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 883 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | // Remove from the DB |
| 887 | 887 | $args = new stdClass(); |
| 888 | 888 | $args->upload_target_srl = $upload_target_srl; |
| 889 | 889 | $output = executeQuery('file.deleteFiles', $args); |
| 890 | - if(!$output->toBool()) return $output; |
|
| 890 | + if (!$output->toBool()) return $output; |
|
| 891 | 891 | |
| 892 | 892 | // Remove a file directory of the document |
| 893 | - for($i=0, $c=count($path); $i<$c; $i++) |
|
| 893 | + for ($i = 0, $c = count($path); $i < $c; $i++) |
|
| 894 | 894 | { |
| 895 | 895 | FileHandler::removeBlankDir($path[$i]); |
| 896 | 896 | } |
@@ -908,23 +908,23 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | function moveFile($source_srl, $target_module_srl, $target_srl) |
| 910 | 910 | { |
| 911 | - if($source_srl == $target_srl) return; |
|
| 911 | + if ($source_srl == $target_srl) return; |
|
| 912 | 912 | |
| 913 | 913 | $oFileModel = getModel('file'); |
| 914 | 914 | $file_list = $oFileModel->getFiles($source_srl); |
| 915 | - if(!$file_list) return; |
|
| 915 | + if (!$file_list) return; |
|
| 916 | 916 | |
| 917 | 917 | $file_count = count($file_list); |
| 918 | 918 | |
| 919 | - for($i=0;$i<$file_count;$i++) |
|
| 919 | + for ($i = 0; $i < $file_count; $i++) |
|
| 920 | 920 | { |
| 921 | 921 | unset($file_info); |
| 922 | 922 | $file_info = $file_list[$i]; |
| 923 | 923 | $old_file = $file_info->uploaded_filename; |
| 924 | 924 | // Determine the file path by checking if the file is an image or other kinds |
| 925 | - if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) |
|
| 925 | + if (preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) |
|
| 926 | 926 | { |
| 927 | - $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
|
| 927 | + $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl); |
|
| 928 | 928 | $new_file = $path.$file_info->source_filename; |
| 929 | 929 | } |
| 930 | 930 | else |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
| 935 | 935 | } |
| 936 | 936 | // Pass if a target document to move is same |
| 937 | - if($old_file == $new_file) continue; |
|
| 937 | + if ($old_file == $new_file) continue; |
|
| 938 | 938 | // Create a directory |
| 939 | 939 | FileHandler::makeDir($path); |
| 940 | 940 | // Move the file |
@@ -954,18 +954,18 @@ discard block |
||
| 954 | 954 | $vars = Context::getRequestVars(); |
| 955 | 955 | $logged_info = Context::get('logged_info'); |
| 956 | 956 | |
| 957 | - if(!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
| 957 | + if (!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
| 958 | 958 | |
| 959 | 959 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
| 960 | 960 | |
| 961 | 961 | $oFileModel = getModel('file'); |
| 962 | 962 | $file_info = $oFileModel->getFile($vars->file_srl); |
| 963 | 963 | |
| 964 | - if(!$file_info) return new Object(-1, 'msg_not_founded'); |
|
| 964 | + if (!$file_info) return new Object(-1, 'msg_not_founded'); |
|
| 965 | 965 | |
| 966 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
| 966 | + if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
| 967 | 967 | |
| 968 | - $args = new stdClass(); |
|
| 968 | + $args = new stdClass(); |
|
| 969 | 969 | $args->file_srl = $vars->file_srl; |
| 970 | 970 | $args->upload_target_srl = $upload_target_srl; |
| 971 | 971 | |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | |
| 975 | 975 | $args->cover_image = 'N'; |
| 976 | 976 | $output = executeQuery('file.updateClearCoverImage', $args); |
| 977 | - if(!$output->toBool()) |
|
| 977 | + if (!$output->toBool()) |
|
| 978 | 978 | { |
| 979 | 979 | $oDB->rollback(); |
| 980 | 980 | return $output; |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | |
| 983 | 983 | $args->cover_image = 'Y'; |
| 984 | 984 | $output = executeQuery('file.updateCoverImage', $args); |
| 985 | - if(!$output->toBool()) |
|
| 985 | + if (!$output->toBool()) |
|
| 986 | 986 | { |
| 987 | 987 | $oDB->rollback(); |
| 988 | 988 | return $output; |
@@ -1014,9 +1014,9 @@ discard block |
||
| 1014 | 1014 | $fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl); |
| 1015 | 1015 | |
| 1016 | 1016 | $oModuleController = getController('module'); |
| 1017 | - if(is_array($obj->moduleSrlList)) |
|
| 1017 | + if (is_array($obj->moduleSrlList)) |
|
| 1018 | 1018 | { |
| 1019 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1019 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1020 | 1020 | { |
| 1021 | 1021 | $oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig); |
| 1022 | 1022 | } |
@@ -29,24 +29,36 @@ 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'])) { |
|
| 33 | + exit(); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | // Basic variables setting |
| 35 | 37 | $oFileModel = getModel('file'); |
| 36 | 38 | $editor_sequence = Context::get('editor_sequence'); |
| 37 | 39 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 38 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 40 | + if(!$upload_target_srl) { |
|
| 41 | + $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 42 | + } |
|
| 39 | 43 | $module_srl = $this->module_srl; |
| 40 | 44 | // Exit a session if there is neither upload permission nor information |
| 41 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 45 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 46 | + exit(); |
|
| 47 | + } |
|
| 42 | 48 | // 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; |
|
| 49 | + if(!$upload_target_srl) { |
|
| 50 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 51 | + } |
|
| 44 | 52 | // 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(); |
|
| 53 | + if(!$upload_target_srl) { |
|
| 54 | + $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 55 | + } |
|
| 46 | 56 | |
| 47 | 57 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 48 | 58 | Context::setResponseMethod('JSON'); |
| 49 | - if($output->error != '0') $this->stop($output->message); |
|
| 59 | + if($output->error != '0') { |
|
| 60 | + $this->stop($output->message); |
|
| 61 | + } |
|
| 50 | 62 | } |
| 51 | 63 | |
| 52 | 64 | /** |
@@ -61,17 +73,27 @@ discard block |
||
| 61 | 73 | $callback = Context::get('callback'); |
| 62 | 74 | $module_srl = $this->module_srl; |
| 63 | 75 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 64 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 76 | + if(!$upload_target_srl) { |
|
| 77 | + $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 78 | + } |
|
| 65 | 79 | |
| 66 | 80 | // Exit a session if there is neither upload permission nor information |
| 67 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 81 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 82 | + exit(); |
|
| 83 | + } |
|
| 68 | 84 | // Extract from session information if upload_target_srl is not specified |
| 69 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 85 | + if(!$upload_target_srl) { |
|
| 86 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 87 | + } |
|
| 70 | 88 | // Create if upload_target_srl is not defined in the session information |
| 71 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 89 | + if(!$upload_target_srl) { |
|
| 90 | + $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 91 | + } |
|
| 72 | 92 | // Delete and then attempt to re-upload if file_srl is requested |
| 73 | 93 | $file_srl = Context::get('file_srl'); |
| 74 | - if($file_srl) $this->deleteFile($file_srl); |
|
| 94 | + if($file_srl) { |
|
| 95 | + $this->deleteFile($file_srl); |
|
| 96 | + } |
|
| 75 | 97 | |
| 76 | 98 | $file_info = Context::get('Filedata'); |
| 77 | 99 | // An error appears if not a normally uploaded file |
@@ -112,15 +134,16 @@ discard block |
||
| 112 | 134 | $source_src = $fileInfo->uploaded_filename; |
| 113 | 135 | $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
| 114 | 136 | |
| 115 | - if(!$height) $height = $width-1; |
|
| 137 | + if(!$height) { |
|
| 138 | + $height = $width-1; |
|
| 139 | + } |
|
| 116 | 140 | |
| 117 | 141 | if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
| 118 | 142 | { |
| 119 | 143 | $output = new stdClass(); |
| 120 | 144 | $output->info = getimagesize($output_src); |
| 121 | 145 | $output->src = $output_src; |
| 122 | - } |
|
| 123 | - else |
|
| 146 | + } else |
|
| 124 | 147 | { |
| 125 | 148 | return new Object(-1,'msg_invalid_request'); |
| 126 | 149 | } |
@@ -163,7 +186,9 @@ discard block |
||
| 163 | 186 | { |
| 164 | 187 | $oFileModel = getModel('file'); |
| 165 | 188 | |
| 166 | - if(isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
| 189 | + if(isset($this->grant->access) && $this->grant->access !== true) { |
|
| 190 | + return new Object(-1, 'msg_not_permitted'); |
|
| 191 | + } |
|
| 167 | 192 | |
| 168 | 193 | $file_srl = Context::get('file_srl'); |
| 169 | 194 | $sid = Context::get('sid'); |
@@ -172,9 +197,13 @@ discard block |
||
| 172 | 197 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
| 173 | 198 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 174 | 199 | // If the requested file information is incorrect, an error that file cannot be found appears |
| 175 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
| 200 | + if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) { |
|
| 201 | + return $this->stop('msg_file_not_found'); |
|
| 202 | + } |
|
| 176 | 203 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
| 177 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
| 204 | + if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') { |
|
| 205 | + return $this->stop('msg_not_permitted_download'); |
|
| 206 | + } |
|
| 178 | 207 | // File name |
| 179 | 208 | $filename = $file_obj->source_filename; |
| 180 | 209 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
@@ -186,7 +215,9 @@ discard block |
||
| 186 | 215 | { |
| 187 | 216 | $allow_outlink_format_array = array(); |
| 188 | 217 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
| 189 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 218 | + if(!is_array($allow_outlink_format_array)) { |
|
| 219 | + $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 220 | + } |
|
| 190 | 221 | |
| 191 | 222 | foreach($allow_outlink_format_array as $val) |
| 192 | 223 | { |
@@ -208,7 +239,9 @@ discard block |
||
| 208 | 239 | { |
| 209 | 240 | $allow_outlink_site_array = array(); |
| 210 | 241 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
| 211 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 242 | + if(!is_array($allow_outlink_site_array)) { |
|
| 243 | + $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 244 | + } |
|
| 212 | 245 | |
| 213 | 246 | foreach($allow_outlink_site_array as $val) |
| 214 | 247 | { |
@@ -220,23 +253,29 @@ discard block |
||
| 220 | 253 | } |
| 221 | 254 | } |
| 222 | 255 | } |
| 256 | + } else { |
|
| 257 | + $file_module_config->allow_outlink = 'Y'; |
|
| 223 | 258 | } |
| 224 | - else $file_module_config->allow_outlink = 'Y'; |
|
| 225 | 259 | } |
| 226 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 260 | + if($file_module_config->allow_outlink != 'Y') { |
|
| 261 | + return $this->stop('msg_not_allowed_outlink'); |
|
| 262 | + } |
|
| 227 | 263 | } |
| 228 | 264 | |
| 229 | 265 | // Check if a permission for file download is granted |
| 230 | 266 | $downloadGrantCount = 0; |
| 231 | 267 | if(is_array($file_module_config->download_grant)) |
| 232 | 268 | { |
| 233 | - foreach($file_module_config->download_grant AS $value) |
|
| 234 | - if($value) $downloadGrantCount++; |
|
| 269 | + foreach($file_module_config->download_grant AS $value) { |
|
| 270 | + if($value) $downloadGrantCount++; |
|
| 271 | + } |
|
| 235 | 272 | } |
| 236 | 273 | |
| 237 | 274 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
| 238 | 275 | { |
| 239 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 276 | + if(!Context::get('is_logged')) { |
|
| 277 | + return $this->stop('msg_not_permitted_download'); |
|
| 278 | + } |
|
| 240 | 279 | $logged_info = Context::get('logged_info'); |
| 241 | 280 | if($logged_info->is_admin != 'Y') |
| 242 | 281 | { |
@@ -259,13 +298,17 @@ discard block |
||
| 259 | 298 | break; |
| 260 | 299 | } |
| 261 | 300 | } |
| 262 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 301 | + if(!$is_permitted) { |
|
| 302 | + return $this->stop('msg_not_permitted_download'); |
|
| 303 | + } |
|
| 263 | 304 | } |
| 264 | 305 | } |
| 265 | 306 | } |
| 266 | 307 | // Call a trigger (before) |
| 267 | 308 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
| 268 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 309 | + if(!$output->toBool()) { |
|
| 310 | + return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 311 | + } |
|
| 269 | 312 | |
| 270 | 313 | |
| 271 | 314 | // 다운로드 후 (가상) |
@@ -289,16 +332,23 @@ discard block |
||
| 289 | 332 | $oFileModel = getModel('file'); |
| 290 | 333 | $file_srl = Context::get('file_srl'); |
| 291 | 334 | $file_key = Context::get('file_key'); |
| 292 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 335 | + if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) { |
|
| 336 | + $is_android = true; |
|
| 337 | + } |
|
| 293 | 338 | |
| 294 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 295 | - else $session_key = '__XE_FILE_KEY__'; |
|
| 339 | + if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) { |
|
| 340 | + $session_key = '__XE_FILE_KEY_AND__'; |
|
| 341 | + } else { |
|
| 342 | + $session_key = '__XE_FILE_KEY__'; |
|
| 343 | + } |
|
| 296 | 344 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
| 297 | 345 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 298 | 346 | |
| 299 | 347 | $uploaded_filename = $file_obj->uploaded_filename; |
| 300 | 348 | |
| 301 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 349 | + if(!file_exists($uploaded_filename)) { |
|
| 350 | + return $this->stop('msg_file_not_found'); |
|
| 351 | + } |
|
| 302 | 352 | |
| 303 | 353 | if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
| 304 | 354 | { |
@@ -311,8 +361,7 @@ discard block |
||
| 311 | 361 | if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
| 312 | 362 | { |
| 313 | 363 | $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
| 314 | - } |
|
| 315 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 364 | + } elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 316 | 365 | { |
| 317 | 366 | $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
| 318 | 367 | } |
@@ -321,15 +370,16 @@ discard block |
||
| 321 | 370 | { |
| 322 | 371 | $filename = rawurlencode($filename); |
| 323 | 372 | $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
| 324 | - } |
|
| 325 | - else |
|
| 373 | + } else |
|
| 326 | 374 | { |
| 327 | 375 | $filename_param = 'filename="' . $filename . '"'; |
| 328 | 376 | } |
| 329 | 377 | |
| 330 | 378 | if($is_android) |
| 331 | 379 | { |
| 332 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 380 | + if($_SESSION['__XE_FILE_KEY__'][$file_srl]) { |
|
| 381 | + $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 382 | + } |
|
| 333 | 383 | } |
| 334 | 384 | |
| 335 | 385 | unset($_SESSION[$session_key][$file_srl]); |
@@ -337,7 +387,9 @@ discard block |
||
| 337 | 387 | Context::close(); |
| 338 | 388 | |
| 339 | 389 | $fp = fopen($uploaded_filename, 'rb'); |
| 340 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
| 390 | + if(!$fp) { |
|
| 391 | + return $this->stop('msg_file_not_found'); |
|
| 392 | + } |
|
| 341 | 393 | |
| 342 | 394 | header("Cache-Control: "); |
| 343 | 395 | header("Pragma: "); |
@@ -351,10 +403,11 @@ discard block |
||
| 351 | 403 | // if file size is lager than 10MB, use fread function (#18675748) |
| 352 | 404 | if(filesize($uploaded_filename) > 1024 * 1024) |
| 353 | 405 | { |
| 354 | - while(!feof($fp)) echo fread($fp, 1024); |
|
| 406 | + while(!feof($fp)) { |
|
| 407 | + echo fread($fp, 1024); |
|
| 408 | + } |
|
| 355 | 409 | fclose($fp); |
| 356 | - } |
|
| 357 | - else |
|
| 410 | + } else |
|
| 358 | 411 | { |
| 359 | 412 | fpassthru($fp); |
| 360 | 413 | } |
@@ -373,9 +426,13 @@ discard block |
||
| 373 | 426 | $editor_sequence = Context::get('editor_sequence'); |
| 374 | 427 | $file_srl = Context::get('file_srl'); |
| 375 | 428 | $file_srls = Context::get('file_srls'); |
| 376 | - if($file_srls) $file_srl = $file_srls; |
|
| 429 | + if($file_srls) { |
|
| 430 | + $file_srl = $file_srls; |
|
| 431 | + } |
|
| 377 | 432 | // Exit a session if there is neither upload permission nor information |
| 378 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 433 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 434 | + exit(); |
|
| 435 | + } |
|
| 379 | 436 | |
| 380 | 437 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
| 381 | 438 | |
@@ -383,26 +440,38 @@ discard block |
||
| 383 | 440 | $oFileModel = getModel('file'); |
| 384 | 441 | |
| 385 | 442 | $srls = explode(',',$file_srl); |
| 386 | - if(!count($srls)) return; |
|
| 443 | + if(!count($srls)) { |
|
| 444 | + return; |
|
| 445 | + } |
|
| 387 | 446 | |
| 388 | 447 | for($i=0;$i<count($srls);$i++) |
| 389 | 448 | { |
| 390 | 449 | $srl = (int)$srls[$i]; |
| 391 | - if(!$srl) continue; |
|
| 450 | + if(!$srl) { |
|
| 451 | + continue; |
|
| 452 | + } |
|
| 392 | 453 | |
| 393 | 454 | $args = new stdClass; |
| 394 | 455 | $args->file_srl = $srl; |
| 395 | 456 | $output = executeQuery('file.getFile', $args); |
| 396 | - if(!$output->toBool()) continue; |
|
| 457 | + if(!$output->toBool()) { |
|
| 458 | + continue; |
|
| 459 | + } |
|
| 397 | 460 | |
| 398 | 461 | $file_info = $output->data; |
| 399 | - if(!$file_info) continue; |
|
| 462 | + if(!$file_info) { |
|
| 463 | + continue; |
|
| 464 | + } |
|
| 400 | 465 | |
| 401 | 466 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 402 | 467 | |
| 403 | - if(!$file_grant->is_deletable) continue; |
|
| 468 | + if(!$file_grant->is_deletable) { |
|
| 469 | + continue; |
|
| 470 | + } |
|
| 404 | 471 | |
| 405 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 472 | + if($upload_target_srl && $file_srl) { |
|
| 473 | + $output = $this->deleteFile($file_srl); |
|
| 474 | + } |
|
| 406 | 475 | } |
| 407 | 476 | } |
| 408 | 477 | |
@@ -413,28 +482,36 @@ discard block |
||
| 413 | 482 | */ |
| 414 | 483 | function procFileGetList() |
| 415 | 484 | { |
| 416 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 485 | + if(!Context::get('is_logged')) { |
|
| 486 | + return new Object(-1,'msg_not_permitted'); |
|
| 487 | + } |
|
| 417 | 488 | $fileSrls = Context::get('file_srls'); |
| 418 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 489 | + if($fileSrls) { |
|
| 490 | + $fileSrlList = explode(',', $fileSrls); |
|
| 491 | + } |
|
| 419 | 492 | |
| 420 | 493 | global $lang; |
| 421 | 494 | if(count($fileSrlList) > 0) |
| 422 | 495 | { |
| 423 | 496 | $oFileModel = getModel('file'); |
| 424 | 497 | $fileList = $oFileModel->getFile($fileSrlList); |
| 425 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
| 498 | + if(!is_array($fileList)) { |
|
| 499 | + $fileList = array($fileList); |
|
| 500 | + } |
|
| 426 | 501 | |
| 427 | 502 | if(is_array($fileList)) |
| 428 | 503 | { |
| 429 | 504 | foreach($fileList AS $key=>$value) |
| 430 | 505 | { |
| 431 | 506 | $value->human_file_size = FileHandler::filesize($value->file_size); |
| 432 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
| 433 | - else $value->validName = $lang->is_stand_by; |
|
| 507 | + if($value->isvalid=='Y') { |
|
| 508 | + $value->validName = $lang->is_valid; |
|
| 509 | + } else { |
|
| 510 | + $value->validName = $lang->is_stand_by; |
|
| 511 | + } |
|
| 434 | 512 | } |
| 435 | 513 | } |
| 436 | - } |
|
| 437 | - else |
|
| 514 | + } else |
|
| 438 | 515 | { |
| 439 | 516 | $fileList = array(); |
| 440 | 517 | $this->setMessage($lang->no_files); |
@@ -451,7 +528,9 @@ discard block |
||
| 451 | 528 | function triggerCheckAttached(&$obj) |
| 452 | 529 | { |
| 453 | 530 | $document_srl = $obj->document_srl; |
| 454 | - if(!$document_srl) return new Object(); |
|
| 531 | + if(!$document_srl) { |
|
| 532 | + return new Object(); |
|
| 533 | + } |
|
| 455 | 534 | // Get numbers of attachments |
| 456 | 535 | $oFileModel = getModel('file'); |
| 457 | 536 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -468,10 +547,14 @@ discard block |
||
| 468 | 547 | function triggerAttachFiles(&$obj) |
| 469 | 548 | { |
| 470 | 549 | $document_srl = $obj->document_srl; |
| 471 | - if(!$document_srl) return new Object(); |
|
| 550 | + if(!$document_srl) { |
|
| 551 | + return new Object(); |
|
| 552 | + } |
|
| 472 | 553 | |
| 473 | 554 | $output = $this->setFilesValid($document_srl); |
| 474 | - if(!$output->toBool()) return $output; |
|
| 555 | + if(!$output->toBool()) { |
|
| 556 | + return $output; |
|
| 557 | + } |
|
| 475 | 558 | |
| 476 | 559 | return new Object(); |
| 477 | 560 | } |
@@ -485,7 +568,9 @@ discard block |
||
| 485 | 568 | function triggerDeleteAttached(&$obj) |
| 486 | 569 | { |
| 487 | 570 | $document_srl = $obj->document_srl; |
| 488 | - if(!$document_srl) return new Object(); |
|
| 571 | + if(!$document_srl) { |
|
| 572 | + return new Object(); |
|
| 573 | + } |
|
| 489 | 574 | |
| 490 | 575 | $output = $this->deleteFiles($document_srl); |
| 491 | 576 | return $output; |
@@ -500,7 +585,9 @@ discard block |
||
| 500 | 585 | function triggerCommentCheckAttached(&$obj) |
| 501 | 586 | { |
| 502 | 587 | $comment_srl = $obj->comment_srl; |
| 503 | - if(!$comment_srl) return new Object(); |
|
| 588 | + if(!$comment_srl) { |
|
| 589 | + return new Object(); |
|
| 590 | + } |
|
| 504 | 591 | // Get numbers of attachments |
| 505 | 592 | $oFileModel = getModel('file'); |
| 506 | 593 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -518,10 +605,14 @@ discard block |
||
| 518 | 605 | { |
| 519 | 606 | $comment_srl = $obj->comment_srl; |
| 520 | 607 | $uploaded_count = $obj->uploaded_count; |
| 521 | - if(!$comment_srl || !$uploaded_count) return new Object(); |
|
| 608 | + if(!$comment_srl || !$uploaded_count) { |
|
| 609 | + return new Object(); |
|
| 610 | + } |
|
| 522 | 611 | |
| 523 | 612 | $output = $this->setFilesValid($comment_srl); |
| 524 | - if(!$output->toBool()) return $output; |
|
| 613 | + if(!$output->toBool()) { |
|
| 614 | + return $output; |
|
| 615 | + } |
|
| 525 | 616 | |
| 526 | 617 | return new Object(); |
| 527 | 618 | } |
@@ -535,9 +626,13 @@ discard block |
||
| 535 | 626 | function triggerCommentDeleteAttached(&$obj) |
| 536 | 627 | { |
| 537 | 628 | $comment_srl = $obj->comment_srl; |
| 538 | - if(!$comment_srl) return new Object(); |
|
| 629 | + if(!$comment_srl) { |
|
| 630 | + return new Object(); |
|
| 631 | + } |
|
| 539 | 632 | |
| 540 | - if($obj->isMoveToTrash) return new Object(); |
|
| 633 | + if($obj->isMoveToTrash) { |
|
| 634 | + return new Object(); |
|
| 635 | + } |
|
| 541 | 636 | |
| 542 | 637 | $output = $this->deleteFiles($comment_srl); |
| 543 | 638 | return $output; |
@@ -552,7 +647,9 @@ discard block |
||
| 552 | 647 | function triggerDeleteModuleFiles(&$obj) |
| 553 | 648 | { |
| 554 | 649 | $module_srl = $obj->module_srl; |
| 555 | - if(!$module_srl) return new Object(); |
|
| 650 | + if(!$module_srl) { |
|
| 651 | + return new Object(); |
|
| 652 | + } |
|
| 556 | 653 | |
| 557 | 654 | $oFileController = getAdminController('file'); |
| 558 | 655 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -627,7 +724,9 @@ discard block |
||
| 627 | 724 | $trigger_obj->module_srl = $module_srl; |
| 628 | 725 | $trigger_obj->upload_target_srl = $upload_target_srl; |
| 629 | 726 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
| 630 | - if(!$output->toBool()) return $output; |
|
| 727 | + if(!$output->toBool()) { |
|
| 728 | + return $output; |
|
| 729 | + } |
|
| 631 | 730 | |
| 632 | 731 | // A workaround for Firefox upload bug |
| 633 | 732 | if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
@@ -665,13 +764,17 @@ discard block |
||
| 665 | 764 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
| 666 | 765 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
| 667 | 766 | // An error appears if file size exceeds a limit |
| 668 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 767 | + if($allowed_filesize < filesize($file_info['tmp_name'])) { |
|
| 768 | + return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 769 | + } |
|
| 669 | 770 | // Get total file size of all attachements (from DB) |
| 670 | 771 | $size_args = new stdClass; |
| 671 | 772 | $size_args->upload_target_srl = $upload_target_srl; |
| 672 | 773 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
| 673 | 774 | $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
| 674 | - if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 775 | + if($attached_size > $allowed_attach_size) { |
|
| 776 | + return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 777 | + } |
|
| 675 | 778 | } |
| 676 | 779 | } |
| 677 | 780 | |
@@ -701,18 +804,21 @@ discard block |
||
| 701 | 804 | $idx++; |
| 702 | 805 | } |
| 703 | 806 | $direct_download = 'Y'; |
| 704 | - } |
|
| 705 | - else |
|
| 807 | + } else |
|
| 706 | 808 | { |
| 707 | 809 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
| 708 | 810 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 709 | 811 | $direct_download = 'N'; |
| 710 | 812 | } |
| 711 | 813 | // Create a directory |
| 712 | - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); |
|
| 814 | + if(!FileHandler::makeDir($path)) { |
|
| 815 | + return new Object(-1,'msg_not_permitted_create'); |
|
| 816 | + } |
|
| 713 | 817 | |
| 714 | 818 | // Check uploaded file |
| 715 | - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error'); |
|
| 819 | + if(!checkUploadedFile($file_info['tmp_name'])) { |
|
| 820 | + return new Object(-1,'msg_file_upload_error'); |
|
| 821 | + } |
|
| 716 | 822 | |
| 717 | 823 | // Get random number generator |
| 718 | 824 | $random = new Password(); |
@@ -726,13 +832,14 @@ discard block |
||
| 726 | 832 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 727 | 833 | @copy($file_info['tmp_name'], $filename); |
| 728 | 834 | } |
| 729 | - } |
|
| 730 | - else |
|
| 835 | + } else |
|
| 731 | 836 | { |
| 732 | 837 | if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
| 733 | 838 | { |
| 734 | 839 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 735 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); |
|
| 840 | + if(!@move_uploaded_file($file_info['tmp_name'], $filename)) { |
|
| 841 | + return new Object(-1,'msg_file_upload_error'); |
|
| 842 | + } |
|
| 736 | 843 | } |
| 737 | 844 | } |
| 738 | 845 | // Get member information |
@@ -753,10 +860,14 @@ discard block |
||
| 753 | 860 | $args->sid = $random->createSecureSalt(32, 'hex'); |
| 754 | 861 | |
| 755 | 862 | $output = executeQuery('file.insertFile', $args); |
| 756 | - if(!$output->toBool()) return $output; |
|
| 863 | + if(!$output->toBool()) { |
|
| 864 | + return $output; |
|
| 865 | + } |
|
| 757 | 866 | // Call a trigger (after) |
| 758 | 867 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
| 759 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 868 | + if(!$trigger_output->toBool()) { |
|
| 869 | + return $trigger_output; |
|
| 870 | + } |
|
| 760 | 871 | |
| 761 | 872 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
| 762 | 873 | |
@@ -799,10 +910,14 @@ discard block |
||
| 799 | 910 | */ |
| 800 | 911 | function deleteFile($file_srl) |
| 801 | 912 | { |
| 802 | - if(!$file_srl) return; |
|
| 913 | + if(!$file_srl) { |
|
| 914 | + return; |
|
| 915 | + } |
|
| 803 | 916 | |
| 804 | 917 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
| 805 | - if(!count($srls)) return; |
|
| 918 | + if(!count($srls)) { |
|
| 919 | + return; |
|
| 920 | + } |
|
| 806 | 921 | |
| 807 | 922 | $oDocumentController = getController('document'); |
| 808 | 923 | $documentSrlList = array(); |
@@ -837,15 +952,21 @@ discard block |
||
| 837 | 952 | // Call a trigger (before) |
| 838 | 953 | $trigger_obj = $output->data; |
| 839 | 954 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
| 840 | - if(!$output->toBool()) return $output; |
|
| 955 | + if(!$output->toBool()) { |
|
| 956 | + return $output; |
|
| 957 | + } |
|
| 841 | 958 | |
| 842 | 959 | // Remove from the DB |
| 843 | 960 | $output = executeQuery('file.deleteFile', $args); |
| 844 | - if(!$output->toBool()) return $output; |
|
| 961 | + if(!$output->toBool()) { |
|
| 962 | + return $output; |
|
| 963 | + } |
|
| 845 | 964 | |
| 846 | 965 | // Call a trigger (after) |
| 847 | 966 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
| 848 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 967 | + if(!$trigger_output->toBool()) { |
|
| 968 | + return $trigger_output; |
|
| 969 | + } |
|
| 849 | 970 | |
| 850 | 971 | // If successfully deleted, remove the file |
| 851 | 972 | FileHandler::removeFile($uploaded_filename); |
@@ -869,7 +990,9 @@ discard block |
||
| 869 | 990 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
| 870 | 991 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
| 871 | 992 | // Success returned if no attachement exists |
| 872 | - if(!is_array($file_list)||!count($file_list)) return new Object(); |
|
| 993 | + if(!is_array($file_list)||!count($file_list)) { |
|
| 994 | + return new Object(); |
|
| 995 | + } |
|
| 873 | 996 | |
| 874 | 997 | // Delete the file |
| 875 | 998 | $path = array(); |
@@ -880,14 +1003,18 @@ discard block |
||
| 880 | 1003 | |
| 881 | 1004 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
| 882 | 1005 | $path_info = pathinfo($uploaded_filename); |
| 883 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 1006 | + if(!in_array($path_info['dirname'], $path)) { |
|
| 1007 | + $path[] = $path_info['dirname']; |
|
| 1008 | + } |
|
| 884 | 1009 | } |
| 885 | 1010 | |
| 886 | 1011 | // Remove from the DB |
| 887 | 1012 | $args = new stdClass(); |
| 888 | 1013 | $args->upload_target_srl = $upload_target_srl; |
| 889 | 1014 | $output = executeQuery('file.deleteFiles', $args); |
| 890 | - if(!$output->toBool()) return $output; |
|
| 1015 | + if(!$output->toBool()) { |
|
| 1016 | + return $output; |
|
| 1017 | + } |
|
| 891 | 1018 | |
| 892 | 1019 | // Remove a file directory of the document |
| 893 | 1020 | for($i=0, $c=count($path); $i<$c; $i++) |
@@ -908,11 +1035,15 @@ discard block |
||
| 908 | 1035 | */ |
| 909 | 1036 | function moveFile($source_srl, $target_module_srl, $target_srl) |
| 910 | 1037 | { |
| 911 | - if($source_srl == $target_srl) return; |
|
| 1038 | + if($source_srl == $target_srl) { |
|
| 1039 | + return; |
|
| 1040 | + } |
|
| 912 | 1041 | |
| 913 | 1042 | $oFileModel = getModel('file'); |
| 914 | 1043 | $file_list = $oFileModel->getFiles($source_srl); |
| 915 | - if(!$file_list) return; |
|
| 1044 | + if(!$file_list) { |
|
| 1045 | + return; |
|
| 1046 | + } |
|
| 916 | 1047 | |
| 917 | 1048 | $file_count = count($file_list); |
| 918 | 1049 | |
@@ -926,15 +1057,16 @@ discard block |
||
| 926 | 1057 | { |
| 927 | 1058 | $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
| 928 | 1059 | $new_file = $path.$file_info->source_filename; |
| 929 | - } |
|
| 930 | - else |
|
| 1060 | + } else |
|
| 931 | 1061 | { |
| 932 | 1062 | $path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl); |
| 933 | 1063 | $random = new Password(); |
| 934 | 1064 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
| 935 | 1065 | } |
| 936 | 1066 | // Pass if a target document to move is same |
| 937 | - if($old_file == $new_file) continue; |
|
| 1067 | + if($old_file == $new_file) { |
|
| 1068 | + continue; |
|
| 1069 | + } |
|
| 938 | 1070 | // Create a directory |
| 939 | 1071 | FileHandler::makeDir($path); |
| 940 | 1072 | // Move the file |
@@ -954,16 +1086,22 @@ discard block |
||
| 954 | 1086 | $vars = Context::getRequestVars(); |
| 955 | 1087 | $logged_info = Context::get('logged_info'); |
| 956 | 1088 | |
| 957 | - if(!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
| 1089 | + if(!$vars->editor_sequence) { |
|
| 1090 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1091 | + } |
|
| 958 | 1092 | |
| 959 | 1093 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
| 960 | 1094 | |
| 961 | 1095 | $oFileModel = getModel('file'); |
| 962 | 1096 | $file_info = $oFileModel->getFile($vars->file_srl); |
| 963 | 1097 | |
| 964 | - if(!$file_info) return new Object(-1, 'msg_not_founded'); |
|
| 1098 | + if(!$file_info) { |
|
| 1099 | + return new Object(-1, 'msg_not_founded'); |
|
| 1100 | + } |
|
| 965 | 1101 | |
| 966 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
| 1102 | + if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) { |
|
| 1103 | + return new Object(-1, 'msg_not_permitted'); |
|
| 1104 | + } |
|
| 967 | 1105 | |
| 968 | 1106 | $args = new stdClass(); |
| 969 | 1107 | $args->file_srl = $vars->file_srl; |
@@ -34,25 +34,25 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function procMemberLogin($user_id = null, $password = null, $keep_signed = null) |
| 36 | 36 | { |
| 37 | - if(!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
| 37 | + if (!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
| 38 | 38 | { |
| 39 | 39 | $this->setRedirectUrl(getNotEncodedUrl('')); |
| 40 | 40 | return new Object(-1, 'null_user_id'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Variables |
| 44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
| 44 | + if (!$user_id) $user_id = Context::get('user_id'); |
|
| 45 | 45 | $user_id = trim($user_id); |
| 46 | 46 | |
| 47 | - if(!$password) $password = Context::get('password'); |
|
| 47 | + if (!$password) $password = Context::get('password'); |
|
| 48 | 48 | $password = trim($password); |
| 49 | 49 | |
| 50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 50 | + if (!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 51 | 51 | // Return an error when id and password doesn't exist |
| 52 | - if(!$user_id) return new Object(-1,'null_user_id'); |
|
| 53 | - if(!$password) return new Object(-1,'null_password'); |
|
| 52 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
| 53 | + if (!$password) return new Object(-1, 'null_password'); |
|
| 54 | 54 | |
| 55 | - $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
|
| 55 | + $output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ? true : false); |
|
| 56 | 56 | if (!$output->toBool()) return $output; |
| 57 | 57 | |
| 58 | 58 | $oModuleModel = getModel('module'); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | $limit_date = $config->change_password_date; |
| 63 | 63 | |
| 64 | 64 | // Check if change_password_date is set |
| 65 | - if($limit_date > 0) |
|
| 65 | + if ($limit_date > 0) |
|
| 66 | 66 | { |
| 67 | 67 | $oMemberModel = getModel('member'); |
| 68 | - if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day'))) |
|
| 68 | + if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day'))) |
|
| 69 | 69 | { |
| 70 | 70 | $msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date); |
| 71 | - return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg)); |
|
| 71 | + return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new Object(-1, $msg)); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $args->member_srl = $this->memberInfo->member_srl; |
| 78 | 78 | executeQuery('member.deleteAuthMail', $args); |
| 79 | 79 | |
| 80 | - if(!$config->after_login_url) |
|
| 80 | + if (!$config->after_login_url) |
|
| 81 | 81 | { |
| 82 | 82 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 83 | 83 | } |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | // Call a trigger before log-out (before) |
| 99 | 99 | $logged_info = Context::get('logged_info'); |
| 100 | 100 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
| 101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 101 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 102 | 102 | // Destroy session information |
| 103 | 103 | $this->destroySessionInfo(); |
| 104 | 104 | // Call a trigger after log-out (after) |
| 105 | 105 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
| 106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 106 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 107 | 107 | |
| 108 | 108 | $output = new Object(); |
| 109 | 109 | |
| 110 | 110 | $oModuleModel = getModel('module'); |
| 111 | 111 | $config = $oModuleModel->getModuleConfig('member'); |
| 112 | - if($config->after_logout_url) |
|
| 112 | + if ($config->after_logout_url) |
|
| 113 | 113 | $output->redirect_url = $config->after_logout_url; |
| 114 | 114 | |
| 115 | 115 | $this->_clearMemberCache($logged_info->member_srl); |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | function procMemberScrapDocument() |
| 126 | 126 | { |
| 127 | 127 | // Check login information |
| 128 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 128 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 129 | 129 | $logged_info = Context::get('logged_info'); |
| 130 | 130 | |
| 131 | - $document_srl = (int)Context::get('document_srl'); |
|
| 132 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
| 133 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 131 | + $document_srl = (int) Context::get('document_srl'); |
|
| 132 | + if (!$document_srl) $document_srl = (int) Context::get('target_srl'); |
|
| 133 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 134 | 134 | // Get document |
| 135 | 135 | $oDocumentModel = getModel('document'); |
| 136 | 136 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | $args->title = $oDocument->get('title'); |
| 146 | 146 | // Check if already scrapped |
| 147 | 147 | $output = executeQuery('member.getScrapDocument', $args); |
| 148 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
| 148 | + if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
| 149 | 149 | // Insert |
| 150 | 150 | $output = executeQuery('member.addScrapDocument', $args); |
| 151 | - if(!$output->toBool()) return $output; |
|
| 151 | + if (!$output->toBool()) return $output; |
|
| 152 | 152 | |
| 153 | 153 | $this->setError(-1); |
| 154 | 154 | $this->setMessage('success_registed'); |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | function procMemberDeleteScrap() |
| 163 | 163 | { |
| 164 | 164 | // Check login information |
| 165 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 165 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 166 | 166 | $logged_info = Context::get('logged_info'); |
| 167 | 167 | |
| 168 | - $document_srl = (int)Context::get('document_srl'); |
|
| 169 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 168 | + $document_srl = (int) Context::get('document_srl'); |
|
| 169 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 170 | 170 | // Variables |
| 171 | 171 | $args = new stdClass; |
| 172 | 172 | $args->member_srl = $logged_info->member_srl; |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | function procMemberDeleteSavedDocument() |
| 193 | 193 | { |
| 194 | 194 | // Check login information |
| 195 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 195 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 196 | 196 | $logged_info = Context::get('logged_info'); |
| 197 | 197 | |
| 198 | - $document_srl = (int)Context::get('document_srl'); |
|
| 199 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 198 | + $document_srl = (int) Context::get('document_srl'); |
|
| 199 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 200 | 200 | // Variables |
| 201 | 201 | $oDocumentController = getController('document'); |
| 202 | 202 | $oDocumentController->deleteDocument($document_srl, true); |
@@ -211,37 +211,37 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $name = Context::get('name'); |
| 213 | 213 | $value = Context::get('value'); |
| 214 | - if(!$value) return; |
|
| 214 | + if (!$value) return; |
|
| 215 | 215 | |
| 216 | 216 | $oMemberModel = getModel('member'); |
| 217 | 217 | // Check if logged-in |
| 218 | 218 | $logged_info = Context::get('logged_info'); |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - switch($name) |
|
| 221 | + switch ($name) |
|
| 222 | 222 | { |
| 223 | 223 | case 'user_id' : |
| 224 | 224 | // Check denied ID |
| 225 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
| 225 | + if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id'); |
|
| 226 | 226 | // Check if duplicated |
| 227 | 227 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 228 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
| 228 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id'); |
|
| 229 | 229 | break; |
| 230 | 230 | case 'nick_name' : |
| 231 | 231 | // Check denied ID |
| 232 | - if($oMemberModel->isDeniedNickName($value)) |
|
| 232 | + if ($oMemberModel->isDeniedNickName($value)) |
|
| 233 | 233 | { |
| 234 | - return new Object(0,'denied_nick_name'); |
|
| 234 | + return new Object(0, 'denied_nick_name'); |
|
| 235 | 235 | } |
| 236 | 236 | // Check if duplicated |
| 237 | 237 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 238 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
| 238 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name'); |
|
| 239 | 239 | |
| 240 | 240 | break; |
| 241 | 241 | case 'email_address' : |
| 242 | 242 | // Check if duplicated |
| 243 | 243 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 244 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
| 244 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address'); |
|
| 245 | 245 | break; |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -253,25 +253,25 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | function procMemberInsert() |
| 255 | 255 | { |
| 256 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
| 257 | - $oMemberModel = &getModel ('member'); |
|
| 256 | + if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); |
|
| 257 | + $oMemberModel = &getModel('member'); |
|
| 258 | 258 | $config = $oMemberModel->getMemberConfig(); |
| 259 | 259 | |
| 260 | 260 | // call a trigger (before) |
| 261 | - $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
|
| 262 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 261 | + $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); |
|
| 262 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 263 | 263 | // Check if an administrator allows a membership |
| 264 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 264 | + if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 265 | 265 | // Check if the user accept the license terms (only if terms exist) |
| 266 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 266 | + if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement'); |
|
| 267 | 267 | |
| 268 | 268 | // Extract the necessary information in advance |
| 269 | 269 | $getVars = array(); |
| 270 | - if($config->signupForm) |
|
| 270 | + if ($config->signupForm) |
|
| 271 | 271 | { |
| 272 | - foreach($config->signupForm as $formInfo) |
|
| 272 | + foreach ($config->signupForm as $formInfo) |
|
| 273 | 273 | { |
| 274 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 274 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 275 | 275 | { |
| 276 | 276 | $getVars[] = $formInfo->name; |
| 277 | 277 | } |
@@ -279,22 +279,22 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $args = new stdClass; |
| 282 | - foreach($getVars as $val) |
|
| 282 | + foreach ($getVars as $val) |
|
| 283 | 283 | { |
| 284 | 284 | $args->{$val} = Context::get($val); |
| 285 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 285 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 286 | 286 | } |
| 287 | 287 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 288 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 288 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 289 | 289 | |
| 290 | 290 | $args->find_account_answer = Context::get('find_account_answer'); |
| 291 | 291 | $args->allow_mailing = Context::get('allow_mailing'); |
| 292 | 292 | $args->allow_message = Context::get('allow_message'); |
| 293 | 293 | |
| 294 | - if($args->password1) $args->password = $args->password1; |
|
| 294 | + if ($args->password1) $args->password = $args->password1; |
|
| 295 | 295 | |
| 296 | 296 | // check password strength |
| 297 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 297 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 298 | 298 | { |
| 299 | 299 | $message = Context::getLang('about_password_strength'); |
| 300 | 300 | return new Object(-1, $message[$config->password_strength]); |
@@ -320,58 +320,58 @@ discard block |
||
| 320 | 320 | unset($all_args->secret_text); |
| 321 | 321 | |
| 322 | 322 | // Set the user state as "denied" when using mail authentication |
| 323 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 323 | + if ($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 324 | 324 | // Add extra vars after excluding necessary information from all the requested arguments |
| 325 | 325 | $extra_vars = delObjectVars($all_args, $args); |
| 326 | 326 | $args->extra_vars = serialize($extra_vars); |
| 327 | 327 | |
| 328 | 328 | // remove whitespace |
| 329 | 329 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 330 | - foreach($checkInfos as $val) |
|
| 330 | + foreach ($checkInfos as $val) |
|
| 331 | 331 | { |
| 332 | - if(isset($args->{$val})) |
|
| 332 | + if (isset($args->{$val})) |
|
| 333 | 333 | { |
| 334 | 334 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | $output = $this->insertMember($args); |
| 338 | - if(!$output->toBool()) return $output; |
|
| 338 | + if (!$output->toBool()) return $output; |
|
| 339 | 339 | |
| 340 | 340 | // insert ProfileImage, ImageName, ImageMark |
| 341 | 341 | $profile_image = $_FILES['profile_image']; |
| 342 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 342 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 343 | 343 | { |
| 344 | 344 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $image_mark = $_FILES['image_mark']; |
| 348 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 348 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 349 | 349 | { |
| 350 | 350 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $image_name = $_FILES['image_name']; |
| 354 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 354 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 355 | 355 | { |
| 356 | 356 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // If a virtual site, join the site |
| 360 | 360 | $site_module_info = Context::get('site_module_info'); |
| 361 | - if($site_module_info->site_srl > 0) |
|
| 361 | + if ($site_module_info->site_srl > 0) |
|
| 362 | 362 | { |
| 363 | 363 | $columnList = array('site_srl', 'group_srl'); |
| 364 | 364 | $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList); |
| 365 | - if($default_group->group_srl) |
|
| 365 | + if ($default_group->group_srl) |
|
| 366 | 366 | { |
| 367 | 367 | $this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | } |
| 371 | 371 | // Log-in |
| 372 | - if($config->enable_confirm != 'Y') |
|
| 372 | + if ($config->enable_confirm != 'Y') |
|
| 373 | 373 | { |
| 374 | - if($config->identifier == 'email_address') |
|
| 374 | + if ($config->identifier == 'email_address') |
|
| 375 | 375 | { |
| 376 | 376 | $output = $this->doLogin($args->email_address); |
| 377 | 377 | } |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | { |
| 380 | 380 | $output = $this->doLogin($args->user_id); |
| 381 | 381 | } |
| 382 | - if(!$output->toBool()) { |
|
| 383 | - if($output->error == -9) |
|
| 382 | + if (!$output->toBool()) { |
|
| 383 | + if ($output->error == -9) |
|
| 384 | 384 | $output->error = -11; |
| 385 | 385 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 386 | 386 | } |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | // Results |
| 390 | 390 | $this->add('member_srl', $args->member_srl); |
| 391 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 392 | - if($config->enable_confirm == 'Y') |
|
| 391 | + if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 392 | + if ($config->enable_confirm == 'Y') |
|
| 393 | 393 | { |
| 394 | 394 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 395 | 395 | $this->setMessage($msg); |
@@ -398,19 +398,19 @@ discard block |
||
| 398 | 398 | else $this->setMessage('success_registed'); |
| 399 | 399 | // Call a trigger (after) |
| 400 | 400 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 401 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 401 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 402 | 402 | |
| 403 | - if($config->redirect_url) |
|
| 403 | + if ($config->redirect_url) |
|
| 404 | 404 | { |
| 405 | 405 | $returnUrl = $config->redirect_url; |
| 406 | 406 | } |
| 407 | 407 | else |
| 408 | 408 | { |
| 409 | - if(Context::get('success_return_url')) |
|
| 409 | + if (Context::get('success_return_url')) |
|
| 410 | 410 | { |
| 411 | 411 | $returnUrl = Context::get('success_return_url'); |
| 412 | 412 | } |
| 413 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 413 | + else if ($_COOKIE['XE_REDIRECT_URL']) |
|
| 414 | 414 | { |
| 415 | 415 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 416 | 416 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -424,26 +424,26 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | function procMemberModifyInfoBefore() |
| 426 | 426 | { |
| 427 | - if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 427 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 428 | 428 | { |
| 429 | 429 | return $this->stop('msg_invalid_request'); |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - if(!Context::get('is_logged')) |
|
| 432 | + if (!Context::get('is_logged')) |
|
| 433 | 433 | { |
| 434 | 434 | return $this->stop('msg_not_logged'); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | $password = Context::get('password'); |
| 438 | 438 | |
| 439 | - if(!$password) |
|
| 439 | + if (!$password) |
|
| 440 | 440 | { |
| 441 | 441 | return $this->stop('msg_invalid_request'); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $oMemberModel = getModel('member'); |
| 445 | 445 | |
| 446 | - if(!$this->memberInfo->password) |
|
| 446 | + if (!$this->memberInfo->password) |
|
| 447 | 447 | { |
| 448 | 448 | // Get information of logged-in user |
| 449 | 449 | $logged_info = Context::get('logged_info'); |
@@ -454,14 +454,14 @@ discard block |
||
| 454 | 454 | $this->memberInfo->password = $memberInfo->password; |
| 455 | 455 | } |
| 456 | 456 | // Verify the current password |
| 457 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 457 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 458 | 458 | { |
| 459 | 459 | return new Object(-1, 'invalid_password'); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | $_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD'; |
| 463 | 463 | |
| 464 | - if(Context::get('success_return_url')) |
|
| 464 | + if (Context::get('success_return_url')) |
|
| 465 | 465 | { |
| 466 | 466 | $redirectUrl = Context::get('success_return_url'); |
| 467 | 467 | } |
@@ -479,26 +479,26 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | function procMemberModifyInfo() |
| 481 | 481 | { |
| 482 | - if(!Context::get('is_logged')) |
|
| 482 | + if (!Context::get('is_logged')) |
|
| 483 | 483 | { |
| 484 | 484 | return $this->stop('msg_not_logged'); |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 487 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 488 | 488 | { |
| 489 | 489 | return $this->stop('msg_invalid_request'); |
| 490 | 490 | } |
| 491 | 491 | unset($_SESSION['rechecked_password_step']); |
| 492 | 492 | |
| 493 | 493 | // Extract the necessary information in advance |
| 494 | - $oMemberModel = &getModel ('member'); |
|
| 495 | - $config = $oMemberModel->getMemberConfig (); |
|
| 496 | - $getVars = array('find_account_answer','allow_mailing','allow_message'); |
|
| 497 | - if($config->signupForm) |
|
| 494 | + $oMemberModel = &getModel('member'); |
|
| 495 | + $config = $oMemberModel->getMemberConfig(); |
|
| 496 | + $getVars = array('find_account_answer', 'allow_mailing', 'allow_message'); |
|
| 497 | + if ($config->signupForm) |
|
| 498 | 498 | { |
| 499 | - foreach($config->signupForm as $formInfo) |
|
| 499 | + foreach ($config->signupForm as $formInfo) |
|
| 500 | 500 | { |
| 501 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 501 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 502 | 502 | { |
| 503 | 503 | $getVars[] = $formInfo->name; |
| 504 | 504 | } |
@@ -506,16 +506,16 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | $args = new stdClass; |
| 509 | - foreach($getVars as $val) |
|
| 509 | + foreach ($getVars as $val) |
|
| 510 | 510 | { |
| 511 | 511 | $args->{$val} = Context::get($val); |
| 512 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 512 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 513 | 513 | } |
| 514 | 514 | // Login Information |
| 515 | 515 | $logged_info = Context::get('logged_info'); |
| 516 | 516 | $args->member_srl = $logged_info->member_srl; |
| 517 | 517 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 518 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 518 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 519 | 519 | // Remove some unnecessary variables from all the vars |
| 520 | 520 | $all_args = Context::getRequestVars(); |
| 521 | 521 | unset($all_args->module); |
@@ -539,9 +539,9 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | // remove whitespace |
| 541 | 541 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 542 | - foreach($checkInfos as $val) |
|
| 542 | + foreach ($checkInfos as $val) |
|
| 543 | 543 | { |
| 544 | - if(isset($args->{$val})) |
|
| 544 | + if (isset($args->{$val})) |
|
| 545 | 545 | { |
| 546 | 546 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 547 | 547 | } |
@@ -549,22 +549,22 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | // Execute insert or update depending on the value of member_srl |
| 551 | 551 | $output = $this->updateMember($args); |
| 552 | - if(!$output->toBool()) return $output; |
|
| 552 | + if (!$output->toBool()) return $output; |
|
| 553 | 553 | |
| 554 | 554 | $profile_image = $_FILES['profile_image']; |
| 555 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 555 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 556 | 556 | { |
| 557 | 557 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | $image_mark = $_FILES['image_mark']; |
| 561 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 561 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 562 | 562 | { |
| 563 | 563 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $image_name = $_FILES['image_name']; |
| 567 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 567 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 568 | 568 | { |
| 569 | 569 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 570 | 570 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | // Call a trigger after successfully log-in (after) |
| 581 | 581 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 582 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 582 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 583 | 583 | |
| 584 | 584 | $this->setSessionInfo(); |
| 585 | 585 | // Return result |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | */ |
| 601 | 601 | function procMemberModifyPassword() |
| 602 | 602 | { |
| 603 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 603 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 604 | 604 | // Extract the necessary information in advance |
| 605 | 605 | $current_password = trim(Context::get('current_password')); |
| 606 | 606 | $password = trim(Context::get('password1')); |
@@ -614,17 +614,17 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 616 | 616 | // Verify the cuttent password |
| 617 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
| 617 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
| 618 | 618 | |
| 619 | 619 | // Check if a new password is as same as the previous password |
| 620 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
| 620 | + if ($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
| 621 | 621 | |
| 622 | 622 | // Execute insert or update depending on the value of member_srl |
| 623 | 623 | $args = new stdClass; |
| 624 | 624 | $args->member_srl = $member_srl; |
| 625 | 625 | $args->password = $password; |
| 626 | 626 | $output = $this->updateMemberPassword($args); |
| 627 | - if(!$output->toBool()) return $output; |
|
| 627 | + if (!$output->toBool()) return $output; |
|
| 628 | 628 | |
| 629 | 629 | $this->add('member_srl', $args->member_srl); |
| 630 | 630 | $this->setMessage('success_updated'); |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | function procMemberLeave() |
| 642 | 642 | { |
| 643 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 643 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 644 | 644 | // Extract the necessary information in advance |
| 645 | 645 | $password = trim(Context::get('password')); |
| 646 | 646 | // Get information of logged-in user |
@@ -649,17 +649,17 @@ discard block |
||
| 649 | 649 | // Create a member model object |
| 650 | 650 | $oMemberModel = getModel('member'); |
| 651 | 651 | // Get information of member_srl |
| 652 | - if(!$this->memberInfo->password) |
|
| 652 | + if (!$this->memberInfo->password) |
|
| 653 | 653 | { |
| 654 | 654 | $columnList = array('member_srl', 'password'); |
| 655 | 655 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 656 | 656 | $this->memberInfo->password = $memberInfo->password; |
| 657 | 657 | } |
| 658 | 658 | // Verify the cuttent password |
| 659 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
| 659 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
| 660 | 660 | |
| 661 | 661 | $output = $this->deleteMember($member_srl); |
| 662 | - if(!$output->toBool()) return $output; |
|
| 662 | + if (!$output->toBool()) return $output; |
|
| 663 | 663 | // Destroy all session information |
| 664 | 664 | $this->destroySessionInfo(); |
| 665 | 665 | // Return success message |
@@ -678,17 +678,17 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | // Check if the file is successfully uploaded |
| 680 | 680 | $file = $_FILES['profile_image']; |
| 681 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 681 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 682 | 682 | // Ignore if member_srl is invalid or doesn't exist. |
| 683 | 683 | $member_srl = Context::get('member_srl'); |
| 684 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 684 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 685 | 685 | |
| 686 | 686 | $logged_info = Context::get('logged_info'); |
| 687 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 687 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 688 | 688 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 689 | 689 | $oModuleModel = getModel('module'); |
| 690 | 690 | $config = $oModuleModel->getModuleConfig('member'); |
| 691 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 691 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 692 | 692 | |
| 693 | 693 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 694 | 694 | // Page refresh |
@@ -710,25 +710,25 @@ discard block |
||
| 710 | 710 | { |
| 711 | 711 | |
| 712 | 712 | // Check uploaded file |
| 713 | - if(!checkUploadedFile($target_file)) return; |
|
| 713 | + if (!checkUploadedFile($target_file)) return; |
|
| 714 | 714 | |
| 715 | 715 | $oMemberModel = getModel('member'); |
| 716 | 716 | $config = $oMemberModel->getMemberConfig(); |
| 717 | 717 | |
| 718 | 718 | // Get an image size |
| 719 | 719 | $max_width = $config->profile_image_max_width; |
| 720 | - if(!$max_width) $max_width = "90"; |
|
| 720 | + if (!$max_width) $max_width = "90"; |
|
| 721 | 721 | $max_height = $config->profile_image_max_height; |
| 722 | - if(!$max_height) $max_height = "90"; |
|
| 722 | + if (!$max_height) $max_height = "90"; |
|
| 723 | 723 | // Get a target path to save |
| 724 | 724 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
| 725 | 725 | FileHandler::makeDir($target_path); |
| 726 | 726 | |
| 727 | 727 | // Get file information |
| 728 | 728 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 729 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 730 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 731 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 729 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 730 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 731 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 732 | 732 | else |
| 733 | 733 | { |
| 734 | 734 | return; |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
| 740 | 740 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 741 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
| 741 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
| 742 | 742 | { |
| 743 | 743 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
| 744 | 744 | } |
@@ -757,17 +757,17 @@ discard block |
||
| 757 | 757 | { |
| 758 | 758 | // Check if the file is successfully uploaded |
| 759 | 759 | $file = $_FILES['image_name']; |
| 760 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 760 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 761 | 761 | // Ignore if member_srl is invalid or doesn't exist. |
| 762 | 762 | $member_srl = Context::get('member_srl'); |
| 763 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 763 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 764 | 764 | |
| 765 | 765 | $logged_info = Context::get('logged_info'); |
| 766 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 766 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 767 | 767 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 768 | 768 | $oModuleModel = getModel('module'); |
| 769 | 769 | $config = $oModuleModel->getModuleConfig('member'); |
| 770 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 770 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 771 | 771 | |
| 772 | 772 | $this->insertImageName($member_srl, $file['tmp_name']); |
| 773 | 773 | // Page refresh |
@@ -788,15 +788,15 @@ discard block |
||
| 788 | 788 | function insertImageName($member_srl, $target_file) |
| 789 | 789 | { |
| 790 | 790 | // Check uploaded file |
| 791 | - if(!checkUploadedFile($target_file)) return; |
|
| 791 | + if (!checkUploadedFile($target_file)) return; |
|
| 792 | 792 | |
| 793 | 793 | $oModuleModel = getModel('module'); |
| 794 | 794 | $config = $oModuleModel->getModuleConfig('member'); |
| 795 | 795 | // Get an image size |
| 796 | 796 | $max_width = $config->image_name_max_width; |
| 797 | - if(!$max_width) $max_width = "90"; |
|
| 797 | + if (!$max_width) $max_width = "90"; |
|
| 798 | 798 | $max_height = $config->image_name_max_height; |
| 799 | - if(!$max_height) $max_height = "20"; |
|
| 799 | + if (!$max_height) $max_height = "20"; |
|
| 800 | 800 | // Get a target path to save |
| 801 | 801 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
| 802 | 802 | FileHandler::makeDir($target_path); |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | // Get file information |
| 806 | 806 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 807 | 807 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 808 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 808 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 809 | 809 | else @copy($target_file, $target_filename); |
| 810 | 810 | } |
| 811 | 811 | |
@@ -817,20 +817,20 @@ discard block |
||
| 817 | 817 | function procMemberDeleteProfileImage($_memberSrl = 0) |
| 818 | 818 | { |
| 819 | 819 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 820 | - if(!$member_srl) |
|
| 820 | + if (!$member_srl) |
|
| 821 | 821 | { |
| 822 | - return new Object(0,'success'); |
|
| 822 | + return new Object(0, 'success'); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | $logged_info = Context::get('logged_info'); |
| 826 | 826 | |
| 827 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 827 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 828 | 828 | { |
| 829 | 829 | $oMemberModel = getModel('member'); |
| 830 | 830 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
| 831 | 831 | FileHandler::removeFile($profile_image->file); |
| 832 | 832 | } |
| 833 | - return new Object(0,'success'); |
|
| 833 | + return new Object(0, 'success'); |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | /** |
@@ -841,20 +841,20 @@ discard block |
||
| 841 | 841 | function procMemberDeleteImageName($_memberSrl = 0) |
| 842 | 842 | { |
| 843 | 843 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 844 | - if(!$member_srl) |
|
| 844 | + if (!$member_srl) |
|
| 845 | 845 | { |
| 846 | - return new Object(0,'success'); |
|
| 846 | + return new Object(0, 'success'); |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | $logged_info = Context::get('logged_info'); |
| 850 | 850 | |
| 851 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 851 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 852 | 852 | { |
| 853 | 853 | $oMemberModel = getModel('member'); |
| 854 | 854 | $image_name = $oMemberModel->getImageName($member_srl); |
| 855 | 855 | FileHandler::removeFile($image_name->file); |
| 856 | 856 | } |
| 857 | - return new Object(0,'success'); |
|
| 857 | + return new Object(0, 'success'); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
@@ -866,17 +866,17 @@ discard block |
||
| 866 | 866 | { |
| 867 | 867 | // Check if the file is successfully uploaded |
| 868 | 868 | $file = $_FILES['image_mark']; |
| 869 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 869 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 870 | 870 | // Ignore if member_srl is invalid or doesn't exist. |
| 871 | 871 | $member_srl = Context::get('member_srl'); |
| 872 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 872 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 873 | 873 | |
| 874 | 874 | $logged_info = Context::get('logged_info'); |
| 875 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 875 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 876 | 876 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 877 | 877 | $oModuleModel = getModel('module'); |
| 878 | 878 | $config = $oModuleModel->getModuleConfig('member'); |
| 879 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 879 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 880 | 880 | |
| 881 | 881 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 882 | 882 | // Page refresh |
@@ -897,15 +897,15 @@ discard block |
||
| 897 | 897 | function insertImageMark($member_srl, $target_file) |
| 898 | 898 | { |
| 899 | 899 | // Check uploaded file |
| 900 | - if(!checkUploadedFile($target_file)) return; |
|
| 900 | + if (!checkUploadedFile($target_file)) return; |
|
| 901 | 901 | |
| 902 | 902 | $oModuleModel = getModel('module'); |
| 903 | 903 | $config = $oModuleModel->getModuleConfig('member'); |
| 904 | 904 | // Get an image size |
| 905 | 905 | $max_width = $config->image_mark_max_width; |
| 906 | - if(!$max_width) $max_width = "20"; |
|
| 906 | + if (!$max_width) $max_width = "20"; |
|
| 907 | 907 | $max_height = $config->image_mark_max_height; |
| 908 | - if(!$max_height) $max_height = "20"; |
|
| 908 | + if (!$max_height) $max_height = "20"; |
|
| 909 | 909 | |
| 910 | 910 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 911 | 911 | FileHandler::makeDir($target_path); |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | // Get file information |
| 915 | 915 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 916 | 916 | |
| 917 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 917 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 918 | 918 | else @copy($target_file, $target_filename); |
| 919 | 919 | } |
| 920 | 920 | |
@@ -926,20 +926,20 @@ discard block |
||
| 926 | 926 | function procMemberDeleteImageMark($_memberSrl = 0) |
| 927 | 927 | { |
| 928 | 928 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 929 | - if(!$member_srl) |
|
| 929 | + if (!$member_srl) |
|
| 930 | 930 | { |
| 931 | - return new Object(0,'success'); |
|
| 931 | + return new Object(0, 'success'); |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | $logged_info = Context::get('logged_info'); |
| 935 | 935 | |
| 936 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 936 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 937 | 937 | { |
| 938 | 938 | $oMemberModel = getModel('member'); |
| 939 | 939 | $image_mark = $oMemberModel->getImageMark($member_srl); |
| 940 | 940 | FileHandler::removeFile($image_mark->file); |
| 941 | 941 | } |
| 942 | - return new Object(0,'success'); |
|
| 942 | + return new Object(0, 'success'); |
|
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | /** |
@@ -950,26 +950,26 @@ discard block |
||
| 950 | 950 | function procMemberFindAccount() |
| 951 | 951 | { |
| 952 | 952 | $email_address = Context::get('email_address'); |
| 953 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 953 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 954 | 954 | |
| 955 | 955 | $oMemberModel = getModel('member'); |
| 956 | 956 | $oModuleModel = getModel('module'); |
| 957 | 957 | |
| 958 | 958 | // Check if a member having the same email address exists |
| 959 | 959 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 960 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 960 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 961 | 961 | |
| 962 | 962 | // Get information of the member |
| 963 | 963 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
| 964 | 964 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 965 | 965 | |
| 966 | 966 | // Check if possible to find member's ID and password |
| 967 | - if($member_info->denied == 'Y') |
|
| 967 | + if ($member_info->denied == 'Y') |
|
| 968 | 968 | { |
| 969 | 969 | $chk_args = new stdClass; |
| 970 | 970 | $chk_args->member_srl = $member_info->member_srl; |
| 971 | 971 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 972 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
| 972 | + if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | // Insert data into the authentication DB |
@@ -982,19 +982,19 @@ discard block |
||
| 982 | 982 | $args->is_register = 'N'; |
| 983 | 983 | |
| 984 | 984 | $output = executeQuery('member.insertAuthMail', $args); |
| 985 | - if(!$output->toBool()) return $output; |
|
| 985 | + if (!$output->toBool()) return $output; |
|
| 986 | 986 | // Get content of the email to send a member |
| 987 | 987 | Context::set('auth_args', $args); |
| 988 | 988 | |
| 989 | 989 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 990 | 990 | $memberInfo = array(); |
| 991 | 991 | global $lang; |
| 992 | - if(is_array($member_config->signupForm)) |
|
| 992 | + if (is_array($member_config->signupForm)) |
|
| 993 | 993 | { |
| 994 | - $exceptForm=array('password', 'find_account_question'); |
|
| 995 | - foreach($member_config->signupForm as $form) |
|
| 994 | + $exceptForm = array('password', 'find_account_question'); |
|
| 995 | + foreach ($member_config->signupForm as $form) |
|
| 996 | 996 | { |
| 997 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 997 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 998 | 998 | { |
| 999 | 999 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1000 | 1000 | } |
@@ -1009,15 +1009,15 @@ discard block |
||
| 1009 | 1009 | } |
| 1010 | 1010 | Context::set('memberInfo', $memberInfo); |
| 1011 | 1011 | |
| 1012 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1013 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1012 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1013 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1014 | 1014 | |
| 1015 | 1015 | Context::set('member_config', $member_config); |
| 1016 | 1016 | |
| 1017 | 1017 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1018 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1018 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1019 | 1019 | |
| 1020 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1020 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1021 | 1021 | Context::set('find_url', $find_url); |
| 1022 | 1022 | |
| 1023 | 1023 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1027,19 +1027,19 @@ discard block |
||
| 1027 | 1027 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1028 | 1028 | // Send a mail |
| 1029 | 1029 | $oMail = new Mail(); |
| 1030 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
| 1030 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
| 1031 | 1031 | $oMail->setContent($content); |
| 1032 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1033 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1032 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1033 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1034 | 1034 | $oMail->send(); |
| 1035 | 1035 | // Return message |
| 1036 | 1036 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
| 1037 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 1037 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
| 1040 | 1040 | $this->setRedirectUrl($returnUrl); |
| 1041 | 1041 | } |
| 1042 | - return new Object(0,$msg); |
|
| 1042 | + return new Object(0, $msg); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | /** |
@@ -1057,28 +1057,28 @@ discard block |
||
| 1057 | 1057 | $find_account_question = trim(Context::get('find_account_question')); |
| 1058 | 1058 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1059 | 1059 | |
| 1060 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
| 1060 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
| 1061 | 1061 | |
| 1062 | 1062 | $oModuleModel = getModel('module'); |
| 1063 | 1063 | // Check if a member having the same email address exists |
| 1064 | 1064 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1065 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1065 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1066 | 1066 | // Get information of the member |
| 1067 | 1067 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1068 | 1068 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1069 | 1069 | |
| 1070 | 1070 | // Display a message if no answer is entered |
| 1071 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
| 1071 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
| 1072 | 1072 | |
| 1073 | - if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
| 1073 | + if (trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
| 1074 | 1074 | |
| 1075 | - if($config->identifier == 'email_address') |
|
| 1075 | + if ($config->identifier == 'email_address') |
|
| 1076 | 1076 | { |
| 1077 | 1077 | $user_id = $email_address; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | // Update to a temporary password and set change_password_date to 1 |
| 1081 | - $oPassword = new Password(); |
|
| 1081 | + $oPassword = new Password(); |
|
| 1082 | 1082 | $temp_password = $oPassword->createTemporaryPassword(8); |
| 1083 | 1083 | |
| 1084 | 1084 | $args = new stdClass(); |
@@ -1086,11 +1086,11 @@ discard block |
||
| 1086 | 1086 | $args->password = $temp_password; |
| 1087 | 1087 | $args->change_password_date = '1'; |
| 1088 | 1088 | $output = $this->updateMemberPassword($args); |
| 1089 | - if(!$output->toBool()) return $output; |
|
| 1089 | + if (!$output->toBool()) return $output; |
|
| 1090 | 1090 | |
| 1091 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
| 1091 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
| 1092 | 1092 | |
| 1093 | - $this->add('user_id',$user_id); |
|
| 1093 | + $this->add('user_id', $user_id); |
|
| 1094 | 1094 | |
| 1095 | 1095 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 1096 | 1096 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | $member_srl = Context::get('member_srl'); |
| 1111 | 1111 | $auth_key = Context::get('auth_key'); |
| 1112 | 1112 | |
| 1113 | - if(!$member_srl || !$auth_key) |
|
| 1113 | + if (!$member_srl || !$auth_key) |
|
| 1114 | 1114 | { |
| 1115 | 1115 | return $this->stop('msg_invalid_request'); |
| 1116 | 1116 | } |
@@ -1121,9 +1121,9 @@ discard block |
||
| 1121 | 1121 | $args->auth_key = $auth_key; |
| 1122 | 1122 | $output = executeQuery('member.getAuthMail', $args); |
| 1123 | 1123 | |
| 1124 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1124 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1125 | 1125 | { |
| 1126 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1126 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1127 | 1127 | { |
| 1128 | 1128 | executeQuery('member.deleteAuthMail', $args); |
| 1129 | 1129 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | return $this->stop('msg_invalid_auth_key'); |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1134 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1135 | 1135 | { |
| 1136 | 1136 | executeQuery('member.deleteAuthMail', $args); |
| 1137 | 1137 | return $this->stop('msg_invalid_auth_key'); |
@@ -1140,7 +1140,7 @@ discard block |
||
| 1140 | 1140 | $args->password = $output->data->new_password; |
| 1141 | 1141 | |
| 1142 | 1142 | // If credentials are correct, change the password to a new one |
| 1143 | - if($output->data->is_register == 'Y') |
|
| 1143 | + if ($output->data->is_register == 'Y') |
|
| 1144 | 1144 | { |
| 1145 | 1145 | $args->denied = 'N'; |
| 1146 | 1146 | } |
@@ -1153,13 +1153,13 @@ discard block |
||
| 1153 | 1153 | $is_register = $output->data->is_register; |
| 1154 | 1154 | |
| 1155 | 1155 | $output = executeQuery('member.updateMemberPassword', $args); |
| 1156 | - if(!$output->toBool()) |
|
| 1156 | + if (!$output->toBool()) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | return $this->stop($output->getMessage()); |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | // Remove all values having the member_srl from authentication table |
| 1162 | - executeQuery('member.deleteAuthMail',$args); |
|
| 1162 | + executeQuery('member.deleteAuthMail', $args); |
|
| 1163 | 1163 | |
| 1164 | 1164 | $this->_clearMemberCache($args->member_srl); |
| 1165 | 1165 | |
@@ -1178,33 +1178,33 @@ discard block |
||
| 1178 | 1178 | { |
| 1179 | 1179 | // Get an email_address |
| 1180 | 1180 | $email_address = Context::get('email_address'); |
| 1181 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1181 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1182 | 1182 | // Log test by using email_address |
| 1183 | 1183 | $oMemberModel = getModel('member'); |
| 1184 | 1184 | |
| 1185 | 1185 | $args = new stdClass; |
| 1186 | 1186 | $args->email_address = $email_address; |
| 1187 | 1187 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1188 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
| 1188 | + if (!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
| 1189 | 1189 | |
| 1190 | 1190 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1191 | 1191 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1192 | 1192 | |
| 1193 | 1193 | $oModuleModel = getModel('module'); |
| 1194 | 1194 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1195 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1196 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1195 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1196 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1197 | 1197 | |
| 1198 | 1198 | // Check if a authentication mail has been sent previously |
| 1199 | 1199 | $chk_args = new stdClass; |
| 1200 | 1200 | $chk_args->member_srl = $member_info->member_srl; |
| 1201 | 1201 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1202 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
| 1202 | + if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
| 1203 | 1203 | |
| 1204 | 1204 | $auth_args = new stdClass; |
| 1205 | 1205 | $auth_args->member_srl = $member_info->member_srl; |
| 1206 | 1206 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1207 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
| 1207 | + if (!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
| 1208 | 1208 | $auth_info = $output->data[0]; |
| 1209 | 1209 | |
| 1210 | 1210 | // Update the regdate of authmail entry |
@@ -1215,12 +1215,12 @@ discard block |
||
| 1215 | 1215 | |
| 1216 | 1216 | $memberInfo = array(); |
| 1217 | 1217 | global $lang; |
| 1218 | - if(is_array($member_config->signupForm)) |
|
| 1218 | + if (is_array($member_config->signupForm)) |
|
| 1219 | 1219 | { |
| 1220 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1221 | - foreach($member_config->signupForm as $form) |
|
| 1220 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1221 | + foreach ($member_config->signupForm as $form) |
|
| 1222 | 1222 | { |
| 1223 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1223 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1224 | 1224 | { |
| 1225 | 1225 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1226 | 1226 | } |
@@ -1239,19 +1239,19 @@ discard block |
||
| 1239 | 1239 | Context::set('member_config', $member_config); |
| 1240 | 1240 | |
| 1241 | 1241 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1242 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1242 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1243 | 1243 | |
| 1244 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
| 1244 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
| 1245 | 1245 | Context::set('auth_url', $auth_url); |
| 1246 | 1246 | |
| 1247 | 1247 | $oTemplate = &TemplateHandler::getInstance(); |
| 1248 | 1248 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1249 | 1249 | // Send a mail |
| 1250 | 1250 | $oMail = new Mail(); |
| 1251 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1251 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1252 | 1252 | $oMail->setContent($content); |
| 1253 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1254 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
| 1253 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1254 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
| 1255 | 1255 | $oMail->send(); |
| 1256 | 1256 | |
| 1257 | 1257 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1266,23 +1266,23 @@ discard block |
||
| 1266 | 1266 | $memberInfo = $_SESSION['auth_member_info']; |
| 1267 | 1267 | unset($_SESSION['auth_member_info']); |
| 1268 | 1268 | |
| 1269 | - if(!$memberInfo) |
|
| 1269 | + if (!$memberInfo) |
|
| 1270 | 1270 | { |
| 1271 | 1271 | return $this->stop('msg_invalid_request'); |
| 1272 | 1272 | } |
| 1273 | 1273 | |
| 1274 | 1274 | $newEmail = Context::get('email_address'); |
| 1275 | 1275 | |
| 1276 | - if(!$newEmail) |
|
| 1276 | + if (!$newEmail) |
|
| 1277 | 1277 | { |
| 1278 | 1278 | return $this->stop('msg_invalid_request'); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | 1281 | $oMemberModel = getModel('member'); |
| 1282 | 1282 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 1283 | - if($member_srl) |
|
| 1283 | + if ($member_srl) |
|
| 1284 | 1284 | { |
| 1285 | - return new Object(-1,'msg_exists_email_address'); |
|
| 1285 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | // remove all key by member_srl |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | $args->member_srl = $memberInfo->member_srl; |
| 1291 | 1291 | $output = executeQuery('member.deleteAuthMail', $args); |
| 1292 | 1292 | |
| 1293 | - if(!$output->toBool()) |
|
| 1293 | + if (!$output->toBool()) |
|
| 1294 | 1294 | { |
| 1295 | 1295 | return $output; |
| 1296 | 1296 | } |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 1301 | 1301 | |
| 1302 | 1302 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 1303 | - if(!$output->toBool()) |
|
| 1303 | + if (!$output->toBool()) |
|
| 1304 | 1304 | { |
| 1305 | 1305 | return $this->stop($output->getMessage()); |
| 1306 | 1306 | } |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | $auth_args->is_register = 'Y'; |
| 1318 | 1318 | |
| 1319 | 1319 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1320 | - if(!$output->toBool()) return $output; |
|
| 1320 | + if (!$output->toBool()) return $output; |
|
| 1321 | 1321 | |
| 1322 | 1322 | $memberInfo->email_address = $newEmail; |
| 1323 | 1323 | |
@@ -1341,12 +1341,12 @@ discard block |
||
| 1341 | 1341 | $memberInfo = array(); |
| 1342 | 1342 | |
| 1343 | 1343 | global $lang; |
| 1344 | - if(is_array($member_config->signupForm)) |
|
| 1344 | + if (is_array($member_config->signupForm)) |
|
| 1345 | 1345 | { |
| 1346 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1347 | - foreach($member_config->signupForm as $form) |
|
| 1346 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1347 | + foreach ($member_config->signupForm as $form) |
|
| 1348 | 1348 | { |
| 1349 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1349 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1350 | 1350 | { |
| 1351 | 1351 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1352 | 1352 | } |
@@ -1361,25 +1361,25 @@ discard block |
||
| 1361 | 1361 | } |
| 1362 | 1362 | Context::set('memberInfo', $memberInfo); |
| 1363 | 1363 | |
| 1364 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1365 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1364 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1365 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1366 | 1366 | |
| 1367 | 1367 | Context::set('member_config', $member_config); |
| 1368 | 1368 | |
| 1369 | 1369 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1370 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1370 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1371 | 1371 | |
| 1372 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 1372 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 1373 | 1373 | Context::set('auth_url', $auth_url); |
| 1374 | 1374 | |
| 1375 | 1375 | $oTemplate = &TemplateHandler::getInstance(); |
| 1376 | 1376 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1377 | 1377 | // Send a mail |
| 1378 | 1378 | $oMail = new Mail(); |
| 1379 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1379 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1380 | 1380 | $oMail->setContent($content); |
| 1381 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1382 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1381 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1382 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1383 | 1383 | $oMail->send(); |
| 1384 | 1384 | } |
| 1385 | 1385 | |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | { |
| 1393 | 1393 | $site_module_info = Context::get('site_module_info'); |
| 1394 | 1394 | $logged_info = Context::get('logged_info'); |
| 1395 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1395 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
| 1396 | 1396 | |
| 1397 | 1397 | $oMemberModel = getModel('member'); |
| 1398 | 1398 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1411,13 +1411,13 @@ discard block |
||
| 1411 | 1411 | { |
| 1412 | 1412 | $site_module_info = Context::get('site_module_info'); |
| 1413 | 1413 | $logged_info = Context::get('logged_info'); |
| 1414 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1414 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
| 1415 | 1415 | |
| 1416 | 1416 | $args = new stdClass; |
| 1417 | - $args->site_srl= $site_module_info->site_srl; |
|
| 1417 | + $args->site_srl = $site_module_info->site_srl; |
|
| 1418 | 1418 | $args->member_srl = $logged_info->member_srl; |
| 1419 | 1419 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1420 | - if(!$output->toBool()) return $output; |
|
| 1420 | + if (!$output->toBool()) return $output; |
|
| 1421 | 1421 | $this->setMessage('success_deleted'); |
| 1422 | 1422 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1423 | 1423 | } |
@@ -1431,25 +1431,25 @@ discard block |
||
| 1431 | 1431 | */ |
| 1432 | 1432 | function setMemberConfig($args) |
| 1433 | 1433 | { |
| 1434 | - if(!$args->skin) $args->skin = "default"; |
|
| 1435 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1436 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1437 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1438 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1439 | - $args->enable_openid= 'N'; |
|
| 1440 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1441 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1442 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1443 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1444 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1445 | - $args->limit_day = (int)$args->limit_day; |
|
| 1434 | + if (!$args->skin) $args->skin = "default"; |
|
| 1435 | + if (!$args->colorset) $args->colorset = "white"; |
|
| 1436 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
| 1437 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1438 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
| 1439 | + $args->enable_openid = 'N'; |
|
| 1440 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
| 1441 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
| 1442 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
| 1443 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
| 1444 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1445 | + $args->limit_day = (int) $args->limit_day; |
|
| 1446 | 1446 | |
| 1447 | 1447 | $agreement = trim($args->agreement); |
| 1448 | 1448 | unset($args->agreement); |
| 1449 | 1449 | |
| 1450 | 1450 | $oModuleController = getController('module'); |
| 1451 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
| 1452 | - if(!$output->toBool()) return $output; |
|
| 1451 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
| 1452 | + if (!$output->toBool()) return $output; |
|
| 1453 | 1453 | |
| 1454 | 1454 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1455 | 1455 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1470,11 +1470,11 @@ discard block |
||
| 1470 | 1470 | $signature = trim(removeHackTag($signature)); |
| 1471 | 1471 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
| 1472 | 1472 | |
| 1473 | - $check_signature = trim(str_replace(array(' ',"\n","\r"),'',strip_tags($signature,'<img><object>'))); |
|
| 1473 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1474 | 1474 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1475 | 1475 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1476 | 1476 | |
| 1477 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1477 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
| 1478 | 1478 | |
| 1479 | 1479 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1480 | 1480 | FileHandler::makeDir($path); |
@@ -1503,15 +1503,15 @@ discard block |
||
| 1503 | 1503 | * |
| 1504 | 1504 | * @return Object |
| 1505 | 1505 | */ |
| 1506 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
| 1506 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
| 1507 | 1507 | { |
| 1508 | 1508 | $args = new stdClass(); |
| 1509 | 1509 | $args->member_srl = $member_srl; |
| 1510 | 1510 | $args->group_srl = $group_srl; |
| 1511 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1511 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1512 | 1512 | |
| 1513 | 1513 | // Add |
| 1514 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
| 1514 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
| 1515 | 1515 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
| 1516 | 1516 | |
| 1517 | 1517 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1531,18 +1531,18 @@ discard block |
||
| 1531 | 1531 | { |
| 1532 | 1532 | $obj = new stdClass; |
| 1533 | 1533 | $obj->site_srl = $args->site_srl; |
| 1534 | - $obj->member_srl = implode(',',$args->member_srl); |
|
| 1534 | + $obj->member_srl = implode(',', $args->member_srl); |
|
| 1535 | 1535 | |
| 1536 | 1536 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1537 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1537 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1538 | 1538 | |
| 1539 | 1539 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1540 | - if(!$output->toBool()) return $output; |
|
| 1540 | + if (!$output->toBool()) return $output; |
|
| 1541 | 1541 | |
| 1542 | 1542 | $inserted_members = array(); |
| 1543 | - foreach($args->member_srl as $key => $val) |
|
| 1543 | + foreach ($args->member_srl as $key => $val) |
|
| 1544 | 1544 | { |
| 1545 | - if($inserted_members[$val]) continue; |
|
| 1545 | + if ($inserted_members[$val]) continue; |
|
| 1546 | 1546 | $inserted_members[$val] = true; |
| 1547 | 1547 | |
| 1548 | 1548 | unset($obj); |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | $obj->site_srl = $args->site_srl; |
| 1553 | 1553 | $obj->regdate = $date[$obj->member_srl]; |
| 1554 | 1554 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1555 | - if(!$output->toBool()) return $output; |
|
| 1555 | + if (!$output->toBool()) return $output; |
|
| 1556 | 1556 | |
| 1557 | 1557 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1558 | 1558 | } |
@@ -1574,9 +1574,9 @@ discard block |
||
| 1574 | 1574 | // Get information of the key |
| 1575 | 1575 | $output = executeQuery('member.getAutologin', $args); |
| 1576 | 1576 | // If no information exists, delete a cookie |
| 1577 | - if(!$output->toBool() || !$output->data) |
|
| 1577 | + if (!$output->toBool() || !$output->data) |
|
| 1578 | 1578 | { |
| 1579 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/'); |
|
| 1579 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/'); |
|
| 1580 | 1580 | return; |
| 1581 | 1581 | } |
| 1582 | 1582 | |
@@ -1586,9 +1586,9 @@ discard block |
||
| 1586 | 1586 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
| 1587 | 1587 | $password = $output->data->password; |
| 1588 | 1588 | |
| 1589 | - if(!$user_id || !$password) |
|
| 1589 | + if (!$user_id || !$password) |
|
| 1590 | 1590 | { |
| 1591 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/'); |
|
| 1591 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/'); |
|
| 1592 | 1592 | return; |
| 1593 | 1593 | } |
| 1594 | 1594 | |
@@ -1598,7 +1598,7 @@ discard block |
||
| 1598 | 1598 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
| 1599 | 1599 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
| 1600 | 1600 | |
| 1601 | - if($check_key === substr($args->autologin_key, 32)) |
|
| 1601 | + if ($check_key === substr($args->autologin_key, 32)) |
|
| 1602 | 1602 | { |
| 1603 | 1603 | // Check change_password_date |
| 1604 | 1604 | $oModuleModel = getModel('module'); |
@@ -1606,12 +1606,12 @@ discard block |
||
| 1606 | 1606 | $limit_date = $member_config->change_password_date; |
| 1607 | 1607 | |
| 1608 | 1608 | // Check if change_password_date is set |
| 1609 | - if($limit_date > 0) |
|
| 1609 | + if ($limit_date > 0) |
|
| 1610 | 1610 | { |
| 1611 | 1611 | $oMemberModel = getModel('member'); |
| 1612 | 1612 | $columnList = array('member_srl', 'change_password_date'); |
| 1613 | 1613 | |
| 1614 | - if($config->identifier == 'user_id') |
|
| 1614 | + if ($config->identifier == 'user_id') |
|
| 1615 | 1615 | { |
| 1616 | 1616 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1617 | 1617 | } |
@@ -1620,7 +1620,7 @@ discard block |
||
| 1620 | 1620 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
| 1623 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
| 1624 | 1624 | $do_auto_login = true; |
| 1625 | 1625 | } |
| 1626 | 1626 | |
@@ -1631,14 +1631,14 @@ discard block |
||
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | - if($do_auto_login) |
|
| 1634 | + if ($do_auto_login) |
|
| 1635 | 1635 | { |
| 1636 | 1636 | $output = $this->doLogin($user_id); |
| 1637 | 1637 | } |
| 1638 | 1638 | else |
| 1639 | 1639 | { |
| 1640 | 1640 | executeQuery('member.deleteAutologin', $args); |
| 1641 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365, '/'); |
|
| 1641 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365, '/'); |
|
| 1642 | 1642 | } |
| 1643 | 1643 | } |
| 1644 | 1644 | |
@@ -1654,13 +1654,13 @@ discard block |
||
| 1654 | 1654 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1655 | 1655 | { |
| 1656 | 1656 | $user_id = strtolower($user_id); |
| 1657 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
| 1657 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
| 1658 | 1658 | // Call a trigger before log-in (before) |
| 1659 | 1659 | $trigger_obj = new stdClass(); |
| 1660 | 1660 | $trigger_obj->user_id = $user_id; |
| 1661 | 1661 | $trigger_obj->password = $password; |
| 1662 | 1662 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1663 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1663 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1664 | 1664 | // Create a member model object |
| 1665 | 1665 | $oMemberModel = getModel('member'); |
| 1666 | 1666 | |
@@ -1670,12 +1670,12 @@ discard block |
||
| 1670 | 1670 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1671 | 1671 | |
| 1672 | 1672 | // check identifier |
| 1673 | - if($config->identifier == 'email_address') |
|
| 1673 | + if ($config->identifier == 'email_address') |
|
| 1674 | 1674 | { |
| 1675 | 1675 | // Get user_id information |
| 1676 | 1676 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1677 | 1677 | // Set an invalid user if no value returned |
| 1678 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1678 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1679 | 1679 | |
| 1680 | 1680 | } |
| 1681 | 1681 | else |
@@ -1683,24 +1683,24 @@ discard block |
||
| 1683 | 1683 | // Get user_id information |
| 1684 | 1684 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1685 | 1685 | // Set an invalid user if no value returned |
| 1686 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1686 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 1690 | 1690 | $errorCount = $output->data->count; |
| 1691 | - if($errorCount >= $config->max_error_count) |
|
| 1691 | + if ($errorCount >= $config->max_error_count) |
|
| 1692 | 1692 | { |
| 1693 | 1693 | $last_update = strtotime($output->data->last_update); |
| 1694 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 1695 | - if($term < $config->max_error_count_time) |
|
| 1694 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 1695 | + if ($term < $config->max_error_count_time) |
|
| 1696 | 1696 | { |
| 1697 | 1697 | $term = $config->max_error_count_time - $term; |
| 1698 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1699 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1700 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1701 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1698 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1699 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
| 1700 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
| 1701 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
| 1702 | 1702 | |
| 1703 | - return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
| 1703 | + return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
| 1704 | 1704 | } |
| 1705 | 1705 | else |
| 1706 | 1706 | { |
@@ -1710,13 +1710,13 @@ discard block |
||
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | // Password Check |
| 1713 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1713 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1714 | 1714 | { |
| 1715 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
| 1715 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
| 1716 | 1716 | } |
| 1717 | 1717 | |
| 1718 | 1718 | // If denied == 'Y', notify |
| 1719 | - if($this->memberInfo->denied == 'Y') |
|
| 1719 | + if ($this->memberInfo->denied == 'Y') |
|
| 1720 | 1720 | { |
| 1721 | 1721 | $args->member_srl = $this->memberInfo->member_srl; |
| 1722 | 1722 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1724,12 +1724,12 @@ discard block |
||
| 1724 | 1724 | { |
| 1725 | 1725 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
| 1726 | 1726 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
| 1727 | - return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed')); |
|
| 1727 | + return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed')); |
|
| 1728 | 1728 | } |
| 1729 | - return new Object(-1,'msg_user_denied'); |
|
| 1729 | + return new Object(-1, 'msg_user_denied'); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | // Notify if denied_date is less than the current time |
| 1732 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 1732 | + if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new Object(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d"))); |
|
| 1733 | 1733 | // Update the latest login time |
| 1734 | 1734 | $args->member_srl = $this->memberInfo->member_srl; |
| 1735 | 1735 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1739,36 +1739,36 @@ discard block |
||
| 1739 | 1739 | |
| 1740 | 1740 | // Check if there is recoding table. |
| 1741 | 1741 | $oDB = &DB::getInstance(); |
| 1742 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1742 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1743 | 1743 | { |
| 1744 | 1744 | // check if there is login fail records. |
| 1745 | 1745 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 1746 | - if($output->data && $output->data->content) |
|
| 1746 | + if ($output->data && $output->data->content) |
|
| 1747 | 1747 | { |
| 1748 | 1748 | $title = Context::getLang('login_fail_report'); |
| 1749 | 1749 | $message = '<ul>'; |
| 1750 | 1750 | $content = unserialize($output->data->content); |
| 1751 | - if(count($content) > $config->max_error_count) |
|
| 1751 | + if (count($content) > $config->max_error_count) |
|
| 1752 | 1752 | { |
| 1753 | - foreach($content as $val) |
|
| 1753 | + foreach ($content as $val) |
|
| 1754 | 1754 | { |
| 1755 | - $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
| 1755 | + $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
| 1756 | 1756 | } |
| 1757 | 1757 | $message .= '</ul>'; |
| 1758 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
| 1758 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
| 1759 | 1759 | |
| 1760 | 1760 | //send message |
| 1761 | 1761 | $oCommunicationController = getController('communication'); |
| 1762 | 1762 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
| 1763 | 1763 | |
| 1764 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1764 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1765 | 1765 | { |
| 1766 | 1766 | $view_url = Context::getRequestUri(); |
| 1767 | - $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
| 1767 | + $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
| 1768 | 1768 | $oMail = new Mail(); |
| 1769 | 1769 | $oMail->setTitle($title); |
| 1770 | 1770 | $oMail->setContent($content); |
| 1771 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
| 1771 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
| 1772 | 1772 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
| 1773 | 1773 | $oMail->send(); |
| 1774 | 1774 | } |
@@ -1778,9 +1778,9 @@ discard block |
||
| 1778 | 1778 | } |
| 1779 | 1779 | // Call a trigger after successfully log-in (after) |
| 1780 | 1780 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1781 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1781 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1782 | 1782 | // When user checked to use auto-login |
| 1783 | - if($keep_signed) |
|
| 1783 | + if ($keep_signed) |
|
| 1784 | 1784 | { |
| 1785 | 1785 | // Key generate for auto login |
| 1786 | 1786 | $oPassword = new Password(); |
@@ -1792,12 +1792,12 @@ discard block |
||
| 1792 | 1792 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1793 | 1793 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1794 | 1794 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1795 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000, '/'); |
|
| 1795 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000, '/'); |
|
| 1796 | 1796 | } |
| 1797 | - if($this->memberInfo->is_admin == 'Y') |
|
| 1797 | + if ($this->memberInfo->is_admin == 'Y') |
|
| 1798 | 1798 | { |
| 1799 | 1799 | $oMemberAdminModel = getAdminModel('member'); |
| 1800 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1800 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1801 | 1801 | { |
| 1802 | 1802 | $_SESSION['denied_admin'] = 'Y'; |
| 1803 | 1803 | } |
@@ -1815,18 +1815,18 @@ discard block |
||
| 1815 | 1815 | { |
| 1816 | 1816 | $oMemberModel = getModel('member'); |
| 1817 | 1817 | // If your information came through the current session information to extract information from the users |
| 1818 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
| 1818 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
| 1819 | 1819 | { |
| 1820 | 1820 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
| 1821 | 1821 | // If you do not destroy the session Profile |
| 1822 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1822 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | $this->destroySessionInfo(); |
| 1825 | 1825 | return; |
| 1826 | 1826 | } |
| 1827 | 1827 | } |
| 1828 | 1828 | // Stop using the session id is destroyed |
| 1829 | - if($this->memberInfo->denied=='Y') |
|
| 1829 | + if ($this->memberInfo->denied == 'Y') |
|
| 1830 | 1830 | { |
| 1831 | 1831 | $this->destroySessionInfo(); |
| 1832 | 1832 | return; |
@@ -1856,10 +1856,10 @@ discard block |
||
| 1856 | 1856 | Context::set('logged_info', $this->memberInfo); |
| 1857 | 1857 | |
| 1858 | 1858 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
| 1859 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
| 1860 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1861 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1862 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1859 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
| 1860 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1861 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1862 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | /** |
@@ -1881,7 +1881,7 @@ discard block |
||
| 1881 | 1881 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1882 | 1882 | { |
| 1883 | 1883 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 1884 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1884 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1885 | 1885 | |
| 1886 | 1886 | $obj = new stdClass; |
| 1887 | 1887 | $obj->url = $url; |
@@ -1900,33 +1900,33 @@ discard block |
||
| 1900 | 1900 | { |
| 1901 | 1901 | // Call a trigger (before) |
| 1902 | 1902 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 1903 | - if(!$output->toBool()) return $output; |
|
| 1903 | + if (!$output->toBool()) return $output; |
|
| 1904 | 1904 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 1905 | 1905 | $oModuleModel = getModel('module'); |
| 1906 | 1906 | $config = $oModuleModel->getModuleConfig('member'); |
| 1907 | 1907 | |
| 1908 | 1908 | $logged_info = Context::get('logged_info'); |
| 1909 | 1909 | // If the date of the temporary restrictions limit further information on the date of |
| 1910 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 1910 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
| 1911 | 1911 | |
| 1912 | 1912 | $args->member_srl = getNextSequence(); |
| 1913 | 1913 | $args->list_order = -1 * $args->member_srl; |
| 1914 | 1914 | |
| 1915 | 1915 | // Execute insert or update depending on the value of member_srl |
| 1916 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1916 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1917 | 1917 | // Enter the user's identity changed to lowercase |
| 1918 | 1918 | else $args->user_id = strtolower($args->user_id); |
| 1919 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 1920 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 1919 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 1920 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 1921 | 1921 | |
| 1922 | 1922 | // Control of essential parameters |
| 1923 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 1924 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 1925 | - $args->allow_message= 'Y'; |
|
| 1923 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 1924 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 1925 | + $args->allow_message = 'Y'; |
|
| 1926 | 1926 | |
| 1927 | - if($logged_info->is_admin == 'Y') |
|
| 1927 | + if ($logged_info->is_admin == 'Y') |
|
| 1928 | 1928 | { |
| 1929 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 1929 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
| 1930 | 1930 | } |
| 1931 | 1931 | else |
| 1932 | 1932 | { |
@@ -1941,88 +1941,88 @@ discard block |
||
| 1941 | 1941 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1942 | 1942 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1943 | 1943 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1944 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 1945 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 1944 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 1945 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 1946 | 1946 | |
| 1947 | 1947 | // Create a model object |
| 1948 | 1948 | $oMemberModel = getModel('member'); |
| 1949 | 1949 | |
| 1950 | 1950 | // Check password strength |
| 1951 | - if($args->password && !$password_is_hashed) |
|
| 1951 | + if ($args->password && !$password_is_hashed) |
|
| 1952 | 1952 | { |
| 1953 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 1953 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 1954 | 1954 | { |
| 1955 | 1955 | $message = Context::getLang('about_password_strength'); |
| 1956 | 1956 | return new Object(-1, $message[$config->password_strength]); |
| 1957 | 1957 | } |
| 1958 | 1958 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1959 | 1959 | } |
| 1960 | - elseif(!$args->password) |
|
| 1960 | + elseif (!$args->password) |
|
| 1961 | 1961 | { |
| 1962 | 1962 | unset($args->password); |
| 1963 | 1963 | } |
| 1964 | 1964 | |
| 1965 | 1965 | // Check if ID is prohibited |
| 1966 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
| 1966 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
| 1967 | 1967 | { |
| 1968 | - return new Object(-1,'denied_user_id'); |
|
| 1968 | + return new Object(-1, 'denied_user_id'); |
|
| 1969 | 1969 | } |
| 1970 | 1970 | |
| 1971 | 1971 | // Check if ID is duplicate |
| 1972 | 1972 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 1973 | - if($member_srl) |
|
| 1973 | + if ($member_srl) |
|
| 1974 | 1974 | { |
| 1975 | - return new Object(-1,'msg_exists_user_id'); |
|
| 1975 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | 1978 | // Check if nickname is prohibited |
| 1979 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 1979 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 1980 | 1980 | { |
| 1981 | - return new Object(-1,'denied_nick_name'); |
|
| 1981 | + return new Object(-1, 'denied_nick_name'); |
|
| 1982 | 1982 | } |
| 1983 | 1983 | |
| 1984 | 1984 | // Check if nickname is duplicate |
| 1985 | 1985 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 1986 | - if($member_srl) |
|
| 1986 | + if ($member_srl) |
|
| 1987 | 1987 | { |
| 1988 | - return new Object(-1,'msg_exists_nick_name'); |
|
| 1988 | + return new Object(-1, 'msg_exists_nick_name'); |
|
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | 1991 | // Check if email address is duplicate |
| 1992 | 1992 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 1993 | - if($member_srl) |
|
| 1993 | + if ($member_srl) |
|
| 1994 | 1994 | { |
| 1995 | - return new Object(-1,'msg_exists_email_address'); |
|
| 1995 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | // Insert data into the DB |
| 1999 | 1999 | $args->list_order = -1 * $args->member_srl; |
| 2000 | 2000 | |
| 2001 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2002 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2001 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2002 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2003 | 2003 | |
| 2004 | 2004 | $oDB = &DB::getInstance(); |
| 2005 | 2005 | $oDB->begin(); |
| 2006 | 2006 | |
| 2007 | 2007 | $output = executeQuery('member.insertMember', $args); |
| 2008 | - if(!$output->toBool()) |
|
| 2008 | + if (!$output->toBool()) |
|
| 2009 | 2009 | { |
| 2010 | 2010 | $oDB->rollback(); |
| 2011 | 2011 | return $output; |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2014 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2015 | 2015 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2016 | 2016 | // If no value is entered the default group, the value of group registration |
| 2017 | - if(!$args->group_srl_list) |
|
| 2017 | + if (!$args->group_srl_list) |
|
| 2018 | 2018 | { |
| 2019 | 2019 | $columnList = array('site_srl', 'group_srl'); |
| 2020 | 2020 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
| 2021 | - if($default_group) |
|
| 2021 | + if ($default_group) |
|
| 2022 | 2022 | { |
| 2023 | 2023 | // Add to the default group |
| 2024 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
| 2025 | - if(!$output->toBool()) |
|
| 2024 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
| 2025 | + if (!$output->toBool()) |
|
| 2026 | 2026 | { |
| 2027 | 2027 | $oDB->rollback(); |
| 2028 | 2028 | return $output; |
@@ -2032,11 +2032,11 @@ discard block |
||
| 2032 | 2032 | } |
| 2033 | 2033 | else |
| 2034 | 2034 | { |
| 2035 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2035 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2036 | 2036 | { |
| 2037 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2037 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2038 | 2038 | |
| 2039 | - if(!$output->toBool()) |
|
| 2039 | + if (!$output->toBool()) |
|
| 2040 | 2040 | { |
| 2041 | 2041 | $oDB->rollback(); |
| 2042 | 2042 | return $output; |
@@ -2046,7 +2046,7 @@ discard block |
||
| 2046 | 2046 | |
| 2047 | 2047 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2048 | 2048 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
| 2049 | - if($args->denied == 'Y') |
|
| 2049 | + if ($args->denied == 'Y') |
|
| 2050 | 2050 | { |
| 2051 | 2051 | // Insert data into the authentication DB |
| 2052 | 2052 | $oPassword = new Password(); |
@@ -2058,7 +2058,7 @@ discard block |
||
| 2058 | 2058 | $auth_args->is_register = 'Y'; |
| 2059 | 2059 | |
| 2060 | 2060 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2061 | - if(!$output->toBool()) |
|
| 2061 | + if (!$output->toBool()) |
|
| 2062 | 2062 | { |
| 2063 | 2063 | $oDB->rollback(); |
| 2064 | 2064 | return $output; |
@@ -2066,10 +2066,10 @@ discard block |
||
| 2066 | 2066 | $this->_sendAuthMail($auth_args, $args); |
| 2067 | 2067 | } |
| 2068 | 2068 | // Call a trigger (after) |
| 2069 | - if($output->toBool()) |
|
| 2069 | + if ($output->toBool()) |
|
| 2070 | 2070 | { |
| 2071 | 2071 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
| 2072 | - if(!$trigger_output->toBool()) |
|
| 2072 | + if (!$trigger_output->toBool()) |
|
| 2073 | 2073 | { |
| 2074 | 2074 | $oDB->rollback(); |
| 2075 | 2075 | return $trigger_output; |
@@ -2091,41 +2091,41 @@ discard block |
||
| 2091 | 2091 | { |
| 2092 | 2092 | // Call a trigger (before) |
| 2093 | 2093 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2094 | - if(!$output->toBool()) return $output; |
|
| 2094 | + if (!$output->toBool()) return $output; |
|
| 2095 | 2095 | // Create a model object |
| 2096 | 2096 | $oMemberModel = getModel('member'); |
| 2097 | 2097 | |
| 2098 | 2098 | $logged_info = Context::get('logged_info'); |
| 2099 | 2099 | // Get what you want to modify the original information |
| 2100 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2100 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2101 | 2101 | // Control of essential parameters |
| 2102 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2103 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2102 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2103 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
| 2104 | 2104 | |
| 2105 | - if($logged_info->is_admin == 'Y') |
|
| 2105 | + if ($logged_info->is_admin == 'Y') |
|
| 2106 | 2106 | { |
| 2107 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2108 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2107 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2108 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2109 | 2109 | } |
| 2110 | 2110 | else |
| 2111 | 2111 | { |
| 2112 | 2112 | unset($args->is_admin); |
| 2113 | - if($is_admin == false) |
|
| 2113 | + if ($is_admin == false) |
|
| 2114 | 2114 | unset($args->denied); |
| 2115 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2115 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2116 | 2116 | { |
| 2117 | 2117 | return $this->stop('msg_invalid_request'); |
| 2118 | 2118 | } |
| 2119 | 2119 | } |
| 2120 | 2120 | |
| 2121 | 2121 | // Sanitize user ID, username, nickname, homepage, blog |
| 2122 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2122 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2123 | 2123 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2124 | 2124 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2125 | 2125 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2126 | 2126 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2127 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2128 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2127 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2128 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2129 | 2129 | |
| 2130 | 2130 | // check member identifier form |
| 2131 | 2131 | $config = $oMemberModel->getMemberConfig(); |
@@ -2134,56 +2134,56 @@ discard block |
||
| 2134 | 2134 | $orgMemberInfo = $output->data; |
| 2135 | 2135 | |
| 2136 | 2136 | // Check if email address or user ID is duplicate |
| 2137 | - if($config->identifier == 'email_address') |
|
| 2137 | + if ($config->identifier == 'email_address') |
|
| 2138 | 2138 | { |
| 2139 | 2139 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2140 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2140 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2141 | 2141 | { |
| 2142 | - return new Object(-1,'msg_exists_email_address'); |
|
| 2142 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 2143 | 2143 | } |
| 2144 | 2144 | $args->email_address = $orgMemberInfo->email_address; |
| 2145 | 2145 | } |
| 2146 | 2146 | else |
| 2147 | 2147 | { |
| 2148 | 2148 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2149 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2149 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2150 | 2150 | { |
| 2151 | - return new Object(-1,'msg_exists_user_id'); |
|
| 2151 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | $args->user_id = $orgMemberInfo->user_id; |
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | - if($logged_info->is_admin !== 'Y') |
|
| 2157 | + if ($logged_info->is_admin !== 'Y') |
|
| 2158 | 2158 | { |
| 2159 | 2159 | // Check if ID is prohibited |
| 2160 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2160 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2161 | 2161 | { |
| 2162 | - return new Object(-1,'denied_user_id'); |
|
| 2162 | + return new Object(-1, 'denied_user_id'); |
|
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | 2165 | // Check if nickname is prohibited |
| 2166 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2166 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2167 | 2167 | { |
| 2168 | 2168 | return new Object(-1, 'denied_nick_name'); |
| 2169 | 2169 | } |
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | // Check if ID is duplicate |
| 2173 | - if($args->user_id) |
|
| 2173 | + if ($args->user_id) |
|
| 2174 | 2174 | { |
| 2175 | 2175 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2176 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2176 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2177 | 2177 | { |
| 2178 | - return new Object(-1,'msg_exists_user_id'); |
|
| 2178 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 2179 | 2179 | } |
| 2180 | 2180 | } |
| 2181 | 2181 | |
| 2182 | 2182 | // Check if nickname is duplicate |
| 2183 | 2183 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2184 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2184 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2185 | 2185 | { |
| 2186 | - return new Object(-1,'msg_exists_nick_name'); |
|
| 2186 | + return new Object(-1, 'msg_exists_nick_name'); |
|
| 2187 | 2187 | } |
| 2188 | 2188 | |
| 2189 | 2189 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2192,9 +2192,9 @@ discard block |
||
| 2192 | 2192 | $oDB->begin(); |
| 2193 | 2193 | |
| 2194 | 2194 | // Check password strength |
| 2195 | - if($args->password) |
|
| 2195 | + if ($args->password) |
|
| 2196 | 2196 | { |
| 2197 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2197 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2198 | 2198 | { |
| 2199 | 2199 | $message = Context::getLang('about_password_strength'); |
| 2200 | 2200 | return new Object(-1, $message[$config->password_strength]); |
@@ -2206,40 +2206,40 @@ discard block |
||
| 2206 | 2206 | $args->password = $orgMemberInfo->password; |
| 2207 | 2207 | } |
| 2208 | 2208 | |
| 2209 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2210 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2211 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2212 | - if(!$args->description) $args->description = ''; |
|
| 2213 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2209 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2210 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2211 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2212 | + if (!$args->description) $args->description = ''; |
|
| 2213 | + if (!$args->birthday) $args->birthday = ''; |
|
| 2214 | 2214 | |
| 2215 | 2215 | $output = executeQuery('member.updateMember', $args); |
| 2216 | 2216 | |
| 2217 | - if(!$output->toBool()) |
|
| 2217 | + if (!$output->toBool()) |
|
| 2218 | 2218 | { |
| 2219 | 2219 | $oDB->rollback(); |
| 2220 | 2220 | return $output; |
| 2221 | 2221 | } |
| 2222 | 2222 | |
| 2223 | - if($args->group_srl_list) |
|
| 2223 | + if ($args->group_srl_list) |
|
| 2224 | 2224 | { |
| 2225 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2225 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2226 | 2226 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2227 | 2227 | // If the group information, group information changes |
| 2228 | - if(count($group_srl_list) > 0) |
|
| 2228 | + if (count($group_srl_list) > 0) |
|
| 2229 | 2229 | { |
| 2230 | 2230 | $args->site_srl = 0; |
| 2231 | 2231 | // One of its members to delete all the group |
| 2232 | 2232 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2233 | - if(!$output->toBool()) |
|
| 2233 | + if (!$output->toBool()) |
|
| 2234 | 2234 | { |
| 2235 | 2235 | $oDB->rollback(); |
| 2236 | 2236 | return $output; |
| 2237 | 2237 | } |
| 2238 | 2238 | // Enter one of the loop a |
| 2239 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2239 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2240 | 2240 | { |
| 2241 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2242 | - if(!$output->toBool()) |
|
| 2241 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2242 | + if (!$output->toBool()) |
|
| 2243 | 2243 | { |
| 2244 | 2244 | $oDB->rollback(); |
| 2245 | 2245 | return $output; |
@@ -2251,9 +2251,9 @@ discard block |
||
| 2251 | 2251 | } |
| 2252 | 2252 | } |
| 2253 | 2253 | // Call a trigger (after) |
| 2254 | - if($output->toBool()) { |
|
| 2254 | + if ($output->toBool()) { |
|
| 2255 | 2255 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
| 2256 | - if(!$trigger_output->toBool()) |
|
| 2256 | + if (!$trigger_output->toBool()) |
|
| 2257 | 2257 | { |
| 2258 | 2258 | $oDB->rollback(); |
| 2259 | 2259 | return $trigger_output; |
@@ -2266,7 +2266,7 @@ discard block |
||
| 2266 | 2266 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2267 | 2267 | |
| 2268 | 2268 | // Save Session |
| 2269 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2269 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2270 | 2270 | $logged_info = Context::get('logged_info'); |
| 2271 | 2271 | |
| 2272 | 2272 | $output->add('member_srl', $args->member_srl); |
@@ -2278,14 +2278,14 @@ discard block |
||
| 2278 | 2278 | */ |
| 2279 | 2279 | function updateMemberPassword($args) |
| 2280 | 2280 | { |
| 2281 | - if($args->password) |
|
| 2281 | + if ($args->password) |
|
| 2282 | 2282 | { |
| 2283 | 2283 | |
| 2284 | 2284 | // check password strength |
| 2285 | 2285 | $oMemberModel = getModel('member'); |
| 2286 | 2286 | $config = $oMemberModel->getMemberConfig(); |
| 2287 | 2287 | |
| 2288 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2288 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2289 | 2289 | { |
| 2290 | 2290 | $message = Context::getLang('about_password_strength'); |
| 2291 | 2291 | return new Object(-1, $message[$config->password_strength]); |
@@ -2293,13 +2293,13 @@ discard block |
||
| 2293 | 2293 | |
| 2294 | 2294 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2295 | 2295 | } |
| 2296 | - else if($args->hashed_password) |
|
| 2296 | + else if ($args->hashed_password) |
|
| 2297 | 2297 | { |
| 2298 | 2298 | $args->password = $args->hashed_password; |
| 2299 | 2299 | } |
| 2300 | 2300 | |
| 2301 | 2301 | $output = executeQuery('member.updateMemberPassword', $args); |
| 2302 | - if($output->toBool()) |
|
| 2302 | + if ($output->toBool()) |
|
| 2303 | 2303 | { |
| 2304 | 2304 | $result = executeQuery('member.updateChangePasswordDate', $args); |
| 2305 | 2305 | } |
@@ -2318,18 +2318,18 @@ discard block |
||
| 2318 | 2318 | $trigger_obj = new stdClass(); |
| 2319 | 2319 | $trigger_obj->member_srl = $member_srl; |
| 2320 | 2320 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2321 | - if(!$output->toBool()) return $output; |
|
| 2321 | + if (!$output->toBool()) return $output; |
|
| 2322 | 2322 | // Create a model object |
| 2323 | 2323 | $oMemberModel = getModel('member'); |
| 2324 | 2324 | // Bringing the user's information |
| 2325 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2325 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2326 | 2326 | { |
| 2327 | 2327 | $columnList = array('member_srl', 'is_admin'); |
| 2328 | 2328 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2329 | 2329 | } |
| 2330 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
| 2330 | + if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
| 2331 | 2331 | // If managers can not be deleted |
| 2332 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2332 | + if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2333 | 2333 | |
| 2334 | 2334 | $oDB = &DB::getInstance(); |
| 2335 | 2335 | $oDB->begin(); |
@@ -2338,7 +2338,7 @@ discard block |
||
| 2338 | 2338 | $args->member_srl = $member_srl; |
| 2339 | 2339 | // Delete the entries in member_auth_mail |
| 2340 | 2340 | $output = executeQuery('member.deleteAuthMail', $args); |
| 2341 | - if(!$output->toBool()) |
|
| 2341 | + if (!$output->toBool()) |
|
| 2342 | 2342 | { |
| 2343 | 2343 | $oDB->rollback(); |
| 2344 | 2344 | return $output; |
@@ -2353,23 +2353,23 @@ discard block |
||
| 2353 | 2353 | */ |
| 2354 | 2354 | // Delete the entries in member_group_member |
| 2355 | 2355 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2356 | - if(!$output->toBool()) |
|
| 2356 | + if (!$output->toBool()) |
|
| 2357 | 2357 | { |
| 2358 | 2358 | $oDB->rollback(); |
| 2359 | 2359 | return $output; |
| 2360 | 2360 | } |
| 2361 | 2361 | // member removed from the table |
| 2362 | 2362 | $output = executeQuery('member.deleteMember', $args); |
| 2363 | - if(!$output->toBool()) |
|
| 2363 | + if (!$output->toBool()) |
|
| 2364 | 2364 | { |
| 2365 | 2365 | $oDB->rollback(); |
| 2366 | 2366 | return $output; |
| 2367 | 2367 | } |
| 2368 | 2368 | // Call a trigger (after) |
| 2369 | - if($output->toBool()) |
|
| 2369 | + if ($output->toBool()) |
|
| 2370 | 2370 | { |
| 2371 | 2371 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
| 2372 | - if(!$trigger_output->toBool()) |
|
| 2372 | + if (!$trigger_output->toBool()) |
|
| 2373 | 2373 | { |
| 2374 | 2374 | $oDB->rollback(); |
| 2375 | 2375 | return $trigger_output; |
@@ -2393,23 +2393,23 @@ discard block |
||
| 2393 | 2393 | */ |
| 2394 | 2394 | function destroySessionInfo() |
| 2395 | 2395 | { |
| 2396 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2396 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
| 2397 | 2397 | |
| 2398 | 2398 | $memberInfo = Context::get('logged_info'); |
| 2399 | 2399 | $memberSrl = $memberInfo->member_srl; |
| 2400 | 2400 | |
| 2401 | - foreach($_SESSION as $key => $val) |
|
| 2401 | + foreach ($_SESSION as $key => $val) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | $_SESSION[$key] = ''; |
| 2404 | 2404 | } |
| 2405 | 2405 | |
| 2406 | 2406 | session_destroy(); |
| 2407 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000, '/'); |
|
| 2408 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000, '/'); |
|
| 2409 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000, '/'); |
|
| 2407 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000, '/'); |
|
| 2408 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000, '/'); |
|
| 2409 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000, '/'); |
|
| 2410 | 2410 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000, '/'); |
| 2411 | 2411 | |
| 2412 | - if($memberSrl || $_COOKIE['xeak']) |
|
| 2412 | + if ($memberSrl || $_COOKIE['xeak']) |
|
| 2413 | 2413 | { |
| 2414 | 2414 | $args = new stdClass(); |
| 2415 | 2415 | $args->member_srl = $memberSrl; |
@@ -2425,22 +2425,22 @@ discard block |
||
| 2425 | 2425 | $pointGroup = $pointModuleConfig->point_group; |
| 2426 | 2426 | |
| 2427 | 2427 | $levelGroup = array(); |
| 2428 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
| 2428 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
| 2429 | 2429 | { |
| 2430 | 2430 | $levelGroup = array_flip($pointGroup); |
| 2431 | 2431 | ksort($levelGroup); |
| 2432 | 2432 | } |
| 2433 | 2433 | $maxLevel = 0; |
| 2434 | 2434 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2435 | - if(count($resultGroup) > 0) |
|
| 2435 | + if (count($resultGroup) > 0) |
|
| 2436 | 2436 | $maxLevel = max(array_flip($resultGroup)); |
| 2437 | 2437 | |
| 2438 | - if($maxLevel > 0) |
|
| 2438 | + if ($maxLevel > 0) |
|
| 2439 | 2439 | { |
| 2440 | 2440 | $oPointModel = getModel('point'); |
| 2441 | 2441 | $originPoint = $oPointModel->getPoint($memberSrl); |
| 2442 | 2442 | |
| 2443 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2443 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2444 | 2444 | { |
| 2445 | 2445 | $oPointController = getController('point'); |
| 2446 | 2446 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2450,18 +2450,18 @@ discard block |
||
| 2450 | 2450 | |
| 2451 | 2451 | function procMemberModifyEmailAddress() |
| 2452 | 2452 | { |
| 2453 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2453 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2454 | 2454 | |
| 2455 | 2455 | $member_info = Context::get('logged_info'); |
| 2456 | 2456 | $newEmail = Context::get('email_address'); |
| 2457 | 2457 | |
| 2458 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2458 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2459 | 2459 | |
| 2460 | 2460 | $oMemberModel = getModel('member'); |
| 2461 | 2461 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2462 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
| 2462 | + if ($member_srl) return new Object(-1, 'msg_exists_email_address'); |
|
| 2463 | 2463 | |
| 2464 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2464 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2465 | 2465 | { |
| 2466 | 2466 | return $this->stop('msg_invalid_request'); |
| 2467 | 2467 | } |
@@ -2477,7 +2477,7 @@ discard block |
||
| 2477 | 2477 | $oDB = &DB::getInstance(); |
| 2478 | 2478 | $oDB->begin(); |
| 2479 | 2479 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2480 | - if(!$output->toBool()) |
|
| 2480 | + if (!$output->toBool()) |
|
| 2481 | 2481 | { |
| 2482 | 2482 | $oDB->rollback(); |
| 2483 | 2483 | return $output; |
@@ -2487,7 +2487,7 @@ discard block |
||
| 2487 | 2487 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2488 | 2488 | |
| 2489 | 2489 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2490 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2490 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2491 | 2491 | |
| 2492 | 2492 | global $lang; |
| 2493 | 2493 | |
@@ -2499,17 +2499,17 @@ discard block |
||
| 2499 | 2499 | |
| 2500 | 2500 | Context::set('newEmail', $newEmail); |
| 2501 | 2501 | |
| 2502 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 2502 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 2503 | 2503 | Context::set('auth_url', $auth_url); |
| 2504 | 2504 | |
| 2505 | 2505 | $oTemplate = &TemplateHandler::getInstance(); |
| 2506 | 2506 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
| 2507 | 2507 | |
| 2508 | 2508 | $oMail = new Mail(); |
| 2509 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
| 2509 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
| 2510 | 2510 | $oMail->setContent($content); |
| 2511 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 2512 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
| 2511 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 2512 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
| 2513 | 2513 | $result = $oMail->send(); |
| 2514 | 2514 | |
| 2515 | 2515 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2523,16 +2523,16 @@ discard block |
||
| 2523 | 2523 | { |
| 2524 | 2524 | $member_srl = Context::get('member_srl'); |
| 2525 | 2525 | $auth_key = Context::get('auth_key'); |
| 2526 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2526 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2527 | 2527 | |
| 2528 | 2528 | // Test logs for finding password by user_id and authkey |
| 2529 | 2529 | $args = new stdClass; |
| 2530 | 2530 | $args->member_srl = $member_srl; |
| 2531 | 2531 | $args->auth_key = $auth_key; |
| 2532 | 2532 | $output = executeQuery('member.getAuthMail', $args); |
| 2533 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2533 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2534 | 2534 | { |
| 2535 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2535 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2536 | 2536 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2537 | 2537 | } |
| 2538 | 2538 | |
@@ -2541,10 +2541,10 @@ discard block |
||
| 2541 | 2541 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2542 | 2542 | |
| 2543 | 2543 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2544 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2544 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2545 | 2545 | |
| 2546 | 2546 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2547 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
| 2547 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2548 | 2548 | |
| 2549 | 2549 | $this->_clearMemberCache($args->member_srl); |
| 2550 | 2550 | |
@@ -2562,7 +2562,7 @@ discard block |
||
| 2562 | 2562 | **/ |
| 2563 | 2563 | function triggerGetDocumentMenu(&$menu_list) |
| 2564 | 2564 | { |
| 2565 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2565 | + if (!Context::get('is_logged')) return new Object(); |
|
| 2566 | 2566 | |
| 2567 | 2567 | $logged_info = Context::get('logged_info'); |
| 2568 | 2568 | $document_srl = Context::get('target_srl'); |
@@ -2573,12 +2573,12 @@ discard block |
||
| 2573 | 2573 | $member_srl = $oDocument->get('member_srl'); |
| 2574 | 2574 | $module_srl = $oDocument->get('module_srl'); |
| 2575 | 2575 | |
| 2576 | - if(!$member_srl) return new Object(); |
|
| 2577 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2576 | + if (!$member_srl) return new Object(); |
|
| 2577 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
| 2578 | 2578 | |
| 2579 | 2579 | $oDocumentController = getController('document'); |
| 2580 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2581 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2580 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2581 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2582 | 2582 | |
| 2583 | 2583 | return new Object(); |
| 2584 | 2584 | } |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | **/ |
| 2593 | 2593 | function triggerGetCommentMenu(&$menu_list) |
| 2594 | 2594 | { |
| 2595 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2595 | + if (!Context::get('is_logged')) return new Object(); |
|
| 2596 | 2596 | |
| 2597 | 2597 | $logged_info = Context::get('logged_info'); |
| 2598 | 2598 | $comment_srl = Context::get('target_srl'); |
@@ -2603,12 +2603,12 @@ discard block |
||
| 2603 | 2603 | $module_srl = $oComment->get('module_srl'); |
| 2604 | 2604 | $member_srl = $oComment->get('member_srl'); |
| 2605 | 2605 | |
| 2606 | - if(!$member_srl) return new Object(); |
|
| 2607 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2606 | + if (!$member_srl) return new Object(); |
|
| 2607 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
| 2608 | 2608 | |
| 2609 | 2609 | $oCommentController = getController('comment'); |
| 2610 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2611 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2610 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2611 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2612 | 2612 | |
| 2613 | 2613 | return new Object(); |
| 2614 | 2614 | } |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | **/ |
| 2621 | 2621 | function procMemberSpammerManage() |
| 2622 | 2622 | { |
| 2623 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 2623 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 2624 | 2624 | |
| 2625 | 2625 | $logged_info = Context::get('logged_info'); |
| 2626 | 2626 | $member_srl = Context::get('member_srl'); |
@@ -2628,7 +2628,7 @@ discard block |
||
| 2628 | 2628 | $cnt_loop = Context::get('cnt_loop'); |
| 2629 | 2629 | $proc_type = Context::get('proc_type'); |
| 2630 | 2630 | $isMoveToTrash = true; |
| 2631 | - if($proc_type == "delete") |
|
| 2631 | + if ($proc_type == "delete") |
|
| 2632 | 2632 | $isMoveToTrash = false; |
| 2633 | 2633 | |
| 2634 | 2634 | // check grant |
@@ -2637,7 +2637,7 @@ discard block |
||
| 2637 | 2637 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2638 | 2638 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2639 | 2639 | |
| 2640 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 2640 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
| 2641 | 2641 | |
| 2642 | 2642 | $proc_msg = ""; |
| 2643 | 2643 | |
@@ -2646,10 +2646,10 @@ discard block |
||
| 2646 | 2646 | |
| 2647 | 2647 | // delete or trash destination |
| 2648 | 2648 | // proc member |
| 2649 | - if($cnt_loop == 1) |
|
| 2649 | + if ($cnt_loop == 1) |
|
| 2650 | 2650 | $this->_spammerMember($member_srl); |
| 2651 | 2651 | // proc document and comment |
| 2652 | - elseif($cnt_loop>1) |
|
| 2652 | + elseif ($cnt_loop > 1) |
|
| 2653 | 2653 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
| 2654 | 2654 | |
| 2655 | 2655 | // get destination count |
@@ -2658,11 +2658,11 @@ discard block |
||
| 2658 | 2658 | |
| 2659 | 2659 | $total_count = Context::get('total_count'); |
| 2660 | 2660 | $remain_count = $cnt_document + $cnt_comment; |
| 2661 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 2661 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
| 2662 | 2662 | |
| 2663 | 2663 | // get progress percent |
| 2664 | - if($total_count > 0) |
|
| 2665 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2664 | + if ($total_count > 0) |
|
| 2665 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
| 2666 | 2666 | else |
| 2667 | 2667 | $progress = 100; |
| 2668 | 2668 | |
@@ -2686,7 +2686,7 @@ discard block |
||
| 2686 | 2686 | **/ |
| 2687 | 2687 | private function _spammerMember($member_srl) { |
| 2688 | 2688 | $logged_info = Context::get('logged_info'); |
| 2689 | - $spam_description = trim( Context::get('spam_description') ); |
|
| 2689 | + $spam_description = trim(Context::get('spam_description')); |
|
| 2690 | 2690 | |
| 2691 | 2691 | $oMemberModel = getModel('member'); |
| 2692 | 2692 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2705,10 +2705,10 @@ discard block |
||
| 2705 | 2705 | $args->user_id = $member_info->user_id; |
| 2706 | 2706 | $args->nick_name = $member_info->nick_name; |
| 2707 | 2707 | $args->denied = "Y"; |
| 2708 | - $args->description = trim( $member_info->description ); |
|
| 2709 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 2708 | + $args->description = trim($member_info->description); |
|
| 2709 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
| 2710 | 2710 | |
| 2711 | - $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
|
| 2711 | + $args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]"; |
|
| 2712 | 2712 | |
| 2713 | 2713 | $output = $this->updateMember($args, true); |
| 2714 | 2714 | |
@@ -2737,21 +2737,21 @@ discard block |
||
| 2737 | 2737 | // 1. proc comment, 2. proc document |
| 2738 | 2738 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
| 2739 | 2739 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
| 2740 | - if($cnt_comment > 0) |
|
| 2740 | + if ($cnt_comment > 0) |
|
| 2741 | 2741 | { |
| 2742 | 2742 | $columnList = array(); |
| 2743 | 2743 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2744 | - if($commentList) { |
|
| 2745 | - foreach($commentList as $v) { |
|
| 2744 | + if ($commentList) { |
|
| 2745 | + foreach ($commentList as $v) { |
|
| 2746 | 2746 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
| 2747 | 2747 | } |
| 2748 | 2748 | } |
| 2749 | - } elseif($cnt_document > 0) { |
|
| 2749 | + } elseif ($cnt_document > 0) { |
|
| 2750 | 2750 | $columnList = array(); |
| 2751 | 2751 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2752 | - if($documentList) { |
|
| 2753 | - foreach($documentList as $v) { |
|
| 2754 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2752 | + if ($documentList) { |
|
| 2753 | + foreach ($documentList as $v) { |
|
| 2754 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2755 | 2755 | else $oDocumentController->deleteDocument($v->document_srl); |
| 2756 | 2756 | } |
| 2757 | 2757 | } |
@@ -2763,24 +2763,24 @@ discard block |
||
| 2763 | 2763 | function _clearMemberCache($member_srl, $site_srl = 0) |
| 2764 | 2764 | { |
| 2765 | 2765 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 2766 | - if($oCacheHandler->isSupport()) |
|
| 2766 | + if ($oCacheHandler->isSupport()) |
|
| 2767 | 2767 | { |
| 2768 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
| 2768 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 2769 | 2769 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2770 | 2770 | $oCacheHandler->delete($cache_key); |
| 2771 | 2771 | |
| 2772 | - if($site_srl !== 0) |
|
| 2772 | + if ($site_srl !== 0) |
|
| 2773 | 2773 | { |
| 2774 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 2774 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 2775 | 2775 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2776 | 2776 | $oCacheHandler->delete($cache_key); |
| 2777 | 2777 | } |
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | 2780 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 2781 | - if($oCacheHandler->isSupport()) |
|
| 2781 | + if ($oCacheHandler->isSupport()) |
|
| 2782 | 2782 | { |
| 2783 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 2783 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 2784 | 2784 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2785 | 2785 | $oCacheHandler->delete($cache_key); |
| 2786 | 2786 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * Search option to use in admin page |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - var $search_option = array('title','content','title_content','user_name',); // /< Search options |
|
| 20 | + var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options |
|
| 21 | 21 | /** |
| 22 | 22 | * Status list |
| 23 | 23 | * @var array |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | $oModuleController = getController('module'); |
| 35 | 35 | |
| 36 | 36 | $oDB = &DB::getInstance(); |
| 37 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 38 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 39 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 40 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 41 | - $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 42 | - $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 43 | - $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); |
|
| 44 | - $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); |
|
| 45 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 37 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 38 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 39 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 40 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 41 | + $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 42 | + $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 43 | + $oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count")); |
|
| 44 | + $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true); |
|
| 45 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 46 | 46 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 47 | 47 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 48 | 48 | |
| 49 | 49 | // 2009. 01. 29 Added a trigger for additional setup |
| 50 | 50 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 51 | 51 | |
| 52 | - if(!is_dir('./files/cache/tmp')) |
|
| 52 | + if (!is_dir('./files/cache/tmp')) |
|
| 53 | 53 | { |
| 54 | 54 | FileHandler::makeDir('./files/cache/tmp'); |
| 55 | 55 | } |
@@ -66,68 +66,68 @@ discard block |
||
| 66 | 66 | $oModuleModel = getModel('module'); |
| 67 | 67 | |
| 68 | 68 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 69 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 69 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
| 70 | 70 | |
| 71 | 71 | // 2007. 8. 23: create a clustered index in the document table |
| 72 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 73 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 74 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 75 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 72 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
| 73 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
| 74 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
| 75 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
| 76 | 76 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 77 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 77 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 78 | 78 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 79 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 80 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 81 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 79 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
| 80 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
| 81 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
| 82 | 82 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 83 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 83 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
| 84 | 84 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 85 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 85 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
| 86 | 86 | |
| 87 | 87 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 88 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 88 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
| 89 | 89 | // 2008. 04. 23 Add a column(blamed_count) |
| 90 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 91 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 92 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 90 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 91 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
| 92 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 93 | 93 | // 2008-12-15 Add a column(color) |
| 94 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 94 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 98 | 98 | */ |
| 99 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 99 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
| 100 | 100 | |
| 101 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 101 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 102 | 102 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 103 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 103 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
| 104 | 104 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 105 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 105 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 106 | 106 | |
| 107 | 107 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 108 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 109 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 108 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
| 109 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
| 110 | 110 | |
| 111 | 111 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 112 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 112 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 113 | 113 | |
| 114 | 114 | //2011. 04. 07 adding description column to document categories |
| 115 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 115 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
| 116 | 116 | |
| 117 | 117 | //2011. 05. 23 adding status column to document |
| 118 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 118 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 119 | 119 | |
| 120 | 120 | //2011. 06. 07 check comment status update |
| 121 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 121 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 122 | 122 | |
| 123 | 123 | // 2011. 10. 25 status index check |
| 124 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 124 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 125 | 125 | |
| 126 | 126 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 127 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 127 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 128 | 128 | |
| 129 | 129 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 130 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 130 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 131 | 131 | |
| 132 | 132 | return false; |
| 133 | 133 | } |
@@ -143,98 +143,98 @@ discard block |
||
| 143 | 143 | $oModuleController = getController('module'); |
| 144 | 144 | |
| 145 | 145 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 146 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
| 146 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
| 147 | 147 | { |
| 148 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
| 148 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // 2007. 8. 23: create a clustered index in the document table |
| 152 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
| 152 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
| 153 | 153 | { |
| 154 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 154 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
| 157 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
| 158 | 158 | { |
| 159 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 159 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
| 162 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
| 163 | 163 | { |
| 164 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 164 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
| 167 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
| 168 | 168 | { |
| 169 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 169 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 170 | 170 | } |
| 171 | 171 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 172 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 172 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 173 | 173 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 174 | 174 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 175 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 176 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 177 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 175 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
| 176 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
| 177 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
| 178 | 178 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 179 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 179 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 180 | 180 | |
| 181 | 181 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 182 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 182 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
| 183 | 183 | |
| 184 | 184 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 185 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 185 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 186 | 186 | // 2008. 04. 23 Add a column(blamed count) |
| 187 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 187 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 188 | 188 | { |
| 189 | 189 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
| 190 | 190 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
| 193 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
| 194 | 194 | { |
| 195 | 195 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 198 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 199 | 199 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
| 200 | 200 | |
| 201 | 201 | |
| 202 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 202 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
| 203 | 203 | |
| 204 | 204 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 205 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 205 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
| 206 | 206 | |
| 207 | 207 | // 2009. 01. 29 Added a trigger for additional setup |
| 208 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 208 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 209 | 209 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 210 | 210 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 211 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
| 211 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
| 212 | 212 | { |
| 213 | 213 | $db_info = Context::getDBInfo(); |
| 214 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
| 214 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
| 215 | 215 | $obj->lang_code = $db_info->lang_type; |
| 216 | 216 | executeQuery('document.updateDocumentsLangCode', $obj); |
| 217 | 217 | } |
| 218 | 218 | // 2009. 03. 11 Check the index in the document_extra_vars table |
| 219 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 219 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 220 | 220 | { |
| 221 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 221 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 224 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 225 | 225 | { |
| 226 | 226 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // 2009. 03. 19: Add a column(eid) |
| 230 | 230 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
| 231 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
| 231 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
| 232 | 232 | { |
| 233 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
| 233 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
| 234 | 234 | |
| 235 | 235 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
| 236 | - if($output->toBool() && $output->data && count($output->data)) { |
|
| 237 | - foreach($output->data as $extra_keys) { |
|
| 236 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
| 237 | + foreach ($output->data as $extra_keys) { |
|
| 238 | 238 | $args->module_srl = $extra_keys->module_srl; |
| 239 | 239 | $args->var_idx = $extra_keys->idx; |
| 240 | 240 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -243,14 +243,14 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
| 246 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
| 247 | 247 | { |
| 248 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
| 248 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
| 249 | 249 | $obj->var_idx = '-1,-2'; |
| 250 | 250 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
| 251 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 251 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 252 | 252 | { |
| 253 | - foreach($output->data as $extra_vars) |
|
| 253 | + foreach ($output->data as $extra_vars) |
|
| 254 | 254 | { |
| 255 | 255 | $args->module_srl = $extra_vars->module_srl; |
| 256 | 256 | $args->var_idx = $extra_vars->idx; |
@@ -261,16 +261,16 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 264 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 264 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 265 | 265 | { |
| 266 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
| 266 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | //2011. 04. 07 adding description column to document categories |
| 270 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 270 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
| 271 | 271 | |
| 272 | 272 | //2011. 05. 23 adding status column to document |
| 273 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
| 273 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
| 274 | 274 | { |
| 275 | 275 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
| 276 | 276 | $args->is_secret = 'Y'; |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // 2011. 09. 08 drop column document is_secret |
| 281 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 281 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 282 | 282 | $oDB->dropColumn('documents', 'is_secret'); |
| 283 | 283 | |
| 284 | 284 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 285 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 285 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 286 | 286 | { |
| 287 | 287 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
| 288 | 288 | |
@@ -304,28 +304,28 @@ discard block |
||
| 304 | 304 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 307 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 308 | 308 | $oDB->dropColumn('documents', 'allow_comment'); |
| 309 | 309 | |
| 310 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 310 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 311 | 311 | $oDB->dropColumn('documents', 'lock_comment'); |
| 312 | 312 | |
| 313 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 314 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 313 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 314 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
| 315 | 315 | |
| 316 | 316 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 317 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 317 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 318 | 318 | { |
| 319 | 319 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 323 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 323 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 324 | 324 | { |
| 325 | 325 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return new Object(0,'success_updated'); |
|
| 328 | + return new Object(0, 'success_updated'); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | function recompileCache() |
| 336 | 336 | { |
| 337 | - if(!is_dir('./files/cache/tmp')) |
|
| 337 | + if (!is_dir('./files/cache/tmp')) |
|
| 338 | 338 | { |
| 339 | 339 | FileHandler::makeDir('./files/cache/tmp'); |
| 340 | 340 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | function getConfigStatus($key) |
| 366 | 366 | { |
| 367 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 367 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 368 | 368 | else $this->getDefaultStatus(); |
| 369 | 369 | } |
| 370 | 370 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
| 3 | 3 | |
| 4 | -require_once(_XE_PATH_ . 'modules/comment/comment.item.php'); |
|
| 4 | +require_once(_XE_PATH_.'modules/comment/comment.item.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * comment |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // 2008. 02. 22 add comment setting when a new module added |
| 37 | 37 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
| 38 | 38 | |
| 39 | - if(!is_dir('./files/cache/tmp')) |
|
| 39 | + if (!is_dir('./files/cache/tmp')) |
|
| 40 | 40 | { |
| 41 | 41 | FileHandler::makeDir('./files/cache/tmp'); |
| 42 | 42 | } |
@@ -53,55 +53,55 @@ discard block |
||
| 53 | 53 | $oDB = DB::getInstance(); |
| 54 | 54 | $oModuleModel = getModel('module'); |
| 55 | 55 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
| 56 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 56 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 57 | 57 | { |
| 58 | 58 | return TRUE; |
| 59 | 59 | } |
| 60 | 60 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
| 61 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 61 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 62 | 62 | { |
| 63 | 63 | return TRUE; |
| 64 | 64 | } |
| 65 | 65 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
| 66 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
| 66 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
| 67 | 67 | { |
| 68 | 68 | return TRUE; |
| 69 | 69 | } |
| 70 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
| 70 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
| 71 | 71 | { |
| 72 | 72 | return TRUE; |
| 73 | 73 | } |
| 74 | 74 | // 2008. 02. 22 add comment setting when a new module added |
| 75 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 75 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 76 | 76 | { |
| 77 | 77 | return TRUE; |
| 78 | 78 | } |
| 79 | 79 | // 2008. 05. 14 add a column for blamed count |
| 80 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 80 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 81 | 81 | { |
| 82 | 82 | return TRUE; |
| 83 | 83 | } |
| 84 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 84 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 85 | 85 | { |
| 86 | 86 | return TRUE; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 89 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 90 | 90 | { |
| 91 | 91 | return TRUE; |
| 92 | 92 | } |
| 93 | 93 | //2012. 02. 24 add comment published status column and index |
| 94 | - if(!$oDB->isColumnExists("comments", "status")) |
|
| 94 | + if (!$oDB->isColumnExists("comments", "status")) |
|
| 95 | 95 | { |
| 96 | 96 | return TRUE; |
| 97 | 97 | } |
| 98 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
| 98 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
| 99 | 99 | { |
| 100 | 100 | return TRUE; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 104 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 104 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 105 | 105 | { |
| 106 | 106 | return TRUE; |
| 107 | 107 | } |
@@ -119,43 +119,43 @@ discard block |
||
| 119 | 119 | $oModuleModel = getModel('module'); |
| 120 | 120 | $oModuleController = getController('module'); |
| 121 | 121 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
| 122 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 122 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 123 | 123 | { |
| 124 | 124 | $oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'); |
| 125 | 125 | } |
| 126 | 126 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
| 127 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 127 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 128 | 128 | { |
| 129 | 129 | $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); |
| 130 | 130 | } |
| 131 | 131 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
| 132 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
| 132 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
| 133 | 133 | { |
| 134 | 134 | $oDB->addColumn("comments", "voted_count", "number", "11"); |
| 135 | 135 | $oDB->addIndex("comments", "idx_voted_count", array("voted_count")); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
| 138 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
| 139 | 139 | { |
| 140 | 140 | $oDB->addColumn("comments", "notify_message", "char", "1"); |
| 141 | 141 | } |
| 142 | 142 | // 2008. 02. 22 add comment setting when a new module added |
| 143 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 143 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 144 | 144 | { |
| 145 | 145 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
| 146 | 146 | } |
| 147 | 147 | // 2008. 05. 14 add a column for blamed count |
| 148 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 148 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 149 | 149 | { |
| 150 | 150 | $oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE); |
| 151 | 151 | $oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count')); |
| 152 | 152 | } |
| 153 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 153 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 154 | 154 | { |
| 155 | 155 | $oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 158 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 159 | 159 | { |
| 160 | 160 | $oDB->addIndex( |
| 161 | 161 | "comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | //2012. 02. 24 add comment published status column and index |
| 166 | - if(!$oDB->isColumnExists("comments", "status")) |
|
| 166 | + if (!$oDB->isColumnExists("comments", "status")) |
|
| 167 | 167 | { |
| 168 | 168 | $oDB->addColumn("comments", "status", "number", 1, 1, TRUE); |
| 169 | 169 | } |
| 170 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
| 170 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
| 171 | 171 | { |
| 172 | 172 | $oDB->addIndex( |
| 173 | 173 | "comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 178 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 178 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 179 | 179 | { |
| 180 | 180 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'); |
| 181 | 181 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | function recompileCache() |
| 191 | 191 | { |
| 192 | - if(!is_dir('./files/cache/tmp')) |
|
| 192 | + if (!is_dir('./files/cache/tmp')) |
|
| 193 | 193 | { |
| 194 | 194 | FileHandler::makeDir('./files/cache/tmp'); |
| 195 | 195 | } |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function getRealPath($source) |
| 19 | 19 | { |
| 20 | - if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0) |
|
| 20 | + if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0) |
|
| 21 | 21 | { |
| 22 | - return _XE_PATH_ . substr($source, 2); |
|
| 22 | + return _XE_PATH_.substr($source, 2); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $source; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $source_dir = self::getRealPath($source_dir); |
| 42 | 42 | $target_dir = self::getRealPath($target_dir); |
| 43 | - if(!is_dir($source_dir)) |
|
| 43 | + if (!is_dir($source_dir)) |
|
| 44 | 44 | { |
| 45 | 45 | return FALSE; |
| 46 | 46 | } |
@@ -48,44 +48,44 @@ discard block |
||
| 48 | 48 | // generate when no target exists |
| 49 | 49 | self::makeDir($target_dir); |
| 50 | 50 | |
| 51 | - if(substr($source_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 51 | + if (substr($source_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 52 | 52 | { |
| 53 | 53 | $source_dir .= DIRECTORY_SEPARATOR; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(substr($target_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 56 | + if (substr($target_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 57 | 57 | { |
| 58 | 58 | $target_dir .= DIRECTORY_SEPARATOR; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $oDir = dir($source_dir); |
| 62 | - while($file = $oDir->read()) |
|
| 62 | + while ($file = $oDir->read()) |
|
| 63 | 63 | { |
| 64 | - if($file{0} == '.') |
|
| 64 | + if ($file{0} == '.') |
|
| 65 | 65 | { |
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if($filter && preg_match($filter, $file)) |
|
| 69 | + if ($filter && preg_match($filter, $file)) |
|
| 70 | 70 | { |
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if(is_dir($source_dir . $file)) |
|
| 74 | + if (is_dir($source_dir.$file)) |
|
| 75 | 75 | { |
| 76 | - self::copyDir($source_dir . $file, $target_dir . $file, $type); |
|
| 76 | + self::copyDir($source_dir.$file, $target_dir.$file, $type); |
|
| 77 | 77 | } |
| 78 | 78 | else |
| 79 | 79 | { |
| 80 | - if($type == 'force') |
|
| 80 | + if ($type == 'force') |
|
| 81 | 81 | { |
| 82 | - @unlink($target_dir . $file); |
|
| 82 | + @unlink($target_dir.$file); |
|
| 83 | 83 | } |
| 84 | 84 | else |
| 85 | 85 | { |
| 86 | - if(!file_exists($target_dir . $file)) |
|
| 86 | + if (!file_exists($target_dir.$file)) |
|
| 87 | 87 | { |
| 88 | - @copy($source_dir . $file, $target_dir . $file); |
|
| 88 | + @copy($source_dir.$file, $target_dir.$file); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | self::makeDir($target_dir); |
| 112 | 112 | |
| 113 | - if($force == 'Y') |
|
| 113 | + if ($force == 'Y') |
|
| 114 | 114 | { |
| 115 | - @unlink($target_dir . DIRECTORY_SEPARATOR . $target); |
|
| 115 | + @unlink($target_dir.DIRECTORY_SEPARATOR.$target); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - @copy($source, $target_dir . DIRECTORY_SEPARATOR . $target); |
|
| 118 | + @copy($source, $target_dir.DIRECTORY_SEPARATOR.$target); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | function readFile($filename) |
| 128 | 128 | { |
| 129 | - if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) |
|
| 129 | + if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) |
|
| 130 | 130 | { |
| 131 | 131 | return; |
| 132 | 132 | } |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | self::makeDir($pathinfo['dirname']); |
| 150 | 150 | |
| 151 | 151 | $flags = 0; |
| 152 | - if(strtolower($mode) == 'a') |
|
| 152 | + if (strtolower($mode) == 'a') |
|
| 153 | 153 | { |
| 154 | 154 | $flags = FILE_APPEND; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - @file_put_contents($filename, $buff, $flags|LOCK_EX); |
|
| 157 | + @file_put_contents($filename, $buff, $flags | LOCK_EX); |
|
| 158 | 158 | @chmod($filename, 0644); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | function moveFile($source, $target) |
| 194 | 194 | { |
| 195 | - if(($source = self::exists($source)) !== FALSE) |
|
| 195 | + if (($source = self::exists($source)) !== FALSE) |
|
| 196 | 196 | { |
| 197 | 197 | self::removeFile($target); |
| 198 | 198 | return self::rename($source, $target); |
@@ -230,35 +230,35 @@ discard block |
||
| 230 | 230 | $path = self::getRealPath($path); |
| 231 | 231 | $output = array(); |
| 232 | 232 | |
| 233 | - if(substr($path, -1) != '/') |
|
| 233 | + if (substr($path, -1) != '/') |
|
| 234 | 234 | { |
| 235 | 235 | $path .= '/'; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if(!is_dir($path)) |
|
| 238 | + if (!is_dir($path)) |
|
| 239 | 239 | { |
| 240 | 240 | return $output; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $files = scandir($path); |
| 244 | - foreach($files as $file) |
|
| 244 | + foreach ($files as $file) |
|
| 245 | 245 | { |
| 246 | - if($file{0} == '.' || ($filter && !preg_match($filter, $file))) |
|
| 246 | + if ($file{0} == '.' || ($filter && !preg_match($filter, $file))) |
|
| 247 | 247 | { |
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - if($to_lower) |
|
| 251 | + if ($to_lower) |
|
| 252 | 252 | { |
| 253 | 253 | $file = strtolower($file); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if($filter) |
|
| 256 | + if ($filter) |
|
| 257 | 257 | { |
| 258 | 258 | $file = preg_replace($filter, '$1', $file); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if($concat_prefix) |
|
| 261 | + if ($concat_prefix) |
|
| 262 | 262 | { |
| 263 | 263 | $file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file); |
| 264 | 264 | } |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | function makeDir($path_string) |
| 281 | 281 | { |
| 282 | - if(self::exists($path_string) !== FALSE) |
|
| 282 | + if (self::exists($path_string) !== FALSE) |
|
| 283 | 283 | { |
| 284 | 284 | return TRUE; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if(!ini_get('safe_mode')) |
|
| 287 | + if (!ini_get('safe_mode')) |
|
| 288 | 288 | { |
| 289 | 289 | @mkdir($path_string, 0755, TRUE); |
| 290 | 290 | @chmod($path_string, 0755); |
@@ -295,35 +295,35 @@ discard block |
||
| 295 | 295 | static $oFtp = NULL; |
| 296 | 296 | |
| 297 | 297 | $ftp_info = Context::getFTPInfo(); |
| 298 | - if($oFtp == NULL) |
|
| 298 | + if ($oFtp == NULL) |
|
| 299 | 299 | { |
| 300 | - if(!Context::isFTPRegisted()) |
|
| 300 | + if (!Context::isFTPRegisted()) |
|
| 301 | 301 | { |
| 302 | 302 | return; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
| 305 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
| 306 | 306 | $oFtp = new ftp(); |
| 307 | - if(!$ftp_info->ftp_host) |
|
| 307 | + if (!$ftp_info->ftp_host) |
|
| 308 | 308 | { |
| 309 | 309 | $ftp_info->ftp_host = "127.0.0.1"; |
| 310 | 310 | } |
| 311 | - if(!$ftp_info->ftp_port) |
|
| 311 | + if (!$ftp_info->ftp_port) |
|
| 312 | 312 | { |
| 313 | 313 | $ftp_info->ftp_port = 21; |
| 314 | 314 | } |
| 315 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 315 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 316 | 316 | { |
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 319 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 320 | 320 | { |
| 321 | 321 | $oFtp->ftp_quit(); |
| 322 | 322 | return; |
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if(!($ftp_path = $ftp_info->ftp_root_path)) |
|
| 326 | + if (!($ftp_path = $ftp_info->ftp_root_path)) |
|
| 327 | 327 | { |
| 328 | 328 | $ftp_path = DIRECTORY_SEPARATOR; |
| 329 | 329 | } |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | $path_list = explode(DIRECTORY_SEPARATOR, $path_string); |
| 333 | 333 | |
| 334 | 334 | $path = _XE_PATH_; |
| 335 | - for($i = 0, $c = count($path_list); $i < $c; $i++) |
|
| 335 | + for ($i = 0, $c = count($path_list); $i < $c; $i++) |
|
| 336 | 336 | { |
| 337 | - if(!$path_list[$i]) |
|
| 337 | + if (!$path_list[$i]) |
|
| 338 | 338 | { |
| 339 | 339 | continue; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $path .= $path_list[$i] . DIRECTORY_SEPARATOR; |
|
| 343 | - $ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR; |
|
| 344 | - if(!is_dir($path)) |
|
| 342 | + $path .= $path_list[$i].DIRECTORY_SEPARATOR; |
|
| 343 | + $ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR; |
|
| 344 | + if (!is_dir($path)) |
|
| 345 | 345 | { |
| 346 | 346 | $oFtp->ftp_mkdir($ftp_path); |
| 347 | - $oFtp->ftp_site("CHMOD 777 " . $ftp_path); |
|
| 347 | + $oFtp->ftp_site("CHMOD 777 ".$ftp_path); |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | } |
@@ -360,23 +360,23 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | function removeDir($path) |
| 362 | 362 | { |
| 363 | - if(($path = self::isDir($path)) === FALSE) |
|
| 363 | + if (($path = self::isDir($path)) === FALSE) |
|
| 364 | 364 | { |
| 365 | 365 | return; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if(self::isDir($path)) |
|
| 368 | + if (self::isDir($path)) |
|
| 369 | 369 | { |
| 370 | 370 | $files = array_diff(scandir($path), array('..', '.')); |
| 371 | 371 | |
| 372 | - foreach($files as $file) |
|
| 372 | + foreach ($files as $file) |
|
| 373 | 373 | { |
| 374 | - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 374 | + if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 375 | 375 | { |
| 376 | 376 | continue; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if(is_dir($target)) |
|
| 379 | + if (is_dir($target)) |
|
| 380 | 380 | { |
| 381 | 381 | self::removeDir($target); |
| 382 | 382 | } |
@@ -401,22 +401,22 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | function removeBlankDir($path) |
| 403 | 403 | { |
| 404 | - if(($path = self::isDir($path)) === FALSE) |
|
| 404 | + if (($path = self::isDir($path)) === FALSE) |
|
| 405 | 405 | { |
| 406 | 406 | return; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | $files = array_diff(scandir($path), array('..', '.')); |
| 410 | 410 | |
| 411 | - if(count($files) < 1) |
|
| 411 | + if (count($files) < 1) |
|
| 412 | 412 | { |
| 413 | 413 | rmdir($path); |
| 414 | 414 | return; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - foreach($files as $file) |
|
| 417 | + foreach ($files as $file) |
|
| 418 | 418 | { |
| 419 | - if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 419 | + if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 420 | 420 | { |
| 421 | 421 | continue; |
| 422 | 422 | } |
@@ -435,23 +435,23 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | function removeFilesInDir($path) |
| 437 | 437 | { |
| 438 | - if(($path = self::getRealPath($path)) === FALSE) |
|
| 438 | + if (($path = self::getRealPath($path)) === FALSE) |
|
| 439 | 439 | { |
| 440 | 440 | return; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if(is_dir($path)) |
|
| 443 | + if (is_dir($path)) |
|
| 444 | 444 | { |
| 445 | 445 | $files = array_diff(scandir($path), array('..', '.')); |
| 446 | 446 | |
| 447 | - foreach($files as $file) |
|
| 447 | + foreach ($files as $file) |
|
| 448 | 448 | { |
| 449 | - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 449 | + if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 450 | 450 | { |
| 451 | 451 | continue; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if(is_dir($target)) |
|
| 454 | + if (is_dir($target)) |
|
| 455 | 455 | { |
| 456 | 456 | self::removeFilesInDir($target); |
| 457 | 457 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | else |
| 465 | 465 | { |
| 466 | - if(self::exists($path)) unlink($path); |
|
| 466 | + if (self::exists($path)) unlink($path); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | } |
@@ -477,22 +477,22 @@ discard block |
||
| 477 | 477 | */ |
| 478 | 478 | function filesize($size) |
| 479 | 479 | { |
| 480 | - if(!$size) |
|
| 480 | + if (!$size) |
|
| 481 | 481 | { |
| 482 | 482 | return '0Byte'; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if($size === 1) |
|
| 485 | + if ($size === 1) |
|
| 486 | 486 | { |
| 487 | 487 | return '1Byte'; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - if($size < 1024) |
|
| 490 | + if ($size < 1024) |
|
| 491 | 491 | { |
| 492 | - return $size . 'Bytes'; |
|
| 492 | + return $size.'Bytes'; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if($size >= 1024 && $size < 1024 * 1024) |
|
| 495 | + if ($size >= 1024 && $size < 1024 * 1024) |
|
| 496 | 496 | { |
| 497 | 497 | return sprintf("%0.1fKB", $size / 1024); |
| 498 | 498 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | */ |
| 518 | 518 | function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array()) |
| 519 | 519 | { |
| 520 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 520 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 521 | 521 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 522 | 522 | $url = $IDN->encode($url); |
| 523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | require_once('HTTP/Request.php'); |
| 528 | 528 | |
| 529 | 529 | $parsed_url = parse_url(__PROXY_SERVER__); |
| 530 | - if($parsed_url["host"]) |
|
| 530 | + if ($parsed_url["host"]) |
|
| 531 | 531 | { |
| 532 | 532 | $oRequest = new HTTP_Request(__PROXY_SERVER__); |
| 533 | 533 | $oRequest->setMethod('POST'); |
@@ -537,49 +537,49 @@ discard block |
||
| 537 | 537 | { |
| 538 | 538 | $oRequest = new HTTP_Request($url); |
| 539 | 539 | |
| 540 | - if(count($request_config) && method_exists($oRequest, 'setConfig')) |
|
| 540 | + if (count($request_config) && method_exists($oRequest, 'setConfig')) |
|
| 541 | 541 | { |
| 542 | - foreach($request_config as $key=>$val) |
|
| 542 | + foreach ($request_config as $key=>$val) |
|
| 543 | 543 | { |
| 544 | 544 | $oRequest->setConfig($key, $val); |
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if(count($headers) > 0) |
|
| 548 | + if (count($headers) > 0) |
|
| 549 | 549 | { |
| 550 | - foreach($headers as $key => $val) |
|
| 550 | + foreach ($headers as $key => $val) |
|
| 551 | 551 | { |
| 552 | 552 | $oRequest->addHeader($key, $val); |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | - if($cookies[$host]) |
|
| 555 | + if ($cookies[$host]) |
|
| 556 | 556 | { |
| 557 | - foreach($cookies[$host] as $key => $val) |
|
| 557 | + foreach ($cookies[$host] as $key => $val) |
|
| 558 | 558 | { |
| 559 | 559 | $oRequest->addCookie($key, $val); |
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | - if(count($post_data) > 0) |
|
| 562 | + if (count($post_data) > 0) |
|
| 563 | 563 | { |
| 564 | - foreach($post_data as $key => $val) |
|
| 564 | + foreach ($post_data as $key => $val) |
|
| 565 | 565 | { |
| 566 | 566 | $oRequest->addPostData($key, $val); |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | - if(!$content_type) |
|
| 569 | + if (!$content_type) |
|
| 570 | 570 | $oRequest->addHeader('Content-Type', 'text/html'); |
| 571 | 571 | else |
| 572 | 572 | $oRequest->addHeader('Content-Type', $content_type); |
| 573 | 573 | $oRequest->setMethod($method); |
| 574 | - if($body) |
|
| 574 | + if ($body) |
|
| 575 | 575 | $oRequest->setBody($body); |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if(method_exists($oRequest, 'setConfig')) |
|
| 578 | + if (method_exists($oRequest, 'setConfig')) |
|
| 579 | 579 | { |
| 580 | 580 | $oRequest->setConfig('timeout', $timeout); |
| 581 | 581 | } |
| 582 | - elseif(property_exists($oRequest, '_timeout')) |
|
| 582 | + elseif (property_exists($oRequest, '_timeout')) |
|
| 583 | 583 | { |
| 584 | 584 | $oRequest->_timeout = $timeout; |
| 585 | 585 | } |
@@ -589,25 +589,25 @@ discard block |
||
| 589 | 589 | $code = $oRequest->getResponseCode(); |
| 590 | 590 | $header = $oRequest->getResponseHeader(); |
| 591 | 591 | $response = $oRequest->getResponseBody(); |
| 592 | - if($c = $oRequest->getResponseCookies()) |
|
| 592 | + if ($c = $oRequest->getResponseCookies()) |
|
| 593 | 593 | { |
| 594 | - foreach($c as $k => $v) |
|
| 594 | + foreach ($c as $k => $v) |
|
| 595 | 595 | { |
| 596 | 596 | $cookies[$host][$v['name']] = $v['value']; |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - if($code > 300 && $code < 399 && $header['location']) |
|
| 600 | + if ($code > 300 && $code < 399 && $header['location']) |
|
| 601 | 601 | { |
| 602 | 602 | return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data); |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - if($code != 200) |
|
| 605 | + if ($code != 200) |
|
| 606 | 606 | return; |
| 607 | 607 | |
| 608 | 608 | return $response; |
| 609 | 609 | } |
| 610 | - catch(Exception $e) |
|
| 610 | + catch (Exception $e) |
|
| 611 | 611 | { |
| 612 | 612 | return NULL; |
| 613 | 613 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | function getRemoteFile($url, $target_filename, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array()) |
| 629 | 629 | { |
| 630 | - if(!($body = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers,$cookies,$post_data,$request_config))) |
|
| 630 | + if (!($body = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config))) |
|
| 631 | 631 | { |
| 632 | 632 | return FALSE; |
| 633 | 633 | } |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | function returnBytes($val) |
| 647 | 647 | { |
| 648 | 648 | $unit = strtoupper(substr($val, -1)); |
| 649 | - $val = (float)$val; |
|
| 649 | + $val = (float) $val; |
|
| 650 | 650 | |
| 651 | 651 | switch ($unit) |
| 652 | 652 | { |
@@ -669,13 +669,13 @@ discard block |
||
| 669 | 669 | $K64 = 65536; |
| 670 | 670 | $TWEAKFACTOR = 2.0; |
| 671 | 671 | $channels = $imageInfo['channels']; |
| 672 | - if(!$channels) |
|
| 672 | + if (!$channels) |
|
| 673 | 673 | { |
| 674 | 674 | $channels = 6; //for png |
| 675 | 675 | } |
| 676 | - $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR); |
|
| 676 | + $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR); |
|
| 677 | 677 | $availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage(); |
| 678 | - if($availableMemory < $memoryNeeded) |
|
| 678 | + if ($availableMemory < $memoryNeeded) |
|
| 679 | 679 | { |
| 680 | 680 | return FALSE; |
| 681 | 681 | } |
@@ -702,30 +702,30 @@ discard block |
||
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | $target_file = self::getRealPath($target_file); |
| 705 | - if(!$resize_width) |
|
| 705 | + if (!$resize_width) |
|
| 706 | 706 | { |
| 707 | 707 | $resize_width = 100; |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - if(!$resize_height) |
|
| 710 | + if (!$resize_height) |
|
| 711 | 711 | { |
| 712 | 712 | $resize_height = $resize_width; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | // retrieve source image's information |
| 716 | 716 | $imageInfo = getimagesize($source_file); |
| 717 | - if(!self::checkMemoryLoadImage($imageInfo)) |
|
| 717 | + if (!self::checkMemoryLoadImage($imageInfo)) |
|
| 718 | 718 | { |
| 719 | 719 | return FALSE; |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | list($width, $height, $type, $attrs) = $imageInfo; |
| 723 | - if($width < 1 || $height < 1) |
|
| 723 | + if ($width < 1 || $height < 1) |
|
| 724 | 724 | { |
| 725 | 725 | return; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - switch($type) |
|
| 728 | + switch ($type) |
|
| 729 | 729 | { |
| 730 | 730 | case '1' : |
| 731 | 731 | $type = 'gif'; |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | return; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - if(!$target_type) |
|
| 746 | + if (!$target_type) |
|
| 747 | 747 | { |
| 748 | 748 | $target_type = $type; |
| 749 | 749 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1; |
| 755 | 755 | |
| 756 | 756 | $per = NULL; |
| 757 | - if($thumbnail_type == 'ratio') |
|
| 757 | + if ($thumbnail_type == 'ratio') |
|
| 758 | 758 | { |
| 759 | 759 | $per = ($width_per > $height_per) ? $height_per : $width_per; |
| 760 | 760 | $resize_width = $width * $per; |
@@ -767,16 +767,16 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | // create temporary image with target size |
| 769 | 769 | $thumb = NULL; |
| 770 | - if(function_exists('imagecreateTRUEcolor')) |
|
| 770 | + if (function_exists('imagecreateTRUEcolor')) |
|
| 771 | 771 | { |
| 772 | 772 | $thumb = imagecreateTRUEcolor($resize_width, $resize_height); |
| 773 | 773 | } |
| 774 | - else if(function_exists('imagecreate')) |
|
| 774 | + else if (function_exists('imagecreate')) |
|
| 775 | 775 | { |
| 776 | 776 | $thumb = imagecreate($resize_width, $resize_height); |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | - if(!$thumb) |
|
| 779 | + if (!$thumb) |
|
| 780 | 780 | { |
| 781 | 781 | return FALSE; |
| 782 | 782 | } |
@@ -785,37 +785,37 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | // create temporary image having original type |
| 787 | 787 | $source = NULL; |
| 788 | - switch($type) |
|
| 788 | + switch ($type) |
|
| 789 | 789 | { |
| 790 | 790 | case 'gif' : |
| 791 | - if(function_exists('imagecreatefromgif')) |
|
| 791 | + if (function_exists('imagecreatefromgif')) |
|
| 792 | 792 | { |
| 793 | 793 | $source = @imagecreatefromgif($source_file); |
| 794 | 794 | } |
| 795 | 795 | break; |
| 796 | 796 | case 'jpeg' : |
| 797 | 797 | case 'jpg' : |
| 798 | - if(function_exists('imagecreatefromjpeg')) |
|
| 798 | + if (function_exists('imagecreatefromjpeg')) |
|
| 799 | 799 | { |
| 800 | 800 | $source = @imagecreatefromjpeg($source_file); |
| 801 | 801 | } |
| 802 | 802 | break; |
| 803 | 803 | case 'png' : |
| 804 | - if(function_exists('imagecreatefrompng')) |
|
| 804 | + if (function_exists('imagecreatefrompng')) |
|
| 805 | 805 | { |
| 806 | 806 | $source = @imagecreatefrompng($source_file); |
| 807 | 807 | } |
| 808 | 808 | break; |
| 809 | 809 | case 'wbmp' : |
| 810 | 810 | case 'bmp' : |
| 811 | - if(function_exists('imagecreatefromwbmp')) |
|
| 811 | + if (function_exists('imagecreatefromwbmp')) |
|
| 812 | 812 | { |
| 813 | 813 | $source = @imagecreatefromwbmp($source_file); |
| 814 | 814 | } |
| 815 | 815 | break; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | - if(!$source) |
|
| 818 | + if (!$source) |
|
| 819 | 819 | { |
| 820 | 820 | imagedestroy($thumb); |
| 821 | 821 | return FALSE; |
@@ -827,13 +827,13 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | $x = 0; |
| 829 | 829 | $y = 0; |
| 830 | - if($thumbnail_type == 'crop') |
|
| 830 | + if ($thumbnail_type == 'crop') |
|
| 831 | 831 | { |
| 832 | 832 | $x = (int) ($resize_width / 2 - $new_width / 2); |
| 833 | 833 | $y = (int) ($resize_height / 2 - $new_height / 2); |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | - if(function_exists('imagecopyresampled')) |
|
| 836 | + if (function_exists('imagecopyresampled')) |
|
| 837 | 837 | { |
| 838 | 838 | imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); |
| 839 | 839 | } |
@@ -847,30 +847,30 @@ discard block |
||
| 847 | 847 | |
| 848 | 848 | // write into the file |
| 849 | 849 | $output = NULL; |
| 850 | - switch($target_type) |
|
| 850 | + switch ($target_type) |
|
| 851 | 851 | { |
| 852 | 852 | case 'gif' : |
| 853 | - if(function_exists('imagegif')) |
|
| 853 | + if (function_exists('imagegif')) |
|
| 854 | 854 | { |
| 855 | 855 | $output = imagegif($thumb, $target_file); |
| 856 | 856 | } |
| 857 | 857 | break; |
| 858 | 858 | case 'jpeg' : |
| 859 | 859 | case 'jpg' : |
| 860 | - if(function_exists('imagejpeg')) |
|
| 860 | + if (function_exists('imagejpeg')) |
|
| 861 | 861 | { |
| 862 | 862 | $output = imagejpeg($thumb, $target_file, 100); |
| 863 | 863 | } |
| 864 | 864 | break; |
| 865 | 865 | case 'png' : |
| 866 | - if(function_exists('imagepng')) |
|
| 866 | + if (function_exists('imagepng')) |
|
| 867 | 867 | { |
| 868 | 868 | $output = imagepng($thumb, $target_file, 9); |
| 869 | 869 | } |
| 870 | 870 | break; |
| 871 | 871 | case 'wbmp' : |
| 872 | 872 | case 'bmp' : |
| 873 | - if(function_exists('imagewbmp')) |
|
| 873 | + if (function_exists('imagewbmp')) |
|
| 874 | 874 | { |
| 875 | 875 | $output = imagewbmp($thumb, $target_file, 100); |
| 876 | 876 | } |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | imagedestroy($thumb); |
| 881 | 881 | imagedestroy($source); |
| 882 | 882 | |
| 883 | - if(!$output) |
|
| 883 | + if (!$output) |
|
| 884 | 884 | { |
| 885 | 885 | return FALSE; |
| 886 | 886 | } |
@@ -898,12 +898,12 @@ discard block |
||
| 898 | 898 | */ |
| 899 | 899 | function readIniFile($filename) |
| 900 | 900 | { |
| 901 | - if(($filename = self::exists($filename)) === FALSE) |
|
| 901 | + if (($filename = self::exists($filename)) === FALSE) |
|
| 902 | 902 | { |
| 903 | 903 | return FALSE; |
| 904 | 904 | } |
| 905 | 905 | $arr = parse_ini_file($filename, TRUE); |
| 906 | - if(is_array($arr) && count($arr) > 0) |
|
| 906 | + if (is_array($arr) && count($arr) > 0) |
|
| 907 | 907 | { |
| 908 | 908 | return $arr; |
| 909 | 909 | } |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | function writeIniFile($filename, $arr) |
| 931 | 931 | { |
| 932 | - if(!is_array($arr) || count($arr) == 0) |
|
| 932 | + if (!is_array($arr) || count($arr) == 0) |
|
| 933 | 933 | { |
| 934 | 934 | return FALSE; |
| 935 | 935 | } |
@@ -946,19 +946,19 @@ discard block |
||
| 946 | 946 | function _makeIniBuff($arr) |
| 947 | 947 | { |
| 948 | 948 | $return = array(); |
| 949 | - foreach($arr as $key => $val) |
|
| 949 | + foreach ($arr as $key => $val) |
|
| 950 | 950 | { |
| 951 | 951 | // section |
| 952 | - if(is_array($val)) |
|
| 952 | + if (is_array($val)) |
|
| 953 | 953 | { |
| 954 | 954 | $return[] = sprintf("[%s]", $key); |
| 955 | - foreach($val as $k => $v) |
|
| 955 | + foreach ($val as $k => $v) |
|
| 956 | 956 | { |
| 957 | 957 | $return[] = sprintf("%s=\"%s\"", $k, $v); |
| 958 | 958 | } |
| 959 | 959 | // value |
| 960 | 960 | } |
| 961 | - else if(is_object($val)) |
|
| 961 | + else if (is_object($val)) |
|
| 962 | 962 | { |
| 963 | 963 | continue; |
| 964 | 964 | } |
@@ -1033,15 +1033,15 @@ discard block |
||
| 1033 | 1033 | function isWritableDir($path) |
| 1034 | 1034 | { |
| 1035 | 1035 | $path = self::getRealPath($path); |
| 1036 | - if(is_dir($path)==FALSE) |
|
| 1036 | + if (is_dir($path) == FALSE) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | return FALSE; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | - $checkFile = $path . '/_CheckWritableDir'; |
|
| 1041 | + $checkFile = $path.'/_CheckWritableDir'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | $fp = fopen($checkFile, 'w'); |
| 1044 | - if(!is_resource($fp)) |
|
| 1044 | + if (!is_resource($fp)) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return FALSE; |
| 1047 | 1047 | } |
@@ -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|swf|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|swf|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(); |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | * @author NAVER ([email protected]) |
| 8 | 8 | */ |
| 9 | -if(!defined('__XE__')) |
|
| 9 | +if (!defined('__XE__')) |
|
| 10 | 10 | { |
| 11 | 11 | exit(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
| 15 | -if(!function_exists('iconv')) |
|
| 15 | +if (!function_exists('iconv')) |
|
| 16 | 16 | { |
| 17 | 17 | eval(' |
| 18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $oDB = DB::getInstance(); |
| 222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
| 223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
| 223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
| 224 | 224 | { |
| 225 | 225 | $output->data = array($output->data); |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | function setUserSequence($seq) |
| 251 | 251 | { |
| 252 | 252 | $arr_seq = array(); |
| 253 | - if(isset($_SESSION['seq'])) |
|
| 253 | + if (isset($_SESSION['seq'])) |
|
| 254 | 254 | { |
| 255 | 255 | $arr_seq = $_SESSION['seq']; |
| 256 | 256 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function checkUserSequence($seq) |
| 268 | 268 | { |
| 269 | - if(!isset($_SESSION['seq'])) |
|
| 269 | + if (!isset($_SESSION['seq'])) |
|
| 270 | 270 | { |
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | - if(!in_array($seq, $_SESSION['seq'])) |
|
| 273 | + if (!in_array($seq, $_SESSION['seq'])) |
|
| 274 | 274 | { |
| 275 | 275 | return false; |
| 276 | 276 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $num_args = func_num_args(); |
| 297 | 297 | $args_list = func_get_args(); |
| 298 | 298 | |
| 299 | - if($num_args) |
|
| 299 | + if ($num_args) |
|
| 300 | 300 | $url = Context::getUrl($num_args, $args_list); |
| 301 | 301 | else |
| 302 | 302 | $url = Context::getRequestUri(); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $num_args = func_num_args(); |
| 316 | 316 | $args_list = func_get_args(); |
| 317 | 317 | |
| 318 | - if($num_args) |
|
| 318 | + if ($num_args) |
|
| 319 | 319 | { |
| 320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 321 | 321 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $num_args = func_num_args(); |
| 339 | 339 | $args_list = func_get_args(); |
| 340 | 340 | |
| 341 | - if($num_args) |
|
| 341 | + if ($num_args) |
|
| 342 | 342 | { |
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
| 344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | $num_args = func_num_args(); |
| 361 | 361 | $args_list = func_get_args(); |
| 362 | 362 | $request_uri = Context::getRequestUri(); |
| 363 | - if(!$num_args) |
|
| 363 | + if (!$num_args) |
|
| 364 | 364 | { |
| 365 | 365 | return $request_uri; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $url = Context::getUrl($num_args, $args_list); |
| 369 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 369 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 370 | 370 | { |
| 371 | 371 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 372 | - return substr($match[0], 0, -1) . $url; |
|
| 372 | + return substr($match[0], 0, -1).$url; |
|
| 373 | 373 | } |
| 374 | 374 | return $url; |
| 375 | 375 | } |
@@ -384,17 +384,17 @@ discard block |
||
| 384 | 384 | $num_args = func_num_args(); |
| 385 | 385 | $args_list = func_get_args(); |
| 386 | 386 | $request_uri = Context::getRequestUri(); |
| 387 | - if(!$num_args) |
|
| 387 | + if (!$num_args) |
|
| 388 | 388 | { |
| 389 | 389 | return $request_uri; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 393 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 393 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 394 | 394 | { |
| 395 | 395 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 397 | - return substr($match[0], 0, -1) . $url; |
|
| 397 | + return substr($match[0], 0, -1).$url; |
|
| 398 | 398 | } |
| 399 | 399 | return $url; |
| 400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $num_args = func_num_args(); |
| 411 | 411 | $args_list = func_get_args(); |
| 412 | 412 | |
| 413 | - if(!$num_args) |
|
| 413 | + if (!$num_args) |
|
| 414 | 414 | { |
| 415 | 415 | return Context::getRequestUri(); |
| 416 | 416 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $num_args = func_num_args(); |
| 433 | 433 | $args_list = func_get_args(); |
| 434 | 434 | |
| 435 | - if(!$num_args) |
|
| 435 | + if (!$num_args) |
|
| 436 | 436 | { |
| 437 | 437 | return Context::getRequestUri(); |
| 438 | 438 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $args_list = func_get_args(); |
| 455 | 455 | |
| 456 | 456 | $request_uri = Context::getRequestUri(); |
| 457 | - if(!$num_args) |
|
| 457 | + if (!$num_args) |
|
| 458 | 458 | { |
| 459 | 459 | return $request_uri; |
| 460 | 460 | } |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | $num_args = count($args_list); |
| 464 | 464 | |
| 465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain); |
| 466 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 466 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 467 | 467 | { |
| 468 | 468 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 469 | - return substr($match[0], 0, -1) . $url; |
|
| 469 | + return substr($match[0], 0, -1).$url; |
|
| 470 | 470 | } |
| 471 | 471 | return $url; |
| 472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | function getCurrentPageUrl() |
| 480 | 480 | { |
| 481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
| 482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 482 | + $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | function cut_str($string, $cut_size = 0, $tail = '...') |
| 506 | 506 | { |
| 507 | - if($cut_size < 1 || !$string) |
|
| 507 | + if ($cut_size < 1 || !$string) |
|
| 508 | 508 | { |
| 509 | 509 | return $string; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 512 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 513 | 513 | { |
| 514 | 514 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
| 515 | 515 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | $char_count = 0; |
| 524 | 524 | |
| 525 | 525 | $idx = 0; |
| 526 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 526 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 527 | 527 | { |
| 528 | 528 | $c = ord(substr($string, $idx, 1)); |
| 529 | 529 | $char_count++; |
| 530 | - if($c < 128) |
|
| 530 | + if ($c < 128) |
|
| 531 | 531 | { |
| 532 | 532 | $char_width += (int) $chars[$c - 32]; |
| 533 | 533 | $idx++; |
| 534 | 534 | } |
| 535 | - else if(191 < $c && $c < 224) |
|
| 535 | + else if (191 < $c && $c < 224) |
|
| 536 | 536 | { |
| 537 | 537 | $char_width += $chars[4]; |
| 538 | 538 | $idx += 2; |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | $output = substr($string, 0, $idx); |
| 548 | - if(strlen($output) < $string_length) |
|
| 548 | + if (strlen($output) < $string_length) |
|
| 549 | 549 | { |
| 550 | 550 | $output .= $tail; |
| 551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | function zgap() |
| 562 | 562 | { |
| 563 | 563 | $time_zone = $GLOBALS['_time_zone']; |
| 564 | - if($time_zone < 0) |
|
| 564 | + if ($time_zone < 0) |
|
| 565 | 565 | { |
| 566 | 566 | $to = -1; |
| 567 | 567 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $t_min = substr($time_zone, 3, 2) * $to; |
| 575 | 575 | |
| 576 | 576 | $server_time_zone = date("O"); |
| 577 | - if($server_time_zone < 0) |
|
| 577 | + if ($server_time_zone < 0) |
|
| 578 | 578 | { |
| 579 | 579 | $so = -1; |
| 580 | 580 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | function ztime($str) |
| 603 | 603 | { |
| 604 | - if(!$str) |
|
| 604 | + if (!$str) |
|
| 605 | 605 | { |
| 606 | 606 | return; |
| 607 | 607 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $year = (int) substr($str, 0, 4); |
| 613 | 613 | $month = (int) substr($str, 4, 2); |
| 614 | 614 | $day = (int) substr($str, 6, 2); |
| 615 | - if(strlen($str) <= 8) |
|
| 615 | + if (strlen($str) <= 8) |
|
| 616 | 616 | { |
| 617 | 617 | $gap = 0; |
| 618 | 618 | } |
@@ -636,19 +636,19 @@ discard block |
||
| 636 | 636 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
| 637 | 637 | |
| 638 | 638 | $lang_time_gap = Context::getLang('time_gap'); |
| 639 | - if($gap < 60) |
|
| 639 | + if ($gap < 60) |
|
| 640 | 640 | { |
| 641 | 641 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
| 642 | 642 | } |
| 643 | - elseif($gap < 60 * 60) |
|
| 643 | + elseif ($gap < 60 * 60) |
|
| 644 | 644 | { |
| 645 | 645 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
| 646 | 646 | } |
| 647 | - elseif($gap < 60 * 60 * 2) |
|
| 647 | + elseif ($gap < 60 * 60 * 2) |
|
| 648 | 648 | { |
| 649 | 649 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
| 650 | 650 | } |
| 651 | - elseif($gap < 60 * 60 * 24) |
|
| 651 | + elseif ($gap < 60 * 60 * 24) |
|
| 652 | 652 | { |
| 653 | 653 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
| 654 | 654 | } |
@@ -685,40 +685,40 @@ discard block |
||
| 685 | 685 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
| 686 | 686 | { |
| 687 | 687 | // return null if no target time is specified |
| 688 | - if(!$str) |
|
| 688 | + if (!$str) |
|
| 689 | 689 | { |
| 690 | 690 | return; |
| 691 | 691 | } |
| 692 | 692 | // convert the date format according to the language |
| 693 | - if($conversion == TRUE) |
|
| 693 | + if ($conversion == TRUE) |
|
| 694 | 694 | { |
| 695 | - switch(Context::getLangType()) |
|
| 695 | + switch (Context::getLangType()) |
|
| 696 | 696 | { |
| 697 | 697 | case 'en' : |
| 698 | 698 | case 'es' : |
| 699 | - if($format == 'Y-m-d') |
|
| 699 | + if ($format == 'Y-m-d') |
|
| 700 | 700 | { |
| 701 | 701 | $format = 'M d, Y'; |
| 702 | 702 | } |
| 703 | - elseif($format == 'Y-m-d H:i:s') |
|
| 703 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 704 | 704 | { |
| 705 | 705 | $format = 'M d, Y H:i:s'; |
| 706 | 706 | } |
| 707 | - elseif($format == 'Y-m-d H:i') |
|
| 707 | + elseif ($format == 'Y-m-d H:i') |
|
| 708 | 708 | { |
| 709 | 709 | $format = 'M d, Y H:i'; |
| 710 | 710 | } |
| 711 | 711 | break; |
| 712 | 712 | case 'vi' : |
| 713 | - if($format == 'Y-m-d') |
|
| 713 | + if ($format == 'Y-m-d') |
|
| 714 | 714 | { |
| 715 | 715 | $format = 'd-m-Y'; |
| 716 | 716 | } |
| 717 | - elseif($format == 'Y-m-d H:i:s') |
|
| 717 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 718 | 718 | { |
| 719 | 719 | $format = 'H:i:s d-m-Y'; |
| 720 | 720 | } |
| 721 | - elseif($format == 'Y-m-d H:i') |
|
| 721 | + elseif ($format == 'Y-m-d H:i') |
|
| 722 | 722 | { |
| 723 | 723 | $format = 'H:i d-m-Y'; |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // If year value is less than 1970, handle it separately. |
| 730 | - if((int) substr($str, 0, 4) < 1970) |
|
| 730 | + if ((int) substr($str, 0, 4) < 1970) |
|
| 731 | 731 | { |
| 732 | 732 | $hour = (int) substr($str, 8, 2); |
| 733 | 733 | $min = (int) substr($str, 10, 2); |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | function getEncodeEmailAddress($email) |
| 778 | 778 | { |
| 779 | 779 | $return = ''; |
| 780 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 780 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 781 | 781 | { |
| 782 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
| 782 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
| 783 | 783 | } |
| 784 | 784 | return $return; |
| 785 | 785 | } |
@@ -800,25 +800,25 @@ discard block |
||
| 800 | 800 | static $debug_file; |
| 801 | 801 | static $debug_file_exist; |
| 802 | 802 | |
| 803 | - if(!(__DEBUG__ & 1)) |
|
| 803 | + if (!(__DEBUG__ & 1)) |
|
| 804 | 804 | { |
| 805 | 805 | return; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | static $firephp; |
| 809 | 809 | $bt = debug_backtrace(); |
| 810 | - if(is_array($bt)) |
|
| 810 | + if (is_array($bt)) |
|
| 811 | 811 | { |
| 812 | 812 | $bt_debug_print = array_shift($bt); |
| 813 | 813 | $bt_called_function = array_shift($bt); |
| 814 | 814 | } |
| 815 | 815 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
| 816 | 816 | $line_num = $bt_debug_print['line']; |
| 817 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
| 817 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
| 818 | 818 | |
| 819 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 819 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 820 | 820 | { |
| 821 | - if(!isset($firephp)) |
|
| 821 | + if (!isset($firephp)) |
|
| 822 | 822 | { |
| 823 | 823 | $firephp = FirePHP::getInstance(TRUE); |
| 824 | 824 | } |
@@ -827,16 +827,16 @@ discard block |
||
| 827 | 827 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
| 828 | 828 | |
| 829 | 829 | // Check a FirePHP option |
| 830 | - if($display_option === 'TABLE') |
|
| 830 | + if ($display_option === 'TABLE') |
|
| 831 | 831 | { |
| 832 | 832 | $label = $display_option; |
| 833 | 833 | } |
| 834 | - if($display_option === 'ERROR') |
|
| 834 | + if ($display_option === 'ERROR') |
|
| 835 | 835 | { |
| 836 | 836 | $type = $display_option; |
| 837 | 837 | } |
| 838 | 838 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
| 839 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 839 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 840 | 840 | { |
| 841 | 841 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
| 842 | 842 | $label = NULL; |
@@ -846,18 +846,18 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | else |
| 848 | 848 | { |
| 849 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 849 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 850 | 850 | { |
| 851 | 851 | return; |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | $print = array(); |
| 855 | - if($debug_file_exist === NULL) $print[] = '<?php exit() ?>'; |
|
| 855 | + if ($debug_file_exist === NULL) $print[] = '<?php exit() ?>'; |
|
| 856 | 856 | |
| 857 | - if(!$debug_file) $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 858 | - if(!$debug_file_exist) $debug_file_exist = file_exists($debug_file); |
|
| 857 | + if (!$debug_file) $debug_file = _XE_PATH_.'files/'.$file; |
|
| 858 | + if (!$debug_file_exist) $debug_file_exist = file_exists($debug_file); |
|
| 859 | 859 | |
| 860 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
| 860 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
| 861 | 861 | { |
| 862 | 862 | $print[] = str_repeat('=', 80); |
| 863 | 863 | } |
@@ -865,10 +865,10 @@ discard block |
||
| 865 | 865 | $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); |
| 866 | 866 | |
| 867 | 867 | $type = gettype($debug_output); |
| 868 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
| 868 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
| 869 | 869 | { |
| 870 | - if($display_option === 'ERROR') $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
| 871 | - else $print[] = $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
| 870 | + if ($display_option === 'ERROR') $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
| 871 | + else $print[] = $type.'('.var_export($debug_output, TRUE).')'; |
|
| 872 | 872 | $print[] = PHP_EOL.PHP_EOL; |
| 873 | 873 | } |
| 874 | 874 | else |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $print[] = PHP_EOL; |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 880 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | */ |
| 889 | 889 | function writeSlowlog($type, $elapsed_time, $obj) |
| 890 | 890 | { |
| 891 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 891 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 892 | 892 | |
| 893 | 893 | static $log_filename = array( |
| 894 | 894 | 'query' => 'files/_slowlog_query.php', |
@@ -898,47 +898,47 @@ discard block |
||
| 898 | 898 | ); |
| 899 | 899 | $write_file = true; |
| 900 | 900 | |
| 901 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
| 901 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
| 902 | 902 | |
| 903 | 903 | $buff = array(); |
| 904 | 904 | $buff[] = '<?php exit(); ?>'; |
| 905 | 905 | $buff[] = date('c'); |
| 906 | 906 | |
| 907 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 907 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 908 | 908 | { |
| 909 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 910 | - $buff[] = "\tCalled : " . $obj->called; |
|
| 909 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 910 | + $buff[] = "\tCalled : ".$obj->called; |
|
| 911 | 911 | } |
| 912 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 912 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 913 | 913 | { |
| 914 | - $buff[] = "\tAddon : " . $obj->called; |
|
| 915 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
| 914 | + $buff[] = "\tAddon : ".$obj->called; |
|
| 915 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
| 916 | 916 | } |
| 917 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 917 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 918 | 918 | { |
| 919 | - $buff[] = "\tWidget : " . $obj->called; |
|
| 919 | + $buff[] = "\tWidget : ".$obj->called; |
|
| 920 | 920 | } |
| 921 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 921 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 922 | 922 | { |
| 923 | 923 | |
| 924 | 924 | $buff[] = $obj->query; |
| 925 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
| 926 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 927 | - $buff[] = "\tConnection : " . $obj->connection; |
|
| 925 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
| 926 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 927 | + $buff[] = "\tConnection : ".$obj->connection; |
|
| 928 | 928 | } |
| 929 | 929 | else |
| 930 | 930 | { |
| 931 | 931 | $write_file = false; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - if($write_file) |
|
| 934 | + if ($write_file) |
|
| 935 | 935 | { |
| 936 | 936 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
| 937 | - $buff[] = PHP_EOL . PHP_EOL; |
|
| 937 | + $buff[] = PHP_EOL.PHP_EOL; |
|
| 938 | 938 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | - if($type != 'query') |
|
| 941 | + if ($type != 'query') |
|
| 942 | 942 | { |
| 943 | 943 | $trigger_args = $obj; |
| 944 | 944 | $trigger_args->_log_type = $type; |
@@ -978,11 +978,11 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | function delObjectVars($target_obj, $del_obj) |
| 980 | 980 | { |
| 981 | - if(!is_object($target_obj)) |
|
| 981 | + if (!is_object($target_obj)) |
|
| 982 | 982 | { |
| 983 | 983 | return; |
| 984 | 984 | } |
| 985 | - if(!is_object($del_obj)) |
|
| 985 | + if (!is_object($del_obj)) |
|
| 986 | 986 | { |
| 987 | 987 | return; |
| 988 | 988 | } |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | $target = array_keys($target_vars); |
| 994 | 994 | $del = array_keys($del_vars); |
| 995 | - if(!count($target) || !count($del)) |
|
| 995 | + if (!count($target) || !count($del)) |
|
| 996 | 996 | { |
| 997 | 997 | return $target_obj; |
| 998 | 998 | } |
@@ -1000,10 +1000,10 @@ discard block |
||
| 1000 | 1000 | $return_obj = new stdClass(); |
| 1001 | 1001 | |
| 1002 | 1002 | $target_count = count($target); |
| 1003 | - for($i = 0; $i < $target_count; $i++) |
|
| 1003 | + for ($i = 0; $i < $target_count; $i++) |
|
| 1004 | 1004 | { |
| 1005 | 1005 | $target_key = $target[$i]; |
| 1006 | - if(!in_array($target_key, $del)) |
|
| 1006 | + if (!in_array($target_key, $del)) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
| 1009 | 1009 | } |
@@ -1016,10 +1016,10 @@ discard block |
||
| 1016 | 1016 | { |
| 1017 | 1017 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
| 1018 | 1018 | |
| 1019 | - foreach($del_vars as $var) |
|
| 1019 | + foreach ($del_vars as $var) |
|
| 1020 | 1020 | { |
| 1021 | - if(is_array($vars)) unset($vars[$var]); |
|
| 1022 | - else if(is_object($vars)) unset($vars->$var); |
|
| 1021 | + if (is_array($vars)) unset($vars[$var]); |
|
| 1022 | + else if (is_object($vars)) unset($vars->$var); |
|
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | return $vars; |
@@ -1036,12 +1036,12 @@ discard block |
||
| 1036 | 1036 | */ |
| 1037 | 1037 | function handleError($errno, $errstr, $file, $line) |
| 1038 | 1038 | { |
| 1039 | - if(!__DEBUG__) |
|
| 1039 | + if (!__DEBUG__) |
|
| 1040 | 1040 | { |
| 1041 | 1041 | return; |
| 1042 | 1042 | } |
| 1043 | 1043 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
| 1044 | - if(!in_array($errno, $errors)) |
|
| 1044 | + if (!in_array($errno, $errors)) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return; |
| 1047 | 1047 | } |
@@ -1061,8 +1061,8 @@ discard block |
||
| 1061 | 1061 | function getNumberingPath($no, $size = 3) |
| 1062 | 1062 | { |
| 1063 | 1063 | $mod = pow(10, $size); |
| 1064 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
| 1065 | - if($no >= $mod) |
|
| 1064 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
| 1065 | + if ($no >= $mod) |
|
| 1066 | 1066 | { |
| 1067 | 1067 | $output .= getNumberingPath((int) $no / $mod, $size); |
| 1068 | 1068 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | |
| 1083 | 1083 | function purifierHtml(&$content) |
| 1084 | 1084 | { |
| 1085 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
| 1085 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
| 1086 | 1086 | $oPurifier = Purifier::getInstance(); |
| 1087 | 1087 | $oPurifier->purify($content); |
| 1088 | 1088 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | */ |
| 1096 | 1096 | function removeHackTag($content) |
| 1097 | 1097 | { |
| 1098 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 1098 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 1099 | 1099 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 1100 | 1100 | $oEmbedFilter->check($content); |
| 1101 | 1101 | |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | */ |
| 1138 | 1138 | function checkUploadedFile($file) |
| 1139 | 1139 | { |
| 1140 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
| 1140 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
| 1141 | 1141 | return UploadFileFilter::check($file); |
| 1142 | 1142 | } |
| 1143 | 1143 | |
@@ -1151,13 +1151,13 @@ discard block |
||
| 1151 | 1151 | { |
| 1152 | 1152 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
| 1153 | 1153 | |
| 1154 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1154 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1155 | 1155 | { |
| 1156 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1156 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | $content .= '</xmp>'; |
| 1159 | 1159 | } |
| 1160 | - else if($close_xmp < $start_xmp) |
|
| 1160 | + else if ($close_xmp < $start_xmp) |
|
| 1161 | 1161 | { |
| 1162 | 1162 | $content .= '</xmp>'; |
| 1163 | 1163 | } |
@@ -1177,33 +1177,33 @@ discard block |
||
| 1177 | 1177 | $tag = strtolower($match[2]); |
| 1178 | 1178 | |
| 1179 | 1179 | // xmp tag ?뺣━ |
| 1180 | - if($tag == 'xmp') |
|
| 1180 | + if ($tag == 'xmp') |
|
| 1181 | 1181 | { |
| 1182 | 1182 | return "<{$match[1]}xmp>"; |
| 1183 | 1183 | } |
| 1184 | - if($match[1]) |
|
| 1184 | + if ($match[1]) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | return $match[0]; |
| 1187 | 1187 | } |
| 1188 | - if($match[4]) |
|
| 1188 | + if ($match[4]) |
|
| 1189 | 1189 | { |
| 1190 | - $match[4] = ' ' . $match[4]; |
|
| 1190 | + $match[4] = ' '.$match[4]; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | $attrs = array(); |
| 1194 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1194 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1195 | 1195 | { |
| 1196 | - foreach($m[1] as $idx => $name) |
|
| 1196 | + foreach ($m[1] as $idx => $name) |
|
| 1197 | 1197 | { |
| 1198 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1198 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | continue; |
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
| 1203 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
| 1204 | 1204 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
| 1205 | 1205 | |
| 1206 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
| 1206 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
| 1207 | 1207 | { |
| 1208 | 1208 | continue; |
| 1209 | 1209 | } |
@@ -1214,60 +1214,60 @@ discard block |
||
| 1214 | 1214 | |
| 1215 | 1215 | $filter_arrts = array('style', 'src', 'href'); |
| 1216 | 1216 | |
| 1217 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1218 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1217 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1218 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1219 | 1219 | |
| 1220 | - foreach($filter_arrts as $attr) |
|
| 1220 | + foreach ($filter_arrts as $attr) |
|
| 1221 | 1221 | { |
| 1222 | - if(!isset($attrs[$attr])) continue; |
|
| 1222 | + if (!isset($attrs[$attr])) continue; |
|
| 1223 | 1223 | |
| 1224 | 1224 | $attr_value = rawurldecode($attrs[$attr]); |
| 1225 | 1225 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
| 1226 | 1226 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
| 1227 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1227 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1228 | 1228 | { |
| 1229 | 1229 | unset($attrs[$attr]); |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1233 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | unset($attrs['style']); |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | $attr = array(); |
| 1239 | - foreach($attrs as $name => $val) |
|
| 1239 | + foreach ($attrs as $name => $val) |
|
| 1240 | 1240 | { |
| 1241 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1241 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1242 | 1242 | { |
| 1243 | 1243 | $attribute = strtolower(trim($name)); |
| 1244 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1244 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1245 | 1245 | { |
| 1246 | - if(stripos($val, 'data:') === 0) |
|
| 1246 | + if (stripos($val, 'data:') === 0) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | continue; |
| 1249 | 1249 | } |
| 1250 | 1250 | } |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | - if($tag == 'img') |
|
| 1253 | + if ($tag == 'img') |
|
| 1254 | 1254 | { |
| 1255 | 1255 | $attribute = strtolower(trim($name)); |
| 1256 | - if(stripos($val, 'data:') === 0) |
|
| 1256 | + if (stripos($val, 'data:') === 0) |
|
| 1257 | 1257 | { |
| 1258 | 1258 | continue; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
| 1261 | 1261 | $val = str_replace('"', '"', $val); |
| 1262 | - $attr[] = $name . "=\"{$val}\""; |
|
| 1262 | + $attr[] = $name."=\"{$val}\""; |
|
| 1263 | 1263 | } |
| 1264 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
| 1264 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
| 1265 | 1265 | |
| 1266 | 1266 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | // convert hexa value to RGB |
| 1270 | -if(!function_exists('hexrgb')) |
|
| 1270 | +if (!function_exists('hexrgb')) |
|
| 1271 | 1271 | { |
| 1272 | 1272 | |
| 1273 | 1273 | /** |
@@ -1303,9 +1303,9 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | settype($password, "string"); |
| 1305 | 1305 | |
| 1306 | - for($i = 0; $i < strlen($password); $i++) |
|
| 1306 | + for ($i = 0; $i < strlen($password); $i++) |
|
| 1307 | 1307 | { |
| 1308 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1308 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1309 | 1309 | { |
| 1310 | 1310 | continue; |
| 1311 | 1311 | } |
@@ -1317,11 +1317,11 @@ discard block |
||
| 1317 | 1317 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
| 1318 | 1318 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
| 1319 | 1319 | |
| 1320 | - if($result1 == '80000000') |
|
| 1320 | + if ($result1 == '80000000') |
|
| 1321 | 1321 | { |
| 1322 | 1322 | $nr += 0x80000000; |
| 1323 | 1323 | } |
| 1324 | - if($result2 == '80000000') |
|
| 1324 | + if ($result2 == '80000000') |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $nr2 += 0x80000000; |
| 1327 | 1327 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | function getScriptPath() |
| 1338 | 1338 | { |
| 1339 | 1339 | static $url = NULL; |
| 1340 | - if($url == NULL) |
|
| 1340 | + if ($url == NULL) |
|
| 1341 | 1341 | { |
| 1342 | 1342 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php$/i', '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
| 1343 | 1343 | } |
@@ -1367,14 +1367,14 @@ discard block |
||
| 1367 | 1367 | $decodedStr = ''; |
| 1368 | 1368 | $pos = 0; |
| 1369 | 1369 | $len = strlen($source); |
| 1370 | - while($pos < $len) |
|
| 1370 | + while ($pos < $len) |
|
| 1371 | 1371 | { |
| 1372 | 1372 | $charAt = substr($source, $pos, 1); |
| 1373 | - if($charAt == '%') |
|
| 1373 | + if ($charAt == '%') |
|
| 1374 | 1374 | { |
| 1375 | 1375 | $pos++; |
| 1376 | 1376 | $charAt = substr($source, $pos, 1); |
| 1377 | - if($charAt == 'u') |
|
| 1377 | + if ($charAt == 'u') |
|
| 1378 | 1378 | { |
| 1379 | 1379 | // we got a unicode character |
| 1380 | 1380 | $pos++; |
@@ -1408,21 +1408,21 @@ discard block |
||
| 1408 | 1408 | */ |
| 1409 | 1409 | function _code2utf($num) |
| 1410 | 1410 | { |
| 1411 | - if($num < 128) |
|
| 1411 | + if ($num < 128) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | return chr($num); |
| 1414 | 1414 | } |
| 1415 | - if($num < 2048) |
|
| 1415 | + if ($num < 2048) |
|
| 1416 | 1416 | { |
| 1417 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 1417 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 1418 | 1418 | } |
| 1419 | - if($num < 65536) |
|
| 1419 | + if ($num < 65536) |
|
| 1420 | 1420 | { |
| 1421 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1421 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1422 | 1422 | } |
| 1423 | - if($num < 2097152) |
|
| 1423 | + if ($num < 2097152) |
|
| 1424 | 1424 | { |
| 1425 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1425 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1426 | 1426 | } |
| 1427 | 1427 | return ''; |
| 1428 | 1428 | } |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | */ |
| 1438 | 1438 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
| 1439 | 1439 | { |
| 1440 | - if($urldecode) |
|
| 1440 | + if ($urldecode) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | $string = urldecode($string); |
| 1443 | 1443 | } |
@@ -1445,12 +1445,12 @@ discard block |
||
| 1445 | 1445 | $sample = iconv('utf-8', 'utf-8', $string); |
| 1446 | 1446 | $is_utf8 = (md5($sample) === md5($string)); |
| 1447 | 1447 | |
| 1448 | - if(!$urldecode) |
|
| 1448 | + if (!$urldecode) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | $string = urldecode($string); |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | - if($return_convert) |
|
| 1453 | + if ($return_convert) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
| 1456 | 1456 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | */ |
| 1467 | 1467 | function json_encode2($data) |
| 1468 | 1468 | { |
| 1469 | - switch(gettype($data)) |
|
| 1469 | + switch (gettype($data)) |
|
| 1470 | 1470 | { |
| 1471 | 1471 | case 'boolean': |
| 1472 | 1472 | return $data ? 'true' : 'false'; |
@@ -1474,15 +1474,15 @@ discard block |
||
| 1474 | 1474 | case 'double': |
| 1475 | 1475 | return $data; |
| 1476 | 1476 | case 'string': |
| 1477 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
| 1477 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
| 1478 | 1478 | case 'object': |
| 1479 | 1479 | $data = get_object_vars($data); |
| 1480 | 1480 | case 'array': |
| 1481 | 1481 | $rel = FALSE; // relative array? |
| 1482 | 1482 | $key = array_keys($data); |
| 1483 | - foreach($key as $v) |
|
| 1483 | + foreach ($key as $v) |
|
| 1484 | 1484 | { |
| 1485 | - if(!is_int($v)) |
|
| 1485 | + if (!is_int($v)) |
|
| 1486 | 1486 | { |
| 1487 | 1487 | $rel = TRUE; |
| 1488 | 1488 | break; |
@@ -1490,12 +1490,12 @@ discard block |
||
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | $arr = array(); |
| 1493 | - foreach($data as $k => $v) |
|
| 1493 | + foreach ($data as $k => $v) |
|
| 1494 | 1494 | { |
| 1495 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
| 1495 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
| 1498 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
| 1499 | 1499 | default: |
| 1500 | 1500 | return '""'; |
| 1501 | 1501 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | */ |
| 1510 | 1510 | function isCrawler($agent = NULL) |
| 1511 | 1511 | { |
| 1512 | - if(!$agent) |
|
| 1512 | + if (!$agent) |
|
| 1513 | 1513 | { |
| 1514 | 1514 | $agent = $_SERVER['HTTP_USER_AGENT']; |
| 1515 | 1515 | } |
@@ -1519,9 +1519,9 @@ discard block |
||
| 1519 | 1519 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
| 1520 | 1520 | ); |
| 1521 | 1521 | |
| 1522 | - foreach($check_agent as $str) |
|
| 1522 | + foreach ($check_agent as $str) |
|
| 1523 | 1523 | { |
| 1524 | - if(stristr($agent, $str) != FALSE) |
|
| 1524 | + if (stristr($agent, $str) != FALSE) |
|
| 1525 | 1525 | { |
| 1526 | 1526 | return TRUE; |
| 1527 | 1527 | } |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | */ |
| 1540 | 1540 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
| 1541 | 1541 | { |
| 1542 | - if(!Context::get('is_logged')) |
|
| 1542 | + if (!Context::get('is_logged')) |
|
| 1543 | 1543 | { |
| 1544 | 1544 | return; |
| 1545 | 1545 | } |
@@ -1547,18 +1547,18 @@ discard block |
||
| 1547 | 1547 | $oModuleModel = getModel('module'); |
| 1548 | 1548 | $logged_info = Context::get('logged_info'); |
| 1549 | 1549 | |
| 1550 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1550 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1551 | 1551 | { |
| 1552 | - if($writer_member_srl) |
|
| 1552 | + if ($writer_member_srl) |
|
| 1553 | 1553 | { |
| 1554 | 1554 | $oMemberModel = getModel('member'); |
| 1555 | 1555 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
| 1556 | - if($member_info->is_admin == "Y") |
|
| 1556 | + if ($member_info->is_admin == "Y") |
|
| 1557 | 1557 | { |
| 1558 | 1558 | return; |
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
| 1561 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
| 1562 | 1562 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
| 1563 | 1563 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
| 1564 | 1564 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1574,19 +1574,19 @@ discard block |
||
| 1574 | 1574 | */ |
| 1575 | 1575 | function requirePear() |
| 1576 | 1576 | { |
| 1577 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1577 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1578 | 1578 | { |
| 1579 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
| 1579 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
| 1580 | 1580 | } |
| 1581 | 1581 | else |
| 1582 | 1582 | { |
| 1583 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
| 1583 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | 1587 | function checkCSRF() |
| 1588 | 1588 | { |
| 1589 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1589 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1590 | 1590 | { |
| 1591 | 1591 | return FALSE; |
| 1592 | 1592 | } |
@@ -1594,9 +1594,9 @@ discard block |
||
| 1594 | 1594 | $default_url = Context::getDefaultUrl(); |
| 1595 | 1595 | $referer = $_SERVER["HTTP_REFERER"]; |
| 1596 | 1596 | |
| 1597 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1597 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1598 | 1598 | { |
| 1599 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1599 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1600 | 1600 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1601 | 1601 | $referer = $IDN->encode($referer); |
| 1602 | 1602 | } |
@@ -1607,9 +1607,9 @@ discard block |
||
| 1607 | 1607 | $oModuleModel = getModel('module'); |
| 1608 | 1608 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
| 1609 | 1609 | |
| 1610 | - if($siteModuleInfo->site_srl == 0) |
|
| 1610 | + if ($siteModuleInfo->site_srl == 0) |
|
| 1611 | 1611 | { |
| 1612 | - if($default_url['host'] !== $referer['host']) |
|
| 1612 | + if ($default_url['host'] !== $referer['host']) |
|
| 1613 | 1613 | { |
| 1614 | 1614 | return FALSE; |
| 1615 | 1615 | } |
@@ -1617,7 +1617,7 @@ discard block |
||
| 1617 | 1617 | else |
| 1618 | 1618 | { |
| 1619 | 1619 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
| 1620 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1620 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1621 | 1621 | { |
| 1622 | 1622 | return FALSE; |
| 1623 | 1623 | } |
@@ -1633,15 +1633,15 @@ discard block |
||
| 1633 | 1633 | */ |
| 1634 | 1634 | function recurciveExposureCheck(&$menu) |
| 1635 | 1635 | { |
| 1636 | - if(is_array($menu)) |
|
| 1636 | + if (is_array($menu)) |
|
| 1637 | 1637 | { |
| 1638 | - foreach($menu AS $key=>$value) |
|
| 1638 | + foreach ($menu AS $key=>$value) |
|
| 1639 | 1639 | { |
| 1640 | - if(!$value['isShow']) |
|
| 1640 | + if (!$value['isShow']) |
|
| 1641 | 1641 | { |
| 1642 | 1642 | unset($menu[$key]); |
| 1643 | 1643 | } |
| 1644 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
| 1644 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
| 1645 | 1645 | { |
| 1646 | 1646 | recurciveExposureCheck($menu[$key]['list']); |
| 1647 | 1647 | } |
@@ -1651,14 +1651,14 @@ discard block |
||
| 1651 | 1651 | |
| 1652 | 1652 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
| 1653 | 1653 | { |
| 1654 | - if($requestKey != $dbKey) |
|
| 1654 | + if ($requestKey != $dbKey) |
|
| 1655 | 1655 | { |
| 1656 | 1656 | $arrayUrl = parse_url(Context::get('success_return_url')); |
| 1657 | - if($arrayUrl['query']) |
|
| 1657 | + if ($arrayUrl['query']) |
|
| 1658 | 1658 | { |
| 1659 | 1659 | parse_str($arrayUrl['query'], $parsedStr); |
| 1660 | 1660 | |
| 1661 | - if(isset($parsedStr[$key])) |
|
| 1661 | + if (isset($parsedStr[$key])) |
|
| 1662 | 1662 | { |
| 1663 | 1663 | $parsedStr[$key] = $requestKey; |
| 1664 | 1664 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1701,14 +1701,14 @@ discard block |
||
| 1701 | 1701 | */ |
| 1702 | 1702 | function alertScript($msg) |
| 1703 | 1703 | { |
| 1704 | - if(!$msg) |
|
| 1704 | + if (!$msg) |
|
| 1705 | 1705 | { |
| 1706 | 1706 | return; |
| 1707 | 1707 | } |
| 1708 | 1708 | |
| 1709 | 1709 | echo '<script type="text/javascript"> |
| 1710 | 1710 | //<![CDATA[ |
| 1711 | -alert("' . $msg . '"); |
|
| 1711 | +alert("' . $msg.'"); |
|
| 1712 | 1712 | //]]> |
| 1713 | 1713 | </script>'; |
| 1714 | 1714 | } |
@@ -1739,7 +1739,7 @@ discard block |
||
| 1739 | 1739 | |
| 1740 | 1740 | echo '<script type="text/javascript"> |
| 1741 | 1741 | //<![CDATA[ |
| 1742 | -' . $reloadScript . ' |
|
| 1742 | +' . $reloadScript.' |
|
| 1743 | 1743 | //]]> |
| 1744 | 1744 | </script>'; |
| 1745 | 1745 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function _loadFromDB($load_extra_vars = true) |
| 76 | 76 | { |
| 77 | - if(!$this->document_srl) return; |
|
| 77 | + if (!$this->document_srl) return; |
|
| 78 | 78 | |
| 79 | 79 | $document_item = false; |
| 80 | 80 | $cache_put = false; |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // cache controll |
| 85 | 85 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 86 | - if($oCacheHandler->isSupport()) |
|
| 86 | + if ($oCacheHandler->isSupport()) |
|
| 87 | 87 | { |
| 88 | - $cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl; |
|
| 88 | + $cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl; |
|
| 89 | 89 | $document_item = $oCacheHandler->get($cache_key); |
| 90 | - if($document_item !== false) |
|
| 90 | + if ($document_item !== false) |
|
| 91 | 91 | { |
| 92 | 92 | $columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count'); |
| 93 | 93 | } |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | $args->document_srl = $this->document_srl; |
| 98 | 98 | $output = executeQuery('document.getDocument', $args, $columnList); |
| 99 | 99 | |
| 100 | - if($document_item === false) |
|
| 100 | + if ($document_item === false) |
|
| 101 | 101 | { |
| 102 | 102 | $document_item = $output->data; |
| 103 | 103 | |
| 104 | 104 | //insert in cache |
| 105 | - if($document_item && $oCacheHandler->isSupport()) |
|
| 105 | + if ($document_item && $oCacheHandler->isSupport()) |
|
| 106 | 106 | { |
| 107 | 107 | $oCacheHandler->put($cache_key, $document_item); |
| 108 | 108 | } |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $this->setAttribute($document_item, $load_extra_vars); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - function setAttribute($attribute, $load_extra_vars=true) |
|
| 122 | + function setAttribute($attribute, $load_extra_vars = true) |
|
| 123 | 123 | { |
| 124 | - if(!$attribute->document_srl) |
|
| 124 | + if (!$attribute->document_srl) |
|
| 125 | 125 | { |
| 126 | 126 | $this->document_srl = null; |
| 127 | 127 | return; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $this->adds($attribute); |
| 132 | 132 | |
| 133 | 133 | // Tags |
| 134 | - if($this->get('tags')) |
|
| 134 | + if ($this->get('tags')) |
|
| 135 | 135 | { |
| 136 | 136 | $tag_list = explode(',', $this->get('tags')); |
| 137 | 137 | $tag_list = array_map('trim', $tag_list); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $oDocumentModel = getModel('document'); |
| 142 | - if($load_extra_vars) |
|
| 142 | + if ($load_extra_vars) |
|
| 143 | 143 | { |
| 144 | 144 | $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this; |
| 145 | 145 | $oDocumentModel->setToAllDocumentExtraVars(); |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | function isGranted() |
| 156 | 156 | { |
| 157 | - if($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 157 | + if ($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 158 | 158 | |
| 159 | - if(!Context::get('is_logged')) return false; |
|
| 159 | + if (!Context::get('is_logged')) return false; |
|
| 160 | 160 | |
| 161 | 161 | $logged_info = Context::get('logged_info'); |
| 162 | - if($logged_info->is_admin == 'Y') return true; |
|
| 162 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 163 | 163 | |
| 164 | 164 | $oModuleModel = getModel('module'); |
| 165 | 165 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 166 | - if($grant->manager) return true; |
|
| 166 | + if ($grant->manager) return true; |
|
| 167 | 167 | |
| 168 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true; |
|
| 168 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return true; |
|
| 169 | 169 | |
| 170 | 170 | return false; |
| 171 | 171 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | function isAccessible() |
| 179 | 179 | { |
| 180 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
| 180 | + return $_SESSION['accessible'][$this->document_srl] == true ? true : false; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | function allowComment() |
| 184 | 184 | { |
| 185 | 185 | // init write, document is not exists. so allow comment status is true |
| 186 | - if(!$this->isExists()) return true; |
|
| 186 | + if (!$this->isExists()) return true; |
|
| 187 | 187 | |
| 188 | 188 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 189 | 189 | } |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | function allowTrackback() |
| 192 | 192 | { |
| 193 | 193 | static $allow_trackback_status = null; |
| 194 | - if(is_null($allow_trackback_status)) |
|
| 194 | + if (is_null($allow_trackback_status)) |
|
| 195 | 195 | { |
| 196 | 196 | |
| 197 | 197 | // Check the tarckback module exist |
| 198 | - if(!getClass('trackback')) |
|
| 198 | + if (!getClass('trackback')) |
|
| 199 | 199 | { |
| 200 | 200 | $allow_trackback_status = false; |
| 201 | 201 | } |
@@ -205,20 +205,20 @@ discard block |
||
| 205 | 205 | $oModuleModel = getModel('module'); |
| 206 | 206 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
| 207 | 207 | |
| 208 | - if(!$trackback_config) |
|
| 208 | + if (!$trackback_config) |
|
| 209 | 209 | { |
| 210 | 210 | $trackback_config = new stdClass(); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 213 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 215 | 215 | else |
| 216 | 216 | { |
| 217 | 217 | $module_srl = $this->get('module_srl'); |
| 218 | 218 | // Check settings of each module |
| 219 | 219 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 220 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 220 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | function isLocked() |
| 229 | 229 | { |
| 230 | - if(!$this->isExists()) return false; |
|
| 230 | + if (!$this->isExists()) return false; |
|
| 231 | 231 | |
| 232 | 232 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | function isEditable() |
| 236 | 236 | { |
| 237 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 237 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 238 | 238 | return false; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | function useNotify() |
| 253 | 253 | { |
| 254 | - return $this->get('notify_message')=='Y' ? true : false; |
|
| 254 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | function doCart() |
| 258 | 258 | { |
| 259 | - if(!$this->document_srl) return false; |
|
| 260 | - if($this->isCarted()) $this->removeCart(); |
|
| 259 | + if (!$this->document_srl) return false; |
|
| 260 | + if ($this->isCarted()) $this->removeCart(); |
|
| 261 | 261 | else $this->addCart(); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function notify($type, $content) |
| 286 | 286 | { |
| 287 | - if(!$this->document_srl) return; |
|
| 287 | + if (!$this->document_srl) return; |
|
| 288 | 288 | // return if it is not useNotify |
| 289 | - if(!$this->useNotify()) return; |
|
| 289 | + if (!$this->useNotify()) return; |
|
| 290 | 290 | // Pass if an author is not a logged-in user |
| 291 | - if(!$this->get('member_srl')) return; |
|
| 291 | + if (!$this->get('member_srl')) return; |
|
| 292 | 292 | // Return if the currently logged-in user is an author |
| 293 | 293 | $logged_info = Context::get('logged_info'); |
| 294 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 294 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 295 | 295 | // List variables |
| 296 | - if($type) $title = "[".$type."] "; |
|
| 296 | + if ($type) $title = "[".$type."] "; |
|
| 297 | 297 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 298 | - $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
|
| 298 | + $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl)); |
|
| 299 | 299 | $receiver_srl = $this->get('member_srl'); |
| 300 | 300 | $sender_member_srl = $logged_info->member_srl; |
| 301 | 301 | // Send a message |
@@ -310,26 +310,26 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | function getIpAddress() |
| 312 | 312 | { |
| 313 | - if($this->isGranted()) |
|
| 313 | + if ($this->isGranted()) |
|
| 314 | 314 | { |
| 315 | 315 | return $this->get('ipaddress'); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
| 318 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | function isExistsHomepage() |
| 322 | 322 | { |
| 323 | - if(trim($this->get('homepage'))) return true; |
|
| 323 | + if (trim($this->get('homepage'))) return true; |
|
| 324 | 324 | return false; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | function getHomepageUrl() |
| 328 | 328 | { |
| 329 | 329 | $url = trim($this->get('homepage')); |
| 330 | - if(!$url) return; |
|
| 330 | + if (!$url) return; |
|
| 331 | 331 | |
| 332 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 332 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
| 333 | 333 | |
| 334 | 334 | return $url; |
| 335 | 335 | } |
@@ -359,52 +359,52 @@ discard block |
||
| 359 | 359 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - function getTitleText($cut_size = 0, $tail='...') |
|
| 362 | + function getTitleText($cut_size = 0, $tail = '...') |
|
| 363 | 363 | { |
| 364 | - if(!$this->document_srl) return; |
|
| 364 | + if (!$this->document_srl) return; |
|
| 365 | 365 | |
| 366 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 366 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 367 | 367 | else $title = $this->get('title'); |
| 368 | 368 | |
| 369 | 369 | return $title; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - function getTitle($cut_size = 0, $tail='...') |
|
| 372 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 373 | 373 | { |
| 374 | - if(!$this->document_srl) return; |
|
| 374 | + if (!$this->document_srl) return; |
|
| 375 | 375 | |
| 376 | 376 | $title = $this->getTitleText($cut_size, $tail); |
| 377 | 377 | |
| 378 | 378 | $attrs = array(); |
| 379 | 379 | $this->add('title_color', trim($this->get('title_color'))); |
| 380 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 380 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 382 | 382 | |
| 383 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 383 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 384 | 384 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | function getContentText($strlen = 0) |
| 388 | 388 | { |
| 389 | - if(!$this->document_srl) return; |
|
| 389 | + if (!$this->document_srl) return; |
|
| 390 | 390 | |
| 391 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 391 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 392 | 392 | |
| 393 | 393 | $result = $this->_checkAccessibleFromStatus(); |
| 394 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 394 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 395 | 395 | |
| 396 | 396 | $content = $this->get('content'); |
| 397 | 397 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 398 | 398 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 399 | 399 | |
| 400 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 400 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
| 401 | 401 | |
| 402 | 402 | return htmlspecialchars($content); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | function _addAllowScriptAccess($m) |
| 406 | 406 | { |
| 407 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 407 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 408 | 408 | { |
| 409 | 409 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
| 410 | 410 | } |
@@ -414,26 +414,26 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | function _checkAllowScriptAccess($m) |
| 416 | 416 | { |
| 417 | - if($m[1] == 'object') |
|
| 417 | + if ($m[1] == 'object') |
|
| 418 | 418 | { |
| 419 | 419 | $this->allowscriptaccessList[] = 1; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if($m[1] == 'param') |
|
| 422 | + if ($m[1] == 'param') |
|
| 423 | 423 | { |
| 424 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 424 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 425 | 425 | { |
| 426 | 426 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
| 427 | - if(substr($m[0], -1) == '/') |
|
| 427 | + if (substr($m[0], -1) == '/') |
|
| 428 | 428 | { |
| 429 | 429 | $m[0] .= '/'; |
| 430 | 430 | } |
| 431 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
| 431 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | - else if($m[1] == 'embed') |
|
| 434 | + else if ($m[1] == 'embed') |
|
| 435 | 435 | { |
| 436 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 436 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 437 | 437 | { |
| 438 | 438 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 439 | 439 | } |
@@ -447,24 +447,24 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 449 | 449 | { |
| 450 | - if(!$this->document_srl) return; |
|
| 450 | + if (!$this->document_srl) return; |
|
| 451 | 451 | |
| 452 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 452 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 453 | 453 | |
| 454 | 454 | $result = $this->_checkAccessibleFromStatus(); |
| 455 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 455 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 456 | 456 | |
| 457 | 457 | $content = $this->get('content'); |
| 458 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 458 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 459 | 459 | |
| 460 | 460 | // Define a link if using a rewrite module |
| 461 | 461 | $oContext = &Context::getInstance(); |
| 462 | - if($oContext->allow_rewrite) |
|
| 462 | + if ($oContext->allow_rewrite) |
|
| 463 | 463 | { |
| 464 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
| 464 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
| 465 | 465 | } |
| 466 | 466 | // To display a pop-up menu |
| 467 | - if($add_popup_menu) |
|
| 467 | + if ($add_popup_menu) |
|
| 468 | 468 | { |
| 469 | 469 | $content = sprintf( |
| 470 | 470 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | ); |
| 474 | 474 | } |
| 475 | 475 | // If additional content information is set |
| 476 | - if($add_content_info) |
|
| 476 | + if ($add_content_info) |
|
| 477 | 477 | { |
| 478 | 478 | $memberSrl = $this->get('member_srl'); |
| 479 | - if($memberSrl < 0) |
|
| 479 | + if ($memberSrl < 0) |
|
| 480 | 480 | { |
| 481 | 481 | $memberSrl = 0; |
| 482 | 482 | } |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | { |
| 495 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 495 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 496 | 496 | } |
| 497 | 497 | // Change the image path to a valid absolute path if resource_realpath is true |
| 498 | - if($resource_realpath) |
|
| 498 | + if ($resource_realpath) |
|
| 499 | 499 | { |
| 500 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
| 500 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | return $content; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $content = trim(cut_str($content, $str_size, $tail)); |
| 547 | 547 | |
| 548 | 548 | // Replace back < , <, " |
| 549 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
| 549 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 550 | 550 | |
| 551 | 551 | return $content; |
| 552 | 552 | } |
@@ -559,13 +559,13 @@ discard block |
||
| 559 | 559 | function getRegdateTime() |
| 560 | 560 | { |
| 561 | 561 | $regdate = $this->get('regdate'); |
| 562 | - $year = substr($regdate,0,4); |
|
| 563 | - $month = substr($regdate,4,2); |
|
| 564 | - $day = substr($regdate,6,2); |
|
| 565 | - $hour = substr($regdate,8,2); |
|
| 566 | - $min = substr($regdate,10,2); |
|
| 567 | - $sec = substr($regdate,12,2); |
|
| 568 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 562 | + $year = substr($regdate, 0, 4); |
|
| 563 | + $month = substr($regdate, 4, 2); |
|
| 564 | + $day = substr($regdate, 6, 2); |
|
| 565 | + $hour = substr($regdate, 8, 2); |
|
| 566 | + $min = substr($regdate, 10, 2); |
|
| 567 | + $sec = substr($regdate, 12, 2); |
|
| 568 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | function getRegdateGM() |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | function getRegdateDT() |
| 577 | 577 | { |
| 578 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 578 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -585,13 +585,13 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | function getUpdateTime() |
| 587 | 587 | { |
| 588 | - $year = substr($this->get('last_update'),0,4); |
|
| 589 | - $month = substr($this->get('last_update'),4,2); |
|
| 590 | - $day = substr($this->get('last_update'),6,2); |
|
| 591 | - $hour = substr($this->get('last_update'),8,2); |
|
| 592 | - $min = substr($this->get('last_update'),10,2); |
|
| 593 | - $sec = substr($this->get('last_update'),12,2); |
|
| 594 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 588 | + $year = substr($this->get('last_update'), 0, 4); |
|
| 589 | + $month = substr($this->get('last_update'), 4, 2); |
|
| 590 | + $day = substr($this->get('last_update'), 6, 2); |
|
| 591 | + $hour = substr($this->get('last_update'), 8, 2); |
|
| 592 | + $min = substr($this->get('last_update'), 10, 2); |
|
| 593 | + $sec = substr($this->get('last_update'), 12, 2); |
|
| 594 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | function getUpdateGM() |
@@ -601,21 +601,21 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | function getUpdateDT() |
| 603 | 603 | { |
| 604 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 604 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | function getPermanentUrl() |
| 608 | 608 | { |
| 609 | - return getFullUrl('','document_srl',$this->get('document_srl')); |
|
| 609 | + return getFullUrl('', 'document_srl', $this->get('document_srl')); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | function getTrackbackUrl() |
| 613 | 613 | { |
| 614 | - if(!$this->document_srl) return; |
|
| 614 | + if (!$this->document_srl) return; |
|
| 615 | 615 | |
| 616 | 616 | // Generate a key to prevent spams |
| 617 | 617 | $oTrackbackModel = getModel('trackback'); |
| 618 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 618 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -625,24 +625,24 @@ discard block |
||
| 625 | 625 | function updateReadedCount() |
| 626 | 626 | { |
| 627 | 627 | $oDocumentController = getController('document'); |
| 628 | - if($oDocumentController->updateReadedCount($this)) |
|
| 628 | + if ($oDocumentController->updateReadedCount($this)) |
|
| 629 | 629 | { |
| 630 | 630 | $readed_count = $this->get('readed_count'); |
| 631 | - $this->add('readed_count', $readed_count+1); |
|
| 631 | + $this->add('readed_count', $readed_count + 1); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | function isExtraVarsExists() |
| 636 | 636 | { |
| 637 | - if(!$this->get('module_srl')) return false; |
|
| 637 | + if (!$this->get('module_srl')) return false; |
|
| 638 | 638 | $oDocumentModel = getModel('document'); |
| 639 | 639 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 640 | - return count($extra_keys)?true:false; |
|
| 640 | + return count($extra_keys) ? true : false; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | function getExtraVars() |
| 644 | 644 | { |
| 645 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 645 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 646 | 646 | |
| 647 | 647 | $oDocumentModel = getModel('document'); |
| 648 | 648 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | function getExtraValue($idx) |
| 652 | 652 | { |
| 653 | 653 | $extra_vars = $this->getExtraVars(); |
| 654 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 654 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 655 | 655 | { |
| 656 | 656 | return $extra_vars[$idx]->getValue(); |
| 657 | 657 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | function getExtraValueHTML($idx) |
| 665 | 665 | { |
| 666 | 666 | $extra_vars = $this->getExtraVars(); |
| 667 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 667 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 668 | 668 | { |
| 669 | 669 | return $extra_vars[$idx]->getValueHTML(); |
| 670 | 670 | } |
@@ -678,16 +678,16 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | $extra_vars = $this->getExtraVars(); |
| 680 | 680 | |
| 681 | - if($extra_vars) |
|
| 681 | + if ($extra_vars) |
|
| 682 | 682 | { |
| 683 | 683 | // Handle extra variable(eid) |
| 684 | - foreach($extra_vars as $idx => $key) |
|
| 684 | + foreach ($extra_vars as $idx => $key) |
|
| 685 | 685 | { |
| 686 | 686 | $extra_eid[$key->eid] = $key; |
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 690 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 691 | 691 | { |
| 692 | 692 | return $extra_eid[$eid]->getValue(); |
| 693 | 693 | } |
@@ -701,12 +701,12 @@ discard block |
||
| 701 | 701 | { |
| 702 | 702 | $extra_vars = $this->getExtraVars(); |
| 703 | 703 | // Handle extra variable(eid) |
| 704 | - foreach($extra_vars as $idx => $key) |
|
| 704 | + foreach ($extra_vars as $idx => $key) |
|
| 705 | 705 | { |
| 706 | 706 | $extra_eid[$key->eid] = $key; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 709 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 710 | 710 | { |
| 711 | 711 | return $extra_eid[$eid]->getValueHTML(); |
| 712 | 712 | } |
@@ -730,13 +730,13 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | function getComments() |
| 732 | 732 | { |
| 733 | - if(!$this->getCommentCount()) return; |
|
| 734 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 733 | + if (!$this->getCommentCount()) return; |
|
| 734 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
| 735 | 735 | // cpage is a number of comment pages |
| 736 | 736 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 737 | 737 | $cpage = Context::get($cpageStr); |
| 738 | 738 | |
| 739 | - if(!$cpage) |
|
| 739 | + if (!$cpage) |
|
| 740 | 740 | { |
| 741 | 741 | $cpage = Context::get('cpage'); |
| 742 | 742 | } |
@@ -744,19 +744,19 @@ discard block |
||
| 744 | 744 | // Get a list of comments |
| 745 | 745 | $oCommentModel = getModel('comment'); |
| 746 | 746 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 747 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 747 | + if (!$output->toBool() || !count($output->data)) return; |
|
| 748 | 748 | // Create commentItem object from a comment list |
| 749 | 749 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 750 | 750 | $accessible = array(); |
| 751 | 751 | $comment_list = array(); |
| 752 | - foreach($output->data as $key => $val) |
|
| 752 | + foreach ($output->data as $key => $val) |
|
| 753 | 753 | { |
| 754 | 754 | $oCommentItem = new commentItem(); |
| 755 | 755 | $oCommentItem->setAttribute($val); |
| 756 | 756 | // If permission is granted to the post, you can access it temporarily |
| 757 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 757 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 758 | 758 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 759 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
| 759 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
| 760 | 760 | { |
| 761 | 761 | $oCommentItem->setAccessible(); |
| 762 | 762 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | // Variable setting to be displayed on the skin |
| 766 | 766 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 767 | 767 | Context::set('cpage', $output->page_navigation->cur_page); |
| 768 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 768 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
| 769 | 769 | |
| 770 | 770 | return $comment_list; |
| 771 | 771 | } |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | |
| 778 | 778 | function getTrackbacks() |
| 779 | 779 | { |
| 780 | - if(!$this->document_srl) return; |
|
| 780 | + if (!$this->document_srl) return; |
|
| 781 | 781 | |
| 782 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 782 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 783 | 783 | |
| 784 | 784 | $oTrackbackModel = getModel('trackback'); |
| 785 | 785 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -787,47 +787,47 @@ discard block |
||
| 787 | 787 | |
| 788 | 788 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 789 | 789 | { |
| 790 | - if(!$this->document_srl) return false; |
|
| 791 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 790 | + if (!$this->document_srl) return false; |
|
| 791 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
| 792 | 792 | return true; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 796 | 796 | { |
| 797 | 797 | // Return false if the document doesn't exist |
| 798 | - if(!$this->document_srl) return; |
|
| 798 | + if (!$this->document_srl) return; |
|
| 799 | 799 | |
| 800 | - if($this->isSecret() && !$this->isGranted()) |
|
| 800 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 801 | 801 | { |
| 802 | 802 | return; |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | // If not specify its height, create a square |
| 806 | - if(!$height) $height = $width; |
|
| 806 | + if (!$height) $height = $width; |
|
| 807 | 807 | |
| 808 | 808 | // Return false if neither attachement nor image files in the document |
| 809 | 809 | $content = $this->get('content'); |
| 810 | - if(!$this->get('uploaded_count')) |
|
| 810 | + if (!$this->get('uploaded_count')) |
|
| 811 | 811 | { |
| 812 | - if(!$content) |
|
| 812 | + if (!$content) |
|
| 813 | 813 | { |
| 814 | 814 | $args = new stdClass(); |
| 815 | 815 | $args->document_srl = $this->document_srl; |
| 816 | 816 | $output = executeQuery('document.getDocument', $args, array('content')); |
| 817 | - if($output->toBool() && $output->data) |
|
| 817 | + if ($output->toBool() && $output->data) |
|
| 818 | 818 | { |
| 819 | 819 | $content = $output->data->content; |
| 820 | 820 | $this->add('content', $content); |
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if(!preg_match("!<img!is", $content)) return; |
|
| 824 | + if (!preg_match("!<img!is", $content)) return; |
|
| 825 | 825 | } |
| 826 | 826 | // Get thumbnai_type information from document module's configuration |
| 827 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
| 827 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 828 | 828 | { |
| 829 | 829 | $config = $GLOBALS['__document_config__']; |
| 830 | - if(!$config) |
|
| 830 | + if (!$config) |
|
| 831 | 831 | { |
| 832 | 832 | $oDocumentModel = getModel('document'); |
| 833 | 833 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -836,13 +836,13 @@ discard block |
||
| 836 | 836 | $thumbnail_type = $config->thumbnail_type; |
| 837 | 837 | } |
| 838 | 838 | // Define thumbnail information |
| 839 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
| 839 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
| 840 | 840 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 841 | 841 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
| 842 | 842 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 843 | - if(file_exists($thumbnail_file)) |
|
| 843 | + if (file_exists($thumbnail_file)) |
|
| 844 | 844 | { |
| 845 | - if(filesize($thumbnail_file)<1) return false; |
|
| 845 | + if (filesize($thumbnail_file) < 1) return false; |
|
| 846 | 846 | else return $thumbnail_url; |
| 847 | 847 | } |
| 848 | 848 | |
@@ -851,64 +851,64 @@ discard block |
||
| 851 | 851 | $is_tmp_file = false; |
| 852 | 852 | |
| 853 | 853 | // Find an iamge file among attached files if exists |
| 854 | - if($this->hasUploadedFiles()) |
|
| 854 | + if ($this->hasUploadedFiles()) |
|
| 855 | 855 | { |
| 856 | 856 | $file_list = $this->getUploadedFiles(); |
| 857 | 857 | |
| 858 | 858 | $first_image = null; |
| 859 | - foreach($file_list as $file) |
|
| 859 | + foreach ($file_list as $file) |
|
| 860 | 860 | { |
| 861 | - if($file->direct_download !== 'Y') continue; |
|
| 861 | + if ($file->direct_download !== 'Y') continue; |
|
| 862 | 862 | |
| 863 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 863 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 864 | 864 | { |
| 865 | 865 | $source_file = $file->uploaded_filename; |
| 866 | 866 | break; |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - if($first_image) continue; |
|
| 869 | + if ($first_image) continue; |
|
| 870 | 870 | |
| 871 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 871 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 872 | 872 | { |
| 873 | - if(file_exists($file->uploaded_filename)) |
|
| 873 | + if (file_exists($file->uploaded_filename)) |
|
| 874 | 874 | { |
| 875 | 875 | $first_image = $file->uploaded_filename; |
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - if(!$source_file && $first_image) |
|
| 880 | + if (!$source_file && $first_image) |
|
| 881 | 881 | { |
| 882 | 882 | $source_file = $first_image; |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | // If not exists, file an image file from the content |
| 886 | 886 | $is_tmp_file = false; |
| 887 | - if(!$source_file) |
|
| 887 | + if (!$source_file) |
|
| 888 | 888 | { |
| 889 | 889 | $random = new Password(); |
| 890 | 890 | |
| 891 | 891 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
| 892 | 892 | |
| 893 | - foreach($matches as $target_image) |
|
| 893 | + foreach ($matches as $target_image) |
|
| 894 | 894 | { |
| 895 | 895 | $target_src = trim($target_image[1]); |
| 896 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 896 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 897 | 897 | |
| 898 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 898 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 899 | 899 | { |
| 900 | 900 | $target_src = Context::getRequestUri().$target_src; |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | $target_src = htmlspecialchars_decode($target_src); |
| 904 | 904 | |
| 905 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
| 905 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
| 906 | 906 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 907 | - if(!file_exists($tmp_file)) continue; |
|
| 907 | + if (!file_exists($tmp_file)) continue; |
|
| 908 | 908 | |
| 909 | 909 | $imageinfo = getimagesize($tmp_file); |
| 910 | 910 | list($_w, $_h) = $imageinfo; |
| 911 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 911 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 912 | 912 | FileHandler::removeFile($tmp_file); |
| 913 | 913 | continue; |
| 914 | 914 | } |
@@ -919,15 +919,15 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - if($source_file) |
|
| 922 | + if ($source_file) |
|
| 923 | 923 | { |
| 924 | 924 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 925 | 925 | } |
| 926 | - if($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 926 | + if ($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 927 | 927 | // Return its path if a thumbnail is successfully genetated |
| 928 | - if($output) return $thumbnail_url; |
|
| 928 | + if ($output) return $thumbnail_url; |
|
| 929 | 929 | // Create an empty file not to re-generate the thumbnail |
| 930 | - else FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 930 | + else FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 931 | 931 | |
| 932 | 932 | return; |
| 933 | 933 | } |
@@ -940,21 +940,21 @@ discard block |
||
| 940 | 940 | */ |
| 941 | 941 | function getExtraImages($time_interval = 43200) |
| 942 | 942 | { |
| 943 | - if(!$this->document_srl) return; |
|
| 943 | + if (!$this->document_srl) return; |
|
| 944 | 944 | // variables for icon list |
| 945 | 945 | $buffs = array(); |
| 946 | 946 | |
| 947 | 947 | $check_files = false; |
| 948 | 948 | |
| 949 | 949 | // Check if secret post is |
| 950 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 950 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 951 | 951 | |
| 952 | 952 | // Set the latest time |
| 953 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 953 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 954 | 954 | |
| 955 | 955 | // Check new post |
| 956 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 957 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 956 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 957 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 958 | 958 | |
| 959 | 959 | /* |
| 960 | 960 | $content = $this->get('content'); |
@@ -977,14 +977,14 @@ discard block |
||
| 977 | 977 | */ |
| 978 | 978 | |
| 979 | 979 | // Check the attachment |
| 980 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 980 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 981 | 981 | |
| 982 | 982 | return $buffs; |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | function getStatus() |
| 986 | 986 | { |
| 987 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
| 987 | + if (!$this->get('status')) return $this->getDefaultStatus(); |
|
| 988 | 988 | return $this->get('status'); |
| 989 | 989 | } |
| 990 | 990 | |
@@ -995,15 +995,15 @@ discard block |
||
| 995 | 995 | */ |
| 996 | 996 | function printExtraImages($time_check = 43200) |
| 997 | 997 | { |
| 998 | - if(!$this->document_srl) return; |
|
| 998 | + if (!$this->document_srl) return; |
|
| 999 | 999 | // Get the icon directory |
| 1000 | - $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
|
| 1000 | + $path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/'); |
|
| 1001 | 1001 | |
| 1002 | 1002 | $buffs = $this->getExtraImages($time_check); |
| 1003 | - if(!count($buffs)) return; |
|
| 1003 | + if (!count($buffs)) return; |
|
| 1004 | 1004 | |
| 1005 | 1005 | $buff = array(); |
| 1006 | - foreach($buffs as $key => $val) |
|
| 1006 | + foreach ($buffs as $key => $val) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 1009 | 1009 | } |
@@ -1012,20 +1012,20 @@ discard block |
||
| 1012 | 1012 | |
| 1013 | 1013 | function hasUploadedFiles() |
| 1014 | 1014 | { |
| 1015 | - if(!$this->document_srl) return; |
|
| 1015 | + if (!$this->document_srl) return; |
|
| 1016 | 1016 | |
| 1017 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1018 | - return $this->get('uploaded_count')? true : false; |
|
| 1017 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 1018 | + return $this->get('uploaded_count') ? true : false; |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1022 | 1022 | { |
| 1023 | - if(!$this->document_srl) return; |
|
| 1023 | + if (!$this->document_srl) return; |
|
| 1024 | 1024 | |
| 1025 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1026 | - if(!$this->get('uploaded_count')) return; |
|
| 1025 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1026 | + if (!$this->get('uploaded_count')) return; |
|
| 1027 | 1027 | |
| 1028 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1028 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1029 | 1029 | { |
| 1030 | 1030 | $oFileModel = getModel('file'); |
| 1031 | 1031 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | function getEditor() |
| 1042 | 1042 | { |
| 1043 | 1043 | $module_srl = $this->get('module_srl'); |
| 1044 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1044 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1045 | 1045 | |
| 1046 | 1046 | $oEditorModel = getModel('editor'); |
| 1047 | 1047 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | { |
| 1057 | 1057 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1058 | 1058 | if (!$this->allowComment()) return false; |
| 1059 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1059 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1060 | 1060 | |
| 1061 | 1061 | return true; |
| 1062 | 1062 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | */ |
| 1068 | 1068 | function getCommentEditor() |
| 1069 | 1069 | { |
| 1070 | - if(!$this->isEnableComment()) return; |
|
| 1070 | + if (!$this->isEnableComment()) return; |
|
| 1071 | 1071 | |
| 1072 | 1072 | $oEditorModel = getModel('editor'); |
| 1073 | 1073 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1079,10 +1079,10 @@ discard block |
||
| 1079 | 1079 | */ |
| 1080 | 1080 | function getProfileImage() |
| 1081 | 1081 | { |
| 1082 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1082 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1083 | 1083 | $oMemberModel = getModel('member'); |
| 1084 | 1084 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1085 | - if(!$profile_info) return; |
|
| 1085 | + if (!$profile_info) return; |
|
| 1086 | 1086 | |
| 1087 | 1087 | return $profile_info->src; |
| 1088 | 1088 | } |
@@ -1094,21 +1094,21 @@ discard block |
||
| 1094 | 1094 | function getSignature() |
| 1095 | 1095 | { |
| 1096 | 1096 | // Pass if a document doesn't exist |
| 1097 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1097 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1098 | 1098 | // Get signature information |
| 1099 | 1099 | $oMemberModel = getModel('member'); |
| 1100 | 1100 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1101 | 1101 | // Check if a maximum height of signiture is set in the member module |
| 1102 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1102 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1103 | 1103 | { |
| 1104 | 1104 | $oModuleModel = getModel('module'); |
| 1105 | 1105 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1106 | 1106 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1107 | 1107 | } |
| 1108 | - if($signature) |
|
| 1108 | + if ($signature) |
|
| 1109 | 1109 | { |
| 1110 | 1110 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1111 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1111 | + if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | return $signature; |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | */ |
| 1122 | 1122 | function replaceResourceRealPath($matches) |
| 1123 | 1123 | { |
| 1124 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1124 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | /** |
@@ -1132,19 +1132,19 @@ discard block |
||
| 1132 | 1132 | function _checkAccessibleFromStatus() |
| 1133 | 1133 | { |
| 1134 | 1134 | $logged_info = Context::get('logged_info'); |
| 1135 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1135 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1136 | 1136 | |
| 1137 | 1137 | $status = $this->get('status'); |
| 1138 | - if(empty($status)) return false; |
|
| 1138 | + if (empty($status)) return false; |
|
| 1139 | 1139 | |
| 1140 | 1140 | $oDocumentModel = getModel('document'); |
| 1141 | 1141 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1142 | 1142 | |
| 1143 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1143 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1144 | 1144 | return true; |
| 1145 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1145 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1146 | 1146 | { |
| 1147 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1147 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1148 | 1148 | return true; |
| 1149 | 1149 | } |
| 1150 | 1150 | return false; |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function _loadFromDB($load_extra_vars = true) |
| 76 | 76 | { |
| 77 | - if(!$this->document_srl) return; |
|
| 77 | + if(!$this->document_srl) { |
|
| 78 | + return; |
|
| 79 | + } |
|
| 78 | 80 | |
| 79 | 81 | $document_item = false; |
| 80 | 82 | $cache_put = false; |
@@ -106,8 +108,7 @@ discard block |
||
| 106 | 108 | { |
| 107 | 109 | $oCacheHandler->put($cache_key, $document_item); |
| 108 | 110 | } |
| 109 | - } |
|
| 110 | - else |
|
| 111 | + } else |
|
| 111 | 112 | { |
| 112 | 113 | $document_item->readed_count = $output->data->readed_count; |
| 113 | 114 | $document_item->voted_count = $output->data->voted_count; |
@@ -154,18 +155,28 @@ discard block |
||
| 154 | 155 | |
| 155 | 156 | function isGranted() |
| 156 | 157 | { |
| 157 | - if($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 158 | + if($_SESSION['own_document'][$this->document_srl]) { |
|
| 159 | + return true; |
|
| 160 | + } |
|
| 158 | 161 | |
| 159 | - if(!Context::get('is_logged')) return false; |
|
| 162 | + if(!Context::get('is_logged')) { |
|
| 163 | + return false; |
|
| 164 | + } |
|
| 160 | 165 | |
| 161 | 166 | $logged_info = Context::get('logged_info'); |
| 162 | - if($logged_info->is_admin == 'Y') return true; |
|
| 167 | + if($logged_info->is_admin == 'Y') { |
|
| 168 | + return true; |
|
| 169 | + } |
|
| 163 | 170 | |
| 164 | 171 | $oModuleModel = getModel('module'); |
| 165 | 172 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 166 | - if($grant->manager) return true; |
|
| 173 | + if($grant->manager) { |
|
| 174 | + return true; |
|
| 175 | + } |
|
| 167 | 176 | |
| 168 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true; |
|
| 177 | + if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) { |
|
| 178 | + return true; |
|
| 179 | + } |
|
| 169 | 180 | |
| 170 | 181 | return false; |
| 171 | 182 | } |
@@ -183,7 +194,9 @@ discard block |
||
| 183 | 194 | function allowComment() |
| 184 | 195 | { |
| 185 | 196 | // init write, document is not exists. so allow comment status is true |
| 186 | - if(!$this->isExists()) return true; |
|
| 197 | + if(!$this->isExists()) { |
|
| 198 | + return true; |
|
| 199 | + } |
|
| 187 | 200 | |
| 188 | 201 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 189 | 202 | } |
@@ -198,8 +211,7 @@ discard block |
||
| 198 | 211 | if(!getClass('trackback')) |
| 199 | 212 | { |
| 200 | 213 | $allow_trackback_status = false; |
| 201 | - } |
|
| 202 | - else |
|
| 214 | + } else |
|
| 203 | 215 | { |
| 204 | 216 | // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module. |
| 205 | 217 | $oModuleModel = getModel('module'); |
@@ -210,15 +222,21 @@ discard block |
||
| 210 | 222 | $trackback_config = new stdClass(); |
| 211 | 223 | } |
| 212 | 224 | |
| 213 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 215 | - else |
|
| 225 | + if(!isset($trackback_config->enable_trackback)) { |
|
| 226 | + $trackback_config->enable_trackback = 'Y'; |
|
| 227 | + } |
|
| 228 | + if($trackback_config->enable_trackback != 'Y') { |
|
| 229 | + $allow_trackback_status = false; |
|
| 230 | + } else |
|
| 216 | 231 | { |
| 217 | 232 | $module_srl = $this->get('module_srl'); |
| 218 | 233 | // Check settings of each module |
| 219 | 234 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 220 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 235 | + if($module_config->enable_trackback == 'N') { |
|
| 236 | + $allow_trackback_status = false; |
|
| 237 | + } else if($this->get('allow_trackback')=='Y' || !$this->isExists()) { |
|
| 238 | + $allow_trackback_status = true; |
|
| 239 | + } |
|
| 222 | 240 | } |
| 223 | 241 | } |
| 224 | 242 | } |
@@ -227,14 +245,18 @@ discard block |
||
| 227 | 245 | |
| 228 | 246 | function isLocked() |
| 229 | 247 | { |
| 230 | - if(!$this->isExists()) return false; |
|
| 248 | + if(!$this->isExists()) { |
|
| 249 | + return false; |
|
| 250 | + } |
|
| 231 | 251 | |
| 232 | 252 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 233 | 253 | } |
| 234 | 254 | |
| 235 | 255 | function isEditable() |
| 236 | 256 | { |
| 237 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 257 | + if($this->isGranted() || !$this->get('member_srl')) { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 238 | 260 | return false; |
| 239 | 261 | } |
| 240 | 262 | |
@@ -256,9 +278,14 @@ discard block |
||
| 256 | 278 | |
| 257 | 279 | function doCart() |
| 258 | 280 | { |
| 259 | - if(!$this->document_srl) return false; |
|
| 260 | - if($this->isCarted()) $this->removeCart(); |
|
| 261 | - else $this->addCart(); |
|
| 281 | + if(!$this->document_srl) { |
|
| 282 | + return false; |
|
| 283 | + } |
|
| 284 | + if($this->isCarted()) { |
|
| 285 | + $this->removeCart(); |
|
| 286 | + } else { |
|
| 287 | + $this->addCart(); |
|
| 288 | + } |
|
| 262 | 289 | } |
| 263 | 290 | |
| 264 | 291 | function addCart() |
@@ -284,16 +311,26 @@ discard block |
||
| 284 | 311 | */ |
| 285 | 312 | function notify($type, $content) |
| 286 | 313 | { |
| 287 | - if(!$this->document_srl) return; |
|
| 314 | + if(!$this->document_srl) { |
|
| 315 | + return; |
|
| 316 | + } |
|
| 288 | 317 | // return if it is not useNotify |
| 289 | - if(!$this->useNotify()) return; |
|
| 318 | + if(!$this->useNotify()) { |
|
| 319 | + return; |
|
| 320 | + } |
|
| 290 | 321 | // Pass if an author is not a logged-in user |
| 291 | - if(!$this->get('member_srl')) return; |
|
| 322 | + if(!$this->get('member_srl')) { |
|
| 323 | + return; |
|
| 324 | + } |
|
| 292 | 325 | // Return if the currently logged-in user is an author |
| 293 | 326 | $logged_info = Context::get('logged_info'); |
| 294 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 327 | + if($logged_info->member_srl == $this->get('member_srl')) { |
|
| 328 | + return; |
|
| 329 | + } |
|
| 295 | 330 | // List variables |
| 296 | - if($type) $title = "[".$type."] "; |
|
| 331 | + if($type) { |
|
| 332 | + $title = "[".$type."] "; |
|
| 333 | + } |
|
| 297 | 334 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 298 | 335 | $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
| 299 | 336 | $receiver_srl = $this->get('member_srl'); |
@@ -320,16 +357,22 @@ discard block |
||
| 320 | 357 | |
| 321 | 358 | function isExistsHomepage() |
| 322 | 359 | { |
| 323 | - if(trim($this->get('homepage'))) return true; |
|
| 360 | + if(trim($this->get('homepage'))) { |
|
| 361 | + return true; |
|
| 362 | + } |
|
| 324 | 363 | return false; |
| 325 | 364 | } |
| 326 | 365 | |
| 327 | 366 | function getHomepageUrl() |
| 328 | 367 | { |
| 329 | 368 | $url = trim($this->get('homepage')); |
| 330 | - if(!$url) return; |
|
| 369 | + if(!$url) { |
|
| 370 | + return; |
|
| 371 | + } |
|
| 331 | 372 | |
| 332 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 373 | + if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) { |
|
| 374 | + $url = 'http://' . $url; |
|
| 375 | + } |
|
| 333 | 376 | |
| 334 | 377 | return $url; |
| 335 | 378 | } |
@@ -361,43 +404,65 @@ discard block |
||
| 361 | 404 | |
| 362 | 405 | function getTitleText($cut_size = 0, $tail='...') |
| 363 | 406 | { |
| 364 | - if(!$this->document_srl) return; |
|
| 407 | + if(!$this->document_srl) { |
|
| 408 | + return; |
|
| 409 | + } |
|
| 365 | 410 | |
| 366 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 367 | - else $title = $this->get('title'); |
|
| 411 | + if($cut_size) { |
|
| 412 | + $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 413 | + } else { |
|
| 414 | + $title = $this->get('title'); |
|
| 415 | + } |
|
| 368 | 416 | |
| 369 | 417 | return $title; |
| 370 | 418 | } |
| 371 | 419 | |
| 372 | 420 | function getTitle($cut_size = 0, $tail='...') |
| 373 | 421 | { |
| 374 | - if(!$this->document_srl) return; |
|
| 422 | + if(!$this->document_srl) { |
|
| 423 | + return; |
|
| 424 | + } |
|
| 375 | 425 | |
| 376 | 426 | $title = $this->getTitleText($cut_size, $tail); |
| 377 | 427 | |
| 378 | 428 | $attrs = array(); |
| 379 | 429 | $this->add('title_color', trim($this->get('title_color'))); |
| 380 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 430 | + if($this->get('title_bold')=='Y') { |
|
| 431 | + $attrs[] = "font-weight:bold;"; |
|
| 432 | + } |
|
| 433 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
| 434 | + $attrs[] = "color:#".$this->get('title_color'); |
|
| 435 | + } |
|
| 382 | 436 | |
| 383 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 384 | - else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 437 | + if(count($attrs)) { |
|
| 438 | + return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 439 | + } else { |
|
| 440 | + return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 441 | + } |
|
| 385 | 442 | } |
| 386 | 443 | |
| 387 | 444 | function getContentText($strlen = 0) |
| 388 | 445 | { |
| 389 | - if(!$this->document_srl) return; |
|
| 446 | + if(!$this->document_srl) { |
|
| 447 | + return; |
|
| 448 | + } |
|
| 390 | 449 | |
| 391 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 450 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 451 | + return Context::getLang('msg_is_secret'); |
|
| 452 | + } |
|
| 392 | 453 | |
| 393 | 454 | $result = $this->_checkAccessibleFromStatus(); |
| 394 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 455 | + if($result) { |
|
| 456 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 457 | + } |
|
| 395 | 458 | |
| 396 | 459 | $content = $this->get('content'); |
| 397 | 460 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 398 | 461 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 399 | 462 | |
| 400 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 463 | + if($strlen) { |
|
| 464 | + return cut_str(strip_tags($content),$strlen,'...'); |
|
| 465 | + } |
|
| 401 | 466 | |
| 402 | 467 | return htmlspecialchars($content); |
| 403 | 468 | } |
@@ -430,14 +495,12 @@ discard block |
||
| 430 | 495 | } |
| 431 | 496 | $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
| 432 | 497 | } |
| 433 | - } |
|
| 434 | - else if($m[1] == 'embed') |
|
| 498 | + } else if($m[1] == 'embed') |
|
| 435 | 499 | { |
| 436 | 500 | if(stripos($m[0], 'allowscriptaccess')) |
| 437 | 501 | { |
| 438 | 502 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 439 | - } |
|
| 440 | - else |
|
| 503 | + } else |
|
| 441 | 504 | { |
| 442 | 505 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
| 443 | 506 | } |
@@ -447,15 +510,23 @@ discard block |
||
| 447 | 510 | |
| 448 | 511 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 449 | 512 | { |
| 450 | - if(!$this->document_srl) return; |
|
| 513 | + if(!$this->document_srl) { |
|
| 514 | + return; |
|
| 515 | + } |
|
| 451 | 516 | |
| 452 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 517 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 518 | + return Context::getLang('msg_is_secret'); |
|
| 519 | + } |
|
| 453 | 520 | |
| 454 | 521 | $result = $this->_checkAccessibleFromStatus(); |
| 455 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 522 | + if($result) { |
|
| 523 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 524 | + } |
|
| 456 | 525 | |
| 457 | 526 | $content = $this->get('content'); |
| 458 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 527 | + if(!$stripEmbedTagException) { |
|
| 528 | + stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 529 | + } |
|
| 459 | 530 | |
| 460 | 531 | // Define a link if using a rewrite module |
| 461 | 532 | $oContext = &Context::getInstance(); |
@@ -489,10 +560,11 @@ discard block |
||
| 489 | 560 | $this->document_srl, $memberSrl |
| 490 | 561 | ); |
| 491 | 562 | // Add xe_content class although accessing content is not required |
| 492 | - } |
|
| 493 | - else |
|
| 563 | + } else |
|
| 494 | 564 | { |
| 495 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 565 | + if($add_xe_content_class) { |
|
| 566 | + $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 567 | + } |
|
| 496 | 568 | } |
| 497 | 569 | // Change the image path to a valid absolute path if resource_realpath is true |
| 498 | 570 | if($resource_realpath) |
@@ -611,11 +683,15 @@ discard block |
||
| 611 | 683 | |
| 612 | 684 | function getTrackbackUrl() |
| 613 | 685 | { |
| 614 | - if(!$this->document_srl) return; |
|
| 686 | + if(!$this->document_srl) { |
|
| 687 | + return; |
|
| 688 | + } |
|
| 615 | 689 | |
| 616 | 690 | // Generate a key to prevent spams |
| 617 | 691 | $oTrackbackModel = getModel('trackback'); |
| 618 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 692 | + if($oTrackbackModel) { |
|
| 693 | + return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 694 | + } |
|
| 619 | 695 | } |
| 620 | 696 | |
| 621 | 697 | /** |
@@ -634,7 +710,9 @@ discard block |
||
| 634 | 710 | |
| 635 | 711 | function isExtraVarsExists() |
| 636 | 712 | { |
| 637 | - if(!$this->get('module_srl')) return false; |
|
| 713 | + if(!$this->get('module_srl')) { |
|
| 714 | + return false; |
|
| 715 | + } |
|
| 638 | 716 | $oDocumentModel = getModel('document'); |
| 639 | 717 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 640 | 718 | return count($extra_keys)?true:false; |
@@ -642,7 +720,9 @@ discard block |
||
| 642 | 720 | |
| 643 | 721 | function getExtraVars() |
| 644 | 722 | { |
| 645 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 723 | + if(!$this->get('module_srl') || !$this->document_srl) { |
|
| 724 | + return null; |
|
| 725 | + } |
|
| 646 | 726 | |
| 647 | 727 | $oDocumentModel = getModel('document'); |
| 648 | 728 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -654,8 +734,7 @@ discard block |
||
| 654 | 734 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 655 | 735 | { |
| 656 | 736 | return $extra_vars[$idx]->getValue(); |
| 657 | - } |
|
| 658 | - else |
|
| 737 | + } else |
|
| 659 | 738 | { |
| 660 | 739 | return ''; |
| 661 | 740 | } |
@@ -667,8 +746,7 @@ discard block |
||
| 667 | 746 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 668 | 747 | { |
| 669 | 748 | return $extra_vars[$idx]->getValueHTML(); |
| 670 | - } |
|
| 671 | - else |
|
| 749 | + } else |
|
| 672 | 750 | { |
| 673 | 751 | return ''; |
| 674 | 752 | } |
@@ -690,8 +768,7 @@ discard block |
||
| 690 | 768 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 691 | 769 | { |
| 692 | 770 | return $extra_eid[$eid]->getValue(); |
| 693 | - } |
|
| 694 | - else |
|
| 771 | + } else |
|
| 695 | 772 | { |
| 696 | 773 | return ''; |
| 697 | 774 | } |
@@ -709,8 +786,7 @@ discard block |
||
| 709 | 786 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 710 | 787 | { |
| 711 | 788 | return $extra_eid[$eid]->getValueHTML(); |
| 712 | - } |
|
| 713 | - else |
|
| 789 | + } else |
|
| 714 | 790 | { |
| 715 | 791 | return ''; |
| 716 | 792 | } |
@@ -730,8 +806,12 @@ discard block |
||
| 730 | 806 | |
| 731 | 807 | function getComments() |
| 732 | 808 | { |
| 733 | - if(!$this->getCommentCount()) return; |
|
| 734 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 809 | + if(!$this->getCommentCount()) { |
|
| 810 | + return; |
|
| 811 | + } |
|
| 812 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 813 | + return; |
|
| 814 | + } |
|
| 735 | 815 | // cpage is a number of comment pages |
| 736 | 816 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 737 | 817 | $cpage = Context::get($cpageStr); |
@@ -744,7 +824,9 @@ discard block |
||
| 744 | 824 | // Get a list of comments |
| 745 | 825 | $oCommentModel = getModel('comment'); |
| 746 | 826 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 747 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 827 | + if(!$output->toBool() || !count($output->data)) { |
|
| 828 | + return; |
|
| 829 | + } |
|
| 748 | 830 | // Create commentItem object from a comment list |
| 749 | 831 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 750 | 832 | $accessible = array(); |
@@ -754,7 +836,9 @@ discard block |
||
| 754 | 836 | $oCommentItem = new commentItem(); |
| 755 | 837 | $oCommentItem->setAttribute($val); |
| 756 | 838 | // If permission is granted to the post, you can access it temporarily |
| 757 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 839 | + if($oCommentItem->isGranted()) { |
|
| 840 | + $accessible[$val->comment_srl] = true; |
|
| 841 | + } |
|
| 758 | 842 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 759 | 843 | if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
| 760 | 844 | { |
@@ -765,7 +849,9 @@ discard block |
||
| 765 | 849 | // Variable setting to be displayed on the skin |
| 766 | 850 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 767 | 851 | Context::set('cpage', $output->page_navigation->cur_page); |
| 768 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 852 | + if($output->total_page>1) { |
|
| 853 | + $this->comment_page_navigation = $output->page_navigation; |
|
| 854 | + } |
|
| 769 | 855 | |
| 770 | 856 | return $comment_list; |
| 771 | 857 | } |
@@ -777,9 +863,13 @@ discard block |
||
| 777 | 863 | |
| 778 | 864 | function getTrackbacks() |
| 779 | 865 | { |
| 780 | - if(!$this->document_srl) return; |
|
| 866 | + if(!$this->document_srl) { |
|
| 867 | + return; |
|
| 868 | + } |
|
| 781 | 869 | |
| 782 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 870 | + if(!$this->allowTrackback() || !$this->get('trackback_count')) { |
|
| 871 | + return; |
|
| 872 | + } |
|
| 783 | 873 | |
| 784 | 874 | $oTrackbackModel = getModel('trackback'); |
| 785 | 875 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -787,15 +877,21 @@ discard block |
||
| 787 | 877 | |
| 788 | 878 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 789 | 879 | { |
| 790 | - if(!$this->document_srl) return false; |
|
| 791 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 880 | + if(!$this->document_srl) { |
|
| 881 | + return false; |
|
| 882 | + } |
|
| 883 | + if(!$this->getThumbnail($width, $height, $type)) { |
|
| 884 | + return false; |
|
| 885 | + } |
|
| 792 | 886 | return true; |
| 793 | 887 | } |
| 794 | 888 | |
| 795 | 889 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 796 | 890 | { |
| 797 | 891 | // Return false if the document doesn't exist |
| 798 | - if(!$this->document_srl) return; |
|
| 892 | + if(!$this->document_srl) { |
|
| 893 | + return; |
|
| 894 | + } |
|
| 799 | 895 | |
| 800 | 896 | if($this->isSecret() && !$this->isGranted()) |
| 801 | 897 | { |
@@ -803,7 +899,9 @@ discard block |
||
| 803 | 899 | } |
| 804 | 900 | |
| 805 | 901 | // If not specify its height, create a square |
| 806 | - if(!$height) $height = $width; |
|
| 902 | + if(!$height) { |
|
| 903 | + $height = $width; |
|
| 904 | + } |
|
| 807 | 905 | |
| 808 | 906 | // Return false if neither attachement nor image files in the document |
| 809 | 907 | $content = $this->get('content'); |
@@ -821,7 +919,9 @@ discard block |
||
| 821 | 919 | } |
| 822 | 920 | } |
| 823 | 921 | |
| 824 | - if(!preg_match("!<img!is", $content)) return; |
|
| 922 | + if(!preg_match("!<img!is", $content)) { |
|
| 923 | + return; |
|
| 924 | + } |
|
| 825 | 925 | } |
| 826 | 926 | // Get thumbnai_type information from document module's configuration |
| 827 | 927 | if(!in_array($thumbnail_type, array('crop','ratio'))) |
@@ -842,8 +942,11 @@ discard block |
||
| 842 | 942 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 843 | 943 | if(file_exists($thumbnail_file)) |
| 844 | 944 | { |
| 845 | - if(filesize($thumbnail_file)<1) return false; |
|
| 846 | - else return $thumbnail_url; |
|
| 945 | + if(filesize($thumbnail_file)<1) { |
|
| 946 | + return false; |
|
| 947 | + } else { |
|
| 948 | + return $thumbnail_url; |
|
| 949 | + } |
|
| 847 | 950 | } |
| 848 | 951 | |
| 849 | 952 | // Target File |
@@ -858,7 +961,9 @@ discard block |
||
| 858 | 961 | $first_image = null; |
| 859 | 962 | foreach($file_list as $file) |
| 860 | 963 | { |
| 861 | - if($file->direct_download !== 'Y') continue; |
|
| 964 | + if($file->direct_download !== 'Y') { |
|
| 965 | + continue; |
|
| 966 | + } |
|
| 862 | 967 | |
| 863 | 968 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 864 | 969 | { |
@@ -866,7 +971,9 @@ discard block |
||
| 866 | 971 | break; |
| 867 | 972 | } |
| 868 | 973 | |
| 869 | - if($first_image) continue; |
|
| 974 | + if($first_image) { |
|
| 975 | + continue; |
|
| 976 | + } |
|
| 870 | 977 | |
| 871 | 978 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 872 | 979 | { |
@@ -893,7 +1000,9 @@ discard block |
||
| 893 | 1000 | foreach($matches as $target_image) |
| 894 | 1001 | { |
| 895 | 1002 | $target_src = trim($target_image[1]); |
| 896 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 1003 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 1004 | + continue; |
|
| 1005 | + } |
|
| 897 | 1006 | |
| 898 | 1007 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 899 | 1008 | { |
@@ -904,7 +1013,9 @@ discard block |
||
| 904 | 1013 | |
| 905 | 1014 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
| 906 | 1015 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 907 | - if(!file_exists($tmp_file)) continue; |
|
| 1016 | + if(!file_exists($tmp_file)) { |
|
| 1017 | + continue; |
|
| 1018 | + } |
|
| 908 | 1019 | |
| 909 | 1020 | $imageinfo = getimagesize($tmp_file); |
| 910 | 1021 | list($_w, $_h) = $imageinfo; |
@@ -923,11 +1034,17 @@ discard block |
||
| 923 | 1034 | { |
| 924 | 1035 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 925 | 1036 | } |
| 926 | - if($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 1037 | + if($is_tmp_file) { |
|
| 1038 | + FileHandler::removeFile($source_file); |
|
| 1039 | + } |
|
| 927 | 1040 | // Return its path if a thumbnail is successfully genetated |
| 928 | - if($output) return $thumbnail_url; |
|
| 1041 | + if($output) { |
|
| 1042 | + return $thumbnail_url; |
|
| 1043 | + } |
|
| 929 | 1044 | // Create an empty file not to re-generate the thumbnail |
| 930 | - else FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 1045 | + else { |
|
| 1046 | + FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 1047 | + } |
|
| 931 | 1048 | |
| 932 | 1049 | return; |
| 933 | 1050 | } |
@@ -940,21 +1057,28 @@ discard block |
||
| 940 | 1057 | */ |
| 941 | 1058 | function getExtraImages($time_interval = 43200) |
| 942 | 1059 | { |
| 943 | - if(!$this->document_srl) return; |
|
| 1060 | + if(!$this->document_srl) { |
|
| 1061 | + return; |
|
| 1062 | + } |
|
| 944 | 1063 | // variables for icon list |
| 945 | 1064 | $buffs = array(); |
| 946 | 1065 | |
| 947 | 1066 | $check_files = false; |
| 948 | 1067 | |
| 949 | 1068 | // Check if secret post is |
| 950 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 1069 | + if($this->isSecret()) { |
|
| 1070 | + $buffs[] = "secret"; |
|
| 1071 | + } |
|
| 951 | 1072 | |
| 952 | 1073 | // Set the latest time |
| 953 | 1074 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
| 954 | 1075 | |
| 955 | 1076 | // Check new post |
| 956 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 957 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 1077 | + if($this->get('regdate')>$time_check) { |
|
| 1078 | + $buffs[] = "new"; |
|
| 1079 | + } else if($this->get('last_update')>$time_check) { |
|
| 1080 | + $buffs[] = "update"; |
|
| 1081 | + } |
|
| 958 | 1082 | |
| 959 | 1083 | /* |
| 960 | 1084 | $content = $this->get('content'); |
@@ -977,14 +1101,18 @@ discard block |
||
| 977 | 1101 | */ |
| 978 | 1102 | |
| 979 | 1103 | // Check the attachment |
| 980 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1104 | + if($this->hasUploadedFiles()) { |
|
| 1105 | + $buffs[] = "file"; |
|
| 1106 | + } |
|
| 981 | 1107 | |
| 982 | 1108 | return $buffs; |
| 983 | 1109 | } |
| 984 | 1110 | |
| 985 | 1111 | function getStatus() |
| 986 | 1112 | { |
| 987 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
| 1113 | + if(!$this->get('status')) { |
|
| 1114 | + return $this->getDefaultStatus(); |
|
| 1115 | + } |
|
| 988 | 1116 | return $this->get('status'); |
| 989 | 1117 | } |
| 990 | 1118 | |
@@ -995,12 +1123,16 @@ discard block |
||
| 995 | 1123 | */ |
| 996 | 1124 | function printExtraImages($time_check = 43200) |
| 997 | 1125 | { |
| 998 | - if(!$this->document_srl) return; |
|
| 1126 | + if(!$this->document_srl) { |
|
| 1127 | + return; |
|
| 1128 | + } |
|
| 999 | 1129 | // Get the icon directory |
| 1000 | 1130 | $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
| 1001 | 1131 | |
| 1002 | 1132 | $buffs = $this->getExtraImages($time_check); |
| 1003 | - if(!count($buffs)) return; |
|
| 1133 | + if(!count($buffs)) { |
|
| 1134 | + return; |
|
| 1135 | + } |
|
| 1004 | 1136 | |
| 1005 | 1137 | $buff = array(); |
| 1006 | 1138 | foreach($buffs as $key => $val) |
@@ -1012,18 +1144,28 @@ discard block |
||
| 1012 | 1144 | |
| 1013 | 1145 | function hasUploadedFiles() |
| 1014 | 1146 | { |
| 1015 | - if(!$this->document_srl) return; |
|
| 1147 | + if(!$this->document_srl) { |
|
| 1148 | + return; |
|
| 1149 | + } |
|
| 1016 | 1150 | |
| 1017 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1151 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1152 | + return false; |
|
| 1153 | + } |
|
| 1018 | 1154 | return $this->get('uploaded_count')? true : false; |
| 1019 | 1155 | } |
| 1020 | 1156 | |
| 1021 | 1157 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1022 | 1158 | { |
| 1023 | - if(!$this->document_srl) return; |
|
| 1159 | + if(!$this->document_srl) { |
|
| 1160 | + return; |
|
| 1161 | + } |
|
| 1024 | 1162 | |
| 1025 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1026 | - if(!$this->get('uploaded_count')) return; |
|
| 1163 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1164 | + return; |
|
| 1165 | + } |
|
| 1166 | + if(!$this->get('uploaded_count')) { |
|
| 1167 | + return; |
|
| 1168 | + } |
|
| 1027 | 1169 | |
| 1028 | 1170 | if(!$this->uploadedFiles[$sortIndex]) |
| 1029 | 1171 | { |
@@ -1041,7 +1183,9 @@ discard block |
||
| 1041 | 1183 | function getEditor() |
| 1042 | 1184 | { |
| 1043 | 1185 | $module_srl = $this->get('module_srl'); |
| 1044 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1186 | + if(!$module_srl) { |
|
| 1187 | + $module_srl = Context::get('module_srl'); |
|
| 1188 | + } |
|
| 1045 | 1189 | |
| 1046 | 1190 | $oEditorModel = getModel('editor'); |
| 1047 | 1191 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1055,8 +1199,12 @@ discard block |
||
| 1055 | 1199 | function isEnableComment() |
| 1056 | 1200 | { |
| 1057 | 1201 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1058 | - if (!$this->allowComment()) return false; |
|
| 1059 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1202 | + if (!$this->allowComment()) { |
|
| 1203 | + return false; |
|
| 1204 | + } |
|
| 1205 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 1206 | + return false; |
|
| 1207 | + } |
|
| 1060 | 1208 | |
| 1061 | 1209 | return true; |
| 1062 | 1210 | } |
@@ -1067,7 +1215,9 @@ discard block |
||
| 1067 | 1215 | */ |
| 1068 | 1216 | function getCommentEditor() |
| 1069 | 1217 | { |
| 1070 | - if(!$this->isEnableComment()) return; |
|
| 1218 | + if(!$this->isEnableComment()) { |
|
| 1219 | + return; |
|
| 1220 | + } |
|
| 1071 | 1221 | |
| 1072 | 1222 | $oEditorModel = getModel('editor'); |
| 1073 | 1223 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1079,10 +1229,14 @@ discard block |
||
| 1079 | 1229 | */ |
| 1080 | 1230 | function getProfileImage() |
| 1081 | 1231 | { |
| 1082 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1232 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1233 | + return; |
|
| 1234 | + } |
|
| 1083 | 1235 | $oMemberModel = getModel('member'); |
| 1084 | 1236 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1085 | - if(!$profile_info) return; |
|
| 1237 | + if(!$profile_info) { |
|
| 1238 | + return; |
|
| 1239 | + } |
|
| 1086 | 1240 | |
| 1087 | 1241 | return $profile_info->src; |
| 1088 | 1242 | } |
@@ -1094,7 +1248,9 @@ discard block |
||
| 1094 | 1248 | function getSignature() |
| 1095 | 1249 | { |
| 1096 | 1250 | // Pass if a document doesn't exist |
| 1097 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1251 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1252 | + return; |
|
| 1253 | + } |
|
| 1098 | 1254 | // Get signature information |
| 1099 | 1255 | $oMemberModel = getModel('member'); |
| 1100 | 1256 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1108,7 +1264,9 @@ discard block |
||
| 1108 | 1264 | if($signature) |
| 1109 | 1265 | { |
| 1110 | 1266 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1111 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1267 | + if($max_signature_height) { |
|
| 1268 | + $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1269 | + } |
|
| 1112 | 1270 | } |
| 1113 | 1271 | |
| 1114 | 1272 | return $signature; |
@@ -1132,20 +1290,25 @@ discard block |
||
| 1132 | 1290 | function _checkAccessibleFromStatus() |
| 1133 | 1291 | { |
| 1134 | 1292 | $logged_info = Context::get('logged_info'); |
| 1135 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1293 | + if($logged_info->is_admin == 'Y') { |
|
| 1294 | + return true; |
|
| 1295 | + } |
|
| 1136 | 1296 | |
| 1137 | 1297 | $status = $this->get('status'); |
| 1138 | - if(empty($status)) return false; |
|
| 1298 | + if(empty($status)) { |
|
| 1299 | + return false; |
|
| 1300 | + } |
|
| 1139 | 1301 | |
| 1140 | 1302 | $oDocumentModel = getModel('document'); |
| 1141 | 1303 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1142 | 1304 | |
| 1143 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1144 | - return true; |
|
| 1145 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1305 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
| 1306 | + return true; |
|
| 1307 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1146 | 1308 | { |
| 1147 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1148 | - return true; |
|
| 1309 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
| 1310 | + return true; |
|
| 1311 | + } |
|
| 1149 | 1312 | } |
| 1150 | 1313 | return false; |
| 1151 | 1314 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function _loadFromDB() |
| 51 | 51 | { |
| 52 | - if(!$this->comment_srl) |
|
| 52 | + if (!$this->comment_srl) |
|
| 53 | 53 | { |
| 54 | 54 | return; |
| 55 | 55 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function setAttribute($attribute) |
| 69 | 69 | { |
| 70 | - if(!$attribute->comment_srl) |
|
| 70 | + if (!$attribute->comment_srl) |
|
| 71 | 71 | { |
| 72 | 72 | $this->comment_srl = NULL; |
| 73 | 73 | return; |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | $this->adds($attribute); |
| 78 | 78 | |
| 79 | 79 | // define vars on the object for backward compatibility of skins |
| 80 | - if(count($attribute)) |
|
| 80 | + if (count($attribute)) |
|
| 81 | 81 | { |
| 82 | - foreach($attribute as $key => $val) |
|
| 82 | + foreach ($attribute as $key => $val) |
|
| 83 | 83 | { |
| 84 | 84 | $this->{$key} = $val; |
| 85 | 85 | } |
@@ -93,29 +93,29 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | function isGranted() |
| 95 | 95 | { |
| 96 | - if($_SESSION['own_comment'][$this->comment_srl]) |
|
| 96 | + if ($_SESSION['own_comment'][$this->comment_srl]) |
|
| 97 | 97 | { |
| 98 | 98 | return TRUE; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if(!Context::get('is_logged')) |
|
| 101 | + if (!Context::get('is_logged')) |
|
| 102 | 102 | { |
| 103 | 103 | return FALSE; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $logged_info = Context::get('logged_info'); |
| 107 | - if($logged_info->is_admin == 'Y') |
|
| 107 | + if ($logged_info->is_admin == 'Y') |
|
| 108 | 108 | { |
| 109 | 109 | return TRUE; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $grant = Context::get('grant'); |
| 113 | - if($grant->manager) |
|
| 113 | + if ($grant->manager) |
|
| 114 | 114 | { |
| 115 | 115 | return TRUE; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
| 118 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
| 119 | 119 | { |
| 120 | 120 | return TRUE; |
| 121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | function isEditable() |
| 138 | 138 | { |
| 139 | - if($this->isGranted() || !$this->get('member_srl')) |
|
| 139 | + if ($this->isGranted() || !$this->get('member_srl')) |
|
| 140 | 140 | { |
| 141 | 141 | return TRUE; |
| 142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | function isAccessible() |
| 152 | 152 | { |
| 153 | - if($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
| 153 | + if ($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
| 154 | 154 | { |
| 155 | 155 | return TRUE; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if($this->isGranted() || !$this->isSecret()) |
|
| 158 | + if ($this->isGranted() || !$this->isSecret()) |
|
| 159 | 159 | { |
| 160 | 160 | $this->setAccessible(); |
| 161 | 161 | return TRUE; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $oDocumentModel = getModel('document'); |
| 165 | 165 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
| 166 | - if($oDocument->isGranted()) |
|
| 166 | + if ($oDocument->isGranted()) |
|
| 167 | 167 | { |
| 168 | 168 | $this->setAccessible(); |
| 169 | 169 | return TRUE; |
@@ -184,20 +184,20 @@ discard block |
||
| 184 | 184 | function notify($type, $content) |
| 185 | 185 | { |
| 186 | 186 | // return if not useNotify |
| 187 | - if(!$this->useNotify()) |
|
| 187 | + if (!$this->useNotify()) |
|
| 188 | 188 | { |
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // pass if the author is not logged-in user |
| 193 | - if(!$this->get('member_srl')) |
|
| 193 | + if (!$this->get('member_srl')) |
|
| 194 | 194 | { |
| 195 | 195 | return; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // return if the currently logged-in user is an author of the comment. |
| 199 | 199 | $logged_info = Context::get('logged_info'); |
| 200 | - if($logged_info->member_srl == $this->get('member_srl')) |
|
| 200 | + if ($logged_info->member_srl == $this->get('member_srl')) |
|
| 201 | 201 | { |
| 202 | 202 | return; |
| 203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
| 208 | 208 | |
| 209 | 209 | // Variables |
| 210 | - if($type) |
|
| 210 | + if ($type) |
|
| 211 | 211 | { |
| 212 | - $title = "[" . $type . "] "; |
|
| 212 | + $title = "[".$type."] "; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $title .= cut_str(strip_tags($content), 30, '...'); |
@@ -224,17 +224,17 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | function getIpAddress() |
| 226 | 226 | { |
| 227 | - if($this->isGranted()) |
|
| 227 | + if ($this->isGranted()) |
|
| 228 | 228 | { |
| 229 | 229 | return $this->get('ipaddress'); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
| 232 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | function isExistsHomepage() |
| 236 | 236 | { |
| 237 | - if(trim($this->get('homepage'))) |
|
| 237 | + if (trim($this->get('homepage'))) |
|
| 238 | 238 | { |
| 239 | 239 | return TRUE; |
| 240 | 240 | } |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | function getHomepageUrl() |
| 246 | 246 | { |
| 247 | 247 | $url = trim($this->get('homepage')); |
| 248 | - if(!$url) |
|
| 248 | + if (!$url) |
|
| 249 | 249 | { |
| 250 | 250 | return; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if(strncasecmp('http://', $url, 7) !== 0) |
|
| 253 | + if (strncasecmp('http://', $url, 7) !== 0) |
|
| 254 | 254 | { |
| 255 | - $url = "http://" . $url; |
|
| 255 | + $url = "http://".$url; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function getContentText($strlen = 0) |
| 286 | 286 | { |
| 287 | - if($this->isSecret() && !$this->isAccessible()) |
|
| 287 | + if ($this->isSecret() && !$this->isAccessible()) |
|
| 288 | 288 | { |
| 289 | 289 | return Context::getLang('msg_is_secret'); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $content = $this->get('content'); |
| 293 | 293 | |
| 294 | - if($strlen) |
|
| 294 | + if ($strlen) |
|
| 295 | 295 | { |
| 296 | 296 | return cut_str(strip_tags($content), $strlen, '...'); |
| 297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE) |
| 307 | 307 | { |
| 308 | - if($this->isSecret() && !$this->isAccessible()) |
|
| 308 | + if ($this->isSecret() && !$this->isAccessible()) |
|
| 309 | 309 | { |
| 310 | 310 | return Context::getLang('msg_is_secret'); |
| 311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | stripEmbedTagForAdmin($content, $this->get('member_srl')); |
| 315 | 315 | |
| 316 | 316 | // when displaying the comment on the pop-up menu |
| 317 | - if($add_popup_menu && Context::get('is_logged')) |
|
| 317 | + if ($add_popup_menu && Context::get('is_logged')) |
|
| 318 | 318 | { |
| 319 | 319 | $content = sprintf( |
| 320 | 320 | '%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do') |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // if additional information which can access contents is set |
| 325 | - if($add_content_info) |
|
| 325 | + if ($add_content_info) |
|
| 326 | 326 | { |
| 327 | 327 | $memberSrl = $this->get('member_srl'); |
| 328 | - if($memberSrl < 0) |
|
| 328 | + if ($memberSrl < 0) |
|
| 329 | 329 | { |
| 330 | 330 | $memberSrl = 0; |
| 331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | else |
| 338 | 338 | { |
| 339 | - if($add_xe_content_class) |
|
| 339 | + if ($add_xe_content_class) |
|
| 340 | 340 | { |
| 341 | 341 | $content = sprintf('<div class="xe_content">%s</div>', $content); |
| 342 | 342 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | function getRegdateGM() |
| 398 | 398 | { |
| 399 | - return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone']; |
|
| 399 | + return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone']; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | function getPermanentUrl() |
| 408 | 408 | { |
| 409 | - return getFullUrl('', 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl'); |
|
| 409 | + return getFullUrl('', 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl'); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | function getUpdateTime() |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | function hasUploadedFiles() |
| 429 | 429 | { |
| 430 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
| 430 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
| 431 | 431 | { |
| 432 | 432 | return FALSE; |
| 433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | function getUploadedFiles() |
| 438 | 438 | { |
| 439 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
| 439 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
| 440 | 440 | { |
| 441 | 441 | return; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if(!$this->get('uploaded_count')) |
|
| 444 | + if (!$this->get('uploaded_count')) |
|
| 445 | 445 | { |
| 446 | 446 | return; |
| 447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | function getEditor() |
| 459 | 459 | { |
| 460 | 460 | $module_srl = $this->get('module_srl'); |
| 461 | - if(!$module_srl) |
|
| 461 | + if (!$module_srl) |
|
| 462 | 462 | { |
| 463 | 463 | $module_srl = Context::get('module_srl'); |
| 464 | 464 | } |
@@ -472,13 +472,13 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | function getProfileImage() |
| 474 | 474 | { |
| 475 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
| 475 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
| 476 | 476 | { |
| 477 | 477 | return; |
| 478 | 478 | } |
| 479 | 479 | $oMemberModel = getModel('member'); |
| 480 | 480 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 481 | - if(!$profile_info) |
|
| 481 | + if (!$profile_info) |
|
| 482 | 482 | { |
| 483 | 483 | return; |
| 484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | function getSignature() |
| 494 | 494 | { |
| 495 | 495 | // pass if the posting not exists. |
| 496 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
| 496 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
| 497 | 497 | { |
| 498 | 498 | return; |
| 499 | 499 | } |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 504 | 504 | |
| 505 | 505 | // check if max height of the signiture is specified on the member module |
| 506 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 506 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 507 | 507 | { |
| 508 | 508 | $oModuleModel = getModel('module'); |
| 509 | 509 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 514 | 514 | |
| 515 | - if($max_signature_height) |
|
| 515 | + if ($max_signature_height) |
|
| 516 | 516 | { |
| 517 | 517 | $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
| 518 | 518 | } |
@@ -522,12 +522,12 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 524 | 524 | { |
| 525 | - if(!$this->comment_srl) |
|
| 525 | + if (!$this->comment_srl) |
|
| 526 | 526 | { |
| 527 | 527 | return FALSE; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - if(!$this->getThumbnail($width, $height, $type)) |
|
| 530 | + if (!$this->getThumbnail($width, $height, $type)) |
|
| 531 | 531 | { |
| 532 | 532 | return FALSE; |
| 533 | 533 | } |
@@ -538,42 +538,42 @@ discard block |
||
| 538 | 538 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 539 | 539 | { |
| 540 | 540 | // return false if no doc exists |
| 541 | - if(!$this->comment_srl) |
|
| 541 | + if (!$this->comment_srl) |
|
| 542 | 542 | { |
| 543 | 543 | return; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - if($this->isSecret() && !$this->isGranted()) |
|
| 546 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 547 | 547 | { |
| 548 | 548 | return; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | // If signiture height setting is omitted, create a square |
| 552 | - if(!$height) |
|
| 552 | + if (!$height) |
|
| 553 | 553 | { |
| 554 | 554 | $height = $width; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | $content = $this->get('content'); |
| 558 | - if(!$this->hasUploadedFiles()) |
|
| 558 | + if (!$this->hasUploadedFiles()) |
|
| 559 | 559 | { |
| 560 | - if(!$content) |
|
| 560 | + if (!$content) |
|
| 561 | 561 | { |
| 562 | 562 | $args = new stdClass(); |
| 563 | 563 | $args->comment_srl = $this->comment_srl; |
| 564 | 564 | $output = executeQuery('document.getComment', $args, array('content')); |
| 565 | - if($output->toBool() && $output->data) |
|
| 565 | + if ($output->toBool() && $output->data) |
|
| 566 | 566 | { |
| 567 | 567 | $content = $output->data->content; |
| 568 | 568 | $this->add('content', $content); |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if(!preg_match("!<img!is", $content)) return; |
|
| 572 | + if (!preg_match("!<img!is", $content)) return; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | // get thumbail generation info on the doc module configuration. |
| 576 | - if(!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 576 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 577 | 577 | { |
| 578 | 578 | $thumbnail_type = 'crop'; |
| 579 | 579 | } |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | // Define thumbnail information |
| 582 | 582 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); |
| 583 | 583 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 584 | - $thumbnail_url = Context::getRequestUri() . $thumbnail_file; |
|
| 584 | + $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
|
| 585 | 585 | |
| 586 | 586 | // return false if a size of existing thumbnail file is 0. otherwise return the file path |
| 587 | - if(file_exists($thumbnail_file)) |
|
| 587 | + if (file_exists($thumbnail_file)) |
|
| 588 | 588 | { |
| 589 | - if(filesize($thumbnail_file) < 1) |
|
| 589 | + if (filesize($thumbnail_file) < 1) |
|
| 590 | 590 | { |
| 591 | 591 | return FALSE; |
| 592 | 592 | } |
@@ -601,33 +601,33 @@ discard block |
||
| 601 | 601 | $is_tmp_file = FALSE; |
| 602 | 602 | |
| 603 | 603 | // find an image file among attached files |
| 604 | - if($this->hasUploadedFiles()) |
|
| 604 | + if ($this->hasUploadedFiles()) |
|
| 605 | 605 | { |
| 606 | 606 | $file_list = $this->getUploadedFiles(); |
| 607 | 607 | |
| 608 | 608 | $first_image = null; |
| 609 | - foreach($file_list as $file) |
|
| 609 | + foreach ($file_list as $file) |
|
| 610 | 610 | { |
| 611 | - if($file->direct_download !== 'Y') continue; |
|
| 611 | + if ($file->direct_download !== 'Y') continue; |
|
| 612 | 612 | |
| 613 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 613 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 614 | 614 | { |
| 615 | 615 | $source_file = $file->uploaded_filename; |
| 616 | 616 | break; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if($first_image) continue; |
|
| 619 | + if ($first_image) continue; |
|
| 620 | 620 | |
| 621 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 621 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 622 | 622 | { |
| 623 | - if(file_exists($file->uploaded_filename)) |
|
| 623 | + if (file_exists($file->uploaded_filename)) |
|
| 624 | 624 | { |
| 625 | 625 | $first_image = $file->uploaded_filename; |
| 626 | 626 | } |
| 627 | 627 | } |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - if(!$source_file && $first_image) |
|
| 630 | + if (!$source_file && $first_image) |
|
| 631 | 631 | { |
| 632 | 632 | $source_file = $first_image; |
| 633 | 633 | } |
@@ -635,31 +635,31 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | // get an image file from the doc content if no file attached. |
| 637 | 637 | $is_tmp_file = false; |
| 638 | - if(!$source_file) |
|
| 638 | + if (!$source_file) |
|
| 639 | 639 | { |
| 640 | 640 | $random = new Password(); |
| 641 | 641 | |
| 642 | 642 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
| 643 | 643 | |
| 644 | - foreach($matches as $target_image) |
|
| 644 | + foreach ($matches as $target_image) |
|
| 645 | 645 | { |
| 646 | 646 | $target_src = trim($target_image[1]); |
| 647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 647 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 648 | 648 | |
| 649 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 649 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 650 | 650 | { |
| 651 | 651 | $target_src = Context::getRequestUri().$target_src; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | $target_src = htmlspecialchars_decode($target_src); |
| 655 | 655 | |
| 656 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
| 656 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
| 657 | 657 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 658 | - if(!file_exists($tmp_file)) continue; |
|
| 658 | + if (!file_exists($tmp_file)) continue; |
|
| 659 | 659 | |
| 660 | 660 | $imageinfo = getimagesize($tmp_file); |
| 661 | 661 | list($_w, $_h) = $imageinfo; |
| 662 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 662 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 663 | 663 | FileHandler::removeFile($tmp_file); |
| 664 | 664 | continue; |
| 665 | 665 | } |
@@ -672,13 +672,13 @@ discard block |
||
| 672 | 672 | |
| 673 | 673 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 674 | 674 | |
| 675 | - if($is_tmp_file) |
|
| 675 | + if ($is_tmp_file) |
|
| 676 | 676 | { |
| 677 | 677 | FileHandler::removeFile($source_file); |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | // return the thumbnail path if successfully generated. |
| 681 | - if($output) |
|
| 681 | + if ($output) |
|
| 682 | 682 | { |
| 683 | 683 | return $thumbnail_url; |
| 684 | 684 | } |
@@ -333,8 +333,7 @@ discard block |
||
| 333 | 333 | '<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl |
| 334 | 334 | ); |
| 335 | 335 | // xe_content class name should be specified although content access is not necessary. |
| 336 | - } |
|
| 337 | - else |
|
| 336 | + } else |
|
| 338 | 337 | { |
| 339 | 338 | if($add_xe_content_class) |
| 340 | 339 | { |
@@ -569,7 +568,9 @@ discard block |
||
| 569 | 568 | } |
| 570 | 569 | } |
| 571 | 570 | |
| 572 | - if(!preg_match("!<img!is", $content)) return; |
|
| 571 | + if(!preg_match("!<img!is", $content)) { |
|
| 572 | + return; |
|
| 573 | + } |
|
| 573 | 574 | } |
| 574 | 575 | |
| 575 | 576 | // get thumbail generation info on the doc module configuration. |
@@ -589,8 +590,7 @@ discard block |
||
| 589 | 590 | if(filesize($thumbnail_file) < 1) |
| 590 | 591 | { |
| 591 | 592 | return FALSE; |
| 592 | - } |
|
| 593 | - else |
|
| 593 | + } else |
|
| 594 | 594 | { |
| 595 | 595 | return $thumbnail_url; |
| 596 | 596 | } |
@@ -608,7 +608,9 @@ discard block |
||
| 608 | 608 | $first_image = null; |
| 609 | 609 | foreach($file_list as $file) |
| 610 | 610 | { |
| 611 | - if($file->direct_download !== 'Y') continue; |
|
| 611 | + if($file->direct_download !== 'Y') { |
|
| 612 | + continue; |
|
| 613 | + } |
|
| 612 | 614 | |
| 613 | 615 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 614 | 616 | { |
@@ -616,7 +618,9 @@ discard block |
||
| 616 | 618 | break; |
| 617 | 619 | } |
| 618 | 620 | |
| 619 | - if($first_image) continue; |
|
| 621 | + if($first_image) { |
|
| 622 | + continue; |
|
| 623 | + } |
|
| 620 | 624 | |
| 621 | 625 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 622 | 626 | { |
@@ -644,7 +648,9 @@ discard block |
||
| 644 | 648 | foreach($matches as $target_image) |
| 645 | 649 | { |
| 646 | 650 | $target_src = trim($target_image[1]); |
| 647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 651 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 652 | + continue; |
|
| 653 | + } |
|
| 648 | 654 | |
| 649 | 655 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 650 | 656 | { |
@@ -655,7 +661,9 @@ discard block |
||
| 655 | 661 | |
| 656 | 662 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
| 657 | 663 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 658 | - if(!file_exists($tmp_file)) continue; |
|
| 664 | + if(!file_exists($tmp_file)) { |
|
| 665 | + continue; |
|
| 666 | + } |
|
| 659 | 667 | |
| 660 | 668 | $imageinfo = getimagesize($tmp_file); |
| 661 | 669 | list($_w, $_h) = $imageinfo; |