From eddcb429ad24572676fce289fcae645178a185ba Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Thu, 14 May 2026 09:54:15 +0100 Subject: php-cs-fixer tidies to php8.5 standards Co-Authored-By: Claude Sonnet 4.6 --- convert_r1_to_r2.sh | 0 create_firebird_database.php | 2 +- css/images/bg_body.png | Bin css/images/bg_content.png | Bin css/images/bg_header.png | Bin css/images/bg_header_logo-trans.png | Bin css/images/bitweaver_logo-trans.png | Bin css/images/danger-trans.png | Bin css/images/dialog-error-trans.png | Bin css/images/dialog-ok-trans.png | Bin css/images/dialog-warning-trans.png | Bin css/images/external.gif | Bin css/images/favicon.ico | Bin css/images/go-down-trans.png | Bin css/images/media-playback-start-trans.png | Bin css/images/software-update-available-trans.png | Bin css/images/start-here-trans.png | Bin css/images/tab_shade.png | Bin favicon.ico | Bin icons/pkg_install.gif | Bin icons/pkg_install.png | Bin includes/classes/BitInstaller.php | 16 ++++++++-------- includes/get_databases_inc.php | 4 ++-- includes/install_bit_settings.php | 2 +- includes/install_checks.php | 1 - includes/install_cleanup.php | 10 ++-------- includes/install_database.php | 12 ++++++------ includes/install_database_reset.php | 2 +- includes/install_inc.php | 6 +----- includes/install_options.php | 4 ++-- includes/install_packages.php | 5 ----- includes/install_version.php | 2 +- index.php | 2 +- migrate.php | 4 ++-- migrate_database.php | 8 +++----- migrate_final.php | 3 +-- process_sql.php | 1 + templates/index.php | 2 +- templates/install_beta1_beta2_done.tpl | 0 templates/install_bit_settings_done.tpl | 0 templates/install_cleanup_done.tpl | 0 templates/install_database_done.tpl | 0 templates/install_database_reset.tpl | 0 templates/install_datapump.tpl | 0 templates/install_datapump_done.tpl | 0 templates/install_options.tpl | 0 templates/install_upgrade_done.tpl | 0 templates/install_version_done.tpl | 0 templates/migrate_database_done.tpl | 0 templates/migrate_final_done.tpl | 0 templates/migrate_welcome.tpl | 0 templates/upgrade_database.tpl | 0 templates/upgrade_database_done.tpl | 0 templates/upgrade_final_done.tpl | 0 templates/upgrade_packages.tpl | 0 templates/upgrade_packages_done.tpl | 0 templates/upgrade_ready.tpl | 0 templates/upgrade_results.tpl | 0 testfiles/test.rar | Bin testfiles/test.tar | Bin testfiles/test.tar.bz2 | Bin testfiles/test.tar.gz | Bin testfiles/test.zip | Bin upgrade_packages.php | 22 +++++++++++----------- 64 files changed, 45 insertions(+), 63 deletions(-) mode change 100644 => 100755 convert_r1_to_r2.sh mode change 100644 => 100755 css/images/bg_body.png mode change 100644 => 100755 css/images/bg_content.png mode change 100644 => 100755 css/images/bg_header.png mode change 100644 => 100755 css/images/bg_header_logo-trans.png mode change 100644 => 100755 css/images/bitweaver_logo-trans.png mode change 100644 => 100755 css/images/danger-trans.png mode change 100644 => 100755 css/images/dialog-error-trans.png mode change 100644 => 100755 css/images/dialog-ok-trans.png mode change 100644 => 100755 css/images/dialog-warning-trans.png mode change 100644 => 100755 css/images/external.gif mode change 100644 => 100755 css/images/favicon.ico mode change 100644 => 100755 css/images/go-down-trans.png mode change 100644 => 100755 css/images/media-playback-start-trans.png mode change 100644 => 100755 css/images/software-update-available-trans.png mode change 100644 => 100755 css/images/start-here-trans.png mode change 100644 => 100755 css/images/tab_shade.png mode change 100644 => 100755 favicon.ico mode change 100644 => 100755 icons/pkg_install.gif mode change 100644 => 100755 icons/pkg_install.png mode change 100644 => 100755 templates/install_beta1_beta2_done.tpl mode change 100644 => 100755 templates/install_bit_settings_done.tpl mode change 100644 => 100755 templates/install_cleanup_done.tpl mode change 100644 => 100755 templates/install_database_done.tpl mode change 100644 => 100755 templates/install_database_reset.tpl mode change 100644 => 100755 templates/install_datapump.tpl mode change 100644 => 100755 templates/install_datapump_done.tpl mode change 100644 => 100755 templates/install_options.tpl mode change 100644 => 100755 templates/install_upgrade_done.tpl mode change 100644 => 100755 templates/install_version_done.tpl mode change 100644 => 100755 templates/migrate_database_done.tpl mode change 100644 => 100755 templates/migrate_final_done.tpl mode change 100644 => 100755 templates/migrate_welcome.tpl mode change 100644 => 100755 templates/upgrade_database.tpl mode change 100644 => 100755 templates/upgrade_database_done.tpl mode change 100644 => 100755 templates/upgrade_final_done.tpl mode change 100644 => 100755 templates/upgrade_packages.tpl mode change 100644 => 100755 templates/upgrade_packages_done.tpl mode change 100644 => 100755 templates/upgrade_ready.tpl mode change 100644 => 100755 templates/upgrade_results.tpl mode change 100644 => 100755 testfiles/test.rar mode change 100644 => 100755 testfiles/test.tar mode change 100644 => 100755 testfiles/test.tar.bz2 mode change 100644 => 100755 testfiles/test.tar.gz mode change 100644 => 100755 testfiles/test.zip diff --git a/convert_r1_to_r2.sh b/convert_r1_to_r2.sh old mode 100644 new mode 100755 diff --git a/create_firebird_database.php b/create_firebird_database.php index fe7e91a..9cc7708 100755 --- a/create_firebird_database.php +++ b/create_firebird_database.php @@ -40,7 +40,7 @@ if ($fp = fopen ($tmp_name, 'a+')) { fwrite($fp, $sql); - fclose($fp); + fclose($fp); } $command = sprintf('"%s" -u $user -p $pass -i %s', $fbpath, $tmp_name ); diff --git a/css/images/bg_body.png b/css/images/bg_body.png old mode 100644 new mode 100755 diff --git a/css/images/bg_content.png b/css/images/bg_content.png old mode 100644 new mode 100755 diff --git a/css/images/bg_header.png b/css/images/bg_header.png old mode 100644 new mode 100755 diff --git a/css/images/bg_header_logo-trans.png b/css/images/bg_header_logo-trans.png old mode 100644 new mode 100755 diff --git a/css/images/bitweaver_logo-trans.png b/css/images/bitweaver_logo-trans.png old mode 100644 new mode 100755 diff --git a/css/images/danger-trans.png b/css/images/danger-trans.png old mode 100644 new mode 100755 diff --git a/css/images/dialog-error-trans.png b/css/images/dialog-error-trans.png old mode 100644 new mode 100755 diff --git a/css/images/dialog-ok-trans.png b/css/images/dialog-ok-trans.png old mode 100644 new mode 100755 diff --git a/css/images/dialog-warning-trans.png b/css/images/dialog-warning-trans.png old mode 100644 new mode 100755 diff --git a/css/images/external.gif b/css/images/external.gif old mode 100644 new mode 100755 diff --git a/css/images/favicon.ico b/css/images/favicon.ico old mode 100644 new mode 100755 diff --git a/css/images/go-down-trans.png b/css/images/go-down-trans.png old mode 100644 new mode 100755 diff --git a/css/images/media-playback-start-trans.png b/css/images/media-playback-start-trans.png old mode 100644 new mode 100755 diff --git a/css/images/software-update-available-trans.png b/css/images/software-update-available-trans.png old mode 100644 new mode 100755 diff --git a/css/images/start-here-trans.png b/css/images/start-here-trans.png old mode 100644 new mode 100755 diff --git a/css/images/tab_shade.png b/css/images/tab_shade.png old mode 100644 new mode 100755 diff --git a/favicon.ico b/favicon.ico old mode 100644 new mode 100755 diff --git a/icons/pkg_install.gif b/icons/pkg_install.gif old mode 100644 new mode 100755 diff --git a/icons/pkg_install.png b/icons/pkg_install.png old mode 100644 new mode 100755 diff --git a/includes/classes/BitInstaller.php b/includes/classes/BitInstaller.php index d183aaa..9574956 100755 --- a/includes/classes/BitInstaller.php +++ b/includes/classes/BitInstaller.php @@ -66,7 +66,7 @@ class BitInstaller extends BitSystem { $loginCol = strpos( $pLogin, '@' ) ? 'email' : 'login'; if( $gBitUser->validate( $pLogin, $pPassword, $pChallenge, $pResponse ) ) { - $userInfo = $gBitUser->getUserInfo( array( $loginCol => $pLogin ) ); + $userInfo = $gBitUser->getUserInfo( [ $loginCol => $pLogin ] ); if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { // User is valid and not due to change pass.. @@ -119,7 +119,7 @@ class BitInstaller extends BitSystem { * @access public * @return void */ - public function registerPackageUpgrade( $pParams, $pUpgradeHash = array() ) { + public function registerPackageUpgrade( $pParams, $pUpgradeHash = [] ) { if( $this->verifyPackageUpgrade( $pParams )) { $this->registerPackageVersion( $pParams['package'], $pParams['version'] ); $this->mPackageUpgrades[$pParams['package']][$pParams['version']] = $pParams; @@ -319,11 +319,11 @@ class BitInstaller extends BitSystem { $errors[$version] = $this->applyUpgrade( $pPackage, $this->mPackageUpgrades[$pPackage][$version]['upgrade'] ); if( !empty( $errors[$version] )) { return $errors; - } else { + } // if the upgrade ended without incidence, we store the package version. // this way any successfully applied upgrade can only be applied once. $this->storeVersion( $pPackage, $version ); - } + } } @@ -385,8 +385,8 @@ class BitInstaller extends BitSystem { $completeTableName = $tablePrefix.$tableName; $this->mDb->convertQuery( $completeTableName ); foreach( $alter[$tableName] as $from => $flds ) { - $sql = ( is_string( $flds ) ) - ? $dict->ChangeTableSQL( $completeTableName, $flds ) + $sql = ( is_string( $flds ) ) + ? $dict->ChangeTableSQL( $completeTableName, $flds ) : $dict->ChangeTableSQL( $completeTableName, [ $flds ] ); if( $sql ) { @@ -702,7 +702,7 @@ function upgrade_query_sort( $a, $b ) { return 1; } elseif( $b == 'SQL92' ) { return -1; - } else { - return 0; } + return 0; + } diff --git a/includes/get_databases_inc.php b/includes/get_databases_inc.php index ffc8bc7..51eb6ed 100755 --- a/includes/get_databases_inc.php +++ b/includes/get_databases_inc.php @@ -44,7 +44,7 @@ if( function_exists( 'fbird_connect' ) ) { $gBitDbUser = 'SYSDBA'; $gBitDbPassword = 'masterkey'; } -} +} if( extension_loaded( 'pdo_firebird' ) ) { $dbtodsn['pdo'] = 'PDO Firebird'; if ( !empty($_REQUEST['fbpath']) ) $fbpath = $_REQUEST['fbpath']; @@ -58,7 +58,7 @@ if( extension_loaded( 'pdo_firebird' ) ) { $gBitDbUser = 'SYSDBA'; $gBitDbPassword = 'masterkey'; } -} +} if( function_exists( 'sqlite_open' ) ) { $dbtodsn['sqlite'] = 'SQLLite'; } diff --git a/includes/install_bit_settings.php b/includes/install_bit_settings.php index 67feb9d..8856c0d 100755 --- a/includes/install_bit_settings.php +++ b/includes/install_bit_settings.php @@ -11,7 +11,7 @@ /** * assign next step in installation process - */ + */ $gBitSmarty->assign( 'next_step',$step ); /** diff --git a/includes/install_checks.php b/includes/install_checks.php index 55e1348..6175f19 100755 --- a/includes/install_checks.php +++ b/includes/install_checks.php @@ -195,7 +195,6 @@ function check_settings() { } } - // PEAR checks $pears = [ 'PEAR' => [ diff --git a/includes/install_cleanup.php b/includes/install_cleanup.php index f45a9ef..660e752 100755 --- a/includes/install_cleanup.php +++ b/includes/install_cleanup.php @@ -12,18 +12,14 @@ $schema = $gBitInstaller->mPackages; ksort( $schema ); $gBitSmarty->assign( 'schema', $schema ); - - // ===================== Post install table check ===================== // $dbTables is the output of BitSystem::verifyInstalledPackages() in // install_inc.php and contains all tables that are not present in the database // - even tables of packages that are not installed $dbIntegrity = install_check_database_integrity( $dbTables ); - - // ===================== Permissions ===================== -// check all permissions, compare them to each other and see if there are old +// check all permissions, compare them to each other and see if there are old // permissions and ones that need to be inserted $query = "SELECT * FROM `".BIT_DB_PREFIX."users_permissions` ORDER BY `package` ASC"; $result = $gBitInstaller->mDb->query( $query ); @@ -106,7 +102,7 @@ if (!empty( $_REQUEST['create_tables'] ) && !empty( $dbIntegrity )) { } // If we use MySql check which storage engine to use - $build = isset( $_SESSION['use_innodb'] ) + $build = isset( $_SESSION['use_innodb'] ) ? ( ( $_SESSION['use_innodb'] == true ) ? [ 'NEW', 'MYSQL' => 'ENGINE=INNODB' ] : [ 'NEW', 'MYSQL' => 'ENGINE=MYISAM' ] ) : 'NEW'; $tablePrefix = $gBitInstaller->getTablePrefix(); @@ -189,8 +185,6 @@ $gBitSmarty->assign( 'dbIntegrity', $dbIntegrity ); // $gBitSmarty->assign( 'serviceList', $serviceList ); - - /** * function - install_check_database_integrity */ diff --git a/includes/install_database.php b/includes/install_database.php index 07d24e2..28478ca 100755 --- a/includes/install_database.php +++ b/includes/install_database.php @@ -18,17 +18,17 @@ if( isset( $_REQUEST['submit_db_info'] )) { // avoid database change messages ini_set( 'sybct.min_server_severity', '11' ); } - + // for Oracle force database name to use one from tnsnames // this way we avoid further StartTrans errors that was often reported, if( $gBitDbType == 'oci8po' && empty( $gBitDbName ) ) { $gBitSmarty->assign( 'error', TRUE ); $gBitSmarty->assign( 'errorMsg', "Please fill Database Name field. If you don't know it and you're using Express Edition it's probably 'XE'. Otherwise check your \"tnsnames.ora\" file to get appropriate one." ); - $error = TRUE; + $error = TRUE; } else { - + $gBitDb = ADONewConnection( $gBitDbType ); - + if( $gBitDb->Connect( $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbType != 'pdo' ? $gBitDbName : NULL )) { // display success page when done $app = '_done'; @@ -44,7 +44,7 @@ if( isset( $_REQUEST['submit_db_info'] )) { } else { $_SESSION['first_install'] = FALSE; } - + if( $_SESSION['first_install'] == TRUE ) { // For MySql only, on first install check if server support // InnoDB and set a smarty var for template to offer using @@ -62,7 +62,7 @@ if( isset( $_REQUEST['submit_db_info'] )) { break 2; } } - + $rs->MoveNext(); } $rs->Close(); diff --git a/includes/install_database_reset.php b/includes/install_database_reset.php index 7a3f234..a219c3c 100755 --- a/includes/install_database_reset.php +++ b/includes/install_database_reset.php @@ -17,7 +17,7 @@ if( isset( $_REQUEST['continue_install'] ) ) { } elseif( isset( $_REQUEST['reset_config_inc'] ) ) { $fw = fopen($config_file, 'w' ); if( isset( $fw ) ) { - fwrite( $fw, ''); + fwrite( $fw, ''); fclose( $fw ); } header( 'Location: '.INSTALL_PKG_URL.'install.php' ); diff --git a/includes/install_inc.php b/includes/install_inc.php index 04e3dfa..a39e410 100755 --- a/includes/install_inc.php +++ b/includes/install_inc.php @@ -1,9 +1,5 @@ login( $_REQUEST['user'], $_REQUEST['pass'] ); + $gBitInstaller->login( $_REQUEST['user'], $_REQUEST['pass'] ); } elseif( is_object( $gBitUser ) && !empty( $_COOKIE[$gBitUser->getSiteCookieName()] ) && ( $gBitUser->mUserId = $gBitUser->getUserIdFromCookie( $_COOKIE[$gBitUser->getSiteCookieName()] ))) { $userInfo = $gBitUser->getUserInfo( [ 'user_id' => $gBitUser->mUserId ] ); diff --git a/includes/install_options.php b/includes/install_options.php index f4a93d1..7306ea8 100755 --- a/includes/install_options.php +++ b/includes/install_options.php @@ -31,6 +31,6 @@ if( isset( $_REQUEST['upgrade'] ) ) { // Added check for IIS $_SERVER['HTTPS'] uses 'off' value - wolff_borg header( 'Location: http'.((!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS'] != 'off')?'s':'').'://'.$_SERVER['HTTP_HOST'].INSTALL_PKG_URL.'install.php?step='.( $step + 1 ) ); die; -} else { - $gBitSmarty->assign( 'next_step',$step ); } + $gBitSmarty->assign( 'next_step',$step ); + diff --git a/includes/install_packages.php b/includes/install_packages.php index 05bd353..6979b1d 100755 --- a/includes/install_packages.php +++ b/includes/install_packages.php @@ -425,7 +425,6 @@ if( !empty( $_REQUEST['cancel'] ) ) { $gBitInstaller->mPrefs = ''; $gBitInstaller->loadConfig(); - $gBitInstaller->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."kernel_config` WHERE `package`=?", [ $package ] ); // ---------------------- 5. ---------------------- // run the defaults through afterwards so we can be sure all tables needed have been created @@ -459,7 +458,6 @@ if( !empty( $_REQUEST['cancel'] ) ) { } $gBitInstaller->mDb->CompleteTrans(); - // ---------------------- 6. ---------------------- // register all content types for installed packages foreach( $gBitInstaller->mContentClasses as $package => $classes ){ @@ -471,7 +469,6 @@ if( !empty( $_REQUEST['cancel'] ) ) { } } - // ---------------------- 7. ---------------------- // Do stuff that only applies during the first install $gBitInstaller->StartTrans(); @@ -610,8 +607,6 @@ if( !empty( $_REQUEST['cancel'] ) ) { } } - - // ---------------------- 8. ---------------------- // woo! we're done with the installation bit - below here is some generic installer stuff $gBitSmarty->assign( 'next_step', $step + 1 ); diff --git a/includes/install_version.php b/includes/install_version.php index 5a97442..6004133 100755 --- a/includes/install_version.php +++ b/includes/install_version.php @@ -21,7 +21,7 @@ if( version_compare( '2.1.0-beta', $gBitSystem->getVersion(), '>' )) { // get a list of all groups and their permissions $listHash = [ 'only_root_groups' => true, - 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' + 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc', ]; $allGroups = $gBitUser->getAllGroups( $listHash ); $allPerms = $gBitUser->getGroupPermissions( $_REQUEST ); diff --git a/index.php b/index.php index ac3192f..01ad800 100755 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ -assign( 'name_dst', $_REQUEST['name_dst'] ); $gBitSmarty->assign( 'prefix_dst', $_REQUEST['prefix_dst'] ); - $skip_tables = isset($_REQUEST['skip_tables']) ? $_REQUEST['skip_tables'] : []; + $skip_tables = $_REQUEST['skip_tables'] ?? []; $gBitSmarty->assign( 'skip_tables_select', $skip_tables ); $empty_tables = isset($_REQUEST['empty_tables']); $gBitSmarty->assign( 'empty_tables', $empty_tables ); @@ -66,9 +66,8 @@ if (isset($_REQUEST['fSubmitDatabase']) || isset($_REQUEST['fUpdateTables'])) { if (testDatabase()) { $gBitSmarty->assign( 'error_src', true ); return; - } else { - $gDb_src = new BitDb(); } + $gDb_src = new BitDb(); $tables_src = $gDb_src->MetaTables(); @@ -87,9 +86,8 @@ if (isset($_REQUEST['fSubmitDatabase']) || isset($_REQUEST['fUpdateTables'])) { if (testDatabase()) { $gBitSmarty->assign( 'error_dst', true ); return; - } else { - $gDb_dst = new BitDb(); } + $gDb_dst = new BitDb(); require_once 'create_config_inc.php'; $createHash = [ diff --git a/migrate_final.php b/migrate_final.php index 62b35f1..e07aaa8 100755 --- a/migrate_final.php +++ b/migrate_final.php @@ -20,6 +20,5 @@ if( isset( $_REQUEST['enter_bitweaver'] ) ) { } elseif( isset( $_REQUEST['continue_install'] ) ) { header( 'Location: '.INSTALL_PKG_URL.'install.php?step=4' ); die; -} else { +} $gBitSmarty->assign( 'next_step',$step ); -} \ No newline at end of file diff --git a/process_sql.php b/process_sql.php index cd08952..c78a09d 100755 --- a/process_sql.php +++ b/process_sql.php @@ -11,6 +11,7 @@ */ namespace Bitweaver; + define( 'BIT_INSTALL', 'true' ); global $failedcommands; // keep some crappy notices from spewing diff --git a/templates/index.php b/templates/index.php index 3e305fe..c0437d0 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,4 +1,4 @@ -assign( 'upgrading', $upgrading ); } -$upgradePath = array ( - 'TikiWiki 1.8' => array( +$upgradePath = [ + 'TikiWiki 1.8' => [ 'TIKIWIKI18' => 'BONNIE', 'BONNIE' => 'BWR1', 'BWR1' => 'BWR2', - ), - 'TikiWiki 1.9' => array( + ], + 'TikiWiki 1.9' => [ 'TIKIWIKI19' => 'TIKIWIKI18', 'TIKIWIKI18' => 'BONNIE', 'BONNIE' => 'BWR1', 'BWR1' => 'BWR2', - ), - 'BWR0' => array( + ], + 'BWR0' => [ 'BONNIE' => 'BWR1', 'BWR1' => 'BWR2', - ), - 'BWR1' => array( + ], + 'BWR1' => [ 'BWR1' => 'BWR2', - ), -); + ], +]; $gBitSmarty->assign( 'upgradeFrom', $gUpgradeFrom ); $gBitSmarty->assign( 'upgradeTo', $gUpgradeTo ); @@ -75,7 +75,7 @@ if( !empty( $_REQUEST['upgrade'] ) ) { $gUpgradeTo = $to; $gBitInstaller->scanPackages( 'admin/upgrade_inc.php', false ); - $firstPackages = array_flip( array( 'kernel', 'users', 'categories', 'liberty', 'wiki', 'blogs' ) ); + $firstPackages = array_flip( [ 'kernel', 'users', 'categories', 'liberty', 'wiki', 'blogs' ] ); $secondPackages = array_flip( $upgrading ); // upgrade the ones that are order critical first -- cgit v1.3