mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
- 아래에 이미 author 언급이 있으므로 중복되는 저작권 표기는 제거 - 클래스 하단에 불필요한 end of file 표시 제거 (파일 하나에 클래스 하나씩이므로 파일이 중간에 끊겼다면 클래스가 닫히지 않아 쉽게 알 수 있음)
29 lines
642 B
PHP
29 lines
642 B
PHP
<?php
|
|
|
|
class UploadFileFilter
|
|
{
|
|
/**
|
|
* Generic checker
|
|
*
|
|
* @param string $file
|
|
* @param string $filename
|
|
* @return bool
|
|
*/
|
|
public static function check($file, $filename = null)
|
|
{
|
|
// Return error if the file is not uploaded.
|
|
if (!$file || !file_exists($file) || !is_uploaded_file($file))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// Don't check partial uploads (chunks).
|
|
if (Context::get('act') === 'procFileUpload' && preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE']))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Call Rhymix framework filter.
|
|
return Rhymix\Framework\Filters\FileContentFilter::check($file, $filename);
|
|
}
|
|
}
|