}
function get_course_teachers($courseid, $sort="t.authority ASC") {
- return get_records_sql("SELECT u.* FROM user u, user_teachers t
- WHERE t.course = '$courseid' AND t.user = u.id
+ return get_records_sql("SELECT u.*,t.authority FROM user u, user_teachers t
+ WHERE t.course = '$courseid' AND t.user = u.id
ORDER BY $sort");
}
}
+function valid_uploaded_file($newfile) {
+// Returns current name of file on disk if true
+ if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
+ return $newfile['tmp_name'];
+ } else {
+ return "";
+ }
+}
+
+function get_max_upload_file_size() {
+ if (! $filesize = ini_get("upload_max_filesize")) {
+ $filesize = "5M";
+ }
+ return get_real_size($filesize);
+}
+
+
function get_directory_list($rootdir, $excludefile="") {
// Returns an array with all the filenames in
// all subdirectories, relative to the given rootdir.
$dirs = array();
- $dir = opendir( $rootdir );
+ $dir = opendir($rootdir);
while ($file = readdir($dir)) {
if ($file != "." and $file != ".." and $file != $excludefile) {
}
}
}
+ closedir($dir);
return $dirs;
}
return $size;
}
+function display_size($size) {
+// Converts bytes into display form
+ if ($size >= 1073741824) {
+ $size = round($size / 1073741824 * 10) / 10 . "Gb";
+ } else if ($size >= 1048576) {
+ $size = round($size / 1048576 * 10) / 10 . "Mb";
+ } else if ($size >= 1024) {
+ $size = round($size / 1024 * 10) / 10 . "Kb";
+ } else {
+ $size = $size . "b";
+ }
+ return $size;
+}
+
function clean_filename($string) {
$string = eregi_replace("\.\.", "", $string);
$string = eregi_replace("[^([:alnum:]|\.)]", "_", $string);
} else {
if ($lang == "en") {
- return "ERROR: '$identifier' is missing!";
+ return "[['$identifier']]";
} else { // Try looking in the english file.
$langfile = "$langpath/en/$module.php";
eval($result);
return $resultstring;
} else {
- return "ERROR: '$identifier' is missing!";
+ return "[['$identifier']]";
}
}
}