summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-28 16:10:06 +0100
committerlsces <lester@lsces.co.uk>2025-08-28 16:10:06 +0100
commita27f166eed1064ef7b7ff4ce4db94d92d548fee4 (patch)
treeb62a1aef219b5ce89c6359bfc937d101d79b4407
parent357f49b317f2b7c5aac495d4c8af855ad8032c0d (diff)
downloadfisheye-a27f166eed1064ef7b7ff4ce4db94d92d548fee4.tar.gz
fisheye-a27f166eed1064ef7b7ff4ce4db94d92d548fee4.tar.bz2
fisheye-a27f166eed1064ef7b7ff4ce4db94d92d548fee4.zip
Admin code updated to PHP8.4 and namespace
-rwxr-xr-x[-rw-r--r--]admin/admin_fisheye_inc.php142
-rwxr-xr-x[-rw-r--r--]admin/schema_inc.php108
-rw-r--r--admin/upgrade_inc.php58
3 files changed, 126 insertions, 182 deletions
diff --git a/admin/admin_fisheye_inc.php b/admin/admin_fisheye_inc.php
index 3fe94e2..6eece9f 100644..100755
--- a/admin/admin_fisheye_inc.php
+++ b/admin/admin_fisheye_inc.php
@@ -1,144 +1,148 @@
<?php
+
+use Bitweaver\KernelTools;
+
//This holds the checkbox options for what to display on the 'list galleries' page
-$formGalleryGeneral = array(
- "fisheye_menu_text" => array(
+$formGalleryGeneral = [
+ "fisheye_menu_text" => [
'label' => 'Menu Text',
'note' => '',
'type' => 'text'
- ),
+ ],
/* Disabled for now - spiderr
- "feature_megaupload" => array(
+ "feature_megaupload" => [
'label' => 'Use <a href="http://sourceforge.net/projects/megaupload">MegaUpload</a>',
'note' => 'Upload progress meter that requires Perl and ExecCGI permission',
'type' => 'checkbox'
- ),
+ ],
*/
- "liberty_offline_thumbnailer" => array(
+ "liberty_offline_thumbnailer" => [
'label' => 'Background Thumbnailer',
'note' => 'Thumbnails will be queued and regenerated by a background command-line script. For more information, see '.FISHEYE_PKG_PATH.'thumbaniler.php or you can <a href="'.FISHEYE_PKG_URL.'thumbnailer.php">run it manually</a>',
'type' => 'checkbox'
- ),
- "fisheye_show_public_on_upload" => array(
+ ],
+ "fisheye_show_public_on_upload" => [
'label' => 'Show Public Galleries on Upload',
'note' => 'Enable this if you want to have all public galleries visible when uploading files. This might cause problems on large sites with many public galleries.',
'type' => 'checkbox'
- ),
- "fisheye_show_all_to_admins" => array(
+ ],
+ "fisheye_show_all_to_admins" => [
'label' => 'Show all Galleries to Administrators',
'note' => 'This will allow gallery admins to upload and move around images in all galleries. This might cause problems on large sites with many galleries.',
'type' => 'checkbox'
- ),
-);
+ ],
+];
if( !$gBitSystem->isPackageActive( 'gigaupload' ) ) {
- $formGalleryGeneral["fisheye_extended_upload_slots"] = array(
+ $formGalleryGeneral["fisheye_extended_upload_slots"] = [
'label' => 'Extended Upload Slots',
'note' => 'When you enable this, users can enter the title and description of the file when uploading them.',
'type' => 'checkbox'
- );
+ ];
};
$gBitSmarty->assign('formGalleryGeneral', $formGalleryGeneral);
-$formGalleryListLists = array(
- "fisheye_list_title" => array(
+$formGalleryListLists = [
+ "fisheye_list_title" => [
'label' => 'Gallery title',
'note' => 'List the title of the gallery.',
- ),
- "fisheye_list_thumbnail" => array(
+ ],
+ "fisheye_list_thumbnail" => [
'label' => 'Thumbnail',
'note' => 'Display a small thumbnail associated with a gallery',
- ),
- "fisheye_list_description" => array(
+ ],
+ "fisheye_list_description" => [
'label' => 'Description',
'note' => 'List the description of a gallery',
- ),
- "fisheye_list_user" => array(
+ ],
+ "fisheye_list_user" => [
'label' => 'Creator',
'note' => 'List the name of the user who created the gallery',
- ),
- "fisheye_list_hits" => array(
+ ],
+ "fisheye_list_hits" => [
'label' => 'Hits',
'note' => 'List number of hits this gallery has receieved',
- ),
- "fisheye_list_created" => array(
+ ],
+ "fisheye_list_created" => [
'label' => 'Creation date',
'note' => 'List the creation date of the gallery',
- ),
- "fisheye_list_lastmodif" => array(
+ ],
+ "fisheye_list_lastmodif" => [
'label' => 'Last modification',
'note' => 'List date this gallery was last modified',
- ),
-);
+ ],
+];
$gBitSmarty->assign('formGalleryListLists', $formGalleryListLists);
// This holds the checkbox options for what to display on a 'view gallery' page
-$formGalleryLists = array(
- "fisheye_gallery_list_title" => array(
+$formGalleryLists = [
+ "fisheye_gallery_list_title" => [
'label' => 'Gallery title',
'note' => 'When viewing a gallery, display the title of the gallery',
- ),
- "fisheye_gallery_list_description" => array(
+ ],
+ "fisheye_gallery_list_description" => [
'label' => 'Gallery description',
'note' => 'When viewing a gallery, display the description of the gallery below the title',
- ),
- "fisheye_gallery_list_image_titles" => array(
+ ],
+ "fisheye_gallery_list_image_titles" => [
'label' => 'Image titles',
'note' => 'Show image titles underneath each thumbnail',
- ),
- "fisheye_gallery_hide_modules" => array(
+ ],
+ "fisheye_gallery_hide_modules" => [
'label' => 'Hide modules for galleries',
'note' => 'When viewing a gallery, hide the left and right module columns',
- ),
- "fisheye_gallery_list_image_descriptions" => array(
+ ],
+ "fisheye_gallery_list_image_descriptions" => [
'label' => 'Image description',
'note' => 'Show image descriptions underneath each thumbnail',
- ),
- "fisheye_gallery_div_layout" => array(
+ ],
+ "fisheye_gallery_div_layout" => [
'label' => '&lt;div&gt; based Layout',
'note' => 'You can use a &lt;div&gt; based layout, which will adjust the number of images in each row to the width of the browser. Please visit the online help for more information.',
'page' => 'FisheyePackage',
- ),
-);
+ ],
+];
$gBitSmarty->assign( 'formGalleryLists',$formGalleryLists );
// This holds the checkbox options for what to display on an 'image details' page
-$formImageLists = array(
- "fisheye_image_list_title" => array(
+$formImageLists = [
+ "fisheye_image_list_title" => [
'label' => 'Image title',
'note' => 'When viewing an image, display the title of the image',
- ),
- "fisheye_image_list_description" => array(
+ ],
+ "fisheye_image_list_description" => [
'label' => 'Image description',
'note' => 'When viewing an image, display the description of the image below the title',
- ),
- "fisheye_image_hide_modules" => array(
+ ],
+ "fisheye_image_hide_modules" => [
'label' => 'Hide modules for images',
'note' => 'When viewing an image, hide the left and right module columns',
- ),
- "gallerybar_use_icons" => array(
+ ],
+ "gallerybar_use_icons" => [
'label' => 'Use icons in the gallery bar',
'note' => 'When viewing an image, show <strong>previous</strong> and <strong>next</strong> links as images instead of words',
- ),
- "gallery_bar_use_thumbnails" => array(
+ ],
+ "gallery_bar_use_thumbnails" => [
'label' => 'Use Thumbnails in gallery bar',
'note' => 'When viewing an image, show previous and next <strong>thumbnails</strong> with the appropriate links.',
- ),
-);
+ ],
+];
$gBitSmarty->assign( 'formImageLists', $formImageLists);
-require_once( FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php' );
+use Bitweaver\Fisheye\FisheyeGallery;
+
$gBitSmarty->assign( 'galleryPaginationTypes', FisheyeGallery::getAllLayouts() );
-$sortOptions = array(
- '' => tra( 'None' ),
- 'lc.title_desc' => tra( 'Image Title' ). ' - '.tra( 'descending' ),
- 'lc.title_asc' => tra( 'Image Title' ). ' - '.tra( 'ascending' ),
- 'lc.created_desc' => tra( 'Date Uploaded' ).' - '.tra( 'descending' ),
- 'lc.created_asc' => tra( 'Date Uploaded' ).' - '.tra( 'ascending' ),
- 'lc.last_modified_desc' => tra( 'Last Modified' ).' - '.tra( 'descending' ),
- 'lc.last_modified_asc' => tra( 'Last Modified' ).' - '.tra( 'ascending' ),
-);
+$sortOptions = [
+ '' => KernelTools::tra( 'None' ),
+ 'lc.title_desc' => KernelTools::tra( 'Image Title' ). ' - '.KernelTools::tra( 'descending' ),
+ 'lc.title_asc' => KernelTools::tra( 'Image Title' ). ' - '.KernelTools::tra( 'ascending' ),
+ 'lc.created_desc' => KernelTools::tra( 'Date Uploaded' ).' - '.KernelTools::tra( 'descending' ),
+ 'lc.created_asc' => KernelTools::tra( 'Date Uploaded' ).' - '.KernelTools::tra( 'ascending' ),
+ 'lc.last_modified_desc' => KernelTools::tra( 'Last Modified' ).' - '.KernelTools::tra( 'descending' ),
+ 'lc.last_modified_asc' => KernelTools::tra( 'Last Modified' ).' - '.KernelTools::tra( 'ascending' ),
+];
$gBitSmarty->assign( 'sortOptions', $sortOptions );
-$gBitSmarty->assign( 'imageSizes', get_image_size_options( FALSE ));
+$gBitSmarty->assign( 'imageSizes', Bitweaver\Liberty\get_image_size_options( false ));
//vd($_REQUEST);
if (!empty($_REQUEST['fisheyeAdminSubmit'])) {
@@ -161,7 +165,7 @@ if (!empty($_REQUEST['fisheyeAdminSubmit'])) {
simple_set_toggle($item, FISHEYE_PKG_NAME);
}
- foreach( array( 'fisheye_list_thumbnail_size', 'fisheye_gallery_default_thumbnail_size', 'default_gallery_pagination', 'rows_per_page', 'cols_per_page', 'total_per_page', 'lines_per_page', 'galleriffic_style', 'fisheye_gallery_default_sort_mode' ) as $key ) {
+ foreach( [ 'fisheye_list_thumbnail_size', 'fisheye_gallery_default_thumbnail_size', 'default_gallery_pagination', 'rows_per_page', 'cols_per_page', 'total_per_page', 'lines_per_page', 'galleriffic_style', 'fisheye_gallery_default_sort_mode' ] as $key ) {
$gBitSystem->storeConfig($key, $_REQUEST[$key], FISHEYE_PKG_NAME);
}
@@ -174,5 +178,3 @@ if (!empty($_REQUEST['fisheyeAdminSubmit'])) {
}
}
-
-?>
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 0aee38b..f1852a3 100644..100755
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -1,6 +1,6 @@
<?php
-$tables = array(
+$tables = [
'fisheye_gallery' => "
gallery_id I4 PRIMARY,
@@ -25,7 +25,7 @@ $tables = array(
width I4,
height I4
",
-);
+];
global $gBitInstaller;
@@ -33,77 +33,77 @@ foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( FISHEYE_PKG_NAME, $tableName, $tables[$tableName] );
}
-$indices = array (
- 'fisheye_gallery_id_idx' => array( 'table' => 'fisheye_gallery', 'cols' => 'gallery_id', 'opts' => NULL ),
- 'fisheye_gallery_content_idx' => array( 'table' => 'fisheye_gallery', 'cols' => 'content_id', 'opts' => array( 'UNIQUE' ) ),
- 'fisheye_image_id_idx' => array( 'table' => 'fisheye_image', 'cols' => 'image_id', 'opts' => NULL ),
- 'fisheye_image_content_idx' => array( 'table' => 'fisheye_image', 'cols' => 'content_id', 'opts' => array( 'UNIQUE' ) ),
-);
+$indices = [
+ 'fisheye_gallery_id_idx' => [ 'table' => 'fisheye_gallery', 'cols' => 'gallery_id', 'opts' => null ],
+ 'fisheye_gallery_content_idx' => [ 'table' => 'fisheye_gallery', 'cols' => 'content_id', 'opts' => [ 'UNIQUE' ] ],
+ 'fisheye_image_id_idx' => [ 'table' => 'fisheye_image', 'cols' => 'image_id', 'opts' => null ],
+ 'fisheye_image_content_idx' => [ 'table' => 'fisheye_image', 'cols' => 'content_id', 'opts' => [ 'UNIQUE' ] ],
+];
$gBitInstaller->registerSchemaIndexes( FISHEYE_PKG_NAME, $indices );
-$gBitInstaller->registerPackageInfo( FISHEYE_PKG_NAME, array(
+$gBitInstaller->registerPackageInfo( FISHEYE_PKG_NAME, [
'description' => "FishEye is a package for creating image galleries",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>'
-) );
+] );
// ### Sequences
-$sequences = array (
- 'fisheye_gallery_id_seq' => array( 'start' => 1 ),
- 'fisheye_image_id_seq' => array( 'start' => 1 )
-);
+$sequences = [
+ 'fisheye_gallery_id_seq' => [ 'start' => 1 ],
+ 'fisheye_image_id_seq' => [ 'start' => 1 ]
+];
$gBitInstaller->registerSchemaSequences( FISHEYE_PKG_NAME, $sequences );
// ### Default Preferences
-$gBitInstaller->registerPreferences( FISHEYE_PKG_NAME, array(
- array( FISHEYE_PKG_NAME, 'fisheye_list_title','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_list_created','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_list_user','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_list_hits','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_list_thumbnail','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_list_thumbnail_size','small'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_list_title','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_list_description','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_list_image_titles','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_default_rows_per_page','5'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_default_cols_per_page','3'),
- array( FISHEYE_PKG_NAME, 'fisheye_gallery_default_thumbnail_size','small'),
- array( FISHEYE_PKG_NAME, 'fisheye_image_list_title','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_image_list_description','y'),
- array( FISHEYE_PKG_NAME, 'fisheye_image_default_thumbnail_size','medium'),
- array( FISHEYE_PKG_NAME, 'fisheye_menu_text','Image Galleries'),
+$gBitInstaller->registerPreferences( FISHEYE_PKG_NAME, [
+ [ FISHEYE_PKG_NAME, 'fisheye_list_title','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_list_created','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_list_user','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_list_hits','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_list_thumbnail','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_list_thumbnail_size','small'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_list_title','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_list_description','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_list_image_titles','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_default_rows_per_page','5'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_default_cols_per_page','3'],
+ [ FISHEYE_PKG_NAME, 'fisheye_gallery_default_thumbnail_size','small'],
+ [ FISHEYE_PKG_NAME, 'fisheye_image_list_title','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_image_list_description','y'],
+ [ FISHEYE_PKG_NAME, 'fisheye_image_default_thumbnail_size','medium'],
+ [ FISHEYE_PKG_NAME, 'fisheye_menu_text','Image Galleries'],
// more intuitive if we can see all galleries we can upload images to
- array( FISHEYE_PKG_NAME, 'fisheye_show_public_on_upload','n'),
- array( FISHEYE_PKG_NAME, 'fisheye_show_all_to_admins','n'),
-) );
+ [ FISHEYE_PKG_NAME, 'fisheye_show_public_on_upload','n'],
+ [ FISHEYE_PKG_NAME, 'fisheye_show_all_to_admins','n'],
+] );
// ### Default User Permissions
-$gBitInstaller->registerUserPermissions( FISHEYE_PKG_NAME, array(
- array('p_fisheye_list_galleries', 'Can list image galleries', 'basic', FISHEYE_PKG_NAME),
- array('p_fisheye_view', 'Can view image galleries', 'basic', FISHEYE_PKG_NAME),
- array('p_fisheye_create', 'Can create an image gallery', 'registered', FISHEYE_PKG_NAME),
- array('p_fisheye_update', 'Can update image gallery', 'editors', FISHEYE_PKG_NAME),
- array('p_fisheye_upload', 'Can upload images to gallery', 'registered', FISHEYE_PKG_NAME),
- array('p_fisheye_admin', 'Can admin image galleries', 'editors', FISHEYE_PKG_NAME),
- array('p_fisheye_upload_nonimages', 'Can upload non_image files', 'editors', FISHEYE_PKG_NAME),
- array('p_fisheye_change_thumb_size', 'Can set the thumbnail size for a gallery', 'editors', FISHEYE_PKG_NAME),
- array('p_fisheye_create_public_gal', 'Can create public galleries any user can load images into', 'editors', FISHEYE_PKG_NAME),
- array('p_fisheye_download_gallery_arc',' Can download an archived copy of Fisheye gallery', 'registered', FISHEYE_PKG_NAME)
-) );
+$gBitInstaller->registerUserPermissions( FISHEYE_PKG_NAME, [
+ ['p_fisheye_list_galleries', 'Can list image galleries', 'basic', FISHEYE_PKG_NAME],
+ ['p_fisheye_view', 'Can view image galleries', 'basic', FISHEYE_PKG_NAME],
+ ['p_fisheye_create', 'Can create an image gallery', 'registered', FISHEYE_PKG_NAME],
+ ['p_fisheye_update', 'Can update image gallery', 'editors', FISHEYE_PKG_NAME],
+ ['p_fisheye_upload', 'Can upload images to gallery', 'registered', FISHEYE_PKG_NAME],
+ ['p_fisheye_admin', 'Can admin image galleries', 'editors', FISHEYE_PKG_NAME],
+ ['p_fisheye_upload_nonimages', 'Can upload non_image files', 'editors', FISHEYE_PKG_NAME],
+ ['p_fisheye_change_thumb_size', 'Can set the thumbnail size for a gallery', 'editors', FISHEYE_PKG_NAME],
+ ['p_fisheye_create_public_gal', 'Can create public galleries any user can load images into', 'editors', FISHEYE_PKG_NAME],
+ ['p_fisheye_download_gallery_arc',' Can download an archived copy of Fisheye gallery', 'registered', FISHEYE_PKG_NAME]
+] );
if( defined( 'RSS_PKG_NAME' )) {
- $gBitInstaller->registerPreferences( FISHEYE_PKG_NAME, array(
- array( RSS_PKG_NAME, FISHEYE_PKG_NAME.'_rss', 'y'),
- ));
+ $gBitInstaller->registerPreferences( FISHEYE_PKG_NAME, [
+ [ RSS_PKG_NAME, FISHEYE_PKG_NAME.'_rss', 'y'],
+ ]);
}
// ### Register content types
-$gBitInstaller->registerContentObjects( FISHEYE_PKG_NAME, array(
+$gBitInstaller->registerContentObjects( FISHEYE_PKG_NAME, [
'FisheyeGallery'=>FISHEYE_PKG_CLASS_PATH.'FisheyeGallery.php',
'FisheyeImage'=>FISHEYE_PKG_CLASS_PATH.'FisheyeImage.php',
-));
+] );
// Requirements
-$gBitInstaller->registerRequirements( FISHEYE_PKG_NAME, array(
- 'liberty' => array( 'min' => '2.1.4' ),
-));
+$gBitInstaller->registerRequirements( FISHEYE_PKG_NAME, [
+ 'liberty' => [ 'min' => '5.0.0' ],
+]);
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php
deleted file mode 100644
index 5e1fd0f..0000000
--- a/admin/upgrade_inc.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-global $gBitSystem, $gUpgradeFrom, $gUpgradeTo;
-
-$upgrades = array(
-
- 'BWR1' => array(
- 'BWR2' => array(
-// de-tikify tables
-array( 'DATADICT' => array(
- array( 'RENAMETABLE' => array(
- 'tiki_fisheye_gallery' => 'fisheye_gallery',
- 'tiki_fisheye_gallery_image_map' => 'fisheye_gallery_image_map',
- 'tiki_fisheye_image' => 'fisheye_image',
- 'tiki_thumbnail_queue' => 'liberty_process_queue',
- )),
- array( 'RENAMESEQUENCE' => array(
- "tiki_fisheye_gallery_id_seq" => "fisheye_gallery_id_seq",
- )),
- array('ALTER'=> array(
- 'fisheye_gallery_image_map' => array(
- 'item_position' => array( '`item_position`', 'F' ),
- ),
- )),
-)),
-
-// query: create a fisheye_image_id_seq and bring the table up to date with the current max image_id used in the fisheye_image table - this basically for mysql
-array( 'PHP' => '
- $query = $gBitDb->getOne("SELECT MAX(image_id) FROM `'.BIT_DB_PREFIX.'fisheye_image`");
- $tempId = $gBitDb->mDb->GenID("`'.BIT_DB_PREFIX.'fisheye_image_id_seq`", $query);
-' ),
-
-// Queries
-array( 'QUERY' =>
- array( 'SQL92' => array(
- // Copy int positions to floats
- "UPDATE `".BIT_DB_PREFIX."fisheye_gallery_image_map` SET `item_position`=`position`",
- ),
-)),
-
-// DataDict cleanup
-array( 'DATADICT' => array(
- array( 'DROPCOLUMN' => array(
- 'fisheye_gallery_image_map' => array( '`position`' ),
- )),
- array( 'CREATEINDEX' => array(
- 'fisheye_gallery_image_map_pos_idx' => array( 'fisheye_gallery_image_map', '`gallery_content_id`,`item_position`', array( 'UNIQUE' ) ),
- )),
-)),
-
- )
- ),
-);
-
-if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) {
- $gBitSystem->registerUpgrade( FISHEYE_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] );
-}
-?>