php8.0 버전 호환 코드 적용 및 PHP 끝 태그 삭제 일괄적용

This commit is contained in:
thisgun
2021-01-04 15:33:29 +09:00
parent 10d377de7d
commit 582d1a01f4
852 changed files with 120617 additions and 6307 deletions

View File

@ -160,5 +160,4 @@ if(!function_exists('ft_nonce_generate_hash')){
}
return $o;
}
}
?>
}

View File

@ -1,3 +1,2 @@
<?php
include_once("../../../../common.php");
?>
include_once("../../../../common.php");

View File

@ -67,7 +67,4 @@ function che_replace_filename($filename){
$file_arr = explode('_', $filename);
return $file_arr[0].'_'.$passname.'_'.$random_str.'.'.$ext;
}
// ---------------------------------------------------------------------------
?>
}

View File

@ -48,6 +48,4 @@ if (file_exists($filepath)) {
}
}
echo $r ? true : false;
?>
echo $r ? true : false;

View File

@ -129,5 +129,4 @@ $rdata = sprintf('{"fileUrl": "%s", "filePath": "%s", "fileName": "%s", "fileSiz
$filename,
$filesize );
echo $rdata;
?>
echo $rdata;

View File

@ -168,5 +168,4 @@ if(!function_exists('ft_nonce_generate_hash')){
}
return $o;
}
}
?>
}

View File

@ -1,3 +1,2 @@
<?php
include_once("../../../../../common.php");
?>
include_once("../../../../../common.php");

View File

@ -169,7 +169,7 @@ class Services_JSON
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
case ((0x7F & $bytes) == $bytes):
@ -222,17 +222,17 @@ class Services_JSON
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8[1])));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8[2])));
}
// ignoring UTF-32 for now, sorry
@ -454,7 +454,7 @@ class Services_JSON
*/
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
if (is_array($var) && count($var) && (array_keys($var) !== range(0, count($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));

View File

@ -185,7 +185,7 @@ class UploadHandler
$this->head();
break;
case 'GET':
if( $_GET['del'] ){
if( isset($_GET['del']) && $_GET['del'] ){
$this->delete();
} else {
$this->get();
@ -367,16 +367,19 @@ class UploadHandler
function get_config_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
$val_strlen = strlen($val)-1;
$last = isset($val[$val_strlen]) ? strtolower($val[$val_strlen]) : '';
$bytes = (int) preg_replace('/[^0-9]/', '', $val);
switch($last) {
case 'g':
$val *= 1024;
$bytes *= 1024;
case 'm':
$val *= 1024;
$bytes *= 1024;
case 'k':
$val *= 1024;
$bytes *= 1024;
}
return $this->fix_integer_overflow($val);
return $this->fix_integer_overflow($bytes);
}
protected function validate($uploaded_file, $file, $error, $index) {
@ -466,13 +469,14 @@ class UploadHandler
);
}
protected function get_unique_filename($file_path, $name, $size, $type, $error,
$index, $content_range) {
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range) {
while(is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
$content_range_byte = isset($content_range[1]) ? (int) $content_range[1] : 0;
// Keep an existing filename if this is part of a chunked upload:
$uploaded_bytes = $this->fix_integer_overflow(intval($content_range[1]));
$uploaded_bytes = $this->fix_integer_overflow($content_range_byte);
while(is_file($this->get_upload_path($name))) {
if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) {
@ -483,8 +487,7 @@ class UploadHandler
return $name;
}
protected function trim_file_name($file_path, $name, $size, $type, $error,
$index, $content_range) {
protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
// Remove path information and dots around the filename, to prevent uploading
// into different directories or replacing hidden system files.
// Also remove control characters and spaces (\x00..\x20) around the filename:
@ -498,7 +501,7 @@ class UploadHandler
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
$name .= '.'.$matches[1];
}
if (function_exists('exif_imagetype')) {
if (function_exists('exif_imagetype') && $file_path) {
switch(@exif_imagetype($file_path)){
case IMAGETYPE_JPEG:
$extensions = array('jpg', 'jpeg');
@ -524,12 +527,10 @@ class UploadHandler
return $name;
}
protected function get_file_name($file_path, $name, $size, $type, $error,
$index, $content_range) {
protected function get_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
return $this->get_unique_filename(
$file_path,
$this->trim_file_name($file_path, $name, $size, $type, $error,
$index, $content_range),
$this->trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range),
$size,
$type,
$error,
@ -1066,6 +1067,8 @@ class UploadHandler
protected function reprocessImage($file_path, $callback)
{
if( ! $file_path ) return;
// Extracting mime type using getimagesize
try {
$image_info = getimagesize($file_path);
@ -1106,11 +1109,9 @@ class UploadHandler
return true;
}
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
$index = null, $content_range = null) {
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) {
$file = new \stdClass();
$file->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error,
$index, $content_range);
$file->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
$filename_ext = pathinfo($name, PATHINFO_EXTENSION);
$file->name = $this->get_file_passname().'_'.str_replace(".", "_", $this->get_microtime()).".".$filename_ext;

View File

@ -1,3 +1,2 @@
<?php
include_once("../../../../../../common.php");
?>
include_once("../../../../../../common.php");

View File

@ -10,9 +10,9 @@
* http://www.opensource.org/licenses/MIT
*/
include_once("./_common.php");
@include_once("./JSON.php");
if( !function_exists('json_encode') ) {
@include_once("./JSON.php");
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );