From 538a22102bd717924c9bc4203cfbbf4e77e34215 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 25 Jan 2005 17:39:55 +0000 Subject: [PATCH] Removed some THEME stuff --- lib/moodlelib.php | 5 ++- lib/rsslib.php | 81 ++++++++++++++--------------------------------- lib/setup.php | 10 +++--- 3 files changed, 31 insertions(+), 65 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 1451c8ac6c..cbfa9e2668 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2091,7 +2091,7 @@ function remove_admin($userid) { */ function remove_course_contents($courseid, $showfeedback=true) { - global $CFG, $THEME, $USER, $SESSION; + global $CFG, $USER, $SESSION; $result = true; @@ -2245,7 +2245,6 @@ function remove_course_contents($courseid, $showfeedback=true) { /// of the course. * * @uses $USER - * @uses $THEME * @uses $SESSION * @uses $CFG * @param int $courseid The id of the course that is being viewed @@ -2262,7 +2261,7 @@ function remove_course_userdata($courseid, $showfeedback=true, $removestudents=true, $removeteachers=false, $removegroups=true, $removeevents=true, $removelogs=false) { - global $CFG, $THEME, $USER, $SESSION; + global $CFG, $USER, $SESSION; $result = true; diff --git a/lib/rsslib.php b/lib/rsslib.php index 0ad5a7e861..0b22b23310 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -4,7 +4,7 @@ //This function returns the icon (from theme) with the link to rss/file.php function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext='') { - global $CFG, $THEME, $USER; + global $CFG, $USER; static $pixpath = ''; static $rsspath = ''; @@ -21,15 +21,7 @@ function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext='') { $rsspath = "$CFG->wwwroot/rss/file.php?file=/$courseid/$userid/$modulename/$id/rss.xml"; } - if (empty($pixpath)) { - if (empty($THEME->custompix)) { - $pixpath = $CFG->wwwroot .'/pix'; - } else { - $pixpath = $CFG->wwwroot .'/theme/'. $CFG->theme .'/pix'; - } - } - - $rsspix = $pixpath .'/i/rss.gif'; + $rsspix = $CFG->pixpath .'/i/rss.gif'; return ''; @@ -132,7 +124,7 @@ function rss_file_name($modname, $mod) { //This function return all the common headers for every rss feed in the site function rss_standard_header($title = NULL, $link = NULL, $description = NULL) { - global $CFG, $THEME, $USER; + global $CFG, $USER; static $pixpath = ''; @@ -178,15 +170,7 @@ function rss_standard_header($title = NULL, $link = NULL, $description = NULL) { } //write image info - //Calculate the origin - if (empty($pixpath)) { - if (empty($THEME->custompix)) { - $pixpath = "$CFG->wwwroot/pix"; - } else { - $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix"; - } - } - $rsspix = $pixpath."/i/rsssitelogo.gif"; + $rsspix = $CFG->pixpath."/i/rsssitelogo.gif"; //write the info $result .= rss_start_tag("image",2,true); @@ -355,70 +339,53 @@ define('SUBMITTERS_ADMIN_AND_TEACHER', 2); * @param int $rssid . */ function rss_display_feeds($rssid='none') { - global $db, $USER, $CFG, $THEME; + global $db, $USER, $CFG; 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'; + $rsspix = $CFG->pixpath .'/i/rss.gif'; $closeTable = false; - //Daryl Hawes note: convert this sql statement to a moodle function call if ($rssid != 'none'){ - $sql = 'SELECT * FROM '. $CFG->prefix .'block_rss_client WHERE id='. $rssid; + $feeds = get_records('block_rss_client', 'id', $rssid); } else { - $sql = 'SELECT * FROM '. $CFG->prefix .'block_rss_client'; + $feeds = get_records('block_rss_client'); } - $res = $db->Execute($sql); -// print_object($res); //debug - - if ($res->fields){ + if ($feeds){ $closeTable = true; ?> - + fields){ - while(!$res->EOF) { + foreach ($feeds as $feed) { $editString = ' '; $deleteString = ' '; - if ($res->fields['userid'] == $USER->id || isadmin()) { - $editString = ''; + if ($feed->userid == $USER->id || isadmin()) { + $editString = ''; $editString .= ''. get_string('edit');
                 $editString .= ''; - $deleteString = 'wwwroot .'/blocks/rss_client/block_rss_client_action.php?act=delfeed&rssid='. $feed->id; $deleteString .= '&blogid='. $blogid .'" onClick="return confirm(\''. get_string('block_rss_delete_feed_confirm', 'block_rss_client') .'\');">'; $deleteString .= ''. get_string('delete');
                 $deleteString .= ''; } - print ''; - print '' ."\n"; - print '' ."\n"; - print ''."\n"; - $res->MoveNext(); + echo ''; + echo '' ."\n"; + echo '' ."\n"; + echo ''."\n"; } } if ($closeTable){ - print '
'. $res->fields['title'] .'
' ."\n"; - print ''. $res->fields['url'] .'
'."\n"; - print $res->fields['description'] .'
' ."\n"; - print '
'. $editString .''. $deleteString .'
'. $feed->title .'
' ."\n"; + echo ''. $feed->url .'
'."\n"; + echo $feed->description .'
' ."\n"; + echo '
'. $editString .''. $deleteString .'
'."\n"; + echo ''."\n"; } } @@ -479,4 +446,4 @@ function rss_get_form($act, $url, $rssid, $rsstype, $printnow=true) { } return $returnstring; } -?> \ No newline at end of file +?> diff --git a/lib/setup.php b/lib/setup.php index fff77cbdb1..08b32165d0 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -218,11 +218,7 @@ global $THEME; } include($CFG->dirroot .'/theme/'. $CFG->theme .'/config.php'); - $CFG->stylesheet = $CFG->wwwroot .'/theme/'. $CFG->theme .'/styles.php'; - $CFG->header = $CFG->dirroot .'/theme/'. $CFG->theme .'/header.html'; - $CFG->footer = $CFG->dirroot .'/theme/'. $CFG->theme .'/footer.html'; - - if (empty($THEME->custompix)) { + if (empty($CFG->custompix)) { // Could be set in the above file $CFG->pixpath = $CFG->wwwroot .'/pix'; $CFG->modpixpath = $CFG->wwwroot .'/mod'; } else { @@ -230,6 +226,10 @@ global $THEME; $CFG->modpixpath = $CFG->wwwroot .'/theme/'. $CFG->theme .'/pix/mod'; } + $CFG->stylesheet = $CFG->wwwroot .'/theme/'. $CFG->theme .'/styles.php'; + $CFG->header = $CFG->dirroot .'/theme/'. $CFG->theme .'/header.html'; + $CFG->footer = $CFG->dirroot .'/theme/'. $CFG->theme .'/footer.html'; + /// A hack to get around magic_quotes_gpc being turned off -- 2.39.5