Skip to content

Commit

Permalink
Renamed functions in common_helper according to style guide
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12139 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Jan 20, 2012
1 parent c189a0b commit bd411f9
Show file tree
Hide file tree
Showing 121 changed files with 2,921 additions and 3,628 deletions.
24 changes: 12 additions & 12 deletions application/controllers/AdminController.php
Expand Up @@ -31,22 +31,22 @@ protected function _init()

$this->_sessioncontrol();

if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $updatelastcheck < date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-". Yii::app()->getConfig('updatecheckperiod')." days"))
updatecheck();
if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $updatelastcheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-". Yii::app()->getConfig('updatecheckperiod')." days"))
updateCheck();

//unset(Yii::app()->session['FileManagerContext']);

$this->user_id = Yii::app()->user->getId();

if (!Yii::app()->getConfig("surveyid")) {Yii::app()->setConfig("surveyid", returnglobal('sid'));} //SurveyID
if (!Yii::app()->getConfig("ugid")) {Yii::app()->setConfig("ugid", returnglobal('ugid'));} //Usergroup-ID
if (!Yii::app()->getConfig("gid")) {Yii::app()->setConfig("gid", returnglobal('gid'));} //GroupID
if (!Yii::app()->getConfig("qid")) {Yii::app()->setConfig("qid", returnglobal('qid'));} //QuestionID
if (!Yii::app()->getConfig("lid")) {Yii::app()->setConfig("lid", returnglobal('lid'));} //LabelID
if (!Yii::app()->getConfig("code")) {Yii::app()->setConfig("code", returnglobal('code'));} // ??
if (!Yii::app()->getConfig("action")) {Yii::app()->setConfig("action", returnglobal('action'));} //Desired action
if (!Yii::app()->getConfig("subaction")) {Yii::app()->setConfig("subaction", returnglobal('subaction'));} //Desired subaction
if (!Yii::app()->getConfig("editedaction")) {Yii::app()->setConfig("editedaction", returnglobal('editedaction'));} // for html editor integration
if (!Yii::app()->getConfig("surveyid")) {Yii::app()->setConfig("surveyid", returnGlobal('sid'));} //SurveyID
if (!Yii::app()->getConfig("ugid")) {Yii::app()->setConfig("ugid", returnGlobal('ugid'));} //Usergroup-ID
if (!Yii::app()->getConfig("gid")) {Yii::app()->setConfig("gid", returnGlobal('gid'));} //GroupID
if (!Yii::app()->getConfig("qid")) {Yii::app()->setConfig("qid", returnGlobal('qid'));} //QuestionID
if (!Yii::app()->getConfig("lid")) {Yii::app()->setConfig("lid", returnGlobal('lid'));} //LabelID
if (!Yii::app()->getConfig("code")) {Yii::app()->setConfig("code", returnGlobal('code'));} // ??
if (!Yii::app()->getConfig("action")) {Yii::app()->setConfig("action", returnGlobal('action'));} //Desired action
if (!Yii::app()->getConfig("subaction")) {Yii::app()->setConfig("subaction", returnGlobal('subaction'));} //Desired subaction
if (!Yii::app()->getConfig("editedaction")) {Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));} // for html editor integration
}

/**
Expand Down Expand Up @@ -296,7 +296,7 @@ public function _getAdminHeader($meta = false, $return = false)

$data['sitename'] = Yii::app()->getConfig("sitename");
$data['admintheme'] = Yii::app()->getConfig("admintheme");
$data['firebug'] = use_firebug();
$data['firebug'] = useFirebug();

if (!empty(Yii::app()->session['dateformat']))
$data['formatdata'] = getDateFormatData(Yii::app()->session['dateformat']);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/InstallerController.php
Expand Up @@ -357,7 +357,7 @@ private function stepDatabaseConfiguration()
$values['adminoutputForm'] = "<form action='".$this->createUrl("installer/createdb")."' method='post'><input type='submit' value='"
.$clang->gT("Create database")."' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' /></form>";
}
elseif ($dbexistsbutempty) //&& !(returnglobal('createdbstep2')==$clang->gT("Populate database")))
elseif ($dbexistsbutempty) //&& !(returnGlobal('createdbstep2')==$clang->gT("Populate database")))
{
Yii::app()->session['populatedatabase'] = true;

Expand Down
6 changes: 3 additions & 3 deletions application/controllers/OptinController.php
Expand Up @@ -93,18 +93,18 @@ function actionLocal($surveyid, $token, $langcode = '')
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir'])
{
$thistpl=sGetTemplatePath($defaulttemplate);
$thistpl=getTemplatePath($defaulttemplate);
}
else
{
$thistpl=sGetTemplatePath($thissurvey['templatedir']);
$thistpl=getTemplatePath($thissurvey['templatedir']);
}
$this->_renderHtml($html,$thistpl,$clang);
}

private function _renderHtml($html,$thistpl,$clang)
{
sendcacheheaders();
sendCacheHeaders();
doHeader();
$data['html'] = $html;
$data['thistpl'] = $thistpl;
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/OptoutController.php
Expand Up @@ -86,19 +86,19 @@ function actionLocal($surveyid, $token, $langcode = '')
//PRINT COMPLETED PAGE
if (!$thissurvey['templatedir'])
{
$thistpl=sGetTemplatePath($defaulttemplate);
$thistpl=getTemplatePath($defaulttemplate);
}
else
{
$thistpl=sGetTemplatePath($thissurvey['templatedir']);
$thistpl=getTemplatePath($thissurvey['templatedir']);
}

$this->_renderHtml($html,$thistpl);
}

private function _renderHtml($html,$thistpl)
{
sendcacheheaders();
sendCacheHeaders();
doHeader();
$data['html'] = $html;
$data['thistpl'] = $thistpl;
Expand Down
22 changes: 11 additions & 11 deletions application/controllers/RegisterController.php
Expand Up @@ -101,7 +101,7 @@ function actionIndex($surveyid = null)

$register_errormsg = "";
// Check the security question's answer
if (function_exists("ImageCreate") && captcha_enabled('registrationscreen',$thissurvey['usecaptcha']) )
if (function_exists("ImageCreate") && isCaptchaEnabled('registrationscreen',$thissurvey['usecaptcha']) )
{
if (!isset($_POST['loadsecurity']) ||
!isset(Yii::app()->session['secanswer']) ||
Expand All @@ -112,7 +112,7 @@ function actionIndex($surveyid = null)
}

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

while ($mayinsert != true)
{
$newtoken = sRandomChars($tokenlength);
$newtoken = randomChars($tokenlength);
$ntquery = "SELECT * FROM {{tokens_$surveyid}} WHERE token='$newtoken'";
$ntresult = db_execute_assoc($ntquery); //Checked
if (!$ntresult->count()) {$mayinsert = true;}
Expand All @@ -177,8 +177,8 @@ function actionIndex($surveyid = null)
$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'))); */
/*$postattribute1=sanitize_xss_string(strip_tags(returnGlobal('register_attribute1')));
$postattribute2=sanitize_xss_string(strip_tags(returnGlobal('register_attribute2'))); */

// Insert new entry into tokens db
Tokens_dynamic::sid($thissurvey['sid']);
Expand All @@ -200,12 +200,12 @@ function actionIndex($surveyid = null)
/**
$result = $connect->Execute($query, array($postfirstname,
$postlastname,
returnglobal('register_email'),
returnGlobal('register_email'),
'OK',
$newtoken)
// $postattribute1, $postattribute2)
) or safe_die ($query."<br />".$connect->ErrorMsg()); //Checked - According to adodb docs the bound variables are quoted automatically
) or safeDie ($query."<br />".$connect->ErrorMsg()); //Checked - According to adodb docs the bound variables are quoted automatically
*/
$tid = Yii::app()->db->getLastInsertID();;

Expand Down Expand Up @@ -251,7 +251,7 @@ function actionIndex($surveyid = null)
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", Yii::app()->getConfig('timeadjust'));
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
$query = "UPDATE {{tokens_$surveyid}}\n"
."SET sent='$today' WHERE tid=$tid";
$result=db_execute_assoc($query) or show_error("Unable to execute this query : $query<br />"); //Checked
Expand All @@ -267,14 +267,14 @@ function actionIndex($surveyid = null)
//PRINT COMPLETED PAGE
if (!$thissurvey['template'])
{
$thistpl=sGetTemplatePath(validate_templatedir('default'));
$thistpl=getTemplatePath(validateTemplateDir('default'));
}
else
{
$thistpl=sGetTemplatePath(validate_templatedir($thissurvey['template']));
$thistpl=getTemplatePath(validateTemplateDir($thissurvey['template']));
}

sendcacheheaders();
sendCacheHeaders();
doHeader();
Yii::app()->lang = $clang;
foreach(file("$thistpl/startpage.pstpl") as $op)
Expand Down
16 changes: 8 additions & 8 deletions application/controllers/Statistics_userController.php
Expand Up @@ -66,7 +66,7 @@ function actionAction($surveyid)

if(!isset($surveyid))
{
$surveyid=returnglobal('sid');
$surveyid=returnGlobal('sid');
}
else
{
Expand All @@ -75,7 +75,7 @@ function actionAction($surveyid)
if (!$surveyid)
{
//This next line ensures that the $surveyid value is never anything but a number.
safe_die('You have to provide a valid survey ID.');
safeDie('You have to provide a valid survey ID.');
}


Expand All @@ -84,18 +84,18 @@ function actionAction($surveyid)
$actresult = Survey::model()->findAll('sid = :sid AND active = :active', array(':sid' => $surveyid, ':active' => 'Y')); //Checked
if (count($actresult) == 0)
{
safe_die('You have to provide a valid survey ID.');
safeDie('You have to provide a valid survey ID.');
}
else
{
$surveyinfo = getSurveyInfo($surveyid);
// CHANGE JSW_NZ - let's get the survey title for display
$thisSurveyTitle = $surveyinfo["name"];
// CHANGE JSW_NZ - let's get css from individual template.css - so define path
$thisSurveyCssPath = sGetTemplateURL($surveyinfo["template"]);
$thisSurveyCssPath = getTemplateURL($surveyinfo["template"]);
if ($surveyinfo['publicstatistics']!='Y')
{
safe_die('The public statistics for this survey are deactivated.');
safeDie('The public statistics for this survey are deactivated.');
}

//check if graphs should be shown for this survey
Expand Down Expand Up @@ -165,7 +165,7 @@ function actionAction($surveyid)

//Create header (fixes bug #3097)
$surveylanguage= $language;
sendcacheheaders();
sendCacheHeaders();
$condition = false;
$header= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
. "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"".$surveylanguage."\" lang=\"".$surveylanguage."\"";
Expand Down Expand Up @@ -204,7 +204,7 @@ function actionAction($surveyid)


//SORT IN NATURAL ORDER!
usort($rows, 'GroupOrderThenQuestionOrder');
usort($rows, 'groupOrderThenQuestionOrder');

//put the question information into the filter array
foreach ($rows as $row)
Expand All @@ -215,7 +215,7 @@ function actionAction($surveyid)
$row['type'],
$row['title'],
$row['group_name'],
FlattenText($row['question']));
flattenText($row['question']));
}

//number of records for this survey
Expand Down

0 comments on commit bd411f9

Please sign in to comment.