00001 <?php
00002 class oxSuperCfg
00003 {
00009 protected static $_oConfig = null;
00010
00016 protected static $_oSession = null;
00017
00023 protected static $_oRights = null;
00024
00030 protected static $_oActUser = null;
00031
00037 protected static $_blIsAdmin = null;
00038
00050 public function __call( $sMethod, $aArgs )
00051 {
00052 if ( defined( 'OXID_PHP_UNIT' ) ) {
00053 if ( substr( $sMethod, 0, 4) == "UNIT" ) {
00054 $sMethod = str_replace( "UNIT", "_", $sMethod );
00055 }
00056 if ( method_exists( $this, $sMethod)) {
00057 return call_user_func_array( array( & $this, $sMethod ), $aArgs );
00058 }
00059 }
00060
00061 throw new oxSystemComponentException( "Function '$sMethod' does not exist or is not accessible! (" . get_class($this) . ")".PHP_EOL);
00062 }
00063
00069 public function getConfig()
00070 {
00071 if ( defined( 'OXID_PHP_UNIT' ) ) {
00072 if ( isset( $this->unitCustMOD ) ) {
00073 return $this->unitCustMOD;
00074 }
00075 return oxConfig::getInstance();
00076 }
00077
00078 if ( self::$_oConfig == null ) {
00079 self::$_oConfig = oxConfig::getInstance();
00080 }
00081
00082 return self::$_oConfig;
00083 }
00084
00092 public function setConfig( $oConfig )
00093 {
00094 if ( defined( 'OXID_PHP_UNIT' ) ) {
00095 $this->unitCustMOD = $oConfig;
00096 return;
00097 }
00098
00099 self::$_oConfig = $oConfig;
00100 }
00101
00107 public function getSession()
00108 {
00109 if ( defined( 'OXID_PHP_UNIT' ) ) {
00110 if ( isset( $this->unitCustMOD ) ) {
00111 return $this->unitCustMOD;
00112 }
00113 return oxSession::getInstance();
00114 }
00115
00116 if ( self::$_oSession == null ) {
00117 self::$_oSession = oxSession::getInstance();
00118 }
00119
00120 return self::$_oSession;
00121 }
00122
00130 public function setSession( $oSession )
00131 {
00132 if ( defined( 'OXID_PHP_UNIT' ) ) {
00133 $this->unitCustMOD = $oSession;
00134 return;
00135 }
00136
00137 self::$_oSession = $oSession;
00138 }
00139
00145 public function getUser()
00146 {
00147 if ( defined( 'OXID_PHP_UNIT' ) ) {
00148 if ( isset( $this->unitCustModUser ) ) {
00149 return $this->unitCustModUser;
00150 }
00151 $oUser = oxNew( 'oxuser' );
00152 if ( $oUser->loadActiveUser() ) {
00153 return $oUser;
00154 }
00155 return false;
00156 }
00157
00158 if ( self::$_oActUser == null ) {
00159 $oUser = oxNew( 'oxuser' );
00160 if ( $oUser->loadActiveUser() ) {
00161 self::$_oActUser = $oUser;
00162 }
00163 }
00164
00165 return self::$_oActUser;
00166 }
00167
00175 public function setUser( $oUser )
00176 {
00177 if ( defined( 'OXID_PHP_UNIT' ) ) {
00178 $this->unitCustModUser = $oUser;
00179 return;
00180 }
00181
00182 self::$_oActUser = $oUser;
00183 }
00184
00190 public function isAdmin()
00191 {
00192 if ( self::$_blIsAdmin === null ) {
00193 self::$_blIsAdmin = isAdmin();
00194 }
00195
00196 return self::$_blIsAdmin;
00197 }
00198
00206 public function setAdminMode( $blAdmin )
00207 {
00208 self::$_blIsAdmin = $blAdmin;
00209 }
00210
00211 }