summaryrefslogtreecommitdiff
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
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
-rwxr-xr-xedit.php26
-rwxr-xr-xedit_topic.php2
-rwxr-xr-xincludes/classes/BitArticle.php10
-rwxr-xr-xincludes/lookup_article_inc.php4
-rwxr-xr-xtemplates/article_display.tpl4
-rwxr-xr-xtemplates/center_list_articles.php12
-rwxr-xr-xtemplates/center_list_articles.tpl2
-rwxr-xr-xtemplates/edit_article.tpl8
-rwxr-xr-xtemplates/list_articles.tpl2
9 files changed, 36 insertions, 34 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' ));
diff --git a/edit_topic.php b/edit_topic.php
index a239372..33e9698 100755
--- a/edit_topic.php
+++ b/edit_topic.php
@@ -25,7 +25,7 @@ if( !$gContent->isValid() ) {
die;
}
-$gBitSmarty->assignByRef( 'topic_info', $gContent->mInfo);
+$gBitSmarty->assign( 'topic_info', $gContent->mInfo);
if( isset( $_REQUEST["fSubmitSaveTopic"] ) ) {
$gContent->storeTopic( $_REQUEST );
diff --git a/includes/classes/BitArticle.php b/includes/classes/BitArticle.php
index 7b1a285..6ad6a38 100755
--- a/includes/classes/BitArticle.php
+++ b/includes/classes/BitArticle.php
@@ -284,7 +284,7 @@ class BitArticle extends LibertyMime
$pParamHash['article_store']['expire_date'] = $pParamHash['expire_date'];
}
- if (@$this->verifyId( $pParamHash['status_id'] )) {
+ if ( !empty($pParamHash['status_id']) and @$this->verifyId( $pParamHash['status_id'] )) {
$pParamHash['article_store']['status_id'] = ( $pParamHash['status_id'] > ARTICLE_STATUS_PENDING ) ? ( $gBitUser->hasPermission( 'p_articles_approve_submission' ) ) ? (int) ( $pParamHash['status_id'] ) : ARTICLE_STATUS_PENDING : (int) ( $pParamHash['status_id'] );
}
elseif (@$this->verifyId( $this->mInfo['status_id'] )) {
@@ -453,18 +453,18 @@ class BitArticle extends LibertyMime
// or a string
$whereSql .= " AND UPPER( lc.`title` ) LIKE ? ";
$bindVars[] = '%'.strtoupper( $find ).'%';
- } elseif ( @$this->verifyId( $pParamHash['user_id'] ) ) {
+ } elseif ( @$this->verifyId( $pParamHash['user_id'] ?? 0 ) ) {
// or gate on a user
$whereSql .= " AND lc.`user_id` = ? ";
$bindVars[] = (int) $pParamHash['user_id'];
}
- if ( @$this->verifyId( $pParamHash['status_id'] ) ) {
+ if ( @$this->verifyId( $pParamHash['status_id'] ?? 0 ) ) {
$whereSql .= " AND a.`status_id` = ? ";
$bindVars[] = $pParamHash['status_id'];
}
- if ( @$this->verifyId( $pParamHash['type_id'] ) ) {
+ if ( @$this->verifyId( $pParamHash['type_id'] ?? 0 ) ) {
$whereSql .= " AND a.`article_type_id` = ? ";
$bindVars[] = (int) $pParamHash['type_id'];
}
@@ -510,7 +510,7 @@ class BitArticle extends LibertyMime
$bindVars[] = 'y';
}
- if ( @$this->verifyId( $pParamHash['topic_id'] ) ) {
+ if ( @$this->verifyId( $pParamHash['topic_id'] ?? 0 ) ) {
$whereSql .= " AND a.`topic_id` = ? ";
$bindVars[] = (int) $pParamHash['topic_id'];
} elseif ( !empty( $pParamHash['topic'] ) ) {
diff --git a/includes/lookup_article_inc.php b/includes/lookup_article_inc.php
index cdd5902..45461ac 100755
--- a/includes/lookup_article_inc.php
+++ b/includes/lookup_article_inc.php
@@ -14,9 +14,9 @@ require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if( empty( $gContent ) || !is_object( $gContent ) ) {
- if (@BitBase::verifyId( $_REQUEST['article_id'] ) ) {
+ if (@BitBase::verifyId( $_REQUEST['article_id'] ?? 0 ) ) {
$gContent = new BitArticle( $_REQUEST['article_id'] );
- } elseif( @BitBase::verifyId( $_REQUEST['content_id'] ) ) {
+ } elseif( @BitBase::verifyId( $_REQUEST['content_id'] ?? 0 ) ) {
$gContent = new BitArticle( NULL, $_REQUEST['content_id'] );
} else {
$gContent = new BitArticle();
diff --git a/templates/article_display.tpl b/templates/article_display.tpl
index ea05f21..b457631 100755
--- a/templates/article_display.tpl
+++ b/templates/article_display.tpl
@@ -15,7 +15,7 @@
{/if}
{*<a style="display:none;" href="{$smarty.const.ARTICLES_PKG_URL}print.php?article_id={$article.article_id}">{booticon iname="icon-print" ipackage="icons" iexplain=print}</a>*}
{if $gContent->hasUserPermission( 'p_articles_remove' )}
- {smartlink ititle="Remove" ipackage=articles ifile="list.php" booticon="icon-trash" action=remove remove_article_id=$article.article_id status_id=$smarty.request.status_id}
+ {smartlink ititle="Remove" ipackage=articles ifile="list.php" booticon="icon-trash" action=remove remove_article_id=$article.article_id status_id=$smarty.request.status_id|default:0}
{/if}
</div><!-- end .footer -->
@@ -72,7 +72,7 @@
{if $showDescriptionsOnly}
{$article.parsed_description}
{else}
- {$article.parsed}
+ {$article.parsed_data}
{/if}
</div>
diff --git a/templates/center_list_articles.php b/templates/center_list_articles.php
index 2300e13..51c0607 100755
--- a/templates/center_list_articles.php
+++ b/templates/center_list_articles.php
@@ -2,9 +2,9 @@
use Bitweaver\Users\RoleUser;
global $gBitSmarty, $gBitSystem, $gQueryUserId, $moduleParams, $gContent;
-if ( !empty( $moduleParams ) ) {
- extract( $moduleParams );
-}
+//if ( !empty( $moduleParams->value ) ) {
+// extract( $moduleParams->value );
+//}
include_once( ARTICLES_PKG_INCLUDE_PATH.'lookup_article_inc.php' );
@@ -27,9 +27,9 @@ if ( !empty( $_REQUEST['topic'] ) ) {
$gBitSmarty->assign( 'topic', $_REQUEST['topic'] );
}
-if ( !empty( $moduleParams )) {
- $listHash = array_merge( $_REQUEST, $moduleParams['module_params'] );
- $listHash['max_records'] = $module_rows;
+if ( !empty( $moduleParams->value )) {
+ $listHash = array_merge( $_REQUEST, $moduleParams->value );
+ $listHash['max_records'] = $module_rows ?? 0;
//$listHash['parse_data'] = TRUE;
//$listHash['load_comments'] = TRUE;
} else {
diff --git a/templates/center_list_articles.tpl b/templates/center_list_articles.tpl
index 1531e1b..41fe4cc 100755
--- a/templates/center_list_articles.tpl
+++ b/templates/center_list_articles.tpl
@@ -5,7 +5,7 @@
</div>
{/if}
- {formfeedback success=$smarty.request.feedback}
+ {formfeedback success=$smarty.request.feedback|default:''}
{include file="bitpackage:articles/article_filter_inc.tpl"}
{if $gBitUser->hasPermission( 'p_articles_admin' ) && $futures}
diff --git a/templates/edit_article.tpl b/templates/edit_article.tpl
index b64caaf..6f27f40 100755
--- a/templates/edit_article.tpl
+++ b/templates/edit_article.tpl
@@ -22,14 +22,14 @@
{/if}
{formfeedback hash=$feedback}
- {formfeedback warning=$errors.title}
+ {formfeedback warning=$errors.title|default:''}
<div class="body">
{form enctype="multipart/form-data" id="writearticle"}
<input type="hidden" name="article_id" value="{$gContent->mArticleId}" />
<input type="hidden" name="content_id" value="{$gContent->getField('content_id')}" />
- <input type="hidden" name="preview_image_url" value="{$article.preview_image_url}" />
- <input type="hidden" name="preview_image_path" value="{$article.preview_image_path}" />
+ <input type="hidden" name="preview_image_url" value="{$article.preview_image_url|default:''}" />
+ <input type="hidden" name="preview_image_path" value="{$article.preview_image_path|default:''}" />
{jstabs}
{jstab title="Article Body"}
@@ -118,7 +118,7 @@
{if $gBitSystem->isFeatureActive( 'articles_submissions_rnd_img' ) && !( $gContent->mArticleId || ( $gContent->hasUserPermission('p_articles_approve_submission') || $gContent->hasUserPermission('p_articles_auto_approve') ) )}
<hr />
{formfeedback error=$errors.captcha}
- {captcha force=true variant=row}
+ {* captcha force=true variant=row *}
{/if}
<div class="form-group submit">
diff --git a/templates/list_articles.tpl b/templates/list_articles.tpl
index 24289da..a243f5b 100755
--- a/templates/list_articles.tpl
+++ b/templates/list_articles.tpl
@@ -25,7 +25,7 @@
<div class="body">
- {formfeedback hash=$feedback}
+ {formfeedback hash=$feedback|default:''}
{include file="bitpackage:liberty/services_inc.tpl" serviceLocation='list_options'}