From bab450a05a3f4de9f556d530463ebcfe90c71dde Mon Sep 17 00:00:00 2001 From: dhawes Date: Thu, 20 Jan 2005 01:35:04 +0000 Subject: [PATCH] cleaned up some quotes. Removed reference to blog for an image, now use the standard rss xml.gif image from moodle install --- rss/rsslib.php | 57 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/rss/rsslib.php b/rss/rsslib.php index 15453fba9c..9cb24e3231 100644 --- a/rss/rsslib.php +++ b/rss/rsslib.php @@ -2,7 +2,7 @@ // This file contains all the common stuff to be used in RSS System //This function returns the icon (from theme) with the link to rss/file.php -function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext="") { +function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext='') { global $CFG, $THEME, $USER; @@ -23,20 +23,20 @@ function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext="") { if (empty($pixpath)) { if (empty($THEME->custompix)) { - $pixpath = "$CFG->wwwroot/pix"; + $pixpath = $CFG->wwwroot .'/pix'; } else { - $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix"; + $pixpath = $CFG->wwwroot .'/theme/'. $CFG->theme .'/pix'; } } - $rsspix = $pixpath."/i/rss.gif"; + $rsspix = $pixpath .'/i/rss.gif'; - return "\"\""; + return ''; } //This function prints the icon (from theme) with the link to rss/file.php -function rss_print_link($courseid, $userid, $modulename, $id, $tooltiptext="") { +function rss_print_link($courseid, $userid, $modulename, $id, $tooltiptext='') { echo rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext); @@ -50,15 +50,15 @@ function cron_rss_feeds () { $status = true; - mtrace(" Generating rssfeeds..."); + mtrace(' Generating rssfeeds...'); //Check for required functions... if(!function_exists('utf8_encode')) { - mtrace(" ERROR: You need to add XML support to your PHP installation!"); + mtrace(' ERROR: You need to add XML support to your PHP installation!'); return true; } - if ($allmods = get_records("modules") ) { + if ($allmods = get_records('modules') ) { foreach ($allmods as $mod) { mtrace(' '.$mod->name.': ', ''); $modname = $mod->name; @@ -72,48 +72,48 @@ function cron_rss_feeds () { mtrace('generating ', '');; $status = $generaterssfeeds(); if (!empty($status)) { - mtrace("...OK"); + mtrace('...OK'); } else { - mtrace("...FAILED"); + mtrace('...FAILED'); } } else { - mtrace("...SKIPPED (failed above)"); + mtrace('...SKIPPED (failed above)'); } } else { - mtrace("...NOT SUPPORTED (function)"); + mtrace('...NOT SUPPORTED (function)'); } } else { - mtrace("...NOT SUPPORTED (file)"); + mtrace('...NOT SUPPORTED (file)'); } } } - mtrace(" Ending rssfeeds...", ''); + mtrace(' Ending rssfeeds...', ''); if (!empty($status)) { - mtrace("...OK"); + mtrace('...OK'); } else { - mtrace("...FAILED"); + mtrace('...FAILED'); } return $status; } //This function saves to file the rss feed specified in the parameters -function rss_save_file ($modname,$mod,$result) { +function rss_save_file ($modname, $mod, $result) { global $CFG; $status = true; - if (! $basedir = make_upload_directory ("rss/".$modname)) { + if (! $basedir = make_upload_directory ('rss/'. $modname)) { //Cannot be created, so error $status = false; } if ($status) { $file = rss_file_name($modname, $mod); - $rss_file = fopen($file,"w"); + $rss_file = fopen($file, "w"); if ($rss_file) { - $status = fwrite ($rss_file,$result); + $status = fwrite ($rss_file, $result); fclose($rss_file); } else { $status = false; @@ -547,6 +547,17 @@ function rss_display_feeds($rssid='none') { global $db, $USER, $CFG, $THEME; global $blogid; //hackish, but if there is a blogid it would be good to preserve it + static $pixpath = ''; + if (empty($pixpath)) { + if (empty($THEME->custompix)) { + $pixpath = $CFG->wwwroot .'/pix'; + } else { + $pixpath = $CFG->wwwroot .'/theme/'. $CFG->theme .'/pix'; + } + } + + $rsspix = $pixpath .'/i/rss.gif'; + $closeTable = false; //Daryl Hawes note: convert this sql statement to a moodle function call if ($rssid != 'none'){ @@ -587,7 +598,7 @@ $deleteString .= '" title="'. get_string('delete') .'" align="absmiddle" border= print ''. $res->fields['title'] .'
' ."\n"; print $res->fields['description'] .' 
' ."\n"; - print $res->fields['url'] .'  ' ."\n"; + print $res->fields['url'] .'  ' ."\n"; print '(Validate)'; print ''. $editString .'' ."\n"; print ''. $deleteString .'' ."\n"; @@ -692,4 +703,4 @@ if (! function_exists('file_put_contents')){ return $nr_of_bytes; } } -?> +?> \ No newline at end of file -- 2.39.5