diff --git a/module/action/model.php b/module/action/model.php index 1b3063b110..c55dd5d0b1 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -43,9 +43,12 @@ class actionModel extends model $action->actor = $actor; $action->action = $actionType; $action->date = helper::now(); - $action->comment = $this->loadModel('file')->pasteImage(trim(strip_tags($comment, $this->config->allowedTags)), $this->post->uid); + $action->comment = trim(strip_tags($comment, $this->config->allowedTags)); $action->extra = $extra; + /* Process action. */ + $action = $this->loadModel('file')->processEditor($action, 'comment', $this->post->uid); + /* Get product and project for this object. */ $productAndProject = $this->getProductAndProject($action->objectType, $objectID); $action->product = $productAndProject['product']; @@ -886,11 +889,15 @@ class actionModel extends model */ public function updateComment($actionID) { - $comment = $this->loadModel('file')->pasteImage(trim(strip_tags($this->post->lastComment, $this->config->allowedTags)), $this->post->uid); $action = $this->getById($actionID); + $action->comment = trim(strip_tags($this->post->lastComment, $this->config->allowedTags)); + + /* Process action. */ + $action = $this->loadModel('file')->processEditor($action, 'comment', $this->post->uid); + $this->dao->update(TABLE_ACTION) ->set('date')->eq(helper::now()) - ->set('comment')->eq($comment) + ->set('comment')->eq($action->comment) ->where('id')->eq($actionID) ->exec(); $this->file->updateObjectID($this->post->uid, $action->objectID, $action->objectType); diff --git a/module/block/config.php b/module/block/config.php index 16b7ffefad..287ee49e0e 100644 --- a/module/block/config.php +++ b/module/block/config.php @@ -19,3 +19,14 @@ $config->block->gridOptions[8] = '2/3'; $config->block->gridOptions[3] = '1/4'; $config->block->gridOptions[9] = '3/4'; $config->block->gridOptions[12] = '100%'; + +$config->filterParam->get['block']['common']['hold'] = 'hash'; +$config->filterParam->get['block']['main']['hold'] = 'entry,lang,mode,blockid,blockTitle,param,sso'; +$config->filterParam->get['block']['common']['params']['hash']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['block']['main']['params']['entry']['reg'] = '/^[a-zA-Z0-9_]+$/'; +$config->filterParam->get['block']['main']['params']['lang']['reg'] = '/^[a-zA-Z_\-]+$/'; +$config->filterParam->get['block']['main']['params']['mode']['reg'] = '/^[a-zA-Z0-9_]+$/'; +$config->filterParam->get['block']['main']['params']['blockid']['reg'] = '/^[a-zA-Z0-9]+$/'; +$config->filterParam->get['block']['main']['params']['blockTitle']['reg'] = '/./'; +$config->filterParam->get['block']['main']['params']['param']['reg'] = '/^[a-zA-Z0-9\+\/\=]+$/'; +$config->filterParam->get['block']['main']['params']['sso']['reg'] = '/^[a-zA-Z0-9\+\/\=]+$/'; diff --git a/module/block/model.php b/module/block/model.php index 0f67a6c155..c82192e417 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -26,6 +26,7 @@ class blockModel extends model $block = $id ? $this->getByID($id) : null; $data = fixer::input('post') ->add('account', $this->app->user->account) + ->stripTags('html', $this->config->allowedTags) ->setIF($id, 'id', $id) ->add('order', $block ? $block->order : ($this->getLastKey($module) + 1)) ->add('module', $module) @@ -39,8 +40,11 @@ class blockModel extends model if($type == 'html') { + $uid = $this->post->uid; + $data = $this->loadModel('file')->processEditor($data, 'html', $uid); $data->params['html'] = $data->html; unset($data->html); + unset($_SESSION['album'][$uid]); } $data->params = helper::jsonEncode($data->params); @@ -63,6 +67,7 @@ class blockModel extends model $block->params = json_decode($block->params); if(empty($block->params)) $block->params = new stdclass(); + if($block->block == 'html') $block->params->html = $this->loadModel('file')->setImgSize($block->params->html); return $block; } diff --git a/module/bug/config.php b/module/bug/config.php index 525b6d7bca..b3f9dc54e4 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -276,3 +276,18 @@ $config->bug->datatable->fieldList['branch']['title'] = 'branch'; $config->bug->datatable->fieldList['branch']['fixed'] = 'left'; $config->bug->datatable->fieldList['branch']['width'] = '100'; $config->bug->datatable->fieldList['branch']['required'] = 'no'; + +$config->filterParam->cookie['bug']['common']['hold'] = 'lastProduct,preProductID'; +$config->filterParam->cookie['bug']['browse']['hold'] = 'preBranch,bugModule,qaBugOrder,windowWidth'; +$config->filterParam->cookie['bug']['create']['hold'] = 'preBranch'; +$config->filterParam->cookie['bug']['batchcreate']['hold'] = 'preBranch'; +$config->filterParam->cookie['bug']['export']['hold'] = 'checkedItem'; +$config->filterParam->cookie['bug']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['bug']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['bug']['browse']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['bug']['browse']['params']['bugModule']['int'] = ''; +$config->filterParam->cookie['bug']['browse']['params']['qaBugOrder']['reg'] = '/^[a-zA-Z0-9_]+$/'; +$config->filterParam->cookie['bug']['browse']['params']['windowWidth']['int'] = ''; +$config->filterParam->cookie['bug']['create']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['bug']['batchcreate']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['bug']['export']['params']['checkedItem']['reg'] = '/^[0-9,]+$/'; diff --git a/module/bug/model.php b/module/bug/model.php index 828fd4f2ab..3bb38730b9 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -180,8 +180,8 @@ class bugModel extends model $file['addedDate'] = $now; $this->dao->insert(TABLE_FILE)->data($file)->exec(); - $url = $this->file->webPath . $file['pathname']; - $bug->steps .= ''; + $fileID = $this->dao->lastInsertID; + $bug->steps .= ''; unset($file); } } @@ -361,7 +361,8 @@ class bugModel extends model ->where('t1.id')->eq((int)$bugID)->fetch(); if(!$bug) return false; - if($setImgSize) $bug->steps = $this->loadModel('file')->setImgSize($bug->steps); + $bug = $this->loadModel('file')->revertRealSRC($bug, 'steps'); + if($setImgSize) $bug->steps = $this->file->setImgSize($bug->steps); foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = ''; if($bug->duplicateBug) $bug->duplicateBugTitle = $this->dao->findById($bug->duplicateBug)->from(TABLE_BUG)->fields('title')->fetch('title'); @@ -490,8 +491,8 @@ class bugModel extends model */ public function update($bugID) { - $oldBug = $this->getById($bugID); - if(isset($_POST['lastEditedDate']) and $oldBug->lastEditedDate != $this->post->lastEditedDate) + $oldBug = $this->dao->select('*')->from(TABLE_BUG)->where('id')->eq((int)$bugID)->fetch(); + if(!empty($_POST['lastEditedDate']) and $oldBug->lastEditedDate != $this->post->lastEditedDate) { dao::$errors[] = $this->lang->error->editedByOther; return false; @@ -587,9 +588,10 @@ class bugModel extends model } /* Initialize bugs from the post data.*/ + $oldBugs = $bugIDList ? $this->getList($bugIDList) : array(); foreach($bugIDList as $bugID) { - $oldBug = $this->getByID($bugID); + $oldBug = $oldBugs[$bugID]; $bug = new stdclass(); $bug->lastEditedBy = $this->app->user->account; @@ -632,7 +634,7 @@ class bugModel extends model /* Update bugs. */ foreach($bugs as $bugID => $bug) { - $oldBug = $this->getByID($bugID); + $oldBug = $oldBugs[$bugID]; $this->dao->update(TABLE_BUG)->data($bug) ->autoCheck() diff --git a/module/build/model.php b/module/build/model.php index 309b084660..89e2175a88 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -31,7 +31,8 @@ class buildModel extends model ->fetch(); if(!$build) return false; - $build->files = $this->loadModel('file')->getByObject('build', $buildID); + $build = $this->loadModel('file')->revertRealSRC($build, 'desc'); + $build->files = $this->file->getByObject('build', $buildID); if($setImgSize) $build->desc = $this->file->setImgSize($build->desc); return $build; } @@ -224,8 +225,8 @@ class buildModel extends model */ public function update($buildID) { - $oldBuild = $this->getByID($buildID); - $build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags) + $oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq((int)$buildID)->fetch(); + $build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags) ->remove('allchecker,resolvedBy,files,labels,uid') ->get(); if(!isset($build->branch)) $build->branch = $oldBuild->branch; diff --git a/module/common/model.php b/module/common/model.php index 46f9cf3295..48c6d2d8ca 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -23,7 +23,6 @@ class commonModel extends model if(!defined('FIRST_RUN')) { define('FIRST_RUN', true); - $this->startSession(); $this->sendHeader(); $this->setCompany(); $this->setUser(); @@ -34,19 +33,6 @@ class commonModel extends model } } - /** - * Start the session. - * - * @access public - * @return void - */ - public function startSession() - { - session_name($this->config->sessionVar); - if(isset($_GET[$this->config->sessionVar])) session_id($_GET[$this->config->sessionVar]); - session_start(); - } - /** * Set the header info. * @@ -126,8 +112,8 @@ class commonModel extends model $this->config->personal = isset($config[$account]) ? $config[$account] : array(); /* Overide the items defined in config/config.php and config/my.php. */ - if(isset($this->config->system->common)) helper::mergeConfig($this->config->system->common, 'common'); - if(isset($this->config->personal->common)) helper::mergeConfig($this->config->personal->common, 'common'); + if(isset($this->config->system->common)) $this->app->mergeConfig($this->config->system->common, 'common'); + if(isset($this->config->personal->common)) $this->app->mergeConfig($this->config->personal->common, 'common'); } /** @@ -169,6 +155,7 @@ class commonModel extends model if($module == 'sso' and $method == 'bind') return true; if($module == 'sso' and $method == 'gettodolist') return true; if($module == 'block' and $method == 'main') return true; + if($module == 'file' and $method == 'read') return true; if($this->loadModel('user')->isLogon() or ($this->app->company->guest and $this->app->user->account == 'guest')) { diff --git a/module/doc/config.php b/module/doc/config.php index 6bcb942298..03ce67dcf9 100644 --- a/module/doc/config.php +++ b/module/doc/config.php @@ -45,3 +45,15 @@ $config->doc->search['params']['addedDate'] = array('operator' => '=', $config->doc->search['params']['editedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->doc->search['params']['editedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->doc->search['params']['version'] = array('operator' => '=', 'control' => 'input', 'values' => ''); + +$config->filterParam->get['doc']['showfiles']['hold'] = 'recTotal,recPerPage,pageID,title'; +$config->filterParam->get['doc']['showfiles']['params']['recTotal']['reg'] = '/^[0-9_]+$/'; +$config->filterParam->get['doc']['showfiles']['params']['recPerPage']['reg'] = '/^[0-9]+$/'; +$config->filterParam->get['doc']['showfiles']['params']['pageID']['reg'] = '/^[0-9]+$/'; +$config->filterParam->get['doc']['showfiles']['params']['title']['reg'] = '/./'; + +$config->filterParam->cookie['doc']['common']['hold'] = 'product,from'; +$config->filterParam->cookie['doc']['browse']['hold'] = 'browseType'; +$config->filterParam->cookie['doc']['common']['params']['product']['int'] = ''; +$config->filterParam->cookie['doc']['common']['params']['from']['code'] = ''; +$config->filterParam->cookie['doc']['browse']['params']['browseType']['reg'] = '/^by[a-z]+$/'; diff --git a/module/doc/model.php b/module/doc/model.php index f66ca6648b..8c6581c4cb 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -351,7 +351,9 @@ class docModel extends model $doc->digest = isset($docContent->digest) ? $docContent->digest : ''; $doc->content = isset($docContent->content) ? $docContent->content : ''; $doc->contentType = isset($docContent->type) ? $docContent->type : ''; - if($setImgSize) $doc->content = $this->loadModel('file')->setImgSize($doc->content); + + $doc = $this->loadModel('file')->revertRealSRC($doc, 'content'); + if($setImgSize) $doc->content = $this->file->setImgSize($doc->content); $doc->files = $docFiles; $doc->productName = ''; @@ -437,7 +439,7 @@ class docModel extends model */ public function update($docID) { - $oldDoc = $this->getById($docID); + $oldDoc = $this->dao->select('*')->from(TABLE_DOC)->where('id')->eq((int)$docID)->fetch(); $now = helper::now(); $doc = fixer::input('post')->setDefault('module', 0) ->stripTags($this->config->doc->editor->edit['id'], $this->config->allowedTags) diff --git a/module/file/config.php b/module/file/config.php index 7b55622f10..682f7e62ff 100644 --- a/module/file/config.php +++ b/module/file/config.php @@ -30,3 +30,11 @@ $config->file->ueditor["videoMaxSize"] = 102400000; $config->file->ueditor["videoAllowFiles"] = array(".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"); $config->file->ueditor["videoUrlPrefix"] = ""; $config->file->ueditor["videoPathFormat"] = ""; + +$config->filterParam->get['file']['ajaxueditorupload']['hold'] = 'action'; +$config->filterParam->get['file']['download']['hold'] = 'charset'; +$config->filterParam->get['file']['ajaxueditorupload']['params']['action']['equal'] = 'config'; +$config->filterParam->get['file']['download']['params']['charset']['reg'] = '/^[a-zA-Z0-9\-_]+$/'; + +$config->filterParam->cookie['file']['download']['hold'] = $config->sessionVar; +$config->filterParam->cookie['file']['download']['params'][$config->sessionVar]['reg'] = '/^[a-zA-Z0-9]+$/'; diff --git a/module/file/control.php b/module/file/control.php index 1e1320664c..d2d43f63fc 100644 --- a/module/file/control.php +++ b/module/file/control.php @@ -64,8 +64,9 @@ class file extends control unset($file['tmpname']); $this->dao->insert(TABLE_FILE)->data($file)->exec(); - $url = $this->file->webPath . $file['pathname']; - if($uid) $_SESSION['album'][$uid][] = $this->dao->lastInsertID(); + $fileID = $this->dao->lastInsertID(); + $url = $this->createLink('file', 'read', "fileID=$fileID"); + if($uid) $_SESSION['album'][$uid][] = $fileID; die(json_encode(array('error' => 0, 'url' => $url))); } else @@ -104,8 +105,9 @@ class file extends control unset($file['tmpname']); $this->dao->insert(TABLE_FILE)->data($file)->exec(); - $url = $this->file->webPath . $file['pathname']; - if($uid) $_SESSION['album'][$uid][] = $this->dao->lastInsertID(); + $fileID = $this->dao->lastInsertID(); + $url = $this->createLink('file', 'read', "fileID=$fileID"); + if($uid) $_SESSION['album'][$uid][] = $fileID; die(json_encode(array('state' => 'SUCCESS', 'url' => $url))); } else @@ -469,4 +471,27 @@ class file extends control $this->dao->delete()->from(TABLE_USERTPL)->where('id')->eq($templateID)->andWhere('account')->eq($this->app->user->account)->exec(); die(); } + + /** + * Read file. + * + * @param int $fileID + * @access public + * @return void + */ + public function read($fileID) + { + $file = $this->file->getById($fileID); + if(empty($file) or !file_exists($file->realPath)) return false; + + $mime = in_array($file->extension, $this->config->file->imageExtensions) ? "image/{$file->extension}" : $this->config->file->mimes['default']; + header("Content-type: $mime"); + + $handle = fopen($file->realPath, "r"); + if($handle) + { + while(!feof($handle)) echo fgets($handle); + fclose($handle); + } + } } diff --git a/module/file/model.php b/module/file/model.php index 871563a383..d52791444e 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -68,7 +68,7 @@ class fileModel extends model { $file = $this->dao->findById($fileID)->from(TABLE_FILE)->fetch(); $file->webPath = $this->webPath . $file->pathname; - $file->realPath = $this->app->getAppRoot() . "www/data/upload/{$this->app->company->id}/" . $file->pathname; + $file->realPath = $this->savePath . $file->pathname; return $file; } @@ -92,7 +92,8 @@ class fileModel extends model foreach($files as $id => $file) { if($file['size'] == 0) continue; - move_uploaded_file($file['tmpname'], $this->savePath . $file['pathname']); + if(!move_uploaded_file($file['tmpname'], $this->savePath . $file['pathname'])) return false; + $file = $this->compressImage($file); $file['objectType'] = $objectType; @@ -144,6 +145,7 @@ class fileModel extends model { if(empty($filename)) continue; if(!validater::checkFileName($filename)) continue; + $title = isset($_POST[$labelsName][$id]) ? $_POST[$labelsName][$id] : ''; $file['extension'] = $this->getExtension($filename); $file['pathname'] = $this->setPathName($id, $file['extension']); @@ -151,7 +153,13 @@ class fileModel extends model $file['title'] = $purifier->purify($file['title']); $file['size'] = $size[$id]; $file['tmpname'] = $tmp_name[$id]; - $files[] = $file; + + if(stripos($this->config->file->allowed, ',' . $file['extension'] . ',') === false) + { + $file['pathname'] = $file['pathname'] . '.notAllowed'; + } + + $files[] = $file; } } else @@ -166,6 +174,12 @@ class fileModel extends model $file['title'] = $purifier->purify($file['title']); $file['size'] = $size; $file['tmpname'] = $tmp_name; + + if(stripos($this->config->file->allowed, ',' . $file['extension'] . ',') === false) + { + $file['pathname'] = $file['pathname'] . '.notAllowed'; + } + return array($file); } return $files; @@ -204,6 +218,11 @@ class fileModel extends model $file['chunks'] = isset($_POST['chunks']) ? intval($_POST['chunks']) : 0; $file['chunk'] = isset($_POST['chunk']) ? intval($_POST['chunk']) : 0; + if(stripos($this->config->file->allowed, ',' . $file['extension'] . ',') === false) + { + $file['pathname'] = $file['pathname'] . '.notAllowed'; + } + return $file; } @@ -284,7 +303,7 @@ class fileModel extends model public function getExtension($filename) { $extension = trim(strtolower(pathinfo($filename, PATHINFO_EXTENSION))); - if(empty($extension) or strpos(",{$this->config->file->dangers},", ",{$extension},") !== false) return 'txt'; + if(empty($extension) or stripos(",{$this->config->file->dangers},", ",{$extension},") !== false) return 'txt'; if($extension == 'php') return 'txt'; return $extension; } @@ -339,7 +358,7 @@ class fileModel extends model { $sessionID = session_id(); $randString = substr($sessionID, mt_rand(0, strlen($sessionID) - 5), 3); - return date('Ym/dHis', $this->now) . $fileID . mt_rand(0, 10000) . $randString . '.' . $extension; + return date('Ym/dHis', $this->now) . $fileID . mt_rand(0, 10000) . $randString; } /** @@ -380,7 +399,13 @@ class fileModel extends model */ public function setImgSize($content, $maxSize = 0) { - return str_replace('src="data/upload', 'onload="setImageSize(this,' . $maxSize . ')" src="data/upload', $content); + if(empty($content)) return $content; + + $readLinkReg = htmlspecialchars(str_replace(array('%fileID%', '/', '?'), array('[0-9]+', '\/', '\?'), helper::createLink('file', 'read', 'fileID=(%fileID%)'))); + + $content = preg_replace('/ src="(' . $readLinkReg . ')" /', ' onload="setImageSize(this,' . $maxSize . ')" src="$1" ', $content); + $content = preg_replace('/ src="{([0-9]+)}" /', ' onload="setImageSize(this,' . $maxSize . ')" src="' . helper::createLink('file', 'read', "fileID=$1") . '" ', $content); + return str_replace(' src="data/upload', ' onload="setImageSize(this,' . $maxSize . ')" src="data/upload', $content); } /** @@ -446,9 +471,10 @@ class fileModel extends model file_put_contents($this->savePath . $file['pathname'], $imageData); $this->dao->insert(TABLE_FILE)->data($file)->exec(); - if($uid) $_SESSION['album'][$uid][] = $this->dao->lastInsertID(); + $fileID = $this->dao->lastInsertID(); + if($uid) $_SESSION['album'][$uid][] = $fileID; - $data = str_replace($out[1][$key], $this->webPath . $file['pathname'], $data); + $data = str_replace($out[1][$key], helper::createLink('file', 'read', "fileID=$fileID"), $data); } return $data; @@ -579,11 +605,13 @@ class fileModel extends model */ public function processEditor($data, $editorList, $uid = '') { - foreach(explode(',', $editorList) as $editorID) + if(is_string($editorList)) $editorList = explode(',', str_replace(' ', '', $editorList)); + $readLinkReg = htmlspecialchars(str_replace(array('%fileID%', $this->app->getWebRoot(), '/', '?'), array('[0-9]+', '', '\/', '\?'), helper::createLink('file', 'read', 'fileID=(%fileID%)'))); + foreach($editorList as $editorID) { - $editorID = trim($editorID); - if(empty($editorID) or !isset($data->$editorID)) continue; + if(empty($editorID) or empty($data->$editorID)) continue; $data->$editorID = $this->pasteImage($data->$editorID, $uid); + $data->$editorID = preg_replace("/ src=\"$readLinkReg\" /", ' src="{$1}" ', $data->$editorID); } return $data; } @@ -707,4 +735,24 @@ class fileModel extends model return !dao::isError(); } } + + /** + * Revert real src. + * + * @param object $data + * @param string $fields + * @access public + * @return object + */ + public function revertRealSRC($data, $fields) + { + if(is_string($fields)) $fields = explode(',', str_replace(' ', '', $fields)); + foreach($fields as $field) + { + if(empty($field) or empty($data->$field)) continue; + $data->$field = preg_replace('/ src="{([0-9]+)}" /', ' src="' . helper::createLink('file', 'read', "fileID=$1") . '" ', $data->$field); + } + return $data; + + } } diff --git a/module/mail/config.php b/module/mail/config.php index 2fbfa040cb..ae527cc61a 100644 --- a/module/mail/config.php +++ b/module/mail/config.php @@ -47,3 +47,9 @@ $config->mail->provider['googlemail.com'] = $config->mail->provider['gmail $config->mail->provider['263.net']['host'] = 'smtp.263.net'; $config->mail->provider['263xmail.com']['host'] = 'smtp.263xmail.com'; + +$config->filterParam->get['mail']['batchdelete']['hold'] = 'idList'; +$config->filterParam->get['mail']['batchdelete']['params']['idList']['reg'] = '/^[0-9\|]+$/'; + +$config->filterParam->cookie['mail']['ztcloud']['hold'] = 'ztCloudLicense'; +$config->filterParam->cookie['mail']['ztcloud']['params']['ztCloudLicense']['equal'] = 'yes'; diff --git a/module/mail/model.php b/module/mail/model.php index 19490a3799..fcc002361d 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -304,7 +304,12 @@ class mailModel extends model $this->clear(); /* Replace full webPath image for mail. */ - if(preg_match('/src="\/?data\/upload/U', $body)) $body = preg_replace('/config->mail, 'domain', common::getSysURL()) . $this->config->webRoot . 'data/upload', $body); + $sysURL = zget($this->config->mail, 'domain', common::getSysURL()); + $readLinkReg = htmlspecialchars(str_replace(array('%fileID%', '/', '?'), array('[0-9]+', '\/', '\?'), helper::createLink('file', 'read', 'fileID=(%fileID%)'))); + + $body = preg_replace('/ src="(' . $readLinkReg . ')" /', ' src="' . $sysURL . '$1" ', $body); + $body = preg_replace('/ src="{([0-9]+)}" /', ' src="' . $sysURL . helper::createLink('file', 'read', "fileID=$1") . '" ', $body); + $body = preg_replace('/config->webRoot . 'data/upload', $body); try { diff --git a/module/misc/config.php b/module/misc/config.php new file mode 100644 index 0000000000..34309b3dc9 --- /dev/null +++ b/module/misc/config.php @@ -0,0 +1,4 @@ +filterParam->get['misc']['checkupdate']['hold'] = 'note,browser'; +$config->filterParam->get['misc']['checkupdate']['params']['note']['reg'] = '/^[a-zA-Z0-9\+\/\=]+$/'; +$config->filterParam->get['misc']['checkupdate']['params']['browser']['code'] = ''; diff --git a/module/misc/control.php b/module/misc/control.php index 1653dc0885..50be5e57d2 100644 --- a/module/misc/control.php +++ b/module/misc/control.php @@ -153,40 +153,6 @@ class misc extends control QRcode::png($loginAPI . $session, false, 4, 9); } - /** - * Check and repair database table. - * - * @param string $type - * @access public - * @return void - */ - public function checkTable($type = 'check') - { - if($type != 'check' and $type != 'repair') die(); - if(!isset($_SESSION['checkFileName'])) - { - $checkFileName = $this->app->getBasePath() . 'www' . DS . uniqid('repair_') . '.txt'; - $this->session->set('checkFileName', $checkFileName); - } - - $checkFileName = $this->session->checkFileName; - $this->view->title = $this->lang->misc->checkTable; - - $status = ''; - if(!file_exists($checkFileName) or (time() - filemtime($checkFileName)) > 60 * 10) $status = 'createFile'; - - if($status == 'createFile') - { - $this->app->loadLang('user'); - $this->view->status = $status; - die($this->display()); - } - - $this->view->tables = $this->misc->getTableAndStatus($type); - $this->view->status = 'check'; - $this->display(); - } - /** * Ajax ignore browser. * diff --git a/module/product/config.php b/module/product/config.php index be14f8dbe0..164900deea 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -84,3 +84,14 @@ $config->product->editor = new stdclass(); $config->product->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); $config->product->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); $config->product->editor->close = array('id' => 'comment', 'tools' => 'simpleTools'); + +$config->filterParam->cookie['product']['common']['hold'] = 'lastProduct,preProductID'; +$config->filterParam->cookie['product']['index']['hold'] = 'preBranch'; +$config->filterParam->cookie['product']['browse']['hold'] = 'preBranch,preProductID,storyModule,productStoryOrder'; +$config->filterParam->cookie['product']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['product']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['product']['index']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['product']['browse']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['product']['browse']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['product']['browse']['params']['storyModule']['int'] = ''; +$config->filterParam->cookie['product']['browse']['params']['productStoryOrder']['reg'] = '/^[a-zA-Z0-9_]+$/'; diff --git a/module/product/model.php b/module/product/model.php index e66c4a3f7d..7099e4d59c 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -180,7 +180,8 @@ class productModel extends model public function getById($productID) { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProduct(); - return $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch(); + $product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch(); + return $this->loadModel('file')->revertRealSRC($product, 'desc'); } /** @@ -225,7 +226,6 @@ class productModel extends model if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProductPairs(); $orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'isClosed'; - $mode .= $this->cookie->productMode; $products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed') ->from(TABLE_PRODUCT) ->where('deleted')->eq(0) @@ -321,7 +321,7 @@ class productModel extends model public function update($productID) { $productID = (int)$productID; - $oldProduct = $this->getById($productID); + $oldProduct = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch(); $product = fixer::input('post') ->setIF($this->post->acl != 'custom', 'whitelist', '') ->join('whitelist', ',') diff --git a/module/productplan/model.php b/module/productplan/model.php index 173b04f20f..b10232e07c 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -24,7 +24,8 @@ class productplanModel extends model public function getByID($planID, $setImgSize = false) { $plan = $this->dao->findByID((int)$planID)->from(TABLE_PRODUCTPLAN)->fetch(); - if($setImgSize) $plan->desc = $this->loadModel('file')->setImgSize($plan->desc); + $plan = $this->loadModel('file')->revertRealSRC($plan, 'desc'); + if($setImgSize) $plan->desc = $this->file->setImgSize($plan->desc); return $plan; } @@ -161,7 +162,7 @@ class productplanModel extends model */ public function update($planID) { - $oldPlan = $this->getById($planID); + $oldPlan = $this->dao->findByID((int)$planID)->from(TABLE_PRODUCTPLAN)->fetch(); $plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags)->remove('delta,uid')->get(); $plan = $this->loadModel('file')->processEditor($plan, $this->config->plan->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_PRODUCTPLAN) diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 32de7f7eb9..67b6e0bad7 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -46,7 +46,7 @@ ?> -
'> +
diff --git a/module/project/config.php b/module/project/config.php index b25686b377..8fd21057a4 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -98,3 +98,15 @@ $config->printKanban->col['wait'] = 2; $config->printKanban->col['doing'] = 3; $config->printKanban->col['done'] = 4; $config->printKanban->col['closed'] = 5; + +$config->filterParam->cookie['project']['common']['hold'] = 'lastProject,projectMode'; +$config->filterParam->cookie['project']['task']['hold'] = 'windowWidth,preProjectID,moduleBrowseParam,productBrowseParam,projectTaskOrder'; +$config->filterParam->cookie['project']['story']['hold'] = 'projectStoryOrder'; +$config->filterParam->cookie['project']['common']['params']['lastProject']['int'] = ''; +$config->filterParam->cookie['project']['common']['params']['projectMode']['code'] = ''; +$config->filterParam->cookie['project']['task']['params']['windowWidth']['int'] = ''; +$config->filterParam->cookie['project']['task']['params']['preProjectID']['int'] = ''; +$config->filterParam->cookie['project']['task']['params']['moduleBrowseParam']['int'] = ''; +$config->filterParam->cookie['project']['task']['params']['productBrowseParam']['int'] = ''; +$config->filterParam->cookie['project']['task']['params']['projectTaskOrder']['reg'] = '/^[a-zA-Z0-9_]+$/'; +$config->filterParam->cookie['project']['story']['params']['projectStoryOrder']['reg'] = '/^[a-zA-Z0-9_]+$/'; diff --git a/module/project/model.php b/module/project/model.php index dd3f7af422..3be1927cdf 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -305,7 +305,7 @@ class projectModel extends model */ public function update($projectID) { - $oldProject = $this->getById($projectID); + $oldProject = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch(); $team = $this->getTeamMemberPairs($projectID); $this->lang->project->team = $this->lang->project->teamname; $projectID = (int)$projectID; @@ -903,7 +903,8 @@ class projectModel extends model $project->totalConsumed = round($total->totalConsumed, 1); $project->totalLeft = round($total->totalLeft, 1); - if($setImgSize) $project->desc = $this->loadModel('file')->setImgSize($project->desc); + $project = $this->loadModel('file')->revertRealSRC($project, 'desc'); + if($setImgSize) $project->desc = $this->file->setImgSize($project->desc); return $project; } diff --git a/module/qa/config.php b/module/qa/config.php new file mode 100644 index 0000000000..93eb313726 --- /dev/null +++ b/module/qa/config.php @@ -0,0 +1,5 @@ +filterParam->cookie['qa']['index']['hold'] = 'preBranch,lastProduct,preProductID'; +$config->filterParam->cookie['qa']['index']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['qa']['index']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['qa']['index']['params']['preProductID']['int'] = ''; diff --git a/module/release/model.php b/module/release/model.php index d47133a334..e8a95d867c 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -33,6 +33,7 @@ class releaseModel extends model if(!$release) return false; $this->loadModel('file'); + $release = $this->file->revertRealSRC($release, 'desc'); $release->files = $this->file->getByObject('release', $releaseID); if(empty($release->files))$release->files = $this->file->getByObject('build', $release->buildID); if($setImgSize) $release->desc = $this->file->setImgSize($release->desc); @@ -159,7 +160,7 @@ class releaseModel extends model */ public function update($releaseID) { - $oldRelease = $this->getByID($releaseID); + $oldRelease = $this->dao->select('*')->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch(); $branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq($this->post->build)->fetch('branch'); $release = fixer::input('post')->stripTags($this->config->release->editor->edit['id'], $this->config->allowedTags) diff --git a/module/search/model.php b/module/search/model.php index 0780a350e4..18538a2c5a 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -212,7 +212,7 @@ class searchModel extends model } else { - $params[$fieldName]['values'] = $params[$fieldName]['values'] + array('null' => $this->lang->search->null); + $params[$fieldName]['values'] = $params[$fieldName]['values'] + array('null' => $this->lang->search->null); } } } diff --git a/module/sso/config.php b/module/sso/config.php index b3d9bbc7f3..06f87e37d8 100644 --- a/module/sso/config.php +++ b/module/sso/config.php @@ -1 +1,16 @@ filterParam->get['sso']['login']['hold'] = 'referer,token,status,data,md5'; +$config->filterParam->get['sso']['logout']['hold'] = 'token,status'; +$config->filterParam->get['sso']['getuserpairs']['hold'] = 'hash'; +$config->filterParam->get['sso']['getbindusers']['hold'] = 'hash'; +$config->filterParam->get['sso']['gettodolist']['hold'] = 'hash'; +$config->filterParam->get['sso']['login']['params']['referer']['reg'] = '/^[a-zA-Z0-9\+\/\=]+$/'; +$config->filterParam->get['sso']['login']['params']['token']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['sso']['login']['params']['status']['code'] = ''; +$config->filterParam->get['sso']['login']['params']['data']['reg'] = '/^[a-zA-Z0-9\+\/\=]+$/'; +$config->filterParam->get['sso']['login']['params']['md5']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['sso']['logout']['params']['token']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['sso']['logout']['params']['status']['code'] = ''; +$config->filterParam->get['sso']['getuserpairs']['params']['hash']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['sso']['getbindusers']['params']['hash']['reg'] = '/^[a-z0-9]{32}$/'; +$config->filterParam->get['sso']['gettodolist']['params']['hash']['reg'] = '/^[a-z0-9]{32}$/'; diff --git a/module/story/config.php b/module/story/config.php index 54ddb6f137..7b36832a89 100644 --- a/module/story/config.php +++ b/module/story/config.php @@ -161,3 +161,6 @@ $config->story->datatable->fieldList['branch']['title'] = 'branch'; $config->story->datatable->fieldList['branch']['fixed'] = 'left'; $config->story->datatable->fieldList['branch']['width'] = '100'; $config->story->datatable->fieldList['branch']['required'] = 'no'; + +$config->filterParam->cookie['story']['export']['hold'] = 'checkedItem'; +$config->filterParam->cookie['story']['export']['params']['checkedItem']['reg'] = '/^[0-9,]+$/'; diff --git a/module/story/model.php b/module/story/model.php index 602daef05c..c60dc95510 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1,4 +1,4 @@ -spec = isset($spec->spec) ? $spec->spec : ''; $story->verify = isset($spec->verify) ? $spec->verify : ''; - if($setImgSize) $story->spec = $this->loadModel('file')->setImgSize($story->spec); + $story = $this->loadModel('file')->revertRealSRC($story, 'spec,verify'); + if($setImgSize) $story->spec = $this->file->setImgSize($story->spec); if($setImgSize) $story->verify = $this->file->setImgSize($story->verify); $story->projects = $this->dao->select('t1.project, t2.name, t2.status')->from(TABLE_PROJECTSTORY)->alias('t1') @@ -326,8 +327,8 @@ class storyModel extends model { $this->dao->insert(TABLE_FILE)->data($file)->exec(); - $url = $this->file->webPath . $file['pathname']; - $specData->spec .= ''; + $fileID = $this->dao->lastInsertID(); + $specData->spec .= ''; } else { @@ -370,8 +371,8 @@ class storyModel extends model public function change($storyID) { $specChanged = false; - $oldStory = $this->getById($storyID); - if(isset($_POST['lastEditedDate']) and $oldStory->lastEditedDate != $this->post->lastEditedDate) + $oldStory = $this->dao->findById((int)$storyID)->from(TABLE_STORY)->fetch(); + if(!empty($_POST['lastEditedDate']) and $oldStory->lastEditedDate != $this->post->lastEditedDate) { dao::$errors[] = $this->lang->error->editedByOther; return false; @@ -435,8 +436,8 @@ class storyModel extends model public function update($storyID) { $now = helper::now(); - $oldStory = $this->getById($storyID); - if(isset($_POST['lastEditedDate']) and $oldStory->lastEditedDate != $this->post->lastEditedDate) + $oldStory = $this->dao->select('*')->from(TABLE_STORY)->where('id')->eq($storyID)->fetch(); + if(!empty($_POST['lastEditedDate']) and $oldStory->lastEditedDate != $this->post->lastEditedDate) { dao::$errors[] = $this->lang->error->editedByOther; return false; diff --git a/module/task/config.php b/module/task/config.php index 3c235ccdd7..cb97305df5 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -183,3 +183,6 @@ $config->task->datatable->fieldList['actions']['title'] = 'actions'; $config->task->datatable->fieldList['actions']['fixed'] = 'right'; $config->task->datatable->fieldList['actions']['width'] = '140'; $config->task->datatable->fieldList['actions']['required'] = 'yes'; + +$config->filterParam->cookie['task']['export']['hold'] = 'checkedItem'; +$config->filterParam->cookie['task']['export']['params']['checkedItem']['reg'] = '/^[0-9,]+$/'; diff --git a/module/task/model.php b/module/task/model.php index 6dc82ba430..4ffd779a06 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -194,8 +194,8 @@ class taskModel extends model */ public function update($taskID) { - $oldTask = $this->getById($taskID); - if(isset($_POST['lastEditedDate']) and $oldTask->lastEditedDate != $this->post->lastEditedDate) + $oldTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq((int)$taskID)->fetch(); + if(!empty($_POST['lastEditedDate']) and $oldTask->lastEditedDate != $this->post->lastEditedDate) { dao::$errors[] = $this->lang->error->editedByOther; return false; @@ -313,9 +313,10 @@ class taskModel extends model } /* Initialize tasks from the post data.*/ + $oldTasks = $taskIDList ? $this->getByList($taskIDList) : array(); foreach($taskIDList as $taskID) { - $oldTask = $this->getById($taskID); + $oldTask = $oldTasks[$taskID]; $task = new stdclass(); $task->color = $data->colors[$taskID]; @@ -807,13 +808,15 @@ class taskModel extends model ->where('t1.id')->eq((int)$taskID) ->fetch(); if(!$task) return false; - if($setImgSize) $task->desc = $this->loadModel('file')->setImgSize($task->desc); + + $task = $this->loadModel('file')->revertRealSRC($task, 'desc'); + if($setImgSize) $task->desc = $this->file->setImgSize($task->desc); if($task->assignedTo == 'closed') $task->assignedToRealName = 'Closed'; foreach($task as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $task->$key = ''; $task->files = $this->loadModel('file')->getByObject('task', $taskID); /* Get related test cases. */ - if($task->story) $task->cases = $this->dao->select('id, title')->from(TABLE_CASE)->where('story')->eq($task->story)->andWhere('storyVersion')->eq($task->storyVersion)->fetchPairs(); + if($task->story) $task->cases = $this->dao->select('id, title')->from(TABLE_CASE)->where('story')->eq($task->story)->andWhere('storyVersion')->eq($task->storyVersion)->andWhere('deleted')->eq('0')->fetchPairs(); return $this->processTask($task); } diff --git a/module/testcase/config.php b/module/testcase/config.php index e7853dd740..3438a4faa5 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -164,3 +164,15 @@ $config->testcase->datatable->fieldList['stepNumber']['fixed'] = 'no'; $config->testcase->datatable->fieldList['stepNumber']['width'] = '80'; $config->testcase->datatable->fieldList['stepNumber']['required'] = 'no'; $config->testcase->datatable->fieldList['stepNumber']['sort'] = 'no'; + +$config->filterParam->cookie['testcase']['common']['hold'] = 'lastProduct,preProductID'; +$config->filterParam->cookie['testcase']['browse']['hold'] = 'preBranch,caseModule,caseSuite'; +$config->filterParam->cookie['testcase']['groupcase']['hold'] = 'preBranch'; +$config->filterParam->cookie['testcase']['export']['hold'] = 'checkedItem'; +$config->filterParam->cookie['testcase']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['testcase']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['testcase']['browse']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['testcase']['browse']['params']['caseModule']['int'] = ''; +$config->filterParam->cookie['testcase']['browse']['params']['caseSuite']['int'] = ''; +$config->filterParam->cookie['testcase']['groupcase']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['testcase']['export']['params']['checkedItem']['reg'] = '/^[0-9,]+$/'; diff --git a/module/testcase/model.php b/module/testcase/model.php index 0959b04271..ad20e47269 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -510,8 +510,8 @@ class testcaseModel extends model */ public function update($caseID) { - $oldCase = $this->getById($caseID); - if(isset($_POST['lastEditedDate']) and $oldCase->lastEditedDate != $this->post->lastEditedDate) + $oldCase = $this->getById($caseID); + if(!empty($_POST['lastEditedDate']) and $oldCase->lastEditedDate != $this->post->lastEditedDate) { dao::$errors[] = $this->lang->error->editedByOther; return false; diff --git a/module/testreport/config.php b/module/testreport/config.php index 1d68e71a97..39bcbedabb 100644 --- a/module/testreport/config.php +++ b/module/testreport/config.php @@ -8,3 +8,9 @@ $config->testreport->edit->requiredFields = 'title,owner'; $config->testreport->editor = new stdclass(); $config->testreport->editor->create = array('id' => 'report', 'tools' => 'simpleTools'); $config->testreport->editor->edit = array('id' => 'report', 'tools' => 'simpleTools'); + +$config->filterParam->cookie['testreport']['common']['hold'] = 'lastProduct,preProductID,projectMode,lastProject'; +$config->filterParam->cookie['testreport']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['testreport']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['testreport']['common']['params']['lastProject']['int'] = ''; +$config->filterParam->cookie['testreport']['common']['params']['projectMode']['code'] = ''; diff --git a/module/testreport/model.php b/module/testreport/model.php index fcdc114cb3..2ab9836681 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -89,6 +89,8 @@ class testreportModel extends model ->join('members', ',') ->remove('files,labels,uid') ->get(); + + $data = $this->loadModel('file')->processEditor($date, $this->config->testreport->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_TESTREPORT)->data($data)->autocheck() ->batchCheck($this->config->testreport->create->requiredFields, 'notempty') ->batchCheck('start,end', 'notempty') @@ -96,7 +98,7 @@ class testreportModel extends model ->exec(); if(dao::isError()) return false; $reportID = $this->dao->lastInsertID(); - $this->loadModel('file')->updateObjectID($this->post->uid, $reportID, 'testreport'); + $this->file->updateObjectID($this->post->uid, $reportID, 'testreport'); $this->file->saveUpload('testreport', $reportID); return $reportID; } @@ -120,6 +122,7 @@ class testreportModel extends model ->join('members', ',') ->remove('files,labels,uid') ->get(); + $data = $this->loadModel('file')->processEditor($date, $this->config->testreport->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_TESTREPORT)->data($data)->autocheck() ->batchCheck($this->config->testreport->edit->requiredFields, 'notempty') ->batchCheck('start,end', 'notempty') @@ -128,7 +131,7 @@ class testreportModel extends model ->exec(); if(dao::isError()) return false; - $this->loadModel('file')->updateObjectID($this->post->uid, $reportID, 'testreport'); + $this->file->updateObjectID($this->post->uid, $reportID, 'testreport'); return common::createChanges($report, $data); } @@ -142,7 +145,8 @@ class testreportModel extends model public function getById($reportID) { $report = $this->dao->select('*')->from(TABLE_TESTREPORT)->where('id')->eq($reportID)->fetch(); - $report->files = $this->loadModel('file')->getByObject('testreport', $reportID); + $report = $this->loadModel('file')->revertRealSRC($report, 'report'); + $report->files = $this->file->getByObject('testreport', $reportID); return $report; } diff --git a/module/testsuite/config.php b/module/testsuite/config.php index 4d20c4b2ad..10dc6093b5 100644 --- a/module/testsuite/config.php +++ b/module/testsuite/config.php @@ -16,3 +16,11 @@ $config->testsuite->editor->createlib = array('id' => 'desc', 'tools' => 'simple $config->testsuite->datatable = new stdclass(); $config->testsuite->datatable->defaultField = array('id', 'pri', 'title', 'type', 'assignedTo', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'bugs', 'results', 'actions'); + +$config->filterParam->cookie['testsuite']['common']['hold'] = 'lastCaseLib,lastProduct,preProductID'; +$config->filterParam->cookie['testsuite']['library']['hold'] = 'preCaseLibID,libCaseModule'; +$config->filterParam->cookie['testsuite']['common']['params']['lastCaseLib']['int'] = ''; +$config->filterParam->cookie['testsuite']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['testsuite']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['testsuite']['library']['params']['preCaseLibID']['int'] = ''; +$config->filterParam->cookie['testsuite']['library']['params']['libCaseModule']['int'] = ''; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index a716f5b174..670a726735 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -177,7 +177,8 @@ class testsuiteModel extends model public function getById($suiteID, $setImgSize = false) { $suite = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch(); - if($setImgSize) $suite->desc = $this->loadModel('file')->setImgSize($suite->desc); + $suite = $this->loadModel('file')->revertRealSRC($suite, 'desc'); + if($setImgSize) $suite->desc = $this->file->setImgSize($suite->desc); return $suite; } @@ -190,7 +191,7 @@ class testsuiteModel extends model */ public function update($suiteID) { - $oldSuite = $this->getById($suiteID); + $oldSuite = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch(); $suite = fixer::input('post') ->stripTags($this->config->testsuite->editor->edit['id'], $this->config->allowedTags) ->add('lastEditedBy', $this->app->user->account) diff --git a/module/testtask/config.php b/module/testtask/config.php index e56adeac74..8027bbc52a 100644 --- a/module/testtask/config.php +++ b/module/testtask/config.php @@ -16,3 +16,12 @@ $config->testtask->editor->activate= array('id' => 'comment', 'tools' => 'simple $config->testtask->datatable = new stdclass(); $config->testtask->datatable->defaultField = array('id', 'pri', 'title', 'type', 'assignedTo', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'bugs', 'results', 'actions'); + +$config->filterParam->cookie['testtask']['common']['hold'] = 'lastProduct,preProductID'; +$config->filterParam->cookie['testtask']['browse']['hold'] = 'preBranch'; +$config->filterParam->cookie['testtask']['cases']['hold'] = 'preProductID,taskCaseModule'; +$config->filterParam->cookie['testtask']['common']['params']['lastProduct']['int'] = ''; +$config->filterParam->cookie['testtask']['common']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['testtask']['browse']['params']['preBranch']['int'] = ''; +$config->filterParam->cookie['testtask']['cases']['params']['preProductID']['int'] = ''; +$config->filterParam->cookie['testtask']['cases']['params']['taskCaseModule']['int'] = ''; diff --git a/module/testtask/model.php b/module/testtask/model.php index 668e30c6ee..3e9de631ab 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -186,6 +186,7 @@ class testtaskModel extends model ->where('t1.id')->eq((int)$taskID) ->andWhere('t5.product = t1.product') ->fetch(); + $task = $this->loadModel('file')->revertRealSRC($task, 'desc'); if($setImgSize) $task->desc = $this->loadModel('file')->setImgSize($task->desc); return $task; } @@ -518,7 +519,7 @@ class testtaskModel extends model */ public function update($taskID) { - $oldTask = $this->getById($taskID); + $oldTask = $this->dao->select("*")->from(TABLE_TESTTASK)->where('id')->eq((int)$taskID)->fetch(); $task = fixer::input('post')->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)->join('mailto', ',')->remove('uid')->get(); $task = $this->loadModel('file')->processEditor($task, $this->config->testtask->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_TESTTASK)->data($task) diff --git a/module/todo/config.php b/module/todo/config.php index 6ee664628b..34e81b43e6 100644 --- a/module/todo/config.php +++ b/module/todo/config.php @@ -25,3 +25,6 @@ $config->todo->list->customBatchEditFields = 'type,pri,desc,beginAndEnd,status $config->todo->custom = new stdclass(); $config->todo->custom->batchCreateFields = 'type,pri,desc,beginAndEnd'; $config->todo->custom->batchEditFields = 'type,pri,beginAndEnd,status'; + +$config->filterParam->cookie['todo']['export']['hold'] = 'checkedItem'; +$config->filterParam->cookie['todo']['export']['params']['checkedItem']['reg'] = '/^[0-9,]+$/'; diff --git a/module/todo/model.php b/module/todo/model.php index c8ac69d1de..81dcec6dc8 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -114,7 +114,7 @@ class todoModel extends model */ public function update($todoID) { - $oldTodo = $this->getById($todoID); + $oldTodo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch(); if($oldTodo->type == 'bug' or $oldTodo->type == 'task') $oldTodo->name = ''; $todo = fixer::input('post') ->cleanInt('date, pri, begin, end, private') @@ -171,9 +171,10 @@ class todoModel extends model $todos[$todoID] = $todo; } + $oldTodos = $this->dao->select('*')->from(TABLE_TODO)->where('id')->in(array_keys($todos))->fetchAll('id'); foreach($todos as $todoID => $todo) { - $oldTodo = $this->getById($todoID); + $oldTodo = $oldTodos[$todoID]; if($oldTodo->type == 'bug' or $oldTodo->type == 'task') $oldTodo->name = ''; $this->dao->update(TABLE_TODO)->data($todo) ->autoCheck() @@ -226,7 +227,8 @@ class todoModel extends model { $todo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch(); if(!$todo) return false; - if($setImgSize) $todo->desc = $this->loadModel('file')->setImgSize($todo->desc); + $todo = $this->loadModel('file')->revertRealSRC($todo, 'desc'); + if($setImgSize) $todo->desc = $this->file->setImgSize($todo->desc); if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); $todo->date = str_replace('-', '', $todo->date); diff --git a/module/upgrade/config.php b/module/upgrade/config.php index 0086b916b3..4794c72833 100644 --- a/module/upgrade/config.php +++ b/module/upgrade/config.php @@ -16,3 +16,6 @@ $config->upgrade->lowerTables[$config->db->prefix . 'userContact'] = $config- $config->upgrade->lowerTables[$config->db->prefix . 'userGroup'] = $config->db->prefix . 'usergroup'; $config->upgrade->lowerTables[$config->db->prefix . 'userQuery'] = $config->db->prefix . 'userquery'; $config->upgrade->lowerTables[$config->db->prefix . 'userTPL'] = $config->db->prefix . 'usertpl'; + +$config->filterParam->get['upgrade']['license']['hold'] = 'agree'; +$config->filterParam->get['upgrade']['license']['params']['agree']['equal'] = 'true'; diff --git a/module/user/config.php b/module/user/config.php index eedb75b09b..478ad7f804 100644 --- a/module/user/config.php +++ b/module/user/config.php @@ -16,3 +16,11 @@ $config->user->custom->batchEditFields = 'dept,join,email,commiter'; $config->user->failTimes = 6; $config->user->lockMinutes = 10; $config->user->batchCreate = 10; + +$config->filterParam->get['user']['login']['hold'] = 'account,password,lang'; +$config->filterParam->get['user']['login']['params']['account']['account'] = ''; +$config->filterParam->get['user']['login']['params']['password']['reg'] = '/./'; +$config->filterParam->get['user']['login']['params']['lang']['reg'] = '/^[a-zA-Z\-_]+$/'; + +$config->filterParam->cookie['user']['login']['hold'] = 'keepLogin'; +$config->filterParam->cookie['user']['login']['params']['keepLogin']['equal'] = 'on';