Code cleanup: proper usage of the ReadParam function.

SVN:trunk[814]
This commit is contained in:
Denis Flaven
2010-09-10 14:11:30 +00:00
parent 3cc9d99aca
commit f120e21e00
5 changed files with 26 additions and 25 deletions

View File

@@ -239,8 +239,8 @@ EOF
{
case 'form':
// iTop standard mode: form based authentication
$sAuthUser = utils::ReadParam('auth_user', '', 'post');
$sAuthPwd = utils::ReadParam('auth_pwd', '', 'post');
$sAuthUser = utils::ReadPostedParam('auth_user', '');
$sAuthPwd = utils::ReadPostedParam('auth_pwd', '');
if ($sAuthUser != '')
{
$sLoginMode = 'form';
@@ -280,10 +280,10 @@ EOF
case 'url':
// Credentials passed directly in the url
$sAuthUser = utils::ReadParam('auth_user', '', 'get');
$sAuthUser = utils::ReadParam('auth_user', '');
if ($sAuthUser != '')
{
$sAuthPwd = utils::ReadParam('auth_pwd', '', 'post');
$sAuthPwd = utils::ReadParam('auth_pwd', '');
$sLoginMode = 'url';
}
break;

View File

@@ -1289,17 +1289,17 @@ EOF
break;
case 'do_modify_links':
$aLinks = utils::ReadParam('linkId', array(), 'post');
$sLinksToRemove = trim(utils::ReadParam('linksToRemove', '', 'post'));
$aLinks = utils::ReadPostedParam('linkId', array());
$sLinksToRemove = trim(utils::ReadPostedParam('linksToRemove', ''));
$aLinksToRemove = array();
if (!empty($sLinksToRemove))
{
$aLinksToRemove = explode(' ', trim($sLinksToRemove));
}
$sClass = utils::ReadParam('class', '', 'post');
$sLinkageAtt = utils::ReadParam('linkage', '', 'post');
$iObjectId = utils::ReadParam('object_id', '', 'post');
$sLinkingAttCode = utils::ReadParam('linking_attcode', '', 'post');
$sClass = utils::ReadPostedParam('class', '');
$sLinkageAtt = utils::ReadPostedParam('linkage', '');
$iObjectId = utils::ReadPostedParam('object_id', '');
$sLinkingAttCode = utils::ReadPostedParam('linking_attcode', '');
$oMyChange = MetaModel::NewObject("CMDBChange");
$oMyChange->Set("date", time());
if (UserRights::IsImpersonated())

View File

@@ -49,9 +49,9 @@ switch($operation)
case 'addObjects':
require_once('../application/uilinkswizard.class.inc.php');
$sClass = utils::ReadParam('class', '', 'get');
$sLinkedClass = utils::ReadParam('linkedClass', '', 'get');
$sLinkageAttr = utils::ReadParam('linkageAttr', '', 'get');
$iObjectId = utils::ReadParam('objectId', '', 'get');
$sLinkedClass = utils::ReadParam('linkedClass', '');
$sLinkageAttr = utils::ReadParam('linkageAttr', '');
$iObjectId = utils::ReadParam('objectId', '');
$oLinksWizard = new UILinksWizard($sClass, $sLinkageAttr, $iObjectId, $sLinkedClass);
$oLinksWizard->DisplayAddForm($oPage);
break;
@@ -72,13 +72,13 @@ switch($operation)
$sAttCode = utils::ReadParam('sAttCode', '');
$iInputId = utils::ReadParam('iInputId', '');
$sSuffix = utils::ReadParam('sSuffix', '');
$aLinkedObjectIds = utils::ReadParam('selectObject', array(), 'get');
$aLinkedObjectIds = utils::ReadParam('selectObject', array());
$oWidget = new UILinksWidget($sClass, $sAttCode, $iInputId, $sSuffix);
$oWidget->DoAddObjects($oPage, $aLinkedObjectIds);
break;
case 'wizard_helper_preview':
$sJson = utils::ReadParam('json_obj', '', 'post');
$sJson = utils::ReadParam('json_obj', '');
$oWizardHelper = WizardHelper::FromJSON($sJson);
$oObj = $oWizardHelper->GetTargetObject();
$oObj->DisplayBareProperties($oPage);
@@ -323,8 +323,8 @@ switch($operation)
break;
case 'set_pref':
$sCode = utils::ReadParam('code', '', 'post');
$sValue = utils::ReadParam('value', '', 'post');
$sCode = utils::ReadPostedParam('code', '');
$sValue = utils::ReadPostedParam('value', '');
appUserPreferences::SetPref($sCode, $sValue);
break;

View File

@@ -815,7 +815,7 @@ EOF
*/
function SelectOptions(WebPage $oPage)
{
$sOperation = utils::ReadParam('operation', 'csv_data', 'post');
$sOperation = utils::ReadParam('operation', 'csv_data');
$sCSVData = '';
switch($sOperation)
{
@@ -828,7 +828,7 @@ EOF
break;
default:
$sCSVData = utils::ReadParam('csvdata', '', 'post');
$sCSVData = utils::ReadPostedParam('csvdata', '');
}
$sEncoding = utils::ReadParam('encoding', 'UTF-8');

View File

@@ -111,7 +111,7 @@ function SelectService($oP, $oUserOrg)
$oSet = new CMDBObjectSet($oSearch, array(), array('org_id' => $oUserOrg->GetKey()));
$oP->add("<div class=\"wizContainer\" id=\"form_select_service\">\n");
$oP->add("<h1 id=\"select_subcategory\">".Dict::S('Portal:SelectService')."</h1>\n");
$oP->add("<form id=\"request_form\" method=\"get\">\n");
$oP->add("<form action=\"../portal/index.php\" id=\"request_form\" method=\"get\">\n");
$oP->add("<table>\n");
while($oService = $oSet->Fetch())
{
@@ -249,7 +249,7 @@ function RequestCreationForm($oP, $oUserOrg)
}
$oP->add("<div class=\"wizContainer\" id=\"form_request_description\">\n");
$oP->add("<h1 id=\"title_request_form\">".Dict::S('Portal:DescriptionOfTheRequest')."</h1>\n");
$oP->add("<form id=\"request_form\" method=\"post\">\n");
$oP->add("<form action=\"../portal/index.php\" id=\"request_form\" method=\"post\">\n");
$oP->add("<table>\n");
$oP->details($aDetails);
DumpHiddenParams($oP, $aList, $aParameters);
@@ -528,7 +528,7 @@ function DisplayRequestDetails($oP, UserRequest $oRequest)
function DisplayResolvedRequestForm($oP, UserRequest $oRequest)
{
$oP->add("<div class=\"wizContainer\" id=\"form_close_request\">\n");
$oP->add("<form id=\"request_form\" method=\"post\">\n");
$oP->add("<form action=\"../portal/index.php\" id=\"request_form\" method=\"post\">\n");
$oP->add('<table id="close_form_table"><tr><td style="vertical-align:top;">');
$oP->add("<h1 id=\"title_request_details\">".Dict::Format('Portal:TitleRequestDetailsFor_Request', $oRequest->GetName())."</h1>\n");
DisplayRequestDetails($oP, $oRequest);
@@ -562,9 +562,10 @@ function DisplayResolvedRequestForm($oP, UserRequest $oRequest)
$aStimuli = MetaModel::EnumStimuli($sClass);
$oP->add("<h1>".Dict::S('Portal:EnterYourCommentsOnTicket')."</h1>");
$oP->details($aDetails);
$oP->add("<input type=\"hidden\" name=\"id\" value=\"".$oRequest->GetKey()."\">");
$oP->add("<input type=\"hidden\" name=\"step\" value=\"2\">");
$oP->add("<input type=\"hidden\" name=\"transaction_id\" value=\"".utils::GetNewTransactionId()."\">\n");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"request_details\">");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"details\">");
$oP->p("<input type=\"submit\" value=\"".Dict::S('Portal:Button:CloseTicket')."\">");
$oP->add('</td></tr></table>');
$oP->add("</form>");
@@ -611,7 +612,7 @@ function DoCloseRequest($oP, UserRequest $oRequest)
if ( ($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) ||
(($iExpectCode & OPT_ATT_MANDATORY) && ($oRequest->Get($sAttCode) == '')) )
{
$value = utils::ReadParam('attr_'.$sAttCode, null, 'post');
$value = utils::ReadPostedParam('attr_'.$sAttCode, null);
if (!is_null($value))
{
$oRequest->Set($sAttCode, $value);
@@ -680,7 +681,7 @@ function RequestDetails(WebPage $oP, $id)
$oRequest = FindRequest($id);
if (!is_object($oRequest))
{
echo "Request not found ! count=".$oSet->Count();
echo "Request not found !";
return;
}
$iDefaultStep = 0;