diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-27 15:41:02 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-27 15:41:02 +0100 |
| commit | 0e12ec2be3836065ecaa2dbb1c4b5da30501a933 (patch) | |
| tree | 5852ce7d8ac0e7d2470056a1472944ec0cc99bb9 | |
| parent | 676eee147404699eae27e678f2f5616758773c10 (diff) | |
| download | themes-0e12ec2be3836065ecaa2dbb1c4b5da30501a933.tar.gz themes-0e12ec2be3836065ecaa2dbb1c4b5da30501a933.tar.bz2 themes-0e12ec2be3836065ecaa2dbb1c4b5da30501a933.zip | |
General tools updated to PHP8.4 and namespace
| -rwxr-xr-x[-rw-r--r--] | css_lib.php | 10 | ||||
| -rwxr-xr-x[-rw-r--r--] | edit_css.php | 26 | ||||
| -rwxr-xr-x[-rw-r--r--] | icon_browser.php | 24 | ||||
| -rwxr-xr-x[-rw-r--r--] | switch_theme.php | 13 |
4 files changed, 32 insertions, 41 deletions
diff --git a/css_lib.php b/css_lib.php index 5e577e2..8d96d62 100644..100755 --- a/css_lib.php +++ b/css_lib.php @@ -66,7 +66,7 @@ class cssLib extends BitBase { } function parse_css($data) { - $back = array(); + $back = []; $index = 0; $type = ''; @@ -80,8 +80,8 @@ class cssLib extends BitBase { $index++; $back["$index"]["comment"] = ''; - $back["$index"]["items"] = array(); - $back["$index"]["attributes"] = array(); + $back["$index"]["items"] = []; + $back["$index"]["attributes"] = []; } elseif (($type == "comment") and ($line == "*/")) { $type = ""; } elseif ($type == "comment") { @@ -102,8 +102,8 @@ class cssLib extends BitBase { $index++; $back["$index"]["comment"] = ''; - $back["$index"]["items"] = array(); - $back["$index"]["attributes"] = array(); + $back["$index"]["items"] = []; + $back["$index"]["attributes"] = []; } elseif ($type == "attributes") { $parts = split(":", str_replace(";", "", $line)); diff --git a/edit_css.php b/edit_css.php index daf940b..aeb9de1 100644..100755 --- a/edit_css.php +++ b/edit_css.php @@ -22,7 +22,7 @@ include_once( THEMES_PKG_PATH.'css_lib.php' ); function delete($dir, $pattern = "*.*") { - $deleted = false; + $deleted = null; $pattern = str_replace(array("\*","\?"), array(".*","."), preg_quote($pattern)); if (substr($dir,-1) != "/") $dir.= "/"; if (is_dir($dir)) { @@ -89,15 +89,15 @@ function ls_a($wh) $gBitSystem->verifyFeature( 'themes_edit_css' ); $gBitSystem->verifyPermission( 'bit_p_create_css' ); -$customCSSPath = $gBitUser->getStoragePath( NULL,$gBitUser->mUserId ); // Path to this user's storage directory +$customCSSPath = $gBitUser->getStoragePath( null,$gBitUser->mUserId ); // Path to this user's storage directory $customCSSFile = $customCSSPath.'custom.css'; // Path to this user's custom stylesheet -$customCSSImageURL = $gBitUser->getStorageURL( NULL,$gBitUser->mUserId ).'/images/'; -$gBitSmarty->assignByRef('customCSSImageURL',$customCSSImageURL); +$customCSSImageURL = $gBitUser->getStorageURL( null,$gBitUser->mUserId ).'/images/'; +$gBitSmarty->assign('customCSSImageURL',$customCSSImageURL); // Create a custom.css for this user if they do not already have one if (!file_exists($customCSSFile)) { if (!copy(THEMES_PKG_PATH.'/styles/basic/basic.css', $customCSSFile)) { $gBitSmarty->assign('msg', tra("Unable to create a custom CSS file for you!")); - $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' )); + $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' )); die; } } @@ -109,7 +109,7 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) { if (!$fp) { $gBitSmarty->assign('msg', tra("You dont have permission to write the style sheet")); - $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' )); + $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' )); die; } @@ -134,7 +134,7 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) { if (!$fp) { $gBitSmarty->assign('msg', tra("You dont have permission to write the style sheet")); - $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' )); + $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' )); die; } @@ -171,10 +171,10 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) { // Get the list of themes the user can choose to derive from (aka Reset to) -$styles = $gBitThemes->getStyles( NULL, FALSE, FALSE ); -$gBitSmarty->assignByRef( 'styles', $styles ); +$styles = $gBitThemes->getStyles( null, false, false ); +$gBitSmarty->assign( 'styles', $styles ); $assignStyle = 'basic'; -$gBitSmarty->assignByRef( 'assignStyle', $assignStyle); +$gBitSmarty->assign( 'assignStyle', $assignStyle); // Read in this user's custom.css to display in the textarea @@ -192,15 +192,15 @@ if (isset($errorMsg)) // Get the list of images used by this user's custom theme $imageList = ls_a($customCSSPath.'images/'); -$themeImages = array(); +$themeImages = []; foreach ($imageList as $image) { if (ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($image))) { $themeImages[] = $image; } } -$gBitSmarty->assignByRef('themeImages',$themeImages); +$gBitSmarty->assign('themeImages',$themeImages); -$gBitSystem->display( 'bitpackage:themes/edit_css.tpl', NULL, array( 'display_mode' => 'edit' )); +$gBitSystem->display( 'bitpackage:themes/edit_css.tpl', null, array( 'display_mode' => 'edit' )); ?> diff --git a/icon_browser.php b/icon_browser.php index c878817..0cf4efe 100644..100755 --- a/icon_browser.php +++ b/icon_browser.php @@ -13,13 +13,14 @@ /** * Setup */ -require_once( "../kernel/includes/setup_inc.php" ); +use Bitweaver\KernelTools; +require_once "../kernel/includes/setup_inc.php"; if( !$gBitUser->isRegistered() ) { $gBitSystem->fatalError( "You need to be registered to view this page." ); } -$iconUsage = array( +$iconUsage = [ "dialog-ok" => "Success / Accept", "document-open" => "Import", "document-properties" => "Configuration", @@ -50,16 +51,12 @@ $iconUsage = array( "folder" => "Folder", "dialog-error" => "Error", "dialog-information" => "Information", -); +]; $gBitSmarty->assign( 'iconUsage', $iconUsage ); -$iconList = array(); -$iconNames = array(); -if( !empty( $_REQUEST['icon_style'] ) ) { - $iconThemes = array( $_REQUEST['icon_style'] ); -} else { - $iconThemes = scandir( CONFIG_PKG_PATH."iconsets/" ); -} +$iconList = []; +$iconNames = []; +$iconThemes = ( !empty( $_REQUEST['icon_style'] ) ) ? [ $_REQUEST['icon_style'] ] : scandir( CONFIG_PKG_PATH . "iconsets/" ); foreach( $iconThemes as $iconStyle ) { if( $icons = icon_fetcher( $iconStyle ) ) { @@ -72,15 +69,15 @@ asort( $iconNames ); $gBitSmarty->assign( 'iconNames', $iconNames ); $gBitSmarty->assign( 'iconList', $iconList ); -$gBitSystem->display( 'bitpackage:themes/icon_browser.tpl', tra( 'Icon Listing' ) , array( 'display_mode' => 'display' )); +$gBitSystem->display( 'bitpackage:themes/icon_browser.tpl', KernelTools::tra( 'Icon Listing' ) , [ 'display_mode' => 'display' ]); function icon_fetcher( $pStyle = DEFAULT_ICON_STYLE ) { - $ret = array(); + $ret = []; if( strpos( $pStyle, '.' ) !== 0 && $pStyle != 'CVS' ) { $stylePath = CONFIG_PKG_PATH."iconsets/".$pStyle; if( is_dir( $stylePath."/large" )) { $handle = opendir( $stylePath."/large" ); - while( FALSE !== ( $icon = readdir( $handle ))) { + while( false !== ( $icon = readdir( $handle ))) { if( preg_match( "#\.png$#", $icon ) && !preg_match( "#^process-working\.#", $icon )) { $ret[str_replace( ".png", "", $icon )] = str_replace( ".png", "", $icon ); } @@ -90,4 +87,3 @@ function icon_fetcher( $pStyle = DEFAULT_ICON_STYLE ) { ksort( $ret ); return $ret; } -?> diff --git a/switch_theme.php b/switch_theme.php index 4d8f867..843f32c 100644..100755 --- a/switch_theme.php +++ b/switch_theme.php @@ -8,14 +8,10 @@ /** * Setup */ -require_once( '../kernel/includes/setup_inc.php' ); -include_once( KERNEL_PKG_CLASS_PATH.'BitBase.php' ); +require_once '../kernel/includes/setup_inc.php'; +use Bitweaver\BitBase; -if (isset($_SERVER['HTTP_REFERER'])) { - $orig_url = $_SERVER['HTTP_REFERER']; -} else { - $orig_url = $bit_index; -} +$orig_url = $_SERVER['HTTP_REFERER'] ?? $bit_index; if (isset($_GET['theme']) && $gBitSystem->getConfig('users_themes') == 'y'){ $new_theme = $_GET['theme']; @@ -31,5 +27,4 @@ if (isset($_GET['theme']) && $gBitSystem->getConfig('users_themes') == 'y'){ } header("location: $orig_url"); -exit; -?> +exit;
\ No newline at end of file |
