diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-27 15:15:48 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-27 15:15:48 +0100 |
| commit | 407bc340dc419e4448656764ac95e9d90482a867 (patch) | |
| tree | ec3d499580a631213610c101e88ee0a546e9989a /attachment_uploader.php | |
| parent | 6e4c7248e7e20a203b2047dfba7af9fc068d9c42 (diff) | |
| download | liberty-407bc340dc419e4448656764ac95e9d90482a867.tar.gz liberty-407bc340dc419e4448656764ac95e9d90482a867.tar.bz2 liberty-407bc340dc419e4448656764ac95e9d90482a867.zip | |
Kernel functions changes to cover uninitialized variables and style changes for PHP8.4
Diffstat (limited to 'attachment_uploader.php')
| -rwxr-xr-x[-rw-r--r--] | attachment_uploader.php | 22 |
1 files changed, 14 insertions, 8 deletions
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' )); ?> |
