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 return oxUser::getActiveUser();
00152 }
00153
00154 if ( self::$_oActUser == null ) {
00155 self::$_oActUser = oxUser::getActiveUser();
00156 }
00157
00158 return self::$_oActUser;
00159 }
00160
00168 public function setUser( $oUser )
00169 {
00170 if ( defined( 'OXID_PHP_UNIT' ) ) {
00171 $this->unitCustModUser = $oUser;
00172 return;
00173 }
00174
00175 self::$_oActUser = $oUser;
00176 }
00177
00183 public function isAdmin()
00184 {
00185 if ( self::$_blIsAdmin === null ) {
00186 self::$_blIsAdmin = isAdmin();
00187 }
00188
00189 return self::$_blIsAdmin;
00190 }
00191
00199 public function setAdminMode( $blAdmin )
00200 {
00201 self::$_blIsAdmin = $blAdmin;
00202 }
00203
00204 }