diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index 1f99b9a994e..5c71cd02cf9 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -35,7 +35,7 @@ function actionAjaxregisterform($surveyid) WHERE a.sid = $surveyid "; - $sresult = db_execute_assoc($squery) or show_error("Couldn't execute $squery"); + $sresult = dbExecuteAssoc($squery) or show_error("Couldn't execute $squery"); $row = $sresult->read(); @@ -69,7 +69,7 @@ function actionIndex($surveyid = null) } $usquery = "SELECT stg_value FROM {{settings_global}} where stg_name='SessionName'"; - $usresult = db_execute_assoc($usquery,'',true); //Checked + $usresult = dbExecuteAssoc($usquery,'',true); //Checked if ($usresult->count() > 0) { $usrow = $usresult->read(); @@ -137,7 +137,7 @@ function actionIndex($surveyid = null) //Check if this email already exists in token database $query = "SELECT email FROM {{tokens_$surveyid}}\n" . "WHERE email = '".sanitize_email(Yii::app()->request->getPost('register_email'))."'"; - $result = db_execute_assoc($query) or show_error("Unable to execute this query : \n
".$query."
"); //Checked) + $result = dbExecuteAssoc($query) or show_error("Unable to execute this query : \n
".$query."
"); //Checked) if (($result->count()) > 0) { $register_errormsg=$clang->gT("The email you used has already been registered."); @@ -169,7 +169,7 @@ function actionIndex($surveyid = null) { $newtoken = randomChars($tokenlength); $ntquery = "SELECT * FROM {{tokens_$surveyid}} WHERE token='$newtoken'"; - $ntresult = db_execute_assoc($ntquery); //Checked + $ntresult = dbExecuteAssoc($ntquery); //Checked if (!$ntresult->count()) {$mayinsert = true;} } @@ -254,7 +254,7 @@ function actionIndex($surveyid = null) $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 + $result=dbExecuteAssoc($query) or show_error("Unable to execute this query : $query
"); //Checked $html="
".$clang->gT("Thank you for registering to participate in this survey.")."

\n".$clang->gT("An email has been sent to the address you provided with access details for this survey. Please follow the link in that email to proceed.")."

\n".$clang->gT("Survey administrator")." {ADMINNAME} ({ADMINEMAIL})"; $html=ReplaceFields($html, $fieldsarray); $html .= "

\n"; diff --git a/application/controllers/SurveyAction.php b/application/controllers/SurveyAction.php index a0f8142a59d..75cdef7b819 100644 --- a/application/controllers/SurveyAction.php +++ b/application/controllers/SurveyAction.php @@ -169,7 +169,7 @@ function action() AND ((a.expires >= '".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 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 + $result = dbExecuteAssoc($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 safeDie("Couldn't execute $squery"); + $sresult = dbExecuteAssoc($squery) or safeDie("Couldn't execute $squery"); if($sresult->count() > 0) @@ -423,7 +423,7 @@ function sendreq(surveyid) } else { $tkquery = "SELECT * FROM {{'tokens_'".$surveyid."}} WHERE token=".$token." AND (completed = 'N' or completed='')"; } - $tkresult = db_execute_assoc($tkquery); //Checked + $tkresult = dbExecuteAssoc($tkquery); //Checked $tokendata = $tkresult->read(); if ($tkresult->count()==0 || $areTokensUsed) { @@ -443,7 +443,7 @@ function sendreq(surveyid) $this->_niceExit($redata, __LINE__, $thistpl, $asMessage, true); } } - if ($tokensexist == 1 && isset($token) && $token && db_tables_exist("{{tokens_".$surveyid."}}")) //check if token is in a valid time frame + if ($tokensexist == 1 && isset($token) && $token && tableExists("{{tokens_".$surveyid."}}")) //check if token is in a valid time frame { // check also if it is allowed to change survey after completion if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { @@ -451,7 +451,7 @@ function sendreq(surveyid) } else { $tkquery = "SELECT * FROM {{tokens_".$surveyid."}} WHERE token=".$token." AND (completed = 'N' or completed='')"; } - $tkresult = db_execute_assoc($tkquery); //Checked + $tkresult = dbExecuteAssoc($tkquery); //Checked $tokendata = $tkresult->read(); if (isset($tokendata['validfrom']) && (trim($tokendata['validfrom'])!='' && $tokendata['validfrom']>dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) || isset($tokendata['validuntil']) && (trim($tokendata['validuntil'])!='' && $tokendata['validuntil']count()>0) { $row=reset($result->read()); @@ -696,7 +696,7 @@ function _surveyExistsAndIsActive($surveyId) if ($surveyId) { - $aRow = db_execute_assoc("SELECT active FROM {{surveys}} WHERE sid='".$surveyId."'")->read(); + $aRow = dbExecuteAssoc("SELECT active FROM {{surveys}} WHERE sid='".$surveyId."'")->read(); if (isset($aRow['active'])) { $surveyExists = true; @@ -745,7 +745,7 @@ function _canUserPreviewSurvey($iSurveyID) if ( $_SESSION['USER_RIGHT_SUPERADMIN'] == 1 ) return true; - $rightresult = db_execute_assoc( + $rightresult = dbExecuteAssoc( "SELECT uid FROM {{survey_permissions}} WHERE sid = ".$iSurveyID." diff --git a/application/controllers/admin/checkintegrity.php b/application/controllers/admin/checkintegrity.php index 686177c20c6..f4d9ca319b3 100644 --- a/application/controllers/admin/checkintegrity.php +++ b/application/controllers/admin/checkintegrity.php @@ -339,8 +339,8 @@ protected function _checkintegrity() /*** Check for active survey tables with missing survey entry and rename them ***/ $sDBPrefix = Yii::app()->db->tablePrefix; - $sQuery = db_select_tables_like('{{survey}}\_%'); - $aResult = db_query_or_false($sQuery) or safeDie("Couldn't get list of conditions from database
{$sQuery}
"); + $sQuery = dbSelectTablesLike('{{survey}}\_%'); + $aResult = dbQueryOrFalse($sQuery) or safeDie("Couldn't get list of conditions from database
{$sQuery}
"); foreach ($aResult->readAll() as $aRow) { $sTableName = substr(reset($aRow), strlen($sDBPrefix)); @@ -362,7 +362,7 @@ protected function _checkintegrity() } /*** Check for active token tables with missing survey entry ***/ - $aResult = db_query_or_false(db_select_tables_like('{{tokens}}\_%')) or safeDie("Couldn't get list of conditions from database
{$sQuery}
"); + $aResult = dbQueryOrFalse(dbSelectTablesLike('{{tokens}}\_%')) or safeDie("Couldn't get list of conditions from database
{$sQuery}
"); foreach ($aResult->readAll() as $aRow) { $sTableName = substr(reset($aRow), strlen($sDBPrefix)); @@ -613,8 +613,8 @@ protected function _checkintegrity() //1: Get list of 'old_survey' tables and extract the survey id //2: Check if that survey id still exists //3: If it doesn't offer it for deletion - $sQuery = db_select_tables_like('{{old_survey}}%'); - $aResult = db_query_or_false($sQuery) or safeDie("Couldn't get list of conditions from database
$sQuery
"); + $sQuery = dbSelectTablesLike('{{old_survey}}%'); + $aResult = dbQueryOrFalse($sQuery) or safeDie("Couldn't get list of conditions from database
$sQuery
"); $aTables = $aResult->readAll(); $aOldSIDs = array(); @@ -628,7 +628,7 @@ protected function _checkintegrity() } $aOldSIDs = array_unique($aOldSIDs); $sQuery = 'SELECT sid FROM {{surveys}} ORDER BY sid'; - $oResult = db_execute_assoc($sQuery) or safeDie('Couldn\'t get unique survey ids'); + $oResult = dbExecuteAssoc($sQuery) or safeDie('Couldn\'t get unique survey ids'); $surveys = Survey::model()->findAll(); if (Survey::model()->hasErrors()) safeDie(Survey::model()->getError()); $aSIDs = array(); @@ -668,7 +668,7 @@ protected function _checkintegrity() $iMinute = substr($sDateTime, 10, 2); $sDate = date('d M Y H:i', mktime($iHour, $iMinute, 0, $iMonth, $iDay, $iYear)); $sQuery = 'SELECT * FROM ' . $sTableName; - $oQRresult = db_execute_assoc($sQuery) or safeDie('Failed: ' . $sQuery); + $oQRresult = dbExecuteAssoc($sQuery) or safeDie('Failed: ' . $sQuery); $iRecordcount = $oQRresult->count(); if ($iRecordcount == 0) { // empty table - so add it to immediate deletion $aDelete['orphansurveytables'][] = $sTableName; @@ -686,7 +686,7 @@ protected function _checkintegrity() //1: Get list of 'old_token' tables and extract the survey id //2: Check if that survey id still exists //3: If it doesn't offer it for deletion - $aResult = db_query_or_false(db_select_tables_like('{{old_token}}%')) or safeDie("Couldn't get list of conditions from database
$sQuery
"); + $aResult = dbQueryOrFalse(dbSelectTablesLike('{{old_token}}%')) or safeDie("Couldn't get list of conditions from database
$sQuery
"); $aTables = $aResult->readAll(); $aOldTokenSIDs = array(); @@ -732,7 +732,7 @@ protected function _checkintegrity() $sDate = date('D, d M Y h:i a', mktime($iHour, $iMinute, 0, $iMonth, $iDay, $iYear)); $sQuery = 'SELECT * FROM ' . $sTableName; - $oQRresult = db_execute_assoc($sQuery) or safeDie('Failed: ' . $sQuery); + $oQRresult = dbExecuteAssoc($sQuery) or safeDie('Failed: ' . $sQuery); $iRecordcount = $oQRresult->count(); if ($iRecordcount == 0) { $aDelete['orphantokentables'][] = $sTableName; diff --git a/application/controllers/admin/dataentry.php b/application/controllers/admin/dataentry.php index eafcd80b906..d01cda5a91e 100644 --- a/application/controllers/admin/dataentry.php +++ b/application/controllers/admin/dataentry.php @@ -142,7 +142,7 @@ private function _handleFileUpload($surveyid, $aData) $importcount = 0; $recordcount = 0; - $aFieldnames = array_map('db_quote_id', $aFieldnames); + $aFieldnames = array_map('dbQuoteID', $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)); @@ -346,19 +346,19 @@ function import($surveyid) { // show UI for choosing old table - $result = db_get_tables_like("old\_survey\_%"); + $result = dbGetTablesLike("old\_survey\_%"); $optionElements_array = ''; //$queryCheckColumnsActive = $schema->getTable($oldtable)->columnNames; $resultActive = $schema->getTable("{{survey_{$surveyid}}}")->columnNames; - //$resultActive = db_execute_assoc($queryCheckColumnsActive) or show_error("Error:
$query
"); + //$resultActive = dbExecuteAssoc($queryCheckColumnsActive) or show_error("Error:
$query
"); $countActive = count($resultActive); foreach ($result as $row) { $row = each($row); - //$resultOld = db_execute_assoc($queryCheckColumnsOld) or show_error("Error:
$query
"); + //$resultOld = dbExecuteAssoc($queryCheckColumnsOld) or show_error("Error:
$query
"); $resultOld = $schema->getTable($row[1])->columnNames; if($countActive == count($resultOld)) //num_fields() @@ -405,8 +405,8 @@ function import($surveyid) $aValidFields = array_diff($aValidFields, $dontimportfields); - $queryOldValues = "SELECT ".implode(", ",array_map("db_quote_id", $aValidFields))." FROM {$oldtable} "; - $resultOldValues = db_execute_assoc($queryOldValues) or show_error("Error:
$queryOldValues
"); + $queryOldValues = "SELECT ".implode(", ",array_map("dbQuoteID", $aValidFields))." FROM {$oldtable} "; + $resultOldValues = dbExecuteAssoc($queryOldValues) or show_error("Error:
$queryOldValues
"); $iRecordCount = $resultOldValues->count(); $aSRIDConversions=array(); foreach ($resultOldValues->readAll() as $row) @@ -415,8 +415,8 @@ 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("dbQuoteAll",array_values($row))).")"; - $result = db_execute_assoc($sInsertSQL) or show_error("Error:
$sInsertSQL
"); + $sInsertSQL="INSERT into {$activetable} (".implode(",", array_map("dbQuoteID", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll",array_values($row))).")"; + $result = dbExecuteAssoc($sInsertSQL) or show_error("Error:
$sInsertSQL
"); $aSRIDConversions[$iOldID]=Yii::app()->db->getLastInsertID(); } @@ -434,7 +434,7 @@ function import($surveyid) $aValidTimingFields=array_intersect($aFieldsOldTimingTable,$aFieldsNewTimingTable); $queryOldValues = "SELECT ".implode(", ",$aValidTimingFields)." FROM {$sOldTimingsTable} "; - $resultOldValues = db_execute_assoc($queryOldValues) or show_error("Error:
$queryOldValues
"); + $resultOldValues = dbExecuteAssoc($queryOldValues) or show_error("Error:
$queryOldValues
"); $iRecordCountT=$resultOldValues->count(); $aSRIDConversions=array(); foreach ($resultOldValues->readAll() as $row) @@ -445,8 +445,8 @@ 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("dbQuoteAll", array_values($row))).")"; - $result = db_execute_assoc($sInsertSQL) or show_error("Error:
$sInsertSQL
"); + $sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",", array_map("dbQuoteID", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll", array_values($row))).")"; + $result = dbExecuteAssoc($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); } @@ -498,7 +498,7 @@ public function editdata($subaction, $id, $surveyid, $language='') {{questions}}.language = '{$sDataEntryLanguage}' AND g.language = '{$sDataEntryLanguage}' AND {{questions}}.sid={{surveys}}.sid AND {{questions}}.sid='$surveyid' order by group_order, question_order"; - $fnresult = db_execute_assoc($fnquery); + $fnresult = dbExecuteAssoc($fnquery); $fncount = $fnresult->getRowCount(); @@ -525,7 +525,7 @@ public function editdata($subaction, $id, $surveyid, $language='') if ($subaction == "edit" && hasSurveyPermission($surveyid,'responses','update')) { $idquery = "SELECT * FROM $surveytable WHERE id=$id"; - $idresult = db_execute_assoc($idquery) or safeDie ("Couldn't get individual record
$idquery
"); + $idresult = dbExecuteAssoc($idquery) or safeDie ("Couldn't get individual record
$idquery
"); foreach ($idresult->readAll() as $idrow) { $results[]=$idrow; @@ -743,7 +743,7 @@ public function editdata($subaction, $id, $surveyid, $language='') else { $lquery = "SELECT * FROM {{answers}} WHERE qid={$fname['qid']} AND language = '{$sDataEntryLanguage}' ORDER BY sortorder, answer"; - $lresult = db_execute_assoc($lquery); + $lresult = dbExecuteAssoc($lquery); $aDataentryoutput .= "\t\n" ."