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 $sSQL = "delete from oxsessions where SessionID = '$sSID'";
00106 oxDb::getDb()->Execute( $sSQL);
00107 }
00108
00109
00110 $blDeleteCache = $this->getConfig()->getConfigParam( 'blClearCacheOnLogout' );
00111 if ( $blDeleteCache ) {
00112 $this->resetContentCache( $blDeleteCache );
00113 }
00114
00115 oxUtils::getInstance()->redirect( 'index.php' );
00116 }
00117
00123 public function exturl()
00124 {
00125 $myOxUtlis = oxUtils::getInstance();
00126 $blLoadDynContents = $this->getConfig()->getConfigParam( 'blLoadDynContents' );
00127 $sAllowedHost = "http://admin.oxid-esales.com";
00128
00129 $sUrl = oxConfig::getParameter( "url");
00130 if ( isset( $sUrl) || $sUrl ) {
00131
00132
00133 if( $blLoadDynContents && strpos($sUrl,$sAllowedHost) === 0 ) {
00134
00135 $sPath = $this->getConfig()->getConfigParam( 'sCompileDir' ) . "/".md5($sUrl).'.html';
00136 $sBase = dirname($sUrl).'/';
00137
00138 if( $myOxUtlis->getRemoteCachePath($sUrl, $sPath) ) {
00139
00140
00141 $sOutput = file_get_contents($sPath);
00142
00143
00144 $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);
00145
00146
00147 $sOutput = preg_replace("/href=\"#\"/i", 'href="javascript::void();"', $sOutput);
00148
00149 die($sOutput);
00150 }
00151
00152 }else{
00153
00154 header('Location: '.$sUrl);
00155 }
00156 }
00157
00158 die;
00159 }
00160
00167 protected function _doStartUpChecks()
00168 {
00169 $aMessage = array();
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 $oSysReq = new oxSysRequirements();
00191
00192
00193 if ( !$oSysReq->getSysReqStatus() ) {
00194 $aMessage['warning'] = oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE');
00195 $aMessage['warning'] .= '<a href="?cl=sysreq" target="basefrm">';
00196 $aMessage['warning'] .= oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE2').'</a>';
00197 }
00198
00199
00200 if ( $sVersionNotice = $this->_checkVersion() ) {
00201 $aMessage['message'] .= $sVersionNotice;
00202 }
00203
00204
00205
00206 if ( file_exists( $this->getConfig()->getConfigParam( 'sShopDir' ) . '/setup/index.php' ) ) {
00207 $aMessage['warning'] .= ( ( !empty($aMessage['warning']) ) ? "<br>" : '' ) . oxLang::getInstance()->translateString('SETUP_DIRNOTDELETED_WARNING');
00208 }
00209
00210 return $aMessage;
00211 }
00212
00218 protected function _checkVersion()
00219 {
00220 $sVersion = 'CE';
00221
00222 $sQuery = 'http://admin.oxid-esales.com/'.$sVersion.'/onlinecheck.php?getlatestversion';
00223 if ( $sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString( $sQuery ) ) {
00224
00225 if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00226 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00227 }
00228 }
00229 }
00230 }