diff --git a/DEembedq.php b/DEembedq.php index 6d5e5a2071..6e88f354ce 100644 --- a/DEembedq.php +++ b/DEembedq.php @@ -16,9 +16,9 @@ require("./assessment/displayq2.php"); $GLOBALS['assessver'] = 1; -$sessiondata = array(); -$sessiondata['graphdisp'] = 1; -$sessiondata['mathdisp'] = 3; +$_SESSION = array(); +$_SESSION['graphdisp'] = 1; +$_SESSION['mathdisp'] = 3; $showtips = 2; $useeqnhelper = 4; $courseUIver = 1; @@ -35,7 +35,7 @@ } $qsetid=intval($_GET['id']); -$sessiondata['coursetheme'] = $coursetheme; +$_SESSION['coursetheme'] = $coursetheme; $page_formAction = "DEembedq.php?id=$qsetid"; diff --git a/OEAembedq.php b/OEAembedq.php index 8831922fbd..e3fab6ecb1 100644 --- a/OEAembedq.php +++ b/OEAembedq.php @@ -16,7 +16,7 @@ require("./assessment/displayq2.php"); $GLOBALS['assessver'] = 2; -$sessiondata = array(); +$_SESSION = array(); $prefdefaults = array( 'mathdisp'=>6, @@ -26,27 +26,27 @@ 'livepreview'=>1); $prefcookie = json_decode($_COOKIE["OEAembeduserprefs"], true); -$sessiondata['userprefs'] = array(); +$_SESSION['userprefs'] = array(); foreach($prefdefaults as $key=>$def) { if ($prefcookie!==null && isset($prefcookie[$key])) { - $sessiondata['userprefs'][$key] = filter_var($prefcookie[$key], FILTER_SANITIZE_NUMBER_INT); + $_SESSION['userprefs'][$key] = filter_var($prefcookie[$key], FILTER_SANITIZE_NUMBER_INT); } else { - $sessiondata['userprefs'][$key] = $def; + $_SESSION['userprefs'][$key] = $def; } } if (isset($_GET['graphdisp'])) { //currently same is used for graphdisp and drawentry - $sessiondata['userprefs']['graphdisp'] = filter_var($_GET['graphdisp'], FILTER_SANITIZE_NUMBER_INT); - $sessiondata['userprefs']['drawentry'] = filter_var($_GET['graphdisp'], FILTER_SANITIZE_NUMBER_INT); + $_SESSION['userprefs']['graphdisp'] = filter_var($_GET['graphdisp'], FILTER_SANITIZE_NUMBER_INT); + $_SESSION['userprefs']['drawentry'] = filter_var($_GET['graphdisp'], FILTER_SANITIZE_NUMBER_INT); setcookie("OEAembeduserprefs", json_encode(array( - 'graphdisp'=>$sessiondata['userprefs']['graphdisp'], - 'drawentry'=>$sessiondata['userprefs']['drawentry'] + 'graphdisp'=>$_SESSION['userprefs']['graphdisp'], + 'drawentry'=>$_SESSION['userprefs']['drawentry'] )),0,'','',false,true); } foreach(array('graphdisp','mathdisp','useed') as $key) { - $sessiondata[$key] = $sessiondata['userprefs'][$key]; + $_SESSION[$key] = $_SESSION['userprefs'][$key]; } -$sessiondata['secsalt'] = "12345"; +$_SESSION['secsalt'] = "12345"; $cid = "embedq"; $showtips = 2; $useeqnhelper = 4; @@ -94,7 +94,7 @@ if (isset($_REQUEST['theme'])) { $theme = preg_replace('/\W/','',$_REQUEST['theme']); $page_formAction .= '&theme='.$theme; - $sessiondata['coursetheme'] = $theme.'.css'; + $_SESSION['coursetheme'] = $theme.'.css'; } @@ -129,7 +129,7 @@ function sendresizemsg() { }); } '; -if ($sessiondata['mathdisp']==1 || $sessiondata['mathdisp']==3) { +if ($_SESSION['mathdisp']==1 || $_SESSION['mathdisp']==3) { //in case MathJax isn't loaded yet $placeinhead .= '"; } if ($revertgraphdisp) { - $GLOBALS['sessiondata']['graphdisp']=0; + $_SESSION['graphdisp']=0; } $tip = _('Enter your answer by drawing on the graph.'); if (isset($answers)) { @@ -3440,8 +3440,8 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') { $out .= getcolormark($colorbox); if ($colorbox!='') { $out .= '';} if ($la!='') { - if (isset($GLOBALS['testsettings']) && isset($GLOBALS['sessiondata']['groupid']) && $GLOBALS['testsettings']>0 && $GLOBALS['sessiondata']['groupid']>0) { - $s3asid = 'grp'.$GLOBALS['sessiondata']['groupid'].'/'.$GLOBALS['testsettings']['id']; + if (isset($GLOBALS['testsettings']) && isset($_SESSION['groupid']) && $GLOBALS['testsettings']>0 && $_SESSION['groupid']>0) { + $s3asid = 'grp'.$_SESSION['groupid'].'/'.$GLOBALS['testsettings']['id']; } else if (isset($GLOBALS['asid'])) { $s3asid = $GLOBALS['asid']; } diff --git a/assessment/header.php b/assessment/header.php index 2b3eeec9be..6f2a4fd98b 100644 --- a/assessment/header.php +++ b/assessment/header.php @@ -62,13 +62,13 @@ function getlastanswer(qn, part) { } if (isset($coursetheme)) { - $sessiondata['coursetheme'] = $coursetheme; + $_SESSION['coursetheme'] = $coursetheme; } -if (isset($sessiondata['coursetheme'])) { +if (isset($_SESSION['coursetheme'])) { if (isset($flexwidth) || isset($usefullwidth)) { - $coursetheme = str_replace(array('_fw1920','_fw1000','_fw'),'',$sessiondata['coursetheme']); + $coursetheme = str_replace(array('_fw1920','_fw1000','_fw'),'',$_SESSION['coursetheme']); } else { - $coursetheme = $sessiondata['coursetheme']; + $coursetheme = $_SESSION['coursetheme']; $isfw = false; if (strpos($coursetheme,'_fw1920')!==false) { $isfw = 1920; @@ -109,7 +109,7 @@ function getlastanswer(qn, part) { */ -if (isset($sessiondata['ltiitemtype']) && ($sessiondata['mathdisp']==1 || $sessiondata['mathdisp']==3)) { +if (isset($_SESSION['ltiitemtype']) && ($_SESSION['mathdisp']==1 || $_SESSION['mathdisp']==3)) { echo ''; } -//$sessiondata['mathdisp'] = 3; -if (!isset($sessiondata['mathdisp'])) { +//$_SESSION['mathdisp'] = 3; +if (!isset($_SESSION['mathdisp'])) { echo ''; //echo ''; if (!empty($CFG['GEN']['uselocaljs'])) { @@ -127,7 +127,7 @@ function getlastanswer(qn, part) { echo ''; } echo "\n"; -} else if ($sessiondata['mathdisp']==1 || $sessiondata['mathdisp']==3) { +} else if ($_SESSION['mathdisp']==1 || $_SESSION['mathdisp']==3) { echo ''; echo "\n"; echo ''; echo ''; -} else if ($sessiondata['mathdisp']==6) { +} else if ($_SESSION['mathdisp']==6) { //Katex experimental echo ''; echo "\n"; @@ -175,14 +175,14 @@ function setupKatexAutoRenderWhenReady() { '; echo ''; //echo ''; -} else if ($sessiondata['mathdisp']==2) { +} else if ($_SESSION['mathdisp']==2) { echo ''; echo "\n"; echo ""; -} else if ($sessiondata['mathdisp']==0) { +} else if ($_SESSION['mathdisp']==0) { echo ''; } -if ($sessiondata['graphdisp']==1) { +if ($_SESSION['graphdisp']==1) { echo "\n"; echo ""; } else { @@ -211,7 +211,7 @@ function setupKatexAutoRenderWhenReady() { imasroot = '$imasroot';"; -if (isset($useeditor) && $sessiondata['useed']==1) { +if (isset($useeditor) && $_SESSION['useed']==1) { echo ''; //echo ''; echo "\n"; @@ -229,7 +229,7 @@ function setupKatexAutoRenderWhenReady() { } else { echo ''; } -if ((isset($useeditor) && $sessiondata['useed']==1) || isset($loadiconfont)) { +if ((isset($useeditor) && $_SESSION['useed']==1) || isset($loadiconfont)) { echo ''; echo ''; } @@ -264,7 +264,7 @@ function setupKatexAutoRenderWhenReady() { if (isset($CFG['GEN']['translatewidgetID'])) { echo ''; } -if (isset($sessiondata['ltiitemtype'])) { +if (isset($_SESSION['ltiitemtype'])) { echo ''; } - $sessiondata['coursetheme'] = $coursetheme; + $_SESSION['coursetheme'] = $coursetheme; require("header.php"); echo "\n"; echo "\n"; @@ -59,7 +59,7 @@ function toggleqs() { if ($isteacher && isset($_GET['asid'])) { $testid = Sanitize::onlyInt($_GET['asid']); } else { - $testid = $sessiondata['sessiontestid']; + $testid = $_SESSION['sessiontestid']; } $stm = $DBH->prepare("SELECT * FROM imas_assessment_sessions WHERE id=:id"); $stm->execute(array(':id'=>$testid)); diff --git a/assessment/showsoln.php b/assessment/showsoln.php index 909e512d60..deb440d6d4 100644 --- a/assessment/showsoln.php +++ b/assessment/showsoln.php @@ -2,13 +2,13 @@ require_once("../includes/sanitize.php"); if ($_GET['cid']==="embedq") { - $sessiondata = array(); + $_SESSION = array(); require("../init_without_validate.php"); require("../i18n/i18n.php"); $cid = "embedq"; - $sessiondata['secsalt'] = "12345"; - $sessiondata['graphdisp'] = 1; - $sessiondata['mathdisp'] = 1; + $_SESSION['secsalt'] = "12345"; + $_SESSION['graphdisp'] = 1; + $_SESSION['mathdisp'] = 1; if (isset($_GET['theme'])) { $coursetheme = $_GET['theme']; } @@ -19,12 +19,12 @@ $id = Sanitize::onlyInt($_GET['id']); $sig = $_GET['sig']; $t = Sanitize::onlyInt($_GET['t']); -$sessiondata['coursetheme'] = $coursetheme; +$_SESSION['coursetheme'] = $coursetheme; $flexwidth = true; require("header.php"); echo '
'._('Written Example').' '._('of a similar problem').'
'; -if ($sig != md5($id.$sessiondata['secsalt'])) { +if ($sig != md5($id.$_SESSION['secsalt'])) { echo "invalid signature - not authorized to view the solution for this problem"; exit; } diff --git a/assessment/showtest.php b/assessment/showtest.php index 5c0a903e8a..d28e2ef932 100644 --- a/assessment/showtest.php +++ b/assessment/showtest.php @@ -23,7 +23,7 @@ if (isset($instrPreviewId)) { $teacherid=$instrPreviewId; } - if (!isset($sessiondata['sessiontestid']) && !isset($teacherid) && !isset($tutorid) && !isset($studentid)) { + if (!isset($_SESSION['sessiontestid']) && !isset($teacherid) && !isset($tutorid) && !isset($studentid)) { echo ""; echo _("You are not authorized to view this page. If you are trying to reaccess an assessment you've already started, access it from the course page"); echo "\n"; @@ -37,9 +37,9 @@ unset($teacherid); $actas = true; } - $isRealStudent = (isset($studentid) && !$actas && !isset($sessiondata['stuview'])); + $isRealStudent = (isset($studentid) && !$actas && !isset($_SESSION['stuview'])); $latepasses = 0; - if (!isset($sessiondata['stuview'])) { //want to load for actas too + if (!isset($_SESSION['stuview'])) { //want to load for actas too require_once("../includes/exceptionfuncs.php"); if ($isRealStudent) { $exceptionfuncs = new ExceptionFuncs($userid, $cid, true, $studentinfo['latepasses'], $latepasshrs); @@ -155,7 +155,7 @@ echo ""; } - if (isset($sessiondata['ltiitemtype']) && $sessiondata['ltiitemtype']==0 && $sessiondata['ltiitemid']==$aid) { + if (isset($_SESSION['ltiitemtype']) && $_SESSION['ltiitemtype']==0 && $_SESSION['ltiitemid']==$aid) { //in LTI and right item list($atype,$sa) = explode('-',$adata['deffeedback']); if ($sa!='N') { @@ -309,13 +309,13 @@ if ($isRealStudent) { $stm = $DBH->prepare("SELECT latepass FROM imas_students WHERE userid=:userid AND courseid=:courseid"); $stm->execute(array(':userid'=>$userid, ':courseid'=>$adata['courseid'])); - $sessiondata['latepasses'] = $stm->fetchColumn(0); + $_SESSION['latepasses'] = $stm->fetchColumn(0); } else { - $sessiondata['latepasses'] = 0; + $_SESSION['latepasses'] = 0; } - $sessiondata['latepasshrs'] = $latepasshrs; + $_SESSION['latepasshrs'] = $latepasshrs; - $sessiondata['istutorial'] = $adata['istutorial']; + $_SESSION['istutorial'] = $adata['istutorial']; $_SESSION['choicemap'] = array(); $stm = $DBH->prepare("SELECT id,agroupid,lastanswers,bestlastanswers,starttime,ver FROM imas_assessment_sessions WHERE userid=:userid AND assessmentid=:assessmentid ORDER BY id DESC LIMIT 1"); $stm->execute(array(':userid'=>$userid, ':assessmentid'=>$_GET['id'])); @@ -356,7 +356,7 @@ $stm->execute(array(':userid'=>$userid, ':groupsetid'=>$adata['groupsetid'])); if ($stm->rowCount()>0) { $stugroupid = $stm->fetchColumn(0); - $sessiondata['groupid'] = $stugroupid; + $_SESSION['groupid'] = $stugroupid; } else { if ($adata['isgroup']==3) { echo "", _('You are not yet a member of a group. Contact your instructor to be added to a group.'), " Back"; @@ -366,9 +366,9 @@ $stm->execute(array(':groupsetid'=>$adata['groupsetid'])); $stugroupid = $DBH->lastInsertId(); //if ($adata['isgroup']==3) { - // $sessiondata['groupid'] = $stugroupid; + // $_SESSION['groupid'] = $stugroupid; //} else { - $sessiondata['groupid'] = 0; //leave as 0 to trigger adding group members + $_SESSION['groupid'] = 0; //leave as 0 to trigger adding group members //} $stm = $DBH->prepare("INSERT INTO imas_stugroupmembers (userid,stugroupid) VALUES (:userid, :stugroupid)"); $stm->execute(array(':userid'=>$userid, ':stugroupid'=>$stugroupid)); @@ -377,8 +377,8 @@ } $deffeedbacktext = $adata['deffeedbacktext']; - if (isset($sessiondata['lti_lis_result_sourcedid'.$aid]) && strlen($sessiondata['lti_lis_result_sourcedid'.$aid])>1) { - $ltisourcedid = $sessiondata['lti_lis_result_sourcedid'.$aid].':|:'.$sessiondata['lti_outcomeurl'].':|:'.$sessiondata['lti_origkey'].':|:'.$sessiondata['lti_keylookup']; + if (isset($_SESSION['lti_lis_result_sourcedid'.$aid]) && strlen($_SESSION['lti_lis_result_sourcedid'.$aid])>1) { + $ltisourcedid = $_SESSION['lti_lis_result_sourcedid'.$aid].':|:'.$_SESSION['lti_outcomeurl'].':|:'.$_SESSION['lti_origkey'].':|:'.$_SESSION['lti_keylookup']; } else { $ltisourcedid = ''; } @@ -392,10 +392,10 @@ if ($result===false) { echo _('Error DupASID.') . ' ' . _("Try again") . ''; } - $sessiondata['sessiontestid'] = $DBH->lastInsertId(); + $_SESSION['sessiontestid'] = $DBH->lastInsertId(); if ($stugroupid==0) { - $sessiondata['groupid'] = 0; + $_SESSION['groupid'] = 0; } else { //if a group assessment and already in a group, we'll create asids for all the group members now $stm = $DBH->prepare("SELECT userid FROM imas_stugroupmembers WHERE stugroupid=:stugroupid AND userid<>:userid"); @@ -415,45 +415,43 @@ } } - $sessiondata['isreview'] = $isreview; + $_SESSION['isreview'] = $isreview; if (isset($teacherid) || isset($tutorid) || $actas) { - $sessiondata['isteacher']=true; + $_SESSION['isteacher']=true; } else { - $sessiondata['isteacher']=false; + $_SESSION['isteacher']=false; } if ($actas) { - $sessiondata['actas']=$_GET['actas']; - $sessiondata['isreview'] = false; + $_SESSION['actas']=$_GET['actas']; + $_SESSION['isreview'] = false; } else { - unset($sessiondata['actas']); + unset($_SESSION['actas']); } if (strpos($_SERVER['HTTP_REFERER'],'treereader')!==false) { - $sessiondata['intreereader'] = true; + $_SESSION['intreereader'] = true; } else { - $sessiondata['intreereader'] = false; + $_SESSION['intreereader'] = false; } $stm = $DBH->prepare("SELECT name,theme,msgset,toolset FROM imas_courses WHERE id=:id"); $stm->execute(array(':id'=>$_GET['cid'])); $courseinfo = $stm->fetch(PDO::FETCH_ASSOC); - $sessiondata['courseid'] = Sanitize::courseId($_GET['cid']); - $sessiondata['coursename'] = $courseinfo['name']; + $_SESSION['courseid'] = Sanitize::courseId($_GET['cid']); + $_SESSION['coursename'] = $courseinfo['name']; if (!isset($coursetheme)) { //should already be set from validate.php $coursetheme = $courseinfo['theme']; } - if (isset($sessiondata['userprefs']['usertheme']) && strcmp($sessiondata['userprefs']['usertheme'],'0')!=0) { - $coursetheme = $sessiondata['userprefs']['usertheme']; + if (isset($_SESSION['userprefs']['usertheme']) && strcmp($_SESSION['userprefs']['usertheme'],'0')!=0) { + $coursetheme = $_SESSION['userprefs']['usertheme']; } - $sessiondata['coursetheme'] = $coursetheme; + $_SESSION['coursetheme'] = $coursetheme; - $sessiondata['coursetoolset'] = $courseinfo['toolset']; + $_SESSION['coursetoolset'] = $courseinfo['toolset']; if (isset($studentinfo['timelimitmult'])) { - $sessiondata['timelimitmult'] = $studentinfo['timelimitmult']; + $_SESSION['timelimitmult'] = $studentinfo['timelimitmult']; } else { - $sessiondata['timelimitmult'] = 1.0; + $_SESSION['timelimitmult'] = 1.0; } - - writesessiondata(); session_write_close(); header('Location: ' . $GLOBALS['basesiteurl'] . "/assessment/showtest.php"); exit; @@ -471,31 +469,31 @@ exit; } //Return to test. - $sessiondata['sessiontestid'] = $line['id']; - $sessiondata['isreview'] = $isreview; + $_SESSION['sessiontestid'] = $line['id']; + $_SESSION['isreview'] = $isreview; if (isset($teacherid) || isset($tutorid) || $actas) { - $sessiondata['isteacher']=true; + $_SESSION['isteacher']=true; } else { - $sessiondata['isteacher']=false; + $_SESSION['isteacher']=false; } if ($actas) { - $sessiondata['actas']=$_GET['actas']; - $sessiondata['isreview'] = false; + $_SESSION['actas']=$_GET['actas']; + $_SESSION['isreview'] = false; } else { - unset($sessiondata['actas']); + unset($_SESSION['actas']); } if ($adata['isgroup']==0 || $line['agroupid']>0) { - $sessiondata['groupid'] = $line['agroupid']; + $_SESSION['groupid'] = $line['agroupid']; } else if (!isset($teacherid) && !isset($tutorid)) { //isgroup>0 && agroupid==0 //already has asid, but broken from group $stm = $DBH->prepare("INSERT INTO imas_stugroups (name,groupsetid) VALUES ('Unnamed group',:groupsetid)"); $stm->execute(array(':groupsetid'=>$adata['groupsetid'])); $stugroupid = $DBH->lastInsertId(); if ($adata['isgroup']==3) { - $sessiondata['groupid'] = $stugroupid; + $_SESSION['groupid'] = $stugroupid; } else { - $sessiondata['groupid'] = 0; //leave as 0 to trigger adding group members + $_SESSION['groupid'] = 0; //leave as 0 to trigger adding group members } $stm = $DBH->prepare("INSERT INTO imas_stugroupmembers (userid,stugroupid) VALUES (:userid, :stugroupid)"); $stm->execute(array(':userid'=>$userid, ':stugroupid'=>$stugroupid)); @@ -506,26 +504,23 @@ $stm = $DBH->prepare("SELECT name,theme,msgset,toolset FROM imas_courses WHERE id=:id"); $stm->execute(array(':id'=>$_GET['cid'])); $courseinfo = $stm->fetch(PDO::FETCH_ASSOC); - $sessiondata['courseid'] = Sanitize::courseId($_GET['cid']); - $sessiondata['coursename'] = $courseinfo['name']; - $sessiondata['coursetheme'] = $courseinfo['theme']; - $sessiondata['coursetoolset'] = $courseinfo['toolset']; + $_SESSION['courseid'] = Sanitize::courseId($_GET['cid']); + $_SESSION['coursename'] = $courseinfo['name']; + $_SESSION['coursetheme'] = $courseinfo['theme']; + $_SESSION['coursetoolset'] = $courseinfo['toolset']; if (isset($studentinfo['timelimitmult'])) { - $sessiondata['timelimitmult'] = $studentinfo['timelimitmult']; + $_SESSION['timelimitmult'] = $studentinfo['timelimitmult']; } else { - $sessiondata['timelimitmult'] = 1.0; + $_SESSION['timelimitmult'] = 1.0; } - if (isset($sessiondata['lti_lis_result_sourcedid'.$aid])) { - $altltisourcedid = $sessiondata['lti_lis_result_sourcedid'.$aid].':|:'.$sessiondata['lti_outcomeurl'].':|:'.$sessiondata['lti_origkey'].':|:'.$sessiondata['lti_keylookup']; + if (isset($_SESSION['lti_lis_result_sourcedid'.$aid])) { + $altltisourcedid = $_SESSION['lti_lis_result_sourcedid'.$aid].':|:'.$_SESSION['lti_outcomeurl'].':|:'.$_SESSION['lti_origkey'].':|:'.$_SESSION['lti_keylookup']; if ($altltisourcedid != $line['lti_sourcedid']) { $stm = $DBH->prepare("UPDATE imas_assessment_sessions SET lti_sourcedid=:lti_sourcedid WHERE id=:id"); $stm->execute(array(':lti_sourcedid'=>$altltisourcedid, ':id'=>$line['id'])); } } - - - writesessiondata(); session_write_close(); header('Location: ' . $GLOBALS['basesiteurl'] . "/assessment/showtest.php"); } @@ -533,15 +528,15 @@ } //already started test - if (!isset($sessiondata['sessiontestid'])) { + if (!isset($_SESSION['sessiontestid'])) { echo "", _('Error. Access assessment from course page'), "\n"; exit; } - $testid = $sessiondata['sessiontestid']; + $testid = $_SESSION['sessiontestid']; $asid = $testid; - $isteacher = $sessiondata['isteacher']; - if (isset($sessiondata['actas'])) { - $userid = $sessiondata['actas']; + $isteacher = $_SESSION['isteacher']; + if (isset($_SESSION['actas'])) { + $userid = $_SESSION['actas']; } $stm = $DBH->prepare("SELECT * FROM imas_assessment_sessions WHERE id=:id"); $stm->execute(array(':id'=>$testid)); @@ -644,7 +639,7 @@ $timelimitkickout = ($testsettings['timelimit']<0); $testsettings['timelimit'] = abs($testsettings['timelimit']); //do time limit mult - $testsettings['timelimit'] *= $sessiondata['timelimitmult']; + $testsettings['timelimit'] *= $_SESSION['timelimitmult']; list($testsettings['testtype'],$testsettings['showans']) = explode('-',$testsettings['deffeedback']); @@ -657,7 +652,7 @@ exit; } //verify group is ok - if ($testsettings['isgroup']>0 && !$isteacher && ($line['agroupid']==0 || ($sessiondata['groupid']>0 && $line['agroupid']!=$sessiondata['groupid']))) { + if ($testsettings['isgroup']>0 && !$isteacher && ($line['agroupid']==0 || ($_SESSION['groupid']>0 && $line['agroupid']!=$_SESSION['groupid']))) { echo "", _('Error. Looks like your group has changed for this assessment. Please reopen the assessment and try again.'); echo "", _('Return to course page'), ""; echo ''; @@ -741,7 +736,7 @@ } } else { $stm2 = $DBH->prepare("SELECT startdate,enddate,islatepass,is_lti FROM imas_exceptions WHERE userid=:userid AND assessmentid=:assessmentid AND itemtype='A'"); - $stm2->execute(array(':userid'=>$sessiondata['actas'], ':assessmentid'=>$line['assessmentid'])); + $stm2->execute(array(':userid'=>$_SESSION['actas'], ':assessmentid'=>$line['assessmentid'])); $row = $stm2->fetch(PDO::FETCH_NUM); if ($row!=null) { $useexception = $exceptionfuncs->getCanUseAssessException($row, $testsettings, true); @@ -946,33 +941,32 @@ recordtestdata(false, false); } if (isset($_GET['regen']) && $allowregen && $qi[$questions[$_GET['regen']]]['allowregen']==1) { - if (!isset($sessiondata['regendelay'])) { - $sessiondata['regendelay'] = 2; + if (!isset($_SESSION['regendelay'])) { + $_SESSION['regendelay'] = 2; } $doexit = false; - if (isset($sessiondata['lastregen'])) { - if ($now-$sessiondata['lastregen']<$sessiondata['regendelay']) { - $sessiondata['regendelay'] = 5; + if (isset($_SESSION['lastregen'])) { + if ($now-$_SESSION['lastregen']<$_SESSION['regendelay']) { + $_SESSION['regendelay'] = 5; echo 'Hey, about slowing down and trying the problem before hitting regen? Wait 5 seconds before trying again.
'; $stm = $DBH->prepare("INSERT INTO imas_log (time,log) VALUES (:time, :log)"); $stm->execute(array(':time'=>$now, ':log'=>"Quickregen triggered by $userid")); - if (!isset($sessiondata['regenwarnings'])) { - $sessiondata['regenwarnings'] = 1; + if (!isset($_SESSION['regenwarnings'])) { + $_SESSION['regenwarnings'] = 1; } else { - $sessiondata['regenwarnings']++; + $_SESSION['regenwarnings']++; } - if ($sessiondata['regenwarnings']>10) { + if ($_SESSION['regenwarnings']>10) { $stm = $DBH->prepare("INSERT INTO imas_log (time,log) VALUES (:time, :log)"); $stm->execute(array(':time'=>$now, ':log'=>"Over 10 regen warnings triggered by $userid")); } $doexit = true; } - if ($now - $sessiondata['lastregen'] > 20) { - $sessiondata['regendelay'] = 2; + if ($now - $_SESSION['lastregen'] > 20) { + $_SESSION['regendelay'] = 2; } } - $sessiondata['lastregen'] = $now; - writesessiondata(); + $_SESSION['lastregen'] = $now; if ($doexit) { exit;} srand(); $toregen = $_GET['regen']; @@ -1118,18 +1112,18 @@ } - $isdiag = isset($sessiondata['isdiag']); + $isdiag = isset($_SESSION['isdiag']); if ($isdiag) { - $diagid = $sessiondata['isdiag']; + $diagid = $_SESSION['isdiag']; $hideAllHeaderNav = true; } - $isltilimited = (isset($sessiondata['ltiitemtype']) && $sessiondata['ltiitemtype']==0 && $sessiondata['ltirole']=='learner'); + $isltilimited = (isset($_SESSION['ltiitemtype']) && $_SESSION['ltiitemtype']==0 && $_SESSION['ltirole']=='learner'); - if (isset($CFG['GEN']['keeplastactionlog']) && isset($sessiondata['loginlog'.$testsettings['courseid']])) { + if (isset($CFG['GEN']['keeplastactionlog']) && isset($_SESSION['loginlog'.$testsettings['courseid']])) { $now = time(); $stm = $DBH->prepare("UPDATE imas_login_log SET lastaction=:lastaction WHERE id=:id"); - $stm->execute(array(':lastaction'=>$now, ':id'=>$sessiondata['loginlog'.$testsettings['courseid']])); + $stm->execute(array(':lastaction'=>$now, ':id'=>$_SESSION['loginlog'.$testsettings['courseid']])); } header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -1154,7 +1148,7 @@ if ($testsettings['displaymethod'] == "LivePoll") { $placeinhead = ''; $placeinhead .= ''; - $livepollroom = $testsettings['id'].'-'.($sessiondata['isteacher'] ? 'teachers':'students'); + $livepollroom = $testsettings['id'].'-'.($_SESSION['isteacher'] ? 'teachers':'students'); $now = time(); if (isset($CFG['GEN']['livepollpassword'])) { $livepollsig = base64_encode(sha1($livepollroom . $CFG['GEN']['livepollpassword'] . $now,true)); @@ -1178,7 +1172,7 @@ .LPshowcorrect .LPresbar, .LPshowwrong .LPresbar {background-color: #FFFFFF;} '; } - if ($sessiondata['intreereader']) { + if ($_SESSION['intreereader']) { $flexwidth = true; } require("header.php"); @@ -1186,10 +1180,10 @@ echo ''; } - if (!$isdiag && !$isltilimited && !$sessiondata['intreereader']) { - if (isset($sessiondata['actas'])) { - echo "
"; } @@ -1246,7 +1240,7 @@ echo ''.$out.'
'; } - if ($sessiondata['ltiitemid']==$testsettings['id'] && $isreview) { + if ($_SESSION['ltiitemid']==$testsettings['id'] && $isreview) { if ($testsettings['origshowans']!='N') { echo ''; echo _('View your scored assessment'), '
'; @@ -1266,9 +1260,9 @@ echo ''; } - if ((!$sessiondata['isteacher'] || isset($sessiondata['actas'])) && ($testsettings['isgroup']==1 || $testsettings['isgroup']==2) && ($sessiondata['groupid']==0 || isset($_GET['addgrpmem']))) { + if ((!$_SESSION['isteacher'] || isset($_SESSION['actas'])) && ($testsettings['isgroup']==1 || $testsettings['isgroup']==2) && ($_SESSION['groupid']==0 || isset($_GET['addgrpmem']))) { if (isset($_POST['grpsubmit'])) { - if ($sessiondata['groupid']==0) { + if ($_SESSION['groupid']==0) { echo '', _('Group error - lost group info'), '
'; } $fieldstocopy = 'assessmentid,agroupid,questions,seeds,scores,attempts,lastanswers,starttime,endtime,bestseeds,bestattempts,bestscores,bestlastanswers,feedback,reviewseeds,reviewattempts,reviewscores,reviewlastanswers,reattempting,reviewreattempting,ver'; @@ -1305,7 +1299,7 @@ $loginfo .= "$thisusername already in group. "; } else { $stm = $DBH->prepare("INSERT INTO imas_stugroupmembers (userid,stugroupid) VALUES (:userid,:stugroupid)"); - $stm->execute(array(':userid'=>$_POST['user'.$i], ':stugroupid'=>$sessiondata['groupid'])); + $stm->execute(array(':userid'=>$_POST['user'.$i], ':stugroupid'=>$_SESSION['groupid'])); $fieldstocopy = explode(',',$fieldstocopy); $sets = array(); @@ -1326,7 +1320,7 @@ } } else { $stm = $DBH->prepare("INSERT INTO imas_stugroupmembers (userid,stugroupid) VALUES (:userid,:stugroupid)"); - $stm->execute(array(':userid'=>$_POST['user'.$i], ':stugroupid'=>$sessiondata['groupid'])); + $stm->execute(array(':userid'=>$_POST['user'.$i], ':stugroupid'=>$_SESSION['groupid'])); $fieldphs = ':'.implode(',:', explode(',', $fieldstocopy)); $query = "INSERT INTO imas_assessment_sessions (userid,$fieldstocopy) VALUES (:userid,$fieldphs)"; @@ -1344,7 +1338,7 @@ } } else { echo '', _('Group error. Please try reaccessing the assessment from the course page'), '
'; } $agroupid = $stm->fetchColumn(0); - $sessiondata['groupid'] = $agroupid; - writesessiondata(); + $_SESSION['groupid'] = $agroupid; } else { - $agroupid = $sessiondata['groupid']; + $agroupid = $_SESSION['groupid']; } @@ -1366,7 +1359,7 @@ $query = "SELECT imas_users.id,imas_users.FirstName,imas_users.LastName FROM imas_users,imas_stugroupmembers WHERE "; $query .= "imas_users.id=imas_stugroupmembers.userid AND imas_stugroupmembers.stugroupid=:stugroupid ORDER BY imas_users.LastName,imas_users.FirstName"; $stm = $DBH->prepare($query); - $stm->execute(array(':stugroupid'=>$sessiondata['groupid'])); + $stm->execute(array(':stugroupid'=>$_SESSION['groupid'])); while ($row = $stm->fetch(PDO::FETCH_NUM)) { $curgrp[0] = $row[0]; echo sprintf("Someone already added you to a group. Using that group.
"; } - $sessiondata['groupid'] = $agroupid; - writesessiondata(); + $_SESSION['groupid'] = $agroupid; } */ //if was added to existing group, need to reload $questions, etc echo '', _('Teacher Acting as '); $stm = $DBH->prepare("SELECT LastName, FirstName FROM imas_users WHERE id=:id"); - $stm->execute(array(':id'=>$sessiondata['actas'])); + $stm->execute(array(':id'=>$_SESSION['actas'])); $row = $stm->fetch(PDO::FETCH_NUM); echo $row[1].' '.$row[0]; echo '
'; @@ -1893,7 +1885,7 @@ displayq($qn,$qi[$questions[$qn]]['questionsetid'],$seeds[$qn],false,false,$attempts[$qn],false,false,false,$colors); } $contactlinks = showquestioncontactlinks($qn); - if ($contactlinks!='' && !$sessiondata['istutorial']) { + if ($contactlinks!='' && !$_SESSION['istutorial']) { echo '
", _('No attempts remain on this problem.'), "
"; if ($showeachscore) { //TODO i18n @@ -2350,7 +2342,7 @@ showqinfobar($qn,true,false,true); echo ''; $useeditor = "noinit"; - if ($sessiondata['useed']!=0) { + if ($_SESSION['useed']!=0) { $placeinhead .= ''; } require("../includes/rubric.php"); @@ -624,7 +623,7 @@ function flattenarr($ar) { } */ echo '