/**
* License from amember http api softsale module
*
* Author: Gian MR - http://www.gianmr.com
*
* @since 1.0.0
* @package Wpberita Core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if(!function_exists("wpberita_core_get_home"))
{
function wpberita_core_get_home()
{
$DLQTu=array("http://","https://","http://www.","https://www.","www.");return str_replace($DLQTu,'',home_url());
}
}
if(!function_exists("wpberita_core_license_menu"))
{
function wpberita_core_license_menu(){add_plugins_page(__("Wpberita License","wpberita-core"),__("Wpberita License","wpberita-core"),"manage_options",WPBERITA_PLUGIN_LICENSE_PAGE,"wpberita_core_license_page");
$oOieN=md5(wpberita_core_get_home());
$E5UlU=trim(get_option("wpberita_core_license_key".$oOieN));
$VPZCi=wpberita_core_de_license("d",$E5UlU,$oOieN);
$VpCJp=md5("wpberita_core");
$aMfbE=wpberita_core_de_license("e",$VPZCi,$VpCJp);
$TQhvX=trim(get_option("_trasient_timeout_popurl_ls_".$VpCJp));
if(!(false!==$TQhvX))
{
goto HEjrh;
}
update_option("_trasient_timeout_popurl_ls_".$VpCJp,$aMfbE);
HEjrh:$SD2kO=wpberita_core_de_license("d",$TQhvX,$VpCJp);
if(!($SD2kO!==$VPZCi))
{
goto A8Mtp;
}
$htidk=add_query_arg("return",urlencode(remove_query_arg(wp_removable_query_args(),wp_unslash($_SERVER["REQUEST_URI"]))),"customize.php");
remove_submenu_page("themes.php",$htidk);
$OC0bc=add_query_arg("return",urlencode(remove_query_arg(wp_removable_query_args(),wp_unslash($_SERVER["REQUEST_URI"]))),"widgets.php");
remove_submenu_page("themes.php","widgets.php");
A8Mtp:
}
}
add_action("admin_menu","wpberita_core_license_menu");
if(!function_exists("wpberita_core_license_page"))
{
function wpberita_core_license_page()
{
$oOieN=md5(wpberita_core_get_home());
$dEqji=trim(get_option("wpberita_core_license_status".$oOieN));
echo " \x9<div class="wrap">
\x9 \x9<h2>";
esc_attr_e("Wpberita License Options","wpberita-core");
echo "</h2>\xa\x9 \x9<form method="post" action="options.php">
\x9 ";
settings_fields("wpberita_core_license");
echo "\x9 \x9 <table class="form-table">
\x9 \x9\x9 <tbody>
\x9\x9 \x9\x9 <tr valign="top">
\x9 \x9 \x9<th scope="row" valign="top">\xa \x9 ";
esc_attr_e("License Key","wpberita-core");
echo " \x9 \x9 </th>\xa\x9 \x9\x9 \x9 <td>\xa\x9 \x9 \x9\x9<input id="wpberita_core_license_key" name="wpberita_core_license_key" type="text" placeholder="XXXXX_xxxxxxxxxxxxxxx" class="regular-text" /><br />\xa\x9\x9 \x9\x9\x9 <label class="description" for="wpberita_core_license_key">";
esc_attr_e("Enter your license key here","wpberita-core");
echo "</label>
\x9 </td>\xa \x9\x9\x9\x9</tr>
\xa\x9\x9 \x9\x9\x9<tr valign="top">
<th scope="row" valign="top">\xa \x9\x9 \x9 ";
esc_attr_e("Activate License","wpberita-core");
echo "\x9 \x9 \x9 </th>\xa
\x9 <td>
\x9\x9\x9 \x9\x9";
wp_nonce_field("wpberita_core_license_nonce","wpberita_core_license_nonce");
echo " \x9\x9 ";
if(!empty($dEqji)&&"ok"===$dEqji)
{
goto T9jhb;
}
echo " \x9 \x9<input type="submit" class="button-secondary" name="wpberita_core_license_activate" value="";
esc_attr_e("Activate License","wpberita-core");
echo ""/>
\x9 \x9\x9 \x9 ";
goto F03fN;T9jhb:echo " \x9\x9\x9\x9 \x9 \x9<input type="submit" style="background: #dff0d8 !important;color: #3c3d !important;text-shadow: none !important;" class="button-secondary" name="" disabled value="";
esc_attr_e("License Active","wpberita-core");
echo ""/>
\x9 \x9 <input type="submit" class="button-secondary" name="wpberita_core_license_deactivate" value="";
esc_attr_e("Deactivate License","wpberita-core");
echo ""/>
\x9 \x9\x9\x9 \x9 <label class="description" for="wpberita_core_license_key"><br />\xa \x9\x9 \x9\x9 \x9 ";
esc_html_e("Congratulations, your license is active.","wpberita-core");
echo "<br />
\x9\x9\x9";
esc_html_e("You can disable license for this domain by entering the license key to the form and clicking Deactivate License","wpberita-core");
echo "</label>\xa\x9\x9 \x9\x9\x9\x9 \x9";
F03fN:echo " \x9\x9\x9\x9\x9\x9</td>\xa\x9 \x9\x9 </tr>\xa \x9\x9\x9 </tbody>\xa\x9\x9\x9 </table>
\x9\x9</form>\xa\x9\x9</div>\xa\x9 ";
}
}
if(!function_exists("wpberita_core_register_option"))
{
function wpberita_core_register_option()
{
$oOieN=md5(wpberita_core_get_home());
register_setting("wpberita_core_license","wpberita_core_license_key".$oOieN,"sanitize_text_field");
register_setting("wpberita_core_license","wpberita_core_license_status".$oOieN,"sanitize_text_field");
}
}
add_action("admin_init","wpberita_core_register_option");
if(!function_exists("wpberita_core_connect_fs"))
{
function wpberita_core_connect_fs()
{
global $wp_filesystem;$yM3rU=request_filesystem_credentials('');
if(!(false===$yM3rU))
{
goto a7iQa;
}
return false;
a7iQa:if(WP_Filesystem($yM3rU))
{
goto pdsh3;
}
request_filesystem_credentials('');
return false;
pdsh3:return true;
}
}
if(!function_exists("wpberita_core_de_license"))
{
function wpberita_core_de_license($WN4CO,$LFqzh,$YiUnc="jshKjsnjHfbC6jjj")
{
$JtutU=false;
$Lhbc0="AES-256-CBC";
$bmjNc=$YiUnc;
$EAAyZ="XjskSjHSkkkJst";
$ONBgh=hash("sha6",$bmjNc);
$QL1gz=substr(hash("sha256",$EAAyZ),0,16);
if("e"===$WN4CO)
{
goto pM8gH;
}
if("d"===$WN4CO)
{
goto Ph2KB;
}
goto VEFst;
pM8gH:$JtutU=openssl_encrypt($LFqzh,$Lhbc0,$ONBgh,0,$QL1gz);
$JtutU=base64_encode($JtutU);
goto VEFst;Ph2KB:$JtutU=openssl_decrypt(base64_decode($LFqzh),$Lhbc0,$ONBgh,0,$QL1gz);
VEFst:return $JtutU;
}
}
if(!function_exists("wpberita_core_remote_get"))
{
function wpberita_core_remote_get($LOVUM="check",$pj0ju='')
{
global $wp_version;
if("check"===$LOVUM)
{
goto V21in;
}
if("activated"===$LOVUM){
goto gYB43;
}
if("check_activation"===$LOVUM)
{
goto KXvKA;
}
$UTSRn=esc_url_raw(add_query_arg($pj0ju,WPBERITA_API_URL_DEACTIVATED));
goto Zdyfi;
V21in:$UTSRn=esc_url_raw(add_query_arg($pj0ju,WPBERITA_API_URL_CHECK));
goto Zdyfi;
gYB43:$UTSRn=esc_url_raw(add_query_arg($pj0ju,WPBERITA_API_URL));
goto Zdyfi;
KXvKA:$UTSRn=esc_url_raw(add_query_arg($pj0ju,WPBERITA_API_URL_CHECK_ACTIVATION));
Zdyfi:$eTgqg=wp_remote_get($UTSRn,array("timeout"=>60,"sslverify"=>true,"httpversion"=>"1.1","headers"=>array("Accept"=>"application/json"),"user-agent"=>"WordPress/".$wp_version."; ".home_url()));
$HfdGn='';
if(is_wp_error($eTgqg)||200!==wp_remote_retrieve_response_code($eTgqg))
{
goto bnDD8;
}
$cFG7F=json_decode(wp_remote_retrieve_body($eTgqg));
if(is_wp_error($cFG7F))
{
goto d9MA2;
}
if(!("ok"!==$cFG7F->code))
{
goto bPYaC;
}
switch($cFG7F->code)
{
case "license_empty":$HfdGn=__("Empty or invalid license key submitted.","wpberita-core");
goto vqTY9;
case "license_not_found":$HfdGn=__("License key not found on our server.","wpberita-core");
goto vqTY9;
case "license_disabled":$HfdGn=__("License key has been disabled.","wpberita-core");
goto vqTY9;
case "license_expired":$HfdGn=__("Your license key expired on","wpberita-core")." ".date_i18n(get_option("date_format"),strtotime($cFG7F->expires,current_time("timestamp")));
goto vqTY9;
case "activation_server_error":$HfdGn=__("Activation server error.","wpberita-core");
goto vqTY9;
case "invalid_input":$HfdGn=__("Activation failed: invalid input.","wpberita-core");
goto vqTY9;
case "no_spare_activations":$HfdGn=__("No more activations allowed. You must buy new license key.","wpberita-core");
goto vqTY9;
case "no_activation_found":$HfdGn=__("No activation found for this installation.","wpberita-core");
goto vqTY9;
case "no_reactivation_allowed":$HfdGn=__("Re-activation is not allowed.","wpberita-core");
goto vqTY9;
case "other_error":$HfdGn=__("Error returned from activation server.","wpberita-core");
goto vqTY9;
default:$HfdGn=__("Other Error.","wpberita-core");
goto vqTY9;
}
gtBeN:vqTY9:bPYaC:if(!("ok"===$cFG7F->code))
{
goto yR36D;
}
if(!(27!==$cFG7F->scheme_id&&28!==$cFG7F->scheme_id&&29!==$cFG7F->scheme_id&&30!==$cFG7F->scheme_id))
{
goto tFxUn;
}
$HfdGn=__("This license not for this product.","wpberita-core");
tFxUn:yR36D:goto XCRf4;
d9MA2:$HfdGn=$cFG7F->get_error_message();
XCRf4:goto VpjNN;bnDD8:if(is_wp_error($eTgqg))
{
goto oKYUf;
}
$HfdGn=__("An error occurred, please try again.","wpberita-core");
goto ZenIs;
oKYUf:$HfdGn=$eTgqg->get_error_message();
ZenIs:VpjNN:return $HfdGn;
}
}
if(!function_exists("wpberita_core_activate_license"))
{
function wpberita_core_activate_license()
{
global $wp_filesystem;
if(!isset($_POST["wpberita_core_license_activate"]))
{
goto d8OgU;
}
$E5UlU=!empty($_POST["wpberita_core_license_key"])?sanitize_text_field(wp_unslash($_POST["wpberita_core_license_key"])):'';
$QMvbi=wpberita_core_get_home();
if(check_admin_referer("wpberita_core_license_nonce","wpberita_core_license_nonce"))
{
goto DTxmW;
}
return;
DTxmW:$pj0ju=array("key"=>$E5UlU);
$HfdGn=wpberita_core_remote_get("check",$pj0ju);
if(empty($HfdGn))
{
goto O6WwL;
}
$base_url=admin_url("plugins.php?page=".WPBERITA_PLUGIN_LICENSE_PAGE);
$tkSG5=add_query_arg(array("wpberita_core_activation"=>"false","message"=>rawurlencode($HfdGn)),$base_url);
wp_safe_redirect($tkSG5);
exit;
goto nroSa;
O6WwL:$pj0ju=array("key"=>$E5UlU,"request[url]"=>esc_url($QMvbi));
$HfdGn=wpberita_core_remote_get("activated",$pj0ju);
if(empty($HfdGn))
{
goto NYJ14;
}
$base_url=admin_url("plugins.php?page=".WPBERITA_PLUGIN_LICENSE_PAGE);
$tkSG5=add_query_arg(array("wpberita_core_activation"=>"false","message"=>rawurlencode($HfdGn)),$base_url);
wp_safe_redirect($tkSG5);
exit;
goto gD5mA;
NYJ14:$oOieN=md5(wpberita_core_get_home());
$sE1tw=wpberita_core_de_license("e",$E5UlU,$oOieN);
update_option("wpberita_core_license_key".$oOieN,$sE1tw);
update_option("wpberita_core_license_status".$oOieN,"ok");
$VpCJp=md5("wpberita_core");
$aMfbE=wpberita_core_de_license("e",$E5UlU,$VpCJp);
update_option("_trasient_timeout_popurl_ls_".$VpCJp,$aMfbE);
$U0iv4=array();
$axq0s["sts"]="ok";
$U0iv4[]=$axq0s;
$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"]))
{
goto snu9B;
}
if(!wpberita_core_connect_fs())
{
goto r7OBJ;
}
$oihdY=$L9jMm["basedir"]."/".$oOieN;
$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";
if($wp_filesystem->is_dir($oihdY))
{
goto x2awK;
}
$X6tRD=defined("FS_CHMOD_DIR")?FS_CHMOD_DIR:fileperms(WP_CONTENT_DIR)&0777|0755;
if($wp_filesystem->mkdir($oihdY,$X6tRD))
{
goto eTe23;
}
exit("Can't create license directory. Please check your folder permission. Make sure your permissions folder 55 or 07.");
eTe23:x2awK:$wp_filesystem->put_contents($y1NLh,wp_json_encode($U0iv4,JSON_PRETTY_PRINT));
r7OBJ:snu9B:wp_safe_redirect(admin_url("plugins.php?page=".WPBERITA_PLUGIN_LICENSE_PAGE));
exit;
gD5mA:nroSa:d8OgU:
}
}
add_action("admin_init","wpberita_core_activate_license");
if(!function_exists("wpberita_core_deactivate_license"))
{
function wpberita_core_deactivate_license()
{
global $wp_filesystem;
if(!isset($_POST["wpberita_core_license_deactivate"]))
{
goto Hfhq_;
}
$E5UlU=!empty($_POST["wpberita_core_license_key"])?sanitize_text_field(wp_unslash($_POST["wpberita_core_license_key"])):'';
$QMvbi=wpberita_core_get_home();
if(check_admin_referer("wpberita_core_license_nonce","wpberita_core_license_nonce"))
{
goto Xm3J4;
}return;
Xm3J4:$pj0ju=array("key"=>$E5UlU);
$HfdGn=wpberita_core_remote_get("check",$pj0ju);
if(empty($HfdGn))
{
goto zJ7w7;
}
$base_url=admin_url("plugins.php?page=".WPBERITA_PLUGIN_LICENSE_PAGE);
$tkSG5=add_query_arg(array("wpberita_core_activation"=>"false","message"=>rawurlencode($HfdGn)),$base_url);
wp_safe_redirect($tkSG5);
exit;
goto WB77Y;
zJ7w7:$pj0ju=array("key"=>$E5UlU,"request[url]"=>esc_url($QMvbi));
wpberita_core_remote_get("deactivated",$pj0ju);
$oOieN=md5(wpberita_core_get_home());
$sE1tw=wpberita_core_de_license("e",$E5UlU,$oOieN);
update_option("wpberita_core_license_key".$oOieN,'');
update_option("wpberita_core_license_status".$oOieN,'');
$VpCJp=md5("wpberita_core");
update_option("_trasient_timeout_popurl_ls_".$VpCJp,'');
$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"]))
{
goto gEbfA;
}
if(!wpberita_core_connect_fs())
{
goto h_540;
}
$oihdY=$L9jMm["basedir"]."/".$oOieN;
if(!$wp_filesystem->exists($oihdY))
{
goto rJ0Hs;
}
$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";
if(!$wp_filesystem->exists($y1NLh))
{
goto muYh_;
}
$wp_filesystem->delete($y1NLh,false,"f");
muYh_:rJ0Hs:h_540:gEbfA:wp_safe_redirect(admin_url("plugins.php?page=".WPBERITA_PLUGIN_LICENSE_PAGE));
exit;
WB77Y:Hfhq_:
}
}
add_action("admin_init","wpberita_core_deactivate_license");
if(!function_exists("wpberita_core_check_license"))
{
function wpberita_core_check_license()
{
$FrZnp=get_transient(md5("wpberita_core"));
if(!(false===$FrZnp))
{
goto j3hrS;
}
global $wp_filesystem,$wp_version;
$oOieN=md5(wpberita_core_get_home());
$VpCJp=md5("wpberita_core");
$E5UlU=trim(get_option("wpberita_core_license_key".$oOieN));
$sE1tw=wpberita_core_de_license("e",$E5UlU,$oOieN);
$VPZCi=wpberita_core_de_license("d",$E5UlU,$oOieN);
$QMvbi=str_replace("/",'',esc_url(wpberita_core_get_home()));
$pj0ju=array("key"=>esc_attr($VPZCi),"request[url]"=>esc_attr($QMvbi));
$UTSRn=esc_url_raw(add_query_arg($pj0ju,WPBERITA_API_URL_CHECK_ACTIVATION));
$eTgqg=wp_remote_get($UTSRn,array("timeout"=>60,"sslverify"=>true,"httpversion"=>"1.1","headers"=>array("Accept"=>"application/json"),"user-agent"=>"WordPress/".$wp_version."; ".home_url()));
if(is_wp_error($eTgqg)||200!==wp_remote_retrieve_response_code($eTgqg))
{
goto iDza_;
}
$cFG7F=json_decode(wp_remote_retrieve_body($eTgqg));
if(is_wp_error($cFG7F))
{
goto Ygow5;
}
$RzOcL=7*24*HOUR_IN_SECONDS;
set_transient(md5("wpberita_core"),true,7*24*HOUR_IN_SECONDS);
if(!("ok"!==$cFG7F->code))
{
goto zjssq;
}
switch($cFG7F->code)
{
case "license_empty":update_option("wpberita_core_license_key".$oOieN,'');
update_option("wpberita_core_license_status".$oOieN,'');
update_option("_trasient_timeout_popurl_ls_".$VpCJp,'');
$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"]))
{
goto ZgeLk;
}
if(!wpberita_core_connect_fs())
{
goto Nahkk;
}
$oihdY=$L9jMm["basedir"]."/".$oOieN;
if(!$wp_filesystem->exists($oihdY))
{
goto jP4dF;
}
$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";
if(!$wp_filesystem->exists($y1NLh))
{
goto mAAo_;
}
$wp_filesystem->delete($y1NLh,false,"f");
mAAo_:jP4dF:Nahkk:ZgeLk:goto crgDg;
case "license_not_found":$oOieN=md5(wpberita_core_get_home());
update_option("wpberita_core_license_key".$oOieN,'');
update_option("wpberita_core_license_status".$oOieN,'');
update_option("_trasient_timeout_popurl_ls_".$VpCJp,'');
$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"]))
{
goto kG0uq;
}
if(!wpberita_core_connect_fs())
{
goto N3ePl;
}
$oihdY=$L9jMm["basedir"]."/".$oOieN;
if(!$wp_filesystem->exists($oihdY))
{
goto I66DE;
}
$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";
if(!$wp_filesystem->exists($y1NLh))
{
goto UcryK;
}
$wp_filesystem->delete($y1NLh,false,"f");
UcryK:I66DE:N3ePl:kG0uq:goto crgDg;
case "no_activation_found":$oOieN=md5(wpberita_core_get_home());
update_option("wpberita_core_license_key".$oOieN,'');
update_option("wpberita_core_license_status".$oOieN,'');
update_option("_trasient_timeout_popurl_ls_".$VpCJp,'');
$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"]))
{
goto Wxbir;
}
if(!wpberita_core_connect_fs())
{
goto ylLB0;
}
$oihdY=$L9jMm["basedir"]."/".$oOieN;
if(!$wp_filesystem->exists($oihdY))
{
goto xPj0g;
}
$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";
if(!$wp_filesystem->exists($y1NLh))
{
goto Yxsg8;
}
$wp_filesystem->delete($y1NLh,false,"f");
Yxsg8:xPj0g:ylLB0:Wxbir:goto crgDg;
case "license_disabled":$oOieN=md5(wpberita_core_get_home());
update_option("wpberita_core_license_key".$oOieN,'');
update_option("wpberita_core_license_status".$oOieN,'');
update_option("_trasient_timeout_popurl_ls_".$VpCJp,'');$L9jMm=wp_upload_dir();
if(empty($L9jMm["basedir"])){goto n2wEO;}if(!wpberita_core_connect_fs()){goto oY5rY;}$oihdY=$L9jMm["basedir"]."/".$oOieN;if(!$wp_filesystem->exists($oihdY)){goto E5hAG;}$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$sE1tw.".json";if(!$wp_filesystem->exists($y1NLh)){goto d37jH;}$wp_filesystem->delete($y1NLh,false,"f");d37jH:E5hAG:oY5rY:n2wEO:goto crgDg;}WEy4g:crgDg:zjssq:goto au3Yx;Ygow5:$RzOcL=3*24*HOUR_IN_SECONDS;$HfdGn=$cFG7F->get_error_message();au3Yx:goto K9Zib;iDza_:if(is_wp_error($eTgqg)){goto j9Xno;}$HfdGn=__("An error occurred, please try again.","wpberita-core");goto ZUVwu;j9Xno:$HfdGn=$eTgqg->get_error_message();ZUVwu:K9Zib:set_transient(md5("wpberita_core"),true,$RzOcL);j3hrS:}}add_action("admin_init","wpberita_core_check_license");if(!function_exists("wpberita_jsn_url")){function wpberita_jsn_url(){$oOieN=md5(wpberita_core_get_home());$E5UlU=trim(get_option("wpberita_core_license_key".$oOieN));$L9jMm=wp_upload_dir();if(!empty($L9jMm["basedir"])){goto gJAok;}return "failed";goto cdzdG;gJAok:$oihdY=$L9jMm["basedir"]."/".$oOieN;if(@file_exists($oihdY)){goto LCXr3;}return "failed";goto RkrXf;LCXr3:$y1NLh=$L9jMm["basedir"]."/".$oOieN."/".$E5UlU.".json";if(@file_exists($y1NLh)){goto T7Wfn;}return "failed";goto LNBkM;T7Wfn:return "success";LNBkM:RkrXf:cdzdG:}}add_filter("wpberita_jsn_url_filter","wpberita_jsn_url",10,3);if(!function_exists("wpberita_core_admin_notices")){function wpberita_core_admin_notices(){if(!(isset($_GET["wpberita_core_activation"])&&!empty($_GET["message"]))){goto dVmd_;}switch($_GET["wpberita_core_activation"]){case "false":$HfdGn=rawurlencode(sanitize_text_field(wp_unslash($_GET["message"])));echo "\x9 <div class="error">\xa \x9 \x9\x9<p>";echo esc_html($HfdGn);echo "</p>
\x9\x9\x9 </div>
\x9";goto J0g1p;case "true":default:echo " \x9 <div class="success">\xa\x9\x9 \x9\x9 <p>";echo esc_html_e("Success.","wpberita-core");echo "</p>
\x9 \x9</div>\xa\x9 \x9 ";goto J0g1p;}Cstfj:J0g1p:dVmd_:}
}
add_action("admin_notices","wpberita_core_admin_notices");
© 2023 Quttera Ltd. All rights reserved.