From: moodler Date: Wed, 28 Jul 2004 05:52:18 +0000 (+0000) Subject: Fixed some notices ... thanks, Eloy! For some reason my server X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b673e40b87dd2bd46347c62a860b1cd858a0c9c4;p=moodle.git Fixed some notices ... thanks, Eloy! For some reason my server isn't displaying these even though it's set up ... --- diff --git a/mod/resource/type/directory/resource.class.php b/mod/resource/type/directory/resource.class.php index 844db00510..ced302d6e7 100644 --- a/mod/resource/type/directory/resource.class.php +++ b/mod/resource/type/directory/resource.class.php @@ -11,7 +11,6 @@ function resource($cmid=0) { function display() { global $CFG, $THEME; - $strresource = get_string("modulename", "resource"); $strresources = get_string("modulenameplural", "resource"); $strlastmodified = get_string("lastmodified"); @@ -19,15 +18,13 @@ function display() { if ($this->course->category) { require_login($this->course->id); $navigation = "framename}\" href=\"../../course/view.php?id={$this->course->id}\">{$this->course->shortname} -> - framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; + framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; } else { - $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; } + $navigation = "framename}\" href=\"index.php?id={$this->course->id}\">$strresources ->"; } require_once("../../files/mimetypes.php"); - if (isset($_GET['subdir'])) { - $subdir = $_GET['subdir']; - } + $subdir = isset($_GET['subdir']) ? $_GET['subdir'] : ''; add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); @@ -37,115 +34,115 @@ function display() { $relativepath = "{$this->course->id}"; } - if ($subdir) { - if (detect_munged_arguments($subdir)) { - error("The value for 'subdir' contains illegal characters!"); - } - $relativepath = "$relativepath$subdir"; - - $subs = explode('/', $subdir); - array_shift($subs); - $countsubs = count($subs); - $count = 0; - $subnav = "cm->id}\">{$this->resource->name}"; - $backsub = ''; - foreach ($subs as $sub) { - $count++; - if ($count < $countsubs) { - $backsub .= "/$sub"; - $subnav .= " -> cm->id}&subdir=$backsub\">$sub"; - } else { - $subnav .= " -> $sub"; - } - } + if ($subdir) { + if (detect_munged_arguments($subdir)) { + error("The value for 'subdir' contains illegal characters!"); + } + $relativepath = "$relativepath$subdir"; + + $subs = explode('/', $subdir); + array_shift($subs); + $countsubs = count($subs); + $count = 0; + $subnav = "cm->id}\">{$this->resource->name}"; + $backsub = ''; + foreach ($subs as $sub) { + $count++; + if ($count < $countsubs) { + $backsub .= "/$sub"; + $subnav .= " -> cm->id}&subdir=$backsub\">$sub"; } else { - $subnav = $this->resource->name; + $subnav .= " -> $sub"; } + } + } else { + $subnav = $this->resource->name; + } + $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); - print_header($pagetitle, $this->course->fullname, "$navigation $subnav", - "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), - navmenu($this->course, $this->cm)); + print_header($pagetitle, $this->course->fullname, "$navigation $subnav", + "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), + navmenu($this->course, $this->cm)); - if (isteacheredit($this->course->id)) { - echo "
pixpath/i/files.gif\" height=16 width=16 alt=\"\"> ". - "wwwroot/files/index.php?id={$this->course->id}&wdir=/{$this->resource->reference}$subdir\">". - get_string("editfiles")."...
"; - } + if (isteacheredit($this->course->id)) { + echo "
pixpath/i/files.gif\" height=16 width=16 alt=\"\"> ". + "wwwroot/files/index.php?id={$this->course->id}&wdir=/{$this->resource->reference}$subdir\">". + get_string("editfiles")."...
"; + } - if (trim($this->resource->summary)) { - print_simple_box(text_to_html($this->resource->summary), "center"); - print_spacer(10,10); - } + if (trim($this->resource->summary)) { + print_simple_box(text_to_html($this->resource->summary), "center"); + print_spacer(10,10); + } - $files = get_directory_list("$CFG->dataroot/$relativepath", 'moddata', false, true, true); + $files = get_directory_list("$CFG->dataroot/$relativepath", 'moddata', false, true, true); - if (!$files) { - print_heading(get_string("nofilesyet")); - print_footer($this->course); - exit; - } + if (!$files) { + print_heading(get_string("nofilesyet")); + print_footer($this->course); + exit; + } - print_simple_box_start("center", "", "$THEME->cellcontent", '0' ); - - $strftime = get_string('strftimedatetime'); - $strname = get_string("name"); - $strsize = get_string("size"); - $strmodified = get_string("modified"); - - echo ''; - echo "". - "". - "". - ""; - foreach ($files as $file) { - if (is_dir("$CFG->dataroot/$relativepath/$file")) { // Must be a directory - $icon = "folder.gif"; - $relativeurl = "/view.php?blah"; - $filesize = display_size(get_directory_size("$CFG->dataroot/$relativepath/$file")); - - } else { - $icon = mimeinfo("icon", $file); - - if ($CFG->slasharguments) { - $relativeurl = "/file.php/$relativepath/$file"; - } else { - $relativeurl = "/file.php?file=/$relativepath/$file"; - } - $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file")); - } - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + print_simple_box_start("center", "", "$THEME->cellcontent", '0' ); + + $strftime = get_string('strftimedatetime'); + $strname = get_string("name"); + $strsize = get_string("size"); + $strmodified = get_string("modified"); + + echo '
$strname$strsize$strmodified
'; - echo "pixpath/f/$icon\" width=\"16\" height=\"16\">"; - echo '

'; - if ($icon == 'folder.gif') { - echo "cm->id}&subdir=$subdir/$file\">$file"; - } else { - link_to_popup_window($relativeurl, "resourcedirectory{$this->resource->id}", "$file", 450, 600, ''); - } - echo '

 

'; - echo $filesize; - echo '

'; - echo userdate(filectime("$CFG->dataroot/$relativepath/$file"), $strftime); - echo '

'; + echo "". + "". + "". + ""; + foreach ($files as $file) { + if (is_dir("$CFG->dataroot/$relativepath/$file")) { // Must be a directory + $icon = "folder.gif"; + $relativeurl = "/view.php?blah"; + $filesize = display_size(get_directory_size("$CFG->dataroot/$relativepath/$file")); + + } else { + $icon = mimeinfo("icon", $file); + + if ($CFG->slasharguments) { + $relativeurl = "/file.php/$relativepath/$file"; + } else { + $relativeurl = "/file.php?file=/$relativepath/$file"; } - echo '
$strname$strsize$strmodified
'; + $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file")); + } + + echo ''; + echo ''; + echo "pixpath/f/$icon\" width=\"16\" height=\"16\">"; + echo ''; + echo '

'; + if ($icon == 'folder.gif') { + echo "cm->id}&subdir=$subdir/$file\">$file"; + } else { + link_to_popup_window($relativeurl, "resourcedirectory{$this->resource->id}", "$file", 450, 600, ''); + } + echo '

'; + echo ' '; + echo '

'; + echo $filesize; + echo '

'; + echo '

'; + echo userdate(filectime("$CFG->dataroot/$relativepath/$file"), $strftime); + echo '

'; + echo ''; + } + echo ''; - print_simple_box_end(); + print_simple_box_end(); - print_footer($this->course); + print_footer($this->course); } - function setup($form) { global $CFG; diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php index a39a35774f..67de708427 100644 --- a/mod/resource/type/file/resource.class.php +++ b/mod/resource/type/file/resource.class.php @@ -202,7 +202,8 @@ function display() { /// First, find out what sort of file we are dealing with. require_once("$CFG->dirroot/files/mimetypes.php"); - $resourcetype = ""; + $querystring = ''; + $resourcetype = ''; $embedded = false; $mimetype = mimeinfo("type", $this->resource->reference); @@ -248,7 +249,7 @@ function display() { if (resource_is_url($this->resource->reference)) { $fullurl = $this->resource->reference; - if ($querystring) { + if (!empty($querystring)) { $urlpieces = parse_url($this->resource->reference); if (empty($urlpieces['query'])) { $fullurl .= '?'.$querystring; @@ -276,6 +277,8 @@ function display() { if ($this->resource->popup and !$inpopup) { /// Make a page and a pop-up window + $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm)); @@ -322,7 +325,7 @@ function display() { /// If we are in a frameset, just print the top of it - if ($_GET['frameset'] == "top") { + if (!empty($_GET['frameset']) and $_GET['frameset'] == "top") { print_header($pagetitle, $this->course->fullname, "$navigation framename\" href=\"$fullurl\">{$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm, "parent")); echo "
".text_to_html($this->resource->summary, true, false)."
"; diff --git a/mod/resource/type/html/resource.class.php b/mod/resource/type/html/resource.class.php index f6e2e4ca3a..a571857ab6 100644 --- a/mod/resource/type/html/resource.class.php +++ b/mod/resource/type/html/resource.class.php @@ -25,6 +25,7 @@ function display() { add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm)); diff --git a/mod/resource/type/reference/resource.class.php b/mod/resource/type/reference/resource.class.php index 70b4cdc029..e2eb281770 100644 --- a/mod/resource/type/reference/resource.class.php +++ b/mod/resource/type/reference/resource.class.php @@ -25,6 +25,7 @@ function display() { add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm)); diff --git a/mod/resource/type/text/resource.class.php b/mod/resource/type/text/resource.class.php index 2d918d3153..1b18bdd645 100644 --- a/mod/resource/type/text/resource.class.php +++ b/mod/resource/type/text/resource.class.php @@ -25,6 +25,8 @@ function display() { add_to_log($this->course->id, "resource", "view", "view.php?id={$this->cm->id}", $this->resource->id, $this->cm->id); + $pagetitle = strip_tags($this->course->shortname.': '.$this->resource->name); + print_header($pagetitle, $this->course->fullname, "$navigation {$this->resource->name}", "", "", true, update_module_button($this->cm->id, $this->course->id, $strresource), navmenu($this->course, $this->cm));