コード例 #1
0
ファイル: flooder.php プロジェクト: nubissurveying/nubis
 function generateCase($suid, $primkey, $sesid, $version, $seid)
 {
     $_SESSION['SYSTEM_ENTRY'] = USCIC_SURVEY;
     $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_SURVEY_RETRIEVAL;
     global $engine;
     $engine = loadEngine($suid, $primkey, $sesid, $version, $seid);
     $engine->setFlooding(true);
     $engine->getNextQuestion();
     //echo'done';
     // clean up
     setSessionParameter(SESSION_PARAM_RGID, null);
     setSessionParameter(SESSION_PARAM_GROUP, null);
     $_POST = array();
     $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_ADMIN_RETRIEVAL;
     $_SESSION['SYSTEM_ENTRY'] = USCIC_SMS;
     return;
 }
コード例 #2
0
ファイル: basicengine.php プロジェクト: nubissurveying/nubis
 function doEnd($savestate = false)
 {
     /* if already state of other sections before this one, then this is not the first section 
      * if it is, then do the end part
      */
     if ($this->isMainSection() == true) {
         $this->endofsurvey = true;
         $this->setAnswer(VARIABLE_END, date("Y-m-d H:i:s", time()));
         /* check if we need to reset non-keep variable answers */
         if ($this->survey->getDataKeepOnly() == DATA_KEEP_ONLY_YES) {
             $vars = $this->state->getVariableNames();
             $this->currentaction = ACTION_SURVEY_END;
             foreach ($vars as $var) {
                 //echo "<br>CHECK: " . $var;
                 $vd = $this->getVariableDescriptive(getBasicName($var));
                 if ($vd->getDataKeep() == DATA_KEEP_NO) {
                     //echo 'everybody do their share';
                     $this->setAnswer($var, null);
                 }
             }
         }
         doCommit();
         /* save data record */
         $this->getDataRecord()->saveRecord();
         /* $savestate == true if we are reaching doEnd by going next on a last action in the base module 
          * and there are no more actions left in the _next table.
          */
         if ($savestate == true) {
             $this->saveState(false);
         } else {
             /* get any last things we did from the current state */
             $assign = $this->state->getAssignments();
             $data = $this->state->getAllData();
             /* load the last state we had, update it with any actions we did and save it */
             if ($this->loadLastState()) {
                 $this->state->setAllData($data);
                 $this->state->setAssignments($assign);
                 $this->saveState(false);
             }
         }
         /* set interview data as completed */
         $this->getDataRecord()->setToComplete();
         /* unlock */
         $this->unlock();
         if ($this->getFlooding()) {
             $this->stop = true;
             return;
         }
         /* show end and exit */
         echo $this->display->showEndSurvey();
         doExit();
     } else {
         /* get current state */
         $seid = $this->getParentSeid();
         $mainseid = $this->getMainSeid();
         $assign = $this->state->getAssignments();
         $data = $this->state->getAllData();
         $prefix = "";
         $this->getDataRecord()->saveRecord();
         $this->datarecord = null;
         unset($this->datarecord);
         $this->clearContext();
         /* get engine */
         global $engine;
         $engine = loadEngine($this->getSuid(), $this->primkey, $this->phpid, $this->version, $seid, false, true);
         /* transfer current state with updated details for section we are going back to */
         $engine->setState($this->state);
         $engine->setSeid($seid);
         $engine->setMainSeid($mainseid);
         $engine->setPrefix($this->getParentPrefix());
         $engine->setForward($this->getForward());
         $engine->setFlooding($this->getFlooding());
         /* go into parent section again */
         $engine->endSection();
         if ($this->getFlooding()) {
             $this->stop = true;
             return;
         }
         doExit();
     }
 }
コード例 #3
0
ファイル: displaylogin.php プロジェクト: nubissurveying/nubis
 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;
 }
コード例 #4
0
ファイル: action.php プロジェクト: nubissurveying/nubis
 function surveyEntry()
 {
     global $engine;
     if ($this->checkDateTime() == false) {
         /* get whatever the language is (either post or default) and use it */
         $l = getSurveyLanguage();
         if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
             require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
             // language
         } else {
             require_once 'language_en.php';
             // fall back on english language file
         }
         $login = new Login(session_id());
         return $login->getClosedScreen();
     }
     $logactions = new LogActions();
     $nosessionactions = $logactions->getNumberOfSurveyActionsBySession($this->phpid, USCIC_SURVEY);
     /* no entry yet, then ask for prim_key in login screen */
     if ($nosessionactions == 0 || loadvarSurvey(POST_PARAM_NEW_PRIMKEY) == '1') {
         //no entry yet: ask for prim_key!
         if (loadvarSurvey(POST_PARAM_NEW_PRIMKEY) == '1') {
             $logactions->deleteLoggedInSurveySession($this->phpid);
         }
         /* get whatever the language is (either post or default) and use it */
         $l = getSurveyLanguage();
         if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
             require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
             // language
         } else {
             require_once 'language_en.php';
             // fall back on english language file
         }
         $logactions->addAction('', '', "loginstart", USCIC_SURVEY, 1);
         $login = new Login($this->phpid);
         return $login->getLoginScreen();
     } else {
         //entry: is this person logged in?
         $loggedin = $logactions->getLoggedInSurveySession($this->phpid);
         // gets the last logged in action
         /* no prim_key assigned to this sessionid. Assign if given (and check for pwd etc??)! */
         if ($loggedin["count"] == 0) {
             /* we don't have active session, so take the template we can get */
             global $survey;
             require_once "display/templates/displayquestion_" . getSurveyTemplate() . ".php";
             // we don't have an active session, so fall back to whatever was passed along as language in post OR is the default language
             $l = getSurveyLanguage();
             if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
                 //echo 'well done';
                 require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
                 // language
             } else {
                 require_once 'language_en.php';
                 // fall back on english language file
             }
             $primkey = loadvarSurvey(POST_PARAM_PRIMKEY);
             $_SESSION['PRIMKEY'] = $primkey;
             if ($primkey != '' && strlen($primkey) < 20) {
                 // make sure primkey is not encrypted!
                 //check!!!!!!
                 $login = new Login($this->phpid);
                 if ($login->checkAccess()) {
                     $primkey = $_SESSION['PRIMKEY'];
                     $logactions->addAction($primkey, '', "loggedin", USCIC_SURVEY, 1);
                     // pass along primkey to load correct engine!
                     $engine = loadEngine(getSurvey(), $primkey, $this->phpid, getSurveyVersion(), getSurveySection(getSurvey(), $primkey));
                     $engine->setFirstForm(true);
                     return $engine->getNextQuestion();
                 } else {
                     // incorrect login..start new session
                     endSession();
                     session_start();
                     session_regenerate_id(true);
                     $logactions->addAction('', '', "loginempty", USCIC_SURVEY, 1);
                     $login = new Login(session_id());
                     global $survey;
                     return $login->getLoginScreen($survey->getLoginError());
                 }
             } else {
                 $logactions->addAction('', '', "loginempty", USCIC_SURVEY, 1);
                 $login = new Login($this->phpid);
                 global $survey;
                 if ($survey->getAccessType() == LOGIN_ANONYMOUS) {
                     return $login->getLoginScreen(Language::messageEnterPrimKey());
                 } else {
                     if ($survey->getAccessType() == LOGIN_LOGINCODE) {
                         return $login->getLoginScreen($survey->getLoginError());
                     } else {
                         return $login->getLoginScreen(Language::messageEnterPrimKeyDirectAccess());
                     }
                 }
             }
         } else {
             //continue interview! EXTRA CHECK!!!
             /* update survey info with what we know from the last session action */
             setSurvey($loggedin["suid"]);
             /* include survey template now that we know which survey we are in */
             global $survey;
             require_once "display/templates/displayquestion_" . getSurveyTemplate() . ".php";
             /* update interview mode with what we know from the last session action
              * IF we are not changing the interview mode right now
              */
             if (isset($_POST['navigation']) && $_POST['navigation'] != NAVIGATION_MODE_CHANGE && $survey->getReentryMode() == MODE_REENTRY_YES) {
                 setSurveyMode($loggedin["mode"]);
             }
             /* update language with what we know from the last session action 
              * IF we are not changing the language right now
              */
             if (isset($_POST['navigation']) && $_POST['navigation'] != NAVIGATION_LANGUAGE_CHANGE && $survey->getReentryLanguage(getSurveyMode()) == LANGUAGE_REENTRY_YES) {
                 setSurveyLanguage($loggedin["language"]);
             }
             /* update version with what we know from the last session action */
             setSurveyVersion($loggedin["version"]);
             // include language file
             $l = getSurveyLanguage();
             //echo 'NOW: ' . $l;
             if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
                 //echo 'well done';
                 require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
                 // language
             } else {
                 require_once 'language_en.php';
                 // fall back on english language file
             }
             // pass along primkey to load correct engine!
             $engine = loadEngine(getSurvey(), $loggedin["primkey"], $this->phpid, getSurveyVersion(), getSurveySection(getSurvey(), $loggedin["primkey"]));
             /* handle button click */
             return $engine->getNextQuestion();
         }
     }
 }
コード例 #5
0
ファイル: updater.php プロジェクト: nubissurveying/nubis
 function __construct()
 {
     $primkey = getFromSessionParams('watchprimkey');
     $seid = getSurveySection(getFromSessionParams('watchsuid'), $primkey);
     $this->engine = loadEngine(getFromSessionParams('watchsuid'), $primkey, "", getSurveyVersion(), $seid);
 }