From 8d26dceb4bbe22a75fb74f055647b09aa12a84d5 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 9 Feb 2023 05:54:15 +0000 Subject: [PATCH] * Compatible with php5.3. --- module/bug/model.php | 2 +- module/common/model.php | 3 ++- module/projectrelease/control.php | 18 +++++++++++++++--- module/task/model.php | 5 +++-- module/testcase/model.php | 3 ++- module/upgrade/model.php | 3 ++- module/zahost/config.php | 2 +- module/zahost/lang/de.php | 4 ++-- module/zahost/lang/en.php | 4 ++-- module/zahost/lang/fr.php | 4 ++-- module/zahost/lang/zh-cn.php | 4 ++-- module/zanode/lang/de.php | 4 ++-- module/zanode/lang/en.php | 4 ++-- module/zanode/lang/fr.php | 4 ++-- module/zanode/lang/zh-cn.php | 4 ++-- 15 files changed, 42 insertions(+), 26 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 920bf987bf..f0133bfb06 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1595,7 +1595,7 @@ class bugModel extends model if($day == $days -1) $startDate = date('Y-m-d', $time) . ' 00:00:00'; } - $dateFields = ['openedDate', 'resolvedDate', 'closedDate']; + $dateFields = array('openedDate', 'resolvedDate', 'closedDate'); $staticData = array(); foreach($dateFields as $field) { diff --git a/module/common/model.php b/module/common/model.php index 6415606104..90d100a3ed 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1038,7 +1038,8 @@ class commonModel extends model { foreach($lang->my->$moduleLinkList as $key => $linkList) { - $method = explode('-', $key)[1]; + $moduleMethodList = explode('-', $key); + $method = $moduleMethodList[1]; if(common::hasPriv($currentModule, $method)) { $display = true; diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index ab9fc56834..553b583da7 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -195,7 +195,11 @@ class projectrelease extends control /* Get release and build. */ $release = $this->projectrelease->getById((int)$releaseID); - if(!$this->session->project) $this->session->set('project', explode(',', $release->project)[0], 'project'); + if(!$this->session->project) + { + $releaseProject = explode(',', $release->project); + $this->session->set('project', $releaseProject[0], 'project'); + } $this->commonAction($this->session->project, $release->product, $release->branch); $bindBuilds = $this->build->getByList($release->build); @@ -554,7 +558,11 @@ class projectrelease extends control $this->session->set('storyList', inlink('view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode("&browseType=$browseType&queryID=$param")), $this->app->tab); $release = $this->projectrelease->getByID($releaseID); - if(!$this->session->project) $this->session->set('project', explode(',', $release->project)[0], 'project'); + if(!$this->session->project) + { + $releaseProject = explode(',', $release->project); + $this->session->set('project', $releaseProject[0], 'project'); + } $builds = $this->loadModel('build')->getByList($release->build); $project = $this->loadModel('project')->getByID($this->session->project); @@ -690,7 +698,11 @@ class projectrelease extends control $this->session->set('bugList', inlink('view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode("&browseType=$browseType&queryID=$param")), 'qa'); /* Set menu. */ $release = $this->projectrelease->getByID($releaseID); - if(!$this->session->project) $this->session->set('project', explode(',', $release->project)[0], 'project'); + if(!$this->session->project) + { + $releaseProject = explode(',', $release->project); + $this->session->set('project', $releaseProject[0], 'project'); + } $builds = $this->loadModel('build')->getByList($release->build); $project = $this->loadModel('project')->getByID($this->session->project); diff --git a/module/task/model.php b/module/task/model.php index 6bc20d4347..cc63b4ccf4 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -3643,6 +3643,7 @@ class taskModel extends model if(!empty($task->team)) { global $app; + $myself = new self(); if($task->mode == 'linear') { if($action == 'assignto' and strpos('done,cencel,closed', $task->status) === false) return false; @@ -3650,14 +3651,14 @@ class taskModel extends model { if($task->assignedTo != $app->user->account) return false; - $currentTeam = (new self())->getTeamByAccount($task->team, $app->user->account); + $currentTeam = $myself->getTeamByAccount($task->team, $app->user->account); if($currentTeam and $currentTeam->status == 'wait') return true; } if($action == 'finish' and $task->assignedTo != $app->user->account) return false; } elseif($task->mode == 'multi') { - $currentTeam = (new self())->getTeamByAccount($task->team, $app->user->account); + $currentTeam = $myself->getTeamByAccount($task->team, $app->user->account); if($action == 'start' and strpos('wait,doing', $task->status) !== false and $currentTeam and $currentTeam->status == 'wait') return true; if($action == 'finish' and (empty($currentTeam) or $currentTeam->status == 'done')) return false; } diff --git a/module/testcase/model.php b/module/testcase/model.php index 8dc0912ad0..1356dc541c 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1840,7 +1840,8 @@ class testcaseModel extends model } else { - $libCaseID = array_keys($libCases[$caseID])[0]; + $libCaseList = array_keys($libCases[$caseID]); + $libCaseID = $libCaseList[0]; $libCase->lastEditedBy = $this->app->user->account; $libCase->lastEditedDate = helper::now(); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index f8106705ab..56fc154ce8 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6332,7 +6332,8 @@ class upgradeModel extends model { $dirPath = dirname($filePath); $dir = str_replace($this->app->appRoot . 'extension' . DS . 'custom' .DS , '', $dirPath); - $moduleName = explode(DS, $dir)[0]; + $dirList = explode(DS, $dir); + $moduleName = $dirList[0]; $content = str_replace("include '../../control.php';", "helper::importControl('$moduleName');", $content); $content = str_replace("helper::import('../../control.php');", "helper::importControl('$moduleName');", $content); diff --git a/module/zahost/config.php b/module/zahost/config.php index bd15e339b9..9e3ce0055d 100644 --- a/module/zahost/config.php +++ b/module/zahost/config.php @@ -10,7 +10,7 @@ $config->zahost->edit->requiredFields = 'name,hostType,cpuCores,memory,diskSize, $config->zahost->imageListUrl = 'https://pkg.qucheng.com/zenagent/list.json'; -$config->zahost->cpuCoreList = [1 => 1, 2 => 2, 4 => 4, 6 => 6, 8 => 8, 10 => 10, 12 => 12, 16 => 16, 24 => 24, 32 => 32, 64 => 64]; +$config->zahost->cpuCoreList = array(1 => 1, 2 => 2, 4 => 4, 6 => 6, 8 => 8, 10 => 10, 12 => 12, 16 => 16, 24 => 24, 32 => 32, 64 => 64); $config->zahost->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -k %s -z %s'; diff --git a/module/zahost/lang/de.php b/module/zahost/lang/de.php index e4cf451830..b33c6f24cd 100644 --- a/module/zahost/lang/de.php +++ b/module/zahost/lang/de.php @@ -59,12 +59,12 @@ $lang->zahost->init->next = "Next"; $lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or See Help."; $lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。"; -$lang->zahost->init->serviceStatus = [ +$lang->zahost->init->serviceStatus = array( "kvm" => 'not_install', "nginx" => 'not_install', "novnc" => 'not_install', "websockify" => 'not_install', -]; +); $lang->zahost->init->title = "Initialize Host"; $lang->zahost->init->descTitle = "Follow these steps to complete the initialization on the host:"; $lang->zahost->init->initDesc = "Execute the init script on the host: %s %s
- Click check service status button."; diff --git a/module/zahost/lang/en.php b/module/zahost/lang/en.php index e4cf451830..b33c6f24cd 100644 --- a/module/zahost/lang/en.php +++ b/module/zahost/lang/en.php @@ -59,12 +59,12 @@ $lang->zahost->init->next = "Next"; $lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or See Help."; $lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。"; -$lang->zahost->init->serviceStatus = [ +$lang->zahost->init->serviceStatus = array( "kvm" => 'not_install', "nginx" => 'not_install', "novnc" => 'not_install', "websockify" => 'not_install', -]; +); $lang->zahost->init->title = "Initialize Host"; $lang->zahost->init->descTitle = "Follow these steps to complete the initialization on the host:"; $lang->zahost->init->initDesc = "Execute the init script on the host: %s %s
- Click check service status button."; diff --git a/module/zahost/lang/fr.php b/module/zahost/lang/fr.php index e4cf451830..b33c6f24cd 100644 --- a/module/zahost/lang/fr.php +++ b/module/zahost/lang/fr.php @@ -59,12 +59,12 @@ $lang->zahost->init->next = "Next"; $lang->zahost->init->initFailNotice = "Fail,Execute the installation service command on the host or See Help."; $lang->zahost->init->initSuccessNotice = "Succeed,%s and %s。"; -$lang->zahost->init->serviceStatus = [ +$lang->zahost->init->serviceStatus = array( "kvm" => 'not_install', "nginx" => 'not_install', "novnc" => 'not_install', "websockify" => 'not_install', -]; +); $lang->zahost->init->title = "Initialize Host"; $lang->zahost->init->descTitle = "Follow these steps to complete the initialization on the host:"; $lang->zahost->init->initDesc = "Execute the init script on the host: %s %s
- Click check service status button."; diff --git a/module/zahost/lang/zh-cn.php b/module/zahost/lang/zh-cn.php index 60804004a3..b62373eece 100644 --- a/module/zahost/lang/zh-cn.php +++ b/module/zahost/lang/zh-cn.php @@ -59,12 +59,12 @@ $lang->zahost->init->next = "下一步"; $lang->zahost->init->initFailNotice = "服务未就绪,在宿主机上执行安装服务命令或查看帮助."; $lang->zahost->init->initSuccessNotice = "服务已就绪,您可以在%s后%s。"; -$lang->zahost->init->serviceStatus = [ +$lang->zahost->init->serviceStatus = array( "kvm" => 'not_install', "nginx" => 'not_install', "novnc" => 'not_install', "websockify" => 'not_install', -]; +); $lang->zahost->init->title = "初始化宿主机"; $lang->zahost->init->descTitle = "请根据引导完成宿主机上的初始化: "; $lang->zahost->init->initDesc = "- 在宿主机上执行命令:%s %s
- 点击检测服务状态。"; diff --git a/module/zanode/lang/de.php b/module/zanode/lang/de.php index a1c25e8d70..1200f7cf54 100644 --- a/module/zanode/lang/de.php +++ b/module/zanode/lang/de.php @@ -138,10 +138,10 @@ $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it take $lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; $lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; -$lang->zanode->init->serviceStatus = [ +$lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', "ZTF" => 'not_install', -]; +); $lang->zanode->init->title = "Initialize Node"; $lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:"; $lang->zanode->init->initDesc = "Execute the init script on the node: %s %s
- Click check service status button."; diff --git a/module/zanode/lang/en.php b/module/zanode/lang/en.php index 4b6dcc9ca9..25a9e2dd6c 100644 --- a/module/zanode/lang/en.php +++ b/module/zanode/lang/en.php @@ -142,10 +142,10 @@ $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it take $lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; $lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; -$lang->zanode->init->serviceStatus = [ +$lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', "ZTF" => 'not_install', -]; +); $lang->zanode->init->title = "Initialize Node"; $lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:"; $lang->zanode->init->initDesc = "Execute the init script on the node: %s %s
- Click check service status button."; diff --git a/module/zanode/lang/fr.php b/module/zanode/lang/fr.php index a1c25e8d70..1200f7cf54 100644 --- a/module/zanode/lang/fr.php +++ b/module/zanode/lang/fr.php @@ -138,10 +138,10 @@ $lang->zanode->init->initSuccessNoticeTitle = "The service is ready, and it take $lang->zanode->init->initFailNoticeTitle = "Initialization failed, check the init script execution log and try the following two solutions:"; $lang->zanode->init->initFailNoticeDesc = "1. Re-execute the script
2. Review the initialization FAQ"; -$lang->zanode->init->serviceStatus = [ +$lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', "ZTF" => 'not_install', -]; +); $lang->zanode->init->title = "Initialize Node"; $lang->zanode->init->descTitle = "Follow these steps to complete the initialization on the node:"; $lang->zanode->init->initDesc = "Execute the init script on the node: %s %s
- Click check service status button."; diff --git a/module/zanode/lang/zh-cn.php b/module/zanode/lang/zh-cn.php index cd43cdfa73..27f9b1175c 100644 --- a/module/zanode/lang/zh-cn.php +++ b/module/zanode/lang/zh-cn.php @@ -143,10 +143,10 @@ $lang->zanode->init->initSuccessNoticeTitle = "服务已就绪,还需两步即 $lang->zanode->init->initFailNoticeTitle = "初始化失败,请查看初始化脚本执行日志并尝试以下两种解决方案:"; $lang->zanode->init->initFailNoticeDesc = "1、 重新执行脚本
2、 查看初始化常见问题"; -$lang->zanode->init->serviceStatus = [ +$lang->zanode->init->serviceStatus = array( "ZenAgent" => 'not_install', "ZTF" => 'not_install', -]; +); $lang->zanode->init->title = "初始化执行节点"; $lang->zanode->init->descTitle = "请根据引导完成执行节点上的初始化: "; $lang->zanode->init->initDesc = "- 在执行节点上执行命令:%s %s
- 点击检测服务状态。";$lang->zanode->init->statusTitle = "服务状态";