mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Various little fixes to remove warnings (usually about empty variables)
when error_reporting is turned up to 15 or so ... more of these to come ...
This commit is contained in:
parent
a900458749
commit
9c9f7d7790
28 changed files with 1600 additions and 65 deletions
|
@ -21,6 +21,7 @@
|
|||
"proxyhost" => "",
|
||||
"proxyport" => "",
|
||||
"maxeditingtime" => 1800,
|
||||
"changepassword" => true,
|
||||
"country" => "",
|
||||
"guestloginbutton" => 1
|
||||
);
|
||||
|
|
|
@ -102,6 +102,11 @@ function format_time($totalsecs, $str=NULL) {
|
|||
$sh = ($hours == 1) ? $str->hour : $str->hours;
|
||||
$sd = ($days == 1) ? $str->day : $str->days;
|
||||
|
||||
$odays = "";
|
||||
$ohours = "";
|
||||
$omins = "";
|
||||
$osecs = "";
|
||||
|
||||
if ($days) $odays = "$days $sd";
|
||||
if ($hours) $ohours = "$hours $sh";
|
||||
if ($mins) $omins = "$mins $sm";
|
||||
|
@ -268,7 +273,7 @@ function require_login($courseid=0) {
|
|||
|
||||
// Next, check if the user can be in a particular course
|
||||
if ($courseid) {
|
||||
if ($USER->student[$courseid] || $USER->teacher[$courseid] || $USER->admin) {
|
||||
if (!empty($USER->student[$courseid]) or !empty($USER->teacher[$courseid]) or !empty($USER->admin)) {
|
||||
if (isset($USER->realuser)) { // Make sure the REAL person can also access this course
|
||||
if (!isteacher($courseid, $USER->realuser)) {
|
||||
print_header();
|
||||
|
@ -416,6 +421,9 @@ function isediting($courseid, $user=NULL) {
|
|||
if (!$user){
|
||||
$user = $USER;
|
||||
}
|
||||
if (empty($user->editing)) {
|
||||
return false;
|
||||
}
|
||||
return ($user->editing and isteacher($courseid, $user->id));
|
||||
}
|
||||
|
||||
|
@ -770,6 +778,9 @@ function make_mod_upload_directory($courseid) {
|
|||
|
||||
function valid_uploaded_file($newfile) {
|
||||
/// Returns current name of file on disk if true
|
||||
if (empty($newfile)) {
|
||||
return "";
|
||||
}
|
||||
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
|
||||
return $newfile['tmp_name'];
|
||||
} else {
|
||||
|
|
|
@ -127,9 +127,9 @@
|
|||
/// then use the one from the default language. Otherwise (and this is the
|
||||
/// majority of cases), use the stored locale specified by admin.
|
||||
|
||||
if ($USER->lang and ($USER->lang != $CFG->lang) ) {
|
||||
if (!empty($USER->lang) and ($USER->lang != $CFG->lang) ) {
|
||||
$CFG->locale = get_string("locale");
|
||||
} else if (!$CFG->locale) {
|
||||
} else if (empty($CFG->locale)) {
|
||||
$CFG->locale = get_string("locale");
|
||||
set_config("locale", $CFG->locale); // cache it to save lookups in future
|
||||
}
|
||||
|
|
|
@ -272,7 +272,10 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
|
|||
|
||||
if ($script) {
|
||||
$javascript = "onChange=\"$script\"";
|
||||
} else {
|
||||
$javascript = "";
|
||||
}
|
||||
|
||||
$output = "<SELECT NAME=$name $javascript>\n";
|
||||
if ($nothing) {
|
||||
$output .= " <OPTION VALUE=\"$nothingvalue\"\n";
|
||||
|
@ -338,14 +341,14 @@ function popup_form ($common, $options, $formname, $selected="", $nothing="choos
|
|||
}
|
||||
}
|
||||
$output .= "</SELECT>";
|
||||
if (!$return and $help) {
|
||||
helpbutton($help, $helptext);
|
||||
}
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
if ($help) {
|
||||
helpbutton($help, $helptext);
|
||||
}
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
@ -612,7 +615,7 @@ function print_footer ($course=NULL) {
|
|||
$realuserinfo = "";
|
||||
}
|
||||
|
||||
if ($USER->id) {
|
||||
if (isset($USER->id) and $USER->id) {
|
||||
$username = "<A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A>";
|
||||
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
|
||||
" (<A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A>)";
|
||||
|
@ -889,7 +892,7 @@ function update_course_icon($courseid) {
|
|||
global $CFG, $USER;
|
||||
|
||||
if (isteacher($courseid)) {
|
||||
if ($USER->editing) {
|
||||
if (!empty($USER->editing)) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue