Go to the documentation of this file.00001 <?php
00002
00008 class Shop_License extends Shop_Config
00009 {
00014 protected $_sThisTemplate = "shop_license.tpl";
00015
00016
00021 protected $_aVersionCheckLinks = array(
00022 "EE" => "http://admin.oxid-esales.com/EE/onlinecheck.php",
00023 "PE" => "http://admin.oxid-esales.com/PE/onlinecheck.php",
00024 "CE" => "http://admin.oxid-esales.com/CE/onlinecheck.php"
00025 );
00026
00027
00034 public function render()
00035 {
00036 $myConfig = $this->getConfig();
00037 if ($myConfig->isDemoShop()) {
00038 throw oxNew( "oxSystemComponentException", "license" );
00039 }
00040
00041 parent::render();
00042
00043 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00044 if ( $soxId != "-1" && isset( $soxId ) ) {
00045
00046 $oShop = oxNew( "oxshop" );
00047 $oShop->load( $soxId );
00048 $this->_aViewData["edit"] = $oShop;
00049 }
00050
00051 $this->_aViewData["version"] = $myConfig->getVersion();
00052
00053
00054 $this->_aViewData['aCurVersionInfo'] = $this->_fetchCurVersionInfo( $this->_aVersionCheckLinks["CE"] );
00055
00056 if (!$this->_canUpdate()) {
00057 $this->_aViewData['readonly'] = true;
00058 }
00059
00060 return $this->_sThisTemplate;
00061 }
00062
00063
00069 protected function _canUpdate()
00070 {
00071 $myConfig = $this->getConfig();
00072
00073 $blIsMallAdmin = oxSession::getVar( 'malladmin' );
00074 if (!$blIsMallAdmin) {
00075 return false;
00076 }
00077
00078 if ($myConfig->isDemoShop()) {
00079 return false;
00080 }
00081
00082 return true;
00083 }
00084
00092 protected function _fetchCurVersionInfo( $sUrl )
00093 {
00094 $aParams = array("myversion" => $this->getConfig()->getVersion() );
00095 $oLang = oxRegistry::getLang();
00096 $iLang = $oLang->getTplLanguage();
00097 $sLang = $oLang->getLanguageAbbr( $iLang );
00098
00099 $oCurl = oxNew('oxCurl');
00100 $oCurl->setMethod("POST");
00101 $oCurl->setUrl($sUrl . "/" . $sLang);
00102 $oCurl->setParameters($aParams);
00103 $sOutput = $oCurl->execute();
00104
00105 $sOutput = strip_tags($sOutput, "<br>, <b>");
00106 $aResult = explode("<br>", $sOutput);
00107 if ( strstr( $aResult[5], "update" ) ) {
00108 $sUpdateLink = 'http://wiki.oxidforge.org/Category:Downloads';
00109 if ( !OXID_VERSION_PE_CE ) {
00110 $sUpdateLink = oxRegistry::getLang()->translateString( "VERSION_UPDATE_LINK" );
00111 }
00112 $aResult[5] = "<a id='linkToUpdate' href='$sUpdateLink' target='_blank'>" . $aResult[5] . "</a>";
00113 }
00114 $sOutput = implode("<br>", $aResult);
00115
00116 return $sOutput;
00117 }
00118 }