From e413129c9fd4af334305bc6e7a8d70e57e3951eb Mon Sep 17 00:00:00 2001 From: dhawes Date: Tue, 17 May 2005 14:43:00 +0000 Subject: [PATCH] fix for ugly url problem --- blocks/rss_client/block_rss_client.php | 4 ++-- blocks/rss_client/block_rss_client_action.php | 8 ++++---- blocks/rss_client/config_instance.html | 17 +++++++++++------ blocks/rss_client/config_instance_tabs.php | 7 +++++-- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 279dea4174c..214d6a95e4e 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -87,7 +87,7 @@ class block_rss_client extends block_base { } if ( $userisloggedin && (isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) { - $page = page_create_object($this->instance->pagetype, $this->instance->pageid); + $page = page_create_object($this->instance->pagetype, $this->instance->pageid); if (isset($this->config)) { // this instance is configured - show Add/Edit feeds link $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds')); @@ -217,7 +217,7 @@ class block_rss_client extends block_base { $returnstring .= '' ."\n"; - if ($display_description && !empty($item['description'])){ + if ($display_description && !empty($item['description'])) { $item['description'] = break_up_long_words($item['description'], 30); $returnstring .= '
'. format_text($item['description'], FORMAT_MOODLE, $formatoptions, $this->courseid) . diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index 06addda7019..44c1749f42b 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -8,7 +8,7 @@ global $USER; //ensure that the logged in user is not using the guest account - if (isset($_SERVER['HTTP_REFERER'])){ + if (isset($_SERVER['HTTP_REFERER'])) { $referrer = $_SERVER['HTTP_REFERER']; } else { $referrer = $CFG->wwwroot; @@ -47,7 +47,7 @@ //check to make sure that the user is allowed to post new feeds $submitters = $CFG->block_rss_client_submitters; $isteacher = false; - if ($courseid != 'none'){ + if ($courseid != 'none') { $isteacher = isteacher($courseid); } @@ -102,7 +102,7 @@ $dataobject->preferredtitle = addslashes($preferredtitle); $rssid = insert_record('block_rss_client', $dataobject); - if (!$rssid){ + if (!$rssid) { error('There was an error trying to add a new rss feed:'. $url); } @@ -167,7 +167,7 @@ // echo $sql; //debug // print_object($res); //debug $rss_record = get_record('block_rss_client', 'id', $rssid); - if (!$rss_record->id){ + if (!$rss_record->id) { print ''. get_string('block_rss_could_not_find_feed', 'block_rss_client') .': '. $rssid .''; } else { // By capturing the output from fetch_rss this way diff --git a/blocks/rss_client/config_instance.html b/blocks/rss_client/config_instance.html index e16eb6b8ad6..bb4a47027f1 100644 --- a/blocks/rss_client/config_instance.html +++ b/blocks/rss_client/config_instance.html @@ -1,5 +1,9 @@ libdir .'/rsslib.php'); + +//create a page object for url_get_full() +$page = page_create_object($this->instance->pagetype, $this->instance->pageid); + /// Print tabs at top global $currentaction; if (empty($currentaction) || $currentaction == 'configblock') { @@ -7,6 +11,7 @@ if (empty($currentaction) || $currentaction == 'configblock') { } else { $currentaction = 'managefeeds'; } + include('config_instance_tabs.php'); if ($currentaction == 'configblock') { @@ -66,7 +71,7 @@ if ($currentaction == 'configblock') { } } if ($rssfeeds = get_records('block_rss_client')) { - foreach($rssfeeds as $rssfeed){ + foreach($rssfeeds as $rssfeed) { if (!empty($rssfeed->preferredtitle)) { $feedtitle = stripslashes_safe($rssfeed->preferredtitle); } else { @@ -95,7 +100,7 @@ if ($currentaction == 'configblock') { } else { print_string('block_rss_no_feeds', 'block_rss_client'); - if ( isadmin() ){ + if ( isadmin() ) { print '  '. get_string('block_rss_edit_news_feeds', 'block_rss_client') .'
'; } } @@ -154,10 +159,10 @@ if ($currentaction == 'configblock') { '; - echo ''; + print ''; + print '
'; rss_display_feeds(); - echo ''; + print ''; //not sure that this is needed rss_get_form($act, $url, $rssid, $preferredtitle); - echo '
'; + print ''; } ?> diff --git a/blocks/rss_client/config_instance_tabs.php b/blocks/rss_client/config_instance_tabs.php index 40dd156dcde..1c5704a30c7 100644 --- a/blocks/rss_client/config_instance_tabs.php +++ b/blocks/rss_client/config_instance_tabs.php @@ -2,12 +2,15 @@ /// This file to be included so we can assume config.php has already been included. /// We also assume that $inactive, $activetab and $currentaction have been set + global $USER; $tabs = $row = array(); - $row[] = new tabobject('configblock', me().'&currentaction=configblock', + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock')); + $row[] = new tabobject('configblock', $script, get_string('block_rss_configblock', 'block_rss_client')); - $row[] = new tabobject('managefeeds', me().'&currentaction=managefeeds', + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds')); + $row[] = new tabobject('managefeeds', $script, get_string('block_rss_managefeeds', 'block_rss_client')); $tabs[] = $row;