summaryrefslogtreecommitdiff
path: root/post_history.php
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-16 16:08:07 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-16 16:08:07 +0100
commitf0d0bd6451fc0fc08c919a2208a9ac6bee3657a1 (patch)
tree9fb535bacf3a53ed37f1e0ace51e1f427beb8fc3 /post_history.php
parent7907cccc55a0e5c3e23164344843c44ec5f28d7f (diff)
downloadblogs-f0d0bd6451fc0fc08c919a2208a9ac6bee3657a1.tar.gz
blogs-f0d0bd6451fc0fc08c919a2208a9ac6bee3657a1.tar.bz2
blogs-f0d0bd6451fc0fc08c919a2208a9ac6bee3657a1.zip
Access blog posts history which is all contained in the database already
Diffstat (limited to 'post_history.php')
-rw-r--r--post_history.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/post_history.php b/post_history.php
new file mode 100644
index 0000000..c750492
--- /dev/null
+++ b/post_history.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @package blogs
+ * @subpackage functions
+ */
+
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+
+$gBitSystem->verifyPackage( 'blogs' );
+
+include BLOGS_PKG_INCLUDE_PATH.'lookup_post_inc.php';
+
+if( !$gContent->isValid() || empty( $gContent->mInfo ) ) {
+ $gBitSystem->fatalError( KernelTools::tra( "Unknown post" ));
+}
+
+$gContent->verifyViewPermission();
+
+$gBitSmarty->assign( 'postInfo', $gContent->mInfo );
+
+if( !empty( $_REQUEST['rollback_preview'] )) {
+ $gBitSmarty->assign( 'rollback_preview', $_REQUEST['rollback_preview'] );
+}
+
+$smartyContentRef = 'postInfo';
+$rollbackPerm = 'p_blogs_update';
+include_once LIBERTY_PKG_INCLUDE_PATH.'content_history_inc.php';
+
+$gBitSmarty->assign( 'page', $page = !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : 1 );
+if( !empty( $_REQUEST['list_page'] )) {
+ $gBitSmarty->assign( 'page', $page = !empty( $_REQUEST['list_page'] ) ? $_REQUEST['list_page'] : 1 );
+}
+
+$offset = ( $page - 1 ) * $gBitSystem->getConfig( 'max_records' );
+$history = $gContent->getHistory( null, null, $offset, $gBitSystem->getConfig( 'max_records' ) );
+$gBitSmarty->assign( 'data', $history['data'] );
+$gBitSmarty->assign( 'listInfo', $history['listInfo'] );
+
+$gBitSmarty->assign( 'gContent', $gContent );
+$gBitSystem->display( 'bitpackage:blogs/post_history.tpl', null, [ 'display_mode' => 'display' ]);