کد:
<?php // License Key Validation by IceTheme.
// The php code below is encoded. It absolutely dont affect any part of the template that you may need to change or edit
// The code below contains only the php code for the License Key that you may need to enter on the template paramters.
// Please contact us if you have any questions
// http://www.icetheme.com/About/Contact.html
// No direct access.
defined('_JEXEC') or die;
$SECURITY_CODE = "icetheme";
define("DEBUG_MODE", false);
define("SERVER_URL", "http://www.icetheme.com/index.php" );
if(DEBUG_MODE){
define("NUM_DAYS", 0);
}
else{
define("NUM_DAYS", 1);
}
class iceHelper{
var $host = null;
var $ip_address = null;
var $template_id = "";
var $check_url = SERVER_URL;
var $post_vars = "option=com_license&view=licenses&task=check&l=";
var $method = "POST";
var $_status = null;
var $_temp_params = null;
function __construct($template_id = ""){
$this->host = $_SERVER['SERVER_NAME'];
$this->ip_address = gethostbyname($_SERVER['SERVER_NAME']);
if(empty($this->ip_address)){
$this->ip_address = $_SERVER["REMOTE_ADDR"];
}
$this->template_id = $template_id;
}
public function setTemp($template_id = ""){
$this->template_id = $template_id;
}
function checkLocalhost(){
$white_list = array("localhost", "127.0.0.1");
if( in_array( $this->host, $white_list) || in_array($this->ip_address, $white_list) ){
return true;
}
return false;
}
/**
* make request service
*
* @param string $url
* @return void.
*/
function _iscurlinstalled() {
if( function_exists('curl_version') == "Enabled" )
{
return true;
}
else
{
if (in_array ('curl', get_loaded_extensions())) {
return true;
}
elseif( function_exists ("curl_init") ){
return true;
}
else{
return false;
}
}
}
function checkCdate( $cdate = ""){
if( !empty($cdate)){
$now = time();
$range =round( ($now - $cdate)/ CHECK_DAY);
if($range <= NUM_DAYS ){
return true;
}
}
return false;
}
function checkLicense( $license ="" ){
}
function renderTemplate( &$params = array() ){
$this->_temp_params = $params;
$license = $params->get("license","123456");
$cdate = $params->get("cdate","");
if( !DEBUG_MODE ){
if($this->checkLocalhost()){
return true;
}
if($this->checkCdate( $cdate )){
return true;
}
}
if(!empty($license)){
$current_time = time();
$params->set("cdate", $current_time);
$db = &JFactory::getDBO();
$params_json = (string) $params;
$query = "UPDATE #__template_styles SET params='".$params_json."' WHERE template='".$this->template_id."'";
$db->setQuery($query);
$db->query();
return true;
}else{
echo "
";
echo "
";
echo JText::_("Invalid License Key!");
echo "
";
echo JText::_("We are sorry but your license key is invalid or it may be unpublished.");
echo "
";
echo JText::_("You can get the license key from IceTheme.com - ");
echo "Get the License Key!";
echo "
";
echo JText::_("Please contact us if your issue persist - ");
echo "Contact IceTheme";
echo "
";
exit();
}
}
}
?>