Merged 1.6 version into 1.5 because bugs were fixed
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
<?php //$Id$
|
||||
|
||||
/*******************************************************************
|
||||
* This file contains one class which...
|
||||
* This file contains one class which defines a block for display on
|
||||
* any Moodle page. This block can be configured to display the contents
|
||||
* of a remote RSS news feed in your web site.
|
||||
*
|
||||
* @todo Finish documenting this file
|
||||
* @author Daryl Hawes
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package base
|
||||
******************************************************************/
|
||||
|
||||
/**
|
||||
* This class is for a block which....
|
||||
* @todo Finish documenting this class
|
||||
*/
|
||||
|
||||
// Developer's debug assistant - if true then the display string will not cache, only
|
||||
// the magpie object's built in caching will be used
|
||||
define('BLOCK_RSS_SECONDARY_CACHE_ENABLED', true);
|
||||
|
||||
class block_rss_client extends block_base {
|
||||
/**
|
||||
* This class is for a block which defines a block for display on
|
||||
* any Moodle page.
|
||||
*/
|
||||
class block_rss_client extends block_base {
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('feedstitle', 'block_rss_client');
|
||||
@@ -40,7 +40,7 @@ class block_rss_client extends block_base {
|
||||
$this->title = get_string('remotenewsfeed', 'block_rss_client');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_content() {
|
||||
global $CFG, $editing;
|
||||
|
||||
@@ -53,7 +53,7 @@ class block_rss_client extends block_base {
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = '';
|
||||
$this->content->footer = '';
|
||||
|
||||
|
||||
if (empty($this->instance)) {
|
||||
// We're being asked for content without an associated instance
|
||||
return $this->content;
|
||||
@@ -128,11 +128,11 @@ class block_rss_client extends block_base {
|
||||
$count ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->content->text = $output;
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
|
||||
function instance_allow_multiple() {
|
||||
return true;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ class block_rss_client extends block_base {
|
||||
function instance_allow_config() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $rssid The feed to be displayed
|
||||
* @param bool $display_description Should the description information from the feed be displayed or simply the title?
|
||||
@@ -161,7 +161,7 @@ class block_rss_client extends block_base {
|
||||
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
|
||||
define('MAGPIE_OUTPUT_ENCODING', get_string('thischarset')); // see bug 3107
|
||||
}
|
||||
|
||||
|
||||
// Check if there is a cached string which has not timed out.
|
||||
if (BLOCK_RSS_SECONDARY_CACHE_ENABLED &&
|
||||
isset($this->config->{'rssid'. $rssid}) &&
|
||||
@@ -174,7 +174,6 @@ class block_rss_client extends block_base {
|
||||
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
if (isset($rss_record) && isset($rss_record->id)) {
|
||||
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
@@ -182,7 +181,7 @@ class block_rss_client extends block_base {
|
||||
$rss = fetch_rss($rss_record->url);
|
||||
$rsserror = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
if ($rss === false) {
|
||||
if ($CFG->debug && !empty($rsserror)) {
|
||||
// There was a failure in loading the rss feed, print link to full error text
|
||||
@@ -218,7 +217,7 @@ class block_rss_client extends block_base {
|
||||
if (empty($rss) || empty($rss->items)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
foreach ($rss->items as $item) {
|
||||
$item['title'] = stripslashes_safe(rss_unhtmlentities($item['title']));
|
||||
$item['description'] = stripslashes_safe(rss_unhtmlentities($item['description']));
|
||||
@@ -228,7 +227,7 @@ class block_rss_client extends block_base {
|
||||
} else {
|
||||
$item['title'] = break_up_long_words($item['title'], 30);
|
||||
}
|
||||
|
||||
|
||||
if ($item['link'] == '') {
|
||||
$item['link'] = $item['guid'];
|
||||
}
|
||||
@@ -237,7 +236,6 @@ class block_rss_client extends block_base {
|
||||
|
||||
$returnstring .= '<div class="link"><a href="'. $item['link'] .'" target="_blank">'. $item['title'] . '</a></div>' ."\n";
|
||||
|
||||
|
||||
if ($display_description && !empty($item['description'])) {
|
||||
$item['description'] = break_up_long_words($item['description'], 30);
|
||||
$returnstring .= '<div class="description">'.
|
||||
@@ -264,7 +262,7 @@ class block_rss_client extends block_base {
|
||||
$this->title = $feedtitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// store config setting for this rssid so we do not need to read from file each time
|
||||
$this->config->{'rssid'. $rssid} = addslashes($returnstring);
|
||||
$this->config->{'rssid'. $rssid .'timestamp'} = $now;
|
||||
@@ -272,4 +270,4 @@ class block_rss_client extends block_base {
|
||||
return $returnstring;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php //$Id$
|
||||
|
||||
/*******************************************************************
|
||||
* This file contains one class which...
|
||||
* This file contains no classes. It will display a list of existing feeds
|
||||
* defined for the site and allow add/edit/delete of site feeds.
|
||||
*
|
||||
* @author Daryl Hawes
|
||||
* @version $Id$
|
||||
@@ -9,240 +10,237 @@
|
||||
* @package base
|
||||
******************************************************************/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir .'/rsslib.php');
|
||||
require_once(MAGPIE_DIR .'rss_fetch.inc');
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir .'/rsslib.php');
|
||||
require_once(MAGPIE_DIR .'rss_fetch.inc');
|
||||
|
||||
require_login();
|
||||
global $USER;
|
||||
|
||||
//ensure that the logged in user is not using the guest account
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$referrer = $_SERVER['HTTP_REFERER'];
|
||||
} else {
|
||||
$referrer = $CFG->wwwroot;
|
||||
}
|
||||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
}
|
||||
require_login();
|
||||
global $USER;
|
||||
|
||||
$act = optional_param('act', 'none' );
|
||||
$rssid = optional_param('rssid', 'none' );
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$url = optional_param('url');
|
||||
$preferredtitle = optional_param('preferredtitle', '');
|
||||
$item = optional_param('item');
|
||||
//ensure that the logged in user is not using the guest account
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$referrer = $_SERVER['HTTP_REFERER'];
|
||||
} else {
|
||||
$referrer = $CFG->wwwroot;
|
||||
}
|
||||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
}
|
||||
|
||||
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
|
||||
define('MAGPIE_OUTPUT_ENCODING', get_string('thischarset')); // see bug 3107
|
||||
}
|
||||
$act = optional_param('act', 'none' );
|
||||
$rssid = optional_param('rssid', 'none' );
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$url = optional_param('url');
|
||||
$preferredtitle = optional_param('preferredtitle', '');
|
||||
$item = optional_param('item');
|
||||
|
||||
if (!empty($id)) {
|
||||
// we get the complete $course object here because print_header assumes this is
|
||||
// a complete object (needed for proper course theme settings)
|
||||
$course = get_record('course', 'id', $id);
|
||||
}
|
||||
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
|
||||
define('MAGPIE_OUTPUT_ENCODING', get_string('thischarset')); // see bug 3107
|
||||
}
|
||||
|
||||
$straddedit = get_string('feedsaddedit', 'block_rss_client');
|
||||
if ( isadmin() ) {
|
||||
$stradmin = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$navigation = "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $straddedit";
|
||||
} else if (!empty($course)) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$id\">$course->shortname</a> -> $straddedit";
|
||||
} else {
|
||||
$navigation = $straddedit;
|
||||
}
|
||||
|
||||
print_header(get_string('feedsaddedit', 'block_rss_client'),
|
||||
get_string('feedsaddedit', 'block_rss_client'),
|
||||
$navigation );
|
||||
if (!empty($id)) {
|
||||
// we get the complete $course object here because print_header assumes this is
|
||||
// a complete object (needed for proper course theme settings)
|
||||
$course = get_record('course', 'id', $id);
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
$straddedit = get_string('feedsaddedit', 'block_rss_client');
|
||||
if ( isadmin() ) {
|
||||
$stradmin = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$navigation = "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $straddedit";
|
||||
} else if (!empty($course)) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$id\">$course->shortname</a> -> $straddedit";
|
||||
} else {
|
||||
$navigation = $straddedit;
|
||||
}
|
||||
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
print_header(get_string('feedsaddedit', 'block_rss_client'),
|
||||
get_string('feedsaddedit', 'block_rss_client'),
|
||||
$navigation );
|
||||
|
||||
//if the user is an admin or course teacher then allow the user to
|
||||
//assign categories to other uses than personal
|
||||
if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS ||
|
||||
($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ||
|
||||
( ($act == 'rss_edit' || $act == 'delfeed') && $USER->id == $rss_record->userid) ) ) {
|
||||
//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);
|
||||
}
|
||||
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
|
||||
//if the user is an admin or course teacher then allow the user to
|
||||
//assign categories to other uses than personal
|
||||
if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS ||
|
||||
($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ||
|
||||
( ($act == 'rss_edit' || $act == 'delfeed') && $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);
|
||||
}
|
||||
|
||||
if ($act == 'none') {
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
|
||||
} else if ($act == 'updfeed') {
|
||||
if (empty($url)) {
|
||||
error( 'url not defined for rss feed' );
|
||||
}
|
||||
|
||||
if ($act == 'none') {
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
$message = '';
|
||||
ob_start();
|
||||
$rss = fetch_rss($url);
|
||||
if ($CFG->debug) {
|
||||
$message .= ob_get_contents();
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
$dataobject->id = $rssid;
|
||||
if ($rss === false) {
|
||||
$dataobject->description = '';
|
||||
$dataobject->title = '';
|
||||
$dataobject->preferredtitle = '';
|
||||
} else {
|
||||
$dataobject->description = addslashes(rss_unhtmlentities($rss->channel['description']));
|
||||
$dataobject->title = addslashes(rss_unhtmlentities($rss->channel['title']));
|
||||
$dataobject->preferredtitle = addslashes($preferredtitle);
|
||||
}
|
||||
$dataobject->url = addslashes($url);
|
||||
|
||||
if (!update_record('block_rss_client', $dataobject)) {
|
||||
error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
}
|
||||
|
||||
$message .= '<br />'. get_string('feedupdated', 'block_rss_client');
|
||||
redirect($referrer, $message);
|
||||
|
||||
} else if ($act == 'addfeed' ) {
|
||||
|
||||
if (empty($url)) {
|
||||
error('url not defined for rss feed');
|
||||
}
|
||||
$dataobject->userid = $USER->id;
|
||||
$dataobject->description = '';
|
||||
$dataobject->title = '';
|
||||
$dataobject->url = addslashes($url);
|
||||
$dataobject->preferredtitle = addslashes($preferredtitle);
|
||||
|
||||
$rssid = insert_record('block_rss_client', $dataobject);
|
||||
if (!$rssid) {
|
||||
error('There was an error trying to add a new rss feed:'. $url);
|
||||
}
|
||||
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
$message = '';
|
||||
ob_start();
|
||||
$rss = fetch_rss($url);
|
||||
if ($CFG->debug) {
|
||||
$message .= ob_get_contents();
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
if ($rss === false) {
|
||||
$message .= '<br /><br />There was an error loading this rss feed. You may want to verify the url you have specified before using it.'; //Daryl Hawes note: localize this line
|
||||
} else {
|
||||
|
||||
} else if ($act == 'updfeed') {
|
||||
if (empty($url)) {
|
||||
error( 'url not defined for rss feed' );
|
||||
}
|
||||
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
$message = '';
|
||||
ob_start();
|
||||
$rss = fetch_rss($url);
|
||||
if ($CFG->debug) {
|
||||
$message .= ob_get_contents();
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
$dataobject->id = $rssid;
|
||||
if ($rss === false) {
|
||||
$dataobject->description = '';
|
||||
$dataobject->title = '';
|
||||
$dataobject->preferredtitle = '';
|
||||
} else {
|
||||
if (!empty($rss->channel['description'])) {
|
||||
$dataobject->description = addslashes(rss_unhtmlentities($rss->channel['description']));
|
||||
$dataobject->title = addslashes(rss_unhtmlentities($rss->channel['title']));
|
||||
$dataobject->preferredtitle = addslashes($preferredtitle);
|
||||
}
|
||||
$dataobject->url = addslashes($url);
|
||||
|
||||
if (!empty($rss->channel['title'])) {
|
||||
$dataobject->title = addslashes(rss_unhtmlentities($rss->channel['title']));
|
||||
}
|
||||
if (!update_record('block_rss_client', $dataobject)) {
|
||||
error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
}
|
||||
$message .= '<br />'. get_string('feedadded', 'block_rss_client');
|
||||
}
|
||||
redirect($referrer, $message);
|
||||
/*
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle, $id);
|
||||
*/
|
||||
} else if ( $act == 'rss_edit') {
|
||||
|
||||
$message .= '<br />'. get_string('feedupdated', 'block_rss_client');
|
||||
redirect($referrer, $message);
|
||||
$preferredtitle = stripslashes_safe($rss_record->preferredtitle);
|
||||
if (empty($preferredtitle)) {
|
||||
$preferredtitle = stripslashes_safe($rss_record->title);
|
||||
}
|
||||
$url = stripslashes_safe($rss_record->url);
|
||||
rss_display_feeds($id, '', $rssid);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
|
||||
} else if ($act == 'addfeed' ) {
|
||||
} else if ($act == 'delfeed') {
|
||||
|
||||
if (empty($url)) {
|
||||
error('url not defined for rss feed');
|
||||
}
|
||||
$dataobject->userid = $USER->id;
|
||||
$dataobject->description = '';
|
||||
$dataobject->title = '';
|
||||
$dataobject->url = addslashes($url);
|
||||
$dataobject->preferredtitle = addslashes($preferredtitle);
|
||||
$file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
$rssid = insert_record('block_rss_client', $dataobject);
|
||||
if (!$rssid) {
|
||||
error('There was an error trying to add a new rss feed:'. $url);
|
||||
}
|
||||
// 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);
|
||||
|
||||
redirect($referrer, get_string('feeddeleted', 'block_rss_client') );
|
||||
|
||||
} else if ($act == 'view') {
|
||||
// echo $sql; //debug
|
||||
// print_object($res); //debug
|
||||
if (!$rss_record->id) {
|
||||
print '<strong>'. get_string('couldnotfindfeed', 'block_rss_client') .': '. $rssid .'</strong>';
|
||||
} else {
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
$message = '';
|
||||
ob_start();
|
||||
$rss = fetch_rss($url);
|
||||
if ($CFG->debug) {
|
||||
$message .= ob_get_contents();
|
||||
}
|
||||
$rss = fetch_rss($rss_record->url);
|
||||
ob_end_clean();
|
||||
|
||||
if ($rss === false) {
|
||||
$message = 'There was an error loading this rss feed. You may want to verify the url you have specified before using it.'; //Daryl Hawes note: localize this line
|
||||
|
||||
if (empty($rss_record->preferredtitle)) {
|
||||
$feedtitle = stripslashes_safe($rss_record->preferredtitle);
|
||||
} else {
|
||||
|
||||
$dataobject->id = $rssid;
|
||||
if (!empty($rss->channel['description'])) {
|
||||
$dataobject->description = addslashes(rss_unhtmlentities($rss->channel['description']));
|
||||
$feedtitle = stripslashes_safe(rss_unhtmlentities($rss->channel['title']));
|
||||
}
|
||||
print '<table align="center" width="50%" cellspacing="1">'."\n";
|
||||
print '<tr><td colspan="2"><strong>'. $feedtitle .'</strong></td></tr>'."\n";
|
||||
for($y=0; $y < count($rss->items); $y++) {
|
||||
$rss->items[$y]['title'] = stripslashes_safe(rss_unhtmlentities($rss->items[$y]['title']));
|
||||
$rss->items[$y]['description'] = stripslashes_safe(rss_unhtmlentities($rss->items[$y]['description']));
|
||||
if ($rss->items[$y]['link'] == '') {
|
||||
$rss->items[$y]['link'] = $rss->items[$y]['guid'];
|
||||
}
|
||||
if (!empty($rss->channel['title'])) {
|
||||
$dataobject->title = addslashes(rss_unhtmlentities($rss->channel['title']));
|
||||
}
|
||||
if (!update_record('block_rss_client', $dataobject)) {
|
||||
error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
|
||||
if ($rss->items[$y]['title'] == '') {
|
||||
$rss->items[$y]['title'] = '>>';
|
||||
}
|
||||
$message .= '<br />'. get_string('feedadded', 'block_rss_client');
|
||||
}
|
||||
redirect($referrer, $message);
|
||||
/*
|
||||
rss_display_feeds();
|
||||
rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle);
|
||||
*/
|
||||
} else if ( $act == 'rss_edit') {
|
||||
|
||||
$preferredtitle = stripslashes_safe($rss_record->preferredtitle);
|
||||
if (empty($preferredtitle)) {
|
||||
$preferredtitle = stripslashes_safe($rss_record->title);
|
||||
}
|
||||
$url = stripslashes_safe($rss_record->url);
|
||||
rss_display_feeds($id, '', $rssid);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
|
||||
} else if ($act == 'delfeed') {
|
||||
|
||||
$file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
redirect($referrer, get_string('feeddeleted', 'block_rss_client') );
|
||||
|
||||
/* rss_display_feeds();
|
||||
rss_get_form($act, $url, $rssid, $preferredtitle);
|
||||
*/
|
||||
} else if ($act == 'view') {
|
||||
// echo $sql; //debug
|
||||
// print_object($res); //debug
|
||||
if (!$rss_record->id) {
|
||||
print '<strong>'. get_string('couldnotfindfeed', 'block_rss_client') .': '. $rssid .'</strong>';
|
||||
} else {
|
||||
// By capturing the output from fetch_rss this way
|
||||
// error messages do not display and clutter up the moodle interface
|
||||
// however, we do lose out on seeing helpful messages like "cache hit", etc.
|
||||
ob_start();
|
||||
$rss = fetch_rss($rss_record->url);
|
||||
ob_end_clean();
|
||||
|
||||
if (empty($rss_record->preferredtitle)) {
|
||||
$feedtitle = stripslashes_safe($rss_record->preferredtitle);
|
||||
print '<tr><td valign="middle">'."\n";
|
||||
print '<a href="'. $rss->items[$y]['link'] .'" target="_blank"><strong>'. $rss->items[$y]['title'];
|
||||
print '</strong></a>'."\n";
|
||||
print '</td>'."\n";
|
||||
if (file_exists($CFG->dirroot .'/blog/lib.php')) {
|
||||
//Blog module is installed - provide "blog this" link
|
||||
print '<td align="right">'."\n";
|
||||
print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?userid='. $userid .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
} else {
|
||||
$feedtitle = stripslashes_safe(rss_unhtmlentities($rss->channel['title']));
|
||||
print '<td> ';
|
||||
}
|
||||
print '<table align="center" width="50%" cellspacing="1">'."\n";
|
||||
print '<tr><td colspan="2"><strong>'. $feedtitle .'</strong></td></tr>'."\n";
|
||||
for($y=0; $y < count($rss->items); $y++) {
|
||||
$rss->items[$y]['title'] = stripslashes_safe(rss_unhtmlentities($rss->items[$y]['title']));
|
||||
$rss->items[$y]['description'] = stripslashes_safe(rss_unhtmlentities($rss->items[$y]['description']));
|
||||
if ($rss->items[$y]['link'] == '') {
|
||||
$rss->items[$y]['link'] = $rss->items[$y]['guid'];
|
||||
}
|
||||
|
||||
if ($rss->items[$y]['title'] == '') {
|
||||
$rss->items[$y]['title'] = '>>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="middle">'."\n";
|
||||
print '<a href="'. $rss->items[$y]['link'] .'" target="_blank"><strong>'. $rss->items[$y]['title'];
|
||||
print '</strong></a>'."\n";
|
||||
print '</td>'."\n";
|
||||
if (file_exists($CFG->dirroot .'/blog/lib.php')) {
|
||||
//Blog module is installed - provide "blog this" link
|
||||
print '<td align="right">'."\n";
|
||||
print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?blogid='. $blogid .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
} else {
|
||||
print '<td> ';
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr><td colspan=2><small>';
|
||||
print $rss->items[$y]['description'] .'</small></td></tr>'."\n";
|
||||
}
|
||||
print '</table>'."\n";
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr><td colspan=2><small>';
|
||||
print $rss->items[$y]['description'] .'</small></td></tr>'."\n";
|
||||
}
|
||||
} else {
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
print '</table>'."\n";
|
||||
}
|
||||
} else {
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
}
|
||||
|
||||
print_footer();
|
||||
?>
|
||||
print_footer();
|
||||
?>
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php //$Id$
|
||||
// Print an error page condition
|
||||
require_once('../../config.php');
|
||||
|
||||
require_once('../../config.php');
|
||||
$error = required_param('error', PARAM_CLEAN);
|
||||
|
||||
$error = required_param('error',PARAM_CLEAN);
|
||||
print_header(get_string('error'),
|
||||
get_string('error'),
|
||||
get_string('error') );
|
||||
|
||||
print_header(get_string('error'),
|
||||
get_string('error'),
|
||||
get_string('error') );
|
||||
print clean_text(urldecode($error));
|
||||
|
||||
print clean_text(urldecode($error));
|
||||
|
||||
print_footer();
|
||||
?>
|
||||
print_footer();
|
||||
?>
|
||||
@@ -17,6 +17,7 @@
|
||||
<?php print_string('clientnumentries', 'block_rss_client') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">block_rss_timeout:</td>
|
||||
<td>
|
||||
@@ -31,6 +32,7 @@
|
||||
<?php print_string('timeout', 'block_rss_client') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">block_rss_client_submitters:</td>
|
||||
<td>
|
||||
@@ -56,13 +58,16 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input type="submit" value="<?php print_string('savechanges') ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td colspan="3" align="center"><a href=" <?php echo $CFG->wwwroot; ?>/blocks/rss_client/block_rss_client_action.php?courseid=<?php echo $courseid; ?>"><?php print_string('feedsaddedit', 'block_rss_client')?></a></center><br /><br />
|
||||
<td colspan="3" align="center"><a href=" <?php echo $CFG->wwwroot; ?>/blocks/rss_client/block_rss_client_action.php?id=<?php
|
||||
if (!isset($id)) {
|
||||
$id = '';
|
||||
}
|
||||
echo $id; ?>"><?php print_string('feedsaddedit', 'block_rss_client')?></a></center><br /><br />
|
||||
</td>
|
||||
</table>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php // $Id$ //
|
||||
require_once($CFG->libdir .'/rsslib.php');
|
||||
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
@@ -7,7 +7,7 @@ $id = optional_param('id', SITEID, PARAM_INT);
|
||||
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
||||
|
||||
/// Print tabs at top
|
||||
$currentaction = optional_param( 'currentaction','',PARAM_ALPHA );
|
||||
$currentaction = optional_param('currentaction', '', PARAM_ALPHA);
|
||||
if (empty($currentaction) || $currentaction == 'configblock') {
|
||||
$currentaction = 'configblock';
|
||||
} else {
|
||||
@@ -38,6 +38,7 @@ if ($currentaction == 'configblock') {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right" width="50%">
|
||||
<?php print_string('shownumentrieslabel', 'block_rss_client') ?>
|
||||
@@ -56,6 +57,7 @@ if ($currentaction == 'configblock') {
|
||||
?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right" width="50%">
|
||||
<?php print_string('choosefeedlabel', 'block_rss_client') ?>
|
||||
@@ -89,12 +91,13 @@ if ($currentaction == 'configblock') {
|
||||
} else {
|
||||
print_string('nofeeds', 'block_rss_client');
|
||||
if ( isadmin() ) {
|
||||
print ' <a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
|
||||
print ' <a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?id='. $id .'"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right" width="50%"><?php print_string('uploadlabel'); ?></td>
|
||||
<?php
|
||||
@@ -106,6 +109,7 @@ if ($currentaction == 'configblock') {
|
||||
<td width="50%"><input type="text" name="title" size="30" value="<?php echo $title; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right" width="50%"><?php print_string('clientshowchannellinklabel', 'block_rss_client'); ?></td>
|
||||
<td width="50%">
|
||||
@@ -122,6 +126,7 @@ if ($currentaction == 'configblock') {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right" width="50%"><?php print_string('clientshowimagelabel', 'block_rss_client'); ?></td>
|
||||
<td width="50%">
|
||||
@@ -138,6 +143,7 @@ if ($currentaction == 'configblock') {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<input type="submit" value="<?php print_string('savechanges') ?>">
|
||||
@@ -153,4 +159,4 @@ if ($currentaction == 'configblock') {
|
||||
print '</form>'; //not sure that this is needed
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
print '</td></tr></table>';
|
||||
} ?>
|
||||
} ?>
|
||||
@@ -2,21 +2,21 @@
|
||||
/// 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();
|
||||
global $USER;
|
||||
$tabs = $row = array();
|
||||
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id));
|
||||
$row[] = new tabobject('configblock', $script,
|
||||
get_string('configblock', 'block_rss_client'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id));
|
||||
$row[] = new tabobject('configblock', $script,
|
||||
get_string('configblock', 'block_rss_client'));
|
||||
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id));
|
||||
$row[] = new tabobject('managefeeds', $script,
|
||||
get_string('managefeeds', 'block_rss_client'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id));
|
||||
$row[] = new tabobject('managefeeds', $script,
|
||||
get_string('managefeeds', 'block_rss_client'));
|
||||
|
||||
$tabs[] = $row;
|
||||
$tabs[] = $row;
|
||||
|
||||
/// Print out the tabs and continue!
|
||||
print '<div align="center">';
|
||||
print_tabs($tabs, $currentaction);
|
||||
print '</div>';
|
||||
/// Print out the tabs and continue!
|
||||
print '<div align="center">';
|
||||
print_tabs($tabs, $currentaction);
|
||||
print '</div>';
|
||||
?>
|
||||
Reference in New Issue
Block a user