From: defacer Date: Tue, 31 Aug 2004 13:46:25 +0000 (+0000) Subject: Merging goodness from MOODLE_14_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e89fad6b99292320fa3018c690c69ba09d60282b;p=moodle.git Merging goodness from MOODLE_14_STABLE --- diff --git a/mod/resource/coursefiles.php b/mod/resource/coursefiles.php index f5c095b955..2dca6bac28 100644 --- a/mod/resource/coursefiles.php +++ b/mod/resource/coursefiles.php @@ -4,7 +4,7 @@ // This file is a hack to files/index.php that removes // the headers and adds some controls so that images -// can be selected within the Richtext editor. +// can be selected within the Richtext editor. // All the Moodle-specific stuff is in this top section // Configuration and access control occurs here. @@ -32,17 +32,17 @@ function html_footer() { echo ""; } - + function html_header($course, $wdir, $formfield=""){ - global $CFG,$THEME; + global $CFG, $THEME, $ME; if ($course->id == SITEID) { $strfiles = get_string("sitefiles"); } else { $strfiles = get_string("files"); } - + if ($wdir == "/") { $fullnav = "$strfiles"; } else { @@ -53,9 +53,9 @@ for ($i=1; $i<$numdirs; $i++) { $navigation .= " -> "; $link .= "/".urlencode($dirs[$i]); - $navigation .= "id&wdir=$link\">".$dirs[$i].""; + $navigation .= "id&wdir=$link\">".$dirs[$i].""; } - $fullnav = "id&wdir=/\">$strfiles $navigation"; + $fullnav = "id&wdir=/\">$strfiles $navigation"; } print_header(); @@ -97,11 +97,11 @@ $regexp="\\.\\."; - if (ereg( $regexp, $file, $regs )| ereg( $regexp, $wdir,$regs )) { + if (ereg( $regexp, $file, $regs )| ereg( $regexp, $wdir,$regs )) { $message = "Error: Directories can not contain \"..\""; $wdir = "/"; $action = ""; - } + } if (!$wdir) { $wdir="/"; @@ -137,7 +137,7 @@ } } displaydir($wdir); - + } else { $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); $filesize = display_size($upload_max_filesize); @@ -149,7 +149,7 @@ echo "

$struploadafile ($strmaxsize) --> $wdir"; echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -159,7 +159,7 @@ echo " "; echo "
"; echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -191,9 +191,9 @@ printfilelist($USER->filelist); print_simple_box_end(); echo "
"; - notice_yesno (get_string("deletecheckfiles"), - "".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&action=delete&confirm=1", - "".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&action=cancel"); + notice_yesno (get_string("deletecheckfiles"), + "".basename($ME)."?id=$id&wdir=$wdir&action=delete&confirm=1", + "".basename($ME)."?id=$id&wdir=$wdir&action=cancel"); } else { displaydir($wdir); } @@ -241,7 +241,7 @@ echo "Error: could not rename $oldname to $name"; } displaydir($wdir); - + } else { $strrename = get_string("rename"); $strcancel = get_string("cancel"); @@ -249,7 +249,7 @@ html_header($course, $wdir, "form.name"); echo "

$strrenamefileto:"; echo "
"; - echo ""; + echo ""; echo " "; echo " "; echo " "; @@ -258,7 +258,7 @@ echo " "; echo ""; echo ""; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -279,7 +279,7 @@ echo "Error: could not create $name"; } displaydir($wdir); - + } else { $strcreate = get_string("create"); $strcancel = get_string("cancel"); @@ -287,7 +287,7 @@ html_header($course, $wdir, "form.name"); echo "

$strcreatefolder:"; echo "
"; - echo ""; + echo ""; echo " "; echo " "; echo " "; @@ -295,7 +295,7 @@ echo " "; echo ""; echo ""; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -313,7 +313,7 @@ fputs($fileptr, stripslashes($text)); fclose($fileptr); displaydir($wdir); - + } else { $streditfile = get_string("edit", "", "$file"); $fileptr = fopen($basedir.$file, "r"); @@ -335,7 +335,7 @@ print_heading("$streditfile"); echo "
"; - echo ""; + echo ""; echo " "; echo " "; echo " "; @@ -345,7 +345,7 @@ echo " "; echo ""; echo ""; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -353,7 +353,7 @@ echo "
"; echo "
"; - if ($usehtmleditor) { + if ($usehtmleditor) { print_richedit_javascript("form", "text", "yes"); } @@ -387,7 +387,7 @@ } clearfilelist(); displaydir($wdir); - + } else { html_header($course, $wdir, "form.name"); @@ -399,7 +399,7 @@ echo "
"; echo "

".get_string("whattocallzip"); echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -407,7 +407,7 @@ echo " "; echo "
"; echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -463,7 +463,7 @@ } echo "
"; } - + } else { // Use external unzip program print_simple_box_start("center"); echo "

";
@@ -473,7 +473,7 @@
                     print_simple_box_end();
                 }
 
-                echo "
"; + echo "
"; echo " "; echo " "; echo " "; @@ -520,7 +520,7 @@ } echo "
"; } - echo "

"; + echo "
"; echo " "; echo " "; echo " "; @@ -575,13 +575,13 @@ /// FILE FUNCTIONS /////////////////////////////////////////////////////////// -function fulldelete($location) { +function fulldelete($location) { if (is_dir($location)) { $currdir = opendir($location); - while ($file = readdir($currdir)) { + while ($file = readdir($currdir)) { if ($file <> ".." && $file <> ".") { $fullfile = $location."/".$file; - if (is_dir($fullfile)) { + if (is_dir($fullfile)) { if (!fulldelete($fullfile)) { return false; } @@ -589,9 +589,9 @@ function fulldelete($location) { if (!unlink($fullfile)) { return false; } - } + } } - } + } closedir($currdir); if (! rmdir($location)) { return false; @@ -639,14 +639,14 @@ function printfilelist($filelist) { echo "pixpath/f/folder.gif\" height=16 width=16> $file
"; $subfilelist = array(); $currdir = opendir($basedir.$file); - while ($subfile = readdir($currdir)) { + while ($subfile = readdir($currdir)) { if ($subfile <> ".." && $subfile <> ".") { $subfilelist[] = $file."/".$subfile; } } printfilelist($subfilelist); - } else { + } else { $icon = mimeinfo("icon", $file); echo "pixpath/f/$icon\" height=16 width=16> $file
"; } @@ -667,7 +667,7 @@ function displaydir ($wdir) { global $basedir; global $id; - global $USER, $CFG; + global $USER, $CFG, $ME; $fullpath = $basedir.$wdir; @@ -676,7 +676,7 @@ function displaydir ($wdir) { if ($file == "." || $file == "..") { continue; } - + if (is_dir($fullpath."/".$file)) { $dirlist[] = $file; } else { @@ -703,8 +703,8 @@ function displaydir ($wdir) { $strchoose = get_string("choose"); - echo ""; - echo ""; + echo ""; + echo "
"; echo ""; echo ""; echo ""; @@ -729,15 +729,15 @@ function displaydir ($wdir) { $fileurl = rawurlencode($wdir."/".$dir); $filesafe = rawurlencode($dir); $filedate = userdate(filectime($filename), "%d %b %Y, %I:%M %p"); - + echo ""; print_cell("center", ""); - print_cell("left", "pixpath/f/folder.gif\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"Folder\">".htmlspecialchars($dir).""); + print_cell("left", "pixpath/f/folder.gif\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"Folder\">".htmlspecialchars($dir).""); print_cell("right", "-"); print_cell("right", $filedate); - print_cell("right", "$strrename"); - + print_cell("right", "$strrename"); + echo ""; } } @@ -772,8 +772,8 @@ function displaydir ($wdir) { print_cell("center", ""); echo ""; } } @@ -804,7 +804,7 @@ function displaydir ($wdir) { $wdir = "/"; } - echo "
$strname
"; - link_to_popup_window ($ffurl, "display", - "pixpath/f/$icon\" height=16 width=16 border=0 alt=\"file\">", + link_to_popup_window ($ffurl, "display", + "pixpath/f/$icon\" height=16 width=16 border=0 alt=\"file\">", 480, 640); echo ""; link_to_popup_window ($ffurl, "display", htmlspecialchars($file), 480, 640); @@ -786,14 +786,14 @@ function displaydir ($wdir) { $edittext = "$strchoose "; if ($icon == "text.gif" || $icon == "html.gif") { - $edittext .= "$stredit"; + $edittext .= "$stredit"; } else if ($icon == "zip.gif") { - $edittext .= "$strunzip "; - $edittext .= "$strlist "; + $edittext .= "$strunzip "; + $edittext .= "$strlist "; } - print_cell("right", "$edittext $strrename"); - + print_cell("right", "$edittext $strrename"); + echo "
"; + echo "
"; echo ""; echo "
"; echo ""; echo " "; @@ -820,7 +820,7 @@ function displaydir ($wdir) { echo ""; echo ""; if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) { - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -828,7 +828,7 @@ function displaydir ($wdir) { echo "
"; } echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; @@ -836,7 +836,7 @@ function displaydir ($wdir) { echo "
"; echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " ";