summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-27 15:15:48 +0100
committerlsces <lester@lsces.co.uk>2025-08-27 15:15:48 +0100
commit407bc340dc419e4448656764ac95e9d90482a867 (patch)
treeec3d499580a631213610c101e88ee0a546e9989a
parent6e4c7248e7e20a203b2047dfba7af9fc068d9c42 (diff)
downloadliberty-407bc340dc419e4448656764ac95e9d90482a867.tar.gz
liberty-407bc340dc419e4448656764ac95e9d90482a867.tar.bz2
liberty-407bc340dc419e4448656764ac95e9d90482a867.zip
Kernel functions changes to cover uninitialized variables and style changes for PHP8.4
-rwxr-xr-x[-rw-r--r--]ajax_attachment_browser.php4
-rwxr-xr-x[-rw-r--r--]ajax_comments.php14
-rwxr-xr-x[-rw-r--r--]ajax_edit_storage.php4
-rwxr-xr-x[-rw-r--r--]attachment_browser.php15
-rwxr-xr-x[-rw-r--r--]attachment_uploader.php22
-rwxr-xr-x[-rw-r--r--]attachments.php4
-rwxr-xr-x[-rw-r--r--]content_permissions.php39
-rwxr-xr-x[-rw-r--r--]content_role_permissions.php42
-rwxr-xr-x[-rw-r--r--]download_file.php19
-rwxr-xr-x[-rw-r--r--]liberty_rss.php32
-rwxr-xr-x[-rw-r--r--]list_content.php36
-rwxr-xr-x[-rw-r--r--]preview.php6
-rwxr-xr-x[-rw-r--r--]redirect.php2
-rwxr-xr-x[-rw-r--r--]structure_add_content.php14
-rwxr-xr-x[-rw-r--r--]structure_edit.php2
-rw-r--r--templates/center_recent_comments.php24
-rw-r--r--templates/center_view_generic.php6
-rwxr-xr-x[-rw-r--r--]view_file.php26
18 files changed, 162 insertions, 149 deletions
diff --git a/ajax_attachment_browser.php b/ajax_attachment_browser.php
index dd04d74..50cee62 100644..100755
--- a/ajax_attachment_browser.php
+++ b/ajax_attachment_browser.php
@@ -8,14 +8,14 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
global $gContent, $gBitSmarty;
$gContent = new LibertyMime();
if( isset( $_REQUEST['content_id'] )) {
$gContent->mContentId = $_REQUEST['content_id'];
}
-$gBitSmarty->assign( 'attachmentBrowser', TRUE );
+$gBitSmarty->assign( 'attachmentBrowser', true );
include_once( LIBERTY_PKG_PATH.'attachment_browser.php' );
if( isset( $_REQUEST['json'] )){
diff --git a/ajax_comments.php b/ajax_comments.php
index f34c97f..4b34a92 100644..100755
--- a/ajax_comments.php
+++ b/ajax_comments.php
@@ -8,13 +8,16 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+namespace Smarty;
+use Bitweaver\Liberty\LibertyBase;
+use Bitweaver\Liberty\LibertyContent;
+require_once '../kernel/includes/setup_inc.php';
$staticContent = new LibertyContent();
-$gContent = LibertyBase::getLibertyObject( $_REQUEST['parent_id'], ( !empty( $_REQUEST['parent_guid'] ) ? $_REQUEST['parent_guid'] : NULL ));
+$gContent = LibertyBase::getLibertyObject( $_REQUEST['parent_id'], !empty( $_REQUEST['parent_guid'] ) ? $_REQUEST['parent_guid'] : null );
$XMLContent = "";
-if( !$gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE)) {
+if( !$gContent->hasUserPermission( 'p_liberty_post_comments', true, true)) {
$statusCode = 401;
$XMLContent = tra( "You do not have the required permissions to post new comments" );
} elseif( $gContent->isCommentable() ) {
@@ -29,7 +32,7 @@ if( !$gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE)) {
$commentsParentId = $_REQUEST['parent_id'];
$comments_return_url = $_REQUEST['comments_return_url'];
- include_once( LIBERTY_PKG_INCLUDE_PATH.'comments_inc.php' );
+ include_once LIBERTY_PKG_INCLUDE_PATH.'comments_inc.php';
if( isset( $_REQUEST['post_comment_submit'] )) {
if ($storeComment->loadComment()){
@@ -49,7 +52,6 @@ if( !$gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE)) {
$gBitSmarty->assign( 'commentsParentId', $commentsParentId );
if( !empty( $formfeedback )){
$statusCode = 400;
- $gBitSmarty->loadPlugin( 'smarty_modifier_formfeedback' );
$XMLContent = smarty_function_formfeedback( $formfeedback, $gBitSmarty );
}
$XMLContent .= $gBitSmarty->fetch( 'bitpackage:liberty/display_comment.tpl' );
@@ -71,7 +73,7 @@ header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: ".gmdate( "D, d M Y H:i:s" )." GMT" );
// HTTP/1.1
header( "Cache-Control: no-store, no-cache, must-revalidate" );
-header( "Cache-Control: post-check=0, pre-check=0", FALSE );
+header( "Cache-Control: post-check=0, pre-check=0", false );
// HTTP/1.0
header( "Pragma: no-cache" );
//XML Header
diff --git a/ajax_edit_storage.php b/ajax_edit_storage.php
index 9dec7f3..3bf4eb0 100644..100755
--- a/ajax_edit_storage.php
+++ b/ajax_edit_storage.php
@@ -21,11 +21,11 @@ include_once( LIBERTY_PKG_INCLUDE_PATH.'edit_storage_inc.php' );
// fetch the content of the page to display
$gBitThemes->setFormatHeader( 'center_only' );
-$gBitSmarty->assign( 'uploadTab', TRUE );
+$gBitSmarty->assign( 'uploadTab', true );
if( isset( $_REQUEST['form_id'] ) ){
$gBitSmarty->assign( 'form_id', $_REQUEST['form_id'] );
}
-$gBitSystem->display( 'bitpackage:liberty/edit_storage_list.tpl' , NULL, array( 'display_mode' => 'edit' ));
+$gBitSystem->display( 'bitpackage:liberty/edit_storage_list.tpl' , null, array( 'display_mode' => 'edit' ));
?>
diff --git a/attachment_browser.php b/attachment_browser.php
index 805f4ff..dc4bda0 100644..100755
--- a/attachment_browser.php
+++ b/attachment_browser.php
@@ -11,7 +11,9 @@
/**
* bit setup
*/
-require_once("../kernel/includes/setup_inc.php");
+use Bitweaver\BitBase;
+use Bitweaver\Liberty\LibertyMime;
+require_once "../kernel/includes/setup_inc.php";
global $gBitSmarty, $gContent, $gBitUser, $gBitSystem, $gLibertySystem;
@@ -22,7 +24,7 @@ if (isset($_REQUEST['attachment_id']) && is_numeric($_REQUEST['attachment_id']))
}
// this is a hack to make it compatible with existing tpls for now
$attachment = $gContent->getAttachment($_REQUEST['attachment_id']);
- $ret = array();
+ $ret = [];
$ret[$attachment['attachment_id']] = $attachment;
$userAttachments = $ret;
$gContent->mStorage = $userAttachments;
@@ -31,7 +33,7 @@ if (isset($_REQUEST['attachment_id']) && is_numeric($_REQUEST['attachment_id']))
// we want a list of user attachments
$listHash = $_REQUEST;
$listHash = array(
- 'page' => @BitBase::verifyId( $_REQUEST['pgnPage'] ) ? $_REQUEST['pgnPage'] : NULL,
+ 'page' => BitBase::verifyId( $_REQUEST['pgnPage'] ?? 0 ) ? $_REQUEST['pgnPage'] : null,
'load_attached_to' => true,
);
$userAttachments = $gBitUser->getUserAttachments( $listHash );
@@ -41,13 +43,12 @@ if (isset($_REQUEST['attachment_id']) && is_numeric($_REQUEST['attachment_id']))
$gBitSmarty->assign('gContent', $gContent);
// pagination
- $offset = @BitBase::verifyId( $_REQUEST['offset'] ) ? $_REQUEST['offset'] : 0;
- $gBitSmarty->assign( 'curPage', $pgnPage = @BitBase::verifyId( $_REQUEST['pgnPage'] ) ? $_REQUEST['pgnPage'] : 1 );
+ $offset = BitBase::verifyId( $_REQUEST['offset'] ?? 0 ) ? $_REQUEST['offset'] : 0;
+ $gBitSmarty->assign( 'curPage', $pgnPage = BitBase::verifyId( $_REQUEST['pgnPage'] ?? 0 ) ? $_REQUEST['pgnPage'] : 1 );
$offset = ( $pgnPage - 1 ) * $gBitSystem->getConfig( 'max_records' );
// calculate page number
$numPages = ceil( $listHash['cant'] / $gBitSystem->getConfig( 'max_records' ) );
$gBitSmarty->assign( 'cant', $listHash['cant'] );
$gBitSmarty->assign( 'numPages', $numPages );
-}
-?>
+} \ No newline at end of file
diff --git a/attachment_uploader.php b/attachment_uploader.php
index 193cb46..cc26600 100644..100755
--- a/attachment_uploader.php
+++ b/attachment_uploader.php
@@ -8,10 +8,10 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
global $gBitSmarty, $gContent;
-$error = NULL;
+$error = null;
if ( !isset($_FILES['upload'] ) ) {
$error = tra( "No upload submitted." );
}elseif( !empty( $_REQUEST['liberty_attachments']['content_id'] )) {
@@ -33,10 +33,16 @@ if ( !isset($_FILES['upload'] ) ) {
// load up the requested content type handler class
$contentType = $_REQUEST['liberty_attachments']['content_type_guid'];
$contentTypeHash = $gLibertySystem->mContentTypes[$contentType];
- if( LibertySystem::requireContentType( $contentTypeHash ) ) {
- $gContent = new $contentTypeHash['handler_class']();
- } else {
+ $class = $contentTypeHash['handler_class'];
+ $classFile = $contentTypeHash['handler_file'];
+ $package = $contentTypeHash['handler_package'];
+ $pathVar = strtoupper($package).'_PKG_PATH';
+
+ if( !defined( $pathVar ) ) {
$error = tra( "Undefined handler package path" );
+ }else{
+ require_once( constant( $pathVar ).$classFile );
+ $gContent = new $class();
}
}
}else{
@@ -89,8 +95,8 @@ if ( !is_null( $error ) ){
}
$gBitSmarty->assign( 'gContent', $gContent );
-$gBitSmarty->assign( 'libertyUploader', TRUE );
-$gBitSmarty->assign( 'uploadTab', TRUE );
+$gBitSmarty->assign( 'libertyUploader', true );
+$gBitSmarty->assign( 'uploadTab', true );
if( !empty( $_REQUEST['liberty_attachments']['primary_label'] ) ) {
$gBitSmarty->assign('primary_label', $_REQUEST['liberty_attachments']['primary_label']);
@@ -100,5 +106,5 @@ if( isset( $_REQUEST['liberty_attachments']['form_id'] ) ){
$gBitSmarty->assign( 'form_id', $_REQUEST['liberty_attachments']['form_id'] );
}
-echo $gBitSystem->display( 'bitpackage:liberty/attachment_uploader.tpl', NULL, array( 'format'=>'none', 'display_mode' => 'display' ));
+echo $gBitSystem->display( 'bitpackage:liberty/attachment_uploader.tpl', null, array( 'format'=>'none', 'display_mode' => 'display' ));
?>
diff --git a/attachments.php b/attachments.php
index 1fa6808..248602f 100644..100755
--- a/attachments.php
+++ b/attachments.php
@@ -19,11 +19,11 @@ if( !$gBitUser->isRegistered() ) {
$gBitSystem->fatalError( tra( 'You need to be logged in to view this page.' ));
}
-$feedback = array();
+$feedback = [];
$listHash = &$_REQUEST;
if( $gBitUser->isAdmin() ) {
if( !empty( $listHash['login'] ) && $listHash['login'] == 'all' ) {
- $listHash['user_id'] = NULL;
+ $listHash['user_id'] = null;
} elseif( !empty( $listHash['login'] ) ) {
if( $userInfo = $gBitUser->getUserInfo( array( 'login' => $listHash['login'] ) ) ) {
$listHash['user_id'] = $userInfo['user_id'];
diff --git a/content_permissions.php b/content_permissions.php
index ba14a08..67b2eaf 100644..100755
--- a/content_permissions.php
+++ b/content_permissions.php
@@ -8,14 +8,19 @@
/**
* bit setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+namespace Smarty;
+use Bitweaver\BitBase;
+use Bitweaver\HttpStatusCodes;
+use Bitweaver\Liberty\LibertyBase;
+
+require_once '../kernel/includes/setup_inc.php';
$gBitSystem->verifyPermission( 'p_liberty_assign_content_perms' );
-require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
+require_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php';
if( $gContent == null ) {
- $gBitSystem->fatalError('Could not find the requested content.', NULL, NULL, HttpStatusCodes::HTTP_GONE );
+ $gBitSystem->fatalError('Could not find the requested content.', null, null, HttpStatusCodes::HTTP_GONE );
}
// Process the form
@@ -25,7 +30,7 @@ if( !empty( $_REQUEST['back'] )) {
}
// Update database if needed
-if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )) {
+if( !empty( $_REQUEST['action'] ) && BitBase::verifyId( $gContent->mContentId )) {
if( $_REQUEST["action"] == 'expunge' ) {
if( $gContent->expungeContentPermissions() ) {
$feedback['success'] = tra( 'The content permissions were successfully removed.' );
@@ -34,12 +39,12 @@ if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )
}
}
- if( @BitBase::verifyId( $_REQUEST["group_id"] ) && !empty( $_REQUEST["perm"] )) {
+ if( BitBase::verifyId( $_REQUEST["group_id"] ?? 0 ) && !empty( $_REQUEST["perm"] )) {
$gBitUser->verifyTicket();
if( $_REQUEST["action"] == 'assign' ) {
$gContent->storePermission( $_REQUEST["group_id"], $_REQUEST["perm"] );
} elseif( $_REQUEST["action"] == 'negate' ) {
- $gContent->storePermission( $_REQUEST["group_id"], $_REQUEST["perm"], TRUE );
+ $gContent->storePermission( $_REQUEST["group_id"], $_REQUEST["perm"], true );
} elseif( $_REQUEST["action"] == 'remove' ) {
$gContent->removePermission( $_REQUEST["group_id"], $_REQUEST["perm"] );
}
@@ -47,15 +52,13 @@ if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )
}
// Get a list of groups
-$listHash = array( 'sort_mode' => 'group_id_asc', 'visible' => 1 );
+$listHash = [ 'sort_mode' => 'group_id_asc', 'visible' => 1 ];
$contentPerms['groups'] = $gBitUser->getAllGroups( $listHash );
-if( !empty( $gContent->mType['handler_package'] )) {
- $contentPerms['assignable'] = $gBitUser->getGroupPermissions( array( 'package' => $gContent->mType['handler_package'] ));
-} else {
+$contentPerms['assignable'] = !empty( $gContent->mType['handler_package'] )
+ ? $gBitUser->getGroupPermissions( [ 'package' => $gContent->mType['handler_package'] ] )
// this is a last resort and will dump all perms a user has
- $contentPerms['assignable'] = $gBitUser->mPerms;
-}
+ : $gBitUser->mPerms;
// Now we have to get the individual object permissions if any
if( $contentPerms['assigned'] = $gContent->getContentPermissionsList() ) {
@@ -70,11 +73,7 @@ $gBitSmarty->assign( 'contentPerms', $contentPerms );
// if we've called this page as part of an ajax update, we output the appropriate data
if( $gBitThemes->isAjaxRequest() ) {
- if( count( $contentPerms['groups'] <= 10 )) {
- $size = 'large/';
- } else {
- $size = 'small/';
- }
+ $size = count( $contentPerms['roles'] ) <= 10 ? 'large/' : 'small/';
$gid = $_REQUEST['group_id'];
$perm = $_REQUEST['perm'];
@@ -100,16 +99,14 @@ if( $gBitThemes->isAjaxRequest() ) {
}
}
- $gBitSmarty->loadPlugin( 'smarty_function_biticon' );
$ret = '<a title="'.$contentPerms['groups'][$gid]['group_name']." :: ".$perm.'" '.
'href="javascript:void(0);" onclick="BitAjax.updater('.
"'{$perm}{$gid}', ".
"'".LIBERTY_PKG_URL."content_permissions.php', ".
"'action={$action}&amp;content_id={$gContent->mContentId}&amp;perm={$perm}&amp;group_id={$gid}'".
- ')">'.smarty_function_biticon( $biticon, $gBitSmarty ).'</a>';
+ ')">'.$gBitweaverExtension->smarty_function_biticon( $biticon, $gBitSmarty ).'</a>';
echo $ret;
die;
}
-$gBitSystem->display( 'bitpackage:liberty/content_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:liberty/content_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' )); \ No newline at end of file
diff --git a/content_role_permissions.php b/content_role_permissions.php
index ab6a3d8..8ea94d7 100644..100755
--- a/content_role_permissions.php
+++ b/content_role_permissions.php
@@ -8,14 +8,18 @@
/**
* bit setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+namespace Smarty;
+use Bitweaver\BitBase;
+use Bitweaver\HttpStatusCodes;
+
+require_once '../kernel/includes/setup_inc.php';
$gBitSystem->verifyPermission( 'p_liberty_assign_content_perms' );
-require_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
+require_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php';
if( $gContent == null ) {
- $gBitSystem->fatalError('Could not find the requested content.', NULL, NULL, HttpStatusCodes::HTTP_GONE );
+ $gBitSystem->fatalError('Could not find the requested content.', null, null, HttpStatusCodes::HTTP_GONE );
}
// Process the form
@@ -25,7 +29,7 @@ if( !empty( $_REQUEST['back'] )) {
}
// Update database if needed
-if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )) {
+if( !empty( $_REQUEST['action'] ) && BitBase::verifyId( $gContent->mContentId )) {
if( $_REQUEST["action"] == 'expunge' ) {
if( $gContent->expungeContentPermissions() ) {
$feedback['success'] = tra( 'The content permissions were successfully removed.' );
@@ -34,12 +38,12 @@ if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )
}
}
- if( @BitBase::verifyId( $_REQUEST["role_id"] ) && !empty( $_REQUEST["perm"] )) {
+ if( BitBase::verifyId( $_REQUEST["role_id"] ?? 0 ) && !empty( $_REQUEST["perm"] )) {
$gBitUser->verifyTicket();
if( $_REQUEST["action"] == 'assign' ) {
$gContent->storePermission( $_REQUEST["role_id"], $_REQUEST["perm"] );
} elseif( $_REQUEST["action"] == 'negate' ) {
- $gContent->storePermission( $_REQUEST["role_id"], $_REQUEST["perm"], TRUE );
+ $gContent->storePermission( $_REQUEST["role_id"], $_REQUEST["perm"], true );
} elseif( $_REQUEST["action"] == 'remove' ) {
$gContent->removePermission( $_REQUEST["role_id"], $_REQUEST["perm"] );
}
@@ -47,15 +51,13 @@ if( !empty( $_REQUEST['action'] ) && @BitBase::verifyId( $gContent->mContentId )
}
// Get a list of roles
-$listHash = array( 'sort_mode' => 'role_id_asc', 'visible' => 1 );
+$listHash = [ 'sort_mode' => 'role_id_asc', 'visible' => 1 ];
$contentPerms['roles'] = $gBitUser->getAllRoles( $listHash );
-if( !empty( $gContent->mType['handler_package'] )) {
- $contentPerms['assignable'] = $gBitUser->getRolePermissions( array( 'package' => $gContent->mType['handler_package'] ));
-} else {
+$contentPerms['assignable'] = !empty( $gContent->mType['handler_package'] )
+ ? $gBitUser->getRolePermissions( [ 'package' => $gContent->mType['handler_package'] ] )
// this is a last resort and will dump all perms a user has
- $contentPerms['assignable'] = $gBitUser->mPerms;
-}
+ : $gBitUser->mPerms;
// Now we have to get the individual object permissions if any
if( $contentPerms['assigned'] = $gContent->getContentPermissionsList() ) {
@@ -70,22 +72,18 @@ $gBitSmarty->assign( 'contentPerms', $contentPerms );
// if we've called this page as part of an ajax update, we output the appropriate data
if( $gBitThemes->isAjaxRequest() ) {
- if( count( $contentPerms['roles'] <= 10 )) {
- $size = 'large/';
- } else {
- $size = 'small/';
- }
+ $size = count( $contentPerms['roles'] ) <= 10 ? 'large/' : 'small/';
$gid = $_REQUEST['role_id'];
$perm = $_REQUEST['perm'];
// we're applying the same logic as in the template. if you fix / change anything here, please update the template as well.
- $biticon = array(
+ $biticon = [
'ipackage' => 'icons',
'iname' => $size.'media-playback-stop',
'iexplain' => '',
'iforce' => 'icon',
- );
+ ];
$action = 'assign';
if( !empty( $contentPerms['roles'][$gid]['perms'][$perm] )) {
$biticon['iname'] = $size.'dialog-ok';
@@ -100,16 +98,14 @@ if( $gBitThemes->isAjaxRequest() ) {
}
}
- $gBitSmarty->loadPlugin( 'smarty_function_biticon' );
$ret = '<a title="'.$contentPerms['roles'][$gid]['role_name']." :: ".$perm.'" '.
'href="javascript:void(0);" onclick="BitAjax.updater('.
"'{$perm}{$gid}', ".
"'".LIBERTY_PKG_URL."content_role_permissions.php', ".
"'action={$action}&amp;content_id={$gContent->mContentId}&amp;perm={$perm}&amp;role_id={$gid}'".
- ')">'.smarty_function_biticon( $biticon, $gBitSmarty ).'</a>';
+ ')">'.$gBitweaverExtension->smarty_function_biticon( $biticon, $gBitSmarty ).'</a>';
echo $ret;
die;
}
-$gBitSystem->display( 'bitpackage:liberty/content_role_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:liberty/content_role_permissions.tpl', tra( 'Content Permissions' ), array( 'display_mode' => 'display' )); \ No newline at end of file
diff --git a/download_file.php b/download_file.php
index 2667968..2d8ba57 100644..100755
--- a/download_file.php
+++ b/download_file.php
@@ -11,12 +11,15 @@
/**
* Setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( LIBERTY_PKG_CLASS_PATH.'LibertyMime.php' );
+namespace Bitweaver\Liberty;
+use Bitweaver\BitBase;
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyMime;
+require_once '../kernel/includes/setup_inc.php';
// fetch the attachment details
-if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ) || !( $attachment = LibertyMime::loadAttachment( $_REQUEST['attachment_id'], $_REQUEST ))) {
- $gBitSystem->fatalError( tra( "The Attachment ID given is not valid" ));
+if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ?? 0 ) || !( $attachment = LibertyMime::loadAttachment( $_REQUEST['attachment_id'], $_REQUEST ))) {
+ $gBitSystem->fatalError( KernelTools::tra( "The Attachment ID given is not valid" ));
}
$gBitSmarty->assign( 'attachment', $attachment );
@@ -36,14 +39,14 @@ if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
foreach( $attachment['errors'] as $error ) {
$msg .= $error.'<br />';
}
- $gBitSystem->fatalError( tra( $msg ));
+ $gBitSystem->fatalError( KernelTools::tra( $msg ));
} else {
- $gBitSystem->fatalError( tra( 'There was an undetermined problem trying to prepare the file for download.' ));
+ $gBitSystem->fatalError( KernelTools::tra( 'There was an undetermined problem trying to prepare the file for download.' ));
}
}
} else {
- $gBitSystem->fatalError( tra( "No suitable download function found." ));
+ $gBitSystem->fatalError( KernelTools::tra( "No suitable download function found." ));
}
} else {
- $gBitSystem->fatalError( tra( "Object not found." ), NULL, NULL, 404 );
+ $gBitSystem->fatalError( KernelTools::tra( "Object not found." ), null, null, 404 );
}
diff --git a/liberty_rss.php b/liberty_rss.php
index 930841b..4c66144 100644..100755
--- a/liberty_rss.php
+++ b/liberty_rss.php
@@ -8,26 +8,28 @@
/**
* Initialization
*/
-require_once( "../kernel/includes/setup_inc.php" );
-require_once( RSS_PKG_INCLUDE_PATH.'rss_inc.php' );
-require_once( LIBERTY_PKG_CLASS_PATH.'LibertyContent.php' );
+require_once "../kernel/includes/setup_inc.php";
+require_once RSS_PKG_INCLUDE_PATH . 'rss_inc.php';
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyContent;
+use Bitweaver\Feed\FeedStatus;
$gBitSystem->verifyPackage( 'rss' );
$gBitSystem->verifyFeature( 'liberty_rss' );
-$rss->title = $gBitSystem->getConfig( 'liberty_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'Liberty' ) );
-$rss->description = $gBitSystem->getConfig( 'liberty_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'RSS Feed' ) );
+$rss->title = $gBitSystem->getConfig( 'liberty_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.KernelTools::tra( 'Liberty' ) );
+$rss->description = $gBitSystem->getConfig( 'liberty_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.KernelTools::tra( 'RSS Feed' ) );
// check if we want to use the cache file
$cacheFile = TEMP_PKG_PATH.RSS_PKG_NAME.'/'.LIBERTY_PKG_NAME.'/'.$cacheFileTail;
$rss->useCached( $rss_version_name, $cacheFile, $gBitSystem->getConfig( 'rssfeed_cache_time' ));
$liberty = new LibertyContent();
-$listHash = array(
- 'max_records' => $gBitSystem->getConfig( 'liberty_rss_max_records', 10 ),
- 'sort_mode' => 'last_modified_desc',
- 'include_data' => TRUE,
-);
+$listHash = [
+ 'max_records' => $gBitSystem->getConfig( 'liberty_rss_max_records', 10 ),
+ 'sort_mode' => 'last_modified_desc',
+ 'include_data' => true,
+];
$feeds = $liberty->getContentList( $listHash );
// set the rss link
@@ -41,22 +43,22 @@ foreach( $feeds as $feed ) {
// create a page header that we know what type of data we're looking at
$description =
- tra( 'Package' ). ': '.ucfirst( $gLibertySystem->mContentTypes[$feed['content_type_guid']]['handler_package'] ).'<br />'.
- tra( 'Content Type' ).': '.$gLibertySystem->getContentTypeName( $feed['content_type_guid'] ).'<br />';
+ KernelTools::tra( 'Package' ). ': '.ucfirst( $gLibertySystem->mContentTypes[$feed['content_type_guid']]['handler_package'] ).'<br />'.
+ KernelTools::tra( 'Content Type' ).': '.$gLibertySystem->getContentTypeName( $feed['content_type_guid'] ).'<br />';
// add the parsed data, if there is any
if( !empty( $feed['data'] ) ) {
- $description .= '<br /><hr /><br />'.tra( 'Content' ).':<br />'.LibertyContent::parseDataHash( $feed ).'<br /><hr />';
+ $description .= '<br /><hr /><br />'.KernelTools::tra( 'Content' ).':<br />'.LibertyContent::parseDataHash( $feed ).'<br /><hr />';
}
$item->description = $description;
$item->date = ( int )$feed['last_modified'];
$item->source = 'http://'.$_SERVER['HTTP_HOST'].LIBERTY_PKG_URL.'/list_content.php';
- $item->author = $gBitUser->getDisplayName( FALSE, array( 'real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user'] ) );
+ $item->author = $gBitUser->getDisplayName( false, array( 'real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user'] ) );
$item->descriptionTruncSize = $gBitSystem->getConfig( 'rssfeed_truncate', 5000 );
- $item->descriptionHtmlSyndicated = FALSE;
+ $item->descriptionHtmlSyndicated = false;
// pass the item on to the rss feed creator
$rss->addItem( $item );
diff --git a/list_content.php b/list_content.php
index bf6907b..8b6b601 100644..100755
--- a/list_content.php
+++ b/list_content.php
@@ -11,7 +11,10 @@
/**
* required setup
*/
-require_once("../kernel/includes/setup_inc.php");
+require_once "../kernel/includes/setup_inc.php";
+use Bitweaver\BitBase;
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyContent;
$gBitSystem->verifyPermission( 'p_liberty_list_content' );
@@ -24,7 +27,7 @@ if( !empty( $_REQUEST['sort_mode'] )) {
#$max_content = ( !empty( $_REQUEST['max_records'] )) ? $_REQUEST['max_records'] : $gBitSystem->getConfig( 'max_records' );
if( !empty( $_POST ) ) {
- $feedback = array();
+ $feedback = [];
$gBitUser->verifyTicket();
switch( BitBase::getParameter( $_POST, 'action' ) ) {
@@ -49,46 +52,45 @@ if( !empty( $_POST ) ) {
break;
}
if( !empty( $delUsers ) ) {
- $feedback['success'][] = tra( 'Content deleted' ).": <ul>$delUsers</ul>";
+ $feedback['success'][] = KernelTools::tra( 'Content deleted' ).": <ul>$delUsers</ul>";
}
if( !empty( $errDelUsers ) ) {
- $feedback['error'][] = tra( 'Content not deleted' ).": <ul>$errDelUsers</ul>";
+ $feedback['error'][] = KernelTools::tra( 'Content not deleted' ).": <ul>$errDelUsers</ul>";
}
$gBitSmarty->assign( 'feedback', $feedback );
}
-if( !empty( $_SESSION['liberty_records_per_page'] )) {
- $max_content = $_SESSION['liberty_records_per_page'];
-} else {
- $max_content = $gBitSystem->getConfig( 'max_records', 10 );
-}
+$max_content = !empty( $_SESSION['liberty_records_per_page'] )
+ ? $_SESSION['liberty_records_per_page']
+ : $gBitSystem->getConfig( 'max_records', 10 );
+
if( !empty( $_REQUEST["max_records"] )) {
$max_content = $_REQUEST["max_records"];
$_SESSION['liberty_records_per_page'] = $max_content;
}
// now that we have all the offsets, we can get the content list
-include_once( LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php' );
+include_once LIBERTY_PKG_INCLUDE_PATH.'get_content_list_inc.php';
$gBitSmarty->assign( 'contentSelect', $contentSelect );
$gBitSmarty->assign( 'contentTypes', $contentTypes );
$gBitSmarty->assign( 'contentList', $contentList );
$contentListHash['listInfo']['ihash']['content_type_guid'] = $contentSelect;
-$contentListHash['listInfo']['ihash']['user_id'] = @BitBase::verifyId( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL;
+$contentListHash['listInfo']['ihash']['user_id'] = BitBase::verifyId( $_REQUEST['user_id'] ?? 0 ) ? $_REQUEST['user_id'] : null;
$contentListHash['listInfo']['ihash']['find'] = $contentListHash['listInfo']['find'];
$gBitSmarty->assign( 'listInfo', $contentListHash['listInfo'] );
-$gBitSmarty->assign( 'content_type_guids', ( isset( $_REQUEST['content_type_guid'] ) ? $_REQUEST['content_type_guid'] : NULL ));
+$gBitSmarty->assign( 'content_type_guids', isset( $_REQUEST['content_type_guid'] ) ? $_REQUEST['content_type_guid'] : null );
-//depricate 'ajax_api', use 'output'
+//depricate 'ajax_xml', use 'output'
//@todo clean out from other packages
-if( !empty( $_REQUEST['ajax_api'] )) {
+if( !empty( $_REQUEST['ajax_xml'] )) {
$_REQUEST['output'] = 'ajax';
}
if( !empty( $_REQUEST['output'] )) {
switch( $_REQUEST['output'] ) {
case 'json':
- $gBitSmarty->assignByRef( 'listcontent', $contentList );
+ $gBitSmarty->assign( 'listcontent', $contentList );
header( 'Content-type:application/json' );
$gBitSmarty->display( 'bitpackage:liberty/list_content_json.tpl' );
break;
@@ -99,7 +101,7 @@ if( !empty( $_REQUEST['output'] )) {
* Recommend that this be standardized, but
* a package dependency somewhere is likely an issue
*/
- require_once( UTIL_PKG_PATH.'javascript/suggest/suggest_lib.php' );
+ require_once UTIL_PKG_PATH.'javascript/suggest/suggest_lib.php';
foreach( array_keys( $contentList ) as $row ) {
$xmlList[$contentList[$row]['content_id']] = $contentList[$row]['title'];
}
@@ -113,5 +115,5 @@ if( !empty( $_REQUEST['output'] )) {
}
} else {
$gBitSystem->setBrowserTitle( 'List Content' );
- $gBitSystem->display( 'bitpackage:liberty/list_content.tpl' , NULL, array( 'display_mode' => 'list' ));
+ $gBitSystem->display( 'bitpackage:liberty/list_content.tpl' , null, [ 'display_mode' => 'list' ] );
}
diff --git a/preview.php b/preview.php
index a6d2cd7..f5645da 100644..100755
--- a/preview.php
+++ b/preview.php
@@ -12,15 +12,15 @@
* Required setup
*/
global $gLightweightScan;
-$gLightwieightScan = TRUE;
-require_once( '../kernel/includes/setup_inc.php' );
+$gLightwieightScan = true;
+require_once '../kernel/includes/setup_inc.php';
global $gContent, $gBitSystem, $gBitSmarty;
include_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
// If we can't find one make an invalid one to keep the template happy.
if (empty($gContent)) {
$gContent = new LibertyContent();
- $gBitSmarty->assignByRef('gContent', $gContent);
+ $gBitSmarty->assign('gContent', $gContent);
}
// Should we tell the template to generate a closeclick icon
if (isset($_REQUEST['closeclick'])) {
diff --git a/redirect.php b/redirect.php
index 9cba59d..f997490 100644..100755
--- a/redirect.php
+++ b/redirect.php
@@ -11,7 +11,7 @@
/**
* Required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
if( !empty( $_REQUEST['q'] )) {
bit_redirect( $_REQUEST['q'] );
} else {
diff --git a/structure_add_content.php b/structure_add_content.php
index cd31231..9921bf7 100644..100755
--- a/structure_add_content.php
+++ b/structure_add_content.php
@@ -11,13 +11,13 @@
/**
* required setup
*/
-$gLiteweightScan = TRUE;
-require_once( '../kernel/includes/setup_inc.php' );
+$gLiteweightScan = true;
+require_once '../kernel/includes/setup_inc.php';
if( !empty( $_REQUEST['modal'] ) ) {
- $gBitSystem->mConfig['site_top_bar'] = FALSE;
- $gBitSystem->mConfig['site_left_column'] = FALSE;
- $gBitSystem->mConfig['site_right_column'] = FALSE;
+ $gBitSystem->mConfig['site_top_bar'] = false;
+ $gBitSystem->mConfig['site_left_column'] = false;
+ $gBitSystem->mConfig['site_right_column'] = false;
$gBitSmarty->assign( 'popupPage', '1' );
}
@@ -42,14 +42,14 @@ if( $gBitThemes->isAjaxRequest() ) {
foreach( $contentList as $cItem ) {
$cList[$contentTypes[$cItem['content_type_guid']]][$cItem['content_id']] = $cItem['title'].' [id: '.$cItem['content_id'].']';
}
- $gBitSmarty->assignByRef( 'contentListHash', $contentList );
+ $gBitSmarty->assign( 'contentListHash', $contentList );
$gBitSmarty->assign( 'contentList', $cList );
$gBitSmarty->assign( 'contentSelect', $contentSelect );
$gBitSmarty->assign( 'contentTypes', $contentTypes );
$subpages = $gStructure->getStructureNodes($_REQUEST["structure_id"]);
$max = count($subpages);
- $gBitSmarty->assignByRef('subpages', $subpages);
+ $gBitSmarty->assign('subpages', $subpages);
if ($max != 0) {
$last_child = $subpages[$max - 1];
$gBitSmarty->assign('insert_after', $last_child["structure_id"]);
diff --git a/structure_edit.php b/structure_edit.php
index 7ae244b..bdc0cfb 100644..100755
--- a/structure_edit.php
+++ b/structure_edit.php
@@ -12,5 +12,5 @@
// wiki books also use structure_edit_inc.php
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
include_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php');
diff --git a/templates/center_recent_comments.php b/templates/center_recent_comments.php
index 20833b3..c9e9d43 100644
--- a/templates/center_recent_comments.php
+++ b/templates/center_recent_comments.php
@@ -1,28 +1,32 @@
<?php
-require_once( LIBERTY_PKG_CLASS_PATH.'LibertyComment.php' );
+use Bitweaver\Liberty\LibertyBase;
+use Bitweaver\Liberty\LibertyComment;
+use Bitweaver\Users\BitUser;
+
global $gQueryUser, $gBitUser, $gLibertySystem, $moduleParams;
+
$params = $moduleParams['module_params'];
$moduleTitle = !empty($moduleParams['title'])? $moduleParams['title'] : 'Recent Activity';
-$userId = NULL;
+$userId = null;
if( !empty( $gQueryUser->mUserId ) ) {
$userId = $gQueryUser->mUserId;
}
-$listHash = array(
- 'user_id' => $userId,
+$listHash = [
+ 'user_id' => $userId,
'max_records' => $moduleParams['module_rows'],
-);
+];
if (!empty($params['full'])) {
- $listHash['parse'] = TRUE;
+ $listHash['parse'] = true;
}
-$listHash['full'] = (!empty( $params['full'] ) ? $params['full'] : TRUE);
-$listHash['thumb_size'] = (!empty( $params['thumb_size'] ) ? $params['thumb_size'] : 'avatar');
-$listHash['show_date'] = (!empty( $params['show_date'] ) ? $params['show_date'] : TRUE);;
+$listHash['full'] = !empty( $params['full'] ) ? $params['full'] : true;
+$listHash['thumb_size'] = !empty( $params['thumb_size'] ) ? $params['thumb_size'] : 'avatar';
+$listHash['show_date'] = !empty( $params['show_date'] ) ? $params['show_date'] : true;;
if( !empty( $params['root_content_type_guid'] ) ) {
$listHash['root_content_type_guid'] = $params['root_content_type_guid'];
@@ -43,5 +47,3 @@ foreach( $keys as $k ) {
}
$gBitSmarty->assign( 'modLastComments', $modLastComments );
-
-?>
diff --git a/templates/center_view_generic.php b/templates/center_view_generic.php
index 44811c2..a000bb1 100644
--- a/templates/center_view_generic.php
+++ b/templates/center_view_generic.php
@@ -5,18 +5,18 @@
*/
global $moduleParams, $gContent, $gBitSmarty;
-$gContent = NULL;
+$gContent = null;
if( !empty( $moduleParams ) ) {
extract( $moduleParams );
}
-$lookupHash['content_id'] = ( !empty( $module_params['content_id'] ) ? $module_params['content_id'] : NULL );
+$lookupHash['content_id'] = ( !empty( $module_params['content_id'] ) ? $module_params['content_id'] : null );
if( $gContent = LibertyBase::getLibertyObject( $lookupHash['content_id'] ) ) {
if( !$gContent->hasViewPermission() ){
// no perm then get rid of the content object
- $gContent = NULL;
+ $gContent = null;
}else{
// deal with the parsing
$parseHash['format_guid'] = $gContent->mInfo['format_guid'];
diff --git a/view_file.php b/view_file.php
index 0fd806d..5893450 100644..100755
--- a/view_file.php
+++ b/view_file.php
@@ -11,14 +11,17 @@
/**
* Setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( LIBERTY_PKG_CLASS_PATH.'LibertyMime.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\BitBase;
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyMime;
+use Bitweaver\Liberty\LibertyBase;
-$feedback = array();
+$feedback = [];
// fetch the attachment details
-if( @!BitBase::verifyId( $_REQUEST['attachment_id'] ) || !( $attachment = LibertyMime::getAttachment( $_REQUEST['attachment_id'], $_REQUEST ))) {
- $gBitSystem->fatalError( tra( "The Attachment ID given is not valid" ));
+if( !BitBase::verifyId( $_REQUEST['attachment_id'] ?? 0 ) || !( $attachment = LibertyMime::getAttachment( $_REQUEST['attachment_id'], $_REQUEST ))) {
+ $gBitSystem->fatalError( KernelTools::tra( "The Attachment ID given is not valid" ));
}
// first we need to check the permissions of the content the attachment belongs to since they inherit them
@@ -27,9 +30,9 @@ if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
if( !empty( $_REQUEST['plugin_submit'] )) {
// now that we have data for a plugin, we'll simply feed it back to the update function of that plugin
- $data = !empty( $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] ) ? $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] : array();
+ $data = !empty( $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] ) ? $_REQUEST['plugin'][$attachment['attachment_id']][$attachment['attachment_plugin_guid']] : [];
if( $gContent->updateAttachmentParams( $attachment['attachment_id'], $attachment['attachment_plugin_guid'], $data )) {
- $feedback['success'] = tra( "The data was successfully updated." );
+ $feedback['success'] = KernelTools::tra( "The data was successfully updated." );
} else {
$feedback['error'] = $gContent->mErrors;
}
@@ -46,7 +49,7 @@ if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
$_REQUEST['size'] = 'large';
}
- $attachment['original'] = ( $gContent->isOwner( $attachment ) || $gBitSystem->isFeatureActive( 'liberty_original_image' ));
+ $attachment['original'] = $gContent->isOwner( $attachment ) || $gBitSystem->isFeatureActive( 'liberty_original_image' );
$gBitSmarty->assign( 'attachment', $attachment );
$gBitSmarty->assign( 'gContent', $gContent );
@@ -56,8 +59,7 @@ if( $gContent = LibertyBase::getLibertyObject( $attachment['content_id'] ) ) {
$gBitSmarty->assign( 'view_template', $gLibertySystem->getMimeTemplate( 'view', $attachment['attachment_plugin_guid'] ));
$gBitSmarty->assign( 'edit_template', $gLibertySystem->getMimeTemplate( 'edit', $attachment['attachment_plugin_guid'] ));
- $gBitSystem->display( 'bitpackage:liberty/mime_view.tpl', tra( "View File" ), array( 'display_mode' => 'display' ));
+ $gBitSystem->display( 'bitpackage:liberty/mime_view.tpl', KernelTools::tra( "View File" ), array( 'display_mode' => 'display' ));
} else {
- $gBitSystem->fatalError( 'Not Found', NULL, NULL, HttpStatusCodes::HTTP_GONE );
-}
-?>
+ $gBitSystem->fatalError( 'Not Found', null, null, HttpStatusCodes::HTTP_GONE );
+} \ No newline at end of file