From 4f7c5168dce9b5bdc4aabb0c99f484312c9b6e09 Mon Sep 17 00:00:00 2001 From: star7th Date: Tue, 12 Jan 2021 19:41:15 +0800 Subject: [PATCH] =?UTF-8?q?Compatible=20with=20php8=20/=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9php8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/Controller/AttachmentController.class.php | 2 +- server/Application/Api/Model/CaptchaModel.class.php | 2 +- server/Application/Api/Model/ItemTokenModel.class.php | 2 +- server/Application/Home/Controller/ItemController.class.php | 3 ++- server/ThinkPHP/Common/functions.php | 3 +-- server/ThinkPHP/Library/Think/Template.class.php | 2 +- server/ThinkPHP/Library/Think/Upload.class.php | 6 +++++- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/Application/Api/Controller/AttachmentController.class.php b/server/Application/Api/Controller/AttachmentController.class.php index 390df81ff..eaac202cc 100644 --- a/server/Application/Api/Controller/AttachmentController.class.php +++ b/server/Application/Api/Controller/AttachmentController.class.php @@ -256,7 +256,7 @@ public function getMyList(){ $display_name = I("display_name"); $username = I("username"); $return = array() ; - $where = " uid = '{$login_user[uid]}' "; + $where = " uid = {$login_user['uid']} "; if($attachment_type == 1 ){ $where .=" and file_type like '%image%' " ; } diff --git a/server/Application/Api/Model/CaptchaModel.class.php b/server/Application/Api/Model/CaptchaModel.class.php index 938a8fd44..f04d5a0f0 100644 --- a/server/Application/Api/Model/CaptchaModel.class.php +++ b/server/Application/Api/Model/CaptchaModel.class.php @@ -7,7 +7,7 @@ */ class CaptchaModel extends BaseModel { - public function check($captcha_id , $captcha){ + public function check($captcha_id , $captcha, $none =''){ $time = time() ; $captcha_array = $this->where(" captcha_id = '$captcha_id' and expire_time > $time ")->find(); if ($captcha_array['captcha'] && $captcha_array['captcha'] == $captcha) { diff --git a/server/Application/Api/Model/ItemTokenModel.class.php b/server/Application/Api/Model/ItemTokenModel.class.php index 315233cb2..efba67e75 100644 --- a/server/Application/Api/Model/ItemTokenModel.class.php +++ b/server/Application/Api/Model/ItemTokenModel.class.php @@ -40,7 +40,7 @@ public function setLastTime($item_id){ } //检查token。如果检测通过则返回item_id - public function check($api_key , $api_token){ + public function check($api_key , $api_token, $no = ''){ $ret = $this->getTokenByKey($api_key); if ($ret && $ret['api_token'] == $api_token) { $item_id = $ret['item_id'] ; diff --git a/server/Application/Home/Controller/ItemController.class.php b/server/Application/Home/Controller/ItemController.class.php index 2f43cb7e3..7fb6568a2 100644 --- a/server/Application/Home/Controller/ItemController.class.php +++ b/server/Application/Home/Controller/ItemController.class.php @@ -47,7 +47,8 @@ public function add(){ } //根据项目类型展示项目 - public function show(){ + //这些参数都不需要用到,只是为了兼容父类的方法。php8需要compatible with父类的同名方法 + public function show($content='', $charset = '', $contentType = '', $prefix = ''){ $this->checkLogin(false); $item_id = I("item_id/d"); $item_domain = I("item_domain/s"); diff --git a/server/ThinkPHP/Common/functions.php b/server/ThinkPHP/Common/functions.php index 5c475eb42..6456f80fe 100644 --- a/server/ThinkPHP/Common/functions.php +++ b/server/ThinkPHP/Common/functions.php @@ -399,8 +399,7 @@ function I($name,$default='',$filter=null,$datas=null) { }else{ // 变量默认值 $data = isset($default)?$default:null; } - is_array($data) && array_walk_recursive($data,' - '); + is_array($data) && array_walk_recursive($data,'think_filter'); return $data; } diff --git a/server/ThinkPHP/Library/Think/Template.class.php b/server/ThinkPHP/Library/Think/Template.class.php index c43a97a1b..af6a8232a 100644 --- a/server/ThinkPHP/Library/Think/Template.class.php +++ b/server/ThinkPHP/Library/Think/Template.class.php @@ -663,7 +663,7 @@ public function parseThinkVar($varStr){ * @param array $vars 要传递的变量列表 * @return string */ - private function parseIncludeItem($tmplPublicName,$vars=array(),$extend){ + private function parseIncludeItem($tmplPublicName,$vars=array(),$extend = true ){ // 分析模板文件名并读取内容 $parseStr = $this->parseTemplateName($tmplPublicName); // 替换变量 diff --git a/server/ThinkPHP/Library/Think/Upload.class.php b/server/ThinkPHP/Library/Think/Upload.class.php index 89a04ac5c..446fb7341 100644 --- a/server/ThinkPHP/Library/Think/Upload.class.php +++ b/server/ThinkPHP/Library/Think/Upload.class.php @@ -167,7 +167,11 @@ public function upload($files='') { } /* 调用回调函数检测文件是否存在 */ - $data = call_user_func($this->callback, $file); + if($this->callback){ + $data = call_user_func($this->callback, $file); + }else{ + $data = false; + } if( $this->callback && $data ){ if ( file_exists('.'.$data['path']) ) { $info[$key] = $data;