From 9bd49dfa3bf144b08f07f8351f181eb2a9d9f5c1 Mon Sep 17 00:00:00 2001 From: defacer Date: Sun, 2 Oct 2005 15:46:06 +0000 Subject: [PATCH] Code readability improvements and fixed a notice --- blocks/rss_client/block_rss_client_action.php | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index 50b4f2291da..8fc80e82211 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -45,26 +45,19 @@ if (!empty($id)) { $straddedit = get_string('feedsaddedit', 'block_rss_client'); if ( isadmin() ) { - $stradmin = get_string('administration'); - $strconfiguration = get_string('configuration'); - $navigation = "wwwroot/$CFG->admin/index.php\">$stradmin -> ". - "wwwroot/$CFG->admin/configure.php\">$strconfiguration -> $straddedit"; + $navigation = ''.get_string('administration').' -> '. + ''.get_string('configuration').' -> '.$straddedit; } else if (!empty($course)) { - $navigation = "wwwroot/course/view.php?id=$id\">$course->shortname -> $straddedit"; + $navigation = ''.$course->shortname.' -> '.$straddedit; } else { $navigation = $straddedit; } -print_header(get_string('feedsaddedit', 'block_rss_client'), - get_string('feedsaddedit', 'block_rss_client'), - $navigation ); +print_header($straddedit, $straddedit, $navigation); //check to make sure that the user is allowed to post new feeds $submitters = $CFG->block_rss_client_submitters; -$isteacher = false; -if (!empty($course)) { - $isteacher = isteacher($id); -} +$isteacher = empty($course) ? false : isteacher($id); if ($act == NULL) { rss_display_feeds($id); @@ -79,7 +72,7 @@ if ($rssid != NULL) { //if the user is an admin or course teacher then allow the user to //assign categories to other uses than personal -if ($rss_record != NULL && !( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || +if (isset($rss_record) && !( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) || ( ($act == 'rss_edit' || $act == 'delfeed' || $act == 'updfeed') && $USER->id == $rss_record->userid) ) ) { error(get_string('noguestpost', 'forum').' You are not allowed to make modifications to this RSS feed at this time.', $referrer); @@ -186,9 +179,7 @@ if ($act == 'updfeed') { } // echo "DEBUG: act = delfeed"; //debug - //Daryl Hawes note: convert this sql statement to a moodle function call - $sql = 'DELETE FROM '. $CFG->prefix .'block_rss_client WHERE id='. $rssid; - $res= $db->Execute($sql); + delete_records('block_rss_client', 'id', $rssid); redirect($referrer, get_string('feeddeleted', 'block_rss_client') );