mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Small robustness fixes
This commit is contained in:
parent
8af3e37948
commit
ce78926df0
@ -189,12 +189,12 @@
|
||||
}
|
||||
echo "</TABLE>";
|
||||
|
||||
if ($news or $course->showrecent) {
|
||||
if (!empty($news) or !empty($course->showrecent)) {
|
||||
echo "</TD><TD WIDTH=210>";
|
||||
|
||||
// Print all the news items.
|
||||
|
||||
if ($news) {
|
||||
if (!empty($news)) {
|
||||
print_side_block_start(get_string("latestnews"), 210, "sideblocklatestnews");
|
||||
echo "<FONT SIZE=\"-2\">";
|
||||
forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
|
||||
@ -203,7 +203,7 @@
|
||||
}
|
||||
|
||||
// Print all the recent activity
|
||||
if ($course->showrecent) {
|
||||
if (!empty($course->showrecent)) {
|
||||
print_side_block_start(get_string("recentactivity"), 210, "sideblockrecentactivity");
|
||||
print_recent_activity($course);
|
||||
print_side_block_end();
|
||||
|
@ -955,7 +955,7 @@ function add_to_log($course, $module, $action, $url="", $info="") {
|
||||
'$url',
|
||||
'$info')");
|
||||
|
||||
if (!$result) {
|
||||
if (!$result and ($CFG->debug > 7)) {
|
||||
echo "<P>Error: Could not insert a new entry to the Moodle log</P>"; // Don't throw an error
|
||||
}
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ function check_browser_version($brand="MSIE", $version=5.5) {
|
||||
function can_use_richtext_editor() {
|
||||
/// Is the richedit editor enabled?
|
||||
global $USER, $CFG;
|
||||
if ($USER->htmleditor and $CFG->htmleditor) {
|
||||
if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
|
||||
return check_browser_version("MSIE", 5.5);
|
||||
}
|
||||
return false;
|
||||
|
@ -163,11 +163,11 @@ function match_referer($good_referer = "") {
|
||||
/// good_referer is not specified, use qualified_me as the good_referer
|
||||
global $CFG;
|
||||
|
||||
if ($CFG->buggy_referer) {
|
||||
if (!empty($CFG->buggy_referer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($good_referer == "") {
|
||||
if (empty($good_referer)) {
|
||||
$good_referer = qualified_me();
|
||||
}
|
||||
return $good_referer == get_referer();
|
||||
|
@ -298,7 +298,7 @@ function assignment_print_difference($time) {
|
||||
}
|
||||
|
||||
function assignment_print_submission($assignment, $user, $submission, $teachers, $grades) {
|
||||
global $THEME;
|
||||
global $THEME, $USER;
|
||||
|
||||
echo "\n<TABLE BORDER=1 CELLSPACING=0 valign=top cellpadding=10 align=center>";
|
||||
|
||||
@ -433,7 +433,7 @@ function assignment_print_upload_form($assignment) {
|
||||
|
||||
echo "<DIV ALIGN=CENTER>";
|
||||
echo "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"POST\" ACTION=upload.php>";
|
||||
echo " <INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=\"$assignment->maxfilesize\">";
|
||||
echo " <INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=\"$assignment->maxbytes\">";
|
||||
echo " <INPUT TYPE=hidden NAME=id VALUE=\"$assignment->id\">";
|
||||
echo " <INPUT NAME=\"newfile\" TYPE=\"file\" size=\"50\">";
|
||||
echo " <INPUT TYPE=submit NAME=save VALUE=\"".get_string("uploadthisfile")."\">";
|
||||
|
@ -21,8 +21,8 @@
|
||||
if (empty($form->resubmit)) {
|
||||
$form->resubmit = "";
|
||||
}
|
||||
if (empty($form->grade)) {
|
||||
$form->grade = "";
|
||||
if (!isset($form->grade)) {
|
||||
$form->grade = 100;
|
||||
}
|
||||
if (empty($form->maxbytes)) {
|
||||
$form->maxbytes = "";
|
||||
|
@ -73,7 +73,6 @@
|
||||
if ($data = data_submitted()) {
|
||||
|
||||
$feedback = array();
|
||||
$data = (array)$data;
|
||||
|
||||
// Peel out all the data from variable names.
|
||||
foreach ($data as $key => $val) {
|
||||
@ -89,10 +88,10 @@
|
||||
foreach ($feedback as $num => $vals) {
|
||||
$submission = $submissions[$num];
|
||||
// Only update entries where feedback has actually changed.
|
||||
if (($vals[g] <> $submission->grade) || ($vals[c] <> addslashes($submission->comment))) {
|
||||
if (($vals['g'] <> $submission->grade) || ($vals['c'] <> addslashes($submission->comment))) {
|
||||
unset($newsubmission);
|
||||
$newsubmission->grade = $vals[g];
|
||||
$newsubmission->comment = $vals[c];
|
||||
$newsubmission->grade = $vals['g'];
|
||||
$newsubmission->comment = $vals['c'];
|
||||
$newsubmission->teacher = $USER->id;
|
||||
$newsubmission->timemarked = $timenow;
|
||||
$newsubmission->mailed = 0; // Make sure mail goes out (again, even)
|
||||
|
@ -62,14 +62,19 @@
|
||||
} else {
|
||||
$aa = "";
|
||||
}
|
||||
if (!empty($choice->section)) {
|
||||
$section = "$choice->section";
|
||||
} else {
|
||||
$section = "";
|
||||
}
|
||||
|
||||
if ($course->format == "weeks" || $course->format == "topics") {
|
||||
$table->data[] = array ("$choice->section",
|
||||
$table->data[] = array ($section,
|
||||
"<A HREF=\"view.php?id=$choice->coursemodule\">$choice->name</A>",
|
||||
"$aa");
|
||||
$aa);
|
||||
} else {
|
||||
$table->data[] = array ("<A HREF=\"view.php?id=$choice->coursemodule\">$choice->name</A>",
|
||||
"$aa");
|
||||
$aa);
|
||||
}
|
||||
}
|
||||
echo "<BR>";
|
||||
|
@ -1,3 +1,13 @@
|
||||
<?PHP
|
||||
if (empty($user->htmleditor)) {
|
||||
$user->htmleditor = 1;
|
||||
}
|
||||
if (empty($user->lang)) {
|
||||
$user->lang = $CFG->lang;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<FORM METHOD="post" ENCTYPE="multipart/form-data" action="edit.php">
|
||||
<table cellpadding=9 cellspacing=0 >
|
||||
<?
|
||||
|
Loading…
x
Reference in New Issue
Block a user