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             // set menu structure
00030             $this->_aViewData["menustructure"] =  $this->getNavigation()->getDomXml()->documentElement->childNodes;
00031 
00032             // version patch strin
00033             $sVersion = str_replace( array("EE.","PE."), "", $this->_sShopVersion);
00034             $this->_aViewData["sVersion"] =  trim($sVersion);
00035 
00036             // #661 execute stuff we run each time when we start admin once
00037             $this->_aViewData['aMessage'] = $this->_doStartUpChecks();
00038 
00039             // favorite navigation
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             // history navigation
00048             $aHistory = explode('|',$myUtilsServer->getOxCookie('oxidadminhistory'));
00049             if(is_array($aHistory) && count($aHistory)) {
00050                 $this->_aViewData["menuhistory"] = $this->getNavigation()->getListNodes($aHistory);
00051             }
00052 
00053             // open history node ?
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             // we only allow to see our shop
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         // dodger - Task #1364 - Logout-Button
00088         // store
00089         $sSID = $mySession->getId();
00090 
00091         // kill session
00092         $mySession->destroy();
00093 
00094         // delete also, this is usually not needed but for security reasons we execute still
00095         if ( $myConfig->getConfigParam( 'blAdodbSessionHandler' ) ) {
00096             $sSQL = "delete from oxsessions where SessionID = '$sSID'";
00097             oxDb::getDb()->Execute( $sSQL);
00098         }
00099 
00100         //reseting content cache if needed
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              // Limit external url's only allowed host
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                     // Get ceontent
00132                     $sOutput = file_get_contents($sPath);
00133 
00134                     // Fix base path
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                     // Fix self url's
00138                     $sOutput = preg_replace("/href=\"#\"/i", 'href="javascript::void();"', $sOutput);
00139 
00140                     die($sOutput);
00141                }
00142 
00143             }else{
00144                 // Caching not allowed, redirecting
00145                 header('Location: '.$sUrl);
00146             }
00147         }
00148 
00149         die;
00150     }
00151 
00158     protected function _doStartUpChecks()
00159     {   // #661
00160         $aMessage = array();
00161 /*
00162             // check if there are any links in oxobject2category which are outdated or old
00163             $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";
00164             $iCnt = 0;
00165             $sDel = "";
00166             $rs = oxDb::getDb()->Execute( $sSQL);
00167             if ($rs != false && $rs->recordCount() > 0) {
00168                 while (!$rs->EOF) {
00169                     if ( $iCnt)
00170                         $sDel .= ",";
00171                     $sDel .= "'".$rs->fields[0]."'";
00172                     $iCnt++;
00173                     $rs->moveNext();
00174                 }
00175                 // delete it now
00176                 oxDb::getDb()->Execute("delete from oxobject2category where oxid in ($sDel)");
00177                 $aMessage['message'] = "- Deleted $iCnt old/outdated entries in table oxobject2category.<br>";
00178             }
00179 */
00180         // check if system reguirements are ok
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         // version check
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             // current version is older ..
00208             if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00209                 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00210             }
00211         }
00212     }
00213 }

Generated on Wed May 13 13:25:50 2009 for OXID eShop CE by  doxygen 1.5.5