diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-28 16:19:05 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-28 16:19:05 +0100 |
| commit | 2140176e21e83d3779460277a31bcc7adaf9d3fe (patch) | |
| tree | f7e1d27e3428e63c2b635a4474e57cf14158241a /edit.php | |
| parent | d4cf8eb6b69ff23eedcba9359ce9a1ed4e2a7d9c (diff) | |
| download | fisheye-2140176e21e83d3779460277a31bcc7adaf9d3fe.tar.gz fisheye-2140176e21e83d3779460277a31bcc7adaf9d3fe.tar.bz2 fisheye-2140176e21e83d3779460277a31bcc7adaf9d3fe.zip | |
General code updated to PHP8.4 and namespace ... work in progress on updating some third party code
Diffstat (limited to 'edit.php')
| -rwxr-xr-x[-rw-r--r--] | edit.php | 60 |
1 files changed, 29 insertions, 31 deletions
@@ -7,14 +7,14 @@ /** * required setup */ -require_once( '../kernel/includes/setup_inc.php' ); - -require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php'); -require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeImage.php'); +namespace Bitweaver\Fisheye; +require_once '../kernel/includes/setup_inc.php'; +use Bitweaver\KernelTools; global $gBitSystem; -include_once( FISHEYE_PKG_INCLUDE_PATH.'gallery_lookup_inc.php' ); +include_once LIBERTY_PKG_INCLUDE_PATH.'liberty_lib.php'; +include_once FISHEYE_PKG_INCLUDE_PATH.'gallery_lookup_inc.php'; // Ensure the user has the permission to create new image galleries if( $gContent->isValid() ){ @@ -24,7 +24,7 @@ if( $gContent->isValid() ){ } if( $gBitUser->hasPermission( 'p_fisheye_change_thumb_size' ) ) { - $gBitSmarty->assign( 'thumbnailSizes', get_image_size_options( NULL )); + $gBitSmarty->assign( 'thumbnailSizes', \Bitweaver\Liberty\get_image_size_options( null )); } $gBitSmarty->assign( 'galleryPaginationTypes', $gContent::getAllLayouts() ); @@ -41,14 +41,14 @@ if( !empty( $_REQUEST['savegallery'] ) ) { $_REQUEST['cols_per_page'] = '1'; } if( $gContent->store( $_REQUEST ) ) { - $gContent->storePreference( 'is_public', !empty( $_REQUEST['is_public'] ) ? $_REQUEST['is_public'] : NULL ); - $gContent->storePreference( 'allow_comments', !empty( $_REQUEST['allow_comments'] ) ? $_REQUEST['allow_comments'] : NULL ); - $gContent->storePreference( 'gallery_pagination', !empty( $_REQUEST['gallery_pagination'] ) ? $_REQUEST['gallery_pagination'] : NULL ); - $gContent->storePreference( 'link_original_images', !empty( $_REQUEST['link_original_images'] ) ? $_REQUEST['link_original_images'] : NULL ); + $gContent->storePreference( 'is_public', !empty( $_REQUEST['is_public'] ) ? $_REQUEST['is_public'] : null ); + $gContent->storePreference( 'allow_comments', !empty( $_REQUEST['allow_comments'] ) ? $_REQUEST['allow_comments'] : null ); + $gContent->storePreference( 'gallery_pagination', !empty( $_REQUEST['gallery_pagination'] ) ? $_REQUEST['gallery_pagination'] : null ); + $gContent->storePreference( 'link_original_images', !empty( $_REQUEST['link_original_images'] ) ? $_REQUEST['link_original_images'] : null ); // make sure var is fully stuffed with current data $gContent->load(); // set the mappings, or if nothing checked, nuke them all - $gContent->addToGalleries( !empty( $_REQUEST['gallery_additions'] ) ? $_REQUEST['gallery_additions'] : NULL ); + $gContent->addToGalleries( !empty( $_REQUEST['gallery_additions'] ) ? $_REQUEST['gallery_additions'] : null ); if( !empty( $_REQUEST['generate_thumbnails'] ) ) { $gContent->generateThumbnails(); @@ -57,29 +57,29 @@ if( !empty( $_REQUEST['savegallery'] ) ) { die(); } } elseif( !empty( $_REQUEST['delete'] ) ) { - $gContent->hasUserPermission( 'p_fisheye_admin', TRUE, tra( "You do not have permission to delete this image gallery" ) ); + $gContent->hasUserPermission( 'p_fisheye_admin', true); // , KernelTools::tra( "You do not have permission to delete this image gallery" ) ); if( !empty( $_REQUEST['cancel'] ) ) { // user cancelled - just continue on, doing nothing } elseif( empty( $_REQUEST['confirm'] ) ) { - $formHash['delete'] = TRUE; + $formHash['delete'] = true; $formHash['gallery_id'] = $gContent->mGalleryId; $formHash['input'] = array( - '<label><input name="recurse" value="" type="radio" checked="checked" /> '.tra( 'Delete only images in this gallery. Sub-galleries will not be removed.' ).'</label>', - '<label><input name="recurse" value="all" type="radio" /> '.tra( 'Permanently delete all contents, even if they appear in other galleries.' ).'</label>', + '<label><input name="recurse" value="" type="radio" checked="checked" /> '.KernelTools::tra( 'Delete only images in this gallery. Sub-galleries will not be removed.' ).'</label>', + '<label><input name="recurse" value="all" type="radio" /> '.KernelTools::tra( 'Permanently delete all contents, even if they appear in other galleries.' ).'</label>', ); $gBitSystem->confirmDialog( $formHash, array( - 'warning' => tra('Are you sure you want to delete this gallery?') . ' ' . $gContent->getTitle(), - 'error' => tra('This cannot be undone!'), + 'warning' => KernelTools::tra('Are you sure you want to delete this gallery?') . ' ' . $gContent->getTitle(), + 'error' => KernelTools::tra('This cannot be undone!'), ) ); } else { $userId = $gContent->getField( 'user_id' ); - $recurseDelete = (!empty( $_REQUEST['recurse'] ) && ($_REQUEST['recurse'] == 'all') ); - - if( $gContent->expunge( $recurseDelete ) ) { + $gContent->pRecursiveDelete = !empty( $_REQUEST['recurse'] ) && ($_REQUEST['recurse'] == 'all'); + + if( $gContent->expunge() ) { header( "Location: ".FISHEYE_PKG_URL.'?user_id='.$userId ); } } @@ -90,19 +90,19 @@ if( !empty( $_REQUEST['savegallery'] ) ) { } // Initalize the errors list which contains any errors which occured during storage -$errors = (!empty($gContent->mErrors) ? $gContent->mErrors : array()); -$gBitSmarty->assignByRef('errors', $errors); +$errors = !empty($gContent->mErrors) ? $gContent->mErrors : []; +$gBitSmarty->assign('errors', $errors); $gBitSystem->setOnloadScript( 'updateGalleryPagination();' ); $gallery = $gContent->getParentGalleries(); -$gBitSmarty->assignByRef( 'parentGalleries', $gallery ); +$gBitSmarty->assign( 'parentGalleries', $gallery ); $getHash = array( 'user_id' => $gBitUser->mUserId, // 'max_records' => -1, -// 'no_thumbnails' => TRUE, +// 'no_thumbnails' => true, // 'sort_mode' => 'title_asc', -// 'show_empty' => TRUE, +// 'show_empty' => true, ); if( $gContent->mContentId ) { $getHash['contain_item'] = $gContent->mContentId; @@ -111,13 +111,11 @@ if( $gContent->mContentId ) { if( $gBitSystem->isFeatureActive( 'fisheye_show_all_to_admins' ) && $gBitUser->hasPermission( 'p_fisheye_admin' ) ) { unset( $getHash['user_id'] ); } elseif( $gBitSystem->isFeatureActive( 'fisheye_show_public_on_upload' ) ) { -// $getHash['show_public'] = TRUE; +// $getHash['show_public'] = true; } -$galleryTree = $gContent->generateList( $getHash, array( 'name' => "gallery_id", 'id' => "gallerylist", 'item_attributes' => array( 'class'=>'listingtitle'), 'radio_checkbox' => TRUE, ) ); -$gBitSmarty->assignByRef( 'galleryTree', $galleryTree ); +$galleryTree = $gContent->generateList( $getHash, array( 'name' => "gallery_id", 'id' => "gallerylist", 'item_attributes' => array( 'class'=>'listingtitle'), 'radio_checkbox' => true, ) ); +$gBitSmarty->assign( 'galleryTree', $galleryTree ); $gContent->invokeServices( 'content_edit_function' ); -$gBitSystem->display( 'bitpackage:fisheye/edit_gallery.tpl', tra('Edit Gallery: ').$gContent->getTitle() , array( 'display_mode' => 'edit' )); - -?> +$gBitSystem->display( 'bitpackage:fisheye/edit_gallery.tpl', KernelTools::tra('Edit Gallery: ').$gContent->getTitle() , array( 'display_mode' => 'edit' )); |
