blogs
[ class tree: blogs ] [ index: blogs ] [ all elements ]

Source for file view_post.php

Documentation is available at view_post.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  *
  5.  * @package blogs
  6.  * @subpackage functions
  7.  */
  8.  
  9. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  10. // All Rights Reserved. See below for details and a complete list of authors.
  11. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  12.  
  13. /**
  14.  * required setup
  15.  */
  16. require_once( '../kernel/setup_inc.php' );
  17.  
  18. $gBitSystem->verifyPackage( 'blogs' );
  19.  
  20. require_once( BLOGS_PKG_PATH.'BitBlogPost.php' );
  21.  
  22. include_once( BLOGS_PKG_PATH.'lookup_post_inc.php' );
  23.  
  24. if( !$gContent->isValid() ) {
  25.     $gBitSystem->setHttpStatus( 404 );
  26.     $gBitSystem->fatalError( "The blog post you requested could not be found." );
  27. }
  28.  
  29. $gContent->verifyViewPermission();
  30.  
  31. $now = $gBitSystem->getUTCTime();
  32. $view = FALSE;
  33.  
  34. if ( $gContent->hasAdminPermission()  || ( $gContent->hasUserPermission( 'p_blog_posts_read_future' ) && $gContent->hasUserPermission( 'p_blog_posts_read_expired' ) ) ){
  35.     $view = TRUE;
  36. }elseif ( $gContent->mInfo['publish_date'] == $gContent->mInfo['expire_date'] ) {
  37.     $view = TRUE;
  38. }elseif ( $gContent->mInfo['publish_date'] > $now && $gContent->hasUserPermission( 'p_blog_posts_read_future' ) ){
  39.     $view = TRUE;
  40. }elseif ( $gContent->mInfo['expire_date'] < $now && $gContent->hasUserPermission( 'p_blog_posts_read_expired' ) ){
  41.     $view = TRUE;
  42. }elseif ( ( $gContent->mInfo['publish_date'] <= $now ) && ( $gContent->mInfo['expire_date'] > $now || $gContent->mInfo['expire_date'] <= $gContent->mInfo['publish_date'] ) ){
  43.     $view = TRUE;
  44. }
  45.  
  46. if ($view == TRUE){
  47.     include_once( BLOGS_PKG_PATH.'display_bitblogpost_inc.php' );
  48. }else{
  49.     $gBitSystem->setHttpStatus( 404 );
  50.     $gBitSystem->fatalError( "The blog post you requested could not be found." );
  51. }
  52.  
  53. if( $gContent->isValid() ) {
  54.     $gContent->addHit();
  55. }
  56. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:33 +0000 by phpDocumentor 1.5.0-lsces