summaryrefslogtreecommitdiff
path: root/edit.php
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-03-09 20:21:12 +0000
committerlsces <lester@lsces.co.uk>2026-03-09 20:21:12 +0000
commitf0e03115d345cf3497ae2804d09037bcf9f32aff (patch)
tree5e56d5d3e7e48818ea69c510d4cfede1bd3b0ed3 /edit.php
parent0b7bc39d45c39f36e13e704ac126f9246a9be62f (diff)
downloadarticles-f0e03115d345cf3497ae2804d09037bcf9f32aff.tar.gz
articles-f0e03115d345cf3497ae2804d09037bcf9f32aff.tar.bz2
articles-f0e03115d345cf3497ae2804d09037bcf9f32aff.zip
I had forgotten that the medw site has a lot of articles which have not been displayed recently, so have applied all the Smarty5 and PHP8.4 fixes on mass which gets displaying and editing working, but the list function is currently broken
Diffstat (limited to 'edit.php')
-rwxr-xr-xedit.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/edit.php b/edit.php
index 57a8664..d0baabd 100755
--- a/edit.php
+++ b/edit.php
@@ -13,7 +13,9 @@
* Initialization
*/
require_once '../kernel/includes/setup_inc.php';
-use Bitweaver\Articles\BitArticle;
+use Bitweaver\Articles\BitArticleTopic;
+use Bitweaver\Articles\BitArticleType;
+use Bitweaver\KernelTools;
// Is package installed and enabled
$gBitSystem->verifyPackage( 'articles' );
@@ -29,7 +31,7 @@ if ( $gContent->isValid() ) {
// if we want to remove a custom image, just nuke all custom image settings at once
if( !empty( $_REQUEST['remove_image'] ) ) {
$_REQUEST['image_attachment_id'] = NULL;
- $gContent->expungeImage( $gContent->mArticleId, !empty( $_REQUEST['preview_image_path'] ) ? $_REQUEST['preview_image_path'] : NULL );
+// $gContent->expungeImage( $gContent->mArticleId, !empty( $_REQUEST['preview_image_path'] ) ? $_REQUEST['preview_image_path'] : NULL );
// set the preview mode to maintain all settings
$_REQUEST['preview'] = 1;
}
@@ -37,7 +39,7 @@ if( !empty( $_REQUEST['remove_image'] ) ) {
if( isset( $_REQUEST["save"] ) ) {
// random image code
if( !( $gContent->hasUserPermission( 'p_articles_approve_submission' ) || $gContent->hasUserPermission( 'p_articles_auto_approve' ) ) && $gBitSystem->isFeatureActive( 'articles_submissions_rnd_img' ) && !$gBitUser->verifyCaptcha( $_REQUEST['captcha'] ) ) {
- $feedback['error'] = tra( "You need to supply the correct code to submit." );
+ $feedback['error'] = KernelTools::tra( "You need to supply the correct code to submit." );
$_REQUEST['preview'] = TRUE;
unset( $_REQUEST['save'] );
}
@@ -47,13 +49,13 @@ if( !empty( $_REQUEST['preview'] ) ) {
$article = $gContent->preparePreview( $_REQUEST );
$gBitSmarty->assign( 'preview', TRUE );
$gContent->invokeServices( 'content_preview_function', $_REQUEST );
- $gBitSmarty->assignByRef( 'article', $article );
+ $gBitSmarty->assign( 'article', $article );
} else {
$gContent->invokeServices( 'content_edit_function' );
if( empty( $gContent->mInfo['author_name'] ) ) {
$gContent->mInfo['author_name'] = $gBitUser->getDisplayName();
}
- $gBitSmarty->assignByRef('article', $gContent->mInfo);
+ $gBitSmarty->assign('article', $gContent->mInfo);
}
// If the article was saved, show feedback or show result
@@ -62,31 +64,31 @@ if( !empty( $_REQUEST['save'] ) ) {
if( empty( $_REQUEST['topic_id'] ) ) $_REQUEST['topic_id'] = 0;
if( $gContent->store( $_REQUEST ) ) {
if( isset ($gContent->mInfo['status_id']) and $gContent->mInfo['status_id'] == ARTICLE_STATUS_PENDING ) {
- bit_redirect( ARTICLES_PKG_URL. "index.php?feedback=".urlencode( tra( 'Your article has been submitted and is awaiting approval.' ) ) );
+ KernelTools::bit_redirect( ARTICLES_PKG_URL. "index.php?feedback=".urlencode( KernelTools::tra( 'Your article has been submitted and is awaiting approval.' ) ) );
} else {
- bit_redirect( ARTICLES_PKG_URL . ( ($gBitSystem->isFeatureActive('pretty_urls_extended') || $gBitSystem->isFeatureActive('pretty_urls')) ? $gContent->mArticleId : "read.php?article_id=" . $gContent->mArticleId ) );
+ KernelTools::bit_redirect( ARTICLES_PKG_URL . ( ($gBitSystem->isFeatureActive('pretty_urls_extended') || $gBitSystem->isFeatureActive('pretty_urls')) ? $gContent->mArticleId : "read.php?article_id=" . $gContent->mArticleId ) );
}
}
}
// Get a topic list
$topics = BitArticleTopic::getTopicList( array( 'active_topic' => TRUE ) );
-$gBitSmarty->assignByRef( 'topics', $topics );
+$gBitSmarty->assign( 'topics', $topics );
if ( !empty( $_REQUEST['topic'] ) ) {
$gBitSmarty->assign( 'topic', $_REQUEST['topic'] );
}
// get list of valid types
$types = BitArticleType::getTypeList();
-$gBitSmarty->assignByRef( 'types', $types );
+$gBitSmarty->assign( 'types', $types );
if ( !empty( $gContent->mErrors ) || !empty( $feedback ) ) {
$article = $gContent->preparePreview( $_REQUEST );
- $gBitSmarty->assignByRef( 'article', $article );
+ $gBitSmarty->assign( 'article', $article );
}
-$gBitSmarty->assignByRef( 'errors', $gContent->mErrors );
+$gBitSmarty->assign( 'errors', $gContent->mErrors );
$gBitSmarty->assign( 'feedback', ( !empty( $feedback ) ? $feedback : NULL ) );
// Display the Index Template
$gBitSmarty->assign( 'show_page_bar', 'n' );
-$gBitSystem->display( 'bitpackage:articles/edit_article.tpl', tra( "Articles" ) , array( 'display_mode' => 'edit' ));
+$gBitSystem->display( 'bitpackage:articles/edit_article.tpl', KernelTools::tra( "Articles" ) , array( 'display_mode' => 'edit' ));