openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 1a397fc526c1da2bdf700925024591ccaa3ace52
parent 47cff085f547bec3cfffc794de17a184087cc8e6
Author: Jan Dankert <develop@jandankert.de>
Date:   Wed,  7 Oct 2020 23:01:31 +0200

Cleanup: Refactored file seperator char with an unicode char.

Diffstat:
Mmodules/cms/Dispatcher.class.php | 3+--
Mmodules/cms/action/ElementAction.class.php | 4++--
Mmodules/cms/action/PageAction.class.php | 4++--
Mmodules/cms/action/PageelementAction.class.php | 4++--
Mmodules/cms/model/Project.class.php | 21+++++++++++----------
Mmodules/util/Text.class.php | 4++++
6 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -24,6 +24,7 @@ use util\exception\UIException; use util\exception\SecurityException; use util\json\JSON; use util\Session; +use util\Text; /** @@ -86,8 +87,6 @@ class Dispatcher $this->checkPostToken(); - define('FILE_SEP', $conf['interface']['file_separator']); - $this->connectToDatabase(); $this->startDatabaseTransaction(); diff --git a/modules/cms/action/ElementAction.class.php b/modules/cms/action/ElementAction.class.php @@ -517,10 +517,10 @@ class ElementAction extends BaseAction $names = $f->parentObjectNames(false,true); foreach( $names as $fid=>$name ) $names[$fid] = Text::maxLength($name,15,'..',STR_PAD_BOTH); - $objects[ $id ] .= implode( FILE_SEP,$names ); + $objects[ $id ] .= implode( \util\Text::FILE_SEP,$names ); } - $objects[ $id ] .= FILE_SEP.$o->name; + $objects[ $id ] .= \util\Text::FILE_SEP.$o->getName(); } asort( $objects ); // Sortieren diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php @@ -256,8 +256,8 @@ class PageAction extends ObjectAction { $f = new Folder( $o->parentid ); $objects[ $id ] = \cms\base\Language::lang( ''.$o->getType() ).': '; - $objects[ $id ] .= implode( FILE_SEP,$f->parentObjectNames(false,true) ); - $objects[ $id ] .= FILE_SEP.$o->name; + $objects[ $id ] .= implode( \util\Text::FILE_SEP,$f->parentObjectNames(false,true) ); + $objects[ $id ] .= \util\Text::FILE_SEP.$o->name; } } asort($objects); diff --git a/modules/cms/action/PageelementAction.class.php b/modules/cms/action/PageelementAction.class.php @@ -461,8 +461,8 @@ class PageelementAction extends BaseAction // $f->load(); $objects[ $id ] = \cms\base\Language::lang( $o->getType() ).': '; - $objects[ $id ] .= implode( FILE_SEP,$f->parentObjectNames(false,true) ); - $objects[ $id ] .= FILE_SEP.$o->name; + $objects[ $id ] .= implode( \util\Text::FILE_SEP,$f->parentObjectNames(false,true) ); + $objects[ $id ] .= \util\Text::FILE_SEP.$o->name; // } } diff --git a/modules/cms/model/Project.class.php b/modules/cms/model/Project.class.php @@ -991,13 +991,14 @@ SQL */ public function getAllFolders() { - $db = \cms\base\DB::get(); - - $stmt = $db->sql('SELECT id FROM {{object}}'. - ' WHERE typeid='.BaseObject::TYPEID_FOLDER. - ' AND projectid={projectid}' ); - - $stmt->setInt( 'projectid',$this->projectid ); + $stmt = DB::sql( <<<SQL + SELECT id FROM {{object}} + WHERE typeid={typeid} + AND projectid={projectid} +SQL + ); + $stmt->setInt( 'typeid' ,BaseObject::TYPEID_FOLDER ); + $stmt->setInt( 'projectid',$this->projectid ); return( $stmt->getCol() ); } @@ -1023,10 +1024,10 @@ SQL $names = $f->parentObjectNames(true,true); foreach( $names as $fid=>$name ) $names[$fid] = \util\Text::maxLength($name,15,'..',STR_PAD_BOTH); - $folders[ $id ] = implode( ' &raquo; ',$names ); - $folders[ $id ] .= ' &raquo; '; + $folders[ $id ] = implode( \util\Text::FILE_SEP,$names ); + $folders[ $id ] .= \util\Text::FILE_SEP; } - $folders[ $id ] .= $o->name; + $folders[ $id ] .= $o->getName(); } asort( $folders ); // Sortieren diff --git a/modules/util/Text.class.php b/modules/util/Text.class.php @@ -27,6 +27,10 @@ namespace util; */ class Text { + const ARROW_RIGHT = "\xE2\x86\x92"; + const FILE_SEP = " \xE2\x86\x92 "; + + /** * * @param unknown $key