From bd411f90681279922812d7844391713d447705ec Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Fri, 20 Jan 2012 19:07:52 +0000 Subject: [PATCH] Renamed functions in common_helper according to style guide git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12139 b72ed6b6-b9f8-46b5-92b4-906544132732 --- application/controllers/AdminController.php | 24 +- .../controllers/InstallerController.php | 2 +- application/controllers/OptinController.php | 6 +- application/controllers/OptoutController.php | 6 +- .../controllers/RegisterController.php | 22 +- .../controllers/Statistics_userController.php | 16 +- application/controllers/SurveyAction.php | 68 +- application/controllers/SurveyController.php | 22 +- .../controllers/UploaderController.php | 22 +- application/controllers/admin/assessments.php | 10 +- .../controllers/admin/authentication.php | 2 +- application/controllers/admin/browse.php | 18 +- .../controllers/admin/checkintegrity.php | 100 +- .../controllers/admin/conditionsaction.php | 158 +- application/controllers/admin/database.php | 98 +- application/controllers/admin/dataentry.php | 122 +- application/controllers/admin/dumpdb.php | 4 +- .../controllers/admin/emailtemplates.php | 4 +- application/controllers/admin/export.php | 68 +- .../admin/fck_LimeReplacementFields.php | 28 +- .../controllers/admin/globalsettings.php | 24 +- application/controllers/admin/index.php | 2 +- application/controllers/admin/kcfinder.php | 2 +- application/controllers/admin/labels.php | 10 +- .../controllers/admin/participantsaction.php | 24 +- .../controllers/admin/printablesurvey.php | 20 +- application/controllers/admin/question.php | 48 +- .../controllers/admin/questiongroup.php | 30 +- application/controllers/admin/quotas.php | 12 +- .../controllers/admin/remotecontrol.php | 10 +- application/controllers/admin/saved.php | 2 +- application/controllers/admin/statistics.php | 16 +- .../controllers/admin/surveyaction.php | 66 +- .../controllers/admin/surveypermission.php | 26 +- application/controllers/admin/templates.php | 94 +- application/controllers/admin/tokens.php | 82 +- application/controllers/admin/translate.php | 4 +- application/controllers/admin/update.php | 6 +- application/controllers/admin/useraction.php | 44 +- application/controllers/admin/usergroups.php | 2 +- application/controllers/printanswers.php | 28 +- application/core/LSYii_Controller.php | 2 +- application/core/Survey_Common_Action.php | 72 +- application/helpers/SurveyRuntimeHelper.php | 18 +- application/helpers/admin/activate_helper.php | 18 +- .../helpers/admin/exportresults_helper.php | 32 +- .../helpers/admin/htmleditor_helper.php | 2 +- application/helpers/admin/import_helper.php | 314 +-- application/helpers/admin/label_helper.php | 14 +- .../helpers/admin/statistics_helper.php | 126 +- application/helpers/admin/template_helper.php | 8 +- application/helpers/common_helper.php | 2061 ++++++----------- application/helpers/database_helper.php | 8 +- application/helpers/export_helper.php | 26 +- .../helpers/expressions/em_manager_helper.php | 22 +- application/helpers/frontend_helper.php | 120 +- application/helpers/ldap_helper.php | 4 +- application/helpers/qanda_helper.php | 68 +- application/helpers/replacements_helper.php | 56 +- .../helpers/update/upgrade-all_helper.php | 26 +- .../helpers/update/upgrade-mssql_helper.php | 430 ++-- .../update/upgrade-mssqlnative_helper.php | 430 ++-- .../helpers/update/upgrade-mysql_helper.php | 644 ++--- .../update/upgrade-postgres_helper.php | 342 +-- application/libraries/Limesurvey_lang.php | 20 +- application/libraries/Load_answers.php | 2 +- application/libraries/Save.php | 18 +- application/models/Participants.php | 4 +- application/models/Questions.php | 2 +- application/models/Survey.php | 2 +- application/models/Survey_permissions.php | 2 +- application/models/Tokens_dynamic.php | 2 +- application/views/admin/assessments_view.php | 8 +- .../admin/browse/browseallheader_view.php | 12 +- .../views/admin/browse/browseallrow_view.php | 10 +- .../admin/browse/browseidheader_view.php | 8 +- .../views/admin/browse/browseidrow_view.php | 2 +- .../views/admin/browse/browsemenubar_view.php | 18 +- .../admin/browse/browsetimeheader_view.php | 2 +- .../admin/dataentry/active_html_view.php | 2 +- .../views/admin/dataentry/caption_view.php | 4 +- .../views/admin/dataentry/content_view.php | 2 +- .../dataentry/includes/editdata/editdata.php | 10 +- .../emailtemplates/emailtemplates_view.php | 12 +- .../views/admin/export/exportresults_view.php | 8 +- .../views/admin/export/statistics_view.php | 22 +- .../expressions/test/navigation_test.php | 2 +- .../expressions/test/survey_logic_file.php | 2 +- .../views/admin/globalSettings_view.php | 6 +- .../admin/htmleditor/pop_editor_view.php | 2 +- .../views/admin/labels/labelbar_view.php | 2 +- .../views/admin/labels/labelview_view.php | 2 +- .../admin/quotas/viewquotasfooter_view.php | 2 +- .../views/admin/quotas/viewquotasrow_view.php | 6 +- .../views/admin/saved/savedlist_view.php | 4 +- application/views/admin/super/adminmenu.php | 2 +- .../survey/Question/editQuestion_view.php | 8 +- .../Question/editdefaultvalues_view.php | 2 +- .../survey/Question/questionbar_view.php | 22 +- .../survey/QuestionGroups/addGroup_view.php | 4 +- .../QuestionGroups/questiongroupbar_view.php | 12 +- .../admin/survey/deactivateSurvey_view.php | 2 +- .../views/admin/survey/editSurvey_view.php | 6 +- .../organizeGroupsAndQuestions_view.php | 2 +- .../admin/survey/printablesurvey_view.php | 2 +- .../admin/survey/subview/tabCopy_view.php | 2 +- .../survey/subview/tabPresentation_view.php | 4 +- .../views/admin/survey/surveybar_view.php | 4 +- .../templates/templateeditorbar_view.php | 2 +- .../admin/templates/templatesummary_view.php | 6 +- application/views/admin/token/actions.php | 14 +- application/views/admin/token/browse.php | 4 +- application/views/admin/token/csvupload.php | 4 +- application/views/admin/token/email.php | 6 +- .../views/admin/token/emailwarning.php | 4 +- application/views/admin/token/tokenbar.php | 14 +- .../views/admin/token/tokensummary.php | 12 +- .../views/admin/token/tokenwarning.php | 6 +- application/views/admin/user/editusers.php | 4 +- .../views/admin/user/setuserrights.php | 2 +- .../admin/usergroup/usergroupbar_view.php | 4 +- 121 files changed, 2921 insertions(+), 3628 deletions(-) diff --git a/application/controllers/AdminController.php b/application/controllers/AdminController.php index b914b538d11..7bc8e003f2b 100644 --- a/application/controllers/AdminController.php +++ b/application/controllers/AdminController.php @@ -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 } /** @@ -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']); diff --git a/application/controllers/InstallerController.php b/application/controllers/InstallerController.php index e8c8deb0f18..dcac0063660 100644 --- a/application/controllers/InstallerController.php +++ b/application/controllers/InstallerController.php @@ -357,7 +357,7 @@ private function stepDatabaseConfiguration() $values['adminoutputForm'] = "
"; } - elseif ($dbexistsbutempty) //&& !(returnglobal('createdbstep2')==$clang->gT("Populate database"))) + elseif ($dbexistsbutempty) //&& !(returnGlobal('createdbstep2')==$clang->gT("Populate database"))) { Yii::app()->session['populatedatabase'] = true; diff --git a/application/controllers/OptinController.php b/application/controllers/OptinController.php index 5099a0084af..f9fbe1c15ec 100644 --- a/application/controllers/OptinController.php +++ b/application/controllers/OptinController.php @@ -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; diff --git a/application/controllers/OptoutController.php b/application/controllers/OptoutController.php index 9836569c463..a03dc604cb2 100644 --- a/application/controllers/OptoutController.php +++ b/application/controllers/OptoutController.php @@ -86,11 +86,11 @@ 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); @@ -98,7 +98,7 @@ function actionLocal($surveyid, $token, $langcode = '') private function _renderHtml($html,$thistpl) { - sendcacheheaders(); + sendCacheHeaders(); doHeader(); $data['html'] = $html; $data['thistpl'] = $thistpl; diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index 84cfdaac5d7..1f99b9a994e 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -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']) || @@ -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."); } @@ -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;} @@ -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']); @@ -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."
".$connect->ErrorMsg()); //Checked - According to adodb docs the bound variables are quoted automatically + ) or safeDie ($query."
".$connect->ErrorMsg()); //Checked - According to adodb docs the bound variables are quoted automatically */ $tid = Yii::app()->db->getLastInsertID();; @@ -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
"); //Checked @@ -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) diff --git a/application/controllers/Statistics_userController.php b/application/controllers/Statistics_userController.php index 4e9ceeb93f9..2984e4cc142 100644 --- a/application/controllers/Statistics_userController.php +++ b/application/controllers/Statistics_userController.php @@ -66,7 +66,7 @@ function actionAction($surveyid) if(!isset($surveyid)) { - $surveyid=returnglobal('sid'); + $surveyid=returnGlobal('sid'); } else { @@ -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.'); } @@ -84,7 +84,7 @@ 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 { @@ -92,10 +92,10 @@ function actionAction($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 @@ -165,7 +165,7 @@ function actionAction($surveyid) //Create header (fixes bug #3097) $surveylanguage= $language; - sendcacheheaders(); + sendCacheHeaders(); $condition = false; $header= "\n" . "= '".date("Y-m-d H:i")."') OR (a.expires is null)) AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) ORDER BY surveyls_title"; - $result = db_execute_assoc($query,false,true) or safe_die("Could not connect to database. If you try to install LimeSurvey please refer to the installation docs and/or contact the system administrator of this webpage."); //Checked + $result = db_execute_assoc($query,false,true) or safeDie("Could not connect to database. If you try to install LimeSurvey please refer to the installation docs and/or contact the system administrator of this webpage."); //Checked $list=array(); if($result->count() > 0) @@ -202,7 +202,7 @@ function action() AND a.startdate is not null ORDER BY surveyls_title"; - $sresult = db_execute_assoc($squery) or safe_die("Couldn't execute $squery"); + $sresult = db_execute_assoc($squery) or safeDie("Couldn't execute $squery"); if($sresult->count() > 0) @@ -211,7 +211,7 @@ function action() foreach($sresult->readAll() as $rows) { $link = "
  • \n"; if ($rows['publicstatistics'] == 'Y') $link .= "(".$clang->gT('View statistics').")"; $link .= "
  • \n"; @@ -237,18 +237,18 @@ function action() //$data['privacy'] = $privacy; $data['surveylist'] = $surveylist; $data['surveyid'] = $surveyid; - $data['templatedir'] = sGetTemplatePath($defaulttemplate); - $data['templateurl'] = sGetTemplateURL($defaulttemplate)."/"; + $data['templatedir'] = getTemplatePath($defaulttemplate); + $data['templateurl'] = getTemplateURL($defaulttemplate)."/"; $data['templatename'] = $defaulttemplate; $data['sitename'] = Yii::app()->getConfig("sitename"); $data['languagechanger'] = $languagechanger; //A nice exit - sendcacheheaders(); + sendCacheHeaders(); doHeader(); - $this->_printTemplateContent(sGetTemplatePath($defaulttemplate)."/startpage.pstpl", $data, __LINE__); + $this->_printTemplateContent(getTemplatePath($defaulttemplate)."/startpage.pstpl", $data, __LINE__); - $this->_printTemplateContent(sGetTemplatePath($defaulttemplate)."/surveylist.pstpl", $data, __LINE__); + $this->_printTemplateContent(getTemplatePath($defaulttemplate)."/surveylist.pstpl", $data, __LINE__); echo '\n"; @@ -764,11 +764,11 @@ function index($sa = null) { Questions::model()->updateAll(array('gid'=>$gid), 'qid=:qid and parent_qid>0', array(':qid'=>$oldqid)); // if the group has changed then fix the sortorder of old and new group - fixsortorderQuestions($oldgid, $surveyid); - fixsortorderQuestions($gid, $surveyid); + fixSortOrderQuestions($oldgid, $surveyid); + fixSortOrderQuestions($gid, $surveyid); // If some questions have conditions set on this question's answers // then change the cfieldname accordingly - fixmovedquestionConditions($qid, $oldgid, $gid); + fixMovedQuestionConditions($qid, $oldgid, $gid); } if ($oldtype != Yii::app()->request->getPost('type')) { @@ -833,7 +833,7 @@ function index($sa = null) } - if (($action == "updatesurveylocalesettings") && bHasSurveyPermission($surveyid,'surveylocale','update')) + if (($action == "updatesurveylocalesettings") && hasSurveyPermission($surveyid,'surveylocale','update')) { $languagelist = Survey::model()->findByPk($surveyid)->additionalLanguages; $languagelist[]=Survey::model()->findByPk($surveyid)->language; @@ -877,10 +877,10 @@ function index($sa = null) $welcome = Yii::app()->request->getPost('welcome_'.$langname); $endtext = Yii::app()->request->getPost('endtext_'.$langname); - $short_title=fix_FCKeditor_text($short_title); - $description=fix_FCKeditor_text($description); - $welcome=fix_FCKeditor_text($welcome); - $endtext=fix_FCKeditor_text($endtext); + $short_title=fixCKeditorText($short_title); + $description=fixCKeditorText($description); + $welcome=fixCKeditorText($welcome); + $endtext=fixCKeditorText($endtext); $data = array( 'surveyls_title' => $short_title, @@ -908,7 +908,7 @@ function index($sa = null) } } - if (($action == "updatesurveysettingsandeditlocalesettings" || $action == "updatesurveysettings") && bHasSurveyPermission($surveyid,'surveysettings','update')) + if (($action == "updatesurveysettingsandeditlocalesettings" || $action == "updatesurveysettings") && hasSurveyPermission($surveyid,'surveysettings','update')) { Yii::app()->loadHelper('surveytranslator'); Yii::app()->loadHelper('database'); @@ -947,9 +947,9 @@ function index($sa = null) } - CleanLanguagesFromSurvey($surveyid,Yii::app()->request->getPost('languageids')); + cleanLanguagesFromSurvey($surveyid,Yii::app()->request->getPost('languageids')); - FixLanguageConsistency($surveyid,Yii::app()->request->getPost('languageids')); + fixLanguageConsistency($surveyid,Yii::app()->request->getPost('languageids')); $template = Yii::app()->request->getPost('template'); if(Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1 && Yii::app()->session['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights(Yii::app()->session['loginID'], $template)) $template = "default"; @@ -1048,7 +1048,7 @@ function index($sa = null) if (count($usresult)==0) { $bplang = $this->getController()->lang; - $aDefaultTexts=aTemplateDefaultTexts($bplang,'unescaped'); + $aDefaultTexts=templateDefaultTexts($bplang,'unescaped'); if (getEmailFormat($surveyid) == "html") { $ishtml=true; diff --git a/application/controllers/admin/dataentry.php b/application/controllers/admin/dataentry.php index ecbd3484fd9..eafcd80b906 100644 --- a/application/controllers/admin/dataentry.php +++ b/application/controllers/admin/dataentry.php @@ -82,7 +82,7 @@ function vvimport() $aData['surveyid'] = $surveyid; $aData['clang'] = $this->getController()->lang; - if( bHasSurveyPermission($surveyid,'responses','create') ) + if( hasSurveyPermission($surveyid,'responses','create') ) { // First load the database helper Yii::app()->loadHelper('database'); @@ -145,7 +145,7 @@ private function _handleFileUpload($surveyid, $aData) $aFieldnames = array_map('db_quote_id', $aFieldnames); // Find out which fields are datefields, these have to be null if the imported string is empty - $fieldmap = createFieldMap($surveyid,'short',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); $datefields = array(); $numericfields = array(); @@ -211,13 +211,13 @@ private function _handleFileUpload($surveyid, $aData) } if (isset($fielddata['`id`'])) { - db_switchIDInsert("survey_$surveyid", true); + switchMSSQLIdentityInsert("survey_$surveyid", true); } $result = $survey->insertRecords($fielddata); if (isset($fielddata['id'])) { - db_switchIDInsert("survey_$surveyid", false); + switchMSSQLIdentityInsert("survey_$surveyid", false); } if (!$result) { @@ -327,7 +327,7 @@ function import($surveyid) 'surveyid' => $surveyid ); - if(bHasSurveyPermission($surveyid,'responses','create')) + if(hasSurveyPermission($surveyid,'responses','create')) { //if (!isset($surveyid)) $surveyid = $this->input->post('sid'); if (!isset($oldtable) && isset($_POST['oldtable'])) @@ -415,7 +415,7 @@ function import($surveyid) unset($row['id']); //$sInsertSQL=Yii::app()->db->GetInsertSQL($activetable, $row); - $sInsertSQL="INSERT into {$activetable} (".implode(",", array_map("db_quote_id", array_keys($row))).") VALUES (".implode(",", array_map("db_quoteall",array_values($row))).")"; + $sInsertSQL="INSERT into {$activetable} (".implode(",", array_map("db_quote_id", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll",array_values($row))).")"; $result = db_execute_assoc($sInsertSQL) or show_error("Error:
    $sInsertSQL
    "); $aSRIDConversions[$iOldID]=Yii::app()->db->getLastInsertID(); } @@ -425,7 +425,7 @@ function import($surveyid) $sOldTimingsTable=substr($oldtable,0,strrpos($oldtable,'_')).'_timings'.substr($oldtable,strrpos($oldtable,'_')); $sNewTimingsTable = "{{{$surveyid}_timings}}"; - if (returnglobal('importtimings')=='Y' && tableExists($sOldTimingsTable) && tableExists($sNewTimingsTable)) + if (returnGlobal('importtimings')=='Y' && tableExists($sOldTimingsTable) && tableExists($sNewTimingsTable)) { // Import timings $aFieldsOldTimingTable=array_values($schema->getTable($sOldTimingsTable)->columnNames); @@ -445,7 +445,7 @@ function import($surveyid) } else continue; //$sInsertSQL=Yii::app()->db->GetInsertSQL($sNewTimingsTable,$row); - $sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",", array_map("db_quote_id", array_keys($row))).") VALUES (".implode(",", array_map("db_quoteall", array_values($row))).")"; + $sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",", array_map("db_quote_id", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll", array_values($row))).")"; $result = db_execute_assoc($sInsertSQL) or show_error("Error:
    $sInsertSQL
    "); } Yii::app()->session['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT); @@ -484,7 +484,7 @@ public function editdata($subaction, $id, $surveyid, $language='') } $surveyinfo = getSurveyInfo($surveyid); - if (bHasSurveyPermission($surveyid, 'responses','update')) + if (hasSurveyPermission($surveyid, 'responses','update')) { $surveytable = "{{survey_".$surveyid.'}}'; $aData['clang'] = $clang = $this->getController()->lang; @@ -522,16 +522,16 @@ public function editdata($subaction, $id, $surveyid, $language='') //SHOW INDIVIDUAL RECORD - if ($subaction == "edit" && bHasSurveyPermission($surveyid,'responses','update')) + if ($subaction == "edit" && hasSurveyPermission($surveyid,'responses','update')) { $idquery = "SELECT * FROM $surveytable WHERE id=$id"; - $idresult = db_execute_assoc($idquery) or safe_die ("Couldn't get individual record
    $idquery
    "); + $idresult = db_execute_assoc($idquery) or safeDie ("Couldn't get individual record
    $idquery
    "); foreach ($idresult->readAll() as $idrow) { $results[]=$idrow; } } - elseif ($subaction == "editsaved" && bHasSurveyPermission($surveyid,'responses','update')) + elseif ($subaction == "editsaved" && hasSurveyPermission($surveyid,'responses','update')) { if (isset($_GET['public']) && $_GET['public']=="true") { @@ -562,7 +562,7 @@ public function editdata($subaction, $id, $surveyid, $language='') $responses[$svrow['fieldname']] = $svrow['value']; } // while - $fieldmap = createFieldMap($surveyid,'short',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); foreach($fieldmap as $fm) { if (isset($responses[$fm['fieldname']])) @@ -576,7 +576,7 @@ public function editdata($subaction, $id, $surveyid, $language='') } $results1['id'] = ""; - $results1['datestamp'] = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); + $results1['datestamp'] = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); $results1['ipaddr'] = $saver['ip']; $results[] = $results1; } @@ -624,7 +624,7 @@ public function editdata($subaction, $id, $surveyid, $language='') $aDataentryoutput .=">\n" ."" ."\n"; - $aDataentryoutput .= "\t".strip_javascript($question)."\n"; + $aDataentryoutput .= "\t".stripJavaScript($question)."\n"; $aDataentryoutput .= "\n" ."\n"; //$aDataentryoutput .= "\t-={$fname[3]}=-"; //Debugging info @@ -645,7 +645,7 @@ public function editdata($subaction, $id, $surveyid, $language='') } else { - $mysubmitdate = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); + $mysubmitdate = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); } $completedate = empty($idrow['submitdate']) ? $mysubmitdate : $idrow['submitdate']; @@ -796,7 +796,7 @@ public function editdata($subaction, $id, $surveyid, $language='') } $oquery="SELECT other FROM {{questions}} WHERE qid={$fname['qid']} AND {{questions}}.language = '{$sDataEntryLanguage}'"; - $oresult=db_execute_assoc($oquery) or safe_die("Couldn't get other for list question
    ".$oquery."
    "); + $oresult=db_execute_assoc($oquery) or safeDie("Couldn't get other for list question
    ".$oquery."
    "); foreach($oresult->readAll() as $orow) { $fother=$orow['other']; @@ -1391,16 +1391,16 @@ public function editdata($subaction, $id, $surveyid, $language='') $aData['sDataEntryLanguage'] = $sDataEntryLanguage; - if (!bHasSurveyPermission($surveyid, 'responses','update')) + if (!hasSurveyPermission($surveyid, 'responses','update')) { // if you are not survey owner or super admin you cannot modify responses $aDataentryoutput .= "\n"; } - elseif ($subaction == "edit" && bHasSurveyPermission($surveyid,'responses','update')) + elseif ($subaction == "edit" && hasSurveyPermission($surveyid,'responses','update')) { $aData['part'] = 'edit'; $aDataentryoutput .= $this->getController()->render('/admin/dataentry/edit', $aData, TRUE); } - elseif ($subaction == "editsaved" && bHasSurveyPermission($surveyid,'responses','update')) + elseif ($subaction == "editsaved" && hasSurveyPermission($surveyid,'responses','update')) { $aData['part'] = 'editsaved'; $aDataentryoutput .= $this->getController()->render('/admin/dataentry/edit', $aData, TRUE); @@ -1432,14 +1432,14 @@ public function delete() 'id' => $id ); - if (bHasSurveyPermission($surveyid, 'responses','read') && $subaction == "delete" && bHasSurveyPermission($surveyid, 'responses', 'delete')) + if (hasSurveyPermission($surveyid, 'responses','read') && $subaction == "delete" && hasSurveyPermission($surveyid, 'responses', 'delete')) { $surveytable = "{{survey_".$surveyid.'}}'; $aData['thissurvey'] = getSurveyInfo($surveyid); $delquery = "DELETE FROM $surveytable WHERE id=$id"; Yii::app()->loadHelper('database'); - $delresult = db_execute_assoc($delquery) or safe_die ("Couldn't delete record $id
    \n"); + $delresult = db_execute_assoc($delquery) or safeDie ("Couldn't delete record $id
    \n"); $this->_renderWrappedTemplate('delete', $aData); } @@ -1459,7 +1459,7 @@ public function update() $id = Yii::app()->request->getPost('id'); $lang = Yii::app()->request->getPost('lang'); - if ($subaction == "update" && bHasSurveyPermission($surveyid, 'responses', 'update')) + if ($subaction == "update" && hasSurveyPermission($surveyid, 'responses', 'update')) { $baselang = Survey::model()->findByPk($surveyid)->language; @@ -1469,7 +1469,7 @@ public function update() $aDataentryoutput = "
    ".$clang->gT("Data entry")."
    \n"; - $fieldmap = createFieldMap($surveyid,'short',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); // unset timings foreach ($fieldmap as $fname) @@ -1535,22 +1535,22 @@ public function update() } elseif (isset($_POST['completed']) && $thisvalue=="") { - $updateqr .= $fieldname." = '" . $_POST['completed'] . "', \n";// db_quote_id($fieldname)." = " . db_quoteall($_POST['completed'],true) . ", \n"; + $updateqr .= $fieldname." = '" . $_POST['completed'] . "', \n";// db_quote_id($fieldname)." = " . dbQuoteAll($_POST['completed'],true) . ", \n"; } else { - $updateqr .= $fieldname." = '" . $thisvalue . "', \n"; //db_quote_id($fieldname)." = " . db_quoteall($thisvalue,true) . ", \n"; + $updateqr .= $fieldname." = '" . $thisvalue . "', \n"; //db_quote_id($fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n"; } } else { - $updateqr .= $fieldname." = '" . $thisvalue . "', \n"; // db_quote_id($fieldname)." = " . db_quoteall($thisvalue,true) . ", \n"; + $updateqr .= $fieldname." = '" . $thisvalue . "', \n"; // db_quote_id($fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n"; } } $updateqr = substr($updateqr, 0, -3); $updateqr .= " WHERE id=$id"; - $updateres = db_execute_assoc($updateqr) or safe_die("Update failed:
    \n
    $updateqr"); + $updateres = db_execute_assoc($updateqr) or safeDie("Update failed:
    \n
    $updateqr"); while (ob_get_level() > 0) { ob_end_flush(); } @@ -1586,9 +1586,9 @@ public function insert() 'clang' => $clang ); - if (bHasSurveyPermission($surveyid, 'responses','read')) + if (hasSurveyPermission($surveyid, 'responses','read')) { - if ($subaction == "insert" && bHasSurveyPermission($surveyid,'responses','create')) + if ($subaction == "insert" && hasSurveyPermission($surveyid,'responses','create')) { $surveytable = "{{survey_{$surveyid}}}"; $thissurvey = getSurveyInfo($surveyid); @@ -1607,7 +1607,7 @@ public function insert() if (isset($_POST['token'])) { $tokencompleted = ""; - $tcquery = "SELECT completed from {{tokens_{$surveyid}}} WHERE token='{$_POST['token']}'"; //db_quoteall($_POST['token'],true); + $tcquery = "SELECT completed from {{tokens_{$surveyid}}} WHERE token='{$_POST['token']}'"; //dbQuoteAll($_POST['token'],true); $tcresult = db_execute_assoc($tcquery); $tccount = $tcresult->getRowCount(); foreach ($tcresult->readAll() as $tcrow) @@ -1628,7 +1628,7 @@ public function insert() } else { // token is valid, survey not anonymous, try to get last recorded response id - $aquery = "SELECT id,startlanguage FROM $surveytable WHERE token='".$_POST['token']."'"; //db_quoteall($_POST['token'],true); + $aquery = "SELECT id,startlanguage FROM $surveytable WHERE token='".$_POST['token']."'"; //dbQuoteAll($_POST['token'],true); $aresult = db_execute_assoc($aquery); foreach ($aresult->readAll() as $arow) { @@ -1679,7 +1679,7 @@ public function insert() $saver['password']=$_POST['save_password']; $saver['passwordconfirm']=$_POST['save_confirmpassword']; $saver['email']=$_POST['save_email']; - if (!returnglobal('redo')) + if (!returnGlobal('redo')) { $password = md5($saver['password']); } @@ -1709,7 +1709,7 @@ public function insert() //BUILD THE SQL TO INSERT RESPONSES $baselang = Survey::model()->findByPk($surveyid)->language; - $fieldmap = createFieldMap($surveyid,'short',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); $insert_data = array(); $_POST['startlanguage'] = $baselang; @@ -1718,7 +1718,7 @@ public function insert() { if ($thissurvey['datestamp'] == "Y") { - $_POST['submitdate'] = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); + $_POST['submitdate'] = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); } else { @@ -1747,7 +1747,7 @@ public function insert() { if ($_FILES[$fieldname."_file_".$i]['error'] != 4) { - $target = Yii::app()->getConfig('uploaddir')."/surveys/". $thissurvey['sid'] ."/files/".sRandomChars(20); + $target = Yii::app()->getConfig('uploaddir')."/surveys/". $thissurvey['sid'] ."/files/".randomChars(20); $size = 0.001 * $_FILES[$fieldname."_file_".$i]['size']; $name = rawurlencode($_FILES[$fieldname."_file_".$i]['name']); @@ -1800,7 +1800,7 @@ public function insert() if (isset($_POST['closedate'])) { $submitdate = $_POST['closedate']; } else - { $submitdate = date_shift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust); } + { $submitdate = dateShift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust); } // check how many uses the token has left $usesquery = "SELECT usesleft FROM {{tokens_}}$surveyid WHERE token='".$_POST['token']."'"; @@ -1810,7 +1810,7 @@ public function insert() // query for updating tokens $utquery = "UPDATE {{tokens_$surveyid}}\n"; - if (bIsTokenCompletedDatestamped($thissurvey)) + if (isTokenCompletedDatestamped($thissurvey)) { if (isset($usesleft) && $usesleft<=1) { @@ -1833,12 +1833,12 @@ public function insert() } } $utquery .= "WHERE token='".$_POST['token']."'"; - $utresult = db_execute_assoc($utquery); //Yii::app()->db->Execute($utquery) or safe_die ("Couldn't update tokens table!
    \n$utquery
    \n".Yii::app()->db->ErrorMsg()); + $utresult = db_execute_assoc($utquery); //Yii::app()->db->Execute($utquery) or safeDie ("Couldn't update tokens table!
    \n$utquery
    \n".Yii::app()->db->ErrorMsg()); // save submitdate into survey table $srid = Yii::app()->db->getLastInsertID(); // Yii::app()->db->getLastInsertID(); $sdquery = "UPDATE {{survey_$surveyid}} SET submitdate='".$submitdate."' WHERE id={$srid}\n"; - $sdresult = db_execute_assoc($sdquery) or safe_die ("Couldn't set submitdate response in survey table!
    \n$sdquery
    \n"); + $sdresult = db_execute_assoc($sdquery) or safeDie ("Couldn't set submitdate response in survey table!
    \n$sdquery
    \n"); $last_db_id = Yii::app()->db->getLastInsertID(); } if (isset($_POST['save']) && $_POST['save'] == "on") @@ -1853,7 +1853,7 @@ public function insert() $columns = array("sid", "srid", "identifier", "access_code", "email", "ip", "refurl", 'saved_thisstep', "status", "saved_date"); $values = array("'".$surveyid."'", "'".$srid."'", "'".$saver['identifier']."'", "'".$password."'", "'".$saver['email']."'", "'".$aUserData['ip_address']."'", - "'".getenv("HTTP_REFERER")."'", 0, "'"."S"."'", "'".date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "'".Yii::app()->getConfig('timeadjust'))."'"); + "'".getenv("HTTP_REFERER")."'", 0, "'"."S"."'", "'".dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "'".Yii::app()->getConfig('timeadjust'))."'"); $SQL = "INSERT INTO $saved_control_table (".implode(',',$columns).") @@ -1869,7 +1869,7 @@ public function insert() "refurl"=>getenv("HTTP_REFERER"), 'saved_thisstep' => 0, "status"=>"S", - "saved_date"=>date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust'))); + "saved_date"=>dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust'))); $this->load->model('saved_control_model');*/ if (db_execute_assoc($SQL)) { @@ -1888,15 +1888,15 @@ public function insert() "firstname"=> $saver['identifier'], "lastname"=> $saver['identifier'], "email"=>$saver['email'], - "token"=>sRandomChars(15), + "token"=>randomChars(15), "language"=>$saver['language'], - "sent"=>date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust), + "sent"=>dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust), "completed"=>"N");*/ $columns = array("firstname", "lastname", "email", "token", "language", "sent", "completed"); $values = array("'".$saver['identifier']."'", "'".$saver['identifier']."'", "'".$saver['email']."'", "'".$password."'", - "'".sRandomChars(15)."'", "'".$saver['language']."'", "'"."N"."'"); + "'".randomChars(15)."'", "'".$saver['language']."'", "'"."N"."'"); $SQL = "INSERT INTO $token_table (".implode(',',$columns).") @@ -1913,7 +1913,7 @@ public function insert() if ($saver['email']) { //Send email - if (validate_email($saver['email']) && !returnglobal('redo')) + if (validateEmailAddress($saver['email']) && !returnGlobal('redo')) { $subject = $clang->gT("Saved Survey Details"); $message = $clang->gT("Thank you for saving your survey in progress. The following details can be used to return to this survey and continue where you left off. Please keep this e-mail for your reference - we cannot retrieve the password for you."); @@ -1936,7 +1936,7 @@ public function insert() } else { - safe_die("Unable to insert record into saved_control table.

    "); + safeDie("Unable to insert record into saved_control table.

    "); } } @@ -1967,7 +1967,7 @@ public function view($surveyid, $lang=NULL) if(isset($lang)) $lang=sanitize_languagecode($lang); $aViewUrls = array(); - if (bHasSurveyPermission($surveyid, 'responses', 'read')) + if (hasSurveyPermission($surveyid, 'responses', 'read')) { $clang = Yii::app()->lang; @@ -2020,14 +2020,14 @@ public function view($surveyid, $lang=NULL) $deqquery = "SELECT * FROM {{questions}} WHERE sid=$surveyid AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'"; $deqrows = (array) db_execute_assoc($deqquery)->readAll(); $aDataentryoutput .= "\t\n" - ."".FlattenText($degrow['group_name'],true)."\n" + ."".flattenText($degrow['group_name'],true)."\n" ."\t\n"; $gid = $degrow['gid']; $aDataentryoutput .= "\t\n"; // Perform a case insensitive natural sort on group name then question title of a multidimensional array - usort($deqrows, 'GroupOrderThenQuestionOrder'); + usort($deqrows, 'groupOrderThenQuestionOrder'); foreach ($deqrows as $deqrow) { @@ -2095,7 +2095,7 @@ public function view($surveyid, $lang=NULL) // $fquery = "SELECT * FROM {{labels}}" // . "WHERE lid='{$conrow['lid']}'\n and language='$sDataEntryLanguage' " // . "AND code='{$conrow['value']}'"; -// $fresult=db_execute_assoc($fquery) or safe_die("$fquery
    Failed to execute this command in Data entry controller"); +// $fresult=db_execute_assoc($fquery) or safeDie("$fquery
    Failed to execute this command in Data entry controller"); // foreach($fresult->readAll() as $frow) // { // $postans=$frow['title']; @@ -2118,7 +2118,7 @@ public function view($surveyid, $lang=NULL) // $fquery = "SELECT * FROM {{questions}} " // . "WHERE qid='{$conrow['cqid']}'\n and language='$sDataEntryLanguage' " // . "AND title='{$conrow['title']}' and scale_id=0"; -// $fresult=db_execute_assoc($fquery) or safe_die("$fquery
    Failed to execute this command in Data Entry controller."); +// $fresult=db_execute_assoc($fquery) or safeDie("$fquery
    Failed to execute this command in Data Entry controller."); // if ($fresult->getRowCount() <= 0) die($fquery); // foreach($fresult->readAll() as $frow) // { @@ -2197,7 +2197,7 @@ public function view($surveyid, $lang=NULL) $explanation = trim($qinfo['relEqn']); $validation = trim($qinfo['prettyValidTip']); $qidattributes=getQuestionAttributeValues($deqrow['qid']); - $array_filter_help = FlattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid)); + $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid)); if (($relevance != '' && $relevance != '1') || ($validation != '') || ($array_filter_help != '')) { @@ -2264,7 +2264,7 @@ public function view($surveyid, $lang=NULL) $cdata['dearesult'] = $dearesult->readAll(); $oquery="SELECT other FROM {{questions}} WHERE qid={$deqrow['qid']} AND language='{$baselang}'"; - $oresult=db_execute_assoc($oquery) or safe_die("Couldn't get other for list question
    ".$oquery); + $oresult=db_execute_assoc($oquery) or safeDie("Couldn't get other for list question
    ".$oquery); foreach($oresult->readAll() as $orow) { $cdata['fother']=$orow['other']; @@ -2334,7 +2334,7 @@ public function view($surveyid, $lang=NULL) } $oquery="SELECT other FROM {{questions}} WHERE qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}'"; - $oresult=db_execute_assoc($oquery) or safe_die("Couldn't get other for list question
    "); + $oresult=db_execute_assoc($oquery) or safeDie("Couldn't get other for list question
    "); foreach($oresult->readAll() as $orow) { $fother=$orow['other']; @@ -2511,7 +2511,7 @@ public function view($surveyid, $lang=NULL) break; case "E": //ARRAY (YES/UNCERTAIN/NO) radio-buttons $meaquery = "SELECT title, question FROM {{questions}} WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order"; - $mearesult=db_execute_assoc($meaquery) or safe_die ("Couldn't get answers, Type \"E\"
    $meaquery
    "); + $mearesult=db_execute_assoc($meaquery) or safeDie ("Couldn't get answers, Type \"E\"
    $meaquery
    "); $cdata['mearesult'] = $mearesult->readAll(); break; @@ -2575,7 +2575,7 @@ public function view($surveyid, $lang=NULL) case "F": //ARRAY (Flexible Labels) case "H": $meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order"; - $mearesult=db_execute_assoc($meaquery) or safe_die ("Couldn't get answers, Type \"E\"
    $meaquery
    "); + $mearesult=db_execute_assoc($meaquery) or safeDie ("Couldn't get answers, Type \"E\"
    $meaquery
    "); $cdata['mearesult'] = $mearesult->readAll(); @@ -2701,8 +2701,8 @@ private function _prepFieldValues($fieldnames, $field, $fieldcount, $donotimport // Make this safe for DB (*after* we undo first excel's // and then our escaping). - $fieldvalues = array_map( 'db_quoteall', $fieldvalues ); - $fieldvalues = str_replace( db_quoteall('{question_not_shown}'), 'NULL', $fieldvalues ); + $fieldvalues = array_map( 'dbQuoteAll', $fieldvalues ); + $fieldvalues = str_replace( dbQuoteAll('{question_not_shown}'), 'NULL', $fieldvalues ); return $fieldvalues; } @@ -2717,7 +2717,7 @@ private function _array_filter_help($qidattributes, $surveyprintlang, $surveyid) { $newquestiontext = Questions::model()->findByAttributes(array('title' => $qidattributes['array_filter'], 'language' => $surveyprintlang, 'sid' => $surveyid))->getAttribute('question'); $output .= "\n

    - ".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], FlattenText(br2nl($newquestiontext['question'])))." + ".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], flattenText(breakToNewline($newquestiontext['question'])))."

    \n"; } if(!empty($qidattributes['array_filter_exclude'])) @@ -2725,7 +2725,7 @@ private function _array_filter_help($qidattributes, $surveyprintlang, $surveyid) $newquestiontext = Questions::model()->findByAttributes(array('title' => $qidattributes['array_filter_exclude'], 'language' => $surveyprintlang, 'sid' => $surveyid))->getAttribute('question'); $output .= "\n

    - ".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], br2nl($newquestiontext['question']))." + ".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], breakToNewline($newquestiontext['question']))."

    \n"; } return $output; diff --git a/application/controllers/admin/dumpdb.php b/application/controllers/admin/dumpdb.php index 07b2568156f..10d932f860e 100644 --- a/application/controllers/admin/dumpdb.php +++ b/application/controllers/admin/dumpdb.php @@ -69,7 +69,7 @@ private function _getDbName() { */ private function _outputHeaders($sDbName) { - $sFileName = 'LimeSurvey_'.$sDbName.'_dump_'.date_shift(date('Y-m-d H:i:s'), 'Y-m-d', Yii::app()->getConfig('timeadjust')).'.sql'; + $sFileName = 'LimeSurvey_'.$sDbName.'_dump_'.dateShift(date('Y-m-d H:i:s'), 'Y-m-d', Yii::app()->getConfig('timeadjust')).'.sql'; header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$sFileName); @@ -95,7 +95,7 @@ private function _outputDBDescription($sDbName, $bAllowExportAllDb) if (!$bAllowExportAllDb) { echo '-- Only prefixed tables with: ' . Yii::app()->db->tablePrefix . "\n"; } - echo '-- Date of Dump: ' . date_shift(date('d-M-Y'), 'd-M-Y', Yii::app()->getConfig('timeadjust')) . "\n"; + echo '-- Date of Dump: ' . dateShift(date('d-M-Y'), 'd-M-Y', Yii::app()->getConfig('timeadjust')) . "\n"; echo '--' . "\n"; } diff --git a/application/controllers/admin/emailtemplates.php b/application/controllers/admin/emailtemplates.php index 324e7b0cb86..e14f45febf2 100644 --- a/application/controllers/admin/emailtemplates.php +++ b/application/controllers/admin/emailtemplates.php @@ -60,7 +60,7 @@ function index($iSurveyId) { $aData['bplangs'][$key] = new limesurvey_lang($grouplang); $aData['attrib'][$key] = Surveys_languagesettings::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang)); - $aData['defaulttexts'][$key] = aTemplateDefaultTexts($aData['bplangs'][$key]); + $aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key]); } $aData['surveyid'] = $iSurveyId; @@ -76,7 +76,7 @@ function index($iSurveyId) function update($iSurveyId) { $clang = $this->getController()->lang; - if (bHasSurveyPermission($iSurveyId, 'surveylocale','update')) + if (hasSurveyPermission($iSurveyId, 'surveylocale','update')) { $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages; $languagelist[] = Survey::model()->findByPk($iSurveyId)->language; diff --git a/application/controllers/admin/export.php b/application/controllers/admin/export.php index 19dce3016a9..c1926783204 100644 --- a/application/controllers/admin/export.php +++ b/application/controllers/admin/export.php @@ -35,7 +35,7 @@ public function survey() $action = Yii::app()->request->getParam('action'); $surveyid = sanitize_int(Yii::app()->request->getParam('surveyid')); - if ( bHasSurveyPermission($surveyid, 'surveycontent', 'export') ) + if ( hasSurveyPermission($surveyid, 'surveycontent', 'export') ) { $this->_surveyexport($action, $surveyid); return; @@ -69,7 +69,7 @@ public function surveyarchives() if ( count($aExportedFiles) > 0 ) { - $aZIPFileName=$this->config->item("tempdir") . DIRECTORY_SEPARATOR . sRandomChars(30); + $aZIPFileName=$this->config->item("tempdir") . DIRECTORY_SEPARATOR . randomChars(30); $this->load->library("admin/pclzip/pclzip", array('p_zipname' => $aZIPFileName)); @@ -111,7 +111,7 @@ public function group() $gid = sanitize_int(Yii::app()->request->getParam('gid')); $surveyid = sanitize_int(Yii::app()->request->getParam('surveyid')); - if ( Yii::app()->getConfig("export4lsrc") === TRUE && bHasSurveyPermission($surveyid, 'survey', 'export') ) + if ( Yii::app()->getConfig("export4lsrc") === TRUE && hasSurveyPermission($surveyid, 'survey', 'export') ) { if ( ! empty($_POST['action']) ) { @@ -137,7 +137,7 @@ public function question() $qid = sanitize_int(Yii::app()->request->getParam('qid')); $surveyid = sanitize_int(Yii::app()->request->getParam('surveyid')); - if( Yii::app()->getConfig('export4lsrc') === TRUE && bHasSurveyPermission($surveyid, 'survey', 'export') ) + if( Yii::app()->getConfig('export4lsrc') === TRUE && hasSurveyPermission($surveyid, 'survey', 'export') ) { if( ! empty($_POST['action']) ) { @@ -162,17 +162,17 @@ public function exportresults() $surveyid = sanitize_int(Yii::app()->request->getParam('surveyid')); if ( ! isset($imageurl) ) { $imageurl = "./images"; } - if ( ! isset($surveyid) ) { $surveyid = returnglobal('sid'); } - if ( ! isset($exportstyle) ) { $exportstyle = returnglobal('exportstyle'); } - if ( ! isset($answers) ) { $answers = returnglobal('answers'); } - if ( ! isset($type) ) { $type = returnglobal('type'); } - if ( ! isset($convertyto1) ) { $convertyto1 = returnglobal('convertyto1'); } - if ( ! isset($convertnto2) ) { $convertnto2 = returnglobal('convertnto2'); } - if ( ! isset($convertspacetous) ) { $convertspacetous = returnglobal('convertspacetous'); } + if ( ! isset($surveyid) ) { $surveyid = returnGlobal('sid'); } + if ( ! isset($exportstyle) ) { $exportstyle = returnGlobal('exportstyle'); } + if ( ! isset($answers) ) { $answers = returnGlobal('answers'); } + if ( ! isset($type) ) { $type = returnGlobal('type'); } + if ( ! isset($convertyto1) ) { $convertyto1 = returnGlobal('convertyto1'); } + if ( ! isset($convertnto2) ) { $convertnto2 = returnGlobal('convertnto2'); } + if ( ! isset($convertspacetous) ) { $convertspacetous = returnGlobal('convertspacetous'); } $clang = Yii::app()->lang; - if ( ! bHasSurveyPermission($surveyid, 'responses', 'export') ) + if ( ! hasSurveyPermission($surveyid, 'responses', 'export') ) { exit; } @@ -188,7 +188,7 @@ public function exportresults() if ( ! $exportstyle ) { //FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT - $excesscols = createFieldMap($surveyid,'short',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $excesscols = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); $excesscols = array_keys($excesscols); $afieldcount = count($excesscols); @@ -198,11 +198,11 @@ public function exportresults() $selecthide = "'"; $selectshow = ""; $selectinc = ""; - if ( incompleteAnsFilterstate() == "filter" ) + if ( incompleteAnsFilterState() == "filter" ) { $selecthide = "selected='selected'"; } - elseif ( incompleteAnsFilterstate() == "inc" ) + elseif ( incompleteAnsFilterState() == "inc" ) { $selectinc = "selected='selected'"; } @@ -264,7 +264,7 @@ public function exportresults() $options->format = $type; $options->headerSpacesToUnderscores = $convertspacetous; $options->headingFormat = $exportstyle; - $options->responseCompletionState = incompleteAnsFilterstate(); + $options->responseCompletionState = incompleteAnsFilterState(); //If we have no data for the filter state then default to show all. if ( empty($options->responseCompletionState) ) @@ -297,7 +297,7 @@ public function exportresults() $dquery .= ", {{tokens_$surveyid}}.token"; } - $attributeFields = GetTokenFieldsAndNames($surveyid, TRUE); + $attributeFields = getTokenFieldsAndNames($surveyid, TRUE); foreach ($attributeFields as $attr_name => $attr_desc) { @@ -343,8 +343,8 @@ public function exportspss() // $typeMap = $this->_getTypeMap(); - $filterstate = incompleteAnsFilterstate(); - $spssver = returnglobal('spssver'); + $filterstate = incompleteAnsFilterState(); + $spssver = returnGlobal('spssver'); if ( is_null($spssver) ) { @@ -640,8 +640,8 @@ public function exportr() $headerComment = ''; $tempFile = ''; - if ( ! isset($surveyid) ) { $surveyid = returnglobal('sid'); } - $filterstate = incompleteAnsFilterstate(); + if ( ! isset($surveyid) ) { $surveyid = returnGlobal('sid'); } + $filterstate = incompleteAnsFilterState(); $headerComment = '#$Rev: 10193 $' . " $filterstate.\n"; @@ -886,7 +886,7 @@ public function vvexport() //Exports all responses to a survey in special "Verified Voting" format. $clang = $this->getController()->lang; - if ( ! bHasSurveyPermission($surveyid, 'responses','export') ) + if ( ! hasSurveyPermission($surveyid, 'responses','export') ) { return; } @@ -896,11 +896,11 @@ public function vvexport() $selecthide = ""; $selectshow = ""; $selectinc = ""; - if( incompleteAnsFilterstate() == "inc" ) + if( incompleteAnsFilterState() == "inc" ) { $selectinc = "selected='selected'"; } - elseif ( incompleteAnsFilterstate() == "filter" ) + elseif ( incompleteAnsFilterState() == "filter" ) { $selecthide = "selected='selected'"; } @@ -920,14 +920,14 @@ public function vvexport() elseif ( isset($surveyid) && $surveyid ) { //Export is happening - $extension = sanitize_paranoid_string(returnglobal('extension')); + $extension = sanitize_paranoid_string(returnGlobal('extension')); $fn = "vvexport_$surveyid." . $extension; $this->_addHeaders($fn, "text/comma-separated-values", 0, "cache"); $s="\t"; - $fieldmap = createFieldMap($surveyid,'full',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); $surveytable = "{{survey_$surveyid}}"; Survey::model()->findByPk($surveyid)->language; @@ -957,11 +957,11 @@ public function vvexport() $vvoutput .= $secondline . "\n"; $query = "SELECT * FROM ".Yii::app()->db->quoteTableName($surveytable); - if (incompleteAnsFilterstate() == "inc") + if (incompleteAnsFilterState() == "inc") { $query .= " WHERE submitdate IS NULL "; } - elseif (incompleteAnsFilterstate() == "filter") + elseif (incompleteAnsFilterState() == "filter") { $query .= " WHERE submitdate >= '01/01/1980' "; } @@ -1141,7 +1141,7 @@ public function dumplabel() // 1. questions // 2. answers - $lids=returnglobal('lids'); + $lids=returnGlobal('lids'); if ( ! $lid && ! $lids ) { @@ -1193,11 +1193,11 @@ private function _exportarchive($iSurveyID, $bSendToBrowser=TRUE) $sTempDir = Yii::app()->getConfig("tempdir"); - $aZIPFileName = $sTempDir . DIRECTORY_SEPARATOR . sRandomChars(30); - $sLSSFileName = $sTempDir . DIRECTORY_SEPARATOR . sRandomChars(30); - $sLSRFileName = $sTempDir . DIRECTORY_SEPARATOR . sRandomChars(30); - $sLSTFileName = $sTempDir . DIRECTORY_SEPARATOR . sRandomChars(30); - $sLSIFileName = $sTempDir . DIRECTORY_SEPARATOR . sRandomChars(30); + $aZIPFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30); + $sLSSFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30); + $sLSRFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30); + $sLSTFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30); + $sLSIFileName = $sTempDir . DIRECTORY_SEPARATOR . randomChars(30); Yii::import('application.libraries.admin.pclzip.pclzip', TRUE); $zip = new PclZip($aZIPFileName); diff --git a/application/controllers/admin/fck_LimeReplacementFields.php b/application/controllers/admin/fck_LimeReplacementFields.php index d7fca611f6e..dc79fb164a0 100644 --- a/application/controllers/admin/fck_LimeReplacementFields.php +++ b/application/controllers/admin/fck_LimeReplacementFields.php @@ -37,11 +37,11 @@ public function index($fieldtype, $action, $surveyid = false, $gid = false, $qid if ($isInstertAnswerEnabled === true) { if (empty($surveyid)) { - safe_die("No SID provided."); + safeDie("No SID provided."); } //2: Get all other questions that occur before this question that are pre-determined answer types - $fieldmap = createFieldMap($surveyid,'full',false,false,GetbaseLanguageFromSurveyid($surveyid)); + $fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); $surveyInfo = getSurveyInfo($surveyid); $surveyformat = $surveyInfo['format']; // S, G, A @@ -100,7 +100,7 @@ private function _shouldAddQuestion($action, $gid, $qid, array $question, $previ case 'editgroup_desc': case 'translategroup': if (empty($gid)) { - safe_die("No GID provided."); + safeDie("No GID provided."); } if ($question['gid'] == $gid) { @@ -110,7 +110,7 @@ private function _shouldAddQuestion($action, $gid, $qid, array $question, $previ case 'addquestion': if (empty($gid)) { - safe_die("No GID provided."); + safeDie("No GID provided."); } if (!is_null($previousQuestion) && $previousQuestion['gid'] == $gid && $question['gid'] != $gid ) { @@ -124,10 +124,10 @@ private function _shouldAddQuestion($action, $gid, $qid, array $question, $previ case 'translatequestion': case 'translateanswer': if (empty($gid)) { - safe_die("No GID provided."); + safeDie("No GID provided."); } if (empty($qid)) { - safe_die("No QID provided."); + safeDie("No QID provided."); } if ($question['gid'] == $gid && $question['qid'] == $qid) { @@ -138,7 +138,7 @@ private function _shouldAddQuestion($action, $gid, $qid, array $question, $previ // this is the case for email-conf return true; default: - safe_die("No Action provided."); + safeDie("No Action provided."); } } @@ -183,7 +183,7 @@ private function _getChildQuestions(array $questions) $question = "[{$row['subquestion2']}] " . $question; } - $shortquestion = $row['title'] . ": " . FlattenText($question); + $shortquestion = $row['title'] . ": " . flattenText($question); $cquestions[] = array($shortquestion, $row['qid'], $row['type'], $row['fieldname'], $row['previouspage']); } return $cquestions; @@ -206,7 +206,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('TOKEN:FIRSTNAME', $clang->gT("Firstname from token")); $replFields[] = array('TOKEN:LASTNAME', $clang->gT("Lastname from token")); $replFields[] = array('TOKEN:EMAIL', $clang->gT("Email from the token")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array('TOKEN:' . strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); @@ -224,7 +224,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('TOKEN:LASTNAME', $clang->gT("Last name from token")); $replFields[] = array('SURVEYNAME', $clang->gT("Name of the survey")); $replFields[] = array('SURVEYDESCRIPTION', $clang->gT("Description of the survey")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); @@ -244,7 +244,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('TOKEN:LASTNAME', $clang->gT("Last name from token")); $replFields[] = array('SURVEYNAME', $clang->gT("Name of the survey")); $replFields[] = array('SURVEYDESCRIPTION', $clang->gT("Description of the survey")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); @@ -266,7 +266,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('LASTNAME', $clang->gT("Lastname from token")); $replFields[] = array('SURVEYNAME', $clang->gT("Name of the survey")); $replFields[] = array('SURVEYDESCRIPTION', $clang->gT("Description of the survey")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); @@ -283,7 +283,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('LASTNAME', $clang->gT("Lastname from token")); $replFields[] = array('SURVEYNAME', $clang->gT("Name of the survey")); $replFields[] = array('SURVEYDESCRIPTION', $clang->gT("Description of the survey")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); @@ -316,7 +316,7 @@ private function _getReplacementFields($fieldtype, $surveyid) $replFields[] = array('GID', $clang->gT("This question's group ID number")); $replFields[] = array('QID', $clang->gT("This question's question ID number")); $replFields[] = array('SGQ', $clang->gT("This question's SGQA code")); - $attributes = GetTokenFieldsAndNames($surveyid, true); + $attributes = getTokenFieldsAndNames($surveyid, true); foreach ($attributes as $attributefield => $attributedescription) { $replFields[] = array('TOKEN:' . strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription)); diff --git a/application/controllers/admin/globalsettings.php b/application/controllers/admin/globalsettings.php index 5b631acdfb6..368a4cfdcad 100644 --- a/application/controllers/admin/globalsettings.php +++ b/application/controllers/admin/globalsettings.php @@ -114,21 +114,21 @@ private function _saveSettings() setGlobalSetting('defaulthtmleditormode', sanitize_paranoid_string($_POST['defaulthtmleditormode'])); setGlobalSetting('defaulttemplate', sanitize_paranoid_string($_POST['defaulttemplate'])); setGlobalSetting('emailmethod', strip_tags($_POST['emailmethod'])); - setGlobalSetting('emailsmtphost', strip_tags(returnglobal('emailsmtphost'))); - if (returnglobal('emailsmtppassword') != 'somepassword') { - setGlobalSetting('emailsmtppassword', strip_tags(returnglobal('emailsmtppassword'))); + setGlobalSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost'))); + if (returnGlobal('emailsmtppassword') != 'somepassword') { + setGlobalSetting('emailsmtppassword', strip_tags(returnGlobal('emailsmtppassword'))); } - setGlobalSetting('bounceaccounthost', strip_tags(returnglobal('bounceaccounthost'))); - setGlobalSetting('bounceaccounttype', strip_tags(returnglobal('bounceaccounttype'))); - setGlobalSetting('bounceencryption', strip_tags(returnglobal('bounceencryption'))); - setGlobalSetting('bounceaccountuser', strip_tags(returnglobal('bounceaccountuser'))); + setGlobalSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost'))); + setGlobalSetting('bounceaccounttype', strip_tags(returnGlobal('bounceaccounttype'))); + setGlobalSetting('bounceencryption', strip_tags(returnGlobal('bounceencryption'))); + setGlobalSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser'))); - if (returnglobal('bounceaccountpass') != 'enteredpassword') { - setGlobalSetting('bounceaccountpass', strip_tags(returnglobal('bounceaccountpass'))); + if (returnGlobal('bounceaccountpass') != 'enteredpassword') { + setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass'))); } - setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(returnglobal('emailsmtpssl'))); - setGlobalSetting('emailsmtpdebug', sanitize_int(returnglobal('emailsmtpdebug'))); - setGlobalSetting('emailsmtpuser', strip_tags(returnglobal('emailsmtpuser'))); + setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(returnGlobal('emailsmtpssl'))); + setGlobalSetting('emailsmtpdebug', sanitize_int(returnGlobal('emailsmtpdebug'))); + setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser'))); setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml'])); setGlobalSetting('siteadminbounce', strip_tags($_POST['siteadminbounce'])); setGlobalSetting('siteadminemail', strip_tags($_POST['siteadminemail'])); diff --git a/application/controllers/admin/index.php b/application/controllers/admin/index.php index bcf7b0a2093..ba20c88a64c 100644 --- a/application/controllers/admin/index.php +++ b/application/controllers/admin/index.php @@ -19,7 +19,7 @@ public function run() $clang = Yii::app()->lang; $aViewUrls = array(); - if (count(getsurveylist(true)) == 0) + if (count(getSurveyList(true)) == 0) { $aViewUrls = 'firststeps'; } diff --git a/application/controllers/admin/kcfinder.php b/application/controllers/admin/kcfinder.php index b3dc1f1a24d..2819894b940 100644 --- a/application/controllers/admin/kcfinder.php +++ b/application/controllers/admin/kcfinder.php @@ -41,7 +41,7 @@ function index($load = false) $contextarray = explode(':', Yii::app()->session['FileManagerContext'], 3); $surveyid = $contextarray[2]; - if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'update')) { $_SESSION['KCFINDER']['disabled'] = false; $_SESSION['KCFINDER']['uploadURL'] = $this->getController()->createUrl("upload/surveys/{$surveyid}/"); diff --git a/application/controllers/admin/labels.php b/application/controllers/admin/labels.php index 4e01e1e65cd..87d8c8000f6 100644 --- a/application/controllers/admin/labels.php +++ b/application/controllers/admin/labels.php @@ -49,7 +49,7 @@ public function run($sa) public function importlabelresources() { $clang = $this->getController()->lang; - $lid = returnglobal('lid'); + $lid = returnGlobal('lid'); if (!empty($lid)) { @@ -121,7 +121,7 @@ public function importlabelresources() public function import() { $clang = $this->getController()->lang; - $action = returnglobal('action'); + $action = returnGlobal('action'); $aViewUrls = array(); if ($action == 'importlabels') @@ -330,9 +330,9 @@ public function process() if (isset($_POST['method']) && get_magic_quotes_gpc()) $_POST['method'] = stripslashes($_POST['method']); - $action = returnglobal('action'); + $action = returnGlobal('action'); Yii::app()->loadHelper('admin/label'); - $lid = returnglobal('lid'); + $lid = returnGlobal('lid'); if ($action == "updateset") { @@ -438,7 +438,7 @@ protected function _renderWrappedTemplate($sAction = 'labels', $aViewUrls = arra { if (empty($aData['labelsets'])) { - $aData['labelsets'] = getlabelsets(); + $aData['labelsets'] = getLabelSets(); } if (empty($aData['lid'])) diff --git a/application/controllers/admin/participantsaction.php b/application/controllers/admin/participantsaction.php index 63817594a45..075ff30201d 100644 --- a/application/controllers/admin/participantsaction.php +++ b/application/controllers/admin/participantsaction.php @@ -189,7 +189,7 @@ function getShareInfo_json() $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } // otherwise only the shared participants by that user else @@ -207,7 +207,7 @@ function getShareInfo_json() $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } } @@ -271,7 +271,7 @@ function getAttributeInfo_json() $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } /** @@ -434,7 +434,7 @@ function getSurveyInfo_json() $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } /** @@ -858,7 +858,7 @@ function subval_sort($a, $subkey, $order) $i++; } } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } // Only the owned and shared participants will be visible else @@ -942,7 +942,7 @@ function subval_sort($a, $subkey, $order) $i++; } } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } } @@ -1024,7 +1024,7 @@ function subval_sort($a, $subkey, $order) } $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } // Only the owned and shared participants will be visible else @@ -1092,7 +1092,7 @@ function subval_sort($a, $subkey, $order) } $i++; } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } } @@ -1184,7 +1184,7 @@ function getAttribute_json() $i++; } } - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } /* @@ -1506,7 +1506,7 @@ function uploadCSV() $aEmailAddresses = explode(';', $writearray['email']); foreach ($aEmailAddresses as $sEmailaddress) { - if (!validate_email($sEmailaddress)) + if (!validateEmailAddress($sEmailaddress)) { $invalidemail = true; $invalidemaillist[] = $line[0] . " " . $line[1] . " (" . $line[2] . ")"; @@ -1715,7 +1715,7 @@ function attributeMap() if (is_array($arr)) { $tokenfieldnames = array_keys($arr); - $tokenattributefieldnames = array_filter($tokenfieldnames, 'filterforattributes'); + $tokenattributefieldnames = array_filter($tokenfieldnames, 'filterForAttributes'); } else { @@ -1776,7 +1776,7 @@ function attributeMapToken() $iSurveyId = Yii::app()->request->getQuery('sid'); $attributes = ParticipantAttributeNames::getAttributes(); - $tokenattributefieldnames = GetTokenFieldsAndNames($iSurveyId, TRUE); + $tokenattributefieldnames = getTokenFieldsAndNames($iSurveyId, TRUE); $selectedattribute = array(); $selectedcentralattribute = array(); diff --git a/application/controllers/admin/printablesurvey.php b/application/controllers/admin/printablesurvey.php index a8e716c3027..afcb5a3b848 100644 --- a/application/controllers/admin/printablesurvey.php +++ b/application/controllers/admin/printablesurvey.php @@ -47,7 +47,7 @@ function index($surveyid, $lang = null) if ($lang) $surveyprintlang = $lang; } else { - $surveyprintlang=GetbaseLanguageFromSurveyid((int) $surveyid); + $surveyprintlang=getBaseLanguageFromSurveyID((int) $surveyid); } $_POST['surveyprintlang']=$surveyprintlang; @@ -229,7 +229,7 @@ function index($surveyid, $lang = null) foreach ($deqresult->readAll() as $deqrow) {$deqrows[] = $deqrow;} // Get table output into array // Perform a case insensitive natural sort on group name then question title of a multidimensional array - usort($deqrows, 'GroupOrderThenQuestionOrder'); + usort($deqrows, 'groupOrderThenQuestionOrder'); if ($degrow['description']) { @@ -358,7 +358,7 @@ function index($surveyid, $lang = null) // } // } // if(!$distinctrow['cqid']) { // cqid == 0 ==> token attribute match -// $tokenData = GetTokenFieldsAndNames($surveyid); +// $tokenData = getTokenFieldsAndNames($surveyid); // preg_match('/^{TOKEN:([^}]*)}$/',$distinctrow['cfieldname'],$extractedTokenAttr); // $explanation .= "Your ".$tokenData[strtolower($extractedTokenAttr[1])]." "; // if($distinctrow['method']=='==') @@ -646,7 +646,7 @@ function index($surveyid, $lang = null) ,'QUESTION_SCENARIO' => $explanation // if there are conditions on a question, list the conditions. ,'QUESTION_MANDATORY' => '' // translated 'mandatory' identifier ,'QUESTION_ID' => $deqrow['qid'] // id to be added to wrapping question div - ,'QUESTION_CLASS' => question_class( $deqrow['type']) // classes to be added to wrapping question div + ,'QUESTION_CLASS' => getQuestionClass( $deqrow['type']) // classes to be added to wrapping question div ,'QUESTION_TYPE_HELP' => $qinfo['prettyValidTip'] // '' // instructions on how to complete the question ,'QUESTION_MAN_MESSAGE' => '' // (not sure if this is used) mandatory error ,'QUESTION_VALID_MESSAGE' => '' // (not sure if this is used) validation error @@ -763,7 +763,7 @@ function index($surveyid, $lang = null) $deacount=$dearesult->getRowCount(); if ($deqrow['other'] == "Y") {$deacount++;} - $wrapper = setup_columns(0, $deacount); + $wrapper = setupColumns(0, $deacount); $question['ANSWER'] = $wrapper['whole-start']; @@ -879,7 +879,7 @@ function index($surveyid, $lang = null) $meacount = $mearesult->getRowCount(); if ($deqrow['other'] == 'Y') {$meacount++;} - $wrapper = setup_columns($dcols, $meacount); + $wrapper = setupColumns($dcols, $meacount); $question['ANSWER'] = $wrapper['whole-start']; $rowcounter = 0; @@ -933,7 +933,7 @@ function index($surveyid, $lang = null) $longest_string = 0; foreach ($mearesult->readAll() as $mearow) { - $longest_string = longest_string($mearow['question'] , $longest_string ); + $longest_string = longestString($mearow['question'] , $longest_string ); $question['ANSWER'] .= "\t
  • \n\t\t".self::_input_type_image('checkbox',$mearow['question']).$mearow['question'].self::_addsgqacode(" (".$fieldname.$mearow['title'].") ")."\n\t\t".self::_input_type_image('text','comment box',60).self::_addsgqacode(" (".$fieldname.$mearow['title']."comment) ")."\n\t
  • \n"; $pdfoutput[$j]=array(" o ".$mearow['title']," __________"); $j++; @@ -983,7 +983,7 @@ function index($surveyid, $lang = null) $longest_string = 0; foreach ($mearesult->readAll() as $mearow) { - $longest_string = longest_string($mearow['question'] , $longest_string ); + $longest_string = longestString($mearow['question'] , $longest_string ); if (isset($qidattributes['slider_layout']) && $qidattributes['slider_layout']==1) { $mearow['question']=explode(':',$mearow['question']); @@ -1958,7 +1958,7 @@ private function _array_filter_help($qidattributes, $surveyprintlang, $surveyid) { $newquestiontext = Questions::model()->findByAttributes(array('title' => $qidattributes['array_filter'], 'language' => $surveyprintlang, 'sid' => $surveyid))->getAttribute('question'); $output .= "\n

    - ".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], FlattenText(br2nl($newquestiontext['question'])))." + ".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], flattenText(breakToNewline($newquestiontext['question'])))."

    \n"; } if(!empty($qidattributes['array_filter_exclude'])) @@ -1966,7 +1966,7 @@ private function _array_filter_help($qidattributes, $surveyprintlang, $surveyid) $newquestiontext = Questions::model()->findByAttributes(array('title' => $qidattributes['array_filter_exclude'], 'language' => $surveyprintlang, 'sid' => $surveyid))->getAttribute('question'); $output .= "\n

    - ".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], br2nl($newquestiontext['question']))." + ".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], breakToNewline($newquestiontext['question']))."

    \n"; } return $output; diff --git a/application/controllers/admin/question.php b/application/controllers/admin/question.php index a41d2282548..507e4c57b2c 100644 --- a/application/controllers/admin/question.php +++ b/application/controllers/admin/question.php @@ -36,9 +36,9 @@ class question extends Survey_Common_Action */ public function import() { - $action = returnglobal('action'); - $surveyid = returnglobal('sid'); - $gid = returnglobal('gid'); + $action = returnGlobal('action'); + $surveyid = returnGlobal('sid'); + $gid = returnGlobal('gid'); $clang = $this->getController()->lang; $aViewUrls = array(); @@ -77,7 +77,7 @@ public function import() else $this->getController()->error($clang->gT('Unknown file extension')); - FixLanguageConsistency($surveyid); + fixLanguageConsistency($surveyid); if (isset($aImportResults['fatalerror'])) { @@ -129,7 +129,7 @@ public function editdefaultvalues($surveyid, $gid, $qid) 'gid' => $gid, 'language' => $baselang ))->attributes; - $qtproperties = getqtypelist('', 'array'); + $qtproperties = getQuestionTypeList('', 'array'); $langopts = array(); foreach ($questlangs as $language) @@ -287,7 +287,7 @@ public function _editansweroptions($surveyid, $gid, $qid) $qrow = Questions::model()->findByAttributes(array('qid' => $qid, 'language' => $baselang)); $qtype = $qrow['type']; - $qtypes = getqtypelist('', 'array'); + $qtypes = getQuestionTypeList('', 'array'); $scalecount = $qtypes[$qtype]['answerscales']; @@ -384,7 +384,7 @@ public function _editansweroptions($surveyid, $gid, $qid) $surveyinfo = $sumresult1->attributes; $surveyinfo = array_merge($surveyinfo, $sumresult1->languagesettings->attributes); - $surveyinfo = array_map('FlattenText', $surveyinfo); + $surveyinfo = array_map('flattenText', $surveyinfo); $assessmentvisible = ($surveyinfo['assessments'] == 'Y' && $qtypes[$qtype]['assessable'] == 1); $aData['assessmentvisible'] = $assessmentvisible; @@ -447,7 +447,7 @@ public function _editsubquestion($surveyid, $gid, $qid) $resultrow = Questions::model()->findByPk(array('qid' => $qid, 'language' => $baselang))->attributes; $sQuestiontype = $resultrow['type']; - $aQuestiontypeInfo = getqtypelist($sQuestiontype, 'array'); + $aQuestiontypeInfo = getQuestionTypeList($sQuestiontype, 'array'); $iScaleCount = $aQuestiontypeInfo[$sQuestiontype]['subquestions']; for ($iScale = 0; $iScale < $iScaleCount; $iScale++) @@ -497,7 +497,7 @@ public function _editsubquestion($surveyid, $gid, $qid) // Means that no record for the language exists in the questions table if (empty($qrow)) { - db_switchIDInsert('questions', true); + switchMSSQLIdentityInsert('questions', true); Questions::model()->insert(array( 'qid' => $row->qid, @@ -511,7 +511,7 @@ public function _editsubquestion($surveyid, $gid, $qid) 'scale_id' => $iScale, )); - db_switchIDInsert('questions', false); + switchMSSQLIdentityInsert('questions', false); } } } @@ -560,7 +560,7 @@ public function _editsubquestion($surveyid, $gid, $qid) * The following line decides if the assessment input fields are visible or not * for some question types the assessment values is set in the label set instead of the answers */ - $qtypes = getqtypelist('', 'array'); + $qtypes = getQuestionTypeList('', 'array'); Yii::app()->loadHelper('surveytranslator'); $aData['scalecount'] = $scalecount = $qtypes[$qtype]['subquestions']; @@ -571,7 +571,7 @@ public function _editsubquestion($surveyid, $gid, $qid) $surveyinfo = $sumresult1->attributes; $surveyinfo = array_merge($surveyinfo, $sumresult1->languagesettings->attributes); - $surveyinfo = array_map('FlattenText', $surveyinfo); + $surveyinfo = array_map('flattenText', $surveyinfo); $aData['activated'] = $activated = $surveyinfo['active']; $aData['surveyid'] = $surveyid; @@ -623,7 +623,7 @@ public function index($sa, $surveyid, $gid, $qid=null) $aData['display']['menu_bars']['gid_action'] = 'addquestion'; Yii::app()->session['FileManagerContext'] = "create:question:{$surveyid}"; - if (bHasSurveyPermission($surveyid, 'surveycontent', 'read')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'read')) { $clang = $this->getController()->lang; $surveyinfo = getSurveyInfo($surveyid); @@ -709,13 +709,13 @@ public function index($sa, $surveyid, $gid, $qid=null) LimeExpressionManager::StartProcessingGroup($gid, ($surveyinfo['anonymized']!="N"), $surveyinfo['sid']); // loads list of replacement values available for this group } - $qtypelist = getqtypelist('', 'array'); + $qtypelist = getQuestionTypeList('', 'array'); $qDescToCode = 'qDescToCode = {'; $qCodeToInfo = 'qCodeToInfo = {'; foreach ($qtypelist as $qtype => $qdesc) { $qDescToCode .= " '{$qdesc['description']}' : '{$qtype}', \n"; - $qCodeToInfo .= " '{$qtype}' : '" . ls_json_encode($qdesc) . "', \n"; + $qCodeToInfo .= " '{$qtype}' : '" . lsJSONEncode($qdesc) . "', \n"; } $aData['qTypeOutput'] = "$qDescToCode 'null':'null' }; \n $qCodeToInfo 'null':'null' };"; @@ -766,7 +766,7 @@ public function index($sa, $surveyid, $gid, $qid=null) $this->getController()->error('Invalid Survey ID'); $surveyinfo = $sumresult1->attributes; - $surveyinfo = array_map('FlattenText', $surveyinfo); + $surveyinfo = array_map('flattenText', $surveyinfo); $aData['activated'] = $activated = $surveyinfo['active']; if ($activated != "Y") @@ -796,7 +796,7 @@ public function index($sa, $surveyid, $gid, $qid=null) $aViewUrls['questionJavascript_view'][] = array('type' => $eqrow['type']); } else - include('access_denied.php'); + include('accessDenied.php'); $this->_renderWrappedTemplate('survey/Question', $aViewUrls, $aData); } @@ -818,10 +818,10 @@ public function delete($surveyid, $gid, $qid) $gid = sanitize_int($gid); $qid = sanitize_int($qid); - if (bHasSurveyPermission($surveyid, 'surveycontent', 'delete')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'delete')) { if (!isset($qid)) - $qid = returnglobal('qid'); + $qid = returnGlobal('qid'); LimeExpressionManager::RevertUpgradeConditionsToRelevance(NULL,$qid); @@ -892,7 +892,7 @@ public function ajaxquestionattributes() $thissurvey = getSurveyInfo($surveyid); $aAttributesWithValues = Questions::model()->getAdvancedSettingsWithValues($qid, $type, $surveyid); - uasort($aAttributesWithValues, 'CategorySort'); + uasort($aAttributesWithValues, 'categorySort'); $aAttributesPrepared = array(); foreach ($aAttributesWithValues as $iKey => $aAttribute) @@ -994,9 +994,9 @@ public function preview($surveyid, $qid, $lang = null) $answers = retrieveAnswers($ia,$surveyid); if (!$thissurvey['template']) - $thistpl = sGetTemplatePath(Yii::app()->getConfig('defaulttemplate')); + $thistpl = getTemplatePath(Yii::app()->getConfig('defaulttemplate')); else - $thistpl = sGetTemplatePath(validate_templatedir($thissurvey['template'])); + $thistpl = getTemplatePath(validateTemplateDir($thissurvey['template'])); doHeader(); @@ -1060,7 +1060,7 @@ function checkconditions(value, name, type) $question = $answers[0][0]; $question['code'] = $answers[0][5]; - $question['class'] = question_class($qrows['type']); + $question['class'] = getQuestionClass($qrows['type']); $question['essentials'] = 'id="question' . $qrows['qid'] . '"'; $question['sgq'] = $ia[1]; $question['aid']='unknown'; @@ -1128,4 +1128,4 @@ protected function _renderWrappedTemplate($sAction = 'survey/Question', $aViewUr parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData); } -} \ No newline at end of file +} diff --git a/application/controllers/admin/questiongroup.php b/application/controllers/admin/questiongroup.php index a0588247c5d..d58c62b40f2 100644 --- a/application/controllers/admin/questiongroup.php +++ b/application/controllers/admin/questiongroup.php @@ -56,7 +56,7 @@ function import() } // validate that we have a SID - if (!returnglobal('sid')) + if (!returnGlobal('sid')) $fatalerror .= $clang->gT("No SID (Survey) has been provided. Cannot import question."); if (isset($fatalerror)) @@ -74,7 +74,7 @@ function import() $aImportResults = XMLImportGroup($sFullFilepath, $surveyid); else $this->getController()->error('Unknown file extension'); - FixLanguageConsistency($surveyid); + fixLanguageConsistency($surveyid); if (isset($aImportResults['fatalerror'])) { @@ -105,7 +105,7 @@ function add($surveyid) $surveyid = sanitize_int($surveyid); $aViewUrls = $aData = array(); - if (bHasSurveyPermission($surveyid, 'surveycontent', 'read')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'read')) { $clang = $this->getController()->lang; @@ -137,7 +137,7 @@ function add($surveyid) */ public function insert($surveyid) { - if (bHasSurveyPermission($surveyid, 'surveycontent', 'create')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'create')) { Yii::app()->loadHelper('surveytranslator'); @@ -166,8 +166,8 @@ public function insert($surveyid) $group_description = html_entity_decode($group_description, ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types - $group_name = fix_FCKeditor_text($group_name); - $group_description = fix_FCKeditor_text($group_description); + $group_name = fixCKeditorText($group_name); + $group_description = fixCKeditorText($group_description); if ($first) @@ -176,7 +176,7 @@ public function insert($surveyid) 'sid' => $surveyid, 'group_name' => $group_name, 'description' => $group_description, - 'group_order' => getMaxgrouporder($surveyid), + 'group_order' => getMaxGroupOrder($surveyid), 'language' => $grouplang, 'randomization_group' => $_POST['randomization_group'], 'grelevance' => $_POST['grelevance'], @@ -191,13 +191,13 @@ public function insert($surveyid) } else { - //db_switchIDInsert('groups',true); + //switchMSSQLIdentityInsert('groups',true); $aData = array( 'gid' => $groupid, 'sid' => $surveyid, 'group_name' => $group_name, 'description' => $group_description, - 'group_order' => getMaxgrouporder($surveyid), + 'group_order' => getMaxGroupOrder($surveyid), 'language' => $grouplang, 'randomization_group' => $_POST['randomization_group'] ); @@ -227,7 +227,7 @@ public function delete($iSurveyId, $iGroupId) { $iSurveyId = sanitize_int($iSurveyId); - if (bHasSurveyPermission($iSurveyId, 'surveycontent', 'delete')) + if (hasSurveyPermission($iSurveyId, 'surveycontent', 'delete')) { LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyId); @@ -266,7 +266,7 @@ public function edit($surveyid, $gid) $gid = sanitize_int($gid); $aViewUrls = $aData = array(); - if (bHasSurveyPermission($surveyid, 'surveycontent', 'read')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'read')) { Yii::app()->session['FileManagerContext'] = "edit:group:{$surveyid}"; @@ -350,7 +350,7 @@ public function update($gid) $group = Groups::model()->findByAttributes(array('gid' => $gid)); $surveyid = $group->sid; - if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) + if (hasSurveyPermission($surveyid, 'surveycontent', 'update')) { Yii::app()->loadHelper('surveytranslator'); @@ -370,8 +370,8 @@ public function update($gid) $group_description = html_entity_decode($group_description, ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types - $group_name = fix_FCKeditor_text($group_name); - $group_description = fix_FCKeditor_text($group_description); + $group_name = fixCKeditorText($group_name); + $group_description = fixCKeditorText($group_description); $aData = array( 'group_name' => $group_name, @@ -390,7 +390,7 @@ public function update($gid) $ugresult = $group->save(); if ($ugresult) { - $groupsummary = getgrouplist($gid, $surveyid); + $groupsummary = getGroupList($gid, $surveyid); } } } diff --git a/application/controllers/admin/quotas.php b/application/controllers/admin/quotas.php index dad30cd5598..5c537a49391 100644 --- a/application/controllers/admin/quotas.php +++ b/application/controllers/admin/quotas.php @@ -62,7 +62,7 @@ private function _getData($iSurveyId) private function _checkPermissions($iSurveyId, $sPermission) { - if (!empty($sPermission) && !bHasSurveyPermission($iSurveyId, 'quotas', $sPermission)) { + if (!empty($sPermission) && !hasSurveyPermission($iSurveyId, 'quotas', $sPermission)) { die(); } } @@ -104,7 +104,7 @@ function index($iSurveyId, $quickreport = false) foreach ($aResult as $aQuotaListing) { $totalquotas += $aQuotaListing['qlimit']; - $completed = get_quotaCompletedCount($iSurveyId, $aQuotaListing['id']); + $completed = getQuotaCompletedCount($iSurveyId, $aQuotaListing['id']); $highlight = ($completed >= $aQuotaListing['qlimit']) ? "" : "style='color: red'"; //Incomplete quotas displayed in red $totalcompleted = $totalcompleted + $completed; $csvoutput[] = $aQuotaListing['name'] . "," . $aQuotaListing['qlimit'] . "," . $completed . "," . ($aQuotaListing['qlimit'] - $completed) . "\r\n"; @@ -201,7 +201,7 @@ function insertquota($iSurveyId) $_POST['quotals_message_' . $sLang] = html_entity_decode($_POST['quotals_message_' . $sLang], ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types - $_POST['quotals_message_' . $sLang] = fix_FCKeditor_text($_POST['quotals_message_' . $sLang]); + $_POST['quotals_message_' . $sLang] = fixCKeditorText($_POST['quotals_message_' . $sLang]); $oQuotaLanguageSettings = new Quota_languagesettings; $oQuotaLanguageSettings->quotals_quota_id = $iQuotaId; @@ -254,7 +254,7 @@ function modifyquota($iSurveyId) $_POST['quotals_message_' . $sLang] = html_entity_decode($_POST['quotals_message_' . $sLang], ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types - $_POST['quotals_message_' . $sLang] = fix_FCKeditor_text($_POST['quotals_message_' . $sLang]); + $_POST['quotals_message_' . $sLang] = fixCKeditorText($_POST['quotals_message_' . $sLang]); $oQuotaLanguageSettings = Quota_languagesettings::model()->findByAttributes(array('quotals_quota_id' => Yii::app()->request->getPost('quota_id'), 'quotals_language' => $sLang)); $oQuotaLanguageSettings->quotals_name = Yii::app()->request->getPost('quota_name'); @@ -354,7 +354,7 @@ function new_answer($iSurveyId, $sSubAction = 'new_answer') $clang = $aData['clang']; $aViewUrls = array(); - if (($sSubAction == "new_answer" || ($sSubAction == "new_answer_two" && !isset($_POST['quota_qid']))) && bHasSurveyPermission($iSurveyId, 'quotas', 'create')) + if (($sSubAction == "new_answer" || ($sSubAction == "new_answer_two" && !isset($_POST['quota_qid']))) && hasSurveyPermission($iSurveyId, 'quotas', 'create')) { $result = Quota::model()->findAllByPk(Yii::app()->request->getPost('quota_id')); foreach ($result as $aQuotaDetails) @@ -375,7 +375,7 @@ function new_answer($iSurveyId, $sSubAction = 'new_answer') } } - if ($sSubAction == "new_answer_two" && isset($_POST['quota_qid']) && bHasSurveyPermission($iSurveyId, 'quotas', 'create')) + if ($sSubAction == "new_answer_two" && isset($_POST['quota_qid']) && hasSurveyPermission($iSurveyId, 'quotas', 'create')) { $aResults = Quota::model()->findByPk(Yii::app()->request->getPost('quota_qid')); $sQuotaName = $aResults['name']; diff --git a/application/controllers/admin/remotecontrol.php b/application/controllers/admin/remotecontrol.php index 86da6ce87cf..17a41155ee3 100644 --- a/application/controllers/admin/remotecontrol.php +++ b/application/controllers/admin/remotecontrol.php @@ -115,7 +115,7 @@ public function get_session_key($username, $password) if ($this->_doLogin($username, $password)) { $this->_jumpStartSession($username); - $session_key = sRandomChars(32); + $session_key = randomChars(32); $session = new Sessions; $session->id = $session_key; @@ -158,7 +158,7 @@ public function delete_survey($session_key, $sid) { if ($this->_checkSessionKey($session_key)) { - if (bHasSurveyPermission($sid, 'survey', 'delete')) + if (hasSurveyPermission($sid, 'survey', 'delete')) { Survey::model()->deleteAllByAttributes(array('sid' => $sid)); rmdirr(Yii::app()->getConfig("uploaddir") . '/surveys/' . $sid); @@ -184,7 +184,7 @@ public function add_response($session_key, $sid, $aResponseData) { if ($this->_checkSessionKey($session_key)) { - if (bHasSurveyPermission($sid, 'response', 'create')) + if (hasSurveyPermission($sid, 'response', 'create')) { if (!Yii::app()->db->schema->getTable('{{survey_' . $sid . '}}')) throw new Zend_XmlRpc_Server_Exception('No survey response table', 12); @@ -197,7 +197,7 @@ public function add_response($session_key, $sid, $aResponseData) if (!isset($aResponseData['startdate'])) $aResponseData['startdate'] = date("Y-m-d H:i:s"); if (!isset($aResponseData['startlanguage'])) - $aResponseData['startlanguage'] = GetBaseLanguageFromSurveyID($iSurveyID); + $aResponseData['startlanguage'] = getBaseLanguageFromSurveyID($iSurveyID); Survey_dynamic::sid($sid); $survey_dynamic = new Survey_dynamic; @@ -229,7 +229,7 @@ public function add_participants($session_key, $sid, $participant_data, $create_ { if ($this->_checkSessionKey($session_key)) { - if (bHasSurveyPermission($sid, 'tokens', 'create')) + if (hasSurveyPermission($sid, 'tokens', 'create')) { if (!Yii::app()->db->schema->getTable('{{tokens_' . $sid . '}}')) throw new Zend_XmlRpc_Server_Exception('No token table', 11); diff --git a/application/controllers/admin/saved.php b/application/controllers/admin/saved.php index 5f96a8d6016..0f41ba038aa 100644 --- a/application/controllers/admin/saved.php +++ b/application/controllers/admin/saved.php @@ -30,7 +30,7 @@ public function view($iSurveyId) $clang = $this->getController()->lang; $aViewUrls = array(); - if (!bHasSurveyPermission($iSurveyId, 'responses', 'read')) + if (!hasSurveyPermission($iSurveyId, 'responses', 'read')) { die(); } diff --git a/application/controllers/admin/statistics.php b/application/controllers/admin/statistics.php index 03c644d31cd..806220554c3 100644 --- a/application/controllers/admin/statistics.php +++ b/application/controllers/admin/statistics.php @@ -104,8 +104,8 @@ public function run($surveyid, $subaction = null) $cr_statisticsoutput = ''; // This gets all the 'to be shown questions' from the POST and puts these into an array - $summary=returnglobal('summary'); - $statlang=returnglobal('statlang'); + $summary=returnGlobal('summary'); + $statlang=returnGlobal('statlang'); //if $summary isn't an array we create one if (isset($summary) && !is_array($summary)) { @@ -113,7 +113,7 @@ public function run($surveyid, $subaction = null) } //no survey ID? -> come and get one - if (!isset($surveyid)) {$surveyid=returnglobal('sid');} + if (!isset($surveyid)) {$surveyid=returnGlobal('sid');} //still no survey ID -> error $aData['surveyid'] = $surveyid; @@ -212,7 +212,7 @@ public function run($surveyid, $subaction = null) $rows = Questions::getQuestionList($surveyid, $language); //SORT IN NATURAL ORDER! - usort($rows, 'GroupOrderThenQuestionOrder'); + usort($rows, 'groupOrderThenQuestionOrder'); //put the question information into the filter array $filters = array(); @@ -224,7 +224,7 @@ public function run($surveyid, $subaction = null) $row['type'], $row['title'], $row['group_name'], - FlattenText($row['question'])); + flattenText($row['question'])); } $aData['filters'] = $filters; @@ -245,13 +245,13 @@ public function run($surveyid, $subaction = null) //pre-selection of filter forms - if (incompleteAnsFilterstate() == "filter") + if (incompleteAnsFilterState() == "filter") { $selecthide="selected='selected'"; $selectshow=""; $selectinc=""; } - elseif (incompleteAnsFilterstate() == "inc") + elseif (incompleteAnsFilterState() == "inc") { $selecthide=""; $selectshow=""; @@ -286,7 +286,7 @@ public function run($surveyid, $subaction = null) //second row below options -> filter settings headline - $filterchoice_state=returnglobal('filterchoice_state'); + $filterchoice_state=returnGlobal('filterchoice_state'); $aData['filterchoice_state'] = $filterchoice_state; diff --git a/application/controllers/admin/surveyaction.php b/application/controllers/admin/surveyaction.php index 2647f4826cc..7c33b554f61 100644 --- a/application/controllers/admin/surveyaction.php +++ b/application/controllers/admin/surveyaction.php @@ -87,7 +87,7 @@ public function index() */ function newsurvey() { - if (!bHasGlobalPermission('USER_RIGHT_CREATE_SURVEY')) + if (!hasGlobalPermission('USER_RIGHT_CREATE_SURVEY')) $this->getController()->error('No permission'); $this->_registerScriptFiles(); @@ -119,7 +119,7 @@ function editsurveysettings($surveyid) if (is_null($surveyid) || !$surveyid) $this->getController()->error('Invalid survey id'); - if (!bHasSurveyPermission($surveyid, 'surveysettings', 'read') && !bHasGlobalPermission('USER_RIGHT_CREATE_SURVEY')) + if (!hasSurveyPermission($surveyid, 'surveysettings', 'read') && !hasGlobalPermission('USER_RIGHT_CREATE_SURVEY')) $this->getController()->error('No permission'); $this->_registerScriptFiles(); @@ -377,7 +377,7 @@ public function activate($surveyid) if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') $this->getController()->error('Survey not active'); - $qtypes = getqtypelist('', 'array'); + $qtypes = getQuestionTypeList('', 'array'); Yii::app()->loadHelper("admin/activate"); if (empty($_POST['ok'])) @@ -456,7 +456,7 @@ public function ajaxowneredit($newowner, $surveyid) $query_condition = 'sid=:sid'; $params[':sid']=$intSurveyId; - if (!bHasGlobalPermission("USER_RIGHT_SUPERADMIN")) + if (!hasGlobalPermission("USER_RIGHT_SUPERADMIN")) { $query_condition .= 'AND owner_id=:uid'; $params[':uid']=$owner_id; @@ -505,17 +505,17 @@ public function getSurveys_json() $rows = array_merge($rows->attributes, $rows->languagesettings->attributes, $rows->owner->attributes); // Set status - if ($rows['active'] == "Y" && $rows['expires'] != '' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust'))) + if ($rows['active'] == "Y" && $rows['expires'] != '' && $rows['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust'))) { $aSurveyEntry[] = '' . $clang->gT('; } - elseif ($rows['active'] == "Y" && $rows['startdate'] != '' && $rows['startdate'] > date_shift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust'))) + elseif ($rows['active'] == "Y" && $rows['startdate'] != '' && $rows['startdate'] > dateShift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust'))) { $aSurveyEntry[] = '' . $clang->gT('; } elseif ($rows['active'] == "Y") { - if (bHasSurveyPermission($rows['sid'], 'surveyactivation', 'update')) + if (hasSurveyPermission($rows['sid'], 'surveyactivation', 'update')) { $aSurveyEntry[] = '' . $clang->gT('; } @@ -529,7 +529,7 @@ public function getSurveys_json() $condition = "sid={$rows['sid']} AND language='" . $rows['language'] . "'"; $questionsCountResult = Questions::model()->findAll($condition); - if (count($questionsCountResult) && bHasSurveyPermission($rows['sid'], 'surveyactivation', 'update')) + if (count($questionsCountResult) && hasSurveyPermission($rows['sid'], 'surveyactivation', 'update')) { $aSurveyEntry[] = '' . $clang->gT('; } @@ -608,7 +608,7 @@ public function getSurveys_json() $aSurveyEntries->rows[] = array('id' => $rows['sid'], 'cell' => $aSurveyEntry); } - echo ls_json_encode($aSurveyEntries); + echo lsJSONEncode($aSurveyEntries); } /** @@ -625,7 +625,7 @@ public function delete($surveyid, $delete = 'no') $aData['surveyid'] = $iSurveyId = (int) $surveyid; $clang = $this->getController()->lang; - if (bHasSurveyPermission($iSurveyId, 'survey', 'delete')) + if (hasSurveyPermission($iSurveyId, 'survey', 'delete')) { if ($delete == 'yes') { @@ -656,7 +656,7 @@ function editSurvey_json() { foreach(explode(',',$surveyids) as $surveyid) { - if (bHasSurveyPermission($surveyid, 'survey', 'delete')) + if (hasSurveyPermission($surveyid, 'survey', 'delete')) { $this->_deleteSurvey($surveyid); } @@ -678,7 +678,7 @@ public function editlocalsettings($surveyid) $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts').'/scripts/admin/surveysettings.js'); - if (bHasSurveyPermission($surveyid, 'surveylocale', 'read')) + if (hasSurveyPermission($surveyid, 'surveylocale', 'read')) { $editsurvey = ''; $grplangs = Survey::model()->findByPk($surveyid)->additionalLanguages; @@ -728,7 +728,7 @@ public function editlocalsettings($surveyid) } $editsurvey .= CHtml::closeTag('div'); - $aData['has_permissions'] = bHasSurveyPermission($surveyid, 'surveylocale', 'update'); + $aData['has_permissions'] = hasSurveyPermission($surveyid, 'surveylocale', 'update'); $aData['surveyls_language'] = $esrow["surveyls_language"]; $aData['additional_content'] = $editsurvey; @@ -936,7 +936,7 @@ public function copy() unlink($sFullFilepath); } - if (isset($aImportResults['error']) && $aImportResults['error']) safe_die($aImportResults['error']); + if (isset($aImportResults['error']) && $aImportResults['error']) safeDie($aImportResults['error']); $aData['action'] = $action; $aData['sLink'] = $this->getController()->createUrl('admin/survey/view/surveyid/' . $aImportResults['newsid']); @@ -955,7 +955,7 @@ public function organize($iSurveyId) { $iSurveyId = (int)$iSurveyId; - if (!empty($_POST['orgdata']) && bHasSurveyPermission($iSurveyId, 'surveycontent', 'update')) + if (!empty($_POST['orgdata']) && hasSurveyPermission($iSurveyId, 'surveycontent', 'update')) { $this->_reorderGroup($iSurveyId); } @@ -1319,15 +1319,15 @@ private function _tabResourceManagement($surveyid) function expire($iSurveyId) { $iSurveyId = (int) $iSurveyId; - if (!bHasSurveyPermission($iSurveyId, 'surveysettings', 'update')) + if (!hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) { die(); } $clang = $this->getController()->lang; Yii::app()->session['flashmessage'] = $clang->gT("The survey was successfully expired by setting an expiration date in the survey settings."); $this->_expireSurvey($iSurveyId); - $dExpirationdate = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); - $dExpirationdate = date_shift($dExpirationdate, "Y-m-d H:i:s", '-1 day'); + $dExpirationdate = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); + $dExpirationdate = dateShift($dExpirationdate, "Y-m-d H:i:s", '-1 day'); Survey::model()->updateSurvey(array('expires' => $dExpirationdate), 'sid= \'' . $iSurveyId . '\''); $this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $iSurveyId)); } @@ -1340,8 +1340,8 @@ function expire($iSurveyId) */ private function _expireSurvey($iSurveyId) { - $dExpirationdate = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); - $dExpirationdate = date_shift($dExpirationdate, "Y-m-d H:i:s", '-1 day'); + $dExpirationdate = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig('timeadjust')); + $dExpirationdate = dateShift($dExpirationdate, "Y-m-d H:i:s", '-1 day'); return Survey::model()->updateSurvey(array('expires' => $dExpirationdate), 'sid=\'' . $iSurveyId . '\''); } @@ -1358,11 +1358,11 @@ function getUrlParamsJSON($iSurveyId) foreach ($oResult->readAll() as $oRow) { $aData->rows[$i]['id'] = $oRow['id']; - $oRow['title'] = $oRow['title'] . ': ' . ellipsize(FlattenText($oRow['question'], false, true), 43, .70); + $oRow['title'] = $oRow['title'] . ': ' . ellipsize(flattenText($oRow['question'], false, true), 43, .70); if ($oRow['sqquestion'] != '') { - echo (' - ' . ellipsize(FlattenText($oRow['sqquestion'], false, true), 30, .75)); + echo (' - ' . ellipsize(flattenText($oRow['sqquestion'], false, true), 30, .75)); } unset($oRow['sqquestion']); unset($oRow['sqtitle']); @@ -1376,7 +1376,7 @@ function getUrlParamsJSON($iSurveyId) $aData->records = $oResult->getRowCount(); $aData->total = 1; - echo ls_json_encode($aData); + echo lsJSONEncode($aData); } /** @@ -1554,19 +1554,19 @@ function insert($iSurveyId=null) $sURLDescription = html_entity_decode($sURLDescription, ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types - $sTitle = fix_FCKeditor_text($sTitle); - $sDescription = fix_FCKeditor_text($sDescription); - $sWelcome = fix_FCKeditor_text($sWelcome); + $sTitle = fixCKeditorText($sTitle); + $sDescription = fixCKeditorText($sDescription); + $sWelcome = fixCKeditorText($sWelcome); // Load default email templates for the chosen language $oLanguage = new Limesurvey_lang($_POST['language']); - $aDefaultTexts = aTemplateDefaultTexts($oLanguage, 'unescaped'); + $aDefaultTexts = templateDefaultTexts($oLanguage, 'unescaped'); unset($oLanguage); if ($_POST['htmlemail'] && $_POST['htmlemail'] == "Y") { $bIsHTMLEmail = true; - $aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . conditional_nl2br($aDefaultTexts['admin_detailed_notification'], $bIsHTMLEmail, 'unescaped'); + $aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . conditionalNewlineToBreak($aDefaultTexts['admin_detailed_notification'], $bIsHTMLEmail, 'unescaped'); } else { @@ -1584,15 +1584,15 @@ function insert($iSurveyId=null) 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_email_invite_subj' => $aDefaultTexts['invitation_subject'], - 'surveyls_email_invite' => conditional_nl2br($aDefaultTexts['invitation'], $bIsHTMLEmail, 'unescaped'), + 'surveyls_email_invite' => conditionalNewlineToBreak($aDefaultTexts['invitation'], $bIsHTMLEmail, 'unescaped'), 'surveyls_email_remind_subj' => $aDefaultTexts['reminder_subject'], - 'surveyls_email_remind' => conditional_nl2br($aDefaultTexts['reminder'], $bIsHTMLEmail, 'unescaped'), + 'surveyls_email_remind' => conditionalNewlineToBreak($aDefaultTexts['reminder'], $bIsHTMLEmail, 'unescaped'), 'surveyls_email_confirm_subj' => $aDefaultTexts['confirmation_subject'], - 'surveyls_email_confirm' => conditional_nl2br($aDefaultTexts['confirmation'], $bIsHTMLEmail, 'unescaped'), + 'surveyls_email_confirm' => conditionalNewlineToBreak($aDefaultTexts['confirmation'], $bIsHTMLEmail, 'unescaped'), 'surveyls_email_register_subj' => $aDefaultTexts['registration_subject'], - 'surveyls_email_register' => conditional_nl2br($aDefaultTexts['registration'], $bIsHTMLEmail, 'unescaped'), + 'surveyls_email_register' => conditionalNewlineToBreak($aDefaultTexts['registration'], $bIsHTMLEmail, 'unescaped'), 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], - 'email_admin_notification' => conditional_nl2br($aDefaultTexts['admin_notification'], $bIsHTMLEmail, 'unescaped'), + 'email_admin_notification' => conditionalNewlineToBreak($aDefaultTexts['admin_notification'], $bIsHTMLEmail, 'unescaped'), 'email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification'], 'surveyls_dateformat' => (int) $_POST['dateformat'], diff --git a/application/controllers/admin/surveypermission.php b/application/controllers/admin/surveypermission.php index db999390324..dc611b9cc7f 100644 --- a/application/controllers/admin/surveypermission.php +++ b/application/controllers/admin/surveypermission.php @@ -34,7 +34,7 @@ function index($surveyid) $clang = Yii::app()->lang; $imageurl = Yii::app()->getConfig('imageurl'); - if(bHasSurveyPermission($surveyid,'survey','read')) + if(hasSurveyPermission($surveyid,'survey','read')) { $aBaseSurveyPermissions=Survey_permissions::getBasePermissions(); @@ -60,7 +60,7 @@ function index($surveyid) if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true) { - $authorizedGroupsList = getusergrouplist(NULL,'simplegidarray'); + $authorizedGroupsList = getUserGroupList(NULL,'simplegidarray'); } $surveysecurity .= "\n"; @@ -139,7 +139,7 @@ function index($surveyid) $iPermissionCount=0; foreach ($aPDetails as $sPDetailKey=>$sPDetailValue) { - if ($sPDetailValue && bHasSurveyPermission($surveyid,$sPKey,$sPDetailKey,$PermissionRow['uid']) && !($sPKey=='survey' && $sPDetailKey=='read')) $iCount++; + if ($sPDetailValue && hasSurveyPermission($surveyid,$sPKey,$sPDetailKey,$PermissionRow['uid']) && !($sPKey=='survey' && $sPDetailKey=='read')) $iCount++; if ($sPDetailValue) $iPermissionCount++; } if ($sPKey=='survey') $iPermissionCount--; @@ -167,14 +167,14 @@ function index($surveyid) . "\n" . "
    \n" . "