From: moodler Date: Mon, 30 Dec 2002 05:13:43 +0000 (+0000) Subject: More little fixups for robustness X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=47f1da80d02dc05fef9f997cbac05e7cc75198d8;p=moodle.git More little fixups for robustness --- diff --git a/admin/config.html b/admin/config.html index 6403cbba01..8d7a4b5026 100644 --- a/admin/config.html +++ b/admin/config.html @@ -4,9 +4,7 @@

lang: - lang, "", "", ""); - formerr($err["lang"]); - ?> + lang, "", "", ""); ?> @@ -30,7 +28,6 @@

locale: - @@ -48,7 +45,6 @@

smtphosts: - @@ -58,7 +54,6 @@

smtpuser: - @@ -68,7 +63,6 @@

smtppass: - @@ -95,7 +89,6 @@ $options[0] = get_string("allownot"); $options[1] = get_string("allow"); choose_from_menu ($options, "htmleditor", $config->htmleditor, "", "", ""); - formerr($err["htmleditor"]); ?> @@ -145,7 +138,6 @@

zip: - @@ -155,7 +147,6 @@

unzip: - @@ -181,7 +172,6 @@

proxyhost: - @@ -191,7 +181,20 @@

proxyport: - + + + +

debug: + + debug, "", "", ""); + unset($options); + ?> + + + diff --git a/admin/site.html b/admin/site.html index ed94e5db5f..ee691c113f 100644 --- a/admin/site.html +++ b/admin/site.html @@ -1,16 +1,16 @@

- - + + - - + + @@ -38,13 +38,12 @@ "9" => "9 $newsitems", "10" => "10 $newsitems"); choose_from_menu ($options, "newsitems", "$form->newsitems", ""); - formerr($err["newsitems"]); ?> - +

:

- -

:

+ +

:

- -

:

+ +

:


@@ -18,7 +18,7 @@
- +
">">
diff --git a/admin/site.php b/admin/site.php index 799471cb9b..201f8f5307 100644 --- a/admin/site.php +++ b/admin/site.php @@ -1,6 +1,6 @@ id) { if (update_record("course", $form)) { - redirect("index.php", get_string("changessaved")); + redirect("index.php", get_string("changessaved")); } else { error("Serious Error! Could not update the site record! (id = $form->id)"); } @@ -31,7 +31,7 @@ if ($newid = insert_record("course", $form)) { $cat->name = get_string("miscellaneous"); if (insert_record("course_categories", $cat)) { - redirect("index.php", get_string("changessaved"), "1"); + redirect("index.php", get_string("changessaved"), "1"); } else { error("Serious Error! Could not set up a default course category!"); } @@ -39,18 +39,18 @@ error("Serious Error! Could not set up the site!"); } } - die; + die; } else { foreach ($err as $key => $value) { $focus = "form.$key"; } } - } + } /// Otherwise fill and print the form. - if ($site && !$form) { + if ($site and empty($form)) { $form = $site; } else { $form->category = 0; @@ -58,6 +58,10 @@ $form->newsitems = 0; } + if (empty($focus)) { + $focus = "form.fullname"; + } + $stradmin = get_string("administration"); $strsitesettings = get_string("sitesettings"); @@ -66,7 +70,7 @@ print_heading($strsitesettings); print_simple_box_start("center", "", "$THEME->cellheading"); - include("site.html"); + include("site.html"); print_simple_box_end(); print_footer(); diff --git a/course/lib.php b/course/lib.php index d0defb5b75..9eff089bbc 100644 --- a/course/lib.php +++ b/course/lib.php @@ -105,6 +105,8 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") { // It is assumed that $date is the GMT time of midnight for that day, // and so the next 86400 seconds worth of logs are printed. + global $CFG; + if ($course->category) { $selector = "WHERE l.course='$course->id' AND l.userid = u.id"; @@ -152,7 +154,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") { echo "".userdate($log->time, "%A").""; echo "".userdate($log->time, "%d %B %Y, %I:%M %p").""; echo ""; - link_to_popup_window("$CFG->wwwroot/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700); + link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700); echo ""; echo "userid&course=$log->course\">$log->firstname $log->lastname"; echo ""; @@ -325,7 +327,7 @@ function print_recent_activity($course) { break; case "update mod": $strupdated = get_string("updated", "moodle", get_string("modulename", $info[0])); - if (! $changelist["$log->info"]) { + if (empty($changelist["$log->info"])) { $changelist["$log->info"] = array ("operation" => "update", "text" => "$strupdated:
wwwroot/course/$log->url\">$modname"); } break; @@ -477,6 +479,8 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod $editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id§ion=0&add=", $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true); $editmenu = "
$editmenu
"; + } else { + $editmenu = ""; } print_side_block($heading, "", $moddata, $modicon, $editmenu, $width); diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 8d9c3aa2d5..17d3422359 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -54,6 +54,7 @@ $string['city'] = "City/town"; $string['closewindow'] = "Close this window"; $string['comparelanguage'] = "Compare and edit current language"; $string['configcountry'] = "If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset."; +$string['configdebug'] = "If you turn this on, then PHP's error_reporting will be increased so that more warnings are printed. This is only useful for developers."; $string['configgdversion'] = "Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing."; $string['configerrorlevel'] = "Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice."; $string['confightmleditor'] = "Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible browser (IE 5.5 or later). Users can also choose not to use it."; diff --git a/lib/graphlib.php b/lib/graphlib.php index 43bcfab664..ba75e4d0cf 100644 --- a/lib/graphlib.php +++ b/lib/graphlib.php @@ -762,6 +762,12 @@ function init_x_ticks() { //print "xStep: $xStep
"; // if numeric x axis then calculate x coords for each data point. this is seperate from x ticks. $gridX = $gridLeft; + if (empty($this->calculated['x_axis']['factor'])) { + $this->calculated['x_axis']['factor'] = 0; + } + if (empty($this->calculated['x_axis']['min'])) { + $this->calculated['x_axis']['min'] = 0; + } $factor = $this->calculated['x_axis']['factor']; $min = $this->calculated['x_axis']['min']; diff --git a/lib/weblib.php b/lib/weblib.php index ba0e871d38..dfe6b14b24 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -981,9 +981,9 @@ function print_date_selector($day, $month, $year, $currenttime=0) { for ($i=2000; $i<=2010; $i++) { $years[$i] = $i; } - choose_from_menu($days, $day, $currentdate[mday], ""); - choose_from_menu($months, $month, $currentdate[mon], ""); - choose_from_menu($years, $year, $currentdate[year], ""); + choose_from_menu($days, $day, $currentdate['mday'], ""); + choose_from_menu($months, $month, $currentdate['mon'], ""); + choose_from_menu($years, $year, $currentdate['year'], ""); } function print_time_selector($hour, $minute, $currenttime=0) { @@ -1000,8 +1000,8 @@ function print_time_selector($hour, $minute, $currenttime=0) { for ($i=0; $i<=59; $i++) { $minutes[$i] = sprintf("%02d",$i); } - choose_from_menu($hours, $hour, $currentdate[hours], ""); - choose_from_menu($minutes, $minute, $currentdate[minutes], ""); + choose_from_menu($hours, $hour, $currentdate['hours'], ""); + choose_from_menu($minutes, $minute, $currentdate['minutes'], ""); } function error ($message, $link="") { diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 690c5ff27d..b760e84dbe 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1326,7 +1326,7 @@ function forum_print_user_discussions($courseid, $userid) { if (($discussion->forumtype == "teacher") and !isteacher($courseid)) { continue; } - if ($replies[$discussion->discussion]) { + if (!empty($replies[$discussion->discussion])) { $discussion->replies = $replies[$discussion->discussion]->replies; } else { $discussion->replies = 0; diff --git a/mod/survey/graph.php b/mod/survey/graph.php index dabc0874bc..fb9b70a470 100644 --- a/mod/survey/graph.php +++ b/mod/survey/graph.php @@ -119,6 +119,8 @@ $count1[$i] = 0; $count2[$i] = 0; $indexof[$val] = $i; + $stdev1[$i] = 0; + $stdev2[$i] = 0; } $aaa = get_records_select("survey_answers", "((survey = $cm->instance) AND (question in ($question->multi)))"); @@ -396,6 +398,8 @@ $studbuckets2[$i] = 0.0; $studcount1[$i] = 0; $studcount2[$i] = 0; + $stdev1[$i] = 0.0; + $stdev2[$i] = 0.0; $subquestions = $question[$i]->multi; // otherwise next line doesn't work $aaa = get_records_select("survey_answers","((survey = $cm->instance) AND (question in ($subquestions)))"); @@ -541,6 +545,8 @@ $studbuckets2[$i] = 0.0; $studcount1[$i] = 0; $studcount2[$i] = 0; + $stdev1[$i] = 0.0; + $stdev2[$i] = 0.0; } $aaa = get_records_select("survey_answers", "((survey = $cm->instance) AND (question in ($question->multi)))"); @@ -649,7 +655,7 @@ $graph->y_tick_labels = $options; if (($maxbuckets1 > 0.0) && ($maxbuckets2 > 0.0)) { - $graph->y_order = array('stdev1', 'stdev2', 'answers1', 'answers2', 'studanswers1', 'studanswers2'); + $graph->y_order = array('stdev1', 'stdev2', 'answers1', 'answers2', 'studanswers1', 'studanswers2'); } else if ($maxbuckets1 > 0.0) { $graph->y_order = array('stdev1', 'answers1', 'studanswers1'); } else { diff --git a/mod/survey/report.php b/mod/survey/report.php index 38cbb42707..0a8c6b4d96 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -41,11 +41,11 @@ $strseemoredetail = get_string("seemoredetail", "survey"); $strnotes = get_string("notes", "survey"); - if (!$action) { + if (empty($action)) { $display = "summary"; } - if ($display) { // Display the frame containing something. + if (!empty($display)) { // Display the frame containing something. add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id"); echo "$course->shortname: $strreport: $survey->name\n"; echo " "; diff --git a/user/edit.html b/user/edit.html index 8054b3c560..34fc4ec8ca 100644 --- a/user/edit.html +++ b/user/edit.html @@ -3,109 +3,109 @@ "; - echo "

".get_string("username").":"; - echo "

".get_string("username").":"; + echo "username); echo "\">"; - if (isset($err["username"])) formerr($err["username"]); - echo ""; + if (isset($err["username"])) formerr($err["username"]); + echo ""; echo ""; echo ""; - echo "

".get_string("newpassword").":"; - echo "

".get_string("newpassword").":"; + echo "newpassword)) p($user->newpassword); echo "\">"; - if (isset($err["newpassword"])) { + if (isset($err["newpassword"])) { formerr($err["newpassword"]); } else if (empty($user->newpassword)) { - echo " (".get_string("leavetokeep").")"; + echo " (".get_string("leavetokeep").")"; } - echo ""; + echo ""; echo ""; echo "


"; } ?> -

: - - - +

: + + + -

: - - - +

: + + + -

: - - - +

: + + + -

: -

: + maildisplay, "") ?> - + -

: -

: + mailformat, "") ?> - + htmleditor) { ?> -

: -

: + htmleditor, "") ?> - + -

: - - - +

: + + + -

: -

: + country and $CFG->country) { $user->country = $CFG->country; } choose_from_menu ($COUNTRIES, "country", $user->country, get_string("selectacountry")."...", "", "") ?> - - + + -

: -

: + lang) { $user->lang = $CFG->lang; } choose_from_menu ($languages, "lang", $user->lang, "", "", ""); } - if (isset($err["lang"])) formerr($err["lang"]); + if (isset($err["lang"])) formerr($err["lang"]); ?> - + -

: -

: + timezone) > 13) { $user->timezone = 99; } @@ -126,72 +126,72 @@ if (isadmin()) { choose_from_menu ($timezones, "timezone", $user->timezone, get_string("serverlocaltime"), "", "99"); echo "(".get_string("currentlocaltime").")"; - ?> + ?> -

: -

: + "; } ?> - +
: -

: - +

: + - + -

: - - - +

: + + + -

: - - - +

: + + + -

: - - - +

: + + + -

1: - - - +

1: + + + -

2: - - - +

2: + + + -

: - - - +

: + + + - - "> + + ">