@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * It is used when a file list of the upload_target_srl is requested for creating/updating a document. |
| 21 | 21 | * Attempt to replace with sever-side session if upload_target_srl is not yet determined |
| 22 | 22 | * |
| 23 | - * @return void |
|
| 23 | + * @return Object|null |
|
| 24 | 24 | */ |
| 25 | 25 | function getFileList() |
| 26 | 26 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * Get file configurations |
| 147 | 147 | * |
| 148 | 148 | * @param int $module_srl If set this, returns specific module's configuration. Otherwise returns global configuration. |
| 149 | - * @return object Returns configuration. |
|
| 149 | + * @return stdClass Returns configuration. |
|
| 150 | 150 | */ |
| 151 | 151 | function getFileConfig($module_srl = null) |
| 152 | 152 | { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | /** |
| 277 | 277 | * Return configurations of the attachement (it automatically checks if an administrator is) |
| 278 | 278 | * |
| 279 | - * @return object Returns a file configuration of current module. If user is admin, returns PHP's max file size and allow all file types. |
|
| 279 | + * @return stdClass Returns a file configuration of current module. If user is admin, returns PHP's max file size and allow all file types. |
|
| 280 | 280 | */ |
| 281 | 281 | function getUploadConfig() |
| 282 | 282 | { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * Return file configuration of the module |
| 331 | 331 | * |
| 332 | 332 | * @param int $module_srl The sequence of module to get configuration |
| 333 | - * @return object |
|
| 333 | + * @return stdClass |
|
| 334 | 334 | */ |
| 335 | 335 | function getFileModuleConfig($module_srl) |
| 336 | 336 | { |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | $mid = Context::get('mid'); |
| 30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
| 31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
| 32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 32 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 33 | 33 | |
| 34 | - if($upload_target_srl) |
|
| 34 | + if ($upload_target_srl) |
|
| 35 | 35 | { |
| 36 | 36 | $oDocumentModel = getModel('document'); |
| 37 | 37 | $oCommentModel = getModel('comment'); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | $oDocument = $oDocumentModel->getDocument($upload_target_srl); |
| 41 | 41 | |
| 42 | 42 | // comment 권한 확인 |
| 43 | - if(!$oDocument->isExists()) |
|
| 43 | + if (!$oDocument->isExists()) |
|
| 44 | 44 | { |
| 45 | 45 | $oComment = $oCommentModel->getComment($upload_target_srl); |
| 46 | - if($oComment->isExists() && $oComment->isSecret() && !$oComment->isGranted()) |
|
| 46 | + if ($oComment->isExists() && $oComment->isSecret() && !$oComment->isGranted()) |
|
| 47 | 47 | { |
| 48 | 48 | return new Object(-1, 'msg_not_permitted'); |
| 49 | 49 | } |
@@ -52,34 +52,34 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // document 권한 확인 |
| 55 | - if($oDocument->isExists() && $oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 55 | + if ($oDocument->isExists() && $oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 56 | 56 | { |
| 57 | 57 | return new Object(-1, 'msg_not_permitted'); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // 모듈 권한 확인 |
| 61 | - if($oDocument->isExists()) |
|
| 61 | + if ($oDocument->isExists()) |
|
| 62 | 62 | { |
| 63 | 63 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')), $logged_info); |
| 64 | - if(!$grant->access) |
|
| 64 | + if (!$grant->access) |
|
| 65 | 65 | { |
| 66 | 66 | return new Object(-1, 'msg_not_permitted'); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $tmp_files = $this->getFiles($upload_target_srl); |
| 71 | - if(!$tmp_files) $tmp_files = array(); |
|
| 71 | + if (!$tmp_files) $tmp_files = array(); |
|
| 72 | 72 | |
| 73 | - foreach($tmp_files as $file_info) |
|
| 73 | + foreach ($tmp_files as $file_info) |
|
| 74 | 74 | { |
| 75 | - if(!$file_info->file_srl) continue; |
|
| 75 | + if (!$file_info->file_srl) continue; |
|
| 76 | 76 | |
| 77 | 77 | $obj = new stdClass; |
| 78 | 78 | $obj->file_srl = $file_info->file_srl; |
| 79 | 79 | $obj->source_filename = $file_info->source_filename; |
| 80 | 80 | $obj->file_size = $file_info->file_size; |
| 81 | 81 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
| 82 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 82 | + if ($file_info->direct_download == 'N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 83 | 83 | else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
| 84 | 84 | $obj->direct_download = $file_info->direct_download; |
| 85 | 85 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
@@ -99,17 +99,17 @@ discard block |
||
| 99 | 99 | //$config = $oModuleModel->getModuleInfoByMid($mid); //perhaps config varialbles not used |
| 100 | 100 | |
| 101 | 101 | $file_config = $this->getUploadConfig(); |
| 102 | - $left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size; |
|
| 102 | + $left_size = $file_config->allowed_attach_size * 1024 * 1024 - $attached_size; |
|
| 103 | 103 | // Settings of required information |
| 104 | 104 | $attached_size = FileHandler::filesize($attached_size); |
| 105 | - $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size*1024*1024); |
|
| 106 | - $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize*1024*1024); |
|
| 105 | + $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024); |
|
| 106 | + $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024); |
|
| 107 | 107 | $allowed_filetypes = $file_config->allowed_filetypes; |
| 108 | - $this->add("files",$files); |
|
| 109 | - $this->add("editor_sequence",$editor_sequence); |
|
| 110 | - $this->add("upload_target_srl",$upload_target_srl); |
|
| 111 | - $this->add("upload_status",$upload_status); |
|
| 112 | - $this->add("left_size",$left_size); |
|
| 108 | + $this->add("files", $files); |
|
| 109 | + $this->add("editor_sequence", $editor_sequence); |
|
| 110 | + $this->add("upload_target_srl", $upload_target_srl); |
|
| 111 | + $this->add("upload_status", $upload_status); |
|
| 112 | + $this->add("left_size", $left_size); |
|
| 113 | 113 | $this->add('attached_size', $attached_size); |
| 114 | 114 | $this->add('allowed_attach_size', $allowed_attach_size); |
| 115 | 115 | $this->add('allowed_filesize', $allowed_filesize); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $args = new stdClass(); |
| 128 | 128 | $args->upload_target_srl = $upload_target_srl; |
| 129 | 129 | $output = executeQuery('file.getFilesCount', $args); |
| 130 | - return (int)$output->data->count; |
|
| 130 | + return (int) $output->data->count; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $sid |
| 138 | 138 | * @return string Returns a url |
| 139 | 139 | */ |
| 140 | - function getDownloadUrl($file_srl, $sid, $module_srl="") |
|
| 140 | + function getDownloadUrl($file_srl, $sid, $module_srl = "") |
|
| 141 | 141 | { |
| 142 | 142 | return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl); |
| 143 | 143 | } |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
| 157 | 157 | |
| 158 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 159 | - if(!$file_config) $file_config = $file_module_config; |
|
| 158 | + if ($module_srl) $file_config = $oModuleModel->getModulePartConfig('file', $module_srl); |
|
| 159 | + if (!$file_config) $file_config = $file_module_config; |
|
| 160 | 160 | |
| 161 | 161 | $config = new stdClass(); |
| 162 | 162 | |
| 163 | - if($file_config) |
|
| 163 | + if ($file_config) |
|
| 164 | 164 | { |
| 165 | 165 | $config->allowed_filesize = $file_config->allowed_filesize; |
| 166 | 166 | $config->allowed_attach_size = $file_config->allowed_attach_size; |
@@ -171,31 +171,31 @@ discard block |
||
| 171 | 171 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
| 172 | 172 | } |
| 173 | 173 | // Property for all files comes first than each property |
| 174 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 175 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 176 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 177 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 178 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 179 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 180 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 174 | + if (!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 175 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 176 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 177 | + if (!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 178 | + if (!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 179 | + if (!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 180 | + if (!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 181 | 181 | // Default setting if not exists |
| 182 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 183 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 184 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 185 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 186 | - if(!$config->download_grant) $config->download_grant = array(); |
|
| 182 | + if (!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 183 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 184 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 185 | + if (!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 186 | + if (!$config->download_grant) $config->download_grant = array(); |
|
| 187 | 187 | |
| 188 | 188 | $size = ini_get('upload_max_filesize'); |
| 189 | 189 | $unit = strtolower($size[strlen($size) - 1]); |
| 190 | - $size = (float)$size; |
|
| 191 | - if($unit == 'g') $size *= 1024; |
|
| 192 | - if($unit == 'k') $size /= 1024; |
|
| 190 | + $size = (float) $size; |
|
| 191 | + if ($unit == 'g') $size *= 1024; |
|
| 192 | + if ($unit == 'k') $size /= 1024; |
|
| 193 | 193 | |
| 194 | - if($config->allowed_filesize > $size) |
|
| 194 | + if ($config->allowed_filesize > $size) |
|
| 195 | 195 | { |
| 196 | 196 | $config->allowed_filesize = $size; |
| 197 | 197 | } |
| 198 | - if($config->allowed_attach_size > $size) |
|
| 198 | + if ($config->allowed_attach_size > $size) |
|
| 199 | 199 | { |
| 200 | 200 | $config->allowed_attach_size = $size; |
| 201 | 201 | } |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | $args = new stdClass(); |
| 216 | 216 | $args->file_srl = $file_srl; |
| 217 | 217 | $output = executeQueryArray('file.getFile', $args, $columnList); |
| 218 | - if(!$output->toBool()) return $output; |
|
| 218 | + if (!$output->toBool()) return $output; |
|
| 219 | 219 | |
| 220 | 220 | // old version compatibility |
| 221 | - if(count($output->data) == 1) |
|
| 221 | + if (count($output->data) == 1) |
|
| 222 | 222 | { |
| 223 | 223 | $file = $output->data[0]; |
| 224 | 224 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | $fileList = array(); |
| 231 | 231 | |
| 232 | - if(is_array($output->data)) |
|
| 232 | + if (is_array($output->data)) |
|
| 233 | 233 | { |
| 234 | - foreach($output->data as $key=>$value) |
|
| 234 | + foreach ($output->data as $key=>$value) |
|
| 235 | 235 | { |
| 236 | 236 | $file = $value; |
| 237 | 237 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $args = new stdClass(); |
| 256 | 256 | $args->upload_target_srl = $upload_target_srl; |
| 257 | 257 | $args->sort_index = $sortIndex; |
| 258 | - if($ckValid) $args->isvalid = 'Y'; |
|
| 258 | + if ($ckValid) $args->isvalid = 'Y'; |
|
| 259 | 259 | $output = executeQueryArray('file.getFiles', $args, $columnList); |
| 260 | - if(!$output->data) return; |
|
| 260 | + if (!$output->data) return; |
|
| 261 | 261 | |
| 262 | 262 | $file_list = $output->data; |
| 263 | 263 | |
| 264 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 264 | + if ($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 265 | 265 | |
| 266 | 266 | foreach ($file_list as &$file) |
| 267 | 267 | { |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $module_srl = Context::get('module_srl'); |
| 286 | 286 | // Get the current module if module_srl doesn't exist |
| 287 | - if(!$module_srl) |
|
| 287 | + if (!$module_srl) |
|
| 288 | 288 | { |
| 289 | 289 | $current_module_info = Context::get('current_module_info'); |
| 290 | 290 | $module_srl = $current_module_info->module_srl; |
| 291 | 291 | } |
| 292 | 292 | $file_config = $this->getFileConfig($module_srl); |
| 293 | 293 | |
| 294 | - if($logged_info->is_admin == 'Y') |
|
| 294 | + if ($logged_info->is_admin == 'Y') |
|
| 295 | 295 | { |
| 296 | 296 | $iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size')); |
| 297 | 297 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | '%s : %s/ %s<br /> %s : %s (%s : %s)', |
| 318 | 318 | Context::getLang('allowed_attach_size'), |
| 319 | 319 | FileHandler::filesize($attached_size), |
| 320 | - FileHandler::filesize($file_config->allowed_attach_size*1024*1024), |
|
| 320 | + FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024), |
|
| 321 | 321 | Context::getLang('allowed_filesize'), |
| 322 | - FileHandler::filesize($file_config->allowed_filesize*1024*1024), |
|
| 322 | + FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024), |
|
| 323 | 323 | Context::getLang('allowed_filetypes'), |
| 324 | 324 | $file_config->allowed_filetypes |
| 325 | 325 | ); |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | function getFileGrant($file_info, $member_info) |
| 348 | 348 | { |
| 349 | - if(!$file_info) return null; |
|
| 349 | + if (!$file_info) return null; |
|
| 350 | 350 | |
| 351 | - if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
| 351 | + if ($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
| 352 | 352 | { |
| 353 | 353 | $file_grant->is_deletable = true; |
| 354 | 354 | return $file_grant; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | $oDocumentModel = getModel('document'); |
| 361 | 361 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
| 362 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 362 | + if ($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 363 | 363 | |
| 364 | 364 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
| 365 | 365 | |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | $mid = Context::get('mid'); |
| 30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
| 31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
| 32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 32 | + if(!$upload_target_srl) { |
|
| 33 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | if($upload_target_srl) |
| 35 | 37 | { |
@@ -68,26 +70,32 @@ discard block |
||
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | $tmp_files = $this->getFiles($upload_target_srl); |
| 71 | - if(!$tmp_files) $tmp_files = array(); |
|
| 73 | + if(!$tmp_files) { |
|
| 74 | + $tmp_files = array(); |
|
| 75 | + } |
|
| 72 | 76 | |
| 73 | 77 | foreach($tmp_files as $file_info) |
| 74 | 78 | { |
| 75 | - if(!$file_info->file_srl) continue; |
|
| 79 | + if(!$file_info->file_srl) { |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 76 | 82 | |
| 77 | 83 | $obj = new stdClass; |
| 78 | 84 | $obj->file_srl = $file_info->file_srl; |
| 79 | 85 | $obj->source_filename = $file_info->source_filename; |
| 80 | 86 | $obj->file_size = $file_info->file_size; |
| 81 | 87 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
| 82 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 83 | - else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
| 88 | + if($file_info->direct_download=='N') { |
|
| 89 | + $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 90 | + } else { |
|
| 91 | + $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
| 92 | + } |
|
| 84 | 93 | $obj->direct_download = $file_info->direct_download; |
| 85 | 94 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
| 86 | 95 | $files[] = $obj; |
| 87 | 96 | $attached_size += $file_info->file_size; |
| 88 | 97 | } |
| 89 | - } |
|
| 90 | - else |
|
| 98 | + } else |
|
| 91 | 99 | { |
| 92 | 100 | $upload_target_srl = 0; |
| 93 | 101 | $attached_size = 0; |
@@ -155,8 +163,12 @@ discard block |
||
| 155 | 163 | |
| 156 | 164 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
| 157 | 165 | |
| 158 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 159 | - if(!$file_config) $file_config = $file_module_config; |
|
| 166 | + if($module_srl) { |
|
| 167 | + $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 168 | + } |
|
| 169 | + if(!$file_config) { |
|
| 170 | + $file_config = $file_module_config; |
|
| 171 | + } |
|
| 160 | 172 | |
| 161 | 173 | $config = new stdClass(); |
| 162 | 174 | |
@@ -171,25 +183,53 @@ discard block |
||
| 171 | 183 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
| 172 | 184 | } |
| 173 | 185 | // Property for all files comes first than each property |
| 174 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 175 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 176 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 177 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 178 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 179 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 180 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 186 | + if(!$config->allowed_filesize) { |
|
| 187 | + $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 188 | + } |
|
| 189 | + if(!$config->allowed_attach_size) { |
|
| 190 | + $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 191 | + } |
|
| 192 | + if(!$config->allowed_filetypes) { |
|
| 193 | + $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 194 | + } |
|
| 195 | + if(!$config->allow_outlink) { |
|
| 196 | + $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 197 | + } |
|
| 198 | + if(!$config->allow_outlink_site) { |
|
| 199 | + $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 200 | + } |
|
| 201 | + if(!$config->allow_outlink_format) { |
|
| 202 | + $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 203 | + } |
|
| 204 | + if(!$config->download_grant) { |
|
| 205 | + $config->download_grant = $file_module_config->download_grant; |
|
| 206 | + } |
|
| 181 | 207 | // Default setting if not exists |
| 182 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 183 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 184 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 185 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 186 | - if(!$config->download_grant) $config->download_grant = array(); |
|
| 208 | + if(!$config->allowed_filesize) { |
|
| 209 | + $config->allowed_filesize = '2'; |
|
| 210 | + } |
|
| 211 | + if(!$config->allowed_attach_size) { |
|
| 212 | + $config->allowed_attach_size = '3'; |
|
| 213 | + } |
|
| 214 | + if(!$config->allowed_filetypes) { |
|
| 215 | + $config->allowed_filetypes = '*.*'; |
|
| 216 | + } |
|
| 217 | + if(!$config->allow_outlink) { |
|
| 218 | + $config->allow_outlink = 'Y'; |
|
| 219 | + } |
|
| 220 | + if(!$config->download_grant) { |
|
| 221 | + $config->download_grant = array(); |
|
| 222 | + } |
|
| 187 | 223 | |
| 188 | 224 | $size = ini_get('upload_max_filesize'); |
| 189 | 225 | $unit = strtolower($size[strlen($size) - 1]); |
| 190 | 226 | $size = (float)$size; |
| 191 | - if($unit == 'g') $size *= 1024; |
|
| 192 | - if($unit == 'k') $size /= 1024; |
|
| 227 | + if($unit == 'g') { |
|
| 228 | + $size *= 1024; |
|
| 229 | + } |
|
| 230 | + if($unit == 'k') { |
|
| 231 | + $size /= 1024; |
|
| 232 | + } |
|
| 193 | 233 | |
| 194 | 234 | if($config->allowed_filesize > $size) |
| 195 | 235 | { |
@@ -215,7 +255,9 @@ discard block |
||
| 215 | 255 | $args = new stdClass(); |
| 216 | 256 | $args->file_srl = $file_srl; |
| 217 | 257 | $output = executeQueryArray('file.getFile', $args, $columnList); |
| 218 | - if(!$output->toBool()) return $output; |
|
| 258 | + if(!$output->toBool()) { |
|
| 259 | + return $output; |
|
| 260 | + } |
|
| 219 | 261 | |
| 220 | 262 | // old version compatibility |
| 221 | 263 | if(count($output->data) == 1) |
@@ -224,8 +266,7 @@ discard block |
||
| 224 | 266 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
| 225 | 267 | |
| 226 | 268 | return $file; |
| 227 | - } |
|
| 228 | - else |
|
| 269 | + } else |
|
| 229 | 270 | { |
| 230 | 271 | $fileList = array(); |
| 231 | 272 | |
@@ -255,13 +296,19 @@ discard block |
||
| 255 | 296 | $args = new stdClass(); |
| 256 | 297 | $args->upload_target_srl = $upload_target_srl; |
| 257 | 298 | $args->sort_index = $sortIndex; |
| 258 | - if($ckValid) $args->isvalid = 'Y'; |
|
| 299 | + if($ckValid) { |
|
| 300 | + $args->isvalid = 'Y'; |
|
| 301 | + } |
|
| 259 | 302 | $output = executeQueryArray('file.getFiles', $args, $columnList); |
| 260 | - if(!$output->data) return; |
|
| 303 | + if(!$output->data) { |
|
| 304 | + return; |
|
| 305 | + } |
|
| 261 | 306 | |
| 262 | 307 | $file_list = $output->data; |
| 263 | 308 | |
| 264 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 309 | + if($file_list && !is_array($file_list)) { |
|
| 310 | + $file_list = array($file_list); |
|
| 311 | + } |
|
| 265 | 312 | |
| 266 | 313 | foreach ($file_list as &$file) |
| 267 | 314 | { |
@@ -346,7 +393,9 @@ discard block |
||
| 346 | 393 | */ |
| 347 | 394 | function getFileGrant($file_info, $member_info) |
| 348 | 395 | { |
| 349 | - if(!$file_info) return null; |
|
| 396 | + if(!$file_info) { |
|
| 397 | + return null; |
|
| 398 | + } |
|
| 350 | 399 | |
| 351 | 400 | if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
| 352 | 401 | { |
@@ -359,7 +408,9 @@ discard block |
||
| 359 | 408 | |
| 360 | 409 | $oDocumentModel = getModel('document'); |
| 361 | 410 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
| 362 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 411 | + if($oDocument->isExists()) { |
|
| 412 | + $document_grant = $oDocument->isGranted(); |
|
| 413 | + } |
|
| 363 | 414 | |
| 364 | 415 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
| 365 | 416 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
| 36 | 36 | { |
| 37 | 37 | // If XE has not installed yet, set module as install |
| 38 | - if(!Context::isInstalled()) |
|
| 38 | + if (!Context::isInstalled()) |
|
| 39 | 39 | { |
| 40 | 40 | $this->module = 'install'; |
| 41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance(); |
| 46 | - if($oContext->isSuccessInit == FALSE) |
|
| 46 | + if ($oContext->isSuccessInit == FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | $logged_info = Context::get('logged_info'); |
| 49 | - if($logged_info->is_admin != "Y") |
|
| 49 | + if ($logged_info->is_admin != "Y") |
|
| 50 | 50 | { |
| 51 | 51 | $this->error = 'msg_invalid_request'; |
| 52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
| 59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 62 | - if($entry = Context::get('entry')) |
|
| 62 | + if ($entry = Context::get('entry')) |
|
| 63 | 63 | { |
| 64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Validate variables to prevent XSS |
| 68 | 68 | $isInvalid = NULL; |
| 69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 70 | 70 | { |
| 71 | 71 | $isInvalid = TRUE; |
| 72 | 72 | } |
| 73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 74 | 74 | { |
| 75 | 75 | $isInvalid = TRUE; |
| 76 | 76 | } |
| 77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 78 | 78 | { |
| 79 | 79 | $isInvalid = TRUE; |
| 80 | 80 | } |
| 81 | - if($isInvalid) |
|
| 81 | + if ($isInvalid) |
|
| 82 | 82 | { |
| 83 | 83 | htmlHeader(); |
| 84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | exit; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 91 | 91 | { |
| 92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 93 | 93 | { |
| 94 | - if(Context::get('_https_port')!=null) { |
|
| 95 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
| 94 | + if (Context::get('_https_port') != null) { |
|
| 95 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
| 96 | 96 | } else { |
| 97 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
| 97 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
| 98 | 98 | } |
| 99 | 99 | return; |
| 100 | 100 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // call a trigger before moduleHandler init |
| 104 | 104 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
| 105 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 105 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 106 | 106 | { |
| 107 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 107 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 108 | 108 | { |
| 109 | 109 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
| 110 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -115,40 +115,40 @@ discard block |
||
| 115 | 115 | $called_position = 'before_module_init'; |
| 116 | 116 | $oAddonController = getController('addon'); |
| 117 | 117 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 118 | - if(file_exists($addon_file)) include($addon_file); |
|
| 118 | + if (file_exists($addon_file)) include($addon_file); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 122 | 122 | { |
| 123 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 123 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 124 | 124 | { |
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | set_error_handler(function() { }, ~0); |
| 129 | 129 | |
| 130 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 131 | - if(!file_exists($debug_file)) |
|
| 130 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 131 | + if (!file_exists($debug_file)) |
|
| 132 | 132 | { |
| 133 | 133 | $print[] = '<?php exit() ?>'; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $errorname = self::getErrorType($errnumber); |
| 137 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 137 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 138 | 138 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 139 | 139 | $backtrace = debug_backtrace($backtrace_args); |
| 140 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 140 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 141 | 141 | { |
| 142 | 142 | array_shift($backtrace); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - foreach($backtrace as $key => $value) |
|
| 145 | + foreach ($backtrace as $key => $value) |
|
| 146 | 146 | { |
| 147 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 147 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 148 | 148 | $print[] = $message; |
| 149 | 149 | } |
| 150 | 150 | $print[] = PHP_EOL; |
| 151 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 151 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 152 | 152 | restore_error_handler(); |
| 153 | 153 | |
| 154 | 154 | return true; |
@@ -164,21 +164,21 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | set_error_handler(function() { }, ~0); |
| 166 | 166 | |
| 167 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 168 | - if(!file_exists($debug_file)) |
|
| 167 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 168 | + if (!file_exists($debug_file)) |
|
| 169 | 169 | { |
| 170 | 170 | $print[] = '<?php exit() ?>'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $errorname = self::getErrorType($errinfo['type']); |
| 174 | 174 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 175 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 175 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 176 | 176 | |
| 177 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 177 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 178 | 178 | $print[] = $message; |
| 179 | 179 | |
| 180 | 180 | $print[] = PHP_EOL; |
| 181 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 181 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 182 | 182 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 183 | 183 | |
| 184 | 184 | return true; |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 223 | 223 | $defaultHost = $defaultUrlInfo['host']; |
| 224 | 224 | |
| 225 | - foreach($urls as $url) |
|
| 225 | + foreach ($urls as $url) |
|
| 226 | 226 | { |
| 227 | - if(empty($url)) |
|
| 227 | + if (empty($url)) |
|
| 228 | 228 | { |
| 229 | 229 | continue; |
| 230 | 230 | } |
@@ -232,29 +232,29 @@ discard block |
||
| 232 | 232 | $urlInfo = parse_url($url); |
| 233 | 233 | $host = $urlInfo['host']; |
| 234 | 234 | |
| 235 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 235 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 236 | 236 | { |
| 237 | 237 | throw new Exception('msg_default_url_is_null'); |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 241 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 242 | 242 | { |
| 243 | 243 | $oDocumentModel = getModel('document'); |
| 244 | 244 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 245 | - if($this->document_srl) |
|
| 245 | + if ($this->document_srl) |
|
| 246 | 246 | { |
| 247 | 247 | Context::set('document_srl', $this->document_srl); |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Get module's information based on document_srl, if it's specified |
| 252 | - if($this->document_srl) |
|
| 252 | + if ($this->document_srl) |
|
| 253 | 253 | { |
| 254 | 254 | |
| 255 | 255 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 256 | 256 | // If the document does not exist, remove document_srl |
| 257 | - if(!$module_info) |
|
| 257 | + if (!$module_info) |
|
| 258 | 258 | { |
| 259 | 259 | unset($this->document_srl); |
| 260 | 260 | } |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | // If it exists, compare mid based on the module information |
| 264 | 264 | // if mids are not matching, set it as the document's mid |
| 265 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 265 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 266 | 266 | { |
| 267 | 267 | |
| 268 | - if(Context::getRequestMethod() == 'GET') |
|
| 268 | + if (Context::getRequestMethod() == 'GET') |
|
| 269 | 269 | { |
| 270 | 270 | $this->mid = $module_info->mid; |
| 271 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 271 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 272 | 272 | return FALSE; |
| 273 | 273 | } |
| 274 | 274 | else |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 282 | - if($this->module && $module_info->module != $this->module) |
|
| 282 | + if ($this->module && $module_info->module != $this->module) |
|
| 283 | 283 | { |
| 284 | 284 | unset($module_info); |
| 285 | 285 | } |
@@ -288,36 +288,36 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 291 | - if(!$module_info && $this->mid) |
|
| 291 | + if (!$module_info && $this->mid) |
|
| 292 | 292 | { |
| 293 | 293 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 294 | 294 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // redirect, if module_site_srl and site_srl are different |
| 298 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 298 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 299 | 299 | { |
| 300 | 300 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 301 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 301 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 302 | 302 | return FALSE; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // If module_info is not set still, and $module does not exist, find the default module |
| 306 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 306 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 307 | 307 | { |
| 308 | 308 | $module_info = $site_module_info; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 311 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 312 | 312 | { |
| 313 | 313 | $module_info = $site_module_info; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 317 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 317 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 318 | 318 | { |
| 319 | 319 | // If the module is of virtual site |
| 320 | - if($module_info->site_srl) |
|
| 320 | + if ($module_info->site_srl) |
|
| 321 | 321 | { |
| 322 | 322 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 323 | 323 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | 328 | $db_info = Context::getDBInfo(); |
| 329 | - if(!$db_info->default_url) |
|
| 329 | + if (!$db_info->default_url) |
|
| 330 | 330 | { |
| 331 | 331 | return Context::getLang('msg_default_url_is_not_defined'); |
| 332 | 332 | } |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | - header("location:" . $redirect_url); |
|
| 338 | + header("location:".$redirect_url); |
|
| 339 | 339 | return FALSE; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // If module info was set, retrieve variables from the module information |
| 343 | - if($module_info) |
|
| 343 | + if ($module_info) |
|
| 344 | 344 | { |
| 345 | 345 | $this->module = $module_info->module; |
| 346 | 346 | $this->mid = $module_info->mid; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 352 | 352 | |
| 353 | 353 | // use the site default layout. |
| 354 | - if($module_info->{$targetSrl} == -1) |
|
| 354 | + if ($module_info->{$targetSrl} == -1) |
|
| 355 | 355 | { |
| 356 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
| 357 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Set module and mid into module_info |
| 372 | - if(!isset($this->module_info)) |
|
| 372 | + if (!isset($this->module_info)) |
|
| 373 | 373 | { |
| 374 | 374 | $this->module_info = new stdClass(); |
| 375 | 375 | } |
@@ -380,21 +380,21 @@ discard block |
||
| 380 | 380 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 381 | 381 | |
| 382 | 382 | // Still no module? it's an error |
| 383 | - if(!$this->module) |
|
| 383 | + if (!$this->module) |
|
| 384 | 384 | { |
| 385 | 385 | $this->error = 'msg_module_is_not_exists'; |
| 386 | 386 | $this->httpStatusCode = '404'; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // If mid exists, set mid into context |
| 390 | - if($this->mid) |
|
| 390 | + if ($this->mid) |
|
| 391 | 391 | { |
| 392 | 392 | Context::set('mid', $this->mid, TRUE); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // Call a trigger after moduleHandler init |
| 396 | 396 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 397 | - if(!$output->toBool()) |
|
| 397 | + if (!$output->toBool()) |
|
| 398 | 398 | { |
| 399 | 399 | $this->error = $output->getMessage(); |
| 400 | 400 | return TRUE; |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 417 | 417 | |
| 418 | 418 | // If error occurred while preparation, return a message instance |
| 419 | - if($this->error) |
|
| 419 | + if ($this->error) |
|
| 420 | 420 | { |
| 421 | 421 | $this->_setInputErrorToContext(); |
| 422 | 422 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 423 | 423 | $oMessageObject->setError(-1); |
| 424 | 424 | $oMessageObject->setMessage($this->error); |
| 425 | 425 | $oMessageObject->dispMessage(); |
| 426 | - if($this->httpStatusCode) |
|
| 426 | + if ($this->httpStatusCode) |
|
| 427 | 427 | { |
| 428 | 428 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 429 | 429 | } |
@@ -434,22 +434,22 @@ discard block |
||
| 434 | 434 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 435 | 435 | |
| 436 | 436 | // If not installed yet, modify act |
| 437 | - if($this->module == "install") |
|
| 437 | + if ($this->module == "install") |
|
| 438 | 438 | { |
| 439 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 439 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 440 | 440 | { |
| 441 | 441 | $this->act = $xml_info->default_index_act; |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // if act exists, find type of the action, if not use default index act |
| 446 | - if(!$this->act) |
|
| 446 | + if (!$this->act) |
|
| 447 | 447 | { |
| 448 | 448 | $this->act = $xml_info->default_index_act; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // still no act means error |
| 452 | - if(!$this->act) |
|
| 452 | + if (!$this->act) |
|
| 453 | 453 | { |
| 454 | 454 | $this->error = 'msg_module_is_not_exists'; |
| 455 | 455 | $this->httpStatusCode = '404'; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $oMessageObject->setError(-1); |
| 460 | 460 | $oMessageObject->setMessage($this->error); |
| 461 | 461 | $oMessageObject->dispMessage(); |
| 462 | - if($this->httpStatusCode) |
|
| 462 | + if ($this->httpStatusCode) |
|
| 463 | 463 | { |
| 464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 465 | 465 | } |
@@ -470,17 +470,17 @@ discard block |
||
| 470 | 470 | $type = $xml_info->action->{$this->act}->type; |
| 471 | 471 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
| 472 | 472 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 473 | - if(!$kind && $this->module == 'admin') |
|
| 473 | + if (!$kind && $this->module == 'admin') |
|
| 474 | 474 | { |
| 475 | 475 | $kind = 'admin'; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // check REQUEST_METHOD in controller |
| 479 | - if($type == 'controller') |
|
| 479 | + if ($type == 'controller') |
|
| 480 | 480 | { |
| 481 | 481 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 482 | 482 | |
| 483 | - if(!$allowedMethod) |
|
| 483 | + if (!$allowedMethod) |
|
| 484 | 484 | { |
| 485 | 485 | $allowedMethodList[0] = 'POST'; |
| 486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 492 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 493 | 493 | { |
| 494 | 494 | $this->error = "msg_invalid_request"; |
| 495 | 495 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if($this->module_info->use_mobile != "Y") |
|
| 503 | + if ($this->module_info->use_mobile != "Y") |
|
| 504 | 504 | { |
| 505 | 505 | Mobile::setMobile(FALSE); |
| 506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | // check CSRF for non-GET actions |
| 511 | 511 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 512 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 512 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 513 | 513 | { |
| 514 | 514 | $this->error = 'msg_invalid_request'; |
| 515 | 515 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Admin ip |
| 523 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 523 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 524 | 524 | { |
| 525 | 525 | $this->_setInputErrorToContext(); |
| 526 | 526 | $this->error = "msg_not_permitted_act"; |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // if(type == view, and case for using mobilephone) |
| 535 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 535 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 536 | 536 | { |
| 537 | 537 | $orig_type = "view"; |
| 538 | 538 | $type = "mobile"; |
| 539 | 539 | // create a module instance |
| 540 | 540 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 541 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 541 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 542 | 542 | { |
| 543 | 543 | $type = $orig_type; |
| 544 | 544 | Mobile::setMobile(FALSE); |
@@ -551,14 +551,14 @@ discard block |
||
| 551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if(!is_object($oModule)) |
|
| 554 | + if (!is_object($oModule)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->_setInputErrorToContext(); |
| 557 | 557 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 558 | 558 | $oMessageObject->setError(-1); |
| 559 | 559 | $oMessageObject->setMessage($this->error); |
| 560 | 560 | $oMessageObject->dispMessage(); |
| 561 | - if($this->httpStatusCode) |
|
| 561 | + if ($this->httpStatusCode) |
|
| 562 | 562 | { |
| 563 | 563 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 564 | 564 | } |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // If there is no such action in the module object |
| 569 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 569 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 570 | 570 | { |
| 571 | 571 | |
| 572 | - if(!Context::isInstalled()) |
|
| 572 | + if (!Context::isInstalled()) |
|
| 573 | 573 | { |
| 574 | 574 | $this->_setInputErrorToContext(); |
| 575 | 575 | $this->error = 'msg_invalid_request'; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $oMessageObject->setError(-1); |
| 578 | 578 | $oMessageObject->setMessage($this->error); |
| 579 | 579 | $oMessageObject->dispMessage(); |
| 580 | - if($this->httpStatusCode) |
|
| 580 | + if ($this->httpStatusCode) |
|
| 581 | 581 | { |
| 582 | 582 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | $forward = NULL; |
| 588 | 588 | // 1. Look for the module with action name |
| 589 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 589 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 590 | 590 | { |
| 591 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 591 | + $module = strtolower($matches[2].$matches[3]); |
|
| 592 | 592 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 593 | 593 | |
| 594 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 594 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 595 | 595 | { |
| 596 | 596 | $forward = new stdClass(); |
| 597 | 597 | $forward->module = $module; |
@@ -611,12 +611,12 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - if(!$forward) |
|
| 614 | + if (!$forward) |
|
| 615 | 615 | { |
| 616 | 616 | $forward = $oModuleModel->getActionForward($this->act); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 619 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 620 | 620 | { |
| 621 | 621 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 622 | 622 | $type = $forward->type; |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | // check CSRF for non-GET actions |
| 630 | 630 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 631 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 631 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 632 | 632 | { |
| 633 | 633 | $this->error = 'msg_invalid_request'; |
| 634 | 634 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -640,11 +640,11 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | // SECISSUE also check foward act method |
| 642 | 642 | // check REQUEST_METHOD in controller |
| 643 | - if($type == 'controller') |
|
| 643 | + if ($type == 'controller') |
|
| 644 | 644 | { |
| 645 | 645 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 646 | 646 | |
| 647 | - if(!$allowedMethod) |
|
| 647 | + if (!$allowedMethod) |
|
| 648 | 648 | { |
| 649 | 649 | $allowedMethodList[0] = 'POST'; |
| 650 | 650 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 656 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 657 | 657 | { |
| 658 | 658 | $this->error = "msg_invalid_request"; |
| 659 | 659 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -664,13 +664,13 @@ discard block |
||
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 667 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 668 | 668 | { |
| 669 | 669 | $orig_type = "view"; |
| 670 | 670 | $type = "mobile"; |
| 671 | 671 | // create a module instance |
| 672 | 672 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 673 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 673 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 674 | 674 | { |
| 675 | 675 | $type = $orig_type; |
| 676 | 676 | Mobile::setMobile(FALSE); |
@@ -682,25 +682,25 @@ discard block |
||
| 682 | 682 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - if(!is_object($oModule)) |
|
| 685 | + if (!is_object($oModule)) |
|
| 686 | 686 | { |
| 687 | 687 | $this->_setInputErrorToContext(); |
| 688 | 688 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 689 | 689 | $oMessageObject->setError(-1); |
| 690 | 690 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 691 | 691 | $oMessageObject->dispMessage(); |
| 692 | - if($this->httpStatusCode) |
|
| 692 | + if ($this->httpStatusCode) |
|
| 693 | 693 | { |
| 694 | 694 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 695 | 695 | } |
| 696 | 696 | return $oMessageObject; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - if($this->module == "admin" && $type == "view") |
|
| 699 | + if ($this->module == "admin" && $type == "view") |
|
| 700 | 700 | { |
| 701 | - if($logged_info->is_admin == 'Y') |
|
| 701 | + if ($logged_info->is_admin == 'Y') |
|
| 702 | 702 | { |
| 703 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 703 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 704 | 704 | { |
| 705 | 705 | $oAdminView = getAdminView('admin'); |
| 706 | 706 | $oAdminView->makeGnbUrl($forward->module); |
@@ -720,10 +720,10 @@ discard block |
||
| 720 | 720 | return $oMessageObject; |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | - if($kind == 'admin') |
|
| 723 | + if ($kind == 'admin') |
|
| 724 | 724 | { |
| 725 | 725 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 726 | - if(!$grant->manager) |
|
| 726 | + if (!$grant->manager) |
|
| 727 | 727 | { |
| 728 | 728 | $this->_setInputErrorToContext(); |
| 729 | 729 | $this->error = 'msg_is_not_manager'; |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | } |
| 736 | 736 | else |
| 737 | 737 | { |
| 738 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 738 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 739 | 739 | { |
| 740 | 740 | $this->_setInputErrorToContext(); |
| 741 | 741 | $this->error = 'msg_is_not_administrator'; |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 751 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 752 | 752 | { |
| 753 | 753 | $this->act = $xml_info->default_index_act; |
| 754 | 754 | } |
@@ -762,16 +762,16 @@ discard block |
||
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // ruleset check... |
| 765 | - if(!empty($ruleset)) |
|
| 765 | + if (!empty($ruleset)) |
|
| 766 | 766 | { |
| 767 | 767 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 768 | 768 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 769 | - if(!empty($rulesetFile)) |
|
| 769 | + if (!empty($rulesetFile)) |
|
| 770 | 770 | { |
| 771 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 771 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 772 | 772 | { |
| 773 | 773 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 774 | - foreach($errorLang as $key => $val) |
|
| 774 | + foreach ($errorLang as $key => $val) |
|
| 775 | 775 | { |
| 776 | 776 | Context::setLang($key, $val); |
| 777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | |
| 781 | 781 | $Validator = new Validator($rulesetFile); |
| 782 | 782 | $result = $Validator->validate(); |
| 783 | - if(!$result) |
|
| 783 | + if (!$result) |
|
| 784 | 784 | { |
| 785 | 785 | $lastError = $Validator->getLastError(); |
| 786 | 786 | $returnUrl = Context::get('error_return_url'); |
@@ -812,26 +812,26 @@ discard block |
||
| 812 | 812 | 'dispLayoutPreviewWithModule' => 1 |
| 813 | 813 | ); |
| 814 | 814 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 815 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 815 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 816 | 816 | { |
| 817 | 817 | global $lang; |
| 818 | 818 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
| 819 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
| 819 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
| 820 | 820 | Context::addHtmlHeader($header); |
| 821 | 821 | Context::addHtmlFooter($footer); |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if($type == "view" && $kind != 'admin') |
|
| 824 | + if ($type == "view" && $kind != 'admin') |
|
| 825 | 825 | { |
| 826 | 826 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 827 | - if($module_config->htmlFooter) |
|
| 827 | + if ($module_config->htmlFooter) |
|
| 828 | 828 | { |
| 829 | 829 | Context::addHtmlFooter($module_config->htmlFooter); |
| 830 | 830 | } |
| 831 | - if($module_config->siteTitle) |
|
| 831 | + if ($module_config->siteTitle) |
|
| 832 | 832 | { |
| 833 | 833 | $siteTitle = Context::getBrowserTitle(); |
| 834 | - if(!$siteTitle) |
|
| 834 | + if (!$siteTitle) |
|
| 835 | 835 | { |
| 836 | 836 | Context::setBrowserTitle($module_config->siteTitle); |
| 837 | 837 | } |
@@ -844,18 +844,18 @@ discard block |
||
| 844 | 844 | $procResult = $oModule->proc(); |
| 845 | 845 | |
| 846 | 846 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 847 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 847 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 848 | 848 | { |
| 849 | 849 | $error = $oModule->getError(); |
| 850 | 850 | $message = $oModule->getMessage(); |
| 851 | 851 | $messageType = $oModule->getMessageType(); |
| 852 | 852 | $redirectUrl = $oModule->getRedirectUrl(); |
| 853 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 853 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 854 | 854 | |
| 855 | - if(!$procResult) |
|
| 855 | + if (!$procResult) |
|
| 856 | 856 | { |
| 857 | 857 | $this->error = $message; |
| 858 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 858 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 859 | 859 | { |
| 860 | 860 | $redirectUrl = Context::get('error_return_url'); |
| 861 | 861 | } |
@@ -868,13 +868,13 @@ discard block |
||
| 868 | 868 | |
| 869 | 869 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 870 | 870 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 871 | - if($message != 'success') |
|
| 871 | + if ($message != 'success') |
|
| 872 | 872 | { |
| 873 | 873 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 874 | 874 | } |
| 875 | 875 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 876 | 876 | |
| 877 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 877 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 878 | 878 | { |
| 879 | 879 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 880 | 880 | } |
@@ -890,27 +890,27 @@ discard block |
||
| 890 | 890 | * */ |
| 891 | 891 | function _setInputErrorToContext() |
| 892 | 892 | { |
| 893 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 893 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 894 | 894 | { |
| 895 | 895 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 896 | 896 | } |
| 897 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 897 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 898 | 898 | { |
| 899 | 899 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 900 | 900 | } |
| 901 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 901 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 902 | 902 | { |
| 903 | 903 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 904 | 904 | } |
| 905 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 905 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 906 | 906 | { |
| 907 | 907 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 908 | 908 | } |
| 909 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 909 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 910 | 910 | { |
| 911 | 911 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 912 | 912 | } |
| 913 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 913 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 914 | 914 | { |
| 915 | 915 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 916 | 916 | } |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | { |
| 941 | 941 | $requestVars = Context::getRequestVars(); |
| 942 | 942 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 943 | - foreach($requestVars AS $key => $value) |
|
| 943 | + foreach ($requestVars AS $key => $value) |
|
| 944 | 944 | { |
| 945 | 945 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 946 | 946 | } |
@@ -954,41 +954,41 @@ discard block |
||
| 954 | 954 | function displayContent($oModule = NULL) |
| 955 | 955 | { |
| 956 | 956 | // If the module is not set or not an object, set error |
| 957 | - if(!$oModule || !is_object($oModule)) |
|
| 957 | + if (!$oModule || !is_object($oModule)) |
|
| 958 | 958 | { |
| 959 | 959 | $this->error = 'msg_module_is_not_exists'; |
| 960 | 960 | $this->httpStatusCode = '404'; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | // If connection to DB has a problem even though it's not install module, set error |
| 964 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 964 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 965 | 965 | { |
| 966 | 966 | $this->error = 'msg_dbconnect_failed'; |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | // Call trigger after moduleHandler proc |
| 970 | 970 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 971 | - if(!$output->toBool()) |
|
| 971 | + if (!$output->toBool()) |
|
| 972 | 972 | { |
| 973 | 973 | $this->error = $output->getMessage(); |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | // Use message view object, if HTML call |
| 977 | 977 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 978 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 978 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 979 | 979 | { |
| 980 | 980 | |
| 981 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 981 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 982 | 982 | { |
| 983 | 983 | $display_handler = new DisplayHandler(); |
| 984 | 984 | $display_handler->_debugOutput(); |
| 985 | 985 | |
| 986 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 986 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 987 | 987 | return; |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | // If error occurred, handle it |
| 991 | - if($this->error) |
|
| 991 | + if ($this->error) |
|
| 992 | 992 | { |
| 993 | 993 | // display content with message module instance |
| 994 | 994 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -997,14 +997,14 @@ discard block |
||
| 997 | 997 | $oMessageObject->setMessage($this->error); |
| 998 | 998 | $oMessageObject->dispMessage(); |
| 999 | 999 | |
| 1000 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1000 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1001 | 1001 | { |
| 1002 | 1002 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 1003 | 1003 | $oMessageObject->setTemplateFile('http_status_code'); |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // If module was called normally, change the templates of the module into ones of the message view module |
| 1007 | - if($oModule) |
|
| 1007 | + if ($oModule) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1010 | 1010 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | // Check if layout_srl exists for the module |
| 1022 | - if(Mobile::isFromMobilePhone()) |
|
| 1022 | + if (Mobile::isFromMobilePhone()) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1025 | 1025 | } |
@@ -1029,58 +1029,58 @@ discard block |
||
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | // if layout_srl is rollback by module, set default layout |
| 1032 | - if($layout_srl == -1) |
|
| 1032 | + if ($layout_srl == -1) |
|
| 1033 | 1033 | { |
| 1034 | 1034 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1035 | 1035 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1036 | 1036 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1039 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1040 | 1040 | { |
| 1041 | 1041 | |
| 1042 | 1042 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1043 | 1043 | $oLayoutModel = getModel('layout'); |
| 1044 | 1044 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1045 | - if($layout_info) |
|
| 1045 | + if ($layout_info) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | |
| 1048 | 1048 | // Input extra_vars into $layout_info |
| 1049 | - if($layout_info->extra_var_count) |
|
| 1049 | + if ($layout_info->extra_var_count) |
|
| 1050 | 1050 | { |
| 1051 | 1051 | |
| 1052 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1052 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1053 | 1053 | { |
| 1054 | - if($val->type == 'image') |
|
| 1054 | + if ($val->type == 'image') |
|
| 1055 | 1055 | { |
| 1056 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1056 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1057 | 1057 | { |
| 1058 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1058 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | } |
| 1061 | 1061 | $layout_info->{$var_id} = $val->value; |
| 1062 | 1062 | } |
| 1063 | 1063 | } |
| 1064 | 1064 | // Set menus into context |
| 1065 | - if($layout_info->menu_count) |
|
| 1065 | + if ($layout_info->menu_count) |
|
| 1066 | 1066 | { |
| 1067 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1067 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1068 | 1068 | { |
| 1069 | 1069 | // set default menu set(included home menu) |
| 1070 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1070 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1071 | 1071 | { |
| 1072 | 1072 | $oMenuAdminController = getAdminController('menu'); |
| 1073 | 1073 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1074 | 1074 | |
| 1075 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1075 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1076 | 1076 | { |
| 1077 | 1077 | include($homeMenuCacheFile); |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | - if(!$menu->menu_srl) |
|
| 1080 | + if (!$menu->menu_srl) |
|
| 1081 | 1081 | { |
| 1082 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1083 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1082 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1083 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1084 | 1084 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1085 | 1085 | } |
| 1086 | 1086 | else |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | $php_file = FileHandler::exists($menu->php_file); |
| 1094 | - if($php_file) |
|
| 1094 | + if ($php_file) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | include($php_file); |
| 1097 | 1097 | } |
@@ -1107,17 +1107,17 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | // If layout was modified, use the modified version |
| 1109 | 1109 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1110 | - if(file_exists($edited_layout)) |
|
| 1110 | + if (file_exists($edited_layout)) |
|
| 1111 | 1111 | { |
| 1112 | 1112 | $oModule->setEditedLayoutFile($edited_layout); |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | } |
| 1116 | 1116 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1117 | - if($isLayoutDrop) |
|
| 1117 | + if ($isLayoutDrop) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1120 | - if($kind == 'admin') |
|
| 1120 | + if ($kind == 'admin') |
|
| 1121 | 1121 | { |
| 1122 | 1122 | $oModule->setLayoutFile('popup_layout'); |
| 1123 | 1123 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1156 | 1156 | { |
| 1157 | 1157 | |
| 1158 | - if(__DEBUG__ == 3) |
|
| 1158 | + if (__DEBUG__ == 3) |
|
| 1159 | 1159 | { |
| 1160 | 1160 | $start_time = getMicroTime(); |
| 1161 | 1161 | } |
@@ -1165,51 +1165,51 @@ discard block |
||
| 1165 | 1165 | $type = strtolower($type); |
| 1166 | 1166 | |
| 1167 | 1167 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1168 | - if(!isset($kinds[$kind])) |
|
| 1168 | + if (!isset($kinds[$kind])) |
|
| 1169 | 1169 | { |
| 1170 | 1170 | $kind = 'svc'; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1173 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1174 | 1174 | |
| 1175 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1175 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1176 | 1176 | { |
| 1177 | 1177 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | // if there is no instance of the module in global variable, create a new one |
| 1181 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1181 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1182 | 1182 | { |
| 1183 | 1183 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1184 | 1184 | |
| 1185 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1185 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $module = $parent_module; |
| 1188 | 1188 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 | // Check if the base class and instance class exist |
| 1192 | - if(!class_exists($module, true)) |
|
| 1192 | + if (!class_exists($module, true)) |
|
| 1193 | 1193 | { |
| 1194 | 1194 | return NULL; |
| 1195 | 1195 | } |
| 1196 | - if(!class_exists($instance_name, true)) |
|
| 1196 | + if (!class_exists($instance_name, true)) |
|
| 1197 | 1197 | { |
| 1198 | 1198 | return NULL; |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | // Create an instance |
| 1202 | 1202 | $oModule = new $instance_name(); |
| 1203 | - if(!is_object($oModule)) |
|
| 1203 | + if (!is_object($oModule)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | return NULL; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | // Load language files for the class |
| 1209 | - Context::loadLang($class_path . 'lang'); |
|
| 1210 | - if($extend_module) |
|
| 1209 | + Context::loadLang($class_path.'lang'); |
|
| 1210 | + if ($extend_module) |
|
| 1211 | 1211 | { |
| 1212 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1212 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | // Set variables to the instance |
@@ -1217,10 +1217,10 @@ discard block |
||
| 1217 | 1217 | $oModule->setModulePath($class_path); |
| 1218 | 1218 | |
| 1219 | 1219 | // If the module has a constructor, run it. |
| 1220 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1220 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1223 | - if(@method_exists($oModule, $instance_name)) |
|
| 1223 | + if (@method_exists($oModule, $instance_name)) |
|
| 1224 | 1224 | { |
| 1225 | 1225 | $oModule->{$instance_name}(); |
| 1226 | 1226 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(__DEBUG__ == 3) |
|
| 1233 | + if (__DEBUG__ == 3) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1236 | 1236 | } |
@@ -1246,17 +1246,17 @@ discard block |
||
| 1246 | 1246 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1247 | 1247 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1248 | 1248 | |
| 1249 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1250 | - if(!in_array($type, $types)) |
|
| 1249 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1250 | + if (!in_array($type, $types)) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $type = $types[0]; |
| 1253 | 1253 | } |
| 1254 | - if($type == 'class') |
|
| 1254 | + if ($type == 'class') |
|
| 1255 | 1255 | { |
| 1256 | 1256 | $instanceName = '%s'; |
| 1257 | 1257 | $classFile = '%s%s.%s.php'; |
| 1258 | 1258 | } |
| 1259 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1259 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $instanceName = '%sAdmin%s'; |
| 1262 | 1262 | $classFile = '%s%s.admin.%s.php'; |
@@ -1281,26 +1281,26 @@ discard block |
||
| 1281 | 1281 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1282 | 1282 | { |
| 1283 | 1283 | // skip if not installed |
| 1284 | - if(!Context::isInstalled()) |
|
| 1284 | + if (!Context::isInstalled()) |
|
| 1285 | 1285 | { |
| 1286 | 1286 | return new Object(); |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | $oModuleModel = getModel('module'); |
| 1290 | 1290 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1291 | - if(!$triggers || count($triggers) < 1) |
|
| 1291 | + if (!$triggers || count($triggers) < 1) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | return new Object(); |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | //store before trigger call time |
| 1297 | 1297 | $before_trigger_time = NULL; |
| 1298 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1298 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1299 | 1299 | { |
| 1300 | 1300 | $before_trigger_time = microtime(true); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | - foreach($triggers as $item) |
|
| 1303 | + foreach ($triggers as $item) |
|
| 1304 | 1304 | { |
| 1305 | 1305 | $module = $item->module; |
| 1306 | 1306 | $type = $item->type; |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | |
| 1309 | 1309 | // todo why don't we call a normal class object ? |
| 1310 | 1310 | $oModule = getModule($module, $type); |
| 1311 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1311 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | continue; |
| 1314 | 1314 | } |
@@ -1321,12 +1321,12 @@ discard block |
||
| 1321 | 1321 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1322 | 1322 | |
| 1323 | 1323 | $slowlog = new stdClass; |
| 1324 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1325 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1324 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1325 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1326 | 1326 | $slowlog->called_extension = $module; |
| 1327 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1327 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1328 | 1328 | |
| 1329 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1329 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1330 | 1330 | { |
| 1331 | 1331 | return $output; |
| 1332 | 1332 | } |
@@ -1411,9 +1411,9 @@ discard block |
||
| 1411 | 1411 | '511' => 'Network Authentication Required', |
| 1412 | 1412 | ); |
| 1413 | 1413 | $statusMessage = $statusMessageList[$code]; |
| 1414 | - if(!$statusMessage) |
|
| 1414 | + if (!$statusMessage) |
|
| 1415 | 1415 | { |
| 1416 | - $statusMessage = 'HTTP ' . $code; |
|
| 1416 | + $statusMessage = 'HTTP '.$code; |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | Context::set('http_status_code', $code); |