Skip to content

Commit

Permalink
fix for ugly url problem
Browse files Browse the repository at this point in the history
  • Loading branch information
dhawes committed May 17, 2005
1 parent 73ffd0a commit e413129
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions blocks/rss_client/block_rss_client.php
Expand Up @@ -87,7 +87,7 @@ function get_content() {
}
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'));
Expand Down Expand Up @@ -217,7 +217,7 @@ function get_rss_by_id($rssid, $display_description, $shownumentries, $showtitle
$returnstring .= '<div class="link"><a href="'. $item['link'] .'" target="_new">'. $item['title'] . '</a></div>' ."\n";


if ($display_description && !empty($item['description'])){
if ($display_description && !empty($item['description'])) {
$item['description'] = break_up_long_words($item['description'], 30);
$returnstring .= '<div class="description">'.
format_text($item['description'], FORMAT_MOODLE, $formatoptions, $this->courseid) .
Expand Down
8 changes: 4 additions & 4 deletions blocks/rss_client/block_rss_client_action.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 '<strong>'. get_string('block_rss_could_not_find_feed', 'block_rss_client') .': '. $rssid .'</strong>';
} else {
// By capturing the output from fetch_rss this way
Expand Down
17 changes: 11 additions & 6 deletions blocks/rss_client/config_instance.html
@@ -1,12 +1,17 @@
<?php
require_once($CFG->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') {
$currentaction = 'configblock';
} else {
$currentaction = 'managefeeds';
}

include('config_instance_tabs.php');

if ($currentaction == 'configblock') {
Expand Down Expand Up @@ -66,7 +71,7 @@
}
}
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 {
Expand Down Expand Up @@ -95,7 +100,7 @@

} else {
print_string('block_rss_no_feeds', 'block_rss_client');
if ( isadmin() ){
if ( isadmin() ) {
print '&nbsp;<a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php"> '. get_string('block_rss_edit_news_feeds', 'block_rss_client') .'</a><br />';
}
}
Expand Down Expand Up @@ -154,10 +159,10 @@
<?php
} else {
global $act, $url, $rssid, $preferredtitle;
echo '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
echo '<tr valign="top"><td>';
print '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
print '<tr valign="top"><td>';
rss_display_feeds();
echo '</form>';
print '</form>'; //not sure that this is needed
rss_get_form($act, $url, $rssid, $preferredtitle);
echo '</td></tr></table>';
print '</td></tr></table>';
} ?>
7 changes: 5 additions & 2 deletions blocks/rss_client/config_instance_tabs.php
Expand Up @@ -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().'&amp;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().'&amp;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;
Expand Down

0 comments on commit e413129

Please sign in to comment.