From 7a69d802699bc2e41b64b0397932f9a00b03ced2 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 1 Dec 2020 08:52:41 +0800 Subject: [PATCH 1/2] * Adjust code style. --- module/project/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/model.php b/module/project/model.php index b1b85e09f8..4af90adbb6 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -806,7 +806,7 @@ class projectModel extends model ->andWhere('t2.deleted')->eq(0) ->fetch('total'); - if($type == 'create') $percentTotal = $percent + $oldPercentTotal; + if($type == 'create') $percentTotal = $percent + $oldPercentTotal; if($oldProject->grade == 1) $percentTotal = $oldPercentTotal - $oldProject->percent + $this->post->percent; if($percentTotal >100) From e10897a838189ef12acafca41f3b8c3f74e32372 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 1 Dec 2020 09:03:13 +0800 Subject: [PATCH 2/2] * fix bug. --- lib/base/filter/filter.class.php | 4 +-- module/build/model.php | 28 ++++++++++++++----- module/extension/control.php | 10 +++++-- module/file/model.php | 2 ++ module/install/control.php | 5 ++-- module/projectbuild/control.php | 2 +- module/user/lang/de.php | 1 + module/user/lang/en.php | 1 + module/user/lang/fr.php | 1 + module/user/lang/vi.php | 1 + module/user/lang/zh-cn.php | 1 + module/user/view/create.html.php | 2 ++ module/user/view/login.html.php | 46 ++++++++++++++++++++++++++++++++ 13 files changed, 91 insertions(+), 13 deletions(-) diff --git a/lib/base/filter/filter.class.php b/lib/base/filter/filter.class.php index c748063809..f572e20fc7 100644 --- a/lib/base/filter/filter.class.php +++ b/lib/base/filter/filter.class.php @@ -951,7 +951,7 @@ class baseFixer public function cleanFloat($fieldName) { $fields = $this->processFields($fieldName); - foreach($fields as $fieldName) $this->data->$fieldName = filter_var($this->data->$fieldName, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION|FILTER_FLAG_ALLOW_THOUSAND); + foreach($fields as $fieldName) $this->data->$fieldName = (float)filter_var($this->data->$fieldName, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION|FILTER_FLAG_ALLOW_THOUSAND); return $this; } @@ -971,7 +971,7 @@ class baseFixer $filterVar = filter_var($this->data->$fieldName, FILTER_SANITIZE_NUMBER_INT); if(empty($filterVar)) $filterVar = 0; - $this->data->$fieldName = $filterVar; + $this->data->$fieldName = (int)$filterVar; } return $this; } diff --git a/module/build/model.php b/module/build/model.php index 9d522b64d3..5b24acd96f 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -134,10 +134,10 @@ class buildModel extends model public function getProjectBuildsBySearch($projectID, $queryID) { /* If there are saved query conditions, reset the session. */ - if($queryID) + if((int)$queryID) { - $query = $this->loadModel('search')->getQuery($queryID); - if($query) + $buildQuery = $this->loadModel('search')->getQuery($queryID); + if($buildQuery) { $this->session->set('projectBuildQuery', $query->sql); $this->session->set('projectBuildForm', $query->form); @@ -147,6 +147,12 @@ class buildModel extends model $this->session->set('projectBuildQuery', ' 1 = 1'); } } + else + { + if($this->session->projectBuildQuery == false) $this->session->set('projectBuildQuery', ' 1 = 1'); + } + + $buildQuery = $this->session->projectBuildQuery; /* Distinguish between repeated fields. */ $fields = array('id' => '`id`', 'name' => '`name`', 'product' => '`product`', 'desc' => '`desc`'); @@ -196,15 +202,25 @@ class buildModel extends model public function getExecutionBuildsBySearch($executionID, $queryID) { /* If there are saved query conditions, reset the session. */ - if($queryID) + if((int)$queryID) { - $query = $this->loadModel('search')->getQuery($queryID); - if($query) + $buildQuery = $this->loadModel('search')->getQuery($queryID); + if($buildQuery) { $this->session->set('projectBuildQuery', $query->sql); $this->session->set('projectBuildForm', $query->form); } + else + { + $this->session->set('projectBuildQuery', ' 1 = 1'); + } } + else + { + if($this->session->projectBuildQuery == false) $this->session->set('projectBuildQuery', ' 1 = 1'); + } + + $buildQuery = $this->session->projectBuildQuery; /* Distinguish between repeated fields. */ $fields = array('id' => '`id`', 'name' => '`name`', 'product' => '`product`', 'desc' => '`desc`'); diff --git a/module/extension/control.php b/module/extension/control.php index 67d8a9cd4a..17df862c22 100644 --- a/module/extension/control.php +++ b/module/extension/control.php @@ -463,10 +463,16 @@ class extension extends control $tmpName = $_FILES['file']['tmp_name']; $fileName = $_FILES['file']['name']; - move_uploaded_file($tmpName, $this->app->getTmpRoot() . "/extension/$fileName"); + $dest = $this->app->getTmpRoot() . "/extension/$fileName"; + move_uploaded_file($tmpName, $dest); + $extension = basename($fileName, '.zip'); $return = $this->extension->extractPackage($extension); - if($return->result != 'ok') die(js::alert(str_replace("'", "\'", sprintf($this->lang->extension->errorExtracted, $fileName, $return->error)))); + if($return->result != 'ok') + { + unlink($dest); + die(js::alert(str_replace("'", "\'", sprintf($this->lang->extension->errorExtracted, $fileName, $return->error)))); + } $info = $this->extension->parseExtensionCFG($extension); if(isset($info->code) and $info->code != $extension) diff --git a/module/file/model.php b/module/file/model.php index f8cfdf7a3f..2f041f04b2 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -300,6 +300,8 @@ class fileModel extends model public function getExtension($filename) { $extension = trim(strtolower(pathinfo($filename, PATHINFO_EXTENSION))); + if($extension and strpos($extension, '::') !== false) $extension = substr($extension, 0, strpos($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'; diff --git a/module/install/control.php b/module/install/control.php index 8ede07bb17..42dbcb6116 100644 --- a/module/install/control.php +++ b/module/install/control.php @@ -127,6 +127,9 @@ class install extends control { if(!session_save_path()) { + /* Restart the session because the session save path is null when start the session last time. */ + session_write_close(); + $tmpRootInfo = $this->install->getTmpRoot(); $sessionSavePath = $tmpRootInfo['path'] . 'session'; if(!is_dir($sessionSavePath)) mkdir($sessionSavePath, 0777, true); @@ -137,8 +140,6 @@ class install extends control $sessionResult = $this->install->checkSessionSavePath(); if($sessionResult == 'fail') chmod($sessionSavePath, 0777); - /* Restart the session because the session save path is null when start the session last time. */ - session_write_close(); session_start(); $this->session->set('installing', true); } diff --git a/module/projectbuild/control.php b/module/projectbuild/control.php index 1955ea762d..0e96d382db 100644 --- a/module/projectbuild/control.php +++ b/module/projectbuild/control.php @@ -18,7 +18,7 @@ class projectBuild extends control if($type == 'bysearch') { - $builds = $this->loadModel('build')->getProjectBuildsBySearch((int)$projectID, $param); + $builds = $this->loadModel('build')->getProjectBuildsBySearch((int)$projectID, (int)$param); } else { diff --git a/module/user/lang/de.php b/module/user/lang/de.php index ea022d295d..93926ede1f 100644 --- a/module/user/lang/de.php +++ b/module/user/lang/de.php @@ -218,3 +218,4 @@ $lang->user->noticeResetFile = "
Kontaktieren Sie den Administrator um Ihr Pa
  • Die Datei muss leer sein.
  • Wenn die Datei bereits existiert löschen Sie diese und erstellen Sie eine neue.
  • "; +$lang->user->notice4Safe = "It is detected that you may be using the one click installation package environment, and other sites in the environment are still using a simple password. For security, please change the password in time. Login address of other sites:
    %s"; diff --git a/module/user/lang/en.php b/module/user/lang/en.php index 641236d0de..026e72efc9 100644 --- a/module/user/lang/en.php +++ b/module/user/lang/en.php @@ -218,3 +218,4 @@ $lang->user->noticeResetFile = "
    Contact the Administrator to reset your pass
  • Keep the file empty.
  • If the file exists, remove it and create it again.
  • "; +$lang->user->notice4Safe = "It is detected that you may be using the one click installation package environment, and other sites in the environment are still using a simple password. For security, please change the password in time. Login address of other sites:
    %s"; diff --git a/module/user/lang/fr.php b/module/user/lang/fr.php index e15ec39d9b..0be8e541e9 100644 --- a/module/user/lang/fr.php +++ b/module/user/lang/fr.php @@ -218,3 +218,4 @@ $lang->user->noticeResetFile = "
    Contactez l'administrateur pour réinitialis
  • Gardez ce fichier vide.
  • Si le fichier existe déjà, supprimez le et créez le à nouveau.
  • Bonne chance.
  • "; +$lang->user->notice4Safe = "It is detected that you may be using the one click installation package environment, and other sites in the environment are still using a simple password. For security, please change the password in time. Login address of other sites:
    %s"; diff --git a/module/user/lang/vi.php b/module/user/lang/vi.php index 885eb9a7a1..a80ec1a6d5 100644 --- a/module/user/lang/vi.php +++ b/module/user/lang/vi.php @@ -218,3 +218,4 @@ $lang->user->noticeResetFile = "
    Liên hệ quản trị viên để thiết
  • Giữ tập tin này rỗng.
  • Nếu tập tin đã tồn tại, xóa và tạo lại.
  • "; +$lang->user->notice4Safe = "It is detected that you may be using the one click installation package environment, and other sites in the environment are still using a simple password. For security, please change the password in time. Login address of other sites:
    %s"; diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index d97ba6c1b8..ac32efa643 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -218,3 +218,4 @@ $lang->user->noticeResetFile = "
    普通用户请联系管理员重置密码文件内容为空。
  • 如果之前文件存在,删除之后重新创建。
  • "; +$lang->user->notice4Safe = "检测到您可能在使用一键安装包环境,该环境中其他站点还在用简单密码,安全起见,请及时修改密码。其他站点的登录地址:
    %s"; diff --git a/module/user/view/create.html.php b/module/user/view/create.html.php index b4ae529524..2ca2e2143e 100644 --- a/module/user/view/create.html.php +++ b/module/user/view/create.html.php @@ -60,11 +60,13 @@ user->roleList, '', "class='form-control' onchange='changeGroup(this.value)'");?> user->placeholder->role?> + user->group;?> user->placeholder->group?> + user->email;?> diff --git a/module/user/view/login.html.php b/module/user/view/login.html.php index c160b0519a..099833225e 100644 --- a/module/user/view/login.html.php +++ b/module/user/view/login.html.php @@ -89,4 +89,50 @@ if(empty($config->notMd5Pwd))js::import($jsRoot . 'md5.js'); +config->webRoot}|") !== false) +{ + $databases = array('zentao' => 'zentao', 'zentaopro' => 'zentaopro', 'zentaobiz' => 'zentaobiz', 'zentaoep' => 'zentaoep'); + if($this->config->webRoot == '/zentao/') unset($databases['zentao']); + if($this->config->webRoot == '/pro/') unset($databases['zentaopro']); + if($this->config->webRoot == '/biz/') + { + unset($databases['zentaobiz']); + unset($databases['zentaoep']); + } + + $users = array(); + foreach($databases as $database) + { + try + { + $webRoot = "/{$database}/"; + if($database == 'zentao') $webRoot = '/zentao/'; + if($database == 'zentaopro') $webRoot = '/pro/'; + if($database == 'zentaobiz') $webRoot = '/biz/'; + if($database == 'zentaoep') $webRoot = '/biz/'; + + $users[$webRoot] = $this->dbh->query("select * from {$database}.`zt_user` where account = 'admin' and password='" . md5('123456') . "'")->fetch(); + } + catch(Exception $e){} + } + + if($users) + { + $sysURL = common::getSysURL(); + $links = array(); + foreach($users as $webRoot => $user) $links[] = $sysURL . $webRoot; + + $notice = sprintf($lang->user->notice4Safe, join('
    ', $links)); + echo << +\$(function() +{ + bootbox.alert('$notice'); +}) + +EOD; + } +} +?>