From f120e21e007cd05d24ec720b6d7ff8853df85532 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 10 Sep 2010 14:11:30 +0000 Subject: [PATCH] Code cleanup: proper usage of the ReadParam function. SVN:trunk[814] --- application/loginwebpage.class.inc.php | 8 ++++---- pages/UI.php | 12 ++++++------ pages/ajax.render.php | 14 +++++++------- pages/csvimport.php | 4 ++-- portal/index.php | 13 +++++++------ 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index e7119189f..dc414a4e2 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -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; diff --git a/pages/UI.php b/pages/UI.php index a365c0306..d54727164 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -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()) diff --git a/pages/ajax.render.php b/pages/ajax.render.php index eb1b4aaef..f8b197108 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -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; diff --git a/pages/csvimport.php b/pages/csvimport.php index a4a93aa07..420f2c6e1 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -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'); diff --git a/portal/index.php b/portal/index.php index 1070534b5..bc43b5f11 100644 --- a/portal/index.php +++ b/portal/index.php @@ -111,7 +111,7 @@ function SelectService($oP, $oUserOrg) $oSet = new CMDBObjectSet($oSearch, array(), array('org_id' => $oUserOrg->GetKey())); $oP->add("
\n"); $oP->add("

".Dict::S('Portal:SelectService')."

\n"); - $oP->add("
\n"); + $oP->add("\n"); $oP->add("\n"); while($oService = $oSet->Fetch()) { @@ -249,7 +249,7 @@ function RequestCreationForm($oP, $oUserOrg) } $oP->add("
\n"); $oP->add("

".Dict::S('Portal:DescriptionOfTheRequest')."

\n"); - $oP->add("\n"); + $oP->add("\n"); $oP->add("
\n"); $oP->details($aDetails); DumpHiddenParams($oP, $aList, $aParameters); @@ -528,7 +528,7 @@ function DisplayRequestDetails($oP, UserRequest $oRequest) function DisplayResolvedRequestForm($oP, UserRequest $oRequest) { $oP->add("
\n"); - $oP->add("\n"); + $oP->add("\n"); $oP->add('
'); $oP->add("

".Dict::Format('Portal:TitleRequestDetailsFor_Request', $oRequest->GetName())."

\n"); DisplayRequestDetails($oP, $oRequest); @@ -562,9 +562,10 @@ function DisplayResolvedRequestForm($oP, UserRequest $oRequest) $aStimuli = MetaModel::EnumStimuli($sClass); $oP->add("

".Dict::S('Portal:EnterYourCommentsOnTicket')."

"); $oP->details($aDetails); + $oP->add("GetKey()."\">"); $oP->add(""); $oP->add("\n"); - $oP->add(""); + $oP->add(""); $oP->p(""); $oP->add('
'); $oP->add("
"); @@ -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;