/** * */ function onAction() { global $application; loadCoreFile('licensekey.php'); loadCoreFile('licenseaccount.php'); // sending the registration request $lk = new LicenseKey(); $lac = new LicenseAccountClient(); $response = $lac->requestUpdateLicense(array("LicenseKey" => $lk->getLicenseKey(), "LicenseDomain" => $lk->getLicenseURL(), "LicenseType" => PRODUCT_VERSION_INTERNAL_TYPE)); $result_msg = "UNKNOWN_ERROR"; if ($response['CODE'] == 0 && !empty($response['CERT'])) { loadCoreFile('licensecert.php'); $lc = new LicenseCertificate(); if ($lc->_save_cert_to_file($response['CERT']) === false) { // error saving certificate $result_msg = "CERT_ERROR_CANNOT_SAVE"; } else { if ($lc->certificate_status === CERTIFICATE_OK) { // certificate saved successfully $result_msg = "UPDATE_SUCCESS"; } else { // invalid certificate received $result_msg = "CERT_ERROR_INVALID"; } } } else { if (!empty($response['CODE'])) { // error handling $result_msg = "RESPONSE_" . $response['CODE']; } } //$request = $application->getInstance('Request'); modApiFunc('Session', 'set', 'ResultMessage', $result_msg); $this->redirect(); }
/** * * * @param * @return */ function getLicenseInfo($state) { global $application; loadCoreFile('licensekey.php'); loadCoreFile('licensecert.php'); //loadCoreFile('licenseclient.class.php'); $licenseKeyObj = new LicenseKey(); $licenseKey = $licenseKeyObj->getLicenseKey(); $licenseCertObj = new LicenseCertificate(); $mr =& $application->getInstance('MessageResources'); if ($state !== "LK_NA" || $state !== "APP_REG") { $link = '<a href="license_info.php">License Info</a>'; } else { $link = ""; } $license_info = array("license_key" => $licenseKey, "license_message" => $this->storeStatusMessage($state), "license_message_home" => str_replace('{LIP_LINK}', $link, $mr->getMessage('STORE_STATE_HOME_' . $state)), "license_url" => $licenseCertObj->getLicenseURL(), "current_url" => $licenseKeyObj->getLicenseURL(), "current_version_type" => PRODUCT_VERSION_TYPE, "license_registration_date" => "NA"); return $license_info; /* if ($licenseKey == LICENSE_KEY_UNDEFINED) { return $license_info; } else { $licenseClient = new LicenseClient(); $licenseInfo = $licenseClient->requestCheckLicense($licenseKey, $licenseKeyObj->getLicenseURL()); if($licenseInfo === false) { return null; }; if (is_array($licenseInfo)) { return array( "license_key" => $licenseKey ,"license_status" => ($licenseInfo["LK_STATUS"] == "INVALID"? "0":"1") ,"license_url" => ($licenseInfo["LK_STATUS"] == "INVALID"? "NA":$licenseKeyObj->getLicenseURL()) // ,"current_url" => $licenseKeyObj->getLicenseURL() ,"version_type" => ($licenseInfo["LK_PRODUCT_TYPE"] == "INVALID"? "NA":$licenseInfo["LK_PRODUCT_TYPE"]) ,"current_version_type" => PRODUCT_VERSION_TYPE ,"license_update" => ($licenseInfo["LK_UPDATE_DATE"] == "INVALID"? "NA":$licenseInfo["LK_UPDATE_DATE"]) ,"license_support" => ($licenseInfo["LK_SUPPORT_DATE"] == "INVALID"? "NA":$licenseInfo["LK_SUPPORT_DATE"]) ,"message" => "" ); } else { $license_info["message"] = "LICENSE_WARNING_001"; return $license_info; } }*/ // } }
/** * */ function onAction() { global $application; loadCoreFile('licensekey.php'); $request = $application->getInstance('Request'); $new_key = $request->getValueByKey("NewLicenseKey"); $lk_class = new LicenseKey(); $result = $lk_class->saveLicenseKey($request->getValueByKey("NewLicenseKey")); if ($result === LICENSE_KEY_FILE_OK) { $result_msg = 'MSG_LICENSE_UPDATED'; } else { $result_msg = 'MSG_' . $result; } modApiFunc('Session', 'set', 'ResultMessage', $result_msg); $this->redirect(); }
public function getLicenseKey($key) { if (!$key or $key === '') { return false; } $result = wp_remote_get($this->baseUrl . '?edd_action=check_license&item_name=WP+Pusher&license=' . $key . '&url=' . home_url()); if (is_wp_error($result)) { add_settings_error('invalid-license-server-message', '', 'We couldn\'t check your license. Are you connected to the Internet?'); } $code = wp_remote_retrieve_response_code($result); if ($code !== 200) { return false; } $body = wp_remote_retrieve_body($result); $array = json_decode($body, true); if (!$array) { return false; } if ($array['license'] === 'invalid') { return false; } if ($array['license'] !== 'active') { $key = $this->registerKeyForSite($key); if (!$key) { return false; } } // For backwards compatability: $array['token'] = $key; return LicenseKey::fromEddResponseArray($array); }
public function getLicenseKey($key) { if (!$key or $key === '') { return false; } $result = wp_remote_get($this->baseUrl . 'license-keys/' . $key); if (is_wp_error($result)) { add_settings_error('invalid-license-server-message', '', 'We couldn\'t check your license. Are you connected to the Internet?'); } $code = wp_remote_retrieve_response_code($result); if ($code !== 200) { return false; } $body = wp_remote_retrieve_body($result); $array = json_decode($body, true); if (!$array) { return false; } return LicenseKey::fromShipperResponseArray($array); }
function updateCertificate() { loadCoreFile('licensekey.php'); loadCoreFile('licenseaccount.php'); // sending the registration request $lk = new LicenseKey(); $lac = new LicenseAccountClient(); $response = $lac->requestUpdateLicense(array("LicenseKey" => $lk->getLicenseKey(), "LicenseDomain" => $lk->getLicenseURL(), "LicenseType" => PRODUCT_VERSION_INTERNAL_TYPE)); $result_msg = "UNKNOWN_ERROR"; if ($response['CODE'] == 0 && !empty($response['CERT'])) { loadCoreFile('licensecert.php'); $lc = new LicenseCertificate(); if ($lc->_save_cert_to_file($response['CERT']) === false) { // error saving certificate $result_msg = "CERT_ERROR_CANNOT_SAVE"; } else { if ($lc->certificate_status === CERTIFICATE_OK) { // certificate saved successfully $result_msg = "UPDATE_SUCCESS"; // message should not be shown } else { // invalid certificate received $result_msg = "CERT_ERROR_INVALID"; } } } else { if (!empty($response['CODE'])) { // error handling $result_msg = "RESPONSE_" . $response['CODE']; if ($response['CODE'] == 3) { $result_msg = "U_RESPONSE_3"; } // another message for update is used } } if ($result_msg !== "UPDATE_SUCCESS") { modApiFunc('Session', 'set', 'ResultMessage', $result_msg); } return $result_msg; }
function outputExtDetailList() { global $application; $arrayOfInstallModules = modApiFunc('Modules_Manager', 'getInstalledExtensionModuleInfo'); /** Geting the Licence Key from the file **/ loadCoreFile('licensekey.php'); // loadCoreFile('licensecert.php'); //loadCoreFile('licenseclient.class.php'); $licenseKeyObj = new LicenseKey(); $licenseKey = $licenseKeyObj->getLicenseKey(); /** Request Instance **/ $request = $application->getInstance('Request'); /** Get the reload parameter **/ $reload = $request->getValueByKey('reload'); modApiFunc('Extension_Manager', 'fetchMarketplaceExtData', isset($reload)); # Fetch Extension data from marketplace server. $extensionList = modApiFunc('Extension_Manager', 'getExtensionsList'); $result = ""; $ext_items = ""; $count = 0; foreach ($arrayOfInstallModules as $key => $installModuleInfo) { $moduleInfo = $extensionList[$installModuleInfo['module_name']]; $template_contents = array('Extn_Category' => $moduleInfo['extension_category']); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $moduleError = 0; if ($moduleInfo['extension_desc'] != "") { $ext_explode = explode(".", $moduleInfo['extension_desc']); $ext_name = $ext_explode[0]; } else { $ext_name = $moduleInfo['extension_name']; $moduleInfo['extension_desc'] = "No description available"; } $installedVersion = ''; $activeFlag = $installModuleInfo['module_active']; $installedVersion = $installModuleInfo['module_version']; if (version_compare($moduleInfo['latestcompatibleversion'], $installedVersion, '>')) { $UprChk = "Y"; } else { $UprChk = "N"; } $extn_type = isset($moduleInfo['extension_type']) && !empty($moduleInfo['extension_type']) ? $moduleInfo['extension_type'] : $this->getTypeOfExtension($installModuleInfo['module_name'], $installModuleInfo['module_groups']); /* For extensions present in store - start */ $template_contents = array('Extn_ID' => $moduleInfo['extension_id'], 'Extn_Display_Name' => $installModuleInfo['module_name'], 'Extn_Name' => $installModuleInfo['module_name'], 'Extn_Desc' => $moduleInfo['extension_desc'], 'Extn_Price' => $moduleInfo['extension_price'], 'Extn_Category' => $extn_type, 'Extn_Image' => $moduleInfo['extension_image'], 'Extn_Filename' => $moduleInfo['extension_filename'], 'Extn_AVersion' => $moduleInfo['latestversion'], 'Extn_CVersion' => $moduleInfo['latestcompatibleversion'], 'Extn_type' => $moduleInfo['extension_type'], 'IsExtnInstalled' => $activeFlag, 'Module_UButton' => $UprChk, 'Extn_IVersion' => $installedVersion, 'isActive' => $activeFlag, 'isSettingExist' => modApiFunc('Settings', 'isGroupExist', $moduleInfo['extension_name']), 'Count' => $count++); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); $html .= $this->mTmplFiller->fill("extension_manager/list/", "list_item_manage.tpl.html", array()); } return $html; }
function outputExtDetailList() { global $application; /** Geting the Licence Key from the file **/ loadCoreFile('licensekey.php'); // loadCoreFile('licensecert.php'); //loadCoreFile('licenseclient.class.php'); $licenseKeyObj = new LicenseKey(); $licenseKey = $licenseKeyObj->getLicenseKey(); /** Request Instance **/ $request = $application->getInstance('Request'); /** Get the reload parameter **/ $reload = $request->getValueByKey('reload'); modApiFunc('Extension_Manager', 'fetchMarketplaceExtData', isset($reload)); # Fetch Extension data from marketplace server. $extensionList = modApiFunc('Extension_Manager', 'getExtensionsList'); $result = ""; $ext_items = ""; $count = 0; foreach ($extensionList as $key => $moduleInfo) { $template_contents = array('Extn_Category' => $moduleInfo['extension_category']); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $moduleError = 0; if ($moduleInfo['extension_desc'] != "") { $ext_explode = explode(".", $moduleInfo['extension_desc']); $ext_name = $ext_explode[0]; } else { $ext_name = $moduleInfo['extension_name']; $moduleInfo['extension_desc'] = "No description available"; } $flag = modApiFunc("Extension_Manager", "isExtensionInstalled", $moduleInfo['extension_name']); if ($flag == "Y") { continue; } /* For extensions present in store - start */ $template_contents = array('Extn_ID' => $moduleInfo['extension_id'], 'Extn_Display_Name' => $moduleInfo['display_name'], 'Extn_Name' => $moduleInfo['extension_name'], 'Store_Url' => modApiFunc('Request', 'selfURL'), 'License_Key' => $licenseKey, 'Extn_Desc' => $moduleInfo['extension_desc'], 'Extn_Price' => $moduleInfo['extension_price'], 'Extn_ReadMeLink' => $moduleInfo['extension_detail_link'] . '&licence=' . $licenseKey, 'Extn_Category' => $moduleInfo['extension_category'], 'Extn_Image' => $moduleInfo['extension_image'], 'Extn_Filename' => $moduleInfo['extension_filename'], 'Extn_AVersion' => $moduleInfo['latestversion'], 'Extn_CVersion' => $moduleInfo['latestcompatibleversion'], 'Extn_type' => $moduleInfo['extension_type'], 'IsExtnInstalled' => $flag, 'Module_UButton' => 'N', 'Count' => $count++); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); $html .= $this->mTmplFiller->fill("extension_manager/list/", "list_item.tpl.html", array()); } return $html; }