openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 138b46019e3ccae25e0e63e1ff49d0fdf258e940
parent 066192f73bc01928b927d17efed10bca7d48bddf
Author: Jan Dankert <devnull@localhost>
Date:   Sun,  3 Dec 2017 23:48:33 +0100

Namespace für Model-Klassen. Dazu mussten die Konstruktoren auf den Namen __construct() geändert werden, da die alten Konstruktoren mit Namespaces nicht mehr aufgerufen werden.

Diffstat:
action/ElementAction.class.php | 7+++++++
action/FileAction.class.php | 5+++++
action/FolderAction.class.php | 7+++++++
action/GroupAction.class.php | 7+++++++
action/GrouplistAction.class.php | 2++
action/IndexAction.class.php | 2++
action/LanguageAction.class.php | 2++
action/LanguagelistAction.class.php | 2++
action/LinkAction.class.php | 3+++
action/LoginAction.class.php | 14+++++++++++++-
action/ModelAction.class.php | 2++
action/ModellistAction.class.php | 2++
action/ObjectAction.class.php | 10++++++++++
action/PageAction.class.php | 10++++++++++
action/PageelementAction.class.php | 8++++++++
action/ProfileAction.class.php | 1+
action/ProjectAction.class.php | 3+++
action/ProjectlistAction.class.php | 2++
action/SearchAction.class.php | 6++++++
action/StartAction.class.php | 11++++++++++-
action/TemplateAction.class.php | 4++++
action/TemplatelistAction.class.php | 3+++
action/TitleAction.class.php | 15++++++++++-----
action/TreeAction.class.php | 67+++++++++++++++++++++++++++++++++++--------------------------------
action/UserAction.class.php | 197+++++++++++++++++++++++++++++++++++++++++--------------------------------------
action/UserlistAction.class.php | 4+++-
action/WebdavAction.class.php | 15+++++++++++----
action/WorkbenchAction.class.php | 3+++
auth/InternalAuth.class.php | 2++
dispatcher.php | 1+
init.php | 5++++-
model/Acl.class.php | 5+++--
model/Element.class.php | 5+++--
model/File.class.php | 11++++++-----
model/Folder.class.php | 25+++++++++++++------------
model/Group.class.php | 5+++--
model/Language.class.php | 15++++++++-------
model/Link.class.php | 5+++--
model/Model.class.php | 9+++++----
model/ModelBase.class.php | 1+
model/Object.class.php | 33+++++++++++++++++----------------
model/ObjectFactory.php | 1+
model/Page.class.php | 25+++++++++++++------------
model/Project.class.php | 37+++++++++++++++++++------------------
model/Template.class.php | 15++++++++-------
model/User.class.php | 20+++++++++++---------
model/Value.class.php | 21+++++++++++++++------
model/include.inc.php | 1+
util/AdministrationTree.class.php | 5+++++
util/ProjectTree.class.php | 9+++++++++
50 files changed, 426 insertions(+), 244 deletions(-)

diff --git a/action/ElementAction.class.php b/action/ElementAction.class.php @@ -1,4 +1,11 @@ <?php + +use cms\model\Element; +use cms\model\Template; +use cms\model\Folder; +use cms\model\Object; + + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/FileAction.class.php b/action/FileAction.class.php @@ -1,4 +1,9 @@ <?php +use cms\model\Folder; +use cms\model\Object; +use cms\model\File; + + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/FolderAction.class.php b/action/FolderAction.class.php @@ -1,4 +1,11 @@ <?php +use cms\model\Template; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; +use cms\model\File; +use cms\model\Link; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/GroupAction.class.php b/action/GroupAction.class.php @@ -1,4 +1,11 @@ <?php +use cms\model\Acl; +use cms\model\User; +use cms\model\Project; +use cms\model\Group; +use cms\model\Object; +use cms\model\Language; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/GrouplistAction.class.php b/action/GrouplistAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Group; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/IndexAction.class.php b/action/IndexAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\User; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/LanguageAction.class.php b/action/LanguageAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Language; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/LanguagelistAction.class.php b/action/LanguagelistAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Language; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/LinkAction.class.php b/action/LinkAction.class.php @@ -1,4 +1,7 @@ <?php +use cms\model\Folder; +use cms\model\Link; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/LoginAction.class.php b/action/LoginAction.class.php @@ -1,4 +1,16 @@ <?php + +use cms\model\User; +use cms\model\Project; +use cms\model\Group; +use cms\model\Value; +use cms\model\Element; +use cms\model\Page; +use cms\model\Object; +use cms\model\Language; +use cms\model\Model; + + // OpenRat Content Management System // Copyright (C) 2002-2007 Jan Dankert, jandankert@jandankert.de // @@ -1211,7 +1223,7 @@ class LoginAction extends Action !isset($subaction['alias' ]) && $subActionName != 'menu' ) { - $engine = new TemplateEngine(); + $engine = new template_engine\TemplateEngine(); $engine->compile( strtolower(str_replace('Action','',$actionName)).'/'.$subActionName); } } diff --git a/action/ModelAction.class.php b/action/ModelAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/ModellistAction.class.php b/action/ModellistAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/ObjectAction.class.php b/action/ObjectAction.class.php @@ -1,4 +1,14 @@ <?php +use cms\model\Acl; +use cms\model\User; +use cms\model\Group; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; +use cms\model\Language; +use cms\model\File; +use cms\model\Link; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/PageAction.class.php b/action/PageAction.class.php @@ -1,4 +1,14 @@ <?php +use cms\model\Project; +use cms\model\Value; +use cms\model\Element; +use cms\model\Template; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; +use cms\model\Language; +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/PageelementAction.class.php b/action/PageelementAction.class.php @@ -1,4 +1,12 @@ <?php +use cms\model\User; +use cms\model\Value; +use cms\model\Element; +use cms\model\Template; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/ProfileAction.class.php b/action/ProfileAction.class.php @@ -1,4 +1,5 @@ <?php + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/ProjectAction.class.php b/action/ProjectAction.class.php @@ -1,4 +1,7 @@ <?php +use cms\model\Project; +use cms\model\Folder; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/ProjectlistAction.class.php b/action/ProjectlistAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\Project; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/SearchAction.class.php b/action/SearchAction.class.php @@ -1,4 +1,10 @@ <?php +use cms\model\User; +use cms\model\Value; +use cms\model\Template; +use cms\model\Object; +use cms\model\File; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/action/StartAction.class.php b/action/StartAction.class.php @@ -1,4 +1,13 @@ <?php +use cms\model\User; +use cms\model\Project; +use cms\model\Value; +use cms\model\Element; +use cms\model\Page; +use cms\model\Object; +use cms\model\Language; +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002-2007 Jan Dankert, jandankert@jandankert.de // @@ -804,7 +813,7 @@ class StartAction extends Action !isset($subaction['alias' ]) && $subActionName != 'menu' ) { - $engine = new TemplateEngine(); + $engine = new template_engine\TemplateEngine(); $engine->compile( strtolower(str_replace('Action','',$actionName)).'/'.$subActionName); } } diff --git a/action/TemplateAction.class.php b/action/TemplateAction.class.php @@ -1,4 +1,8 @@ <?php +use cms\model\Element; +use cms\model\Template; +use cms\model\Page; + // OpenRat Content Management System // Copyright (C) 2002-2009 Jan Dankert // diff --git a/action/TemplatelistAction.class.php b/action/TemplatelistAction.class.php @@ -1,4 +1,7 @@ <?php +use cms\model\Element; +use cms\model\Template; + // OpenRat Content Management System // Copyright (C) 2002-2009 Jan Dankert // diff --git a/action/TitleAction.class.php b/action/TitleAction.class.php @@ -1,4 +1,9 @@ <?php +use cms\model\Project; +use cms\model\Object; +use cms\model\Language; +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002-2009 Jan Dankert, jandankert@jandankert.de // @@ -41,14 +46,14 @@ class TitleAction extends Action $db = Session::getDatabase(); $this->setTemplateVar('dbname',$db->conf['name'].(readonly()?' ('.lang('readonly').')':'')); - $this->setTemplateVar('dbid' ,$db->id); + $this->setTemplateVar('dbid' ,$db->id); $databases = array(); $this->setTemplateVar('username' ,$user->name ); $this->setTemplateVar('userfullname',$user->fullname); - - $project = Session::getProject(); + + $project = Session::getProject(); if ( is_object($project) ) { $this->setTemplateVar('projectname',$project->name); @@ -60,12 +65,12 @@ class TitleAction extends Action $language = Session::getProjectLanguage(); if ( is_object($language) ) { - $this->setTemplateVar('languagename',$language->name); + $this->setTemplateVar('languagename',$language->name); $this->setTemplateVar('languages',Language::getAll() ); } $model = Session::getProjectModel(); - if ( is_object($model) ) + if ( is_object($model) ) { $this->setTemplateVar('modelname',$model->name); $this->setTemplateVar('models' ,Model::getAll() ); diff --git a/action/TreeAction.class.php b/action/TreeAction.class.php @@ -1,4 +1,7 @@ <?php +use cms\model\Language; +use cms\model\Model; + // OpenRat Content Management System // Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de // @@ -226,7 +229,7 @@ class TreeAction extends Action $var = array(); $var['zeilen'] = $this->outputElement( 0,0,array() ); - $var['zeilen'] = array(); + $var['zeilen'] = array(); $this->setTemplateVars( $var ); } @@ -262,21 +265,21 @@ class TreeAction extends Action */ public function loadBranchView() { - $project = Session::getProject(); - $projectid = $project->projectid; - - Logger::debug( "Initializing Tree for Project ".$projectid); - - if ( $projectid == -1 ) - { - $tree = new AdministrationTree(); - } - else - { - $tree = new ProjectTree(); - $tree->projectId = $projectid; - } - + $project = Session::getProject(); + $projectid = $project->projectid; + + Logger::debug( "Initializing Tree for Project ".$projectid); + + if ( $projectid == -1 ) + { + $tree = new AdministrationTree(); + } + else + { + $tree = new ProjectTree(); + $tree->projectId = $projectid; + } + $type = $this->getRequestVar('type'); @@ -336,26 +339,26 @@ class TreeAction extends Action } - public function languagePost() - { - $language = new Language( $this->getRequestId() ); - $language->load(); - Session::setProjectLanguage( $language ); - + public function languagePost() + { + $language = new Language( $this->getRequestId() ); + $language->load(); + Session::setProjectLanguage( $language ); + $this->addNotice('language',$language->name,'DONE',OR_NOTICE_OK); - $this->refresh(); - } + $this->refresh(); + } - public function modelPost() - { - $model = new Model( $this->getRequestId() ); - $model->load(); - Session::setProjectModel( $model ); - - $this->addNotice('model' ,$model->name ,'DONE',OR_NOTICE_OK); + public function modelPost() + { + $model = new Model( $this->getRequestId() ); + $model->load(); + Session::setProjectModel( $model ); + + $this->addNotice('model' ,$model->name ,'DONE',OR_NOTICE_OK); $this->refresh(); - } + } } diff --git a/action/UserAction.class.php b/action/UserAction.class.php @@ -1,4 +1,11 @@ <?php +use cms\model\Acl; +use cms\model\User; +use cms\model\Project; +use cms\model\Group; +use cms\model\Object; +use cms\model\Language; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -40,9 +47,9 @@ class UserAction extends Action function editPost() - { - if ( $this->getRequestVar('name') != '' ) - { + { + if ( $this->getRequestVar('name') != '' ) + { // Benutzer speichern $this->user->name = $this->getRequestVar('name' ); $this->user->fullname = $this->getRequestVar('fullname'); @@ -64,11 +71,11 @@ class UserAction extends Action $this->user->save(); $this->addNotice('user',$this->user->name,'SAVED','ok'); } - else - { - $this->addValidationError('name'); - $this->callSubAction('edit'); - } + else + { + $this->addValidationError('name'); + $this->callSubAction('edit'); + } } @@ -87,11 +94,11 @@ class UserAction extends Action $this->user->delete(); $this->addNotice('user',$this->user->name,'DELETED','ok'); } - else - { - $this->addValidationError('confirm'); - return; - } + else + { + $this->addValidationError('confirm'); + return; + } } @@ -154,13 +161,13 @@ class UserAction extends Action if ( strlen($pw1)<intval($conf['security']['password']['min_length']) ) { $this->addValidationError('password1'); - return; - } - elseif ( $pw1 != $pw2 ) - { - $this->addValidationError('password2'); - return; - } + return; + } + elseif ( $pw1 != $pw2 ) + { + $this->addValidationError('password2'); + return; + } else { $newPassword = $pw1; @@ -176,7 +183,7 @@ class UserAction extends Action Http::serverError('Type unknown: '.$type); } - // Kennwoerter identisch und lang genug + // Kennwoerter identisch und lang genug $this->user->setPassword($newPassword,!$this->hasRequestVar('timeout') ); // Kennwort setzen // E-Mail mit dem neuen Kennwort an Benutzer senden @@ -185,7 +192,7 @@ class UserAction extends Action $this->mailPw( $newPassword ); $this->addNotice('user',$this->user->name,'MAIL_SENT','ok'); } - + $this->addNotice('user',$this->user->name,'SAVED','ok'); } @@ -224,7 +231,7 @@ class UserAction extends Action $this->setTemplateVars( $this->user->getProperties() + array('totpSecretUrl' => "otpauth://totp/{$issuer}:{$account}?secret={$secret}&issuer={$issuer}", - 'hotpSecretUrl' => "otpauth://hotp/{$issuer}:{$account}?secret={$secret}&issuer={$issuer}&counter={$counter}" + 'hotpSecretUrl' => "otpauth://hotp/{$issuer}:{$account}?secret={$secret}&issuer={$issuer}&counter={$counter}" ) + array('totpToken'=>Password::getTOTPCode($this->user->otpSecret)) ); @@ -351,82 +358,82 @@ class UserAction extends Action { $rights = $this->user->getAllAcls(); - $projects = array(); + $projects = array(); foreach( $rights as $acl ) - { - if ( !isset($projects[$acl->projectid])) - { - $projects[$acl->projectid] = array(); + { + if ( !isset($projects[$acl->projectid])) + { + $projects[$acl->projectid] = array(); $p = new Project($acl->projectid); - $p->load(); + $p->load(); $projects[$acl->projectid]['projectname'] = $p->name; $projects[$acl->projectid]['rights' ] = array(); - } - - $right = array(); - - if ( $acl->languageid > 0 ) - { + } + + $right = array(); + + if ( $acl->languageid > 0 ) + { $language = new Language($acl->languageid); - $language->load(); - $right['languagename'] = $language->name; - } - else - { + $language->load(); + $right['languagename'] = $language->name; + } + else + { $right['languagename'] = lang('ALL_LANGUAGES'); - } - + } + $o = new Object($acl->objectid); - $o->objectLoad(); - $right['objectname'] = $o->name; - $right['objectid' ] = $o->objectid; - $right['objecttype'] = $o->getType(); - - if ( $acl->userid > 0 ) - { - $user = new User($acl->userid); + $o->objectLoad(); + $right['objectname'] = $o->name; + $right['objectid' ] = $o->objectid; + $right['objecttype'] = $o->getType(); + + if ( $acl->userid > 0 ) + { + $user = new User($acl->userid); $user->load(); - $right['username'] = $user->name; - } - elseif ( $acl->groupid > 0 ) - { - $group = new Group($acl->groupid); + $right['username'] = $user->name; + } + elseif ( $acl->groupid > 0 ) + { + $group = new Group($acl->groupid); $group->load(); - $right['groupname'] = $group->name; - } - else - { - // Berechtigung f�r "alle". - } - -// $show = array(); -// foreach( $acl->getProperties() as $p=>$set) -// $show[$p] = $set; -// -// $right['show'] = $show; - $right['bits'] = $acl->getProperties(); - + $right['groupname'] = $group->name; + } + else + { + // Berechtigung f�r "alle". + } + +// $show = array(); +// foreach( $acl->getProperties() as $p=>$set) +// $show[$p] = $set; +// +// $right['show'] = $show; + $right['bits'] = $acl->getProperties(); + $projects[$acl->projectid]['rights'][] = $right; } - $this->setTemplateVar('projects' ,$projects ); - - $this->setTemplateVar('show',Acl::getAvailableRights() ); - - if ( $this->user->isAdmin ) + $this->setTemplateVar('projects' ,$projects ); + + $this->setTemplateVar('show',Acl::getAvailableRights() ); + + if ( $this->user->isAdmin ) $this->addNotice('user',$this->user->name,'ADMIN_NEEDS_NO_RIGHTS',OR_NOTICE_WARN); } /** - * @param String $name Men�punkt - * @return boolean - */ + * @param String $name Men�punkt + * @return boolean + */ function checkMenu( $menu ) { - global $conf; + global $conf; switch( $menu ) { @@ -439,15 +446,15 @@ class UserAction extends Action case 'groups': return !readonly() && count(Group::getAll()) > 0; - - case 'pw': + + case 'pw': return !readonly() - && @$conf['security']['auth']['type'] == 'database' + && @$conf['security']['auth']['type'] == 'database' && !@$conf['security']['auth']['userdn']; - } - - return true; - } + } + + return true; + } /** @@ -466,14 +473,14 @@ class UserAction extends Action } - /** - * Ermittelt die letzten Änderungen, die durch den aktuellen Benutzer in allen Projekten gemacht worden sind. - */ - public function historyView() - { - $result = $this->user->getLastChanges(); - $this->setTemplateVar('timeline', $result); - } - - + /** + * Ermittelt die letzten Änderungen, die durch den aktuellen Benutzer in allen Projekten gemacht worden sind. + */ + public function historyView() + { + $result = $this->user->getLastChanges(); + $this->setTemplateVar('timeline', $result); + } + + } \ No newline at end of file diff --git a/action/UserlistAction.class.php b/action/UserlistAction.class.php @@ -1,4 +1,6 @@ <?php +use cms\model\User; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -78,5 +80,5 @@ class UserlistAction extends Action - + } \ No newline at end of file diff --git a/action/WebdavAction.class.php b/action/WebdavAction.class.php @@ -1,4 +1,11 @@ <?php +use cms\model\User; +use cms\model\Project; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; +use cms\model\File; +use cms\model\Link; /** @@ -57,9 +64,9 @@ class WebdavAction extends Action * durchgefuehrt. */ function WebdavAction() - { - if (!defined('E_STRICT')) - define('E_STRICT', 2048); + { + if (!defined('E_STRICT')) + define('E_STRICT', 2048); // Nicht notwendig, da wir den Error-Handler umbiegen: error_reporting(0); // PHP-Fehlermeldungen zerstoeren XML-Dokument, daher ausschalten. @@ -148,7 +155,7 @@ class WebdavAction extends Action if ( !$ok ) { // Client ist nicht angemeldet, daher wird nun die - // Authentisierung angefordert. + // Authentisierung angefordert. Logger::debug( 'Requesting Client to authenticate' ); header('WWW-Authenticate: Basic realm="'.OR_TITLE.'"'); $this->httpStatus('401 Unauthorized'); diff --git a/action/WorkbenchAction.class.php b/action/WorkbenchAction.class.php @@ -1,4 +1,7 @@ <?php +use cms\model\Value; +use cms\model\Folder; +use cms\model\Object; /** * Action-Klasse zum Anzeigen der Workbench diff --git a/auth/InternalAuth.class.php b/auth/InternalAuth.class.php @@ -1,5 +1,7 @@ <?php +use cms\model\User; + /** * Authentifizierungsmodul für die interne Benutzerdatenbank. * diff --git a/dispatcher.php b/dispatcher.php @@ -242,6 +242,7 @@ catch( OpenRatException $e ) } catch( SecurityException $e ) { + Logger::info($e->getMessage()); Http::notAuthorized("You are not allowed to execute this action."); } catch( Exception $e ) diff --git a/init.php b/init.php @@ -103,7 +103,10 @@ function fatal_handler() { $errline = $error["line"]; $errstr = $error["message"]; - Logger::error( $errno .' '. $errstr.' '. $errfile.' '. $errline); + if(class_exists('Logger')) + Logger::error( $errno .' '. $errstr.' '. $errfile.' '. $errline); + else + var_dump($error); } } diff --git a/model/Acl.class.php b/model/Acl.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -180,7 +181,7 @@ class Acl * * @param Integer Acl-ID */ - function Acl( $aclid = 0 ) + function __construct( $aclid = 0 ) { if ( $aclid != 0 ) $this->aclid = $aclid; @@ -339,7 +340,7 @@ class Acl $this->mask += ACL_GRANT *intval($this->grant ); $this->mask += ACL_TRANSMIT *intval($this->transmit ); - Logger::trace('mask of acl '.$this->aclid.': '.$this->mask ); + \Logger::trace('mask of acl '.$this->aclid.': '.$this->mask ); return $this->mask; } diff --git a/model/Element.class.php b/model/Element.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -125,7 +126,7 @@ class Element * Im Konstruktor wird die Element-Id gesetzt * @param Integer Element-Id */ - function Element( $elementid=0 ) + function __construct( $elementid=0 ) { if ( intval($elementid)!=0 ) $this->elementid = $elementid; @@ -192,7 +193,7 @@ SQL function setDatabaseRow( $prop ) { if ( count($prop) <= 0 ) - throw new ObjectNotFoundException("Element not found"); + throw new \ObjectNotFoundException("Element not found"); $this->elementid = $prop['id' ]; $this->templateid = $prop['templateid']; diff --git a/model/File.class.php b/model/File.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -71,14 +72,14 @@ class File extends Object * * @param Objekt-Id */ - function File( $objectid='' ) + function __construct( $objectid='' ) { global $conf; - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $this->storeValueAsBase64 = $db->conf['base64']; - $this->Object( $objectid ); + parent::__construct( $objectid ); $this->isFile = true; } @@ -643,7 +644,7 @@ EOF function publish() { if ( ! is_object($this->publish) ) - $this->publish = new Publish(); + $this->publish = new \Publish(); $this->write(); $this->publish->copy( $this->tmpfile(),$this->full_filename(),$this->lastchangeDate ); diff --git a/model/Folder.class.php b/model/Folder.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -37,9 +38,9 @@ class Folder extends Object var $publish = null; - function Folder( $objectid='' ) + function __construct( $objectid='' ) { - $this->Object( $objectid ); + parent::__construct( $objectid ); $this->isFolder = true; } @@ -81,7 +82,7 @@ class Folder extends Object } else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid ); } @@ -255,7 +256,7 @@ class Folder extends Object { set_time_limit(300); if ( ! is_object($this->publish) ) - $this->publish = new Publish(); + $this->publish = new \Publish(); foreach( $this->getObjectIds() as $oid ) { @@ -332,7 +333,7 @@ class Folder extends Object } else { - $project = Session::getProject(); + $project = \Session::getProject(); $projectid = $project->projectid; } @@ -390,7 +391,7 @@ class Folder extends Object if ( !isset($this) || !isset($this->projectid) ) { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } else $sql->setInt( 'projectid',$this->projectid ); @@ -628,7 +629,7 @@ class Folder extends Object function parentObjectFileNames( $with_root = false, $with_self = false ) { - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $foid = $this->id; $idCache = array(); @@ -648,7 +649,7 @@ SQL $row = $sql->getRow( $sql ); if ( in_array($row['id'],$idCache)) - Http::serverError('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']); + \Http::serverError('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']); else $idCache[] = $row['id']; @@ -664,7 +665,7 @@ SQL function parentObjectNames( $with_root = false, $with_self = false ) { - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $foid = $this->id; $idCache = array(); @@ -687,7 +688,7 @@ SQL $row = $sql->getRow( $sql ); if ( in_array($row['id'],$idCache)) - Http::serverError('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']); + \Http::serverError('fatal: parent-rekursion in object-id: '.$this->objectid.', double-parent-id: '.$row['id']); else $idCache[] = $row['id']; @@ -888,7 +889,7 @@ SQL // Variablen setzen. $sql->setInt( 'folderid', $this->objectid ); - $language = Session::getProjectLanguage(); + $language = \Session::getProjectLanguage(); $sql->setInt( 'languageid', $language->languageid ); return $sql->getAll( $sql ); diff --git a/model/Group.class.php b/model/Group.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -41,7 +42,7 @@ class Group // Konstruktor - function Group( $groupid='' ) + function __construct( $groupid='' ) { if ( is_numeric($groupid) ) $this->groupid = $groupid; @@ -96,7 +97,7 @@ class Group } else { - throw new ObjectNotFoundException( "Group does not exist: ".$name); + throw new \ObjectNotFoundException( "Group does not exist: ".$name); } } diff --git a/model/Language.class.php b/model/Language.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -36,7 +37,7 @@ class Language // Konstruktor - function Language( $languageid='' ) + function __construct( $languageid='' ) { global $SESS; @@ -78,7 +79,7 @@ class Language $sql->setInt('projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } @@ -104,7 +105,7 @@ SQL $sql->setInt('projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } @@ -115,7 +116,7 @@ SQL // Lesen aus der Datenbank function load() { - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $sql = $db->sql( 'SELECT * FROM {{language}}'. ' WHERE id={languageid}' ); @@ -180,7 +181,7 @@ SQL $isocode = str_replace('_','',$isocode); $this->isocode = $isocode; - $codes = GlobalFunctions::getIsoCodes(); + $codes = \GlobalFunctions::getIsoCodes(); $this->name = $codes[ $isocode ]; } @@ -235,7 +236,7 @@ SQL $sql->setInt('projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } diff --git a/model/Link.class.php b/model/Link.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -34,9 +35,9 @@ class Link extends Object var $isLinkToUrl = false; var $isLinkToObject = false; - function Link( $objectid='' ) + function __construct( $objectid='' ) { - $this->Object( $objectid ); + parent::__construct( $objectid ); $this->isLink = true; $this->isLinkToObject = false; } diff --git a/model/Model.class.php b/model/Model.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -41,7 +42,7 @@ class Model /** * Konstruktor */ - function Model( $modelid='' ) + function __construct( $modelid='' ) { if ( is_numeric($modelid) ) $this->modelid = $modelid; @@ -81,7 +82,7 @@ class Model $sql->setInt('projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } @@ -207,7 +208,7 @@ SQL $sql->setInt('projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt('projectid',$project->projectid); } diff --git a/model/ModelBase.class.php b/model/ModelBase.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; class ModelBase { diff --git a/model/Object.class.php b/model/Object.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -156,7 +157,7 @@ class Object * * @param Integer Objekt-ID (optional) */ - function Object($objectid = '') + function __construct($objectid = '') { global $SESS; @@ -167,15 +168,15 @@ class Object } - $language = Session::getProjectLanguage(); + $language = \Session::getProjectLanguage(); if ( is_object($language) ) $this->languageid = $language->languageid; - $model = Session::getProjectModel(); + $model = \Session::getProjectModel(); if ( is_object($model) ) $this->modelid = $model->modelid; - $project = Session::getProject(); + $project = \Session::getProject(); if ( is_object($project) ) $this->projectid = $project->projectid; } @@ -192,7 +193,7 @@ class Object if ( ! isset($this->projectid) ) { - $project = Session::getProject(); + $project = \Session::getProject(); $projectid = $project->projectid; } else @@ -237,9 +238,9 @@ class Object { if ( is_null($this->aclMask) ) { - $project = Session::getProject(); - $language = Session::getProjectLanguage(); - $user = Session::getUser(); + $project = \Session::getProject(); + $language = \Session::getProjectLanguage(); + $user = \Session::getUser(); if ( $user->isAdmin ) { @@ -499,7 +500,7 @@ SQL $row = $sql->getRow($sql); if (count($row) == 0) - throw new ObjectNotFoundException('object '.$this->objectid.' not found'); + throw new \ObjectNotFoundException('object '.$this->objectid.' not found'); $this->setDatabaseRow( $row ); } @@ -595,7 +596,7 @@ SQL if ( $this->isRoot ) { - $project = Session::getProject(); + $project = \Session::getProject(); $this->name = $project->name; $this->desc = ''; $this->description = ''; @@ -684,7 +685,7 @@ SQL else $sql->setInt ('parentid',$this->parentid ); - $user = Session::getUser(); + $user = \Session::getUser(); $this->lastchangeUser = $user; $this->lastchangeDate = now(); $sql->setInt ('time' ,$this->lastchangeDate ); @@ -719,7 +720,7 @@ SQL ' lastchange_userid = {userid} '. ' WHERE id={objectid}'); - $user = Session::getUser(); + $user = \Session::getUser(); $this->lastchangeUser = $user; $this->lastchangeDate = now(); @@ -866,10 +867,10 @@ SQL $sql->setString('projectid', $this->projectid); $sql->setInt ('orderid' , 99999 ); $sql->setInt ('time' , now() ); - $user = Session::getUser(); + $user = \Session::getUser(); $sql->setInt ('createuserid' , $user->userid ); $sql->setInt ('createtime' , now() ); - $user = Session::getUser(); + $user = \Session::getUser(); $sql->setInt ('userid' , $user->userid ); $sql->setBoolean('is_folder',$this->isFolder); @@ -1124,7 +1125,7 @@ SQL // if ( $conf['cache']['enable_cache'] ) // { - $filename = FileUtils::getTempDir().'/openrat'; + $filename = \FileUtils::getTempDir().'/openrat'; foreach( $attr as $a=>$w ) $filename .= '_'.$a.$w; @@ -1154,7 +1155,7 @@ SQL public function getTempDir() { - FileUtils::getTempDir(); + \FileUtils::getTempDir(); } /** diff --git a/model/ObjectFactory.php b/model/ObjectFactory.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/model/Page.class.php b/model/Page.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -65,9 +66,9 @@ class Page extends Object var $up_path = ''; - function Page( $objectid='' ) + function __construct( $objectid='' ) { - $this->Object( $objectid ); + parent::__construct( $objectid ); $this->isPage = true; } @@ -262,11 +263,11 @@ class Page extends Object switch( $object->getType() ) { case 'file': - $inhalt = Html::url('file','show',$objectid,$param); + $inhalt = \Html::url('file','show',$objectid,$param); break; case 'page': - $inhalt = Html::url('page','show',$objectid,$param); + $inhalt = \Html::url('page','show',$objectid,$param); break; case 'link': @@ -281,11 +282,11 @@ class Page extends Object switch( $linkedObject->getType() ) { case 'file': - $inhalt = Html::url('file','show',$link->linkedObjectId,$param); + $inhalt = \Html::url('file','show',$link->linkedObjectId,$param); break; case 'page': - $inhalt = Html::url('page','show',$link->linkedObjectId,$param); + $inhalt = \Html::url('page','show',$link->linkedObjectId,$param); break; } } @@ -474,7 +475,7 @@ class Page extends Object if ( !isset($replaceElementMap[$oldElementId]) || intval($replaceElementMap[$oldElementId]) < 1 ) { - Logger::debug( 'deleting value of elementid '.$oldElementId ); + \Logger::debug( 'deleting value of elementid '.$oldElementId ); $sql = $db->sql('DELETE FROM {{value}}'. ' WHERE pageid={pageid}'. ' AND elementid={elementid}' ); @@ -487,7 +488,7 @@ class Page extends Object { $newElementId = intval($replaceElementMap[$oldElementId]); - Logger::debug( 'updating elementid '.$oldElementId.' -> '.$newElementId ); + \Logger::debug( 'updating elementid '.$oldElementId.' -> '.$newElementId ); $sql = $db->sql('UPDATE {{value}}'. ' SET elementid ={newelementid}'. ' WHERE pageid ={pageid}'. @@ -692,7 +693,7 @@ class Page extends Object if ( !$locale_ok ) // Hat nicht geklappt. Entweder ist das Mapping falsch oder die locale ist // nicht korrekt installiert. - Logger::warn("Could not set locale '$locale', please check with 'locale -a' if it is installaled correctly"); + \Logger::warn("Could not set locale '$locale', please check with 'locale -a' if it is installaled correctly"); } else { @@ -728,7 +729,7 @@ class Page extends Object $src = str_replace( '{{IFEMPTY:'.$id.':BEGIN}}','',$src ); $src = str_replace( '{{IFEMPTY:'.$id.':END}}' ,'',$src ); - $src = Text::entferneVonBis( $src,'{{IFNOTEMPTY:'.$id.':BEGIN}}','{{IFNOTEMPTY:'.$id.':END}}' ); + $src = \Text::entferneVonBis( $src,'{{IFNOTEMPTY:'.$id.':BEGIN}}','{{IFNOTEMPTY:'.$id.':END}}' ); } else { @@ -736,7 +737,7 @@ class Page extends Object $src = str_replace( '{{IFNOTEMPTY:'.$id.':BEGIN}}','',$src ); $src = str_replace( '{{IFNOTEMPTY:'.$id.':END}}' ,'',$src ); - $src = Text::entferneVonBis( $src,'{{IFEMPTY:'.$id.':BEGIN}}','{{IFEMPTY:'.$id.':END}}' ); + $src = \Text::entferneVonBis( $src,'{{IFEMPTY:'.$id.':BEGIN}}','{{IFEMPTY:'.$id.':END}}' ); } if ( $this->icons ) @@ -788,7 +789,7 @@ class Page extends Object $db = db_connection(); if ( ! is_object($this->publish) ) - $this->publish = new Publish(); + $this->publish = new \Publish(); $this->public = true; diff --git a/model/Project.class.php b/model/Project.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -40,7 +41,7 @@ class Project // Konstruktor - function Project( $projectid='' ) + function __construct( $projectid='' ) { if ( intval($projectid) != 0 ) $this->projectid = $projectid; @@ -188,7 +189,7 @@ class Project $row = $sql->getRow( $sql ); if ( empty($row) ) - throw new ObjectNotFoundException('project '.$this->projectid.' not found'); + throw new \ObjectNotFoundException('project '.$this->projectid.' not found'); $this->name = $row['name' ]; $this->target_dir = $row['target_dir' ]; @@ -257,9 +258,9 @@ SQL $rootFolder->filename = $this->name; $rootFolder->save(); } - catch( Exception $e ) + catch( \Exception $e ) { - Logger::warn('Project '.$this->projectid.' has not a root folder'."\n".$e->getTraceAsString()); + \Logger::warn('Project '.$this->projectid.' has not a root folder'."\n".$e->getTraceAsString()); } } @@ -381,7 +382,7 @@ SQL function getDefaultLanguageId() { - $db = Session::getDatabase(); + $db = \Session::getDatabase(); // ORDER BY deswegen, damit immer mind. eine Sprache // gelesen wird @@ -397,7 +398,7 @@ SQL function getDefaultModelId() { - $db = Session::getDatabase(); + $db = \Session::getDatabase(); // ORDER BY deswegen, damit immer mind. eine Sprache // gelesen wird @@ -451,7 +452,7 @@ SQL { $this->log = array(); - $db = &Session::getDatabase(); + $db = &\Session::getDatabase(); // Ordnerstruktur prüfen. $sql = $db->sql( <<<EOF @@ -495,7 +496,7 @@ EOF if ( count( $idList ) > 1 ) { - Logger::warn('Inconsistence found: Reference circle project<->template<->templatemodel<->projectmodel<->project is not consistent.'); + \Logger::warn('Inconsistence found: Reference circle project<->template<->templatemodel<->projectmodel<->project is not consistent.'); $this->log[] = 'Inconsistence found: Reference circle project<->template<->templatemodel<->projectmodel<->project is not consistent.'; } @@ -529,13 +530,13 @@ EOF */ function copy( $dbid_destination,$name='' ) { - Logger::debug( 'Copying project '.$this->name.' to database '.$dbid_destination ); + \Logger::debug( 'Copying project '.$this->name.' to database '.$dbid_destination ); global $conf; $zeit = date('Y-m-d\TH:i:sO'); $db_src = db_connection(); - $db_dest = new DB( $conf['database'][$dbid_destination] ); + $db_dest = new \DB( $conf['database'][$dbid_destination] ); $db_dest->id = $dbid_destination; $db_dest->start(); @@ -610,7 +611,7 @@ EOF foreach( $ids as $tabelle=>$data ) { - Logger::debug( 'Copying table '.$tabelle.' ...' ); + \Logger::debug( 'Copying table '.$tabelle.' ...' ); $mapping[$tabelle] = array(); $idcolumn = $data['primary_key']; @@ -636,7 +637,7 @@ EOF foreach( $db_src->getCol($sql) as $srcid ) { - Logger::debug('Id '.$srcid.' of table '.$tabelle); + \Logger::debug('Id '.$srcid.' of table '.$tabelle); $mapping[$tabelle][$srcid] = ++$nextid; $sql = $db->sql( 'SELECT * FROM {t_'.$tabelle.'} WHERE id={id}'); @@ -649,7 +650,7 @@ EOF // Fremdschl�sselbeziehungen auf neue IDn korrigieren. foreach( $data['foreign_keys'] as $fkey_column=>$target_tabelle) { - Logger::debug($fkey_column.' '.$target_tabelle.' '.$row[$fkey_column]); + \Logger::debug($fkey_column.' '.$target_tabelle.' '.$row[$fkey_column]); if ( intval($row[$fkey_column]) != 0 ) $row[$fkey_column] = $mapping[$target_tabelle][$row[$fkey_column]]; @@ -716,7 +717,7 @@ EOF } } - Logger::debug( 'Finished copying project' ); + \Logger::debug( 'Finished copying project' ); $db_dest->commit(); } @@ -814,10 +815,10 @@ SQL // Variablen setzen. $sql->setInt( 'projectid', $this->projectid ); - $language = Session::getProjectLanguage(); + $language = \Session::getProjectLanguage(); $sql->setInt( 'languageid', $language->languageid ); - $user = Session::getUser(); + $user = \Session::getUser(); $sql->setInt( 'userid', $user->userid ); return $sql->getAll( $sql ); @@ -894,7 +895,7 @@ SQL // Variablen setzen. $sql->setInt( 'projectid', $this->projectid ); - $language = Session::getProjectLanguage(); + $language = \Session::getProjectLanguage(); $sql->setInt( 'languageid', $language->languageid ); return $sql->getAll( $sql ); diff --git a/model/Template.class.php b/model/Template.class.php @@ -1,4 +1,5 @@ -<?php +<?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -63,10 +64,10 @@ class Template var $src=''; // Konstruktor - function Template( $templateid='' ) + function __construct( $templateid='' ) { - $model = Session::getProjectModel(); - $project = Session::getProject(); + $model = \Session::getProjectModel(); + $project = \Session::getProject(); if ( is_object($model) ) $this->modelid = $model->modelid; @@ -94,7 +95,7 @@ class Template $sql->setInt( 'projectid',$this->projectid ); else { - $project = Session::getProject(); + $project = \Session::getProject(); $sql->setInt( 'projectid',$project->projectid ); } @@ -116,7 +117,7 @@ class Template $row = $sql->getRow( $sql ); if ( empty($row) ) - throw new ObjectNotFoundException("Template not found: ".$this->templateid); + throw new \ObjectNotFoundException("Template not found: ".$this->templateid); $this->name = $row['name' ]; $this->projectid = $row['projectid']; @@ -353,7 +354,7 @@ SQL // Wenn Projektid nicht vorhanden, dann aus Session lesen if ( !isset($this->projectid) || intval($this->projectid) == 0 ) { - $project = Session::getProject(); + $project = \Session::getProject(); $this->projectid = $project->projectid; } diff --git a/model/User.class.php b/model/User.class.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -60,7 +61,7 @@ class User extends ModelBase var $loginModuleName = null; // Konstruktor - function User( $userid='' ) + public function __construct( $userid='' ) { if ( is_numeric($userid) ) $this->userid = $userid; @@ -111,7 +112,7 @@ class User extends ModelBase $this->loadProjects(); $this->loginDate = time(); - Session::setUser( $this ); + \Session::setUser( $this ); $db = db_connection(); @@ -241,7 +242,7 @@ SQL $row = $sql->getRow( $sql ); if ( count($row) == 0 ) - throw new ObjectNotFoundException(); + throw new \ObjectNotFoundException(); // Zusammensetzen des Tokens return sha1( $row['password_hash'].$row['name'].$row['id'].$row['mail'] ); @@ -262,7 +263,7 @@ SQL $row = $sql->getRow( $sql ); if ( count($row) == 0 ) - throw new ObjectNotFoundException(); + throw new \ObjectNotFoundException(); $this->setDatabaseRow( $row ); } @@ -288,7 +289,8 @@ SQL $userId = $sql->getOne( $sql ); // Benutzer �ber Id instanziieren - $neuerUser = new User( $userId ); + $neuerUser = new \cms\model\User( $userId ); + $neuerUser->load(); return $neuerUser; @@ -561,7 +563,7 @@ SQL if ( $always ) { - $algo = Password::bestAlgoAvailable(); + $algo = \Password::bestAlgoAvailable(); $expire = null; } else @@ -578,7 +580,7 @@ SQL $sql->setInt('expires',$expire); $sql->setInt ('algo' ,$algo ); - $sql->setString('password',Password::hash($this->pepperPassword($password),$algo) ); + $sql->setString('password',\Password::hash($this->pepperPassword($password),$algo) ); $sql->setInt ('userid' ,$this->userid ); $sql->query( $sql ); @@ -889,7 +891,7 @@ SQL $row_user = $sql->getRow( $sql ); // Pruefen ob Kennwort mit Datenbank uebereinstimmt. - return Password::check($this->pepperPassword($password),$row_user['password_hash'],$row_user['password_algo']); + return \Password::check($this->pepperPassword($password),$row_user['password_hash'],$row_user['password_algo']); } @@ -1005,7 +1007,7 @@ SQL */ public function renewOTPSecret() { - $secret = Password::randomHexString(64); + $secret = \Password::randomHexString(64); $db = db_connection(); diff --git a/model/Value.class.php b/model/Value.class.php @@ -1,4 +1,13 @@ <?php +namespace cms\model; +use \ObjectNotFoundException; +use \Logger; +use \Text; +use \Html; +use \Http; +use \Transformer; +use \Code; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -129,12 +138,12 @@ class Value /** * Konstruktor */ - function Value() + function __construct() { $this->lastchangeUserId = 0; $this->lastchangeTimeStamp = 0; - $language = Session::getProjectLanguage(); + $language = \Session::getProjectLanguage(); if ( is_object($language) ) $this->languageid = $language->languageid; } @@ -412,7 +421,7 @@ SQL $sql->setBoolean( 'publish' ,$this->publish ); $sql->setInt ( 'lastchange_date' ,now() ); - $user = Session::getUser(); + $user = \Session::getUser(); $sql->setInt ( 'lastchange_userid',$user->userid ); $sql->query( $sql ); @@ -1069,7 +1078,7 @@ SQL // Wenn Inhalt leer, dann versuchen, den Inhalt der Default-Sprache zu laden. if ( $inhalt == '' && $conf['content']['language']['use_default_language'] ) { - $project = Session::getProject(); + $project = \Session::getProject(); $this->languageid = $project->getDefaultLanguageId(); $this->load(); $inhalt = $this->text; @@ -1386,13 +1395,13 @@ SQL break; case 'edit_url': $raw = true; - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $inhalt = Html::url('index','object',$this->page->objectid,array('dbid'=>$db->id)); break; case 'edit_fullurl': $raw = true; $inhalt = Http::getServer(); - $db = Session::getDatabase(); + $db = \Session::getDatabase(); $params = array('dbid' =>$db->id, 'objectid' =>$this->page->objectid, 'modelid' =>$this->page->modelid, diff --git a/model/include.inc.php b/model/include.inc.php @@ -1,4 +1,5 @@ <?php +namespace cms\model; // Diese Objekte stehen zeitweise in der Sitzung, daher muessen dieser immer geparst werden. require_once( OR_OBJECTCLASSES_DIR."ModelBase.class.".PHP_EXT ); diff --git a/util/AdministrationTree.class.php b/util/AdministrationTree.class.php @@ -1,4 +1,9 @@ <?php +use cms\model\User; +use cms\model\Project; +use cms\model\Group; +use cms\model\Folder; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // diff --git a/util/ProjectTree.class.php b/util/ProjectTree.class.php @@ -1,4 +1,13 @@ <?php +use cms\model\Value; +use cms\model\Element; +use cms\model\Template; +use cms\model\Page; +use cms\model\Folder; +use cms\model\Object; +use cms\model\File; +use cms\model\Link; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de //