Skip to content
Permalink
Browse files Browse the repository at this point in the history
refactoring for security (www.ackcent.com)
  • Loading branch information
fmancardi committed Feb 5, 2020
1 parent d99bd82 commit 58f3cc0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 32 deletions.
14 changes: 7 additions & 7 deletions lib/functions/testPlanUrgency.class.php
Expand Up @@ -5,12 +5,10 @@
*
* @package TestLink
* @author Martin Havlat
* @copyright 2007-2014, TestLink community
* @copyright 2007-2020, TestLink community
* @filesource testPlanUrgency.class.php
* @link http://www.testlink.org
*
* @internal revisions
* @since 1.9.13
*/

/**
Expand All @@ -34,16 +32,18 @@ class testPlanUrgency extends testplan
*/
public function setTestUrgency($testplan_id, $tc_id, $urgency)
{
$sql = " UPDATE {$this->tables['testplan_tcversions']} SET urgency={$urgency} " .
" WHERE testplan_id=" . $this->db->prepare_int($testplan_id) .
$sql = " UPDATE {$this->tables['testplan_tcversions']}
SET urgency="
. $this->db->prepare_int($urgency) .
" WHERE testplan_id="
. $this->db->prepare_int($testplan_id) .
" AND tcversion_id=" . $this->db->prepare_int($tc_id);

$result = $this->db->exec_query($sql);

return $result ? tl::OK : tl::ERROR;
}



/**
* Set urgency for TCs (direct child only) within a Test Suite and Test Plan
*
Expand Down
38 changes: 13 additions & 25 deletions lib/plan/planUrgency.php
Expand Up @@ -7,29 +7,26 @@
* @filesource planUrgency.php
* @package TestLink
* @author Martin Havlat
* @copyright 2003-2014, TestLink community
* @copyright 2003-2020, TestLink community
* @link http://www.testlink.org
*
* @internal revisions
* @since 1.9.13
**/

require('../../config.inc.php');
require_once('common.php');
testlinkInitPage($db,false,false,"checkRights");
$args = init_args();

if($args->show_help)
{
if ($args->show_help) {
show_instructions('test_urgency');
exit();
}

$templateCfg = templateConfiguration();
$tplan_mgr = new testPlanUrgency($db);
$gui = initializeGui($args,$tplan_mgr->tree_manager);

if( $args->urgency != OFF || isset($args->urgency_tc) )
{
if ($args->urgency != OFF || isset($args->urgency_tc)){
$gui->user_feedback = doProcess($args,$tplan_mgr);
}

Expand Down Expand Up @@ -80,26 +77,18 @@ function init_args()

// Sets urgency for suite

if (isset($_REQUEST['high_urgency']))
{
if (isset($_REQUEST['high_urgency'])) {
$args->urgency = HIGH;
}
elseif (isset($_REQUEST['medium_urgency']))
{
} elseif (isset($_REQUEST['medium_urgency'])) {
$args->urgency = MEDIUM;
}
elseif (isset($_REQUEST['low_urgency']))
{
} elseif (isset($_REQUEST['low_urgency'])) {
$args->urgency = LOW;
}
else
{
} else {
$args->urgency = OFF;
}

// Sets urgency for every single tc
if (isset($_REQUEST['urgency']))
{
if (isset($_REQUEST['urgency'])) {
$args->urgency_tc = $_REQUEST['urgency'];
}

Expand Down Expand Up @@ -151,11 +140,10 @@ function doProcess(&$argsObj,&$tplanMgr)
}

// Set urgency for individual testcases
if(isset($argsObj->urgency_tc))
{
foreach ($argsObj->urgency_tc as $id => $urgency)
{
$tplanMgr->setTestUrgency($argsObj->tplan_id, $id, $urgency);
if (isset($argsObj->urgency_tc)) {
foreach ($argsObj->urgency_tc as $id => $urgency) {
$tplanMgr->setTestUrgency($argsObj->tplan_id,
intval($id), intval($urgency));
}
}

Expand Down

0 comments on commit 58f3cc0

Please sign in to comment.