本文整理汇总了PHP中limesurvey_lang::gT方法的典型用法代码示例。如果您正苦于以下问题:PHP limesurvey_lang::gT方法的具体用法?PHP limesurvey_lang::gT怎么用?PHP limesurvey_lang::gT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类limesurvey_lang
的用法示例。
在下文中一共展示了limesurvey_lang::gT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: question
/* ]]> */
</script>
';
$answer = $answers[0][1];
$help = $answers[0][2];
$question = $answers[0][0];
$question['code'] = $answers[0][5];
$question['class'] = question_class($qrows['type']);
$question['essentials'] = 'id="question' . $qrows['qid'] . '"';
$question['sgq'] = $ia[1];
//Temporary fix for error condition arising from linked question via replacement fields
//@todo: find a consistent way to check and handle this - I guess this is already handled but the wrong values are entered into the DB
$search_for = '{INSERTANS';
if (strpos($question['text'], $search_for) !== false) {
$pattern_text = '/{([A-Z])*:([0-9])*X([0-9])*X([0-9])*}/';
$replacement_text = $clang->gT('[Dependency on another question (ID $4)]');
$text = preg_replace($pattern_text, $replacement_text, $question['text']);
$question['text'] = $text;
}
if ($qrows['mandatory'] == 'Y') {
$question['man_class'] = ' mandatory';
} else {
$question['man_class'] = '';
}
$content = templatereplace(file_get_contents("{$thistpl}/startpage.pstpl"));
$content .= '<form method="post" action="index.php" id="limesurvey" name="limesurvey" autocomplete="off">';
$content .= templatereplace(file_get_contents("{$thistpl}/startgroup.pstpl"));
$question_template = file_get_contents("{$thistpl}/question.pstpl");
if (substr_count($question_template, '{QUESTION_ESSENTIALS}') > 0) {
// LS 1.87 and newer templates
$content .= "\n" . templatereplace($question_template) . "\n";
示例2: generate_statistics
//.........这里部分代码省略.........
//print_r($_POST);
//if $summary isn't an array we create one
if (isset($summary) && !is_array($summary))
{
$summary = explode("+", $summary);
}
}
/* Some variable depend on output type, actually : only line feed */
switch($outputType)
{
case 'xls':
$linefeed = "\n";
break;
case 'pdf':
$linefeed = "\n";
break;
case 'html':
$linefeed = "<br />\n";
break;
default:
break;
}
/**
* pdf Config
*/
if($outputType=='pdf')
{
require_once('classes/tcpdf/config/lang/eng.php');
global $l;
$l['w_page'] = $statlang->gT("Page",'unescaped');
require_once('classes/tcpdf/mypdf.php');
// create new PDF document
$pdf = new MyPDF();
$pdf->SetFont($pdfdefaultfont,'',$pdffontsize);
$surveyInfo = getSurveyInfo($surveyid,$language);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('LimeSurvey');
$pdf->SetTitle('Statistic survey '.$surveyid);
$pdf->SetSubject($surveyInfo['surveyls_title']);
$pdf->SetKeywords('LimeSurvey, Statistics, Survey '.$surveyid.'');
$pdf->SetDisplayMode('fullpage', 'two');
// set header and footer fonts
$pdf->setHeaderFont(Array($pdfdefaultfont, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array($pdfdefaultfont, '', PDF_FONT_SIZE_DATA));
// set default header data
// the path looks awkward - did not find a better solution to set the image path?
$pdf->SetHeaderData("statistics.png", 10, $statlang->gT("Quick statistics",'unescaped') , $statlang->gT("Survey")." ".$surveyid." '".FlattenText($surveyInfo['surveyls_title'],true,'UTF-8')."'");
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
示例3: define
} else {
define('PRINT_TEMPLATE_DIR', $standardtemplaterootdir . '/default/', true);
define('PRINT_TEMPLATE_URL', $standardtemplaterooturl . '/default/', true);
}
$fieldmap = createFieldMap($surveyid);
$degquery = "SELECT * FROM " . db_table_name("groups") . " WHERE sid='{$surveyid}' AND language='{$surveyprintlang}' ORDER BY " . db_table_name("groups") . ".group_order";
$degresult = db_execute_assoc($degquery);
if (!isset($surveyfaxto) || !$surveyfaxto and isset($surveyfaxnumber)) {
$surveyfaxto = $surveyfaxnumber;
//Use system fax number if none is set in survey.
}
$pdf_form = '';
if (isset($usepdfexport) && $usepdfexport == 1 && !in_array($surveyprintlang, $notsupportlanguages)) {
$pdf_form = '
<form action="' . $scriptname . '?action=showprintablesurvey&sid=' . $surveyid . '&lang=' . $surveyprintlang . '" method="post">
<input type="submit" value="' . $clang->gT('PDF Export') . '"/>
<input type="hidden" name="checksessionbypost" value="' . htmlspecialchars($_SESSION['checksessionpost']) . '"/>
<input type="hidden" name="printableexport" value="true"/>
</form>
';
}
$headelements = getPrintableHeader();
//if $showsgqacode is enabled at config.php show table name for reference
if (isset($showsgqacode) && $showsgqacode == true) {
$surveyname = $surveyname . "<br />[" . $clang->gT('Database') . " " . $clang->gT('table') . ": {$surveytable}]";
} else {
$surveyname = "";
}
$survey_output = array('SITENAME' => $sitename, 'SURVEYNAME' => $surveyname, 'SURVEYDESCRIPTION' => $surveydesc, 'WELCOME' => $welcome, 'END' => $end, 'THEREAREXQUESTIONS' => 0, 'SUBMIT_TEXT' => $clang->gT("Submit Your Survey."), 'SUBMIT_BY' => $surveyexpirydate, 'THANKS' => $clang->gT("Thank you for completing this survey."), 'PDF_FORM' => $pdf_form, 'HEADELEMENTS' => $headelements, 'TEMPLATEURL' => PRINT_TEMPLATE_URL, 'FAXTO' => $surveyfaxto, 'PRIVACY' => '', 'GROUPS' => '');
$survey_output['FAX_TO'] = '';
if (!empty($surveyfaxto) && $surveyfaxto != '000-00000000') {
示例4: die
// just to avoid notices
include "database.php";
$query = "SELECT uid, password, lang FROM " . db_table_name('users') . " WHERE users_name=" . $connect->qstr($username);
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$result = $connect->SelectLimit($query, 1) or die($query . "\n" . $connect->ErrorMsg());
if ($result->RecordCount() < 1) {
// wrong or unknown username and/or email
echo "\n" . $clang->gT("User name invalid!") . "\n";
exit;
} else {
$fields = $result->FetchRow();
if (SHA256::hashing($userpass) == $fields['password']) {
$_SESSION['loginID'] = intval($fields['uid']);
$clang = new limesurvey_lang($fields['lang']);
GetSessionUserRights($_SESSION['loginID']);
if (!$_SESSION['USER_RIGHT_CREATE_SURVEY']) {
// no permission to create survey!
echo "\n" . $clang->gT("You are not allowed to import a survey!") . "\n";
exit;
}
} else {
// password don't match username
echo "\n" . $clang->gT("User name and password do not match!") . "\n";
exit;
}
}
echo "\n";
$importsurvey = "";
$importingfrom = "cmdline";
// "http" for the web version and "cmdline" for the command line version
include "importsurvey.php";
示例5: GetBaseLanguageFromSurveyID
//You must have an SID to use this
include "index.php";
exit;
}
// Get passed language from form, so that we dont loose this!
if (!isset($postlang) || $postlang == "") {
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$clang = new limesurvey_lang($baselang);
} else {
$clang = new limesurvey_lang($postlang);
$baselang = $postlang;
}
$thissurvey = getSurveyInfo($surveyid, $baselang);
$html = '<div id="wrapper"><p id="optoutmessage">';
if ($thissurvey == false || !tableExists("tokens_{$surveyid}")) {
$html .= $clang->gT('This survey does not seem to exist.');
} else {
$usquery = "SELECT emailstatus from " . db_table_name("tokens_{$surveyid}") . " where token=" . db_quoteall($token, true);
$usresult = $connect->GetOne($usquery);
if ($usresult == false) {
$html .= $clang->gT('You are not a participant in this survey.');
} elseif ($usresult == 'OK') {
$usquery = "Update " . db_table_name("tokens_{$surveyid}") . " set emailstatus='OptOut', usesleft=0 where token=" . db_quoteall($token, true);
$usresult = $connect->Execute($usquery);
$html .= $clang->gT('You have been successfully removed from this survey.');
} else {
$html .= $clang->gT('You have been already removed from this survey.');
}
}
$html .= '</p></div>';
//PRINT COMPLETED PAGE
示例6:
$clang = new limesurvey_lang($postlang);
$baselang = $postlang;
}
$thissurvey=getSurveyInfo($surveyid,$baselang);
$register_errormsg = "";
// Check the security question's answer
if (function_exists("ImageCreate") && captcha_enabled('registrationscreen',$thissurvey['usecaptcha']) )
{
if (!isset($_POST['loadsecurity']) ||
!isset($_SESSION['secanswer']) ||
$_POST['loadsecurity'] != $_SESSION['secanswer'])
{
$register_errormsg .= $clang->gT("The answer to the security question is incorrect.")."<br />\n";
}
}
//Check that the email is a valid style address
if (!validate_email(returnglobal('register_email')))
{
$register_errormsg .= $clang->gT("The email you used is not valid. Please try again.");
}
if ($register_errormsg != "")
{
include "index.php";
exit;
}
示例7: index
/**
* Show printable survey
*/
function index($surveyid, $lang = null)
{
$surveyid = sanitize_int($surveyid);
if (!Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
$clang = $this->getController()->lang;
$aData['surveyid'] = $surveyid;
App()->getClientScript()->registerPackage('jquery-superfish');
$message['title'] = $clang->gT('Access denied!');
$message['message'] = $clang->gT('You do not have sufficient rights to access this page.');
$message['class'] = "error";
$this->_renderWrappedTemplate('survey', array("message" => $message), $aData);
} else {
$aSurveyInfo = getSurveyInfo($surveyid, $lang);
if (!$aSurveyInfo) {
$this->getController()->error('Invalid survey ID');
}
// Be sure to have a valid language
$surveyprintlang = $aSurveyInfo['surveyls_language'];
// Setting the selected language for printout
$clang = new limesurvey_lang($surveyprintlang);
$templatename = validateTemplateDir($aSurveyInfo['templatedir']);
$welcome = $aSurveyInfo['surveyls_welcometext'];
$end = $aSurveyInfo['surveyls_endtext'];
$surveyname = $aSurveyInfo['surveyls_title'];
$surveydesc = $aSurveyInfo['surveyls_description'];
$surveyactive = $aSurveyInfo['active'];
$surveytable = "{{survey_" . $aSurveyInfo['sid'] . "}}";
$surveyexpirydate = $aSurveyInfo['expires'];
$surveyfaxto = $aSurveyInfo['faxto'];
$dateformattype = $aSurveyInfo['surveyls_dateformat'];
Yii::app()->loadHelper('surveytranslator');
if (!is_null($surveyexpirydate)) {
$dformat = getDateFormatData($dateformattype);
$dformat = $dformat['phpdate'];
$expirytimestamp = strtotime($surveyexpirydate);
$expirytimeofday_h = date('H', $expirytimestamp);
$expirytimeofday_m = date('i', $expirytimestamp);
$surveyexpirydate = date($dformat, $expirytimestamp);
if (!empty($expirytimeofday_h) || !empty($expirytimeofday_m)) {
$surveyexpirydate .= ' – ' . $expirytimeofday_h . ':' . $expirytimeofday_m;
}
sprintf($clang->gT("Please submit by %s"), $surveyexpirydate);
} else {
$surveyexpirydate = '';
}
//Fix $templatename : control if print_survey.pstpl exist
if (is_file(getTemplatePath($templatename) . DIRECTORY_SEPARATOR . 'print_survey.pstpl')) {
$templatename = $templatename;
// Change nothing
} elseif (is_file(getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . DIRECTORY_SEPARATOR . 'print_survey.pstpl')) {
$templatename = Yii::app()->getConfig("defaulttemplate");
} else {
$templatename = "default";
}
$sFullTemplatePath = getTemplatePath($templatename) . DIRECTORY_SEPARATOR;
$sFullTemplateUrl = getTemplateURL($templatename) . "/";
define('PRINT_TEMPLATE_DIR', $sFullTemplatePath, true);
define('PRINT_TEMPLATE_URL', $sFullTemplateUrl, true);
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$condition = "sid = '{$surveyid}' AND language = '{$surveyprintlang}'";
$degresult = QuestionGroup::model()->getAllGroups($condition, array('group_order'));
//xiao,
if (!isset($surveyfaxto) || !$surveyfaxto and isset($surveyfaxnumber)) {
$surveyfaxto = $surveyfaxnumber;
//Use system fax number if none is set in survey.
}
$headelements = getPrintableHeader();
//if $showsgqacode is enabled at config.php show table name for reference
$showsgqacode = Yii::app()->getConfig("showsgqacode");
if (isset($showsgqacode) && $showsgqacode == true) {
$surveyname = $surveyname . "<br />[" . $clang->gT('Database') . " " . $clang->gT('table') . ": {$surveytable}]";
} else {
$surveyname = $surveyname;
}
$survey_output = array('SITENAME' => Yii::app()->getConfig("sitename"), 'SURVEYNAME' => $surveyname, 'SURVEYDESCRIPTION' => $surveydesc, 'WELCOME' => $welcome, 'END' => $end, 'THEREAREXQUESTIONS' => 0, 'SUBMIT_TEXT' => $clang->gT("Submit Your Survey."), 'SUBMIT_BY' => $surveyexpirydate, 'THANKS' => $clang->gT("Thank you for completing this survey."), 'HEADELEMENTS' => $headelements, 'TEMPLATEURL' => PRINT_TEMPLATE_URL, 'FAXTO' => $surveyfaxto, 'PRIVACY' => '', 'GROUPS' => '');
$survey_output['FAX_TO'] = '';
if (!empty($surveyfaxto) && $surveyfaxto != '000-00000000') {
$survey_output['FAX_TO'] = $clang->gT("Please fax your completed survey to:") . " {$surveyfaxto}";
}
$total_questions = 0;
$mapquestionsNumbers = array();
$answertext = '';
// otherwise can throw an error on line 1617
$fieldmap = createFieldMap($surveyid, 'full', false, false, $surveyprintlang);
// =========================================================
// START doin the business:
foreach ($degresult->readAll() as $degrow) {
// ---------------------------------------------------
// START doing groups
$deqresult = Question::model()->getQuestions($surveyid, $degrow['gid'], $surveyprintlang, 0, '"I"');
$deqrows = array();
//Create an empty array in case FetchRow does not return any rows
foreach ($deqresult->readAll() as $deqrow) {
$deqrows[] = $deqrow;
}
// Get table output into array
//.........这里部分代码省略.........
示例8: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$pdfdefaultfont = Yii::app()->getConfig('pdfdefaultfont');
$pdffontsize = Yii::app()->getConfig('pdffontsize');
$pdforientation = Yii::app()->getConfig('pdforientation');
$clang = new limesurvey_lang($sLanguageCode);
if ($oOptions->output == 'file') {
$this->pdfDestination = 'F';
} else {
$this->pdfDestination = 'D';
}
Yii::import('application.libraries.admin.pdf', true);
if ($pdfdefaultfont == 'auto') {
$pdfdefaultfont = PDF_FONT_NAME_DATA;
}
// Array of PDF core fonts: are replaced by according fonts according to the alternatepdffontfile array.Maybe just courier,helvetica and times but if a user want symbol: why not ....
$pdfcorefont = array("courier", "helvetica", "symbol", "times", "zapfdingbats");
$pdffontsize = Yii::app()->getConfig('pdffontsize');
// create new PDF document
$this->pdf = new pdf();
if (in_array($pdfdefaultfont, $pdfcorefont)) {
$alternatepdffontfile = Yii::app()->getConfig('alternatepdffontfile');
if (array_key_exists($sLanguageCode, $alternatepdffontfile)) {
$pdfdefaultfont = $alternatepdffontfile[$sLanguageCode];
// Actually use only core font
}
}
if ($pdffontsize == 'auto') {
$pdffontsize = PDF_FONT_SIZE_MAIN;
}
$this->pdf = new pdf();
$this->pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
$this->pdf->AddPage();
$this->pdf->intopdf("PDF export " . date("Y.m.d-H:i", time()));
//Set some pdf metadata
Yii::app()->loadHelper('surveytranslator');
$lg = array();
$lg['a_meta_charset'] = 'UTF-8';
if (getLanguageRTL($sLanguageCode)) {
$lg['a_meta_dir'] = 'rtl';
} else {
$lg['a_meta_dir'] = 'ltr';
}
$lg['a_meta_language'] = $sLanguageCode;
$lg['w_page'] = $clang->gT("page");
$this->pdf->setLanguageArray($lg);
$this->separator = "\t";
$this->rowCounter = 0;
$this->surveyName = $survey->languageSettings[0]['surveyls_title'];
$this->pdf->titleintopdf($this->surveyName, $survey->languageSettings[0]['surveyls_description']);
}
示例9: define
define('PRINT_TEMPLATE_DIR', $standardtemplaterootdir . '/default/', true);
define('PRINT_TEMPLATE_URL', $standardtemplaterooturl . '/default/', true);
}
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$degquery = "SELECT * FROM " . db_table_name("groups") . " WHERE sid='{$surveyid}' AND language='{$surveyprintlang}' ORDER BY " . db_table_name("groups") . ".group_order";
$degresult = db_execute_assoc($degquery);
if (!isset($surveyfaxto) || !$surveyfaxto and isset($surveyfaxnumber)) {
$surveyfaxto = $surveyfaxnumber;
//Use system fax number if none is set in survey.
}
$pdf_form = '';
if (isset($usepdfexport) && $usepdfexport == 1 && !in_array($surveyprintlang, $notsupportlanguages)) {
$pdf_form = '
<form action="' . $scriptname . '?action=showprintablesurvey&sid=' . $surveyid . '&lang=' . $surveyprintlang . '" method="post">
<input type="submit" value="' . $clang->gT('PDF Export') . '"/>
<input type="hidden" name="checksessionbypost" value="' . htmlspecialchars($_SESSION['checksessionpost']) . '"/>
<input type="hidden" name="printableexport" value="true"/>
</form>
';
}
$headelements = getPrintableHeader();
//if $showsgqacode is enabled at config.php show table name for reference
if (isset($showsgqacode) && $showsgqacode == true) {
$surveyname = $surveyname . "<br />[" . $clang->gT('Database') . " " . $clang->gT('table') . ": {$surveytable}]";
} else {
$surveyname = $surveyname;
}
$survey_output = array('SITENAME' => $sitename, 'SURVEYNAME' => $surveyname, 'SURVEYDESCRIPTION' => $surveydesc, 'WELCOME' => $welcome, 'END' => $end, 'THEREAREXQUESTIONS' => 0, 'SUBMIT_TEXT' => $clang->gT("Submit Your Survey."), 'SUBMIT_BY' => $surveyexpirydate, 'THANKS' => $clang->gT("Thank you for completing this survey."), 'PDF_FORM' => $pdf_form, 'HEADELEMENTS' => $headelements, 'TEMPLATEURL' => PRINT_TEMPLATE_URL, 'FAXTO' => $surveyfaxto, 'PRIVACY' => '', 'GROUPS' => '');
$survey_output['FAX_TO'] = '';
if (!empty($surveyfaxto) && $surveyfaxto != '000-00000000') {
示例10: createFieldMap
/**
* This function generates an array containing the fieldcode, and matching data in the same order as the activate script
*
* @param string $surveyid The Survey ID
* @param mixed $style 'short' (default) or 'full' - full creates extra information like default values
* @param mixed $force_refresh - Forces to really refresh the array, not just take the session copy
* @param int $questionid Limit to a certain qid only (for question preview) - default is false
* @return array
*/
function createFieldMap($surveyid, $style = 'full', $force_refresh = false, $questionid = false, $sQuestionLanguage = null)
{
global $dbprefix, $connect, $clang, $aDuplicateQIDs;
$surveyid = sanitize_int($surveyid);
//Get list of questions
if (is_null($sQuestionLanguage)) {
if (isset($_SESSION['s_lang']) && in_array($_SESSION['s_lang'], GetAdditionalLanguagesFromSurveyID($surveyid))) {
$sQuestionLanguage = $_SESSION['s_lang'];
} else {
$sQuestionLanguage = GetBaseLanguageFromSurveyID($surveyid);
}
}
$sQuestionLanguage = sanitize_languagecode($sQuestionLanguage);
if ($clang->langcode != $sQuestionLanguage) {
SetSurveyLanguage($surveyid, $sQuestionLanguage);
}
$s_lang = $clang->langcode;
//checks to see if fieldmap has already been built for this page.
if (isset($_SESSION['fieldmap-' . $surveyid . $s_lang]) && !$force_refresh && $questionid == false) {
if (isset($_SESSION['adminlang']) && $clang->langcode != $_SESSION['adminlang']) {
$clang = new limesurvey_lang($_SESSION['adminlang']);
}
return $_SESSION['fieldmap-' . $surveyid . $s_lang];
}
$fieldmap["id"] = array("fieldname" => "id", 'sid' => $surveyid, 'type' => "id", "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["id"]['title'] = "";
$fieldmap["id"]['question'] = $clang->gT("Response ID");
$fieldmap["id"]['group_name'] = "";
}
$fieldmap["submitdate"] = array("fieldname" => "submitdate", 'type' => "submitdate", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["submitdate"]['title'] = "";
$fieldmap["submitdate"]['question'] = $clang->gT("Date submitted");
$fieldmap["submitdate"]['group_name'] = "";
}
$fieldmap["lastpage"] = array("fieldname" => "lastpage", 'sid' => $surveyid, 'type' => "lastpage", "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["lastpage"]['title'] = "";
$fieldmap["lastpage"]['question'] = $clang->gT("Last page");
$fieldmap["lastpage"]['group_name'] = "";
}
$fieldmap["startlanguage"] = array("fieldname" => "startlanguage", 'sid' => $surveyid, 'type' => "startlanguage", "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["startlanguage"]['title'] = "";
$fieldmap["startlanguage"]['question'] = $clang->gT("Start language");
$fieldmap["startlanguage"]['group_name'] = "";
}
//Check for any additional fields for this survey and create necessary fields (token and datestamp and ipaddr)
$pquery = "SELECT anonymized, datestamp, ipaddr, refurl FROM " . db_table_name('surveys') . " WHERE sid={$surveyid}";
$presult = db_execute_assoc($pquery);
//Checked
while ($prow = $presult->FetchRow()) {
if ($prow['anonymized'] == "N") {
$fieldmap["token"] = array("fieldname" => "token", 'sid' => $surveyid, 'type' => "token", "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["token"]['title'] = "";
$fieldmap["token"]['question'] = $clang->gT("Token");
$fieldmap["token"]['group_name'] = "";
}
}
if ($prow['datestamp'] == "Y") {
$fieldmap["datestamp"] = array("fieldname" => "datestamp", 'type' => "datestamp", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["datestamp"]['title'] = "";
$fieldmap["datestamp"]['question'] = $clang->gT("Date last action");
$fieldmap["datestamp"]['group_name'] = "";
}
$fieldmap["startdate"] = array("fieldname" => "startdate", 'type' => "startdate", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["startdate"]['title'] = "";
$fieldmap["startdate"]['question'] = $clang->gT("Date started");
$fieldmap["startdate"]['group_name'] = "";
}
}
if ($prow['ipaddr'] == "Y") {
$fieldmap["ipaddr"] = array("fieldname" => "ipaddr", 'type' => "ipaddress", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["ipaddr"]['title'] = "";
$fieldmap["ipaddr"]['question'] = $clang->gT("IP address");
$fieldmap["ipaddr"]['group_name'] = "";
}
}
// Add 'refurl' to fieldmap.
if ($prow['refurl'] == "Y") {
$fieldmap["refurl"] = array("fieldname" => "refurl", 'type' => "url", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["refurl"]['title'] = "";
$fieldmap["refurl"]['question'] = $clang->gT("Referrer URL");
$fieldmap["refurl"]['group_name'] = "";
}
//.........这里部分代码省略.........
示例11: getAdminHeader
*
* $Id: createdb.php 9622 2010-12-10 21:38:02Z c_schmitz $
*/
//Ensure script is not run directly, avoid path disclosure
if (isset($_REQUEST['rootdir'])) {
die('You cannot start this script directly');
}
require_once dirname(__FILE__) . '/../../config-defaults.php';
require_once dirname(__FILE__) . '/../../common.php';
require_once $rootdir . '/classes/core/language.php';
require_once dirname(__FILE__) . '/../admin_functions.php';
$clang = new limesurvey_lang("en");
$dbname = $databasename;
sendcacheheaders();
echo getAdminHeader();
echo "<div class='messagebox ui-corner-all'><div class='header ui-widget-header' >" . $clang->gT("Create Database") . "</div><p>\n";
echo $clang->gT("Creating tables. This might take a moment...") . "<p> \n";
// In Step2 fill the database with data
if (returnglobal('createdbstep2') == $clang->gT("Populate Database")) {
$createdbtype = $databasetype;
if ($databasetype == 'mysql' || $databasetype == 'mysqli') {
@$connect->Execute("ALTER DATABASE `{$dbname}` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;");
$createdbtype = 'mysql';
}
if ($createdbtype == 'mssql_n' || $createdbtype == 'odbc_mssql' || $createdbtype == 'odbtp') {
$createdbtype = 'mssql';
}
if ($createdbtype == 'postgres' && version_compare($connect->pgVersion, '9') >= 0) {
$connect->execute("ALTER DATABASE {$dbname} SET bytea_output='escape';");
}
if ($createdbtype == 'mssqlnative') {
示例12: intval
// User already exists
$isAuthenticated = true;
}
if ($isAuthenticated === true) {
// user exists and was authenticated by webserver
$fields = $result->FetchRow();
$_SESSION['loginID'] = intval($fields['uid']);
$_SESSION['user'] = $fields['users_name'];
$_SESSION['adminlang'] = $fields['lang'];
$_SESSION['htmleditormode'] = $fields['htmleditormode'];
$_SESSION['dateformat'] = $fields['dateformat'];
$_SESSION['checksessionpost'] = sRandomChars(10);
$_SESSION['pw_notify'] = false;
$clang = new limesurvey_lang($_SESSION['adminlang']);
$login = true;
$loginsummary .= "<br /><span style='font-weight:bold;'>" . sprintf($clang->gT("Welcome %s!"), $_SESSION['user']) . "</span><br />";
$loginsummary .= $clang->gT("You logged in successfully.");
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] && strpos($_SERVER['QUERY_STRING'], "action=logout") === FALSE) {
$_SESSION['metaHeader'] = "<meta http-equiv=\"refresh\"" . " content=\"1;URL={$scriptname}?" . $_SERVER['QUERY_STRING'] . "\" />";
$loginsummary .= "<p><font size='1'><i>" . $clang->gT("Reloading screen. Please wait.") . "</i></font>\n";
}
$loginsummary .= "<br /><br />\n";
GetSessionUserRights($_SESSION['loginID']);
}
}
} elseif ($action == "logout") {
killSession();
$logoutsummary = '<p>' . $clang->gT("Logout successful.");
} elseif ($action == "adduser" && $_SESSION['USER_RIGHT_CREATE_USER']) {
$addsummary = "<div class='header ui-widget-header'>" . $clang->gT("Add user") . "</div>\n";
$new_user = FlattenText($postnew_user, true);
示例13: die
@session_start();
if (isset($_SESSION['sid'])) {
$surveyid = $_SESSION['sid'];
} else {
die('Invalid survey/session');
}
//Debut session time out
if (!isset($_SESSION['finished']) || !isset($_SESSION['srid'])) {
require_once $rootdir . '/classes/core/language.php';
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$clang = new limesurvey_lang($baselang);
//A nice exit
sendcacheheaders();
doHeader();
echo templatereplace(file_get_contents(sGetTemplatePath(validate_templatedir("default")) . "/startpage.pstpl"));
echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("ERROR") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), $siteadminname, $siteadminemail) . "\n" . "</center><br />\n";
echo templatereplace(file_get_contents(sGetTemplatePath(validate_templatedir("default")) . "/endpage.pstpl"));
doFooter();
exit;
}
//Fin session time out
$id = $_SESSION['srid'];
//I want to see the answers with this id
$clang = $_SESSION['s_lang'];
//A little bit of debug to see in the noodles plate
/*if ($debug==2)
{
echo "MonSurveyID $surveyid et ma langue ". $_SESSION['s_lang']. " et SRID = ". $_SESSION['srid'] ."<br />";
echo "session id".session_id()." \n"."<br />";
echo //"secanswer ". $_SESSION['secanswer']
示例14: activateSubmit
if (count(GetAdditionalLanguagesFromSurveyID($surveyid))>0)
{
$dataentryoutput .= "\t<tr>\n"
."\t<td colspan='3' align='center'>\n"
."\t".$langlistbox."\n"
."\t</td>\n"
."\t</tr>\n";
$dataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
}
if (tableExists('tokens_'.$thissurvey['sid'])) //Give entry field for token id
{
$dataentryoutput .= "\t<tr>\n"
."<td valign='top' width='1%'></td>\n"
."<td valign='top' align='right' width='30%'><font color='red'>*</font><strong>".$blang->gT("Token").":</strong></td>\n"
."<td valign='top' align='left' style='padding-left: 20px'>\n"
."\t<input type='text' id='token' name='token' onkeyup='activateSubmit(this);' />\n"
."</td>\n"
."\t</tr>\n";
$dataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
$dataentryoutput .= "\n"
. "\t<script type=\"text/javascript\"><!-- \n"
. "\tfunction activateSubmit(me)\n"
. "\t{"
. "if (me.value != '')"
. "{\n"
. "\tdocument.getElementById('submitdata').disabled = false;\n"
. "}\n"
示例15: createFieldMap
$maxfilesize = (int) $_POST['max_filesize'];
$preview = $_POST['preview'];
$fieldname = $_POST['fieldname'];
$aFieldMap = createFieldMap($surveyid);
if (!isset($aFieldMap[$fieldname])) {
die;
}
$aAttributes = getQuestionAttributes($aFieldMap[$fieldname]['qid'], $aFieldMap[$fieldname]['type']);
$valid_extensions_array = explode(",", $aAttributes['allowed_filetypes']);
$valid_extensions_array = array_map('trim', $valid_extensions_array);
$pathinfo = pathinfo($_FILES['uploadfile']['name']);
$ext = $pathinfo['extension'];
// check to see that this file type is allowed
// it is also checked at the client side, but jst double checking
if (!in_array(strtolower($ext), $valid_extensions_array)) {
$return = array("success" => false, "msg" => sprintf($clang->gT("Sorry, this file extension (%s) is not allowed!"), $ext));
echo ls_json_encode($return);
exit;
}
// If this is just a preview, don't save the file
if ($preview) {
if ($size > $maxfilesize) {
$return = array("success" => false, "msg" => sprintf($clang->gT("Sorry, this file is too large. Only files upto %s KB are allowed."), $maxfilesize));
echo ls_json_encode($return);
} else {
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $randfileloc)) {
$return = array("success" => true, "size" => $size, "name" => rawurlencode(basename($filename)), "ext" => $ext, "filename" => $randfilename, "msg" => $clang->gT("The file has been successfuly uploaded."));
echo ls_json_encode($return);
// TODO : unlink this file since this is just a preview
// unlink($randfileloc);
}