Skip to content

Commit

Permalink
Fixed #6987: Add $g_rss_enabled configuration option
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4066 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Apr 25, 2006
1 parent 3ad13ad commit a9a46fd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 18 deletions.
6 changes: 5 additions & 1 deletion config_defaults_inc.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: config_defaults_inc.php,v 1.298 2006-04-25 12:01:06 vboctor Exp $
# $Id: config_defaults_inc.php,v 1.299 2006-04-25 13:18:27 vboctor Exp $
# --------------------------------------------------------


Expand Down Expand Up @@ -1570,6 +1570,10 @@
# RSS Feeds
######################

# This flag enables or disables RSS syndication. In the case where RSS syndication is not used,
# it is recommended to set it to OFF.
$g_rss_enabled = ON;

# This seed is used as part of the inputs for calculating the authentication key for the RSS feeds.
# If this seed changes, all the existing keys for the RSS feeds will become invalid. This is
# defaulted to the database user name, but it is recommended to overwrite it with a specific value
Expand Down
19 changes: 12 additions & 7 deletions core/html_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: html_api.php,v 1.191 2006-04-23 12:32:59 vboctor Exp $
# $Id: html_api.php,v 1.192 2006-04-25 13:18:27 vboctor Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -68,8 +68,10 @@
# null: means no feed (default).
function html_set_rss_link( $p_rss_feed_url )
{
global $g_rss_feed_url;
$g_rss_feed_url = $p_rss_feed_url;
if ( OFF != config_get( 'rss_enabled' ) ) {
global $g_rss_feed_url;
$g_rss_feed_url = $p_rss_feed_url;
}
}

# --------------------
Expand Down Expand Up @@ -344,10 +346,13 @@ function html_login_info() {
}
PRINT '<input type="submit" class="button-small" value="' . lang_get( 'switch' ) . '" />';

# Link to RSS issues feed for the selected project, including authentication details.
PRINT '<a href="' . rss_get_issues_feed_url() . '">';
PRINT '<img src="images/rss.gif" alt="' . lang_get( 'rss' ) . '" style="border-style: none; margin: 5px; vertical-align: middle;" />';
PRINT '</a>';
if ( OFF != config_get( 'rss_enabled' ) ) {
# Link to RSS issues feed for the selected project, including authentication details.
PRINT '<a href="' . rss_get_issues_feed_url() . '">';
PRINT '<img src="images/rss.gif" alt="' . lang_get( 'rss' ) . '" style="border-style: none; margin: 5px; vertical-align: middle;" />';
PRINT '</a>';
}

PRINT '</form>';
PRINT '</td>';
PRINT '</tr>';
Expand Down
7 changes: 6 additions & 1 deletion issues_rss.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: issues_rss.php,v 1.7 2006-04-23 12:32:58 vboctor Exp $
# $Id: issues_rss.php,v 1.8 2006-04-25 13:18:27 vboctor Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -34,6 +34,11 @@
$f_username = gpc_get_string( 'username', null );
$f_key = gpc_get_string( 'key', null );

# make sure RSS syndication is enabled.
if ( OFF == config_get( 'rss_enabled' ) ) {
access_denied();
}

# authenticate the user
if ( $f_username !== null ) {
if ( !rss_login( $f_username, $f_key ) ) {
Expand Down
17 changes: 12 additions & 5 deletions main_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: main_page.php,v 1.58 2006-04-23 12:32:58 vboctor Exp $
# $Id: main_page.php,v 1.59 2006-04-25 13:18:27 vboctor Exp $
# --------------------------------------------------------

# This is the first page a user sees when they login to the bugtracker
Expand All @@ -25,10 +25,15 @@
access_ensure_project_level( VIEWER );

$f_offset = gpc_get_int( 'offset', 0 );

$t_project_id = helper_get_current_project();
$t_rss_link = rss_get_news_feed_url( $t_project_id );
html_set_rss_link( $t_rss_link );

$t_rss_enabled = config_get( 'rss_enabled' );

if ( OFF != $t_rss_enabled ) {
$t_rss_link = rss_get_news_feed_url( $t_project_id );
html_set_rss_link( $t_rss_link );
}

html_page_top1();
html_page_top2();
Expand Down Expand Up @@ -86,7 +91,9 @@
print_bracket_link( 'main_page.php?offset=' . $f_offset_next, lang_get( 'older_news_link' ) );
}

print_bracket_link( $t_rss_link, lang_get( 'rss' ) );
if ( OFF != $t_rss_enabled ) {
print_bracket_link( $t_rss_link, lang_get( 'rss' ) );
}

echo '</div>';

Expand Down
7 changes: 6 additions & 1 deletion news_rss.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: news_rss.php,v 1.10 2006-04-23 12:32:58 vboctor Exp $
# $Id: news_rss.php,v 1.11 2006-04-25 13:18:27 vboctor Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -24,6 +24,11 @@
$f_key = gpc_get_string( 'key', null );
$f_project_id = gpc_get_int( 'project_id', ALL_PROJECTS );

# make sure RSS syndication is enabled.
if ( OFF == config_get( 'rss_enabled' ) ) {
access_denied();
}

# authenticate the user
if ( $f_username !== null ) {
if ( !rss_login( $f_username, $f_key ) ) {
Expand Down
11 changes: 8 additions & 3 deletions query_view_page.php
Expand Up @@ -33,6 +33,8 @@

$t_use_query_url = 'view_all_set.php?type=3&amp;source_query_id=';
$t_delete_query_url = 'query_delete_page.php?source_query_id=';

$t_rss_enabled = config_get( 'rss_enabled' );
?>
<br />
<div align="center">
Expand All @@ -48,9 +50,12 @@

print '<td>';

# Use the "new" RSS link style.
print_rss( rss_get_issues_feed_url( null, null, $t_id ), lang_get( 'rss' ) );
echo ' ';
if ( OFF != $t_rss_enabled ) {
# Use the "new" RSS link style.
print_rss( rss_get_issues_feed_url( null, null, $t_id ), lang_get( 'rss' ) );
echo ' ';
}

print '<a href="' . $t_use_query_url . db_prepare_int( $t_id ) . '">' . string_display( $t_name ) . '</a>';

if ( filter_db_can_delete_filter( $t_id ) ) {
Expand Down

0 comments on commit a9a46fd

Please sign in to comment.