diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-28 16:15:30 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-28 16:15:30 +0100 |
| commit | d77b5a9732361455895cbd76894a26765bff0c97 (patch) | |
| tree | 86667ea79df3d8c7c15a7682be7bc15ce2f8a5da | |
| parent | 1d5acb912c32b33ae04d7e6794be73e4030f2643 (diff) | |
| download | fisheye-d77b5a9732361455895cbd76894a26765bff0c97.tar.gz fisheye-d77b5a9732361455895cbd76894a26765bff0c97.tar.bz2 fisheye-d77b5a9732361455895cbd76894a26765bff0c97.zip | |
Module code updated to PHP8.4 and namespace ... work in progress on updating some third party code
| -rwxr-xr-x[-rw-r--r--] | modules/help_mod_images.tpl | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | modules/mod_banner_rand.php | 29 | ||||
| -rwxr-xr-x[-rw-r--r--] | modules/mod_banner_rand.tpl | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | modules/mod_images.php | 47 | ||||
| -rwxr-xr-x[-rw-r--r--] | modules/mod_images.tpl | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | modules/mod_navigation.tpl | 0 | ||||
| -rwxr-xr-x | modules/mod_specials.php | 25 |
7 files changed, 50 insertions, 53 deletions
diff --git a/modules/help_mod_images.tpl b/modules/help_mod_images.tpl index 7b92a39..7b92a39 100644..100755 --- a/modules/help_mod_images.tpl +++ b/modules/help_mod_images.tpl diff --git a/modules/mod_banner_rand.php b/modules/mod_banner_rand.php index 719cd3b..6110f2c 100644..100755 --- a/modules/mod_banner_rand.php +++ b/modules/mod_banner_rand.php @@ -5,30 +5,31 @@ * @subpackage modules */ -global $gQueryUserId, $gContent, $moduleParams; - -// makes things in older modules easier -extract( $moduleParams ); - /** * required setup */ -require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php' ); +namespace Bitweaver\Fisheye; +use Bitweaver\KernelTools; -$image = new FisheyeImage(); +global $gBitSmarty, $gContent; +// makes things in older modules easier -$display = TRUE; +if ( !empty($gBitSmarty->tpl_vars) ) { + $tpls = $gBitSmarty->tpl_vars; + $module_params = $tpls['moduleParams']; + $listHash = $module_params->value; + $listHash['gallery_id'] = $module_params->value['module_rows']; +} +$image = new FisheyeImage(); -$listHash = $module_params; +$display = true; $listHash['size'] = 'extra-large'; -$listHash['gallery_id'] = $module_rows; $listHash['max_records'] = 5; $listHash['sort_mode'] = 'random'; $images = $image->getList( $listHash ); $moduleTitle = 'Banner Image'; -$_template->tpl_vars['moduleTitle'] = new Smarty_variable( $title ); -$_template->tpl_vars['modImages'] = new Smarty_variable( $images ); -$_template->tpl_vars['module_params'] = new Smarty_variable( $module_params ); -?> +$gBitSmarty->assign( 'moduleTitle', $moduleTitle ); +$gBitSmarty->assign( 'modImages', $images ); +$gBitSmarty->assign( 'module_params', $listHash ); diff --git a/modules/mod_banner_rand.tpl b/modules/mod_banner_rand.tpl index 6a0db01..5548307 100644..100755 --- a/modules/mod_banner_rand.tpl +++ b/modules/mod_banner_rand.tpl @@ -7,7 +7,7 @@ <div id="banner"> <ul id="background"> {foreach from=$modImages item=modImg} - <li><img src="/liberty/download_file.php?attachment_id={$modImg.image_id}" title="{$modImg.title|escape}" alt="{$modImg.title|escape}" /></li> + <li><img src="/liberty/download/file/{$modImg.image_id|default:0}" title="{$modImg.title|default:''}" alt="{$modImg.title|default:''}" /></li> {/foreach} </ul> </div> diff --git a/modules/mod_images.php b/modules/mod_images.php index b8cd111..221e20b 100644..100755 --- a/modules/mod_images.php +++ b/modules/mod_images.php @@ -5,19 +5,19 @@ * @subpackage modules */ -global $gQueryUserId, $gContent, $moduleParams; - -// makes things in older modules easier -extract( $moduleParams ); - /** * required setup */ -require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php' ); +namespace Bitweaver\Fisheye; +use Bitweaver\KernelTools; +use Bitweaver\Users\RoleUser; +global $gQueryUserId, $gContent, $moduleParams; +// makes things in older modules easier +extract( $moduleParams ); $image = new FisheyeImage(); -$display = TRUE; +$display = true; $listHash = $module_params; @@ -34,19 +34,17 @@ if( $display ) { if( $gQueryUserId ) { $listHash['user_id'] = $gQueryUserId; } elseif( !empty( $_REQUEST['user_id'] ) ) { - $_template->tpl_vars['userGallery'] = new Smarty_variable( $_REQUEST['user_id'] ); + $gBitSmarty->assign( 'userGallery', $_REQUEST['user_id'] ); $listHash['user_id'] = $_REQUEST['user_id']; } elseif( !empty( $module_params['recent_users'] ) ) { - $listHash['recent_users'] = TRUE; + $listHash['recent_users'] = true; } // this is needed to avoid wrong sort_modes entered resulting in db errors $sort_options = array( 'hits', 'created' ); - if( !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sort_options ) ) { - $sort_mode = $module_params['sort_mode'].'_desc'; - } else { - $sort_mode = 'random'; - } + $sort_mode = !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sort_options ) + ? $module_params['sort_mode'].'_desc' : 'random'; + $listHash['sort_mode'] = $sort_mode; $images = $image->getList( $listHash ); @@ -66,24 +64,23 @@ if( $display ) { } $moduleTitle .= ' Images'; - $moduleTitle = tra( $moduleTitle ); + $moduleTitle = KernelTools::tra( $moduleTitle ); if( !empty( $listHash['user_id'] ) ) { - $moduleTitle .= ' '.tra('by').' '.BitUser::getDisplayNameFromHash( current( $images ), TRUE ); + $moduleTitle .= ' '.KernelTools::tra('by').' '.RoleUser::getDisplayNameFromHash( current( $images ), true ); } elseif( !empty( $listHash['recent_users'] ) ) { - $moduleTitle .= ' '.tra( 'by' ).' <a href="'.USERS_PKG_URL.'">'.tra( 'New Users' ).'</a>'; + $moduleTitle .= ' '.KernelTools::tra( 'by' ).' <a href="'.USERS_PKG_URL.'">'.KernelTools::tra( 'New Users' ).'</a>'; } $listHash['sort_mode'] = $sort_mode; - $_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleTitle ); + $gBitSmarty->assign( 'moduleTitle', $moduleTitle ); } else { - $_template->tpl_vars['moduleTitle'] = new Smarty_variable( $title ); + $gBitSmarty->assign( 'moduleTitle', $title ); } - $_template->tpl_vars['imageSort'] = new Smarty_variable( $sort_mode ); - $_template->tpl_vars['modImages'] = new Smarty_variable( $images ); - $_template->tpl_vars['module_params'] = new Smarty_variable( $module_params ); - $_template->tpl_vars['maxlen'] = new Smarty_variable( isset( $module_params["maxlen"] ) ); - $_template->tpl_vars['maxlendesc'] = new Smarty_variable( isset( $module_params["maxlendesc"] ) ); + $gBitSmarty->assign( 'imageSort', $sort_mode ); + $gBitSmarty->assign( 'modImages', $images ); + $gBitSmarty->assign( 'module_params', $module_params ); + $gBitSmarty->assign( 'maxlen', isset( $module_params["maxlen"] ) ); + $gBitSmarty->assign( 'maxlendesc', isset( $module_params["maxlendesc"] ) ); } -?> diff --git a/modules/mod_images.tpl b/modules/mod_images.tpl index 78acfec..78acfec 100644..100755 --- a/modules/mod_images.tpl +++ b/modules/mod_images.tpl diff --git a/modules/mod_navigation.tpl b/modules/mod_navigation.tpl index a415fd7..a415fd7 100644..100755 --- a/modules/mod_navigation.tpl +++ b/modules/mod_navigation.tpl diff --git a/modules/mod_specials.php b/modules/mod_specials.php index 1f24291..1d7a786 100755 --- a/modules/mod_specials.php +++ b/modules/mod_specials.php @@ -5,19 +5,19 @@ * @subpackage modules */ +/** + * required setup + */ +namespace Bitweaver\Fisheye; +use Bitweaver\KernelTools; global $gQueryUserId, $gContent, $moduleParams; // makes things in older modules easier extract( $moduleParams ); -/** - * required setup - */ -require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php' ); - $image = new FisheyeImage(); -$display = TRUE; +$display = true; $listHash = $module_params; $listHash['gallery_id'] = 3; @@ -29,12 +29,11 @@ if( $display ) { $images = $image->getList( $listHash ); $moduleTitle = 'Specials'; - $moduleTitle = tra( $moduleTitle ); + $moduleTitle = KernelTools::tra( $moduleTitle ); - $_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleTitle ); - $_template->tpl_vars['modImages'] = new Smarty_variable( $images ); - $_template->tpl_vars['module_params'] = new Smarty_variable( $module_params ); - $_template->tpl_vars['maxlen'] = new Smarty_variable( isset( $module_params["maxlen"] ) ? $module_params["maxlen"] : 0 ); - $_template->tpl_vars['maxlendesc'] = new Smarty_variable( isset( $module_params["maxlendesc"] ) ? $module_params["maxlendesc"] : 0 ); + $gBitSmarty->assign( 'moduleTitle', $moduleTitle ); + $gBitSmarty->assign( 'modImages', $images ); + $gBitSmarty->assign( 'module_params', $module_params ); + $gBitSmarty->assign( 'maxlen', isset( $module_params["maxlen"] ) ? $module_params["maxlen"] : 0 ); + $gBitSmarty->assign( 'maxlendesc', isset( $module_params["maxlendesc"] ) ? $module_params["maxlendesc"] : 0 ); } -?> |
