diff options
| author | lsces <lester@lsces.co.uk> | 2026-03-27 17:48:20 +0000 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-03-27 17:48:20 +0000 |
| commit | 6b4354745aad895cb0ab72978dacacc3513a0c7f (patch) | |
| tree | acab53032eda0025ba1a1a90a50442a86aac921a | |
| parent | 709c60560bb7b96a64d6ee223247196a2a99f545 (diff) | |
| download | fisheye-6b4354745aad895cb0ab72978dacacc3513a0c7f.tar.gz fisheye-6b4354745aad895cb0ab72978dacacc3513a0c7f.tar.bz2 fisheye-6b4354745aad895cb0ab72978dacacc3513a0c7f.zip | |
$moduleParams is now a smarty value rather than array. The passing of parameters to modules needs reviewing across all the modules.
| -rwxr-xr-x | modules/mod_images.php | 28 | ||||
| -rwxr-xr-x | modules/mod_images.tpl | 6 |
2 files changed, 17 insertions, 17 deletions
diff --git a/modules/mod_images.php b/modules/mod_images.php index 221e20b..19be005 100755 --- a/modules/mod_images.php +++ b/modules/mod_images.php @@ -13,13 +13,13 @@ use Bitweaver\KernelTools; use Bitweaver\Users\RoleUser; global $gQueryUserId, $gContent, $moduleParams; // makes things in older modules easier -extract( $moduleParams ); +// extract( $moduleParams ); $image = new FisheyeImage(); $display = true; -$listHash = $module_params; +$listHash = $moduleParams->value; if( !empty( $gContent ) && $gContent->getField( 'content_type_guid' ) == FISHEYEGALLERY_CONTENT_TYPE_GUID ) { $displayCount = empty( $gContent->mItems ) ? 0 : count( $gContent->mItems ); @@ -30,20 +30,20 @@ if( !empty( $gContent ) && $gContent->getField( 'content_type_guid' ) == FISHEYE if( $display ) { - $listHash['max_records'] = $module_rows; + $listHash['max_records'] = $module_rows ?? 3; if( $gQueryUserId ) { $listHash['user_id'] = $gQueryUserId; } elseif( !empty( $_REQUEST['user_id'] ) ) { $gBitSmarty->assign( 'userGallery', $_REQUEST['user_id'] ); $listHash['user_id'] = $_REQUEST['user_id']; - } elseif( !empty( $module_params['recent_users'] ) ) { + } elseif( !empty( $listHash['recent_users'] ) ) { $listHash['recent_users'] = true; } // this is needed to avoid wrong sort_modes entered resulting in db errors - $sort_options = array( 'hits', 'created' ); - $sort_mode = !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sort_options ) - ? $module_params['sort_mode'].'_desc' : 'random'; + $sort_options = [ 'hits', 'created' ]; + $sort_mode = !empty( $listHash['sort_mode'] ) && in_array( $listHash['sort_mode'], $sort_options ) + ? $listHash['sort_mode'].'_desc' : 'random'; $listHash['sort_mode'] = $sort_mode; @@ -51,12 +51,12 @@ if( $display ) { if( empty( $title ) && $images ) { $moduleTitle = ''; - if( !empty( $module_params['sort_mode'] ) ) { - if( $module_params['sort_mode'] == 'random' ) { + if( !empty( $listHash['sort_mode'] ) ) { + if( $listHash['sort_mode'] == 'random' ) { $moduleTitle = 'Random'; - } elseif( $module_params['sort_mode'] == 'created' ) { + } elseif( $listHash['sort_mode'] == 'created' ) { $moduleTitle = 'Recent'; - } elseif( $module_params['sort_mode'] == 'hits' ) { + } elseif( $listHash['sort_mode'] == 'hits' ) { $moduleTitle = 'Popular'; } } else { @@ -80,7 +80,7 @@ if( $display ) { $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"] ) ); + $gBitSmarty->assign( 'module_params', $listHash ); + $gBitSmarty->assign( 'maxlen', isset( $listHash["maxlen"] ) ); + $gBitSmarty->assign( 'maxlendesc', isset( $listHash["maxlendesc"] ) ); } diff --git a/modules/mod_images.tpl b/modules/mod_images.tpl index 81eb27d..d69c59a 100755 --- a/modules/mod_images.tpl +++ b/modules/mod_images.tpl @@ -4,10 +4,10 @@ <ul class="list-unstyled"> {foreach from=$modImages item=modImg} <li class="{cycle values='odd,even'} item"> - <a href="{$modImg.display_url}" title="{$modImg.title|escape} - {$modImg.last_modified|bit_short_datetime}, by {displayname user=$modImg.modifier_user real_name=$modImg.modifier_real_name nolink=1}{if (strlen($modImg.title) > $maxlen) && ($maxlen > 0)}, {$modImg.title|escape}{/if}"> + <a href="{$modImg.display_url}" title="{$modImg.title|escape} - {$modImg.last_modified|bit_short_datetime}, by {displayname user=$modImg.modifier_user ?? '' real_name=$modImg.modifier_real_name ?? '' nolink=1}{if (strlen($modImg.title) > $maxlen) && ($maxlen > 0)}, {$modImg.title|escape}{/if}"> <img src="{$modImg.thumbnail_url}" title="{$modImg.title|escape}" alt="{$modImg.title|escape}" /> - {if !$modImg.has_machine_name} + {if !empty($modImg.has_machine_name)} <br /> {if $maxlen gt 0} {$modImg.title|escape|truncate:$maxlen:"...":true} @@ -17,7 +17,7 @@ {/if} </a> - {if $module_params.description} + {if !empty($module_params.description)} <br /> {if $maxlendesc gt 0} {$modImg.data|escape|truncate:$maxlendesc:"...":true} |
