summaryrefslogtreecommitdiff
path: root/edit_css.php
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-14 09:55:19 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-14 09:55:19 +0100
commit1721544d5a71c0f3b4bc3b498893a65f4d9f1c84 (patch)
tree6a44ae4720a0190927a836911ce28aa67604a0e5 /edit_css.php
parent8225200c6470d1abe939ca007b5915c82c601016 (diff)
downloadthemes-1721544d5a71c0f3b4bc3b498893a65f4d9f1c84.tar.gz
themes-1721544d5a71c0f3b4bc3b498893a65f4d9f1c84.tar.bz2
themes-1721544d5a71c0f3b4bc3b498893a65f4d9f1c84.zip
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'edit_css.php')
-rwxr-xr-xedit_css.php96
1 files changed, 47 insertions, 49 deletions
diff --git a/edit_css.php b/edit_css.php
index 48d7bf8..4f9997a 100755
--- a/edit_css.php
+++ b/edit_css.php
@@ -24,20 +24,20 @@ include_once( THEMES_PKG_PATH.'css_lib.php' );
function delete($dir, $pattern = "*.*")
{
$deleted = null;
- $pattern = str_replace(array("\*","\?"), array(".*","."), preg_quote($pattern));
- if (substr($dir,-1) != "/") $dir.= "/";
- if (is_dir($dir)) {
- $d = opendir($dir);
- while ($file = readdir($d)) {
- if (is_file($dir.$file) && preg_match("^".$pattern."$", $file)){
- if (unlink($dir.$file))
- $deleted[] = $file;
- }
- }
- closedir($d);
- return $deleted;
- }
- else return 0;
+ $pattern = str_replace(["\*","\?"], [".*","."], preg_quote($pattern));
+ if (substr($dir,-1) != "/") $dir.= "/";
+ if (is_dir($dir)) {
+ $d = opendir($dir);
+ while ($file = readdir($d)) {
+ if (is_file($dir.$file) && preg_match("^".$pattern."$", $file)){
+ if (unlink($dir.$file))
+ $deleted[] = $file;
+ }
+ }
+ closedir($d);
+ return $deleted;
+ }
+ return 0;
}
// it copies $wf to $wto
@@ -45,22 +45,22 @@ function copy_dirs($wf, $wto)
{
if (!file_exists($wto))
{
- mkdir($wto, 0777);
+ mkdir($wto, 0777);
}
$arr=ls_a($wf);
foreach ($arr as $fn)
{
- if($fn)
- {
- $fl=$wf."/".$fn;
- $flto=$wto."/".$fn;
- if(is_dir($fl)) copy_dirs($fl, $flto);
- else // begin 2nd improvement
- {
- @copy($fl, $flto);
- chmod($flto, 0666);
- } // end 2nd improvement
- }
+ if($fn)
+ {
+ $fl=$wf."/".$fn;
+ $flto=$wto."/".$fn;
+ if(is_dir($fl)) copy_dirs($fl, $flto);
+ else // begin 2nd improvement
+ {
+ @copy($fl, $flto);
+ chmod($flto, 0666);
+ } // end 2nd improvement
+ }
}
}
@@ -69,19 +69,19 @@ function ls_a($wh)
{
if ($handle = opendir($wh))
{
- while (false !== ($file = readdir($handle)))
- {
- if ($file !== "." && $file !== ".." )
- {
- if(!isset($files)) $files=$file;
- else $files = $file."\r\n".$files;
- }
- }
- closedir($handle);
+ while (false !== ($file = readdir($handle)))
+ {
+ if ($file !== "." && $file !== ".." )
+ {
+ if(!isset($files)) $files=$file;
+ else $files = $file."\r\n".$files;
+ }
+ }
+ closedir($handle);
}
$arr=explode("\r\n", $files);
return $arr;
-}
+}
/**************************************
***** End File Management Functions
*****
@@ -93,12 +93,12 @@ $gBitSystem->verifyPermission( 'bit_p_create_css' );
$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( $gBitUser->mUserId ).'/images/';
-$gBitSmarty->assign('customCSSImageURL',$customCSSImageURL);
+$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', KernelTools::tra("Unable to create a custom CSS file for you!"));
- $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' ));
+ $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'edit' ]);
die;
}
}
@@ -110,10 +110,10 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
if (!$fp) {
$gBitSmarty->assign('msg', KernelTools::tra ("You dont have permission to write the style sheet"));
- $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' ));
+ $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'edit' ]);
die;
}
-
+
fwrite($fp, $_REQUEST["textData"]);
fclose ($fp);
$successMsg = "CSS Updated and Saved";
@@ -128,9 +128,9 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
delete($customCSSPath.'/images/', '*.*');
}
if (file_exists(THEMES_PKG_PATH."styles/$resetStyle/images")) {
- copy_dirs("styles/$resetStyle/images", $customCSSPath.'/images/');
+ copy_dirs("styles/$resetStyle/images", $customCSSPath.'/images/');
}
-
+
$fp = fopen($customCSSFile, "w");
if (!$fp) {
@@ -138,7 +138,7 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
$gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'edit' ]);
die;
}
-
+
fwrite($fp, $cssData);
fclose ($fp);
$successMsg = "Your CSS has been reset to the $resetStyle theme.";
@@ -165,28 +165,26 @@ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
$successMsg = $_REQUEST['fDeleteImg']." successfully deleted";
} else {
$errorMsg = $_REQUEST['fDeleteImg']." does not exists!";
- }
+ }
} else {
$action = 'edit';
}
-
// Get the list of themes the user can choose to derive from (aka Reset to)
$styles = $gBitThemes->getStyles( null, false, false );
$gBitSmarty->assign( 'styles', $styles );
$assignStyle = 'basic';
$gBitSmarty->assign( 'assignStyle', $assignStyle);
-
// Read in this user's custom.css to display in the textarea
$lines = file($customCSSFile);
$data = '';
foreach ($lines as $line) {
$data .= $line;
-}
+}
$gBitSmarty->assign('data', $data);
-if (isset($successMsg))
+if (isset($successMsg))
$gBitSmarty->assign('successMsg',$successMsg);
if (isset($errorMsg))
$gBitSmarty->assign('errorMsg', $errorMsg);
@@ -200,6 +198,6 @@ foreach ($imageList as $image) {
}
}
-$gBitSmarty->assign('themeImages',$themeImages);
+$gBitSmarty->assign('themeImages',$themeImages);
$gBitSystem->display( 'bitpackage:themes/edit_css.tpl', null, [ 'display_mode' => 'edit' ]);