00001 <?php
00002
00006 class Navigation extends oxAdminView
00007 {
00014 public function render()
00015 {
00016 parent::render();
00017 $myUtilsServer = oxUtilsServer::getInstance();
00018
00019 $sItem = oxConfig::getParameter( "item");
00020 if ( !isset( $sItem) || !$sItem ) {
00021 $sItem = "nav_frame.tpl";
00022
00023 $aFavorites = oxConfig::getParameter( "favorites");
00024 if(is_array($aFavorites)) {
00025 $myUtilsServer->setOxCookie('oxidadminfavorites',implode('|',$aFavorites));
00026 }
00027
00028 } else {
00029
00030
00031 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00032
00033
00034 $sVersion = str_replace( array("EE.","PE."), "", $this->_sShopVersion);
00035 $this->_aViewData["sVersion"] = trim($sVersion);
00036
00037
00038 if ( !oxConfig::getParameter( "navReload" ) ) {
00039
00040 if ('home.tpl' == $sItem) {
00041 $this->_aViewData['aMessage'] = $this->_doStartUpChecks();
00042 }
00043 } else {
00044
00045 oxSession::deleteVar( "navReload" );
00046 }
00047
00048
00049 $aFavorites = explode('|',$myUtilsServer->getOxCookie('oxidadminfavorites'));
00050
00051 if ( is_array ( $aFavorites ) && count( $aFavorites ) ) {
00052 $this->_aViewData["menufavorites"] = $this->getNavigation()->getListNodes($aFavorites);
00053 $this->_aViewData["aFavorites"] = $aFavorites;
00054 }
00055
00056
00057 $aHistory = explode('|',$myUtilsServer->getOxCookie('oxidadminhistory'));
00058 if(is_array($aHistory) && count($aHistory)) {
00059 $this->_aViewData["menuhistory"] = $this->getNavigation()->getListNodes($aHistory);
00060 }
00061
00062
00063 $this->_aViewData["blOpenHistory"] = oxConfig::getParameter( 'openHistory' );
00064 }
00065
00066 $oShoplist = oxNew( 'oxshoplist' );
00067 $oBaseShop = $oShoplist->getBaseObject();
00068
00069 $sWhere = '';
00070 $blisMallAdmin = oxSession::getVar( 'malladmin' );
00071 if ( !$blisMallAdmin) {
00072
00073 $sShopID = oxSession::getVar( "actshop" );
00074 $sWhere = "where oxshops.oxid = '$sShopID'";
00075 }
00076
00077 $oShoplist->selectString( "select ".$oBaseShop->getSelectFields()." from " . $oBaseShop->getViewName() . " $sWhere" );
00078 $this->_aViewData['shoplist'] = $oShoplist;
00079
00080 return $sItem;
00081 }
00082
00088 public function logout()
00089 {
00090 $mySession = $this->getSession();
00091 $myConfig = $this->getConfig();
00092
00093 $oUser = oxNew( "oxuser" );
00094 $oUser->logout();
00095
00096
00097
00098 $sSID = $mySession->getId();
00099
00100
00101 $mySession->destroy();
00102
00103
00104 if ( $myConfig->getConfigParam( 'blAdodbSessionHandler' ) ) {
00105 $oDb = oxDb::getDb();
00106 $sSQL = "delete from oxsessions where SessionID = ".$oDb->quote( $sSID );
00107 $oDb->execute( $sSQL );
00108 }
00109
00110
00111 $blDeleteCache = $this->getConfig()->getConfigParam( 'blClearCacheOnLogout' );
00112 if ( $blDeleteCache ) {
00113 $this->resetContentCache( $blDeleteCache );
00114 }
00115
00116 oxUtils::getInstance()->redirect( 'index.php' );
00117 }
00118
00124 public function exturl()
00125 {
00126 $myOxUtlis = oxUtils::getInstance();
00127 $blLoadDynContents = $this->getConfig()->getConfigParam( 'blLoadDynContents' );
00128 $sAllowedHost = "http://admin.oxid-esales.com";
00129
00130 $sUrl = oxConfig::getParameter( "url");
00131 if ( isset( $sUrl) || $sUrl ) {
00132
00133
00134 if( $blLoadDynContents && strpos($sUrl,$sAllowedHost) === 0 ) {
00135
00136 $sPath = $this->getConfig()->getConfigParam( 'sCompileDir' ) . "/".md5($sUrl).'.html';
00137 $sBase = dirname($sUrl).'/';
00138
00139 if( $myOxUtlis->getRemoteCachePath($sUrl, $sPath) ) {
00140
00141
00142 $sOutput = file_get_contents($sPath);
00143
00144
00145 $sOutput = preg_replace("/<\/head>/i", "<base href=\"{$sBase}\"></head>\n <!-- OXID eShop {$sEdition}, Version {$sVersion}, Shopping Cart System (c) OXID eSales AG 2003 - {$sCurYear} - http://www.oxid-esales.com -->", $sOutput);
00146
00147
00148 $sOutput = preg_replace("/href=\"#\"/i", 'href="javascript::void();"', $sOutput);
00149
00150 die($sOutput);
00151 }
00152
00153 }else{
00154
00155 header('Location: '.$sUrl);
00156 }
00157 }
00158
00159 die;
00160 }
00161
00168 protected function _doStartUpChecks()
00169 {
00170 $aMessage = array();
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 $oSysReq = new oxSysRequirements();
00192
00193
00194 if ( !$oSysReq->getSysReqStatus() ) {
00195 $aMessage['warning'] = oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE');
00196 $aMessage['warning'] .= '<a href="?cl=sysreq" target="basefrm">';
00197 $aMessage['warning'] .= oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE2').'</a>';
00198 }
00199
00200
00201 if ( $this->getConfig()->getConfigParam( 'blCheckForUpdates' ) ) {
00202 if ( $sVersionNotice = $this->_checkVersion() ) {
00203 $aMessage['message'] .= $sVersionNotice;
00204 }
00205 }
00206
00207
00208
00209 if ( file_exists( $this->getConfig()->getConfigParam( 'sShopDir' ) . '/setup/index.php' ) ) {
00210 $aMessage['warning'] .= ( ( !empty($aMessage['warning']) ) ? "<br>" : '' ) . oxLang::getInstance()->translateString('SETUP_DIRNOTDELETED_WARNING');
00211 }
00212
00213
00214 $sConfPath = $this->getConfig()->getConfigParam( 'sShopDir' )."/config.inc.php";
00215 $sPerms = substr( decoct( fileperms($sConfPath) ), 2 );
00216 if ( $sPerms > 644 ) {
00217 $aMessage['warning'] .= ( ( !empty($aMessage['warning']) ) ? "<br>" : '' ) . oxLang::getInstance()->translateString('SETUP_CONFIGPERMISSIONS_WARNING');
00218 }
00219
00220 return $aMessage;
00221 }
00222
00228 protected function _checkVersion()
00229 {
00230 $sVersion = 'CE';
00231
00232 $sQuery = 'http://admin.oxid-esales.com/'.$sVersion.'/onlinecheck.php?getlatestversion';
00233 if ( $sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString( $sQuery ) ) {
00234
00235 if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00236 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00237 }
00238 }
00239 }
00240 }