diff --git a/module/task/model.php b/module/task/model.php index fe042c3a73..610b2766ef 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -29,12 +29,16 @@ class taskModel extends model ->setDefault('project', (int)$projectID) ->setDefault('estimate, left, story', 0) ->setDefault('status', 'wait') + ->setDefault('estimate',(int)$this->post->estimate) ->setIF($this->post->estimate != false, 'left', $this->post->estimate) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setDefault('estStarted', '0000-00-00') ->setDefault('deadline', '0000-00-00') ->setIF(strpos($this->config->task->create->requiredFields, 'estStarted') !== false, 'estStarted', $this->post->estStarted) ->setIF(strpos($this->config->task->create->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) + ->setIF($this->post->estimate !== 0, 'estimate', (int)$this->post->estimate) + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setDefault('openedBy', $this->app->user->account) ->setDefault('openedDate', helper::now()) ->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags) @@ -578,6 +582,9 @@ class taskModel extends model ->setDefault('story, estimate, left, consumed', 0) ->setDefault('estStarted', '0000-00-00') ->setDefault('deadline', '0000-00-00') + ->setIF($this->post->estimate !== 0, 'estimate', (int)$this->post->estimate) + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setIF($oldTask->parent == 0 && $this->post->parent == '', 'parent', 0) ->setIF(strpos($this->config->task->edit->requiredFields, 'estStarted') !== false, 'estStarted', $this->post->estStarted) ->setIF(strpos($this->config->task->edit->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) @@ -598,7 +605,7 @@ class taskModel extends model ->setIF($this->post->assignedTo != $oldTask->assignedTo, 'assignedDate', $now) - ->setIF($this->post->status == 'wait' and $this->post->left == $oldTask->left and $this->post->consumed == 0, 'left', $this->post->estimate) + ->setIF($this->post->status == 'wait' and $this->post->left == $oldTask->left and $this->post->consumed == 0 and $this->post->estimate, 'left', $this->post->estimate) ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', $now) @@ -1170,6 +1177,7 @@ class taskModel extends model } $task = fixer::input('post') + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) ->setDefault('left', 0) ->setDefault('assignedTo', $oldTask->openedBy) ->setDefault('assignedDate', $now) @@ -1229,6 +1237,7 @@ class taskModel extends model } if($task->finishedDate == substr($now, 0, 10)) $task->finishedDate = $now; + $task->consumed = (int)$task->consumed; $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() @@ -1349,6 +1358,7 @@ class taskModel extends model $oldTask = $this->getById($taskID); $task = fixer::input('post') + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setDefault('left', 0) ->setDefault('status', 'doing') ->setDefault('finishedBy, canceledBy, closedBy, closedReason', '') @@ -1359,6 +1369,12 @@ class taskModel extends model ->remove('comment') ->get(); + if(!is_numeric($task->left)) + { + dao::$errors[] = $this->lang->task->error->estimateNumber; + return false; + } + if(!empty($oldTask->team)) { $this->dao->update(TABLE_TEAM)->set('left')->eq($this->post->left) diff --git a/xuanxuan/module/admin/ext/control/downloadxxd.php b/xuanxuan/module/admin/ext/control/downloadxxd.php index e2f82c9cb2..4a7ee6c908 100644 --- a/xuanxuan/module/admin/ext/control/downloadxxd.php +++ b/xuanxuan/module/admin/ext/control/downloadxxd.php @@ -5,9 +5,13 @@ class admin extends control { if(in_array($type, array('config', 'package'))) { - $setting = $this->config->xuanxuan; + $this->loadModel('chat'); + $server = $this->chat->getServer(); + if(strpos($server, '127.0.0.1') !== false) die(js::alert($this->lang->chat->xxdServerError)); + + $setting = $this->config->xuanxuan; $setting->os = $os; - $this->loadModel('chat')->downloadXXD($setting, $type); + $this->chat->downloadXXD($setting, $type); } die("Params error."); } diff --git a/xuanxuan/module/admin/ext/control/xuanxuan.php b/xuanxuan/module/admin/ext/control/xuanxuan.php index 08a64fd3e2..fade5a15ff 100644 --- a/xuanxuan/module/admin/ext/control/xuanxuan.php +++ b/xuanxuan/module/admin/ext/control/xuanxuan.php @@ -23,10 +23,15 @@ class admin extends control if(empty($setting->sslkey)) $errors['sslkey'] = $this->lang->chat->errorSSLKey; } + if(strpos($setting->server, '127.0.0.1') !== false) $errors[] = $this->lang->chat->xxdServerError; + if(strpos($setting->server, 'https://') !== 0 and strpos($setting->server, 'http://') !== 0) $errors[] = $this->lang->chat->xxdSchemeError; + if(empty($setting->server)) $errors[] = $this->lang->chat->xxdServerEmpty; + if($errors) $this->send(array('result' => 'fail', 'message' => $errors)); - $setting->server = ($setting->isHttps ? 'https' : 'http') . '://' . $setting->domain . ':' . $setting->commonPort; - $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting, 'all'); + + $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting); + $this->setting->setItem('system.mail.domain', $setting->server); if(!$result) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('xuanxuan'))); } @@ -34,19 +39,11 @@ class admin extends control $os = 'win'; if(strpos(strtolower(PHP_OS), 'win') !== 0) $os = strtolower(PHP_OS); - $domain = $this->server->http_host; - if(!empty($this->config->xuanxuan->server)) - { - preg_match('/^(https?:\/\/)?([^\:]+)/i', $this->config->xuanxuan->server, $match); - $domain = $match[2]; - } - - $this->view->title = $this->lang->chat->common; $this->view->adminList = $this->loadModel('user')->getPairs('admin'); $this->view->os = $os . '_' . php_uname('m'); $this->view->type = $type; - $this->view->domain = $domain; + $this->view->domain = $this->loadModel('chat')->getServer(); $this->view->turnon = isset($this->config->xuanxuan->turnon) ? $this->config->xuanxuan->turnon : 1; $this->view->isHttps = $this->config->xuanxuan->isHttps ? $this->config->xuanxuan->isHttps : 0; $this->display(); diff --git a/xuanxuan/module/admin/ext/view/xuanxuan.html.php b/xuanxuan/module/admin/ext/view/xuanxuan.html.php index 0ea81fbd52..cb5974b3cb 100644 --- a/xuanxuan/module/admin/ext/view/xuanxuan.html.php +++ b/xuanxuan/module/admin/ext/view/xuanxuan.html.php @@ -21,11 +21,12 @@