Skip to content

Commit

Permalink
Several changes to better follow PHP STRICT standards
Browse files Browse the repository at this point in the history
Dev: Still not fully compatible

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11955 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Shitiz Garg committed Jan 9, 2012
1 parent 2425176 commit 7c1811e
Show file tree
Hide file tree
Showing 53 changed files with 672 additions and 644 deletions.
4 changes: 2 additions & 2 deletions application/controllers/AdminController.php
Expand Up @@ -81,8 +81,8 @@ public function error($message)
protected function _sessioncontrol()
{
// From personal settings
if (CHttpRequest::getPost('action') == 'savepersonalsettings') {
Yii::app()->session['adminlang'] = CHttpRequest::getPost('lang');
if (Yii::app()->request->getPost('action') == 'savepersonalsettings') {
Yii::app()->session['adminlang'] = Yii::app()->request->getPost('lang');
}

if (empty(Yii::app()->session['adminlang']))
Expand Down
22 changes: 11 additions & 11 deletions application/controllers/RegisterController.php
Expand Up @@ -60,10 +60,10 @@ function actionIndex($surveyid = null)
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('replacements');
$postlang = CHttpRequest::getPost('lang');
$postlang = Yii::app()->request->getPost('lang');
if($surveyid == null)
{
$surveyid = CHttpRequest::getPost('sid');
$surveyid = Yii::app()->request->getPost('sid');
}
if (!$surveyid)
{
Expand Down Expand Up @@ -107,14 +107,14 @@ function actionIndex($surveyid = null)
{
if (!isset($_POST['loadsecurity']) ||
!isset(Yii::app()->session['secanswer']) ||
CHttpRequest::getPost('loadsecurity') != Yii::app()->session['secanswer'])
Yii::app()->request->getPost('loadsecurity') != Yii::app()->session['secanswer'])
{
$register_errormsg .= $clang->gT("The answer to the security question is incorrect.")."<br />\n";
}
}

//Check that the email is a valid style address
if (!validate_email(CHttpRequest::getPost('register_email')))
if (!validate_email(Yii::app()->request->getPost('register_email')))
{
$register_errormsg .= $clang->gT("The email you used is not valid. Please try again.");
}
Expand All @@ -125,7 +125,7 @@ function actionIndex($surveyid = null)

//Check if this email already exists in token database
$query = "SELECT email FROM {{tokens_$surveyid}}\n"
. "WHERE email = '".sanitize_email(CHttpRequest::getPost('register_email'))."'";
. "WHERE email = '".sanitize_email(Yii::app()->request->getPost('register_email'))."'";
$result = db_execute_assoc($query) or show_error("Unable to execute this query : \n <br/>".$query."<br />"); //Checked)
if (($result->count()) > 0)
{
Expand Down Expand Up @@ -162,10 +162,10 @@ function actionIndex($surveyid = null)
if (!$ntresult->count()) {$mayinsert = true;}
}

$postfirstname=sanitize_xss_string(strip_tags(CHttpRequest::getPost('register_firstname')));
$postlastname=sanitize_xss_string(strip_tags(CHttpRequest::getPost('register_lastname')));
$starttime = sanitize_xss_string(CHttpRequest::getPost('startdate'));
$endtime = sanitize_xss_string(CHttpRequest::getPost('enddate'));
$postfirstname=sanitize_xss_string(strip_tags(Yii::app()->request->getPost('register_firstname')));
$postlastname=sanitize_xss_string(strip_tags(Yii::app()->request->getPost('register_lastname')));
$starttime = sanitize_xss_string(Yii::app()->request->getPost('startdate'));
$endtime = sanitize_xss_string(Yii::app()->request->getPost('enddate'));
/*$postattribute1=sanitize_xss_string(strip_tags(returnglobal('register_attribute1')));
$postattribute2=sanitize_xss_string(strip_tags(returnglobal('register_attribute2'))); */

Expand All @@ -177,7 +177,7 @@ function actionIndex($surveyid = null)
$query .= ", validfrom, validuntil";

$query .=")\n"
. "VALUES ('$postfirstname', '$postlastname', '".CHttpRequest::getPost('register_email')."', 'OK', '$newtoken'";
. "VALUES ('$postfirstname', '$postlastname', '".Yii::app()->request->getPost('register_email')."', 'OK', '$newtoken'";

if ($starttime && $endtime)
$query .= ",$starttime,$endtime";
Expand Down Expand Up @@ -235,7 +235,7 @@ function actionIndex($surveyid = null)
$html = ""; //Set variable
$sitename = Yii::app()->getConfig('sitename');

if (SendEmailMessage($message, $subject, CHttpRequest::getPost('register_email'), $from, $sitename,$useHtmlEmail,getBounceEmail($surveyid)))
if (SendEmailMessage($message, $subject, Yii::app()->request->getPost('register_email'), $from, $sitename,$useHtmlEmail,getBounceEmail($surveyid)))
{
// TLR change to put date into sent
$today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/assessments.php
Expand Up @@ -34,7 +34,7 @@ class Assessments extends Survey_Common_Action
public function index($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
$action = CHttpRequest::getPost('action');
$action = Yii::app()->request->getPost('action');

$languages = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$surveyLanguage = Survey::model()->findByPk($iSurveyId)->language;
Expand Down
14 changes: 7 additions & 7 deletions application/controllers/admin/authentication.php
Expand Up @@ -38,9 +38,9 @@ public function index()

if ($canLogin && !is_array($canLogin))
{
if (CHttpRequest::getPost('action'))
if (Yii::app()->request->getPost('action'))
{
$aData = $this->_doLogin(CHttpRequest::getPost('user'), CHttpRequest::getPost('password'));
$aData = $this->_doLogin(Yii::app()->request->getPost('user'), Yii::app()->request->getPost('password'));

if (!isset($aData['errormsg']))
{
Expand Down Expand Up @@ -83,14 +83,14 @@ public function forgotpassword()
{
$this->_redirectIfLoggedIn();

if (!CHttpRequest::getPost('action'))
if (!Yii::app()->request->getPost('action'))
{
$this->_renderWrappedTemplate('forgotpassword');
}
else
{
$postuser = CHttpRequest::getPost('user');
$sEmailAddr = CHttpRequest::getPost('email');
$postuser = Yii::app()->request->getPost('user');
$sEmailAddr = Yii::app()->request->getPost('email');

$aFields = User::model()->findAllByAttributes(array('users_name' => $postuser, 'email' => $sEmailAddr));

Expand Down Expand Up @@ -304,9 +304,9 @@ private function _setSessionData($user)
*/
private function _setLanguageSettings($user)
{
if (CHttpRequest::getPost('loginlang') !== 'default')
if (Yii::app()->request->getPost('loginlang') !== 'default')
{
$user->lang = sanitize_languagecode(CHttpRequest::getPost('loginlang'));
$user->lang = sanitize_languagecode(Yii::app()->request->getPost('loginlang'));
$user->save();
}

Expand Down
64 changes: 32 additions & 32 deletions application/controllers/admin/browse.php
Expand Up @@ -51,7 +51,7 @@ private function _getData($params)
}
$aData['clang'] = $clang = $this->getController()->lang;
$aData['imageurl'] = Yii::app()->getConfig('imageurl');
$aData['action'] = CHttpRequest::getParam('action');
$aData['action'] = Yii::app()->request->getParam('action');

$oCriteria = new CDbCriteria;
$oCriteria->select = 'sid, active';
Expand Down Expand Up @@ -192,15 +192,15 @@ public function view($iSurveyId, $iId, $sBrowseLang = '')
{
$iId = 1;
}
if (CHttpRequest::getPost('sql'))
if (Yii::app()->request->getPost('sql'))
{
if (get_magic_quotes_gpc())
{
$oCriteria->addCondition(stripslashes(CHttpRequest::getPost('sql')));
$oCriteria->addCondition(stripslashes(Yii::app()->request->getPost('sql')));
}
else
{
$oCriteria->addCondition(CHttpRequest::getPost('sql'));
$oCriteria->addCondition(Yii::app()->request->getPost('sql'));
}
}
else
Expand Down Expand Up @@ -294,15 +294,15 @@ public function index($iSurveyId)
* it containts
* $fnames[] = array(<dbfieldname>, <some strange title>, <questiontext>, <group_id>, <questiontype>);
*/
if (CHttpRequest::getPost('sql'))
if (Yii::app()->request->getPost('sql'))
{
$aViewUrls[] = 'browseallfiltered_view';
}

//Delete Individual answer using inrow delete buttons/links - checked
if (CHttpRequest::getPost('deleteanswer') && CHttpRequest::getPost('deleteanswer') != '' && CHttpRequest::getPost('deleteanswer') != 'marked' && bHasSurveyPermission($iSurveyId, 'responses', 'delete'))
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') != '' && Yii::app()->request->getPost('deleteanswer') != 'marked' && bHasSurveyPermission($iSurveyId, 'responses', 'delete'))
{
$_POST['deleteanswer'] = (int) CHttpRequest::getPost('deleteanswer'); // sanitize the value
$_POST['deleteanswer'] = (int) Yii::app()->request->getPost('deleteanswer'); // sanitize the value
// delete the files as well if its a fuqt

$fieldmap = createFieldMap($iSurveyId);
Expand All @@ -317,7 +317,7 @@ public function index($iSurveyId)
if (!empty($fuqtquestions))
{
// find all responses (filenames) to the fuqt questions
$responses = Survey_dynamic::model($iSurveyId)->findAllByAttributes(array('id' => CHttpRequest::getPost('deleteanswer')));
$responses = Survey_dynamic::model($iSurveyId)->findAllByAttributes(array('id' => Yii::app()->request->getPost('deleteanswer')));

foreach ($responses as $json)
{
Expand All @@ -334,13 +334,13 @@ public function index($iSurveyId)
}

// delete the row
Survey_dynamic::model($iSurveyId)->deleteAllByAttributes(array('id' => mysql_real_escape_string(CHttpRequest::getPost('deleteanswer'))));
Survey_dynamic::model($iSurveyId)->deleteAllByAttributes(array('id' => mysql_real_escape_string(Yii::app()->request->getPost('deleteanswer'))));
}
// Marked responses -> deal with the whole batch of marked responses
if (CHttpRequest::getPost('markedresponses') && count(CHttpRequest::getPost('markedresponses')) > 0 && bHasSurveyPermission($iSurveyId, 'responses', 'delete'))
if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0 && bHasSurveyPermission($iSurveyId, 'responses', 'delete'))
{
// Delete the marked responses - checked
if (CHttpRequest::getPost('deleteanswer') && CHttpRequest::getPost('deleteanswer') === 'marked')
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked')
{
$fieldmap = createFieldMap($iSurveyId);
$fuqtquestions = array();
Expand All @@ -351,7 +351,7 @@ public function index($iSurveyId)
$fuqtquestions[] = $field['fieldname'];
}

foreach (CHttpRequest::getPost('markedresponses') as $iResponseID)
foreach (Yii::app()->request->getPost('markedresponses') as $iResponseID)
{
$iResponseID = (int) $iResponseID; // sanitize the value

Expand All @@ -378,25 +378,25 @@ public function index($iSurveyId)
}
}
// Download all files for all marked responses - checked
else if (CHttpRequest::getPost('downloadfile') && CHttpRequest::getPost('downloadfile') === 'marked')
else if (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') === 'marked')
{
// Now, zip all the files in the filelist
$zipfilename = "Responses_for_survey_{$iSurveyId}.zip";
$this->_zipFiles(CHttpRequest::getPost('markedresponses'), $zipfilename);
$this->_zipFiles(Yii::app()->request->getPost('markedresponses'), $zipfilename);
}
}
// Download all files for this entry - checked
else if (CHttpRequest::getPost('downloadfile') && CHttpRequest::getPost('downloadfile') != '' && CHttpRequest::getPost('downloadfile') !== true)
else if (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') != '' && Yii::app()->request->getPost('downloadfile') !== true)
{
// Now, zip all the files in the filelist
$zipfilename = "LS_Responses_for_" . CHttpRequest::getPost('downloadfile') . ".zip";
$this->_zipFiles(CHttpRequest::getPost('downloadfile'), $zipfilename);
$zipfilename = "LS_Responses_for_" . Yii::app()->request->getPost('downloadfile') . ".zip";
$this->_zipFiles(Yii::app()->request->getPost('downloadfile'), $zipfilename);
}
else if (CHttpRequest::getPost('downloadindividualfile') != '')
else if (Yii::app()->request->getPost('downloadindividualfile') != '')
{
$iId = (int) CHttpRequest::getPost('id');
$downloadindividualfile = CHttpRequest::getPost('downloadindividualfile');
$fieldname = CHttpRequest::getPost('fieldname');
$iId = (int) Yii::app()->request->getPost('id');
$downloadindividualfile = Yii::app()->request->getPost('downloadindividualfile');
$fieldname = Yii::app()->request->getPost('fieldname');

$row = Survey_dynamic::model($iSurveyId)->findByAttributes(array('id' => $iId));
$phparray = json_decode(reset($row));
Expand Down Expand Up @@ -492,8 +492,8 @@ public function index($iSurveyId)

$fncount = count($fnames);

$start = CHttpRequest::getParam('start', 0);
$limit = CHttpRequest::getParam('limit', 100);
$start = Yii::app()->request->getParam('start', 0);
$limit = Yii::app()->request->getParam('limit', 100);

$oCriteria = new CDbCriteria;
//Create the query
Expand All @@ -519,10 +519,10 @@ public function index($iSurveyId)
}

//NOW LETS SHOW THE DATA
if (CHttpRequest::getPost('sql') && stripcslashes(CHttpRequest::getPost('sql')) !== "" && CHttpRequest::getPost('sql') != "NULL")
$oCriteria->addCondition(stripcslashes(CHttpRequest::getPost('sql')));
if (Yii::app()->request->getPost('sql') && stripcslashes(Yii::app()->request->getPost('sql')) !== "" && Yii::app()->request->getPost('sql') != "NULL")
$oCriteria->addCondition(stripcslashes(Yii::app()->request->getPost('sql')));

$oCriteria->order = 'id ' . (CHttpRequest::getParam('order') == 'desc' ? 'desc' : 'asc');
$oCriteria->order = 'id ' . (Yii::app()->request->getParam('order') == 'desc' ? 'desc' : 'asc');
$oCriteria->offset = $start;
$oCriteria->limit = $limit;

Expand Down Expand Up @@ -591,14 +591,14 @@ public function time($iSurveyId)
if ($aData['surveyinfo']['savetimings'] != "Y")
die();

if (CHttpRequest::getPost('deleteanswer') != '')
if (Yii::app()->request->getPost('deleteanswer') != '')
{
Survey_dynamic::model($iSurveyId)->deleteByAttributes(array('id' => (int) CHttpRequest::getPost('deleteanswer'))) or die("Could not delete response");
Survey_dynamic::model($iSurveyId)->deleteByAttributes(array('id' => (int) Yii::app()->request->getPost('deleteanswer'))) or die("Could not delete response");
}

if (CHttpRequest::getPost('markedresponses') && count(CHttpRequest::getPost('markedresponses')) > 0)
if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0)
{
foreach (CHttpRequest::getPost('markedresponses') as $iResponseID)
foreach (Yii::app()->request->getPost('markedresponses') as $iResponseID)
{
Survey_dynamic::model($iSurveyId)->deleteByAttributes(array('id' => (int) $iResponseID)) or die("Could not delete response");
}
Expand Down Expand Up @@ -643,8 +643,8 @@ public function time($iSurveyId)
}
}

$start = CHttpRequest::getParam('start', 0);
$limit = CHttpRequest::getParam('limit', 50);
$start = Yii::app()->request->getParam('start', 0);
$limit = Yii::app()->request->getParam('limit', 50);

//LETS COUNT THE DATA
$oCriteria = new CdbCritera();
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -44,7 +44,7 @@ public function fixredundancy()
{
$clang = Yii::app()->lang;

if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] == 1 && CHttpRequest::getPost('ok') == 'Y') {
if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] == 1 && Yii::app()->request->getPost('ok') == 'Y') {
$aDelete = $this->_checkintegrity();

if (isset($aDelete['redundanttokentables'])) {
Expand All @@ -71,7 +71,7 @@ public function fixintegrity()
{
$aData = array();
$clang = Yii::app()->lang;
if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] == 1 && CHttpRequest::getPost('ok') == 'Y') {
if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] == 1 && Yii::app()->request->getPost('ok') == 'Y') {
$aDelete = $this->_checkintegrity();

// TMSW Conditions->Relevance: Update this to process relevance instead
Expand Down

0 comments on commit 7c1811e

Please sign in to comment.