本文整理汇总了PHP中loadvar函数的典型用法代码示例。如果您正苦于以下问题:PHP loadvar函数的具体用法?PHP loadvar怎么用?PHP loadvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadvar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showNavBar
public function showNavBar()
{
if (loadvar(POST_PARAM_AJAX_LOAD) == AJAX_LOAD) {
return;
}
$testActive = '';
$reportedActive = '';
if (!isset($_SESSION['LASTPAGE'])) {
$_SESSION['LASTPAGE'] = 'tester.home';
}
if (strpos($_SESSION['LASTPAGE'], 'tester.tools.test') === 0) {
$testActive = ' active';
} else {
if (strpos($_SESSION['LASTPAGE'], 'tester.tools.reported') === 0) {
$testActive = '';
$reportedActive = ' active';
}
}
$returnStr = '
<!-- Fixed navbar -->
<div id="mainnavbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="' . setSessionParams(array('page' => 'tester.home')) . '">' . Language::messageSMSTitle() . '</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">';
$returnStr .= '<li class="' . $testActive . '">' . setSessionParamsHref(array('page' => 'tester.tools.test'), Language::linkTest()) . '</li>';
$returnStr .= '<li class="' . $reportedActive . '">' . setSessionParamsHref(array('page' => 'tester.tools.reported'), Language::linkReported()) . '</li>';
$returnStr .= '</ul>';
$user = new User($_SESSION['URID']);
$returnStr .= '<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a data-hover="dropdown" class="dropdown-toggle" data-toggle="dropdown">' . $user->getUsername() . ' <b class="caret"></b></a>
<ul class="dropdown-menu">';
$returnStr .= '<li><a ' . POST_PARAM_NOAJAX . '=' . NOAJAX . ' href="index.php?rs=1&se=2"><span class="glyphicon glyphicon-log-out"></span> ' . Language::linkLogout() . '</a></li>
</ul>
</li>
</ul>';
$returnStr .= '
</div><!--/.nav-collapse -->
</div>
</div>
';
$returnStr .= "<div id='content'>";
return $returnStr;
}
示例2: checkSMSAccess
function checkSMSAccess()
{
global $db;
$username = loadvar('username');
$password = loadvar('password');
$result = $db->selectQuery('select count(*), urid from ' . Config::dbSurvey() . '_users where username=\'' . prepareDatabaseString($username) . '\' and status=1 and aes_decrypt(password, \'' . Config::smsPasswordKey() . '\') = \'' . prepareDatabaseString($password) . '\'');
//echo 'select count(*), urid from ' . Config::dbSurvey() . '_users where username="' . prepareDatabaseString($username) . '" and status=1 and aes_decrypt(password, "' . Config::smsPasswordKey() . '") = "' . prepareDatabaseString($password) . '"';
$row = $db->getRow($result);
if ($row[0] == 1) {
$_SESSION['URID'] = $row['urid'];
return true;
} else {
$logactions = new LogActions();
$logactions->addAction('', '', "loginwrong", USCIC_SMS);
}
return false;
}
示例3: showUsersList
function showUsersList($users)
{
$returnStr = '';
$returnStr .= "<form id=refreshform method=post>";
$returnStr .= '<input type=hidden name=page value="sysadmin.users">';
$returnStr .= '<input type=hidden name="usertype" id="usertype_hidden">';
$returnStr .= "</form>";
$usertypes = array(-1 => Language::labelAll(), USER_INTERVIEWER => Language::labelInterviewer(), USER_NURSE => Language::labelNurse(), USER_SUPERVISOR => Language::labelSupervisor(), USER_TRANSLATOR => Language::labelTranslator(), USER_RESEARCHER => Language::labelResearcher(), USER_SYSADMIN => Language::labelSysadmin(), USER_TESTER => Language::labelTester());
$usertype = loadvar('usertype', USER_INTERVIEWER);
$returnStr .= Language::labelUserFilter() . $this->displaySelectFromArray($usertypes, $usertype, 'usertype');
$returnStr .= "<script type='text/javascript'>";
$returnStr .= '$( document ).ready(function() {
$("#usertype").change(function (e) {
$("#usertype_hidden").val(this.value);
$("#refreshform").submit();
});
})';
$returnStr .= "</script>";
if (sizeof($users) > 0) {
$returnStr .= $this->displayDataTablesScripts(array("colvis", "rowreorder"));
$returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#usertable').dataTable(\n {\n \"iDisplayLength\": " . sizeof($users) . ",\n dom: 'C<\"clear\">lfrtip',\n paginate: false,\n colVis: {\n activate: \"mouseover\",\n exclude: [ 0 ]\n }\n } \n ); \n });</script>\n ";
//
$returnStr .= $this->displayPopoverScript();
$returnStr .= '<br/><br/><table id="usertable" class="table table-striped table-bordered pre-scrollable table-condensed table-hover">';
$returnStr .= '<thead><tr><th></td><th>' . Language::labelUserUserName() . '</th><th>' . Language::labelUserUserNameName() . '</th><th>' . Language::labelUserUserType() . '</th></tr></thead>';
$returnStr .= '<tbody>';
$usertypes = array(USER_INTERVIEWER => Language::labelInterviewer(), USER_NURSE => Language::labelNurse(), USER_SUPERVISOR => Language::labelSupervisor(), USER_TRANSLATOR => Language::labelTranslator(), USER_RESEARCHER => Language::labelResearcher(), USER_SYSADMIN => Language::labelSysadmin(), USER_TESTER => Language::labelTester());
foreach ($users as $user) {
$returnStr .= '<tr><td>';
$content = '<a id="' . $user->getUrid() . '_edit" title="' . Language::linkEditTooltip() . '" href="' . setSessionParams(array('page' => 'sysadmin.users.edituser', 'urid' => $user->getUrid())) . '"><span class="glyphicon glyphicon-edit"></span></a>';
$content .= ' <a id="' . $user->getUrid() . '_copy" title="' . Language::linkCopyTooltip() . '" href="' . setSessionParams(array('page' => 'sysadmin.users.copyuser', 'urid' => $user->getUrid())) . '" ' . confirmAction(language::messageCopyUser($user->getName()), 'COPY') . '><span class="glyphicon glyphicon-copyright-mark"></span></a>';
$content .= ' <a id="' . $user->getUrid() . '_remove" title="' . Language::linkRemoveTooltip() . '" href="' . setSessionParams(array('page' => 'sysadmin.users.removeuser', 'urid' => $user->getUrid())) . '" ' . confirmAction(language::messageRemoveUser($user->getName()), 'REMOVE') . '><span class="glyphicon glyphicon-remove"></span></a>';
$returnStr .= '<a rel="popover" id="' . $user->getUrid() . '_popover" data-placement="right" data-html="true" data-toggle="popover" data-trigger="hover" href="' . setSessionParams(array('page' => 'sysadmin.users.edituser', 'urid' => $user->getUrid())) . '"><span class="glyphicon glyphicon-hand-right"></span></a>';
$returnStr .= '<td>' . $user->getUsername() . '</td><td>' . $user->getName() . '</td>';
$returnStr .= '<td>' . $usertypes[$user->getUserType()] . '</td></tr>';
$returnStr .= $this->displayPopover("#" . $user->getUrid() . '_popover', $content);
}
$returnStr .= '</tbody>';
$returnStr .= '</table><br/><br/>';
} else {
$returnStr .= "<br/><br/>" . $this->displayWarning(Language::messageNoUsersYet());
}
return $returnStr;
}
示例4: generateCases
function generateCases()
{
$suid = loadvar("suid");
if ($suid == "") {
$suid = 1;
}
$seid = loadvar("seid");
if ($seid == "") {
$seid = 1;
}
$version = 1;
setSurvey($suid);
setSurveyLanguage(loadvar(POST_PARAM_LANGUAGE), true);
setSurveyMode(loadvar(POST_PARAM_MODE), true);
setSurveyVersion($version);
/* generate cases */
$number = loadvar("number");
for ($i = 0; $i < $number; $i++) {
//set_time_limit(0);
$primkey = generateRandomPrimkey();
$this->generateCase($suid, $primkey, session_id(), $version, $seid);
//exit;
}
}
示例5: foreach
foreach ($mods as $m) {
$user->setLanguages($this->addtosuid, $m, $survey->getAllowedLanguages($m));
}
$user->saveChanges();
// return result
return "";
}
function importMMIC()
{
set_time_limit(0);
$this->importdb = new Database();
$server = loadvar(SETTING_IMPORT_SERVER);
if ($server == "") {
$server = "localhost";
}
if ($this->importdb->connect($server, loadvar(SETTING_IMPORT_DATABASE), loadvar(SETTING_IMPORT_USER), loadvar(SETTING_IMPORT_PASSWORD)) == false) {
$display = new Display();
return $display->displayError(Language::messageToolsImportDbFailure());
}
$this->sourcetable = loadvar(SETTING_IMPORT_TABLE);
// add
if (loadvar(SETTING_IMPORT_AS) == IMPORT_TARGET_ADD) {
$surveys = new Surveys();
$this->addtosuid = $surveys->getMaximumSuid();
} else {
if (loadvar(SETTING_IMPORT_AS) == IMPORT_TARGET_REPLACE) {
$this->addtosuid = 0;
/* delete existing content */
$tables = Common::surveyTables();
foreach ($tables as $table) {
$query = "delete from " . Config::dbSurvey() . $table;
$this->db->executeQuery($query);
}
/* delete existing data */
$tables = Common::surveyDataTables();
foreach ($tables as $table) {
if ($table == "_actions") {
$query = "delete from " . Config::dbSurvey() . $table . " where suid != ''";
} else {
$query = "delete from " . Config::dbSurvey() . $table;
}
$this->db->executeQuery($query);
}
/* delete test data */
$tables = Common::surveyTestDataTables();
foreach ($tables as $table) {
if ($table == "_actions") {
$query = "delete from " . Config::dbSurvey() . $table . " where suid != ''";
} else {
$query = "delete from " . Config::dbSurvey() . $table;
}
$this->db->executeQuery($query);
}
示例6: getSMSLanguage
}
/* survey entry */
if ($_SESSION['SYSTEM_ENTRY'] != USCIC_SMS) {
$_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_SURVEY_RETRIEVAL;
$engine = null;
// global $engine object
} else {
$_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_ADMIN_RETRIEVAL;
$l = getSMSLanguage();
if (file_exists("language/language" . getSMSLanguagePostFix($l) . ".php")) {
require_once 'language_' . getSMSLanguagePostFix($l) . '.php';
} else {
require_once 'language_en.php';
// fall back on english language file
}
}
if (loadvar(POST_PARAM_SMS_AJAX) == SMS_AJAX_CALL) {
// sms ajax call
require_once 'smsajax.php';
$ajax = new SmsAjax();
echo $ajax->getPage(loadvar('p'));
} else {
// handle action
$action = new Action($sesid);
echo $action->getAction();
// clear session locking (if not already done by earlier script exit)
doExit();
}
?>
示例7: showSearchRes
function showSearchRes()
{
if (dbConfig::defaultPanel() == PANEL_HOUSEHOLD) {
//show household level
$households = new Households();
$households = $households->getHouseholdsByUserSearch($this->user, loadvar('searchterm'));
$displaySupervisor = new DisplaySupervisor();
return $displaySupervisor->showSearchRes($households);
} else {
$respondents = new Respondents();
$respondents = $respondents->getRespondentsByUserSearch($this->user, loadvar('searchterm'));
$displaySupervisor = new DisplaySupervisor();
return $displaySupervisor->showSearchRes($respondents);
}
}
示例8: showLoginDirect
public function showLoginDirect($primkey, $message)
{
global $survey, $engine;
require_once "display/templates/displayquestion_" . $survey->getTemplate() . ".php";
$returnStr = $this->showHeader($survey->getTitle(), '<link href="bootstrap/css/sticky-footer-navbar.min.css" rel="stylesheet">');
if (true) {
if ($primkey != '') {
$returnStr .= '<form method="post" id="startform">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_PRIMKEY . '" value="' . decryptC($primkey, Config::directLoginKey()) . '">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_SUID . '" value="' . $survey->getSuid() . '">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_LANGUAGE . '" value="' . loadvar(POST_PARAM_LANGUAGE) . '">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_PRELOAD . '" value="' . loadvar(POST_PARAM_PRELOAD) . '">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_MODE . '" value="' . loadvar(POST_PARAM_MODE) . '">';
$returnStr .= '<input type=hidden name="' . POST_PARAM_URID . '" value="' . loadvar(POST_PARAM_URID) . '">';
if (loadvar(POST_PARAM_URID) != '') {
$_SESSION['URID'] = loadvar(POST_PARAM_URID);
}
$returnStr .= '<div style="display: none;"><input type=submit></div>';
$returnStr .= '</form>';
$returnStr .= '<script>';
$returnStr .= '$(document).ready(function(){ $("#startform").submit(); }); ';
$returnStr .= '</script>';
} else {
$returnStr .= '<div id="wrap">';
$returnStr .= '<div class="container"><p>';
$engine = loadEngine($survey->getSuid(), $primkey, '', getSurveyVersion(), getBaseSectionSeid($survey->getSuid()));
$do = $engine->getDisplayObject();
$returnStr .= $do->showDirectAccessOnlySurvey();
//$returnStr .= Language::errorDirectLogin();
}
} else {
$returnStr .= '<div id="wrap">';
$returnStr .= '<div class="container"><p>';
//$returnStr .= Language::errorDirectLogin();
$engine = loadEngine($survey->getSuid(), $primkey, '', getSurveyVersion(), getBaseSectionSeid($survey->getSuid()));
$do = $engine->getDisplayObject();
$returnStr .= $do->showDirectAccessOnlySurvey();
}
/* footer */
$returnStr .= $this->showFooter();
return $returnStr;
}
示例9: jumpRes
function jumpRes()
{
global $db;
$suid = getFromSessionParams('jumpsuid');
$prim = getFromSessionParams('jumpprimkey');
$jumpto = loadvar("jumpto");
//echo $suid . '----' . $prim . '----' . $jumpto;
$query = "delete from " . Config::dbSurveyData() . "_states where suid=" . $suid . " and primkey='" . $prim . "' and stateid > " . $jumpto;
$db->executeQuery($query);
$returnStr = "<html><head></head><body>";
$returnStr .= "<script type='text/javascript'>\n window.opener.location.reload();\n window.close();\n</script>";
$returnStr .= '</body></html';
//container and wrap
echo $returnStr;
}
示例10: captureScreenshot
function captureScreenshot()
{
global $db;
$l = $this->getParam(POST_PARAM_LANGUAGE);
$m = $this->getParam(POST_PARAM_MODE);
$v = $this->getParam(POST_PARAM_VERSION);
$result = urldecode(loadvar(POST_PARAM_SCREENSHOT));
$stateid = $this->getParam(POST_PARAM_STATEID);
$primkey = $this->getParam(POST_PARAM_PRIMKEY);
$suid = $this->getParam(POST_PARAM_SUID);
$screen = gzcompress($result, 9);
if ($stateid == "") {
$stateid = 1;
}
$bp = new BindParam();
$scid = null;
$bp->add(MYSQL_BINDING_INTEGER, $scid);
$bp->add(MYSQL_BINDING_INTEGER, $suid);
$bp->add(MYSQL_BINDING_STRING, $primkey);
$bp->add(MYSQL_BINDING_INTEGER, $stateid);
$bp->add(MYSQL_BINDING_STRING, $screen);
$bp->add(MYSQL_BINDING_INTEGER, $m);
$bp->add(MYSQL_BINDING_INTEGER, $l);
$bp->add(MYSQL_BINDING_INTEGER, $v);
$key = $this->survey->getDataEncryptionKeyDirectly($m, $l, $this->getParam(POST_PARAM_DEFAULT_MODE), $this->getParam(POST_PARAM_DEFAULT_LANGUAGE));
if ($key == "") {
$query = "insert into " . Config::dbSurveyData() . "_screendumps(scdid, suid, primkey, stateid, screen, mode, language, version) values (?,?,?,?,?,?,?,?)";
} else {
$query = "insert into " . Config::dbSurveyData() . "_screendumps(scdid, suid, primkey, stateid, screen, mode, language, version) values (?,?,?,?,aes_encrypt(?, '" . $key . "'),?,?,?)";
}
//echo $query;
//print_r($bp->get());
$db->executeBoundQuery($query, $bp->get());
exit;
}
示例11: SMSEntry
function SMSEntry()
{
// check for return from tester, in which case we need to switch back to normal mode to look in the correct actions table
if (isset($_SESSION[SURVEY_EXECUTION_MODE]) && $_SESSION[SURVEY_EXECUTION_MODE] == SURVEY_EXECUTION_MODE_TEST) {
$_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL;
}
$logactions = new LogActions();
$nosessionactions = $logactions->getNumberOfActionsBySession($this->phpid, USCIC_SMS);
//echo 'ytytytyt';
//echo ' [[[[' . $this->phpid;
if ($nosessionactions == 0) {
//no entry yet: ask for prim_key!
$logactions->addAction('', '', "loginstart", USCIC_SMS);
$login = new Login($this->phpid);
return $login->getSMSLoginScreen();
} else {
//echo ']]]]]';
$loggedin = $logactions->getLoggedInSMSSession($this->phpid);
if ($loggedin["count"] == 0) {
//no prim_key (=username in sms) assigned to this sessionid. Assign if given (and check for pwd etc??)!
$username = loadvar('username');
$_SESSION['username'] = $username;
if ($username != '' && loadvar('password') != '') {
//check username!!
$login = new Login($this->phpid);
if ($login->checkSMSAccess()) {
$urid = $_SESSION['URID'];
$logactions->addAction('', $urid, "loggedin", USCIC_SMS);
$sms = new SMS($urid, $this->phpid);
return $sms->getPage();
} else {
// incorrect login..start new session
endSession();
session_start();
session_regenerate_id(true);
$logactions->addAction('', '', "loginempty", USCIC_SMS);
$login = new Login(session_id());
return $login->getSMSLoginScreen(Language::messageCheckUsernamePassword());
}
} else {
$logactions->addAction('', '', "loginempty", USCIC_SMS);
$login = new Login($this->phpid);
return $login->getSMSLoginScreen(Language::messageEnterUsernamePassword());
}
} else {
//continue with the sms! EXTRA CHECK!!!!
$_SESSION['URID'] = $loggedin["urid"];
if (isset($_SESSION['URID'])) {
$sms = new SMS($_SESSION['URID'], $this->phpid);
return $sms->getPage();
} else {
//something went wrong.. no urid..start new session
//echo 'ohno';
endSession();
session_start();
session_regenerate_id(true);
$logactions->addAction('', '', "loginempty", USCIC_SMS);
$login = new Login(session_id());
return $login->getSMSLoginScreen(Language::messageCheckUsernamePassword());
}
}
}
}
示例12: error_reporting
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------
*/
error_reporting(E_ALL);
ini_set("display_errors", 1);
set_include_path(dirname(getcwd()));
require_once 'constants.php';
require_once 'functions.php';
require_once 'dbConfig.php';
require_once 'config.php';
require_once 'database.php';
require_once 'communication.php';
date_default_timezone_set(Config::timezone());
$p = loadvar('p');
$urid = loadvar('urid');
$db = new Database();
$communication = new Communication();
$returnValue = 'error';
if ($p == 'upload') {
//upload data!
$communication->storeUpload($_POST['query'], $urid);
$communication->importTable($_POST['query']);
$returnValue = 'ok';
} elseif ($p == 'updateavailable') {
//is there an update available?
$returnValue = 'no';
if (sizeof($communication->getUserQueries($urid)) > 0) {
$returnValue = 'yes';
}
if (sizeof($communication->getUserScripts($urid)) > 0) {
示例13: getSurveyTemplate
*/
require_once "../constants.php";
require_once "../functions.php";
require_once "../dbConfig.php";
$_SESSION['SYSTEM_ENTRY'] = USCIC_SMS;
$loaded = dbConfig::load("../conf.php");
require_once "../config.php";
require_once "../globals.php";
require_once "../user.php";
require_once 'reportissue.php';
require_once 'watchwindow.php';
require_once 'jumpback.php';
require_once 'updater.php';
require_once "../display/templates/displayquestion_" . getSurveyTemplate() . ".php";
if (loadvar('r') != '') {
getSessionParamsPost(loadvar('r'));
}
// include language
$l = getSMSLanguage();
if (file_exists("language/language" . getSMSLanguagePostFix($l) . ".php")) {
require_once 'language_' . getSMSLanguagePostFix($l) . '.php';
} else {
require_once 'language_en.php';
// fall back on english language file
}
$_SESSION['SYSTEM_ENTRY'] = USCIC_SURVEY;
// switch back to survey
$page = getFromSessionParams('testpage');
if (getFromSessionParams('type') != "2") {
$_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_TEST;
}
示例14: showSetupRes
function showSetupRes()
{
/* write conf.php file */
if (is_writable('conf.php') == false) {
$message = '<div class="alert alert-danger">' . Language::installWarning() . '</div>';
return $this->getContent("setup", $message);
} else {
// TODO: FINISH ADDING POST SETTINGS TO THE CONFIG, ADD SAMPLE SETTINGS AND ANYTHING ELSE MISSING FROM THE SETUP WIZARD
/* test db */
$db = new Database();
if ($db->connect(loadvar("databaseserver"), loadvar("databasename"), loadvar("databaseuser"), loadvar("databasepassword")) == false) {
//no connection with DB.. Errormessage!
$message = '<div class="alert alert-danger">' . Language::installWarningDatabase() . '</div>';
return $this->getContent("setup", $message);
} else {
$file = fopen("conf.php", "w");
$str = '<?php
$configuration = array(
CONFIGURATION_DATABASE => array(
CONFIGURATION_DATABASE_SERVER => "' . loadvar("databaseserver") . '",
CONFIGURATION_DATABASE_NAME => "' . loadvar("databasename") . '",
CONFIGURATION_DATABASE_TYPE => "1",
CONFIGURATION_DATABASE_USER => "' . loadvar("databaseuser") . '",
CONFIGURATION_DATABASE_PASSWORD => "' . loadvar("databasepassword") . '",
CONFIGURATION_DATABASE_SURVEY => "' . loadvar("databasetablename") . '"
),
CONFIGURATION_GENERAL => array(
CONFIGURATION_GENERAL_STARTUP => "1",
CONFIGURATION_GENERAL_DEVICE => "1"
),
CONFIGURATION_SAMPLE => array(
CONFIGURATION_SAMPLE_PANEL => "' . loadvar("sampletype") . '",
CONFIGURATION_SAMPLE_TRACKING => "' . loadvar("sampletracking") . '",
CONFIGURATION_SAMPLE_INTERVIEWADDRESS => "' . loadvar("sampleinterviewaddress") . '",
CONFIGURATION_SAMPLE_PROXYCODE => "' . loadvar("sampleproxycode") . '",
CONFIGURATION_SAMPLE_PROXYCONTACT => "' . loadvar("sampleproxycontact") . '",
CONFIGURATION_SAMPLE_COMMUNICATION => "' . loadvar("samplecommunication") . '",
CONFIGURATION_SAMPLE_FILELOCATION => "' . loadvar("samplefilelocation") . '"
),
CONFIGURATION_ENCRYPTION => array(
CONFIGURATION_ENCRYPTION_DATA => "' . loadvar("encryptiondata") . '",
CONFIGURATION_ENCRYPTION_LOGINCODES => "' . loadvar("encryptionlogincodes") . '",
CONFIGURATION_ENCRYPTION_ADMIN => "' . loadvar("encryptionadmin") . '",
CONFIGURATION_ENCRYPTION_PERSONAL => "' . loadvar("encryptionrespondent") . '",
CONFIGURATION_ENCRYPTION_REMARK => "' . loadvar("encryptionremarks") . '",
CONFIGURATION_ENCRYPTION_CONTACTREMARK => "' . loadvar("encryptioncontactremarks") . '",
CONFIGURATION_ENCRYPTION_CONTACTNAME => "' . loadvar("encryptioncontactnames") . '",
CONFIGURATION_ENCRYPTION_ACTION_PARAMS => "' . loadvar("encryptionparameters") . '",
CONFIGURATION_ENCRYPTION_DIRECT => "' . loadvar("encryptiondirect") . '",
CONFIGURATION_ENCRYPTION_LAB => "' . loadvar("encryptionlab") . '",
CONFIGURATION_ENCRYPTION_FILE => "' . loadvar("encryptionfile") . '"
),
CONFIGURATION_DATETIME => array(
CONFIGURATION_DATETIME_TIMEZONE => "' . loadvar("timezone") . '",
CONFIGURATION_DATETIME_USFORMAT_SMS => "' . loadvar('timeformatsms') . '",
CONFIGURATION_DATETIME_USFORMAT_SURVEY => "' . loadvar('timeformatsurvey') . '",
CONFIGURATION_DATETIME_MINUTES_SMS => "' . loadvar('timeminutessms') . '",
CONFIGURATION_DATETIME_MINUTES_SURVEY => "' . loadvar('timeminutessurvey') . '",
CONFIGURATION_DATETIME_SECONDS_SMS => "' . loadvar('timesecondssms') . '",
CONFIGURATION_DATETIME_SECONDS_SURVEY => "' . loadvar('timesecondssurvey') . '"
),
CONFIGURATION_LOGGING => array(
CONFIGURATION_LOGGING_TIMINGS => "' . loadvar('loggingtimings') . '",
CONFIGURATION_LOGGING_PARAMS => "' . loadvar('loggingactions') . '",
CONFIGURATION_LOGGING_ACTIONS => "' . loadvar('loggingactions') . '",
CONFIGURATION_LOGGING_PARADATA => "' . loadvar('loggingparadata') . '",
CONFIGURATION_LOGGING_TABSWITCH => "' . loadvar('loggingtabswitch') . '",
CONFIGURATION_LOGGING_MOUSE => "' . loadvar('loggingmouse') . '"
),
CONFIGURATION_SESSION => array(
CONFIGURATION_SESSION_WARN => "' . loadvar('sessionwarn') . '",
CONFIGURATION_SESSION_TIMEOUT => "' . loadvar('sessionduration') . '",
CONFIGURATION_SESSION_LOGOUT => "' . loadvar('sessionlogout') . '",
CONFIGURATION_SESSION_REDIRECT => "' . loadvar('sessionredirect') . '",
CONFIGURATION_SESSION_PING => "' . loadvar('sessionping') . '"
),
CONFIGURATION_PERFORMANCE => array(
CONFIGURATION_PERFORMANCE_DATA_FROM_STATE => "' . loadvar('performancestate') . '",
CONFIGURATION_PERFORMANCE_PREPARE_QUERIES => "' . loadvar('performancequeries') . '",
CONFIGURATION_PERFORMANCE_UNSERIALIZE => "' . loadvar('performanceserialize') . '",
CONFIGURATION_PERFORMANCE_USE_DATARECORDS => "' . loadvar('performancerecords') . '",
CONFIGURATION_PERFORMANCE_USE_DYNAMIC_MINIFY => "' . loadvar('performanceminify') . '",
CONFIGURATION_PERFORMANCE_USE_LOCKING => "' . loadvar('performancelocking') . '",
CONFIGURATION_PERFORMANCE_USE_TRANSACTIONS => "' . loadvar('performancetransaction') . '"
)
);
?>';
fwrite($file, $str);
fclose($file);
// create tables
$fr = file_get_contents(dirname(__FILE__) . "/admin/sql/createtables.sql");
$str = str_replace("survey1", loadvar("databasetablename"), $fr);
$db->executeQueries($str);
$query = "REPLACE INTO `" . loadvar("databasetablename") . "_users` (`urid`, `status`, `name`, `username`, `password`, `usertype`, usersubtype, `sup`, `filter`, `regionfilter`, `testmode`, `communication`, `settings`, `access`, `lastdata`, `ts`) VALUES\n (1, 1, 'Sysadmin', 'sysadmin', aes_encrypt('sysadmin','" . loadvar("encryptionadmin") . "'), 4, 1, NULL, 1, 0, 0, 2, 0x613a313a7b733a31303a226e6176696e6272656164223b733a313a2231223b7d, NULL, NULL, '2014-04-12 00:20:49');";
$db->executeQuery($query);
//echo $query;
return $this->getContent("finish");
}
}
//.........这里部分代码省略.........
示例15: json_decode
$grid = "[]";
}
$gridentries = json_decode($grid);
$currentnumber = $engine->getAnswer("hhmembernumber");
for ($i = 1; $i <= $currentnumber; $i++) {
$entry = $gridentries[$i - 1];
// start at 0!
$engine->setAnswer("hhmemberchanged[" . $i . ']', $entry->hhmemberchanged);
}
}
function processGridAdditions()
{
global $engine;
$grid = $engine->getAnswer("hhgrid_new");
if ($grid == "") {
$grid = "[]";
}
$gridentries = json_decode($grid);
$existingnumber = $engine->getAnswer("hhmembernumber");
$newnumber = $engine->getAnswer("newhhmembernumber");
// first time OR more members now
if (inArray($newnumber, array(null, "")) || $newnumber < sizeof($gridentries)) {
$newnumber = sizeof($gridentries);
}
$data = array();
for ($u = 1; $u < 15; $u++) {
if (isset($_POST["hhGrid_hhmemberfirstname_" . $u])) {
$arr = array();
$arr[] = $_POST["hhGrid_hhmemberfirstname_" . $u];
//$arr[] = $_POST["hhGrid_hhmemberlastname_" . $u];
$arr[] = $_POST["hhGrid_hhmembergender_" . $u];
$arr[] = $_POST["hhGrid_hhmemberbirthmonth_" . $u];
//$arr[] = $_POST["hhGrid_hhmemberbirthday_" . $u];
$arr[] = $_POST["hhGrid_hhmemberbirthyear_" . $u];
$arr[] = $_POST["hhGrid_hhmemberrelationship_" . $u];
$data[] = implode(",", $arr);
}
}
$engine->setAnswer("newgriddata", implode("~", $data));
//echo implode("~",$data);
// update new hhmember number
$engine->setAnswer("newgridfilled", loadvar("newgridfilled"));
// update new hhmember number
$engine->setAnswer("newhhmembernumber", sizeof($gridentries));
// update fields --> seems to work, but not showing yet --> array update perhaps!
for ($i = 1; $i <= $newnumber; $i++) {
$storeindex = $existingnumber + $i;
// we lost entries, and so we need to clear the other ones we had
if ($i > sizeof($gridentries)) {
$engine->setAnswer("hhmemberfirstname[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberlastname[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberage[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberdateofbirth_day[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberdateofbirth_month[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberdateofbirth_year[" . $storeindex . ']', null);
$engine->setAnswer("hhmembergender[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberrelationship[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberrelationship_other[" . $storeindex . ']', null);
$engine->setAnswer("hhmemberactive[" . $storeindex . ']', null);
} else {
$entry = $gridentries[$i - 1];
// start at 0!
//print_r($entry);
$engine->setAnswer("hhmemberfirstname[" . $storeindex . ']', $entry->hhmemberfirstname);
$engine->setAnswer("hhmemberlastname[" . $storeindex . ']', $entry->hhmemberlastname);
$engine->setAnswer("hhmemberdateofbirth_day[" . $storeindex . ']', $entry->hhmemberbirthday);
$engine->setAnswer("hhmemberdateofbirth_month[" . $storeindex . ']', $entry->hhmemberbirthmonth);
$engine->setAnswer("hhmemberdateofbirth_year[" . $storeindex . ']', $entry->hhmemberbirthyear);
$age = floor((strtotime(date('Y-m-d')) - strtotime($entry->hhmemberbirthyear . '-' . $entry->hhmemberbirthmonth . '-' . $entry->hhmemberbirthday)) / 31556926);