commit 3bf2a6932371c0c42001a2ddb72925405b89bad5
parent bff91d0650531bacc6fb183a26061cf6d4eddb05
Author: Jan Dankert <develop@jandankert.de>
Date: Mon, 20 May 2019 21:20:14 +0200
Refactoring: Konstanten aus init.php verschoben.
Diffstat:
4 files changed, 20 insertions(+), 75 deletions(-)
diff --git a/modules/cms-core/init.php b/modules/cms-core/init.php
@@ -15,7 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-define('MIN_VERSION','5');
+define('MIN_VERSION','5.4');
if ( version_compare(phpversion(),MIN_VERSION,"<") )
throw new ValidationException('This version of PHP is not supported any more. Minimum required: '.MIN_VERSION);
@@ -29,15 +29,6 @@ define('IMG_ICON_EXT' ,'.png' );
require(__DIR__.'/version.php');
define('OR_TITLE' ,'OpenRat CMS');
-define('OR_TYPE_FOLDER','folder');
-define('OR_TYPE_PAGE' ,'page' );
-define('OR_TYPE_FILE' ,'file' );
-define('OR_TYPE_IMAGE' ,'image' );
-define('OR_TYPE_TEXT' ,'text' );
-define('OR_TYPE_LINK' ,'link' );
-define('OR_TYPE_URL' ,'url' );
-
-
define( 'CMS_ROOT_DIR',__DIR__.'/../../');
define('OR_MODULES_DIR' ,CMS_ROOT_DIR.'modules/');
diff --git a/modules/cms-core/model/BaseObject.class.php b/modules/cms-core/model/BaseObject.class.php
@@ -25,6 +25,14 @@ class BaseObject
const TYPEID_IMAGE = 6;
const TYPEID_TEXT = 7;
+ const TYPE_FOLDER = 'folder';
+ const TYPE_FILE = 'file' ;
+ const TYPE_PAGE = 'page' ;
+ const TYPE_LINK = 'link' ;
+ const TYPE_URL = 'url' ;
+ const TYPE_IMAGE = 'image' ;
+ const TYPE_TEXT = 'text' ;
+
/** eindeutige ID dieses Objektes
* @see #$objectid
* @type Integer
@@ -308,19 +316,19 @@ SQL
function getType()
{
if ($this->isFolder)
- return OR_TYPE_FOLDER;
+ return self::TYPE_FOLDER;
if ($this->isFile)
- return OR_TYPE_FILE;
+ return self::TYPE_FILE;
if ($this->isImage)
- return OR_TYPE_IMAGE;
+ return self::TYPE_IMAGE;
if ($this->isText)
- return OR_TYPE_TEXT;
+ return self::TYPE_TEXT;
if ($this->isPage)
- return OR_TYPE_PAGE;
+ return self::TYPE_PAGE;
if ($this->isLink)
- return OR_TYPE_LINK;
+ return self::TYPE_LINK;
if ($this->isUrl)
- return OR_TYPE_URL;
+ return self::TYPE_URL;
return 'unknown';
}
@@ -407,7 +415,7 @@ SQL
return $this->filename;
}
- if ( $this->type == OR_TYPE_FOLDER )
+ if ( $this->isFolder )
{
$this->filename = $this->objectid;
}
diff --git a/modules/cms-core/model/ObjectFactory.php b/modules/cms-core/model/ObjectFactory.php
@@ -1,53 +0,0 @@
-<?php
-namespace cms\model;
-// OpenRat Content Management System
-// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-class ObjectFactory
-{
- function create( $objectid )
- {
- $o = new BaseObject( $objectid );
-
- switch( $o->getType() )
- {
- case OR_TYPE_FILE:
- $x = new File( $objectid );
- break;
-
- case OR_TYPE_FOLDER:
- $x = new Folder( $objectid );
- break;
-
- case OR_TYPE_PAGE:
- $x = new Page( $objectid );
- break;
-
- case OR_TYPE_LINK:
- $x = new Link( $objectid );
- break;
-
- default:
- throw new \LogicException( "Unknown Object-Typ: ".$o->getType() );
- }
-
- $x->load();
- return $x;
- }
-}
-
-?>-
\ No newline at end of file
diff --git a/modules/cms-core/model/Value.class.php b/modules/cms-core/model/Value.class.php
@@ -644,9 +644,9 @@ SQL
case 'inline':
$o = new BaseObject( $oid );
$o->load();
- switch( $o->getType() )
+ switch( $o->typeid )
{
- case OR_TYPE_PAGE:
+ case BaseObject::TYPEID_PAGE:
$p = new Page( $oid );
$p->enclosingObjectId = $this->page->id;
$p->public = $this->page->publisher->isPublic();
@@ -658,7 +658,7 @@ SQL
$inhalt .= $p->value;
unset( $p );
break;
- case OR_TYPE_LINK:
+ case BaseObject::TYPEID_LINK:
$l = new Link( $oid );
$l->load();
if ( $l->isLinkToObject )