* adjust code for var name.

This commit is contained in:
wangyidong
2016-03-14 12:59:42 +08:00
parent 81c7452008
commit b5059fa0a5
3 changed files with 13 additions and 15 deletions

View File

@@ -50,5 +50,4 @@ $lang->cron->notice->dom = 'Range : 1-31';
$lang->cron->notice->mon = 'Range : 1-12';
$lang->cron->notice->dow = 'Range : 0-6';
$lang->cron->notice->help = 'Note: if the server is restarted, or that the timing task is not normal, then the timing task has stopped. You need to click the [Open process] button or refresh page after a minute to open the scheduled tasks. If the last run time of first record is changed in cron list, then the task is turned on.';
$lang->cron->error['rule'] = '"%s" is not a valid value';
$lang->cron->notice->errorRule = '"%s" is not a valid value';

View File

@@ -50,5 +50,4 @@ $lang->cron->notice->dom = '取值范围:1-31';
$lang->cron->notice->mon = '取值范围:1-12';
$lang->cron->notice->dow = '取值范围:0-6';
$lang->cron->notice->help = '注:如果服务器重启,或者发现计划任务没有正常工作,那么计划任务已经停止工作。需要手动点击【创建进程】按钮,或者一分钟后刷新页面,来开启计划任务。如果任务列表中第一条记录的最后执行时间改变,说明任务开启成功。';
$lang->cron->error['rule'] = '"%s" 填写的不是合法的值';
$lang->cron->notice->errorRule = '"%s" 填写的不是合法的值';

View File

@@ -169,10 +169,10 @@ class cronModel extends model
->skipSpecial('m,h,dom,mon,dow,command')
->get();
$checkRule = $this->checkRule($cron);
if(!empty($checkRule))
$result = $this->checkRule($cron);
if(!empty($result))
{
dao::$errors[] = $checkRule;
dao::$errors[] = $result;
return false;
}
@@ -195,10 +195,10 @@ class cronModel extends model
->skipSpecial('m,h,dom,mon,dow,command')
->get();
$checkRule = $this->checkRule($cron);
if(!empty($checkRule))
$result = $this->checkRule($cron);
if(!empty($result))
{
dao::$errors[] = $checkRule;
dao::$errors[] = $result;
return false;
}
@@ -215,11 +215,11 @@ class cronModel extends model
*/
public function checkRule($cron)
{
if($cron->m === '' or preg_match('/[^0-9\*\-\/]/', $cron->m)) return sprintf($this->lang->cron->error['rule'], $this->lang->cron->m);
if($cron->h === '' or preg_match('/[^0-9\*\-\/]/', $cron->h)) return sprintf($this->lang->cron->error['rule'], $this->lang->cron->h);
if($cron->dom === '' or preg_match('/[^0-9\*\-\/]/', $cron->dom))return sprintf($this->lang->cron->error['rule'], $this->lang->cron->dom);
if($cron->mon === '' or preg_match('/[^0-9\*\-\/]/', $cron->mon))return sprintf($this->lang->cron->error['rule'], $this->lang->cron->mon);
if($cron->dow === '' or preg_match('/[^0-9\*\-\/]/', $cron->dow))return sprintf($this->lang->cron->error['rule'], $this->lang->cron->dow);
if($cron->m === '' or preg_match('/[^0-9\*\-\/]/', $cron->m)) return sprintf($this->lang->cron->notice->errorRule, $this->lang->cron->m);
if($cron->h === '' or preg_match('/[^0-9\*\-\/]/', $cron->h)) return sprintf($this->lang->cron->notice->errorRule, $this->lang->cron->h);
if($cron->dom === '' or preg_match('/[^0-9\*\-\/]/', $cron->dom))return sprintf($this->lang->cron->notice->errorRule, $this->lang->cron->dom);
if($cron->mon === '' or preg_match('/[^0-9\*\-\/]/', $cron->mon))return sprintf($this->lang->cron->notice->errorRule, $this->lang->cron->mon);
if($cron->dow === '' or preg_match('/[^0-9\*\-\/]/', $cron->dow))return sprintf($this->lang->cron->notice->errorRule, $this->lang->cron->dow);
if(empty($cron->command))return sprintf($this->lang->error->notempty, $this->lang->cron->command);
return null;
}