navigation.php

Go to the documentation of this file.
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             // set menu structure
00031             $this->_aViewData["menustructure"] =  $this->getNavigation()->getDomXml()->documentElement->childNodes;
00032 
00033             // version patch strin
00034             $sVersion = str_replace( array("EE.","PE."), "", $this->_sShopVersion);
00035             $this->_aViewData["sVersion"] =  trim($sVersion);
00036 
00037             //checking requirements if this is not nav frame reload
00038             if ( !oxConfig::getParameter( "navReload" ) ) {
00039                 // #661 execute stuff we run each time when we start admin once
00040                 if ('home.tpl' == $sItem) {
00041                     $this->_aViewData['aMessage'] = $this->_doStartUpChecks();
00042                 }
00043             } else {
00044                 //removing reload param to force requirements checking next time
00045                 oxSession::deleteVar( "navReload" );
00046             }
00047 
00048             // favorite navigation
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             // history navigation
00057             $aHistory = explode('|',$myUtilsServer->getOxCookie('oxidadminhistory'));
00058             if(is_array($aHistory) && count($aHistory)) {
00059                 $this->_aViewData["menuhistory"] = $this->getNavigation()->getListNodes($aHistory);
00060             }
00061 
00062             // open history node ?
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             // we only allow to see our shop
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         // dodger - Task #1364 - Logout-Button
00097         // store
00098         $sSID = $mySession->getId();
00099 
00100         // kill session
00101         $mySession->destroy();
00102 
00103         // delete also, this is usually not needed but for security reasons we execute still
00104         if ( $myConfig->getConfigParam( 'blAdodbSessionHandler' ) ) {
00105             $sSQL = "delete from oxsessions where SessionID = '$sSID'";
00106             oxDb::getDb()->Execute( $sSQL);
00107         }
00108 
00109         //reseting content cache if needed
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              // Limit external url's only allowed host
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                     // Get ceontent
00141                     $sOutput = file_get_contents($sPath);
00142 
00143                     // Fix base path
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                     // Fix self url's
00147                     $sOutput = preg_replace("/href=\"#\"/i", 'href="javascript::void();"', $sOutput);
00148 
00149                     die($sOutput);
00150                }
00151 
00152             }else{
00153                 // Caching not allowed, redirecting
00154                 header('Location: '.$sUrl);
00155             }
00156         }
00157 
00158         die;
00159     }
00160 
00167     protected function _doStartUpChecks()
00168     {   // #661
00169         $aMessage = array();
00170 /*
00171             // check if there are any links in oxobject2category which are outdated or old
00172             $sSQL = "select oxobject2category.oxid from oxcategories, oxobject2category left join oxarticles on oxarticles.oxid = oxobject2category.oxobjectid  where oxcategories.oxid = oxobject2category.oxcatnid and oxarticles.oxid is null";
00173             $iCnt = 0;
00174             $sDel = "";
00175             $rs = oxDb::getDb()->Execute( $sSQL);
00176             if ($rs != false && $rs->recordCount() > 0) {
00177                 while (!$rs->EOF) {
00178                     if ( $iCnt)
00179                         $sDel .= ",";
00180                     $sDel .= "'".$rs->fields[0]."'";
00181                     $iCnt++;
00182                     $rs->moveNext();
00183                 }
00184                 // delete it now
00185                 oxDb::getDb()->Execute("delete from oxobject2category where oxid in ($sDel)");
00186                 $aMessage['message'] = "- Deleted $iCnt old/outdated entries in table oxobject2category.<br>";
00187             }
00188 */
00189         // check if system reguirements are ok
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         // version check
00200         if ( $sVersionNotice = $this->_checkVersion() ) {
00201             $aMessage['message'] .= $sVersionNotice;
00202         }
00203 
00204 
00205         // check if setup dir is deleted
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             // current version is older ..
00225             if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00226                 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00227             }
00228         }
00229     }
00230 }

Generated on Tue Aug 4 09:09:57 2009 for OXID eShop CE by  doxygen 1.5.5