本文整理汇总了PHP中passthruReplace函数的典型用法代码示例。如果您正苦于以下问题:PHP passthruReplace函数的具体用法?PHP passthruReplace怎么用?PHP passthruReplace使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了passthruReplace函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkCompletedQuota
//.........这里部分代码省略.........
}
if ($iMatchedAnswers == count($aQuotaFields)) {
switch ($aQuotaCompleted['action']) {
case '1':
default:
$aMatchedQuotas[] = $aQuotaCompleted;
break;
case '2':
if ($bPostedField) {
// Action 2 allow to correct last answers, then need to be posted
$aMatchedQuotas[] = $aQuotaCompleted;
}
break;
}
}
}
}
if ($return) {
return $aMatchedQuotas;
}
if (empty($aMatchedQuotas)) {
return;
}
// Now we have all the information we need about the quotas and their status.
// We need to construct the page and do all needed action
$aSurveyInfo = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$sTemplatePath = getTemplatePath($aSurveyInfo['templatedir']);
$sClientToken = isset($_SESSION['survey_' . $surveyid]['token']) ? $_SESSION['survey_' . $surveyid]['token'] : "";
// {TOKEN} is take by $redata ...
// $redata for templatereplace
$aDataReplacement = array('thissurvey' => $aSurveyInfo, 'clienttoken' => $sClientToken, 'token' => $sClientToken);
// We take only the first matched quota, no need for each
$aMatchedQuota = $aMatchedQuotas[0];
// If a token is used then mark the token as completed, do it before event : this allow plugin to update token information
$event = new PluginEvent('afterSurveyQuota');
$event->set('surveyId', $surveyid);
$event->set('responseId', $_SESSION['survey_' . $surveyid]['srid']);
// We allways have a responseId
$event->set('aMatchedQuotas', $aMatchedQuotas);
// Give all the matched quota : the first is the active
App()->getPluginManager()->dispatchEvent($event);
$blocks = array();
foreach ($event->getAllContent() as $blockData) {
/* @var $blockData PluginEventContent */
$blocks[] = CHtml::tag('div', array('id' => $blockData->getCssId(), 'class' => $blockData->getCssClass()), $blockData->getContent());
}
// Allow plugin to update message, url, url description and action
$sMessage = $event->get('message', $aMatchedQuota['quotals_message']);
$sUrl = $event->get('url', $aMatchedQuota['quotals_url']);
$sUrlDescription = $event->get('urldescrip', $aMatchedQuota['quotals_urldescrip']);
$sAction = $event->get('action', $aMatchedQuota['action']);
$sAutoloadUrl = $event->get('autoloadurl', $aMatchedQuota['autoload_url']);
// Construct the default message
$sMessage = templatereplace($sMessage, array(), $aDataReplacement, 'QuotaMessage', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrl = passthruReplace($sUrl, $aSurveyInfo);
$sUrl = templatereplace($sUrl, array(), $aDataReplacement, 'QuotaUrl', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrlDescription = templatereplace($sUrlDescription, array(), $aDataReplacement, 'QuotaUrldescription', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
// Doing the action and show the page
if ($sAction == "1" && $sClientToken) {
submittokens(true);
}
// Construction of default message inside quotamessage class
$quotaMessage = "<div class='quotamessage limesurveycore'>\n";
$quotaMessage .= "\t" . $sMessage . "\n";
if ($sUrl) {
$quotaMessage .= "<br /><br />\t<a href='" . $sUrl . "'>" . $sUrlDescription . "</a><br />\n";
}
// Add the navigator with Previous button if quota allow modification.
if ($sAction == "2") {
$sQuotaStep = isset($_SESSION['survey_' . $surveyid]['step']) ? $_SESSION['survey_' . $surveyid]['step'] : 0;
// Surely not needed
$sNavigator = CHtml::htmlButton(gT("Previous"), array('type' => 'submit', 'id' => "moveprevbtn", 'value' => $sQuotaStep, 'name' => 'move', 'accesskey' => 'p', 'class' => "submit button"));
$quotaMessage .= CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey'));
$quotaMessage .= templatereplace(file_get_contents($sTemplatePath . "/navigator.pstpl"), array('NAVIGATOR' => $sNavigator, 'SAVE' => ''), $aDataReplacement);
$quotaMessage .= CHtml::hiddenField('sid', $surveyid);
$quotaMessage .= CHtml::hiddenField('token', $sClientToken);
// Did we really need it ?
$quotaMessage .= CHtml::endForm();
}
$quotaMessage .= "</div>\n";
// Add the plugin message before default message
$quotaMessage = implode("\n", $blocks) . "\n" . $quotaMessage;
// Send page to user and end.
sendCacheHeaders();
if ($sAutoloadUrl == 1 && $sUrl != "") {
if ($sAction == "1") {
killSurveySession($surveyid);
}
header("Location: " . $sUrl);
}
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "/startpage.pstpl"), array(), $aDataReplacement);
echo $quotaMessage;
echo templatereplace(file_get_contents($sTemplatePath . "/endpage.pstpl"), array(), $aDataReplacement);
doFooter();
if ($sAction == "1") {
killSurveySession($surveyid);
}
Yii::app()->end();
}
示例2: run
//.........这里部分代码省略.........
if (strlen($unansweredSQList) > 0) {
$notanswered = explode('|', $unansweredSQList);
} else {
$notanswered = array();
}
//CHECK INPUT
$invalidSQList = $moveResult['invalidSQs'];
if (strlen($invalidSQList) > 0) {
$notvalidated = explode('|', $invalidSQList);
} else {
$notvalidated = array();
}
}
// CHECK UPLOADED FILES
// TMSW - Move this into LEM::NavigateForwards?
$filenotvalidated = checkUploadedFileValidity($surveyid, $move);
//SEE IF THIS GROUP SHOULD DISPLAY
$show_empty_group = false;
if ($_SESSION[$LEMsessid]['step'] == 0) {
$show_empty_group = true;
}
$redata = compact(array_keys(get_defined_vars()));
//SUBMIT ###############################################################################
if (isset($move) && $move == "movesubmit") {
// setcookie("limesurvey_timers", "", time() - 3600); // remove the timers cookies //@todo fix - sometimes results in headers already sent error
if ($thissurvey['refurl'] == "Y") {
if (!in_array("refurl", $_SESSION[$LEMsessid]['insertarray'])) {
$_SESSION[$LEMsessid]['insertarray'][] = "refurl";
}
}
resetTimers();
//Before doing the "templatereplace()" function, check the $thissurvey['url']
//field for limereplace stuff, and do transformations!
$thissurvey['surveyls_url'] = passthruReplace($thissurvey['surveyls_url'], $thissurvey);
$thissurvey['surveyls_url'] = templatereplace($thissurvey['surveyls_url'], array(), $redata, 'URLReplace', false, NULL, array(), true);
// to do INSERTANS substitutions
//END PAGE - COMMIT CHANGES TO DATABASE
if ($thissurvey['active'] != "Y") {
if ($thissurvey['assessments'] == "Y") {
$assessments = doAssessment($surveyid);
}
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($sTemplateViewPath . "startpage.pstpl"), array(), $redata, 'SubmitStartpageI', false, NULL, array(), true);
//Check for assessments
if ($thissurvey['assessments'] == "Y" && $assessments) {
echo templatereplace(file_get_contents($sTemplateViewPath . "assessment.pstpl"), array(), $redata, 'SubmitAssessmentI', false, NULL, array(), true);
}
// fetch all filenames from $_SESSIONS['files'] and delete them all
// from the /upload/tmp/ directory
/* echo "<pre>";print_r($_SESSION);echo "</pre>";
for($i = 1; isset($_SESSION[$LEMsessid]['files'][$i]); $i++)
{
unlink('upload/tmp/'.$_SESSION[$LEMsessid]['files'][$i]['filename']);
}
*/
// can't kill session before end message, otherwise INSERTANS doesn't work.
$completed = templatereplace($thissurvey['surveyls_endtext'], array(), $redata, 'SubmitEndtextI', false, NULL, array(), true);
$completed .= "<br /><strong><font size='2' color='red'>" . gT("Did Not Save") . "</font></strong><br /><br />\n\n";
$completed .= gT("Your survey responses have not been recorded. This survey is not yet active.") . "<br /><br />\n";
if ($thissurvey['printanswers'] == 'Y') {
// 'Clear all' link is only relevant for survey with printanswers enabled
// in other cases the session is cleared at submit time
$completed .= "<a href='" . Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}/move/clearall") . "'>" . gT("Clear Responses") . "</a><br /><br />\n";
}
} else {
示例3: checkQuota
//.........这里部分代码省略.........
unset($fields_query_array);
unset($fields_value_array);
// Lets only continue if any of the quota fields is in the posted page
$matched_fields = false;
if (isset($_POST['fieldnames'])) {
$posted_fields = explode("|", $_POST['fieldnames']);
foreach ($fields_list as $checkfield) {
if (in_array($checkfield, $posted_fields)) {
$matched_fields = true;
$global_matched = true;
}
}
}
// A field was submitted that is part of the quota
if ($matched_fields == true) {
// Check the status of the quota, is it full or not
$sQuery = "SELECT count(id) FROM {{survey_" . $surveyid . "}}\n WHERE " . implode(' AND ', $querycond) . " " . "\n AND submitdate IS NOT NULL";
$iRowCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
if ($iRowCount >= $quota['Limit']) {
// Now we have to check if the quota matches in the current session
// This will let us know if this person is going to exceed the quota
$counted_matches = 0;
foreach ($quota_info[$x]['members'] as $member) {
if (isset($member['insession']) && $member['insession'] == "true") {
$counted_matches++;
}
}
if ($counted_matches == count($quota['members'])) {
// They are going to exceed the quota if data is submitted
$quota_info[$x]['status'] = "matched";
} else {
$quota_info[$x]['status'] = "notmatched";
}
} else {
// Quota is no in danger of being exceeded.
$quota_info[$x]['status'] = "notmatched";
}
}
}
$x++;
}
} else {
return false;
}
// Now we have all the information we need about the quotas and their status.
// Lets see what we should do now
if ($checkaction == 'return') {
return $quota_info;
} elseif ($global_matched == true && $checkaction == 'enforce') {
// Need to add Quota action enforcement here.
reset($quota_info);
$tempmsg = "";
$found = false;
$redata = compact(array_keys(get_defined_vars()));
foreach ($quota_info as $quota) {
$quota['Message'] = templatereplace($quota['Message'], array(), $redata);
$quota['Url'] = passthruReplace($quota['Url'], $thissurvey);
$quota['Url'] = templatereplace($quota['Url'], array(), $redata);
$quota['UrlDescrip'] = templatereplace($quota['UrlDescrip'], array(), $redata);
if (isset($quota['status']) && $quota['status'] == "matched" && (isset($quota['Action']) && $quota['Action'] == "1")) {
// If a token is used then mark the token as completed
if (isset($clienttoken) && $clienttoken) {
submittokens(true);
}
sendCacheHeaders();
if ($quota['AutoloadUrl'] == 1 && $quota['Url'] != "") {
header("Location: " . $quota['Url']);
killSurveySession($surveyid);
}
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "/startpage.pstpl"), array(), $redata, 'frontend_helper[2617]');
echo "\t<div class='quotamessage'>\n";
echo "\t" . $quota['Message'] . "<br /><br />\n";
echo "\t<a href='" . $quota['Url'] . "'>" . $quota['UrlDescrip'] . "</a><br />\n";
echo "\t</div>\n";
echo templatereplace(file_get_contents($sTemplatePath . "/endpage.pstpl"), array(), $redata, 'frontend_helper[2622]');
doFooter();
killSurveySession($surveyid);
exit;
}
if (isset($quota['status']) && $quota['status'] == "matched" && (isset($quota['Action']) && $quota['Action'] == "2")) {
sendCacheHeaders();
doHeader();
$redata = compact(array_keys(get_defined_vars()));
echo templatereplace(file_get_contents($sTemplatePath . "/startpage.pstpl"), array(), $redata, 'frontend_helper[2634]');
echo "\t<div class='quotamessage'>\n";
echo "\t" . $quota['Message'] . "<br /><br />\n";
echo "\t<a href='" . $quota['Url'] . "'>" . $quota['UrlDescrip'] . "</a><br />\n";
echo CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey')) . "\n <input type='hidden' name='move' value='movenext' id='movenext' />\n <button class='nav-button nav-button-icon-left ui-corner-all' class='submit' accesskey='p' onclick=\"javascript:document.limesurvey.move.value = 'moveprev'; document.limesurvey.submit();\" id='moveprevbtn'>" . $clang->gT("Previous") . "</button>\n <input type='hidden' name='thisstep' value='" . $_SESSION['survey_' . $surveyid]['step'] . "' id='thisstep' />\n <input type='hidden' name='sid' value='" . returnGlobal('sid') . "' id='sid' />\n <input type='hidden' name='token' value='" . $clienttoken . "' id='token' />\n </form>\n";
echo "\t</div>\n";
echo templatereplace(file_get_contents($sTemplatePath . "/endpage.pstpl"), array(), $redata, 'frontend_helper[2644]');
doFooter();
exit;
}
}
} else {
// Unknown value
return false;
}
}
示例4: checkCompletedQuota
//.........这里部分代码省略.........
}
// Condition to count quota : Answers are the same in quota + an answer is submitted at this time (bPostedField) OR all questions is hidden (bAllHidden)
$bAllHidden = QuestionAttribute::model()->countByAttributes(array('qid' => $aQuotaQid), 'attribute=:attribute', array(':attribute' => 'hidden')) == count($aQuotaQid);
if ($iMatchedAnswers == count($aQuotaFields) && ($bPostedField || $bAllHidden)) {
if ($aQuotaInfo['qlimit'] == 0) {
// Always add the quota if qlimit==0
$aMatchedQuotas[] = $aQuotaInfo;
} else {
$iCompleted = getQuotaCompletedCount($surveyid, $aQuotaInfo['id']);
if (!is_null($iCompleted) && (int) $iCompleted >= (int) $aQuotaInfo['qlimit']) {
// This remove invalid quota and not completed
$aMatchedQuotas[] = $aQuotaInfo;
}
}
}
}
}
if ($return) {
return $aMatchedQuotas;
}
if (empty($aMatchedQuotas)) {
return;
}
// Now we have all the information we need about the quotas and their status.
// We need to construct the page and do all needed action
$aSurveyInfo = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$oTemplate = Template::model()->getInstance('', $surveyid);
$sTemplatePath = $oTemplate->path;
$sTemplateViewPath = $oTemplate->viewPath;
$sClientToken = isset($_SESSION['survey_' . $surveyid]['token']) ? $_SESSION['survey_' . $surveyid]['token'] : "";
// $redata for templatereplace
$aDataReplacement = array('thissurvey' => $aSurveyInfo, 'clienttoken' => $sClientToken, 'token' => $sClientToken);
// We take only the first matched quota, no need for each
$aMatchedQuota = $aMatchedQuotas[0];
// If a token is used then mark the token as completed, do it before event : this allow plugin to update token information
$event = new PluginEvent('afterSurveyQuota');
$event->set('surveyId', $surveyid);
$event->set('responseId', $_SESSION['survey_' . $surveyid]['srid']);
// We allways have a responseId
$event->set('aMatchedQuotas', $aMatchedQuotas);
// Give all the matched quota : the first is the active
App()->getPluginManager()->dispatchEvent($event);
$blocks = array();
foreach ($event->getAllContent() as $blockData) {
/* @var $blockData PluginEventContent */
$blocks[] = CHtml::tag('div', array('id' => $blockData->getCssId(), 'class' => $blockData->getCssClass()), $blockData->getContent());
}
// Allow plugin to update message, url, url description and action
$sMessage = $event->get('message', $aMatchedQuota['quotals_message']);
$sUrl = $event->get('url', $aMatchedQuota['quotals_url']);
$sUrlDescription = $event->get('urldescrip', $aMatchedQuota['quotals_urldescrip']);
$sAction = $event->get('action', $aMatchedQuota['action']);
$sAutoloadUrl = $event->get('autoloadurl', $aMatchedQuota['autoload_url']);
// Doing the action and show the page
if ($sAction == "1" && $sClientToken) {
submittokens(true);
}
// Construct the default message
$sMessage = templatereplace($sMessage, array(), $aDataReplacement, 'QuotaMessage', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrl = passthruReplace($sUrl, $aSurveyInfo);
$sUrl = templatereplace($sUrl, array(), $aDataReplacement, 'QuotaUrl', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
$sUrlDescription = templatereplace($sUrlDescription, array(), $aDataReplacement, 'QuotaUrldescription', $aSurveyInfo['anonymized'] != 'N', NULL, array(), true);
// Construction of default message inside quotamessage class
$sHtmlQuotaMessage = "<div class='quotamessage limesurveycore'>\n";
$sHtmlQuotaMessage .= "\t" . $sMessage . "\n";
$sHtmlQuotaUrl = $sUrl ? "<a href='" . $sUrl . "'>" . $sUrlDescription . "</a>" : "";
// Add the navigator with Previous button if quota allow modification.
if ($sAction == "2") {
$sQuotaStep = isset($_SESSION['survey_' . $surveyid]['step']) ? $_SESSION['survey_' . $surveyid]['step'] : 0;
// Surely not needed
$sNavigator = CHtml::htmlButton(gT("Previous"), array('type' => 'submit', 'id' => "moveprevbtn", 'value' => $sQuotaStep, 'name' => 'move', 'accesskey' => 'p', 'class' => "submit button btn btn-default"));
//$sNavigator .= " ".CHtml::htmlButton(gT("Submit"),array('type'=>'submit','id'=>"movesubmit",'value'=>"movesubmit",'name'=>"movesubmit",'accesskey'=>'l','class'=>"submit button"));
$sHtmlQuotaMessage .= CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'class' => 'survey-form-container QuotaMessage'));
$sHtmlQuotaMessage .= templatereplace(file_get_contents($sTemplateViewPath . "/navigator.pstpl"), array('NAVIGATOR' => $sNavigator, 'SAVE' => ''), $aDataReplacement);
$sHtmlQuotaMessage .= CHtml::hiddenField('sid', $surveyid);
$sHtmlQuotaMessage .= CHtml::hiddenField('token', $sClientToken);
// Did we really need it ?
$sHtmlQuotaMessage .= CHtml::endForm();
}
$sHtmlQuotaMessage .= "</div>\n";
// Add the plugin message before default message
$sHtmlQuotaMessage = implode("\n", $blocks) . "\n" . $sHtmlQuotaMessage;
// Send page to user and end.
sendCacheHeaders();
if ($sAutoloadUrl == 1 && $sUrl != "") {
if ($sAction == "1") {
killSurveySession($surveyid);
}
header("Location: " . $sUrl);
}
doHeader();
echo templatereplace(file_get_contents($sTemplateViewPath . "/startpage.pstpl"), array(), $aDataReplacement);
echo templatereplace(file_get_contents($sTemplateViewPath . "/completed.pstpl"), array("COMPLETED" => $sHtmlQuotaMessage, "URL" => $sHtmlQuotaUrl), $aDataReplacement);
echo templatereplace(file_get_contents($sTemplateViewPath . "/endpage.pstpl"), array(), $aDataReplacement);
doFooter();
if ($sAction == "1") {
killSurveySession($surveyid);
}
Yii::app()->end();
}
示例5: run
//.........这里部分代码省略.........
if (strlen($unansweredSQList) > 0 && $backok != "N") {
$notanswered = explode('|', $unansweredSQList);
} else {
$notanswered = array();
}
//CHECK INPUT
$invalidSQList = $moveResult['invalidSQs'];
if (strlen($invalidSQList) > 0 && $backok != "N") {
$notvalidated = explode('|', $invalidSQList);
} else {
$notvalidated = array();
}
}
// CHECK UPLOADED FILES
// TMSW - Move this into LEM::NavigateForwards?
$filenotvalidated = checkUploadedFileValidity($surveyid, $move, $backok);
//SEE IF THIS GROUP SHOULD DISPLAY
$show_empty_group = false;
if ($_SESSION[$LEMsessid]['step'] == 0) {
$show_empty_group = true;
}
$redata = compact(array_keys(get_defined_vars()));
//SUBMIT ###############################################################################
if (isset($move) && $move == "movesubmit") {
// setcookie("limesurvey_timers", "", time() - 3600); // remove the timers cookies //@todo fix - sometimes results in headers already sent error
if ($thissurvey['refurl'] == "Y") {
if (!in_array("refurl", $_SESSION[$LEMsessid]['insertarray'])) {
$_SESSION[$LEMsessid]['insertarray'][] = "refurl";
}
}
resetTimers();
//Before doing the "templatereplace()" function, check the $thissurvey['url']
//field for limereplace stuff, and do transformations!
$thissurvey['surveyls_url'] = passthruReplace($thissurvey['surveyls_url'], $thissurvey);
$thissurvey['surveyls_url'] = templatereplace($thissurvey['surveyls_url'], $thissurvey);
// to do INSERTANS substitutions
//END PAGE - COMMIT CHANGES TO DATABASE
if ($thissurvey['active'] != "Y") {
if ($thissurvey['assessments'] == "Y") {
$assessments = doAssessment($surveyid);
}
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
//Check for assessments
if ($thissurvey['assessments'] == "Y" && $assessments) {
echo templatereplace(file_get_contents($sTemplatePath . "assessment.pstpl"), array(), $redata);
}
// fetch all filenames from $_SESSIONS['files'] and delete them all
// from the /upload/tmp/ directory
/* echo "<pre>";print_r($_SESSION);echo "</pre>";
for($i = 1; isset($_SESSION[$LEMsessid]['files'][$i]); $i++)
{
unlink('upload/tmp/'.$_SESSION[$LEMsessid]['files'][$i]['filename']);
}
*/
// can't kill session before end message, otherwise INSERTANS doesn't work.
$completed = templatereplace($thissurvey['surveyls_endtext']);
$completed .= "<br /><strong><font size='2' color='red'>" . $clang->gT("Did Not Save") . "</font></strong><br /><br />\n\n";
$completed .= $clang->gT("Your survey responses have not been recorded. This survey is not yet active.") . "<br /><br />\n";
if ($thissurvey['printanswers'] == 'Y') {
// 'Clear all' link is only relevant for survey with printanswers enabled
// in other cases the session is cleared at submit time
$completed .= "<a href='" . Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}/move/clearall") . "'>" . $clang->gT("Clear Responses") . "</a><br /><br />\n";
}
} else {
示例6: submittokens
{
submittokens();
}
//Send notification to survey administrator
SendSubmitNotifications();
$_SESSION['finished']=true;
$_SESSION['sid']=$surveyid;
sendcacheheaders();
if (isset($thissurvey['autoredirect']) && $thissurvey['autoredirect'] == "Y" && $thissurvey['surveyls_url'])
{
$url = dTexts::run($thissurvey['surveyls_url']);
$url = passthruReplace($url, $thissurvey);
$url=str_replace("{SAVEDID}",$saved_id, $url); // to activate the SAVEDID in the END URL
$url=str_replace("{TOKEN}",$clienttoken, $url); // to activate the TOKEN in the END URL
$url=str_replace("{SID}", $surveyid, $url); // to activate the SID in the END URL
$url=str_replace("{LANG}", $clang->getlangcode(), $url); // to activate the LANG in the END URL
//Automatically redirect the page to the "url" setting for the survey
session_write_close();
header("Location: {$url}");
}
//if($thissurvey['printanswers'] != 'Y' && $thissurvey['usecookie'] != 'Y' && $tokensexist !=1)
if($thissurvey['printanswers'] != 'Y')
{
killSession();
}
示例7: getQuotaInformation
/**
* getQuotaInformation() returns quota information for the current survey
* @param string $surveyid - Survey identification number
* @param string $quotaid - Optional quotaid that restricts the result to a given quota
* @return array - nested array, Quotas->Members->Fields
*/
function getQuotaInformation($surveyid, $language, $quotaid = 'all')
{
global $clang, $clienttoken;
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$query = "SELECT * FROM " . db_table_name('quota') . ", " . db_table_name('quota_languagesettings') . "\n\t\t \t WHERE " . db_table_name('quota') . ".id = " . db_table_name('quota_languagesettings') . ".quotals_quota_id\n\t\t\t AND sid='{$surveyid}'\n AND quotals_language='" . $language . "'";
if ($quotaid != 'all') {
$query .= " AND id={$quotaid}";
}
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
//Checked
$quota_info = array();
$x = 0;
$surveyinfo = getSurveyInfo($surveyid);
// Check all quotas for the current survey
if ($result->RecordCount() > 0) {
while ($survey_quotas = $result->FetchRow()) {
//Modify the URL - thanks janokary
$survey_quotas['quotals_url'] = str_replace("{SAVEDID}", isset($_SESSION['srid']) ? $_SESSION['srid'] : '', $survey_quotas['quotals_url']);
$survey_quotas['quotals_url'] = str_replace("{SID}", $surveyid, $survey_quotas['quotals_url']);
$survey_quotas['quotals_url'] = str_replace("{LANG}", $clang->getlangcode(), $survey_quotas['quotals_url']);
$survey_quotas['quotals_url'] = str_replace("{TOKEN}", $clienttoken, $survey_quotas['quotals_url']);
array_push($quota_info, array('Name' => $survey_quotas['name'], 'Limit' => $survey_quotas['qlimit'], 'Action' => $survey_quotas['action'], 'Message' => $survey_quotas['quotals_message'], 'Url' => passthruReplace(insertansReplace($survey_quotas['quotals_url']), $surveyinfo), 'UrlDescrip' => $survey_quotas['quotals_urldescrip'], 'AutoloadUrl' => $survey_quotas['autoload_url']));
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE quota_id='{$survey_quotas['id']}'";
$result_qe = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
//Checked
$quota_info[$x]['members'] = array();
if ($result_qe->RecordCount() > 0) {
while ($quota_entry = $result_qe->FetchRow()) {
$query = "SELECT type, title,gid FROM " . db_table_name('questions') . " WHERE qid='{$quota_entry['qid']}' AND language='{$baselang}'";
$result_quest = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
//Checked
$qtype = $result_quest->FetchRow();
$fieldnames = "0";
if ($qtype['type'] == "I" || $qtype['type'] == "G" || $qtype['type'] == "Y") {
$fieldnames = array(0 => $surveyid . 'X' . $qtype['gid'] . 'X' . $quota_entry['qid']);
$value = $quota_entry['code'];
}
if ($qtype['type'] == "L" || $qtype['type'] == "O" || $qtype['type'] == "!") {
$fieldnames = array(0 => $surveyid . 'X' . $qtype['gid'] . 'X' . $quota_entry['qid']);
$value = $quota_entry['code'];
}
if ($qtype['type'] == "M") {
$fieldnames = array(0 => $surveyid . 'X' . $qtype['gid'] . 'X' . $quota_entry['qid'] . $quota_entry['code']);
$value = "Y";
}
if ($qtype['type'] == "A" || $qtype['type'] == "B") {
$temp = explode('-', $quota_entry['code']);
$fieldnames = array(0 => $surveyid . 'X' . $qtype['gid'] . 'X' . $quota_entry['qid'] . $temp[0]);
$value = $temp[1];
}
array_push($quota_info[$x]['members'], array('Title' => $qtype['title'], 'type' => $qtype['type'], 'code' => $quota_entry['code'], 'value' => $value, 'qid' => $quota_entry['qid'], 'fieldnames' => $fieldnames));
}
}
$x++;
}
}
return $quota_info;
}