Skip to content

Commit 6afe2fb

Browse files
author
drlippman
committed
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
1 parent aa40ff1 commit 6afe2fb

22 files changed

+121
-64
lines changed

admin/forms.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
$topbar = array(array(),array());
140140
$avail = 0;
141141
$lockaid = 0;
142-
$theme = "default.css";
142+
$theme = $defaultcoursetheme;
143143
$ltisecret = "";
144144
$chatset = 0;
145145
$showlatepass = 0;
@@ -253,9 +253,9 @@
253253
if ($copyrights==0) { echo "checked=1";}
254254
echo '/> Require enrollment key from everyone<br/> <input type=radio name="copyrights" value="1" ';
255255
if ($copyrights==1) { echo "checked=1";}
256-
echo '/>No key required for group members, require key from others <br/><input type=radio name="copyrights" value="2" ';
256+
echo '/> No key required for group members, require key from others <br/><input type=radio name="copyrights" value="2" ';
257257
if ($copyrights==2) { echo "checked=1";}
258-
echo '/>No key required from anyone</span><br class=form />';
258+
echo '/> No key required from anyone</span><br class=form />';
259259

260260
echo "<span class=form>Message System:</span><span class=formright>";
261261
//0 on, 1 to instr, 2 to stu, 3 nosend, 4 off

assessment/displayq2.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi) {
577577
if ($displayformat == "horiz") {
578578
$out .= "<div class=choice>{$questions[$randkeys[$i]]}<br/>";
579579
$out .= "<input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
580-
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
580+
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
581581
$out .= " /></div> \n";
582582
} else if ($displayformat == "inline") {
583583
$out .= "<input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
584-
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
584+
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
585585
$out .= " />{$questions[$randkeys[$i]]} ";
586586
} else if ($displayformat == 'column') {
587587
if ($i%$itempercol==0) {
@@ -591,11 +591,11 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi) {
591591
$out .= '<div class="match"><ul class=nomark>';
592592
}
593593
$out .= "<li><input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
594-
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
594+
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
595595
$out .= " />{$questions[$randkeys[$i]]}</li> \n";
596596
} else {
597597
$out .= "<li><input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
598-
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
598+
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
599599
$out .= " />{$questions[$randkeys[$i]]}</li> \n";
600600
}
601601
}

assessment/header.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ function init() {
2525
<?php
2626
echo "<script type=\"text/javascript\" src=\"$imasroot/javascript/general.js?ver=120209\"></script>\n";
2727
if (isset($sessiondata['coursetheme'])) {
28-
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/themes/{$sessiondata['coursetheme']}\"/>\n";
28+
if (isset($flexwidth)) {
29+
$coursetheme = str_replace('_fw','',$sessiondata['coursetheme']);
30+
} else {
31+
$coursetheme = $sessiondata['coursetheme'];
32+
}
33+
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/themes/$coursetheme\"/>\n";
2934
}
3035
if ($isdiag) {
3136
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/diag/print.css\" media=\"print\"/>\n";

assessment/interpret5.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,17 +524,23 @@ function tokenize($str,$anstype) {
524524
//end of line
525525
$intype = 7;
526526
$i++;
527-
$c = $str{$i};
527+
if ($i<$len) {
528+
$c = $str{$i};
529+
}
528530
} else if ($c==';') {
529531
//end of line
530532
$intype = 7;
531533
$i++;
532-
$c = $str{$i};
534+
if ($i<$len) {
535+
$c = $str{$i};
536+
}
533537
} else {
534538
//no type - just append string. Could be operators
535539
$out .= $c;
536540
$i++;
537-
$c = $str{$i};
541+
if ($i<$len) {
542+
$c = $str{$i};
543+
}
538544
}
539545
while ($c==' ') { //eat up extra whitespace
540546
$i++;

assessment/libs/libhelp.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22
require("../../validate.php");
3+
$nologo = true;
4+
$flexwidth = true;
35
require("../../header.php");
46

57
echo "<h1>Installed Macro Libraries</h1>\n";

assessment/macros.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
4242
$ymin = $settings[2];
4343
$ymax = $settings[3];
4444
$yminauto = false;
45-
$yminauto = false;
45+
$ymaxauto = false;
4646
if (substr($ymin,0,4)=='auto') {
4747
$yminauto = true;
4848
if (strpos($ymin,':')!==false) {
@@ -122,19 +122,19 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
122122

123123

124124
$path = '';
125-
if ($function[1]!='') {
125+
if (isset($function[1]) && $function[1]!='') {
126126
$path .= "stroke=\"{$function[1]}\";";
127127
$alt .= ", Color {$function[1]}";
128128
} else {
129129
$path .= "stroke=\"black\";";
130130
$alt .= ", Color black";
131131
}
132-
if ($function[6]!='') {
132+
if (isset($function[6]) && $function[6]!='') {
133133
$path .= "strokewidth=\"{$function[6]}\";";
134134
} else {
135135
$path .= "strokewidth=\"1\";";
136136
}
137-
if ($function[7]!='') {
137+
if (isset($function[7]) && $function[7]!='') {
138138
if ($function[7]=="dash") {
139139
$path .= "strokedasharray=\"5\";";
140140
$alt .= ", Dashed";
@@ -146,17 +146,17 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
146146
}
147147

148148
$avoid = array();
149-
if ($function[2]!='') {$xmin = $function[2];} else {$xmin = $settings[0];}
150-
if ($function[3]!='') {
149+
$domainlimited = false;
150+
if (isset($function[2]) && $function[2]!='') {
151+
$xmin = $function[2];
152+
$domainlimited = true;
153+
} else {$xmin = $settings[0];}
154+
if (isset($function[3]) && $function[3]!='') {
151155
$xmaxarr = explode('!',$function[3]);
152156
$xmax = $xmaxarr[0];
153157
$avoid = array_slice($xmaxarr,1);
154-
} else {$xmax = $settings[1];}
155-
if ($function[2]!='' || $function[3]!='') {
156158
$domainlimited = true;
157-
} else {
158-
$domainlimited = false;
159-
}
159+
} else {$xmax = $settings[1];}
160160

161161
if ($GLOBALS['sessiondata']['graphdisp']==0) {
162162
$dx = 1;
@@ -247,14 +247,14 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
247247
}
248248
if ($lastl > 0) {$path .= "]);";}
249249
$alt .= "</tbody></table>\n";
250-
if ($function[5]=='open') {
250+
if (isset($function[5]) && $function[5]=='open') {
251251
$path .= "dot([$x,$y],\"open\");";
252252
$alt .= "Open dot at $x,$y";
253-
} else if ($function[5]=='closed') {
253+
} else if (isset($function[5]) && $function[5]=='closed') {
254254
$path .= "dot([$x,$y],\"closed\");";
255255
$alt .= "Closed dot at $x,$y";
256256
}
257-
if ($function[4]=='open') {
257+
if (isset($function[4]) && $function[4]=='open') {
258258
if ($isparametric) {
259259
$t = $xmin;
260260
$x = round(eval("return ($xfunc);"),3);
@@ -270,7 +270,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
270270
$absymax = $y;
271271
}
272272
$alt .= "Open dot at $x,$y";
273-
} else if ($function[4]=='closed') {
273+
} else if (isset($function[4]) && $function[4]=='closed') {
274274
if ($isparametric) {
275275
$t = $xmin;
276276
$x = round(eval("return ($xfunc);"),3);

assessment/mathphp2.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,12 @@ function mathphptokenize($str,$vars,$ignorestrings) {
186186
$maxvarlen = $l;
187187
}
188188
}
189+
$connecttolast = 0;
189190
$i=0;
190191
$cnt = 0;
191192
$len = strlen($str);
192193
$syms = array();
194+
$lastsym = array();
193195
while ($i<$len) {
194196
$cnt++;
195197
if ($cnt>100) {
@@ -327,7 +329,7 @@ function mathphptokenize($str,$vars,$ignorestrings) {
327329
$intype = 3; //number
328330
$cont = true;
329331
//handle . 3 which needs to act as concat
330-
if ($lastsym[0]=='.') {
332+
if (isset($lastsym[0]) && $lastsym[0]=='.') {
331333
$syms[count($syms)-1][0] .= ' ';
332334
}
333335
do {
@@ -447,17 +449,23 @@ function mathphptokenize($str,$vars,$ignorestrings) {
447449
//end of line
448450
$intype = 7;
449451
$i++;
450-
$c = $str{$i};
452+
if ($i<$len) {
453+
$c = $str{$i};
454+
}
451455
} else if ($c==';') {
452456
//end of line
453457
$intype = 7;
454458
$i++;
455-
$c = $str{$i};
459+
if ($i<$len) {
460+
$c = $str{$i};
461+
}
456462
} else {
457463
//no type - just append string. Could be operators
458464
$out .= $c;
459465
$i++;
460-
$c = $str{$i};
466+
if ($i<$len) {
467+
$c = $str{$i};
468+
}
461469
}
462470
while ($c==' ') { //eat up extra whitespace
463471
$i++;

assessment/print.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ div.question {
2727
div.nobreak {
2828
page-break-inside:avoid;
2929
}
30+
.headerwrapper {
31+
height: 0px;
32+
}

assessment/printtest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
}
88

99
include("displayq2.php");
10+
$flexwidth = true; //tells header to use non _fw stylesheet
1011
require("header.php");
1112
echo "<style type=\"text/css\" media=\"print\">p.tips { display: none;}\n input.btn {display: none;}\n textarea {display: none;}\n input.sabtn {display: none;}</style>\n";
1213
echo "<style type=\"text/css\">p.tips { display: none;}\n </style>\n";

assessment/showtest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
exit;
1515
}
1616
$actas = false;
17+
$isreview = false;
1718
if (isset($teacherid) && isset($_GET['actas'])) {
1819
$userid = $_GET['actas'];
1920
unset($teacherid);
@@ -665,7 +666,7 @@
665666
//if was added to existing group, need to reload $questions, etc
666667

667668
echo "<h2>{$testsettings['name']}</h2>\n";
668-
if ($sessiondata['actas']) {
669+
if (isset($sessiondata['actas'])) {
669670
echo '<p style="color: red;">Teacher Acting as ';
670671
$query = "SELECT LastName, FirstName FROM imas_users WHERE id='{$sessiondata['actas']}'";
671672
$result = mysql_query($query) or die("Query failed : $query:" . mysql_error());
@@ -766,11 +767,11 @@
766767
} else {
767768
echo "<div class=right>No time limit</div>\n";
768769
}
769-
if ($_GET['action']=="skip" || $_GET['action']=="seq") {
770-
echo "<div class=right><span onclick=\"document.getElementById('intro').className='intro';\"><a href=\"#\">Show Instructions</a></span></div>\n";
771-
}
770+
772771
if (isset($_GET['action'])) {
773-
772+
if ($_GET['action']=="skip" || $_GET['action']=="seq") {
773+
echo "<div class=right><span onclick=\"document.getElementById('intro').className='intro';\"><a href=\"#\">Show Instructions</a></span></div>\n";
774+
}
774775
if ($_GET['action']=="scoreall") {
775776
//score test
776777
for ($i=0; $i < count($questions); $i++) {

0 commit comments

Comments
 (0)