summaryrefslogtreecommitdiff
path: root/read.php
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2007-06-13 16:26:23 +0000
committerwjames5 <will@tekimaki.com>2007-06-13 16:26:23 +0000
commitf999b18d3adb5685691347f9496d5815f1d73808 (patch)
tree5cab1e9bd04af0273dd014a7581a12398494568b /read.php
parent95d27f685e8154736cd50f6c1a2ac63e06f26d84 (diff)
downloadarticles-f999b18d3adb5685691347f9496d5815f1d73808.tar.gz
articles-f999b18d3adb5685691347f9496d5815f1d73808.tar.bz2
articles-f999b18d3adb5685691347f9496d5815f1d73808.zip
hide future articles from those who should not see them
Diffstat (limited to 'read.php')
-rw-r--r--read.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/read.php b/read.php
index 5fbbce4..8c0fa84 100644
--- a/read.php
+++ b/read.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.18 2007/04/23 09:36:30 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_articles/read.php,v 1.19 2007/06/13 16:26:23 wjames5 Exp $
* @package article
* @subpackage functions
*/
@@ -26,6 +26,11 @@ if( !$gBitUser->hasPermission( 'p_articles_read' ) ) {
include_once( ARTICLES_PKG_PATH.'lookup_article_inc.php' );
+// Check if we actually have some content
+if( !$gContent->isValid() ) {
+ $gBitSystem->fatalError( tra( 'Article cannot be found' ));
+}
+
// additionally we need to check if this article is a submission and see if user has perms to view it.
if( $gContent->getField( 'status_id' ) != ARTICLE_STATUS_APPROVED ) {
if( !( $gBitUser->hasPermission( 'p_articles_edit_submission' ) || $gBitUser->hasPermission( 'p_articles_approve_submission' ))) {
@@ -33,6 +38,12 @@ if( $gContent->getField( 'status_id' ) != ARTICLE_STATUS_APPROVED ) {
}
}
+// we also need to check and see if the article is future dated - we will display it if the user can edit it otherwise we pretend it does not exist.
+$timestamp = $gBitSystem->getUTCTime();
+if ( ($gContent->mInfo['publish_date'] > $timestamp) && !$gBitUser->hasPermission( 'p_articles_edit' ) ){
+ $gBitSystem->fatalError( tra( 'Article cannot be found' ));
+}
+
$gContent->addHit();
$gBitSmarty->assign_by_ref( 'article', $gContent->mInfo );