From e5309b5dbc058a62ca583bdbcc52f448b7fbacc6 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 6 Apr 2022 09:21:15 +0900 Subject: [PATCH] Stop using DS for DIRECTORY_SEPARATOR replacement There is no need for a short entry, use the long one. The DS is still defined for backwards compatible use --- www/admin/class_test.php | 4 +- www/configs/config.master.php | 64 ++++++++++----------- www/configs/config.other.php | 4 +- www/configs/config.php | 4 +- www/lib/CoreLibs/Template/SmartyExtend.php | 6 +- www/lib/CoreLibs/Template/SmartyExtend4.php | 6 +- 6 files changed, 43 insertions(+), 45 deletions(-) diff --git a/www/admin/class_test.php b/www/admin/class_test.php index 5f10ae75..c027498f 100644 --- a/www/admin/class_test.php +++ b/www/admin/class_test.php @@ -145,9 +145,7 @@ print "BASE: " . BASE . "
"; print "ROOT: " . ROOT . "
"; print "HOST: " . HOST_NAME . " => DB HOST: " . DB_CONFIG_NAME . " => " . print_r(DB_CONFIG, true) . "
"; -$ds = defined('DS') ? DS : DIRECTORY_SEPARATOR; -$du = DS ?? DIRECTORY_SEPARATOR; -print "DS is: " . $ds . "
"; +print "DS is: " . DIRECTORY_SEPARATOR . "
"; print "SERVER HOST: " . $_SERVER['HTTP_HOST'] . "
"; // print error messages diff --git a/www/configs/config.master.php b/www/configs/config.master.php index d25471ed..d91e0470 100644 --- a/www/configs/config.master.php +++ b/www/configs/config.master.php @@ -11,72 +11,72 @@ declare(strict_types=1); /************* PATHS *********************/ -// directory seperator +// [DEPRECATED] directory seperator define('DS', DIRECTORY_SEPARATOR); // ** NEW/BETTER DIR DECLARATIONS ** // path to original file (if symlink) -define('DIR', __DIR__ . DS); +define('DIR', __DIR__ . DIRECTORY_SEPARATOR); // base dir root folder level -define('BASE', str_replace('/configs', '', __DIR__) . DS); +define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR); // ** OLD DIR DECLARATIONS ** // path to document root of file called -define('ROOT', getcwd() . DS); +define('ROOT', getcwd() . DIRECTORY_SEPARATOR); // libs path -define('LIB', 'lib' . DS); -define('LIBS', 'lib' . DS); +define('LIB', 'lib' . DIRECTORY_SEPARATOR); +define('LIBS', 'lib' . DIRECTORY_SEPARATOR); // configs folder -define('CONFIGS', 'configs' . DS); +define('CONFIGS', 'configs' . DIRECTORY_SEPARATOR); // includes (strings, arrays for static, etc) -define('INCLUDES', 'includes' . DS); +define('INCLUDES', 'includes' . DIRECTORY_SEPARATOR); // data folder (mostly in includes, or root for internal data) -define('DATA', 'data' . DS); +define('DATA', 'data' . DIRECTORY_SEPARATOR); // layout base path -define('LAYOUT', 'layout' . DS); +define('LAYOUT', 'layout' . DIRECTORY_SEPARATOR); // pic-root (compatible to CMS) -define('PICTURES', 'images' . DS); +define('PICTURES', 'images' . DIRECTORY_SEPARATOR); // images -define('IMAGES', 'images' . DS); +define('IMAGES', 'images' . DIRECTORY_SEPARATOR); // icons (below the images/ folder) -define('ICONS', 'icons' . DS); +define('ICONS', 'icons' . DIRECTORY_SEPARATOR); // media (accessable from outside) -define('MEDIA', 'media' . DS); +define('MEDIA', 'media' . DIRECTORY_SEPARATOR); // uploads (anything to keep or data) -define('UPLOADS', 'uploads' . DS); +define('UPLOADS', 'uploads' . DIRECTORY_SEPARATOR); // files (binaries) (below media or data) -define('BINARIES', 'binaries' . DS); +define('BINARIES', 'binaries' . DIRECTORY_SEPARATOR); // files (videos) (below media or data) -define('VIDEOS', 'videos' . DS); +define('VIDEOS', 'videos' . DIRECTORY_SEPARATOR); // files (documents) (below media or data) -define('DOCUMENTS', 'documents' . DS); +define('DOCUMENTS', 'documents' . DIRECTORY_SEPARATOR); // files (pdfs) (below media or data) -define('PDFS', 'documents' . DS); +define('PDFS', 'documents' . DIRECTORY_SEPARATOR); // files (general) (below media or data) -define('FILES', 'files' . DS); +define('FILES', 'files' . DIRECTORY_SEPARATOR); // CSV -define('CSV', 'csv' . DS); +define('CSV', 'csv' . DIRECTORY_SEPARATOR); // css -define('CSS', 'css' . DS); +define('CSS', 'css' . DIRECTORY_SEPARATOR); // font (web) -define('FONT', 'font' . DS); +define('FONT', 'font' . DIRECTORY_SEPARATOR); // js -define('JS', 'javascript' . DS); +define('JS', 'javascript' . DIRECTORY_SEPARATOR); // table arrays -define('TABLE_ARRAYS', 'table_arrays' . DS); +define('TABLE_ARRAYS', 'table_arrays' . DIRECTORY_SEPARATOR); // smarty libs path -define('SMARTY', 'Smarty' . DS); +define('SMARTY', 'Smarty' . DIRECTORY_SEPARATOR); // po langs -define('LANG', 'lang' . DS); +define('LANG', 'lang' . DIRECTORY_SEPARATOR); // cache path -define('CACHE', 'cache' . DS); +define('CACHE', 'cache' . DIRECTORY_SEPARATOR); // temp path -define('TMP', 'tmp' . DS); +define('TMP', 'tmp' . DIRECTORY_SEPARATOR); // log files -define('LOG', 'log' . DS); +define('LOG', 'log' . DIRECTORY_SEPARATOR); // compiled template folder -define('TEMPLATES_C', 'templates_c' . DS); +define('TEMPLATES_C', 'templates_c' . DIRECTORY_SEPARATOR); // template base -define('TEMPLATES', 'templates' . DS); +define('TEMPLATES', 'templates' . DIRECTORY_SEPARATOR); /************* HASH / ACL DEFAULT / ERROR SETTINGS / SMARTY *************/ // default hash type diff --git a/www/configs/config.other.php b/www/configs/config.other.php index 37a4bd11..4930b398 100644 --- a/www/configs/config.other.php +++ b/www/configs/config.other.php @@ -21,9 +21,9 @@ $paths = [ ]; // find convert foreach ($paths as $path) { - if (file_exists($path . DS . 'convert') && is_file($path . DS . 'convert')) { + if (file_exists($path . DIRECTORY_SEPARATOR . 'convert') && is_file($path . DIRECTORY_SEPARATOR . 'convert')) { // image magick convert location - define('CONVERT', $path . DS . 'convert'); + define('CONVERT', $path . DIRECTORY_SEPARATOR . 'convert'); break; } } diff --git a/www/configs/config.php b/www/configs/config.php index f51f822f..62fe0cd1 100644 --- a/www/configs/config.php +++ b/www/configs/config.php @@ -46,8 +46,8 @@ for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir break; } } -// fail if no base DS is not set -if (!defined('DS')) { +// fail if no base DIR is not set +if (!defined('DIR')) { exit('Base config unloadable'); } // find trigger name "admin/" or "frontend/" in the getcwd() folder diff --git a/www/lib/CoreLibs/Template/SmartyExtend.php b/www/lib/CoreLibs/Template/SmartyExtend.php index fd363ca5..3401891f 100644 --- a/www/lib/CoreLibs/Template/SmartyExtend.php +++ b/www/lib/CoreLibs/Template/SmartyExtend.php @@ -330,13 +330,13 @@ class SmartyExtend extends SmartyBC // check if template names exist if (!$this->MASTER_TEMPLATE_NAME) { exit('MASTER TEMPLATE is not set'); - } elseif (!file_exists($this->getTemplateDir()[0] . DS . $this->MASTER_TEMPLATE_NAME)) { + } elseif (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->MASTER_TEMPLATE_NAME)) { // abort if master template could not be found exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found'); } if ( $this->TEMPLATE_NAME && - !file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_NAME) + !file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_NAME) ) { exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found'); } @@ -355,7 +355,7 @@ class SmartyExtend extends SmartyBC } } // if we can't find it, dump it - if (!file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_TRANSLATE)) { + if (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_TRANSLATE)) { $this->TEMPLATE_TRANSLATE = null; } } diff --git a/www/lib/CoreLibs/Template/SmartyExtend4.php b/www/lib/CoreLibs/Template/SmartyExtend4.php index 2b4136de..96514838 100644 --- a/www/lib/CoreLibs/Template/SmartyExtend4.php +++ b/www/lib/CoreLibs/Template/SmartyExtend4.php @@ -327,13 +327,13 @@ class SmartyExtend4 extends Smarty // check if template names exist if (!$this->MASTER_TEMPLATE_NAME) { exit('MASTER TEMPLATE is not set'); - } elseif (!file_exists($this->getTemplateDir()[0] . DS . $this->MASTER_TEMPLATE_NAME)) { + } elseif (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->MASTER_TEMPLATE_NAME)) { // abort if master template could not be found exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found'); } if ( $this->TEMPLATE_NAME && - !file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_NAME) + !file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_NAME) ) { exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found'); } @@ -352,7 +352,7 @@ class SmartyExtend4 extends Smarty } } // if we can't find it, dump it - if (!file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_TRANSLATE)) { + if (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_TRANSLATE)) { $this->TEMPLATE_TRANSLATE = null; } }