diff --git a/trunk/config/config.php b/trunk/config/config.php index 8cefc87fa1..7c91ef5c4d 100644 --- a/trunk/config/config.php +++ b/trunk/config/config.php @@ -49,6 +49,9 @@ $config->default->module = 'index'; // 默 $config->default->method = 'index'; // 默认的方法。当请求中没有指定方法或者指定的方法不存在时,调用该方法。 $config->default->domain = 'pms.easysoft.com'; // 默认的域名,当请求中的域名没有对应的记录时,使用此默认域名对应的公司信息。 +$config->file->dangers = 'php,jsp,py,rb,asp,'; // 不允许上传的文件类型列表。 +$config->file->maxSize = 1024 * 1024; // 允许上传的文件大小,单位为字节。 + $config->db->errorMode = PDO::ERRMODE_EXCEPTION; // PDO的错误模式: PDO::ERRMODE_SILENT|PDO::ERRMODE_WARNING|PDO::ERRMODE_EXCEPTION $config->db->persistant = false; // 是否打开持久连接。 $config->db->driver = 'mysql'; // pdo的驱动类型,目前暂时只支持mysql。 diff --git a/trunk/module/bug/control.php b/trunk/module/bug/control.php index 7322557124..1401ab6778 100644 --- a/trunk/module/bug/control.php +++ b/trunk/module/bug/control.php @@ -156,10 +156,14 @@ class bug extends control { $changes = $this->bug->update($bugID); if(dao::isError()) die(js::error(dao::getError())); - if($this->post->comment != '' or !empty($changes)) + $this->loadModel('file'); + $files = $this->file->saveUpload('files', 'bug', $bugID); + if($this->post->comment != '' or !empty($changes) or !empty($files)) { $action = !empty($changes) ? 'Edited' : 'Commented'; - $actionID = $this->action->create('bug', $bugID, $action, $this->post->comment); + $fileAction = ''; + if(!empty($files)) $fileAction = "Add Files " . join(',', $files) . "\n" ; + $actionID = $this->action->create('bug', $bugID, $action, $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); } die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); @@ -231,6 +235,8 @@ class bug extends control { $this->bug->activate($bugID); if(dao::isError()) die(js::error(dao::getError())); + $this->loadModel('file'); + $files = $this->file->saveUpload('files', 'bug', $bugID); $this->action->create('bug', $bugID, 'Activated', $this->post->comment); die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } diff --git a/trunk/module/bug/model.php b/trunk/module/bug/model.php index ccec3cf4b3..162638fbc9 100644 --- a/trunk/module/bug/model.php +++ b/trunk/module/bug/model.php @@ -40,7 +40,14 @@ class bugModel extends model ->join('mailto', ',') ->get(); $this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->check('title', 'notempty')->exec(); - return $this->dao->lastInsertID(); + if(!dao::isError()) + { + $bugID = $this->dao->lastInsertID(); + $this->loadModel('file'); + $this->file->saveUpload('files', 'bug', $bugID); + return $bugID; + } + return false; } /* 鑾峰緱鏌愪竴涓骇鍝侊紝鏌愪竴涓ā鍧椾笅闈㈢殑鎵鏈塨ug銆*/ @@ -63,6 +70,9 @@ class bugModel extends model foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = ''; $bug->mailto = ltrim(trim($bug->mailto), ','); if($bug->duplicateBug) $bug->duplicateBugTitle = $this->dao->findById($bug->duplicateBug)->from(TABLE_BUG)->fields('title')->fetch('title'); + + $this->loadModel('file'); + $bug->files = $this->file->getByObject('bug', $bugID); return $bug; } diff --git a/trunk/module/bug/view/activate.html.php b/trunk/module/bug/view/activate.html.php index b57b9f2821..cc7e10187e 100644 --- a/trunk/module/bug/view/activate.html.php +++ b/trunk/module/bug/view/activate.html.php @@ -23,7 +23,7 @@ */ ?> -