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 $ch = curl_init();
00100 curl_setopt($ch, CURLOPT_POST, 1);
00101 curl_setopt($ch, CURLOPT_POSTFIELDS, $aParams);
00102 curl_setopt($ch, CURLOPT_URL, $sUrl . "/" . $sLang);
00103 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
00104 $sOutput = curl_exec($ch);
00105 curl_close($ch);
00106
00107 $sOutput = strip_tags($sOutput, "<br>, <b>");
00108 $aResult = explode("<br>", $sOutput);
00109 if ( strstr( $aResult[5], "update" ) ) {
00110 $aResult[5] = "<a id='linkToUpdate' href='http://wiki.oxidforge.org/Category:Downloads' target='_blank'>" . $aResult[5] . "</a>";
00111 }
00112 $sOutput = implode("<br>", $aResult);
00113
00114 return $sOutput;
00115 }
00116 }