From 6afe2fbd9dedf081829efba5280335ac169cb9e6 Mon Sep 17 00:00:00 2001 From: drlippman Date: Mon, 28 Dec 2009 17:57:32 +0000 Subject: [PATCH] Lots of updates to fix notices (mostly missing isset s) Add wrapper and header divs to header/footer to support more advanced themes Add option to set $defaultcoursetheme and $loginpage in config.php git-svn-id: http://imathas.googlecode.com/svn/trunk@488 c89b4f0b-ac2a-0410-9773-c9071ee4f95d --- admin/forms.php | 6 +++--- assessment/displayq2.php | 8 ++++---- assessment/header.php | 7 ++++++- assessment/interpret5.php | 12 +++++++++--- assessment/libs/libhelp.php | 2 ++ assessment/macros.php | 30 +++++++++++++++--------------- assessment/mathphp2.php | 16 ++++++++++++---- assessment/print.css | 3 +++ assessment/printtest.php | 1 + assessment/showtest.php | 11 ++++++----- course/addquestions.php | 4 ++-- course/course.php | 2 +- course/courseshowitems.php | 2 +- course/testquestion.php | 1 + filter/filter.php | 4 ++-- filter/math/ASCIIMath2TeX.php | 2 +- header.php | 30 +++++++++++++++++------------- includes/copyiteminc.php | 6 +++--- index.php | 11 +++++++---- infopages.css | 5 +++++ install.php | 5 +++++ validate.php | 17 +++++++++++++++-- 22 files changed, 121 insertions(+), 64 deletions(-) diff --git a/admin/forms.php b/admin/forms.php index 1c60624a5f..6be95943c2 100644 --- a/admin/forms.php +++ b/admin/forms.php @@ -139,7 +139,7 @@ $topbar = array(array(),array()); $avail = 0; $lockaid = 0; - $theme = "default.css"; + $theme = $defaultcoursetheme; $ltisecret = ""; $chatset = 0; $showlatepass = 0; @@ -253,9 +253,9 @@ if ($copyrights==0) { echo "checked=1";} echo '/> Require enrollment key from everyone
No key required for group members, require key from others
No key required for group members, require key from others
No key required from anyone
'; + echo '/> No key required from anyone
'; echo "Message System:"; //0 on, 1 to instr, 2 to stu, 3 nosend, 4 off diff --git a/assessment/displayq2.php b/assessment/displayq2.php index f48a1c61fc..30a679370c 100644 --- a/assessment/displayq2.php +++ b/assessment/displayq2.php @@ -577,11 +577,11 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi) { if ($displayformat == "horiz") { $out .= "
{$questions[$randkeys[$i]]}
"; $out .= "\n"; if (isset($sessiondata['coursetheme'])) { - echo "\n"; + if (isset($flexwidth)) { + $coursetheme = str_replace('_fw','',$sessiondata['coursetheme']); + } else { + $coursetheme = $sessiondata['coursetheme']; + } + echo "\n"; } if ($isdiag) { echo "\n"; diff --git a/assessment/interpret5.php b/assessment/interpret5.php index 0fcf8e99c1..9578cac576 100644 --- a/assessment/interpret5.php +++ b/assessment/interpret5.php @@ -524,17 +524,23 @@ function tokenize($str,$anstype) { //end of line $intype = 7; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } else if ($c==';') { //end of line $intype = 7; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } else { //no type - just append string. Could be operators $out .= $c; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } while ($c==' ') { //eat up extra whitespace $i++; diff --git a/assessment/libs/libhelp.php b/assessment/libs/libhelp.php index cdde01d7d4..1cab3f5c74 100644 --- a/assessment/libs/libhelp.php +++ b/assessment/libs/libhelp.php @@ -1,5 +1,7 @@ Installed Macro Libraries\n"; diff --git a/assessment/macros.php b/assessment/macros.php index 091d79630f..405f950665 100644 --- a/assessment/macros.php +++ b/assessment/macros.php @@ -42,7 +42,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label $ymin = $settings[2]; $ymax = $settings[3]; $yminauto = false; - $yminauto = false; + $ymaxauto = false; if (substr($ymin,0,4)=='auto') { $yminauto = true; if (strpos($ymin,':')!==false) { @@ -122,19 +122,19 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label $path = ''; - if ($function[1]!='') { + if (isset($function[1]) && $function[1]!='') { $path .= "stroke=\"{$function[1]}\";"; $alt .= ", Color {$function[1]}"; } else { $path .= "stroke=\"black\";"; $alt .= ", Color black"; } - if ($function[6]!='') { + if (isset($function[6]) && $function[6]!='') { $path .= "strokewidth=\"{$function[6]}\";"; } else { $path .= "strokewidth=\"1\";"; } - if ($function[7]!='') { + if (isset($function[7]) && $function[7]!='') { if ($function[7]=="dash") { $path .= "strokedasharray=\"5\";"; $alt .= ", Dashed"; @@ -146,17 +146,17 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label } $avoid = array(); - if ($function[2]!='') {$xmin = $function[2];} else {$xmin = $settings[0];} - if ($function[3]!='') { + $domainlimited = false; + if (isset($function[2]) && $function[2]!='') { + $xmin = $function[2]; + $domainlimited = true; + } else {$xmin = $settings[0];} + if (isset($function[3]) && $function[3]!='') { $xmaxarr = explode('!',$function[3]); $xmax = $xmaxarr[0]; $avoid = array_slice($xmaxarr,1); - } else {$xmax = $settings[1];} - if ($function[2]!='' || $function[3]!='') { $domainlimited = true; - } else { - $domainlimited = false; - } + } else {$xmax = $settings[1];} if ($GLOBALS['sessiondata']['graphdisp']==0) { $dx = 1; @@ -247,14 +247,14 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label } if ($lastl > 0) {$path .= "]);";} $alt .= "\n"; - if ($function[5]=='open') { + if (isset($function[5]) && $function[5]=='open') { $path .= "dot([$x,$y],\"open\");"; $alt .= "Open dot at $x,$y"; - } else if ($function[5]=='closed') { + } else if (isset($function[5]) && $function[5]=='closed') { $path .= "dot([$x,$y],\"closed\");"; $alt .= "Closed dot at $x,$y"; } - if ($function[4]=='open') { + if (isset($function[4]) && $function[4]=='open') { if ($isparametric) { $t = $xmin; $x = round(eval("return ($xfunc);"),3); @@ -270,7 +270,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label $absymax = $y; } $alt .= "Open dot at $x,$y"; - } else if ($function[4]=='closed') { + } else if (isset($function[4]) && $function[4]=='closed') { if ($isparametric) { $t = $xmin; $x = round(eval("return ($xfunc);"),3); diff --git a/assessment/mathphp2.php b/assessment/mathphp2.php index cb1f97f42c..62812e9769 100644 --- a/assessment/mathphp2.php +++ b/assessment/mathphp2.php @@ -186,10 +186,12 @@ function mathphptokenize($str,$vars,$ignorestrings) { $maxvarlen = $l; } } + $connecttolast = 0; $i=0; $cnt = 0; $len = strlen($str); $syms = array(); + $lastsym = array(); while ($i<$len) { $cnt++; if ($cnt>100) { @@ -327,7 +329,7 @@ function mathphptokenize($str,$vars,$ignorestrings) { $intype = 3; //number $cont = true; //handle . 3 which needs to act as concat - if ($lastsym[0]=='.') { + if (isset($lastsym[0]) && $lastsym[0]=='.') { $syms[count($syms)-1][0] .= ' '; } do { @@ -447,17 +449,23 @@ function mathphptokenize($str,$vars,$ignorestrings) { //end of line $intype = 7; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } else if ($c==';') { //end of line $intype = 7; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } else { //no type - just append string. Could be operators $out .= $c; $i++; - $c = $str{$i}; + if ($i<$len) { + $c = $str{$i}; + } } while ($c==' ') { //eat up extra whitespace $i++; diff --git a/assessment/print.css b/assessment/print.css index bc98da20ad..71399481bd 100644 --- a/assessment/print.css +++ b/assessment/print.css @@ -27,3 +27,6 @@ div.question { div.nobreak { page-break-inside:avoid; } +.headerwrapper { + height: 0px; +} diff --git a/assessment/printtest.php b/assessment/printtest.php index e6a27352c4..6e43cd7d1c 100644 --- a/assessment/printtest.php +++ b/assessment/printtest.php @@ -7,6 +7,7 @@ } include("displayq2.php"); + $flexwidth = true; //tells header to use non _fw stylesheet require("header.php"); echo "\n"; echo "\n"; diff --git a/assessment/showtest.php b/assessment/showtest.php index 51517064d5..bd764a016c 100644 --- a/assessment/showtest.php +++ b/assessment/showtest.php @@ -14,6 +14,7 @@ exit; } $actas = false; + $isreview = false; if (isset($teacherid) && isset($_GET['actas'])) { $userid = $_GET['actas']; unset($teacherid); @@ -665,7 +666,7 @@ //if was added to existing group, need to reload $questions, etc echo "

{$testsettings['name']}

\n"; - if ($sessiondata['actas']) { + if (isset($sessiondata['actas'])) { echo '

Teacher Acting as '; $query = "SELECT LastName, FirstName FROM imas_users WHERE id='{$sessiondata['actas']}'"; $result = mysql_query($query) or die("Query failed : $query:" . mysql_error()); @@ -766,11 +767,11 @@ } else { echo "

No time limit
\n"; } - if ($_GET['action']=="skip" || $_GET['action']=="seq") { - echo "\n"; - } + if (isset($_GET['action'])) { - + if ($_GET['action']=="skip" || $_GET['action']=="seq") { + echo "\n"; + } if ($_GET['action']=="scoreall") { //score test for ($i=0; $i < count($questions); $i++) { diff --git a/course/addquestions.php b/course/addquestions.php index 4ad7941a2e..e79c1b4196 100644 --- a/course/addquestions.php +++ b/course/addquestions.php @@ -686,7 +686,7 @@ echo 'How do I find questions to add?'; echo '