Skip to content
Browse files

Some minor issues relating to news syndication.

M main_page.php
- Fixed a notice.

R news.php
- Copied the code of news.php to news_view_page.php to replace the old code and removed this one.

M news_rss.php
- Changed to use news_view_page.php
- Some cleanup of comments.

M news_view_page.php
- Fixed an issue in the checking + added the [Archives] link after the news item.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2337 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information...
1 parent a9becc6 commit 61b0441230c76c1ec66e49edd92f029e19aa6e0b @vboctor vboctor committed
Showing with 75 additions and 105 deletions.
  1. +2 −2 main_page.php
  2. +0 −41 news.php
  3. +55 −25 news_rss.php
  4. +18 −37 news_view_page.php
View
4 main_page.php
@@ -6,7 +6,7 @@
# See the README and LICENSE files for details
# --------------------------------------------------------
- # $Id: main_page.php,v 1.47 2004-02-10 11:37:42 vboctor Exp $
+ # $Id: main_page.php,v 1.48 2004-02-10 13:41:03 vboctor Exp $
# --------------------------------------------------------
?>
<?php
@@ -60,7 +60,7 @@
# get news count (project plus sitewide posts)
$total_news_count = news_get_count( $t_project_id );
- $news_rows = news_get_limited_rows( $p_offset, $t_project_id );
+ $news_rows = news_get_limited_rows( $f_offset, $t_project_id );
$news_count = count( $news_rows );
# Loop through results
View
41 news.php
@@ -1,41 +0,0 @@
-<?php
- # Mantis - a php based bugtracking system
- # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
- # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
- # This program is distributed under the terms and conditions of the GPL
- # See the README and LICENSE files for details
-
- # --------------------------------------------------------
- # $Id: news.php,v 1.1 2004-02-10 11:37:43 vboctor Exp $
- # --------------------------------------------------------
-?>
-<?php
- require_once( 'core.php' );
-
- $t_core_path = config_get( 'core_path' );
-
- require_once( $t_core_path . 'news_api.php' );
- require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'news_inc.php' );
-?>
-<?php
- $f_news_id = gpc_get_int( 'news_id', null );
-?>
-<?php html_page_top1() ?>
-<?php html_page_top2() ?>
-
-<br />
-
-<?php
- if ( $f_news_id !== null ) {
- if ( news_is_private( $f_news_id ) ) {
- access_ensure_project_level( config_get( 'private_news_threshold' ),
- news_get_field( $f_news_id, 'project_id' ) );
- } else {
- access_ensure_project_level( VIEWER );
- }
-
- print_news_string_by_news_id( $f_news_id );
- }
-?>
-
-<?php html_page_bottom1( __FILE__ ) ?>
View
80 news_rss.php
@@ -6,7 +6,7 @@
# See the README and LICENSE files for details
# --------------------------------------------------------
- # $Id: news_rss.php,v 1.1 2004-02-10 11:37:43 vboctor Exp $
+ # $Id: news_rss.php,v 1.2 2004-02-10 13:41:03 vboctor Exp $
# --------------------------------------------------------
?>
<?php
@@ -19,45 +19,63 @@
require_once( $t_core_path . 'project_api.php' );
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'news_inc.php' );
+ # only allow RSS generation of anonymous login is enabled.
+ # @@@ consider adding an explicit option to enable/disable RSS syndication.
if ( OFF == config_get( 'allow_anonymous_login' ) ) {
access_denied();
}
- // Make sure that the user selected either all projects or a public one.
+ # Make sure that the user selected either all projects or a public one.
$f_project_id = gpc_get_int( 'project_id', 0 );
if ( ( $f_project_id != 0 ) && ( VS_PRIVATE == project_get_field( $f_project_id, 'view_state' ) ) ) {
access_denied();
}
- // construct rss file
+ # construct rss file
$encoding = lang_get( 'charset' );
$about = config_get( 'path' );
$title = config_get( 'window_title' );
$description = '';
$image_link = '';
- $category = project_get_name( $f_project_id ); // only rss 2.0
- $cache = '60'; // in minutes (only rss 2.0)
- $rssfile = new RSSBuilder( $encoding, $about, $title, $description, $image_link,
- $category, $cache);
+ # only rss 2.0
+ $category = project_get_name( $f_project_id );
+
+ # in minutes (only rss 2.0)
+ $cache = '60';
+
+ $rssfile = new RSSBuilder( $encoding, $about, $title, $description,
+ $image_link, $category, $cache);
+
+ # person, an organization, or a service
+ $publisher = '';
+
+ # person, an organization, or a service
+ $creator = '';
- /* if you want you can add additional Dublic Core data to the basic rss file (if rss version supports it) */
- $publisher = ''; // person, an organization, or a service
- $creator = ''; // person, an organization, or a service
$date = (string) date('Y-m-d\TH:i:sO');
$language = lang_get( 'phpmailer_language' );
$rights = '';
- $coverage = (string) ''; // spatial location , temporal period or jurisdiction
- $contributor = (string) ''; // person, an organization, or a service
+
+ # spatial location , temporal period or jurisdiction
+ $coverage = (string) '';
+
+ # person, an organization, or a service
+ $contributor = (string) '';
+
$rssfile->addDCdata( $publisher, $creator, $date, $language, $rights, $coverage,
$contributor);
- /* if you want you can add additional Syndication data to the basic rss file (if rss version supports it) */
- $period = (string) 'daily'; // hourly / daily / weekly / ...
- $frequency = (int) 1; // every X hours/days/...
+ # hourly / daily / weekly / ...
+ $period = (string) 'daily';
+
+ # every X hours/days/...
+ $frequency = (int) 1;
+
$base = (string) date('Y-m-d\TH:i:sO');
- $rssfile->addSYdata($period, $frequency, $base);
+
+ $rssfile->addSYdata( $period, $frequency, $base );
$news_rows = news_get_limited_rows( 0 /* offset */, $f_project_id );
@@ -76,20 +94,32 @@
$v_body = string_display_links( $v_body );
$v_date_posted = date( 'Y-m-d\TH:i:sO', $v_date_posted );
- $about = $link = config_get( 'path' ) . "news.php?news_id=$v_id";
+ $about = $link = config_get( 'path' ) . "news_view_page.php?news_id=$v_id";
$title = $v_headline;
$description = $v_body;
- $subject = $title; // optional DC value
- $date = $v_date_posted; // optional DC value
- $author = user_get_name( $v_poster_id ); // author of item
- $comments = ''; // $comments = 'http://flaimo.com/sometext.php?somevariable=somevalue&comments=1'; // url to comment page rss 2.0 value
- $image = ''; // optional mod_im value for dispaying a different pic for every item
+
+ # optional DC value
+ $subject = $title;
+
+ # optional DC value
+ $date = $v_date_posted;
+
+ # author of item
+ $author = user_get_name( $v_poster_id );
+
+ # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1'; # url to comment page rss 2.0 value
+ $comments = '';
+
+ # optional mod_im value for dispaying a different pic for every item
+ $image = '';
+
$rssfile->addItem( $about, $title, $link, $description, $subject, $date,
$author, $comments, $image);
}
- # @@@ should be a configuration option
- $version = '2.0'; // 0.91 / 1.0 / 2.0
+ # @@@ consider making this a configuration option.
+ # 0.91 / 1.0 / 2.0
+ $version = '2.0';
- $rssfile->outputRSS($version);
+ $rssfile->outputRSS( $version );
?>
View
55 news_view_page.php
@@ -6,7 +6,7 @@
# See the README and LICENSE files for details
# --------------------------------------------------------
- # $Id: news_view_page.php,v 1.31 2004-01-11 07:16:07 vboctor Exp $
+ # $Id: news_view_page.php,v 1.32 2004-02-10 13:41:03 vboctor Exp $
# --------------------------------------------------------
?>
<?php
@@ -14,53 +14,34 @@
$t_core_path = config_get( 'core_path' );
- require_once( $t_core_path.'news_api.php' );
- require_once( $t_core_path.'string_api.php' );
+ require_once( $t_core_path . 'news_api.php' );
+ require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'news_inc.php' );
+?>
+<?php
+ $f_news_id = gpc_get_int( 'news_id', null );
?>
-<?php auth_ensure_user_authenticated() ?>
<?php html_page_top1() ?>
<?php html_page_top2() ?>
-<?php
- $f_news_id = gpc_get_int( 'news_id' );
- $row = news_get_row( $f_news_id );
+<br />
- extract( $row, EXTR_PREFIX_ALL, 'v' );
+<?php
+ if ( $f_news_id !== null ) {
+ $t_project_id = news_get_field( $f_news_id, 'project_id' );
+ if ( news_is_private( $f_news_id ) ) {
+ access_ensure_project_level( config_get( 'private_news_threshold' ),
+ $t_project_id );
+ } else {
+ access_ensure_project_level( VIEWER, $t_project_id );
+ }
- access_ensure_project_level( VIEWER, $v_project_id );
- if ( VS_PRIVATE == $v_view_state ) {
- access_ensure_project_level( config_get( 'private_news_threshold' ), $v_project_id );
+ print_news_string_by_news_id( $f_news_id );
}
-
- $v_headline = string_display( $v_headline );
- $v_body = string_display_links( $v_body );
- $v_date_posted = date( config_get( 'normal_date_format' ), $v_date_posted );
?>
-<br />
-<div align="center">
-<table class="width75" cellspacing="0">
-<tr>
- <td class="news-heading">
- <span class="bold"><?php echo $v_headline ?></span> -
- <span class="italic-small"><?php echo $v_date_posted ?></span> -
- <span class="news-email">
- <?php
- print_user( $v_poster_id );
- ?>
- </span>
- </td>
-</tr>
-<tr>
- <td class="news-body">
- <?php echo $v_body ?>
- </td>
-</tr>
-</table>
-</div>
<br />
<div align="center">
- <?php print_bracket_link( 'news_list_page.php', lang_get( 'back_link' ) ) ?>
+ <?php print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) ); ?>
</div>
<?php html_page_bottom1( __FILE__ ) ?>

0 comments on commit 61b0441

Please sign in to comment.
Something went wrong with that request. Please try again.