@@ -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,24 +61,24 @@ 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 | |
73 | 73 | // Delete and then attempt to re-upload if file_srl is requested |
74 | 74 | $file_srl = Context::get('file_srl'); |
75 | - if($file_srl) |
|
75 | + if ($file_srl) |
|
76 | 76 | { |
77 | 77 | $oFileModel = getModel('file'); |
78 | 78 | $logged_info = Context::get('logged_info'); |
79 | 79 | $file_info = $oFileModel->getFile($file_srl); |
80 | 80 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
81 | - if($file_info->file_srl == $file_srl && $file_grant->is_deletable) |
|
81 | + if ($file_info->file_srl == $file_srl && $file_grant->is_deletable) |
|
82 | 82 | { |
83 | 83 | $this->deleteFile($file_srl); |
84 | 84 | } |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | |
87 | 87 | $file_info = Context::get('Filedata'); |
88 | 88 | // An error appears if not a normally uploaded file |
89 | - if(is_uploaded_file($file_info['tmp_name'])) { |
|
89 | + if (is_uploaded_file($file_info['tmp_name'])) { |
|
90 | 90 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
91 | - Context::set('uploaded_fileinfo',$output); |
|
91 | + Context::set('uploaded_fileinfo', $output); |
|
92 | 92 | } |
93 | 93 | |
94 | - Context::set('layout','none'); |
|
94 | + Context::set('layout', 'none'); |
|
95 | 95 | |
96 | 96 | $this->setTemplatePath($this->module_path.'tpl'); |
97 | 97 | $this->setTemplateFile('iframe'); |
@@ -108,24 +108,24 @@ discard block |
||
108 | 108 | $width = Context::get('width'); |
109 | 109 | $height = Context::get('height'); |
110 | 110 | |
111 | - if(!$file_srl || !$width) |
|
111 | + if (!$file_srl || !$width) |
|
112 | 112 | { |
113 | - return new Object(-1,'msg_invalid_request'); |
|
113 | + return new Object(-1, 'msg_invalid_request'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $oFileModel = getModel('file'); |
117 | 117 | $fileInfo = $oFileModel->getFile($file_srl); |
118 | - if(!$fileInfo || $fileInfo->direct_download != 'Y') |
|
118 | + if (!$fileInfo || $fileInfo->direct_download != 'Y') |
|
119 | 119 | { |
120 | - return new Object(-1,'msg_invalid_request'); |
|
120 | + return new Object(-1, 'msg_invalid_request'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $source_src = $fileInfo->uploaded_filename; |
124 | - $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
|
124 | + $output_src = $source_src.'.resized'.strrchr($source_src, '.'); |
|
125 | 125 | |
126 | - if(!$height) $height = $width-1; |
|
126 | + if (!$height) $height = $width - 1; |
|
127 | 127 | |
128 | - if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
|
128 | + if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio')) |
|
129 | 129 | { |
130 | 130 | $output = new stdClass(); |
131 | 131 | $output->info = getimagesize($output_src); |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | } |
134 | 134 | else |
135 | 135 | { |
136 | - return new Object(-1,'msg_invalid_request'); |
|
136 | + return new Object(-1, 'msg_invalid_request'); |
|
137 | 137 | } |
138 | 138 | |
139 | - $this->add('resized_info',$output); |
|
139 | + $this->add('resized_info', $output); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | $oFileModel = getModel('file'); |
176 | 176 | |
177 | - if(isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
177 | + if (isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
178 | 178 | |
179 | 179 | $file_srl = Context::get('file_srl'); |
180 | 180 | $sid = Context::get('sid'); |
@@ -183,26 +183,26 @@ discard block |
||
183 | 183 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
184 | 184 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
185 | 185 | // If the requested file information is incorrect, an error that file cannot be found appears |
186 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
186 | + if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found'); |
|
187 | 187 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
188 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
188 | + if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download'); |
|
189 | 189 | // File name |
190 | 190 | $filename = $file_obj->source_filename; |
191 | 191 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
192 | 192 | // Not allow the file outlink |
193 | - if($file_module_config->allow_outlink == 'N') |
|
193 | + if ($file_module_config->allow_outlink == 'N') |
|
194 | 194 | { |
195 | 195 | // Handles extension to allow outlink |
196 | - if($file_module_config->allow_outlink_format) |
|
196 | + if ($file_module_config->allow_outlink_format) |
|
197 | 197 | { |
198 | 198 | $allow_outlink_format_array = array(); |
199 | 199 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
200 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
200 | + if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
201 | 201 | |
202 | - foreach($allow_outlink_format_array as $val) |
|
202 | + foreach ($allow_outlink_format_array as $val) |
|
203 | 203 | { |
204 | 204 | $val = trim($val); |
205 | - if(preg_match("/\.{$val}$/i", $filename)) |
|
205 | + if (preg_match("/\.{$val}$/i", $filename)) |
|
206 | 206 | { |
207 | 207 | $file_module_config->allow_outlink = 'Y'; |
208 | 208 | break; |
@@ -210,21 +210,21 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | // Sites that outlink is allowed |
213 | - if($file_module_config->allow_outlink != 'Y') |
|
213 | + if ($file_module_config->allow_outlink != 'Y') |
|
214 | 214 | { |
215 | 215 | $referer = parse_url($_SERVER["HTTP_REFERER"]); |
216 | - if($referer['host'] != $_SERVER['HTTP_HOST']) |
|
216 | + if ($referer['host'] != $_SERVER['HTTP_HOST']) |
|
217 | 217 | { |
218 | - if($file_module_config->allow_outlink_site) |
|
218 | + if ($file_module_config->allow_outlink_site) |
|
219 | 219 | { |
220 | 220 | $allow_outlink_site_array = array(); |
221 | 221 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
222 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
222 | + if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
223 | 223 | |
224 | - foreach($allow_outlink_site_array as $val) |
|
224 | + foreach ($allow_outlink_site_array as $val) |
|
225 | 225 | { |
226 | 226 | $site = parse_url(trim($val)); |
227 | - if($site['host'] == $referer['host']) |
|
227 | + if ($site['host'] == $referer['host']) |
|
228 | 228 | { |
229 | 229 | $file_module_config->allow_outlink = 'Y'; |
230 | 230 | break; |
@@ -234,49 +234,49 @@ discard block |
||
234 | 234 | } |
235 | 235 | else $file_module_config->allow_outlink = 'Y'; |
236 | 236 | } |
237 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
237 | + if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | // Check if a permission for file download is granted |
241 | 241 | $downloadGrantCount = 0; |
242 | - if(is_array($file_module_config->download_grant)) |
|
242 | + if (is_array($file_module_config->download_grant)) |
|
243 | 243 | { |
244 | - foreach($file_module_config->download_grant AS $value) |
|
245 | - if($value) $downloadGrantCount++; |
|
244 | + foreach ($file_module_config->download_grant AS $value) |
|
245 | + if ($value) $downloadGrantCount++; |
|
246 | 246 | } |
247 | 247 | |
248 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
248 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
249 | 249 | { |
250 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
250 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
251 | 251 | $logged_info = Context::get('logged_info'); |
252 | - if($logged_info->is_admin != 'Y') |
|
252 | + if ($logged_info->is_admin != 'Y') |
|
253 | 253 | { |
254 | - $oModuleModel =& getModel('module'); |
|
254 | + $oModuleModel = & getModel('module'); |
|
255 | 255 | $columnList = array('module_srl', 'site_srl'); |
256 | 256 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList); |
257 | 257 | |
258 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
258 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
259 | 259 | { |
260 | - $oMemberModel =& getModel('member'); |
|
260 | + $oMemberModel = & getModel('member'); |
|
261 | 261 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
262 | 262 | |
263 | 263 | $is_permitted = false; |
264 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
264 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
265 | 265 | { |
266 | 266 | $group_srl = $file_module_config->download_grant[$i]; |
267 | - if($member_groups[$group_srl]) |
|
267 | + if ($member_groups[$group_srl]) |
|
268 | 268 | { |
269 | 269 | $is_permitted = true; |
270 | 270 | break; |
271 | 271 | } |
272 | 272 | } |
273 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
273 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
277 | 277 | // Call a trigger (before) |
278 | 278 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
279 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
279 | + if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download'); |
|
280 | 280 | |
281 | 281 | |
282 | 282 | // 다운로드 후 (가상) |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | $random = new Password(); |
291 | 291 | $file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex'); |
292 | - header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key)); |
|
292 | + header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key)); |
|
293 | 293 | Context::close(); |
294 | 294 | exit(); |
295 | 295 | |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | $oFileModel = getModel('file'); |
301 | 301 | $file_srl = Context::get('file_srl'); |
302 | 302 | $file_key = Context::get('file_key'); |
303 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
303 | + if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
304 | 304 | |
305 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
305 | + if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
306 | 306 | else $session_key = '__XE_FILE_KEY__'; |
307 | 307 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
308 | 308 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
309 | 309 | |
310 | 310 | $uploaded_filename = $file_obj->uploaded_filename; |
311 | 311 | |
312 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
312 | + if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
313 | 313 | |
314 | - if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
314 | + if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
315 | 315 | { |
316 | 316 | unset($_SESSION[$session_key][$file_srl]); |
317 | 317 | return $this->stop('msg_invalid_request'); |
@@ -320,34 +320,34 @@ discard block |
||
320 | 320 | $file_size = $file_obj->file_size; |
321 | 321 | $filename = $file_obj->source_filename; |
322 | 322 | |
323 | - if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
323 | + if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
324 | 324 | { |
325 | - if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
325 | + if ($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
326 | 326 | { |
327 | - $filename_param = 'filename="' . $filename . '"'; |
|
327 | + $filename_param = 'filename="'.$filename.'"'; |
|
328 | 328 | } |
329 | 329 | else |
330 | 330 | { |
331 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
331 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
332 | 332 | } |
333 | 333 | } |
334 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
334 | + elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
335 | 335 | { |
336 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
336 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
337 | 337 | } |
338 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
338 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
339 | 339 | { |
340 | 340 | $filename = rawurlencode($filename); |
341 | - $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
|
341 | + $filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"'; |
|
342 | 342 | } |
343 | 343 | else |
344 | 344 | { |
345 | - $filename_param = 'filename="' . $filename . '"'; |
|
345 | + $filename_param = 'filename="'.$filename.'"'; |
|
346 | 346 | } |
347 | 347 | |
348 | - if($is_android) |
|
348 | + if ($is_android) |
|
349 | 349 | { |
350 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
350 | + if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | unset($_SESSION[$session_key][$file_srl]); |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | Context::close(); |
356 | 356 | |
357 | 357 | $fp = fopen($uploaded_filename, 'rb'); |
358 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
358 | + if (!$fp) return $this->stop('msg_file_not_found'); |
|
359 | 359 | |
360 | 360 | header("Cache-Control: "); |
361 | 361 | header("Pragma: "); |
362 | 362 | header("Content-Type: application/octet-stream"); |
363 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
363 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
364 | 364 | |
365 | - header("Content-Length: " .(string)($file_size)); |
|
366 | - header('Content-Disposition: attachment; ' . $filename_param); |
|
365 | + header("Content-Length: ".(string) ($file_size)); |
|
366 | + header('Content-Disposition: attachment; '.$filename_param); |
|
367 | 367 | header("Content-Transfer-Encoding: binary\n"); |
368 | 368 | |
369 | 369 | // if file size is lager than 10MB, use fread function (#18675748) |
370 | - if(filesize($uploaded_filename) > 1024 * 1024) |
|
370 | + if (filesize($uploaded_filename) > 1024 * 1024) |
|
371 | 371 | { |
372 | - while(!feof($fp)) echo fread($fp, 1024); |
|
372 | + while (!feof($fp)) echo fread($fp, 1024); |
|
373 | 373 | fclose($fp); |
374 | 374 | } |
375 | 375 | else |
@@ -391,36 +391,36 @@ discard block |
||
391 | 391 | $editor_sequence = Context::get('editor_sequence'); |
392 | 392 | $file_srl = Context::get('file_srl'); |
393 | 393 | $file_srls = Context::get('file_srls'); |
394 | - if($file_srls) $file_srl = $file_srls; |
|
394 | + if ($file_srls) $file_srl = $file_srls; |
|
395 | 395 | // Exit a session if there is neither upload permission nor information |
396 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
396 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
397 | 397 | |
398 | 398 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
399 | 399 | |
400 | 400 | $logged_info = Context::get('logged_info'); |
401 | 401 | $oFileModel = getModel('file'); |
402 | 402 | |
403 | - $srls = explode(',',$file_srl); |
|
404 | - if(!count($srls)) return; |
|
403 | + $srls = explode(',', $file_srl); |
|
404 | + if (!count($srls)) return; |
|
405 | 405 | |
406 | - for($i=0;$i<count($srls);$i++) |
|
406 | + for ($i = 0; $i < count($srls); $i++) |
|
407 | 407 | { |
408 | - $srl = (int)$srls[$i]; |
|
409 | - if(!$srl) continue; |
|
408 | + $srl = (int) $srls[$i]; |
|
409 | + if (!$srl) continue; |
|
410 | 410 | |
411 | 411 | $args = new stdClass; |
412 | 412 | $args->file_srl = $srl; |
413 | 413 | $output = executeQuery('file.getFile', $args); |
414 | - if(!$output->toBool()) continue; |
|
414 | + if (!$output->toBool()) continue; |
|
415 | 415 | |
416 | 416 | $file_info = $output->data; |
417 | - if(!$file_info) continue; |
|
417 | + if (!$file_info) continue; |
|
418 | 418 | |
419 | 419 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
420 | 420 | |
421 | - if(!$file_grant->is_deletable) continue; |
|
421 | + if (!$file_grant->is_deletable) continue; |
|
422 | 422 | |
423 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
423 | + if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | */ |
432 | 432 | function procFileGetList() |
433 | 433 | { |
434 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
434 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
435 | 435 | |
436 | 436 | $oModuleModel = getModel('module'); |
437 | 437 | |
438 | 438 | $logged_info = Context::get('logged_info'); |
439 | - if($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info)) |
|
439 | + if ($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info)) |
|
440 | 440 | { |
441 | 441 | return new Object(-1, 'msg_not_permitted'); |
442 | 442 | } |
443 | 443 | |
444 | 444 | $fileSrls = Context::get('file_srls'); |
445 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
445 | + if ($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
446 | 446 | |
447 | 447 | global $lang; |
448 | - if(count($fileSrlList) > 0) |
|
448 | + if (count($fileSrlList) > 0) |
|
449 | 449 | { |
450 | 450 | $oFileModel = getModel('file'); |
451 | 451 | $fileList = $oFileModel->getFile($fileSrlList); |
452 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
452 | + if (!is_array($fileList)) $fileList = array($fileList); |
|
453 | 453 | |
454 | - if(is_array($fileList)) |
|
454 | + if (is_array($fileList)) |
|
455 | 455 | { |
456 | - foreach($fileList AS $key=>$value) |
|
456 | + foreach ($fileList AS $key=>$value) |
|
457 | 457 | { |
458 | 458 | $value->human_file_size = FileHandler::filesize($value->file_size); |
459 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
459 | + if ($value->isvalid == 'Y') $value->validName = $lang->is_valid; |
|
460 | 460 | else $value->validName = $lang->is_stand_by; |
461 | 461 | } |
462 | 462 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | function triggerCheckAttached(&$obj) |
479 | 479 | { |
480 | 480 | $document_srl = $obj->document_srl; |
481 | - if(!$document_srl) return new Object(); |
|
481 | + if (!$document_srl) return new Object(); |
|
482 | 482 | // Get numbers of attachments |
483 | 483 | $oFileModel = getModel('file'); |
484 | 484 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -495,10 +495,10 @@ discard block |
||
495 | 495 | function triggerAttachFiles(&$obj) |
496 | 496 | { |
497 | 497 | $document_srl = $obj->document_srl; |
498 | - if(!$document_srl) return new Object(); |
|
498 | + if (!$document_srl) return new Object(); |
|
499 | 499 | |
500 | 500 | $output = $this->setFilesValid($document_srl); |
501 | - if(!$output->toBool()) return $output; |
|
501 | + if (!$output->toBool()) return $output; |
|
502 | 502 | |
503 | 503 | return new Object(); |
504 | 504 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | function triggerDeleteAttached(&$obj) |
513 | 513 | { |
514 | 514 | $document_srl = $obj->document_srl; |
515 | - if(!$document_srl) return new Object(); |
|
515 | + if (!$document_srl) return new Object(); |
|
516 | 516 | |
517 | 517 | $output = $this->deleteFiles($document_srl); |
518 | 518 | return $output; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | function triggerCommentCheckAttached(&$obj) |
528 | 528 | { |
529 | 529 | $comment_srl = $obj->comment_srl; |
530 | - if(!$comment_srl) return new Object(); |
|
530 | + if (!$comment_srl) return new Object(); |
|
531 | 531 | // Get numbers of attachments |
532 | 532 | $oFileModel = getModel('file'); |
533 | 533 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -545,10 +545,10 @@ discard block |
||
545 | 545 | { |
546 | 546 | $comment_srl = $obj->comment_srl; |
547 | 547 | $uploaded_count = $obj->uploaded_count; |
548 | - if(!$comment_srl || !$uploaded_count) return new Object(); |
|
548 | + if (!$comment_srl || !$uploaded_count) return new Object(); |
|
549 | 549 | |
550 | 550 | $output = $this->setFilesValid($comment_srl); |
551 | - if(!$output->toBool()) return $output; |
|
551 | + if (!$output->toBool()) return $output; |
|
552 | 552 | |
553 | 553 | return new Object(); |
554 | 554 | } |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | function triggerCommentDeleteAttached(&$obj) |
563 | 563 | { |
564 | 564 | $comment_srl = $obj->comment_srl; |
565 | - if(!$comment_srl) return new Object(); |
|
565 | + if (!$comment_srl) return new Object(); |
|
566 | 566 | |
567 | - if($obj->isMoveToTrash) return new Object(); |
|
567 | + if ($obj->isMoveToTrash) return new Object(); |
|
568 | 568 | |
569 | 569 | $output = $this->deleteFiles($comment_srl); |
570 | 570 | return $output; |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | function triggerDeleteModuleFiles(&$obj) |
580 | 580 | { |
581 | 581 | $module_srl = $obj->module_srl; |
582 | - if(!$module_srl) return new Object(); |
|
582 | + if (!$module_srl) return new Object(); |
|
583 | 583 | |
584 | 584 | $oFileController = getAdminController('file'); |
585 | 585 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | * @param int $upload_target_srl |
593 | 593 | * @return void |
594 | 594 | */ |
595 | - function setUploadInfo($editor_sequence, $upload_target_srl=0) |
|
595 | + function setUploadInfo($editor_sequence, $upload_target_srl = 0) |
|
596 | 596 | { |
597 | - if(!isset($_SESSION['upload_info'][$editor_sequence])) |
|
597 | + if (!isset($_SESSION['upload_info'][$editor_sequence])) |
|
598 | 598 | { |
599 | 599 | $_SESSION['upload_info'][$editor_sequence] = new stdClass(); |
600 | 600 | } |
@@ -654,36 +654,36 @@ discard block |
||
654 | 654 | $trigger_obj->module_srl = $module_srl; |
655 | 655 | $trigger_obj->upload_target_srl = $upload_target_srl; |
656 | 656 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
657 | - if(!$output->toBool()) return $output; |
|
657 | + if (!$output->toBool()) return $output; |
|
658 | 658 | |
659 | 659 | // A workaround for Firefox upload bug |
660 | - if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
660 | + if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
661 | 661 | { |
662 | 662 | $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); |
663 | 663 | } |
664 | 664 | |
665 | - if(!$manual_insert) |
|
665 | + if (!$manual_insert) |
|
666 | 666 | { |
667 | 667 | // Get the file configurations |
668 | 668 | $logged_info = Context::get('logged_info'); |
669 | - if($logged_info->is_admin != 'Y') |
|
669 | + if ($logged_info->is_admin != 'Y') |
|
670 | 670 | { |
671 | 671 | $oFileModel = getModel('file'); |
672 | 672 | $config = $oFileModel->getFileConfig($module_srl); |
673 | 673 | |
674 | 674 | // check file type |
675 | - if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
675 | + if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
676 | 676 | { |
677 | 677 | $filetypes = explode(';', $config->allowed_filetypes); |
678 | 678 | $ext = array(); |
679 | - foreach($filetypes as $item) { |
|
679 | + foreach ($filetypes as $item) { |
|
680 | 680 | $item = explode('.', $item); |
681 | 681 | $ext[] = strtolower($item[1]); |
682 | 682 | } |
683 | 683 | $uploaded_ext = explode('.', $file_info['name']); |
684 | 684 | $uploaded_ext = strtolower(array_pop($uploaded_ext)); |
685 | 685 | |
686 | - if(!in_array($uploaded_ext, $ext)) |
|
686 | + if (!in_array($uploaded_ext, $ext)) |
|
687 | 687 | { |
688 | 688 | return $this->stop('msg_not_allowed_filetype'); |
689 | 689 | } |
@@ -692,63 +692,63 @@ discard block |
||
692 | 692 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
693 | 693 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
694 | 694 | // An error appears if file size exceeds a limit |
695 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
695 | + if ($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
696 | 696 | // Get total file size of all attachements (from DB) |
697 | 697 | $size_args = new stdClass; |
698 | 698 | $size_args->upload_target_srl = $upload_target_srl; |
699 | 699 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
700 | - $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
|
701 | - if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
700 | + $attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']); |
|
701 | + if ($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
705 | 705 | // https://github.com/xpressengine/xe-core/issues/1713 |
706 | - $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); |
|
706 | + $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); |
|
707 | 707 | $file_info['name'] = removeHackTag($file_info['name']); |
708 | - $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); |
|
708 | + $file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); |
|
709 | 709 | |
710 | 710 | // Get random number generator |
711 | 711 | $random = new Password(); |
712 | 712 | |
713 | 713 | // Set upload path by checking if the attachement is an image or other kinds of file |
714 | - 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'])) |
|
714 | + 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'])) |
|
715 | 715 | { |
716 | - $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
|
716 | + $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
717 | 717 | |
718 | 718 | // special character to '_' |
719 | 719 | // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter |
720 | - $ext = substr(strrchr($file_info['name'],'.'),1); |
|
720 | + $ext = substr(strrchr($file_info['name'], '.'), 1); |
|
721 | 721 | //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); |
722 | 722 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
723 | 723 | $filename = $path.$_filename; |
724 | 724 | $idx = 1; |
725 | - while(file_exists($filename)) |
|
725 | + while (file_exists($filename)) |
|
726 | 726 | { |
727 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename); |
|
727 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
728 | 728 | $idx++; |
729 | 729 | } |
730 | 730 | $direct_download = 'Y'; |
731 | 731 | } |
732 | 732 | else |
733 | 733 | { |
734 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
734 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
735 | 735 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
736 | 736 | $direct_download = 'N'; |
737 | 737 | } |
738 | 738 | // Create a directory |
739 | - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); |
|
739 | + if (!FileHandler::makeDir($path)) return new Object(-1, 'msg_not_permitted_create'); |
|
740 | 740 | |
741 | 741 | // Check uploaded file |
742 | - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error'); |
|
742 | + if (!checkUploadedFile($file_info['tmp_name'])) return new Object(-1, 'msg_file_upload_error'); |
|
743 | 743 | |
744 | 744 | // Get random number generator |
745 | 745 | $random = new Password(); |
746 | 746 | |
747 | 747 | // Move the file |
748 | - if($manual_insert) |
|
748 | + if ($manual_insert) |
|
749 | 749 | { |
750 | 750 | @copy($file_info['tmp_name'], $filename); |
751 | - if(!file_exists($filename)) |
|
751 | + if (!file_exists($filename)) |
|
752 | 752 | { |
753 | 753 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
754 | 754 | @copy($file_info['tmp_name'], $filename); |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | } |
757 | 757 | else |
758 | 758 | { |
759 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
759 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
760 | 760 | { |
761 | 761 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
762 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); |
|
762 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1, 'msg_file_upload_error'); |
|
763 | 763 | } |
764 | 764 | } |
765 | 765 | // Get member information |
@@ -780,10 +780,10 @@ discard block |
||
780 | 780 | $args->sid = $random->createSecureSalt(32, 'hex'); |
781 | 781 | |
782 | 782 | $output = executeQuery('file.insertFile', $args); |
783 | - if(!$output->toBool()) return $output; |
|
783 | + if (!$output->toBool()) return $output; |
|
784 | 784 | // Call a trigger (after) |
785 | 785 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
786 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
786 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
787 | 787 | |
788 | 788 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
789 | 789 | |
@@ -826,18 +826,18 @@ discard block |
||
826 | 826 | */ |
827 | 827 | function deleteFile($file_srl) |
828 | 828 | { |
829 | - if(!$file_srl) return; |
|
829 | + if (!$file_srl) return; |
|
830 | 830 | |
831 | 831 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
832 | - if(!count($srls)) return; |
|
832 | + if (!count($srls)) return; |
|
833 | 833 | |
834 | 834 | $oDocumentController = getController('document'); |
835 | 835 | $documentSrlList = array(); |
836 | 836 | |
837 | - foreach($srls as $srl) |
|
837 | + foreach ($srls as $srl) |
|
838 | 838 | { |
839 | - $srl = (int)$srl; |
|
840 | - if(!$srl) |
|
839 | + $srl = (int) $srl; |
|
840 | + if (!$srl) |
|
841 | 841 | { |
842 | 842 | continue; |
843 | 843 | } |
@@ -846,14 +846,14 @@ discard block |
||
846 | 846 | $args->file_srl = $srl; |
847 | 847 | $output = executeQuery('file.getFile', $args); |
848 | 848 | |
849 | - if(!$output->toBool() || !$output->data) |
|
849 | + if (!$output->toBool() || !$output->data) |
|
850 | 850 | { |
851 | 851 | continue; |
852 | 852 | } |
853 | 853 | |
854 | 854 | $file_info = $output->data; |
855 | 855 | |
856 | - if($file_info->upload_target_srl) |
|
856 | + if ($file_info->upload_target_srl) |
|
857 | 857 | { |
858 | 858 | $documentSrlList[] = $file_info->upload_target_srl; |
859 | 859 | } |
@@ -864,15 +864,15 @@ discard block |
||
864 | 864 | // Call a trigger (before) |
865 | 865 | $trigger_obj = $output->data; |
866 | 866 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
867 | - if(!$output->toBool()) return $output; |
|
867 | + if (!$output->toBool()) return $output; |
|
868 | 868 | |
869 | 869 | // Remove from the DB |
870 | 870 | $output = executeQuery('file.deleteFile', $args); |
871 | - if(!$output->toBool()) return $output; |
|
871 | + if (!$output->toBool()) return $output; |
|
872 | 872 | |
873 | 873 | // Call a trigger (after) |
874 | 874 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
875 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
875 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
876 | 876 | |
877 | 877 | // If successfully deleted, remove the file |
878 | 878 | FileHandler::removeFile($uploaded_filename); |
@@ -896,28 +896,28 @@ discard block |
||
896 | 896 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
897 | 897 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
898 | 898 | // Success returned if no attachement exists |
899 | - if(!is_array($file_list)||!count($file_list)) return new Object(); |
|
899 | + if (!is_array($file_list) || !count($file_list)) return new Object(); |
|
900 | 900 | |
901 | 901 | // Delete the file |
902 | 902 | $path = array(); |
903 | 903 | $file_count = count($file_list); |
904 | - for($i=0;$i<$file_count;$i++) |
|
904 | + for ($i = 0; $i < $file_count; $i++) |
|
905 | 905 | { |
906 | 906 | $this->deleteFile($file_list[$i]->file_srl); |
907 | 907 | |
908 | 908 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
909 | 909 | $path_info = pathinfo($uploaded_filename); |
910 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
910 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | // Remove from the DB |
914 | 914 | $args = new stdClass(); |
915 | 915 | $args->upload_target_srl = $upload_target_srl; |
916 | 916 | $output = executeQuery('file.deleteFiles', $args); |
917 | - if(!$output->toBool()) return $output; |
|
917 | + if (!$output->toBool()) return $output; |
|
918 | 918 | |
919 | 919 | // Remove a file directory of the document |
920 | - for($i=0, $c=count($path); $i<$c; $i++) |
|
920 | + for ($i = 0, $c = count($path); $i < $c; $i++) |
|
921 | 921 | { |
922 | 922 | FileHandler::removeBlankDir($path[$i]); |
923 | 923 | } |
@@ -935,23 +935,23 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function moveFile($source_srl, $target_module_srl, $target_srl) |
937 | 937 | { |
938 | - if($source_srl == $target_srl) return; |
|
938 | + if ($source_srl == $target_srl) return; |
|
939 | 939 | |
940 | 940 | $oFileModel = getModel('file'); |
941 | 941 | $file_list = $oFileModel->getFiles($source_srl); |
942 | - if(!$file_list) return; |
|
942 | + if (!$file_list) return; |
|
943 | 943 | |
944 | 944 | $file_count = count($file_list); |
945 | 945 | |
946 | - for($i=0;$i<$file_count;$i++) |
|
946 | + for ($i = 0; $i < $file_count; $i++) |
|
947 | 947 | { |
948 | 948 | unset($file_info); |
949 | 949 | $file_info = $file_list[$i]; |
950 | 950 | $old_file = $file_info->uploaded_filename; |
951 | 951 | // Determine the file path by checking if the file is an image or other kinds |
952 | - if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
952 | + if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
953 | 953 | { |
954 | - $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
|
954 | + $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl); |
|
955 | 955 | $new_file = $path.$file_info->source_filename; |
956 | 956 | } |
957 | 957 | else |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
962 | 962 | } |
963 | 963 | // Pass if a target document to move is same |
964 | - if($old_file == $new_file) continue; |
|
964 | + if ($old_file == $new_file) continue; |
|
965 | 965 | // Create a directory |
966 | 966 | FileHandler::makeDir($path); |
967 | 967 | // Move the file |
@@ -981,18 +981,18 @@ discard block |
||
981 | 981 | $vars = Context::getRequestVars(); |
982 | 982 | $logged_info = Context::get('logged_info'); |
983 | 983 | |
984 | - if(!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
984 | + if (!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
985 | 985 | |
986 | 986 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
987 | 987 | |
988 | 988 | $oFileModel = getModel('file'); |
989 | 989 | $file_info = $oFileModel->getFile($vars->file_srl); |
990 | 990 | |
991 | - if(!$file_info) return new Object(-1, 'msg_not_founded'); |
|
991 | + if (!$file_info) return new Object(-1, 'msg_not_founded'); |
|
992 | 992 | |
993 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
993 | + if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
994 | 994 | |
995 | - $args = new stdClass(); |
|
995 | + $args = new stdClass(); |
|
996 | 996 | $args->file_srl = $vars->file_srl; |
997 | 997 | $args->upload_target_srl = $upload_target_srl; |
998 | 998 | |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | |
1002 | 1002 | $args->cover_image = 'N'; |
1003 | 1003 | $output = executeQuery('file.updateClearCoverImage', $args); |
1004 | - if(!$output->toBool()) |
|
1004 | + if (!$output->toBool()) |
|
1005 | 1005 | { |
1006 | 1006 | $oDB->rollback(); |
1007 | 1007 | return $output; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if($file_info->cover_image != 'Y') |
|
1010 | + if ($file_info->cover_image != 'Y') |
|
1011 | 1011 | { |
1012 | 1012 | |
1013 | 1013 | $args->cover_image = 'Y'; |
1014 | 1014 | $output = executeQuery('file.updateCoverImage', $args); |
1015 | - if(!$output->toBool()) |
|
1015 | + if (!$output->toBool()) |
|
1016 | 1016 | { |
1017 | 1017 | $oDB->rollback(); |
1018 | 1018 | return $output; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | |
1023 | 1023 | $oDB->commit(); |
1024 | 1024 | |
1025 | - $this->add('is_cover',$args->cover_image); |
|
1025 | + $this->add('is_cover', $args->cover_image); |
|
1026 | 1026 | |
1027 | 1027 | // 썸네일 삭제 |
1028 | 1028 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3)); |
@@ -1048,9 +1048,9 @@ discard block |
||
1048 | 1048 | $fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl); |
1049 | 1049 | |
1050 | 1050 | $oModuleController = getController('module'); |
1051 | - if(is_array($obj->moduleSrlList)) |
|
1051 | + if (is_array($obj->moduleSrlList)) |
|
1052 | 1052 | { |
1053 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
1053 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
1054 | 1054 | { |
1055 | 1055 | $oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig); |
1056 | 1056 | } |