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 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00031
00032
00033 $sVersion = str_replace( array("EE.","PE."), "", $this->_sShopVersion);
00034 $this->_aViewData["sVersion"] = trim($sVersion);
00035
00036
00037 $this->_aViewData['aMessage'] = $this->_doStartUpChecks();
00038
00039
00040 $aFavorites = explode('|',$myUtilsServer->getOxCookie('oxidadminfavorites'));
00041
00042 if(is_array($aFavorites) && count($aFavorites)) {
00043 $this->_aViewData["menufavorites"] = $this->getNavigation()->getListNodes($aFavorites);
00044 $this->_aViewData["aFavorites"] = $aFavorites;
00045 }
00046
00047
00048 $aHistory = explode('|',$myUtilsServer->getOxCookie('oxidadminhistory'));
00049 if(is_array($aHistory) && count($aHistory)) {
00050 $this->_aViewData["menuhistory"] = $this->getNavigation()->getListNodes($aHistory);
00051 }
00052
00053
00054 $this->_aViewData["blOpenHistory"] = oxConfig::getParameter( 'openHistory' );
00055 }
00056
00057 $oShoplist = oxNew( 'oxshoplist' );
00058 $oBaseShop = $oShoplist->getBaseObject();
00059
00060 $sWhere = '';
00061 $blisMallAdmin = oxSession::getVar( 'malladmin' );
00062 if ( !$blisMallAdmin) {
00063
00064 $sShopID = oxSession::getVar( "actshop" );
00065 $sWhere = "where oxshops.oxid = '$sShopID'";
00066 }
00067
00068 $oShoplist->selectString( "select ".$oBaseShop->getSelectFields()." from " . $oBaseShop->getViewName() . " $sWhere" );
00069 $this->_aViewData['shoplist'] = $oShoplist;
00070
00071 return $sItem;
00072 }
00073
00079 public function logout()
00080 {
00081 $mySession = $this->getSession();
00082 $myConfig = $this->getConfig();
00083
00084 $oUser = oxNew( "oxuser" );
00085 $oUser->logout();
00086
00087
00088
00089 $sSID = $mySession->getId();
00090
00091
00092 $mySession->destroy();
00093
00094
00095 if ( $myConfig->getConfigParam( 'blAdodbSessionHandler' ) ) {
00096 $sSQL = "delete from oxsessions where SessionID = '$sSID'";
00097 oxDb::getDb()->Execute( $sSQL);
00098 }
00099
00100
00101 $blDeleteCache = $this->getConfig()->getConfigParam( 'blClearCacheOnLogout' );
00102 if ( $blDeleteCache ) {
00103 $this->resetContentCache( $blDeleteCache );
00104 }
00105
00106 oxUtils::getInstance()->redirect( 'index.php' );
00107 }
00108
00114 public function exturl()
00115 {
00116 $myOxUtlis = oxUtils::getInstance();
00117 $blLoadDynContents = $this->getConfig()->getConfigParam( 'blLoadDynContents' );
00118 $sAllowedHost = "http://admin.oxid-esales.com";
00119
00120 $sUrl = oxConfig::getParameter( "url");
00121 if ( isset( $sUrl) || $sUrl ) {
00122
00123
00124 if( $blLoadDynContents && strpos($sUrl,$sAllowedHost) === 0 ) {
00125
00126 $sPath = $this->getConfig()->getConfigParam( 'sCompileDir' ) . "/".md5($sUrl).'.html';
00127 $sBase = dirname($sUrl).'/';
00128
00129 if( $myOxUtlis->getRemoteCachePath($sUrl, $sPath) ) {
00130
00131
00132 $sOutput = file_get_contents($sPath);
00133
00134
00135 $sOutput = preg_replace("/<\/head>/i", "<base href=\"{$sBase}\"></head>\n <!-- OXID eShop {$sEdition}, Version {$sVersion}, Shopsystem (c) OXID eSales AG 2003 - {$sCurYear} - http://www.oxid-esales.com -->", $sOutput);
00136
00137
00138 $sOutput = preg_replace("/href=\"#\"/i", 'href="javascript::void();"', $sOutput);
00139
00140 die($sOutput);
00141 }
00142
00143 }else{
00144
00145 header('Location: '.$sUrl);
00146 }
00147 }
00148
00149 die;
00150 }
00151
00158 protected function _doStartUpChecks()
00159 {
00160 $aMessage = array();
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 $oSysReq = new oxSysRequirements();
00182 if ( !$oSysReq->getSysReqStatus() ) {
00183 $aMessage['warning'] = oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE');
00184 $aMessage['warning'] .= '<a href="?cl=sysreq" target="basefrm">';
00185 $aMessage['warning'] .= oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE2').'</a>';
00186 }
00187
00188
00189 if ( $sVersionNotice = $this->_checkVersion() ) {
00190 $aMessage['message'] .= $sVersionNotice;
00191 }
00192
00193 return $aMessage;
00194 }
00195
00201 protected function _checkVersion()
00202 {
00203 $sVersion = 'CE';
00204
00205 $sQuery = 'http://admin.oxid-esales.com/'.$sVersion.'/onlinecheck.php?getlatestversion';
00206 if ( $sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString( $sQuery ) ) {
00207
00208 if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00209 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00210 }
00211 }
00212 }
00213 }