From 97bbc1bef0cc7013f95740eea1dd50719d8ee3f4 Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Thu, 15 Jun 2017 09:46:13 +0800 Subject: [PATCH] * Merge file upload allowed --- config/config.php | 5 +---- module/file/model.php | 13 +------------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/config/config.php b/config/config.php index f110355243..b37243cc49 100644 --- a/config/config.php +++ b/config/config.php @@ -90,7 +90,7 @@ $config->db->persistant = false; // Pconnect or not. $config->db->driver = 'mysql'; // Must be MySQL. Don't support other database server yet. $config->db->encoding = 'UTF8'; // Encoding of database. $config->db->strictMode = false; // Turn off the strict mode of MySQL. -$config->db->prefix = ''; // 数据库表名前缀。 The prefix of the table name. +$config->db->prefix = 'zt_'; // 数据库表名前缀。 The prefix of the table name. $config->slaveDB->persistant = false; $config->slaveDB->driver = 'mysql'; $config->slaveDB->encoding = 'UTF8'; @@ -148,9 +148,6 @@ $config->filterParam->cookie['common']['device']['reg'] = '/^[a-zA-Z0-9_]+$/'; $config->filterParam->cookie['common']['za']['account'] = ''; $config->filterParam->cookie['common']['zp']['reg'] = '/^[a-f0-9]{40}$/'; -/* Set default table prefix. */ -if(!isset($config->db->prefix)) $config->db->prefix = 'zt_'; - /* Define the tables. */ define('TABLE_COMPANY', '`' . $config->db->prefix . 'company`'); define('TABLE_DEPT', '`' . $config->db->prefix . 'dept`'); diff --git a/module/file/model.php b/module/file/model.php index f972a4f3dc..186aa6692a 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -153,12 +153,6 @@ class fileModel extends model $file['title'] = $purifier->purify($file['title']); $file['size'] = $size[$id]; $file['tmpname'] = $tmp_name[$id]; - - if(stripos($this->config->file->allowed, ',' . $file['extension'] . ',') === false) - { - $file['pathname'] = $file['pathname'] . '.notAllowed'; - } - $files[] = $file; } } @@ -174,12 +168,6 @@ class fileModel extends model $file['title'] = $purifier->purify($file['title']); $file['size'] = $size; $file['tmpname'] = $tmp_name; - - if(stripos($this->config->file->allowed, ',' . $file['extension'] . ',') === false) - { - $file['pathname'] = $file['pathname'] . '.notAllowed'; - } - return array($file); } return $files; @@ -304,6 +292,7 @@ class fileModel extends model { $extension = trim(strtolower(pathinfo($filename, PATHINFO_EXTENSION))); if(empty($extension) or stripos(",{$this->config->file->dangers},", ",{$extension},") !== false) return 'txt'; + if(empty($extension) or stripos(",{$this->config->file->allowed},", ",{$extension},") === false) return 'txt'; if($extension == 'php') return 'txt'; return $extension; }