summaryrefslogtreecommitdiff
path: root/view_post.php
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-28 17:12:45 +0100
committerlsces <lester@lsces.co.uk>2025-08-28 17:12:45 +0100
commitca99260af5783d2d12b3f79fbd43a1aadbef15ff (patch)
tree480f93931abd90b5a9982b4e1e577903dbe09520 /view_post.php
parentc29fea0ae79977f09fd7b4706c88f3ecb90a4575 (diff)
downloadblogs-ca99260af5783d2d12b3f79fbd43a1aadbef15ff.tar.gz
blogs-ca99260af5783d2d12b3f79fbd43a1aadbef15ff.tar.bz2
blogs-ca99260af5783d2d12b3f79fbd43a1aadbef15ff.zip
General code updated to PHP8.4 and namespace
Diffstat (limited to 'view_post.php')
-rwxr-xr-x[-rw-r--r--]view_post.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/view_post.php b/view_post.php
index f1323dc..63bc730 100644..100755
--- a/view_post.php
+++ b/view_post.php
@@ -13,13 +13,12 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Blogs\BitBlogPost;
$gBitSystem->verifyPackage( 'blogs' );
-require_once( BLOGS_PKG_CLASS_PATH.'BitBlogPost.php' );
-
-include_once( BLOGS_PKG_INCLUDE_PATH.'lookup_post_inc.php' );
+include_once BLOGS_PKG_INCLUDE_PATH.'lookup_post_inc.php';
if( !$gContent->isValid() ) {
$gBitSystem->setHttpStatus( 404 );
@@ -29,22 +28,22 @@ if( !$gContent->isValid() ) {
$gContent->verifyViewPermission();
$now = $gBitSystem->getUTCTime();
-$view = FALSE;
+$view = false;
if ( $gContent->hasAdminPermission() || ( $gContent->hasUserPermission( 'p_blog_posts_read_future' ) && $gContent->hasUserPermission( 'p_blog_posts_read_expired' ) ) ){
- $view = TRUE;
+ $view = true;
}elseif ( $gContent->mInfo['publish_date'] == $gContent->mInfo['expire_date'] ) {
- $view = TRUE;
+ $view = true;
}elseif ( $gContent->mInfo['publish_date'] > $now && $gContent->hasUserPermission( 'p_blog_posts_read_future' ) ){
- $view = TRUE;
+ $view = true;
}elseif ( $gContent->mInfo['expire_date'] < $now && $gContent->hasUserPermission( 'p_blog_posts_read_expired' ) ){
- $view = TRUE;
+ $view = true;
}elseif ( ( $gContent->mInfo['publish_date'] <= $now ) && ( $gContent->mInfo['expire_date'] > $now || $gContent->mInfo['expire_date'] <= $gContent->mInfo['publish_date'] ) ){
- $view = TRUE;
+ $view = true;
}
-if ($view == TRUE){
- include_once( BLOGS_PKG_INCLUDE_PATH.'display_bitblogpost_inc.php' );
+if ($view == true){
+ include_once BLOGS_PKG_INCLUDE_PATH.'display_bitblogpost_inc.php';
}else{
$gBitSystem->setHttpStatus( 404 );
$gBitSystem->fatalError( "The blog post you requested could not be found." );
@@ -53,4 +52,3 @@ if ($view == TRUE){
if( $gContent->isValid() ) {
$gContent->addHit();
}
-?>