* fix bug for WooYun-2016-218351.

This commit is contained in:
wangyidong
2016-06-28 13:36:00 +08:00
parent d3915c1dd0
commit 234a3466a2
5 changed files with 56 additions and 51 deletions
+3 -2
View File
@@ -237,14 +237,15 @@ class buildModel extends model
public function updateLinkedBug($build)
{
$bugs = empty($build->bugs) ? '' : $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($build->bugs)->fetchAll();
$data = fixer::input('post')->get();
$now = helper::now();
$resolvedPairs = array();
if(isset($_POST['bugs']))
{
foreach($this->post->bugs as $key => $bugID)
foreach($data->bugs as $key => $bugID)
{
if(isset($_POST['resolvedBy'][$key]))$resolvedPairs[$bugID] = $this->post->resolvedBy[$key];
if(isset($_POST['resolvedBy'][$key]))$resolvedPairs[$bugID] = $data->resolvedBy[$key];
}
}
+11 -10
View File
@@ -292,19 +292,20 @@ class productModel extends model
{
$products = array();
$allChanges = array();
$data = fixer::input('post')->get();
$oldProducts = $this->getByIdList($this->post->productIDList);
foreach($this->post->productIDList as $productID)
foreach($data->productIDList as $productID)
{
$products[$productID] = new stdClass();
$products[$productID]->name = $this->post->names[$productID];
$products[$productID]->code = $this->post->codes[$productID];
$products[$productID]->PO = $this->post->POs[$productID];
$products[$productID]->QD = $this->post->QDs[$productID];
$products[$productID]->RD = $this->post->RDs[$productID];
$products[$productID]->type = $this->post->types[$productID];
$products[$productID]->status = $this->post->statuses[$productID];
$products[$productID]->desc = $this->post->descs[$productID];
$products[$productID]->order = $this->post->orders[$productID];
$products[$productID]->name = $data->names[$productID];
$products[$productID]->code = $data->codes[$productID];
$products[$productID]->PO = $data->POs[$productID];
$products[$productID]->QD = $data->QDs[$productID];
$products[$productID]->RD = $data->RDs[$productID];
$products[$productID]->type = $data->types[$productID];
$products[$productID]->status = $data->statuses[$productID];
$products[$productID]->desc = $data->descs[$productID];
$products[$productID]->order = $data->orders[$productID];
}
foreach($products as $productID => $product)
+17 -16
View File
@@ -335,24 +335,25 @@ class projectModel extends model
{
$projects = array();
$allChanges = array();
$data = fixer::input('post')->get();
$oldProjects = $this->getByIdList($this->post->projectIDList);
foreach($this->post->projectIDList as $projectID)
foreach($data->projectIDList as $projectID)
{
$projects[$projectID] = new stdClass();
$projects[$projectID]->name = $this->post->names[$projectID];
$projects[$projectID]->code = $this->post->codes[$projectID];
$projects[$projectID]->PM = $this->post->PMs[$projectID];
$projects[$projectID]->PO = $this->post->POs[$projectID];
$projects[$projectID]->QD = $this->post->QDs[$projectID];
$projects[$projectID]->RD = $this->post->RDs[$projectID];
$projects[$projectID]->type = $this->post->types[$projectID];
$projects[$projectID]->status = $this->post->statuses[$projectID];
$projects[$projectID]->begin = $this->post->begins[$projectID];
$projects[$projectID]->end = $this->post->ends[$projectID];
$projects[$projectID]->team = $this->post->teams[$projectID];
$projects[$projectID]->desc = $this->post->descs[$projectID];
$projects[$projectID]->days = $this->post->dayses[$projectID];
$projects[$projectID]->order = $this->post->orders[$projectID];
$projects[$projectID]->name = $data->names[$projectID];
$projects[$projectID]->code = $data->codes[$projectID];
$projects[$projectID]->PM = $data->PMs[$projectID];
$projects[$projectID]->PO = $data->POs[$projectID];
$projects[$projectID]->QD = $data->QDs[$projectID];
$projects[$projectID]->RD = $data->RDs[$projectID];
$projects[$projectID]->type = $data->types[$projectID];
$projects[$projectID]->status = $data->statuses[$projectID];
$projects[$projectID]->begin = $data->begins[$projectID];
$projects[$projectID]->end = $data->ends[$projectID];
$projects[$projectID]->team = $data->teams[$projectID];
$projects[$projectID]->desc = $data->descs[$projectID];
$projects[$projectID]->days = $data->dayses[$projectID];
$projects[$projectID]->order = $data->orders[$projectID];
}
foreach($projects as $projectID => $project)
@@ -1238,7 +1239,7 @@ class projectModel extends model
$versions = $this->loadModel('story')->getVersions($this->post->stories);
foreach($this->post->stories as $key => $storyID)
{
$productID = $this->post->products[$storyID];
$productID = (int)$this->post->products[$storyID];
$data = new stdclass();
$data->project = $projectID;
$data->product = $productID;
+5 -4
View File
@@ -734,7 +734,8 @@ class storyModel extends model
$stories = array();
$allChanges = array();
$now = helper::now();
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
$data = fixer::input('post')->get();
$storyIDList = $data->storyIDList ? $data->storyIDList : array();
/* Adjust whether the post data is complete, if not, remove the last element of $storyIDList. */
if($this->session->showSuhosinInfo) array_pop($storyIDList);
@@ -753,9 +754,9 @@ class storyModel extends model
$story->assignedDate = $now;
$story->status = 'closed';
$story->closedReason = $this->post->closedReasons[$storyID];
$story->duplicateStory = $this->post->duplicateStoryIDList[$storyID] ? $this->post->duplicateStoryIDList[$storyID] : $oldStory->duplicateStory;
$story->childStories = $this->post->childStoriesIDList[$storyID] ? $this->post->childStoriesIDList[$storyID] : $oldStory->childStories;
$story->closedReason = $data->closedReasons[$storyID];
$story->duplicateStory = $data->duplicateStoryIDList[$storyID] ? $data->duplicateStoryIDList[$storyID] : $oldStory->duplicateStory;
$story->childStories = $data->childStoriesIDList[$storyID] ? $data->childStoriesIDList[$storyID] : $oldStory->childStories;
if($story->closedReason == 'done') $story->stage = 'released';
if($story->closedReason != 'done') $story->plan = 0;
+20 -19
View File
@@ -427,30 +427,31 @@ class userModel extends model
*/
public function batchEdit()
{
if(empty($_POST['verifyPassword']) or md5($this->post->verifyPassword) != $this->app->user->password) die(js::alert($this->lang->user->error->verifyPassword));
$data = fixer::input('post')->get();
if(empty($_POST['verifyPassword']) or md5($data->verifyPassword) != $this->app->user->password) die(js::alert($this->lang->user->error->verifyPassword));
$oldUsers = $this->dao->select('id, account, email')->from(TABLE_USER)->where('id')->in(array_keys($this->post->account))->fetchAll('id');
$accountGroup = $this->dao->select('id, account')->from(TABLE_USER)->where('account')->in($this->post->account)->fetchGroup('account', 'id');
$oldUsers = $this->dao->select('id, account, email')->from(TABLE_USER)->where('id')->in(array_keys($data->account))->fetchAll('id');
$accountGroup = $this->dao->select('id, account')->from(TABLE_USER)->where('account')->in($data->account)->fetchGroup('account', 'id');
$accounts = array();
foreach($this->post->account as $id => $account)
foreach($data->account as $id => $account)
{
$users[$id]['account'] = $account;
$users[$id]['realname'] = $this->post->realname[$id];
$users[$id]['commiter'] = $this->post->commiter[$id];
$users[$id]['email'] = $this->post->email[$id];
$users[$id]['join'] = $this->post->join[$id];
$users[$id]['skype'] = $this->post->skype[$id];
$users[$id]['qq'] = $this->post->qq[$id];
$users[$id]['yahoo'] = $this->post->yahoo[$id];
$users[$id]['gtalk'] = $this->post->gtalk[$id];
$users[$id]['wangwang'] = $this->post->wangwang[$id];
$users[$id]['mobile'] = $this->post->mobile[$id];
$users[$id]['phone'] = $this->post->phone[$id];
$users[$id]['address'] = $this->post->address[$id];
$users[$id]['zipcode'] = $this->post->zipcode[$id];
$users[$id]['dept'] = $this->post->dept[$id] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $this->post->dept[$id];
$users[$id]['role'] = $this->post->role[$id] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : 0) : $this->post->role[$id];
$users[$id]['realname'] = $data->realname[$id];
$users[$id]['commiter'] = $data->commiter[$id];
$users[$id]['email'] = $data->email[$id];
$users[$id]['join'] = $data->join[$id];
$users[$id]['skype'] = $data->skype[$id];
$users[$id]['qq'] = $data->qq[$id];
$users[$id]['yahoo'] = $data->yahoo[$id];
$users[$id]['gtalk'] = $data->gtalk[$id];
$users[$id]['wangwang'] = $data->wangwang[$id];
$users[$id]['mobile'] = $data->mobile[$id];
$users[$id]['phone'] = $data->phone[$id];
$users[$id]['address'] = $data->address[$id];
$users[$id]['zipcode'] = $data->zipcode[$id];
$users[$id]['dept'] = $data->dept[$id] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $data->dept[$id];
$users[$id]['role'] = $data->role[$id] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : 0) : $data->role[$id];
if(isset($accountGroup[$account]) and count($accountGroup[$account]) > 1) die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));
if(in_array($account, $accounts)) die(js::error(sprintf($this->lang->user->error->accountDupl, $id)));