Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
/* Decoded by unphp.net */ <?php /** * Plugin Name: WooCommerce Dhru Fusion API Inte..
Decoded Output download
/* Decoded by unphp.net */
<?php
/**
* Plugin Name: WooCommerce Dhru Fusion API Integration - Multi Server
* Plugin URI: http://sinticbolivia.net/products/plugins/woocommerce-dhru-fusion-multiserver-integration/
* Description: Dhru Fusion API Integration
* Version: 1.0
* Author: Sintic Bolivia
* Author URI: http://sinticbolivia.net
* Requires at least: 3.5
* Tested up to: 3.5
*/
${"GLOBALS"}["iqymegem"]="wcdfms";${"GLOBALS"}["mkpgerb"]="fh";${"GLOBALS"}["zhwrmvvir"]="log_file";${"GLOBALS"}["orvhvagi"]="order";${"GLOBALS"}["gplrtwsugi"]="dhru_code";${"GLOBALS"}["oiiflmyf"]="args";${"GLOBALS"}["dvqnrfdlwj"]="dhru_ms_server_id";${"GLOBALS"}["pibtvw"]="all_items_completed";${"GLOBALS"}["oadbmncxd"]="order_dhru_response";${"GLOBALS"}["httvkazb"]="res";${"GLOBALS"}["roncnoreob"]="order_item_status";${"GLOBALS"}["hhnclvnfvwi"]="woo_order";${"GLOBALS"}["xgumbciuy"]="orders";${"GLOBALS"}["jqwjqvjr"]="username";${"GLOBALS"}["kdwgrprmxo"]="server_url";${"GLOBALS"}["uisypssllh"]="dhru_ref_id";${"GLOBALS"}["xbmevqhjngf"]="dhru_server";${"GLOBALS"}["srcngttech"]="woo_order_item_id";${"GLOBALS"}["kdtjdor"]="response";${"GLOBALS"}["tefyhcuoqyx"]="para";${"GLOBALS"}["qhshbfbcak"]="api";${"GLOBALS"}["ufzbmvuf"]="dhru_fusion_ms_service_id";${"GLOBALS"}["ajiajbgisk"]="status";${"GLOBALS"}["exqrvsbrg"]="item";${"GLOBALS"}["zcuqnrjquq"]="items";${"GLOBALS"}["gcfxygi"]="the_order";${"GLOBALS"}["bysgud"]="service_id";${"GLOBALS"}["pkrudfc"]="item_id";${"GLOBALS"}["cpimxgkefvf"]="query";${"GLOBALS"}["fcjyfb"]="values";${"GLOBALS"}["wkebbduwwjv"]="data";${"GLOBALS"}["jhfpkjnye"]="cart_item_data";${"GLOBALS"}["rtwgsneiwy"]="bool";${"GLOBALS"}["wbtadywmr"]="imei";${"GLOBALS"}["jyxsay"]="dhru_service_id";${"GLOBALS"}["gdevlqt"]="product_id";${"GLOBALS"}["fllyqbbscpj"]="request";${"GLOBALS"}["uxvohwv"]="json";${"GLOBALS"}["cufrgfkqrad"]="services";${"GLOBALS"}["uofczjmv"]="server";${"GLOBALS"}["xqfpontqyvt"]="dhru_server_id";${"GLOBALS"}["yxdthqwpf"]="server_data";${"GLOBALS"}["wweotjvr"]="task";${"GLOBALS"}["qjjdrtnch"]="q";${"GLOBALS"}["hqilsqphwc"]="queries";defined("SB_DS")or define("SB_DS",DIRECTORY_SEPARATOR);require_once dirname(__FILE__)."/fusionclientapi/dhrufusionapi.class.php";class WooCommerceDhruFusionMS{protected$ops=array();public function __construct(){$this->addActions();$this->addFilters();}public static function onActivate(){global$wpdb;${"GLOBALS"}["zpocpju"]="queries";$yujrxdpndl="queries";${${"GLOBALS"}["hqilsqphwc"]}=array();${$yujrxdpndl}[]="CREATE TABLE IF NOT EXISTS {$wpdb->prefix}dhru_servers(dhru_server_id bigint not null auto_increment primary key,"."server_name varchar(250),"."server_url varchar(250),"."api_username varchar(200),"."api_key varchar(250),"."status varchar(100),"."creation_date datetime);";foreach(${${"GLOBALS"}["zpocpju"]} as${${"GLOBALS"}["qjjdrtnch"]}){$wpdb->query(${${"GLOBALS"}["qjjdrtnch"]});}}public static function onDeactivate(){}public function addActions(){add_action("woocommerce_order_status_processing",array($this,"actionWooOrderStatusProcessing"));add_action("woocommerce_email_order_meta",array($this,"action_woocommerce_email_order_meta"),10,2);if(is_admin()){add_action("admin_init",array($this,"addMetaBoxes"));add_action("save_post",array($this,"save_post"));add_action("woocommerce_admin_order_data_after_shipping_address",array($this,"woocommerce_after_order_shipping"));}add_action("woocommerce_before_add_to_cart_button",array($this,"action_woocommerce_before_add_to_cart_button"));add_action("woocommerce_add_order_item_meta",array($this,"action_woocommerce_add_order_item_meta"),10,2);if(is_admin()){add_action("admin_menu",array($this,"actionAdminMenu"));add_action("init",array($this,"handleAdminRequest"));}}public function handleAdminRequest(){${"GLOBALS"}["qtjjeomxwvv"]="task";global$wpdb;${${"GLOBALS"}["qtjjeomxwvv"]}=isset($_REQUEST["task"])?$_REQUEST["task"]:null;${"GLOBALS"}["gnqifnte"]="task";if(!${${"GLOBALS"}["wweotjvr"]})return false;if(${${"GLOBALS"}["gnqifnte"]}=="save_server"){${${"GLOBALS"}["yxdthqwpf"]}=array_map("trim",$_POST["server"]);$cjsfldukgjg="dhru_server_id";${"GLOBALS"}["eyeqcesgynv"]="dhru_server_id";${$cjsfldukgjg}=isset($_POST["dhru_server_id"])?(int)$_POST["dhru_server_id"]:null;if(${${"GLOBALS"}["eyeqcesgynv"]}){$wpdb->update($wpdb->prefix."dhru_servers",${${"GLOBALS"}["yxdthqwpf"]},array("dhru_server_id"=>${${"GLOBALS"}["xqfpontqyvt"]}));wp_safe_redirect(admin_url("/admin.php?page=woocommerce-dhru-fusion-ms&msg=server_updated"));die();}else{${"GLOBALS"}["niuvfuen"]="server_data";${${"GLOBALS"}["niuvfuen"]}["creation_date"]=date("Y-m-d H:i:s");$wpdb->insert($wpdb->prefix."dhru_servers",${${"GLOBALS"}["yxdthqwpf"]});wp_safe_redirect(admin_url("/admin.php?page=woocommerce-dhru-fusion-ms&msg=server_created"));die();}}elseif(${${"GLOBALS"}["wweotjvr"]}=="delete_dhru_server"){${${"GLOBALS"}["xqfpontqyvt"]}=(int)$_GET["id"];$wpdb->delete($wpdb->prefix."dhru_servers",array("dhru_server_id"=>${${"GLOBALS"}["xqfpontqyvt"]}));}elseif(${${"GLOBALS"}["wweotjvr"]}=="get_dhru_server_services"){$kenmeb="dhru_server_id";${${"GLOBALS"}["xqfpontqyvt"]}=(int)$_POST["dhru_server_id"];${${"GLOBALS"}["uofczjmv"]}=$this->getDhruServer(${$kenmeb});${"GLOBALS"}["bilsjb"]="json";$vwoolmjnif="services";${${"GLOBALS"}["cufrgfkqrad"]}=$this->getDhruFusionServices($server->server_url,$server->api_username,$server->api_key);${${"GLOBALS"}["uxvohwv"]}=array("status"=>"ok","message"=>"","services"=>array());if(isset(${${"GLOBALS"}["cufrgfkqrad"]}["ERROR"])){${${"GLOBALS"}["uxvohwv"]}["status"]="error";$wqhqkvpo="services";${${"GLOBALS"}["uxvohwv"]}["error"]=${$wqhqkvpo}["ERROR"][0]["MESSAGE"];}elseif(isset(${$vwoolmjnif}["SUCCESS"])){$wenaxgl="json";${$wenaxgl}["services"]=${${"GLOBALS"}["cufrgfkqrad"]}["SUCCESS"][0]["LIST"];}header("Content-type: application/json");die(json_encode(${${"GLOBALS"}["bilsjb"]}));}elseif(${${"GLOBALS"}["wweotjvr"]}=="test_get_account_info"){${"GLOBALS"}["pcwdsonnipw"]="server";${"GLOBALS"}["zdhssen"]="api";${"GLOBALS"}["secefyoio"]="request";${${"GLOBALS"}["pcwdsonnipw"]}=array_map("trim",$_POST["server"]);$husjfffjad="server";$tifsvtgnr="server";${${"GLOBALS"}["zdhssen"]}=new SB_DhruFusion(${$tifsvtgnr}["server_url"],${${"GLOBALS"}["uofczjmv"]}["api_username"],${$husjfffjad}["api_key"]);${${"GLOBALS"}["fllyqbbscpj"]}=$api->action("accountinfo");print strip_tags(print_r(${${"GLOBALS"}["secefyoio"]},1));die();}}public function action_woocommerce_cart_updated(){global$woocommerce;}public function addFilters(){add_filter("woocommerce_add_to_cart_validation",array($this,"filter_woocommerce_add_to_cart_validation"),10,5);add_filter("woocommerce_add_cart_item",array($this,"filter_woocommerce_add_cart_item"),10,2);add_filter("woocommerce_get_cart_item_from_session",array($this,"filter_woocommerce_get_cart_item_from_session"),10,3);add_filter("cron_schedules",array($this,"cron_schedules"));}public function addMetaBoxes(){add_meta_box("dhru-fusion-providers-ms",__("Dhru Fusion Services"),array($this,"metaboxProviders"),"product","side");}public function save_post($product_id){if(!isset($_POST["post_type"])||$_POST["post_type"]!="product")return false;${"GLOBALS"}["ftluykug"]="product_id";if(isset($_POST["dhru_ms_server_id"]))update_post_meta(${${"GLOBALS"}["ftluykug"]},"_dhru_ms_server_id",(int)$_POST["dhru_ms_server_id"]);if(isset($_POST["dhru_fusion_ms_service_id"]))update_post_meta(${${"GLOBALS"}["gdevlqt"]},"_dhru_fusion_ms_service_id",(int)$_POST["dhru_fusion_ms_service_id"]);}public function cron_schedules($chedules){${"GLOBALS"}["ocukteldgxz"]="schedules";$jktqycskmg="schedules";$lpyvkoifu="schedules";${$jktqycskmg}["every_twenty_mins"]=array("interval"=>60*20,"display"=>__("Every Twenty Minutes"));${$lpyvkoifu}["every_ten_mins"]=array("interval"=>60*10,"display"=>__("Every Ten Minutes"));return${${"GLOBALS"}["ocukteldgxz"]};}public function filter_woocommerce_add_to_cart_validation($bool){$blahhtsysm="dhru_service_id";global$woocommerce;${$blahhtsysm}=get_post_meta(${${"GLOBALS"}["gdevlqt"]},"_dhru_fusion_ms_service_id",1);$rvifklom="imei";${"GLOBALS"}["swnyzleykoc"]="dhru_service_id";${"GLOBALS"}["odhuqgi"]="imei";if(empty(${${"GLOBALS"}["swnyzleykoc"]})||${${"GLOBALS"}["jyxsay"]}==-1)return true;if(!isset($_POST["the_imei"])||empty($_POST["the_imei"])){$woocommerce->add_error(__("Please enter a valid imei"));return false;}${${"GLOBALS"}["odhuqgi"]}=trim($_POST["the_imei"]);if(strlen(${$rvifklom})<15||strlen(${${"GLOBALS"}["wbtadywmr"]})>15){$woocommerce->add_error(__("The imei needs to be 15 digits"));return false;}if(!is_numeric(${${"GLOBALS"}["wbtadywmr"]})){$woocommerce->add_error(__("The imei needs to be numeric"));${${"GLOBALS"}["rtwgsneiwy"]}=false;}$wubmxic="bool";return${$wubmxic};}public function filter_woocommerce_add_cart_item($cart_item_data,$cart_item_key){${"GLOBALS"}["pzftwfuxvnd"]="cart_item_data";$jgbocwtyrpl="cart_item_data";if(!isset($_POST["the_imei"])||empty($_POST["the_imei"]))return${${"GLOBALS"}["jhfpkjnye"]};$this->log("filter_woocommerce_add_cart_item");${${"GLOBALS"}["pzftwfuxvnd"]}["imei"]=trim($_POST["the_imei"]);$this->log("adding cart item imei: {$cart_item_data['imei']}");return${$jgbocwtyrpl};}public function filter_woocommerce_get_cart_item_from_session($data,$values,$key){return array_merge(${${"GLOBALS"}["wkebbduwwjv"]},${${"GLOBALS"}["fcjyfb"]});}public function actionAdminMenu(){add_menu_page(__("Woocommerce Dhru Fusion Mutli Server"),__("Woocommerce Dhru Fusion Multi Server"),8,"woocommerce-dhru-fusion-ms",array($this,"pageOptions"));add_submenu_page("woocommerce-dhru-fusion-ms",__("Documentation"),__("Documentation"),"manage_options","woocommerce-dhru-fusion-doc-ms",array($this,"pageDocumentation"));}public function pageOptions(){global$wpdb;${"GLOBALS"}["dtvzzt"]="dhru_servers";${"GLOBALS"}["khznbrrd"]="query";${${"GLOBALS"}["khznbrrd"]}="SELECT * FROM {$wpdb->prefix}dhru_servers ORDER BY creation_date DESC";${${"GLOBALS"}["dtvzzt"]}=$wpdb->get_results(${${"GLOBALS"}["cpimxgkefvf"]});require_once dirname(__FILE__)."/pages/admin/options.php";}public function pageDocumentation(){require_once dirname(__FILE__)."/pages/admin/doc.php";}public function action_woocommerce_add_order_item_meta($item_id,$values){$cynkjoy="values";${"GLOBALS"}["hiukkhyn"]="item_id";$this->log("action_woocommerce_add_order_item_meta");${${"GLOBALS"}["wbtadywmr"]}=isset(${${"GLOBALS"}["fcjyfb"]}["imei"])?${$cynkjoy}["imei"]:$_POST["the_imei"];$this->log("IMEI: $imei");$wonkgq="imei";woocommerce_add_order_item_meta(${${"GLOBALS"}["hiukkhyn"]},"_the_imei",${$wonkgq});woocommerce_add_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"IMEI",${${"GLOBALS"}["wbtadywmr"]});}public function action_woocommerce_before_add_to_cart_button(){global$post;${${"GLOBALS"}["bysgud"]}=(int)get_post_meta($post->ID,"_dhru_fusion_ms_service_id",true);${"GLOBALS"}["lwvuumzmyek"]="service_id";if(!${${"GLOBALS"}["bysgud"]}||${${"GLOBALS"}["lwvuumzmyek"]}==-1)return false;echo " <p>
<label>";_e("IMEI");echo "</label>
<input type=\"text\" id=\"the_imei" name=\"the_imei\" value="" style="width:70%;" />
</p>
";if(get_post_meta($post->ID,"_show_dhru_brand",1)=="true"){echo " <p>
<label>";_e("Brand");echo "</label>
<input type=\"text" name="the_brand\" value="\" />
</p>
";}echo "
";}public function actionWooOrderStatusProcessing($woo_order_id){${"GLOBALS"}["iwaiccuiwe"]="items";${"GLOBALS"}["swbqxxzfjoe"]="woo_order_id";$this->log("Woocommerce changing order to processing, so payment is done");$this->log("order_id: $woo_order_id");${${"GLOBALS"}["gcfxygi"]}=new WC_Order(${${"GLOBALS"}["swbqxxzfjoe"]});${${"GLOBALS"}["zcuqnrjquq"]}=$the_order->get_items();foreach(${${"GLOBALS"}["iwaiccuiwe"]} as${${"GLOBALS"}["pkrudfc"]}=>${${"GLOBALS"}["exqrvsbrg"]}){$oelddxuas="dhru_server_id";${"GLOBALS"}["iswlhayn"]="dhru_fusion_ms_service_id";${"GLOBALS"}["deqmlgrj"]="dhru_fusion_ms_service_id";${${"GLOBALS"}["wbtadywmr"]}=${${"GLOBALS"}["exqrvsbrg"]}["item_meta"]["_the_imei"][0];${"GLOBALS"}["qtsxxxmu"]="item";$ztmqhexfgkpx="status";$this->log("order item imei: $imei");${${"GLOBALS"}["xqfpontqyvt"]}=(int)get_post_meta(${${"GLOBALS"}["exqrvsbrg"]}["product_id"],"_dhru_ms_server_id",true);$dvcmed="dhru_fusion_ms_service_id";${${"GLOBALS"}["deqmlgrj"]}=(int)get_post_meta(${${"GLOBALS"}["qtsxxxmu"]}["product_id"],"_dhru_fusion_ms_service_id",true);$gqevblgmbr="item_id";if(!${${"GLOBALS"}["xqfpontqyvt"]}||${$oelddxuas}==-1){$this->log("dhru server id is invalid or not selected, skipping product id -> {$item['product_id']}");continue;}if(!${${"GLOBALS"}["iswlhayn"]}||${$dvcmed}==-1){$this->log("dhru service provider id is not valid or empty, skipping product id -> {$item['product_id']}");continue;}if(${$ztmqhexfgkpx}=woocommerce_get_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_item_status",1)){if(${${"GLOBALS"}["ajiajbgisk"]}!="cancelled"){$dfwonelwco="item_id";woocommerce_add_order_item_meta(${$dfwonelwco},"_dhru_fusion_order_item_status","pending");woocommerce_add_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response","");}continue;}$this->placeDhruFusionNewOrder(${$gqevblgmbr},${${"GLOBALS"}["wbtadywmr"]},${${"GLOBALS"}["xqfpontqyvt"]},${${"GLOBALS"}["ufzbmvuf"]});update_post_meta($the_order->id,"_dhru_order","yes");}}public function placeDhruFusionNewOrder($woo_order_item_id,$imei,$dhru_server_id,$service_id){$bddembrgk="dhru_server";$wxhkrwlec="service_id";$qrslmu="response";${"GLOBALS"}["smmkgngli"]="dhru_server_id";${"GLOBALS"}["jmeddlje"]="dhru_server";${"GLOBALS"}["oclfwemq"]="para";${$bddembrgk}=$this->getDhruServer(${${"GLOBALS"}["smmkgngli"]});if(empty(${${"GLOBALS"}["jmeddlje"]})){$this->log("The dhru server id does not exists");return false;}${${"GLOBALS"}["qhshbfbcak"]}=new SB_DhruFusion($dhru_server->server_url,$dhru_server->api_username,$dhru_server->api_key);${${"GLOBALS"}["oclfwemq"]}=array("IMEI"=>${${"GLOBALS"}["wbtadywmr"]},"ID"=>${$wxhkrwlec});$this->log("PLACING DHRU FUSION ORDER");${$qrslmu}=$api->action("placeimeiorder",${${"GLOBALS"}["tefyhcuoqyx"]});$this->log(${${"GLOBALS"}["kdtjdor"]});if(isset(${${"GLOBALS"}["kdtjdor"]}["SUCCESS"])){$uzmesxjyz="response";$ckewro="response";$wjqnepmsfd="woo_order_item_id";${"GLOBALS"}["mipagsurescz"]="woo_order_item_id";${"GLOBALS"}["ifyjiefhuvl"]="response";$this->log("adding dhru order reference and status to woocommerce order ($woo_order_item_id)");$gtxubujvyvp="woo_order_item_id";$this->log("dhru fusion referenceid: {$response['SUCCESS'][0]['REFERENCEID']}");${"GLOBALS"}["kskpuqc"]="woo_order_item_id";woocommerce_add_order_item_meta(${${"GLOBALS"}["mipagsurescz"]},"_dhru_fusion_order_item_status","pending");${"GLOBALS"}["kmmkgcopsy"]="response";woocommerce_add_order_item_meta(${${"GLOBALS"}["kskpuqc"]},"_dhru_fusion_order_id",${$ckewro}["SUCCESS"][0]["REFERENCEID"]);woocommerce_add_order_item_meta(${$gtxubujvyvp},"_dhru_fusion_order_response",sprintf("Message: %s<br/>Reference Id: %d",${${"GLOBALS"}["ifyjiefhuvl"]}["SUCCESS"][0]["MESSAGE"],${${"GLOBALS"}["kmmkgcopsy"]}["SUCCESS"][0]["REFERENCEID"]));woocommerce_add_order_item_meta(${${"GLOBALS"}["srcngttech"]},"Unlock status:",${${"GLOBALS"}["kdtjdor"]}["SUCCESS"][0]["MESSAGE"]);woocommerce_add_order_item_meta(${$wjqnepmsfd},"Unlock Reference ID:",${$uzmesxjyz}["SUCCESS"][0]["REFERENCEID"]);}}public function getOrderDetails($dhru_ref_id,$dhru_server_id){$fhlfgmbedr="dhru_server_id";${"GLOBALS"}["nmesnddgquoe"]="para";$bpsedbreg="dhru_ref_id";${"GLOBALS"}["eemagdqc"]="request";${${"GLOBALS"}["xbmevqhjngf"]}=$this->getDhruServer(${$fhlfgmbedr});${"GLOBALS"}["nwdrwoxyba"]="para";if(empty(${${"GLOBALS"}["xbmevqhjngf"]}))return false;$this->log("getting dhru fusion order details: ".${${"GLOBALS"}["uisypssllh"]});${${"GLOBALS"}["qhshbfbcak"]}=new SB_DhruFusion($dhru_server->server_url,$dhru_server->api_username,$dhru_server->api_key);${${"GLOBALS"}["nwdrwoxyba"]}=array("ID"=>${$bpsedbreg});${${"GLOBALS"}["eemagdqc"]}=$api->action("getimeiorder",${${"GLOBALS"}["nmesnddgquoe"]});return${${"GLOBALS"}["fllyqbbscpj"]};}public function getDhruFusionProviders(){}public function getDhruFusionServices($server_url,$username,$api_key){${"GLOBALS"}["orcvojlih"]="server_url";$pwgmftauj="username";$this->log("Connection to dhru fusion server to get services list");${"GLOBALS"}["eztemorap"]="api_key";${"GLOBALS"}["stnwagdodwg"]="api_key";$this->log("Dhru fusion url: ".${${"GLOBALS"}["kdwgrprmxo"]});${"GLOBALS"}["kamxlwl"]="api";$this->log("dhru api username: ".${$pwgmftauj});$rvpjjgx="request";$this->log("dhru api key: ".${${"GLOBALS"}["stnwagdodwg"]});${${"GLOBALS"}["kamxlwl"]}=new SB_DhruFusion(${${"GLOBALS"}["orcvojlih"]},${${"GLOBALS"}["jqwjqvjr"]},${${"GLOBALS"}["eztemorap"]});${$rvpjjgx}=$api->action("imeiservicelist");return${${"GLOBALS"}["fllyqbbscpj"]};}public function wrapCheckDhruOrders(){${"GLOBALS"}["dpcdxnl"]="orders";require_once WP_PLUGIN_DIR."/woocommerce/classes/class-wc-order.php";${"GLOBALS"}["pghjstutryw"]="order";${"GLOBALS"}["jllbdmg"]="orders";$this->log("STARTING CRON TASK --> CHECKING ORDERS STATUS");${${"GLOBALS"}["jllbdmg"]}=get_posts(array("numberposts"=>-1,"post_type"=>"shop_order","orderby"=>"post_date","order"=>"DESC","tax_query"=>array(array("taxonomy"=>"shop_order_status","field"=>"slug","terms"=>"processing")),"meta_key"=>"_dhru_order","meta_value"=>"yes"));$this->log("Total Orders to process: ".count(${${"GLOBALS"}["dpcdxnl"]}));foreach(${${"GLOBALS"}["xgumbciuy"]} as${${"GLOBALS"}["pghjstutryw"]}){${"GLOBALS"}["obwdxttouv"]="all_items_completed";$fxvidufcfg="order_dhru_response";$gcgtecd="order_dhru_response";${${"GLOBALS"}["hhnclvnfvwi"]}=new WC_Order($order->ID);${$fxvidufcfg}="";${${"GLOBALS"}["obwdxttouv"]}=true;foreach($woo_order->get_items()as${${"GLOBALS"}["pkrudfc"]}=>${${"GLOBALS"}["exqrvsbrg"]}){${"GLOBALS"}["hyvivouvmy"]="res";${"GLOBALS"}["duoxipwsxy"]="dhru_order_id";$dtqjdvop="dhru_order_id";${"GLOBALS"}["kpoozomwf"]="order_item_status";${$dtqjdvop}=woocommerce_get_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_id",1);$neokhtbvmavg="res";if(!${${"GLOBALS"}["duoxipwsxy"]}){$this->log("the woocommerce order_item_id ($item_id) has not a dhru fusion order id, it is --> $dhru_order_id");continue;}${${"GLOBALS"}["kpoozomwf"]}=woocommerce_get_order_item_meta(${${"GLOBALS"}["exqrvsbrg"]}["id"],"_dhru_fusion_order_item_status",1);if(${${"GLOBALS"}["roncnoreob"]}=="completed")continue;$vxropmokny="item";$qdkvyzegr="dhru_order_id";$this->log("dhru fusion reference_id: $dhru_order_id");${${"GLOBALS"}["xqfpontqyvt"]}=(int)get_post_meta(${$vxropmokny}["product_id"],"_dhru_ms_server_id",1);${${"GLOBALS"}["hyvivouvmy"]}=$this->getOrderDetails(${$qdkvyzegr},${${"GLOBALS"}["xqfpontqyvt"]});$this->log("order details response");$this->log(${${"GLOBALS"}["httvkazb"]});if(isset(${$neokhtbvmavg}["SUCCESS"])){${"GLOBALS"}["kqvimgk"]="res";$opdcrizv="res";if(((int)${${"GLOBALS"}["kqvimgk"]}["SUCCESS"][0]["STATUS"])==4){woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_item_status","completed");${"GLOBALS"}["yrbeietiq"]="item_id";woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response",${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"]);$fplclvnj="res";woocommerce_update_order_item_meta(${${"GLOBALS"}["yrbeietiq"]},"Unlock status:",${$fplclvnj}["SUCCESS"][0]["CODE"]);${${"GLOBALS"}["oadbmncxd"]}.=${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"];}elseif((int)${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["STATUS"]==3){${"GLOBALS"}["eyjdec"]="res";$wgujffjpx="item_id";woocommerce_update_order_item_meta(${$wgujffjpx},"_dhru_fusion_order_item_status","failed");woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response",${${"GLOBALS"}["eyjdec"]}["SUCCESS"][0]["CODE"]);woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"Unlock status:",${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"]);$tqnfxlybgd="res";${${"GLOBALS"}["oadbmncxd"]}.=${$tqnfxlybgd}["SUCCESS"][0]["CODE"];$this->log("order filed, code = 3, not found");}elseif(empty(${$opdcrizv}["SUCCESS"][0]["STATUS"])){${"GLOBALS"}["juflpvri"]="item_id";${"GLOBALS"}["fxiqcofwnqq"]="item_id";${"GLOBALS"}["qpyslm"]="order_dhru_response";$hgvywlnvbqn="item_id";woocommerce_update_order_item_meta(${${"GLOBALS"}["juflpvri"]},"_dhru_fusion_order_item_status","pending");woocommerce_update_order_item_meta(${${"GLOBALS"}["fxiqcofwnqq"]},"_dhru_fusion_order_response","The order has no status code");woocommerce_update_order_item_meta(${$hgvywlnvbqn},"Unlock status:","The order has no status code");$this->log("order null");$weewrwcaecc="all_items_completed";${${"GLOBALS"}["qpyslm"]}.="The order has no status code";${$weewrwcaecc}=false;}else{${"GLOBALS"}["mphndo"]="item_id";$ybyhswf="item_id";${"GLOBALS"}["eafihmb"]="order_dhru_response";$this->log("order UNKNOW CODE");woocommerce_update_order_item_meta(${$ybyhswf},"_dhru_fusion_order_item_status","pending");woocommerce_update_order_item_meta(${${"GLOBALS"}["mphndo"]},"_dhru_fusion_order_response","");$seycuvyj="item_id";${"GLOBALS"}["ukdcsib"]="all_items_completed";woocommerce_update_order_item_meta(${$seycuvyj},"Unlock status:","The order has no status code-");${${"GLOBALS"}["eafihmb"]}.="The order has no status code";${${"GLOBALS"}["ukdcsib"]}=false;}}elseif(isset(${${"GLOBALS"}["httvkazb"]}["ERROR"])){$amovdh="item_id";$yolukrrlw="res";${"GLOBALS"}["ubhrtbm"]="item_id";$xprwao="res";$aouyzgvuw="order_dhru_response";woocommerce_update_order_item_meta(${${"GLOBALS"}["ubhrtbm"]},"_dhru_fusion_order_item_status","failed");$iyiivfc="res";woocommerce_update_order_item_meta(${$amovdh},"_dhru_fusion_order_response",sprintf("%s<br/>%s",${${"GLOBALS"}["httvkazb"]}["ERROR"][0]["MESSAGE"],${$xprwao}["ERROR"][0]["FULL_DESCRIPTION"]));${$aouyzgvuw}.=sprintf("%s<br/>%s",${$yolukrrlw}["ERROR"][0]["MESSAGE"],${$iyiivfc}["ERROR"][0]["FULL_DESCRIPTION"]);}}update_post_meta($woo_order->id,"_dhru_fusion_order_response",${$gcgtecd});if(${${"GLOBALS"}["pibtvw"]}){$woo_order->update_status("completed");}}die("CRON JOB ENDS");}public function metaboxProviders($post){${"GLOBALS"}["ljkyocme"]="dhru_servers";global$wpdb;${${"GLOBALS"}["ljkyocme"]}=$this->getDhruServers();${${"GLOBALS"}["dvqnrfdlwj"]}=get_post_meta($post->ID,"_dhru_ms_server_id",1);${${"GLOBALS"}["ufzbmvuf"]}=get_post_meta($post->ID,"_dhru_fusion_ms_service_id",1);require_once dirname(__FILE__)."/pages/admin/metabox.php";}public function woocommerce_after_order_shipping($order){echo "</div>
<div class=\"order_data_column\">
<h4>";_e("Dhru Fusion Order Details");echo "</h4>
";print get_post_meta($order->id,"_dhru_fusion_order_response",1);}public function woocommerce_after_template_part($template_name,$template_path,$located,$args){$this->log("woocommerce_after_template_part");$this->log(${${"GLOBALS"}["oiiflmyf"]});${${"GLOBALS"}["gplrtwsugi"]}=get_post_meta(@${${"GLOBALS"}["oiiflmyf"]}["order"]->id,"_dhru_fusion_order_response",1);print${${"GLOBALS"}["gplrtwsugi"]};}public function action_woocommerce_email_order_meta($order,$false){$this->log("action_woocommerce_email_order_meta
=========================================");$this->log(${${"GLOBALS"}["orvhvagi"]});${"GLOBALS"}["evwywhrv"]="dhru_code";${${"GLOBALS"}["evwywhrv"]}=get_post_meta($order->id,"_dhru_fusion_order_response",1);echo " <h2>";_e("Unlock Details");echo "</h2>
<p>";print${${"GLOBALS"}["gplrtwsugi"]};echo "</p>
";}public function log($str){$omskplp="fh";${${"GLOBALS"}["zhwrmvvir"]}=dirname(__FILE__).SB_DS."dhru-ms.log";${${"GLOBALS"}["mkpgerb"]}=null;${"GLOBALS"}["cngflvpdtjxh"]="date";${"GLOBALS"}["gxsgcnmdi"]="str";if(file_exists(${${"GLOBALS"}["zhwrmvvir"]})){${"GLOBALS"}["eflrimcdhbt"]="fh";${${"GLOBALS"}["eflrimcdhbt"]}=fopen(${${"GLOBALS"}["zhwrmvvir"]},"a+");}else{${"GLOBALS"}["jsfjxsww"]="fh";${${"GLOBALS"}["jsfjxsww"]}=fopen(${${"GLOBALS"}["zhwrmvvir"]},"w+");}${${"GLOBALS"}["cngflvpdtjxh"]}=date("Y-m-d H:i:s");fwrite(${$omskplp},"[$date]#".print_r(${${"GLOBALS"}["gxsgcnmdi"]},1)."
");fclose(${${"GLOBALS"}["mkpgerb"]});}public function getDhruServers($status='enabled'){${"GLOBALS"}["heddtqpril"]="status";${"GLOBALS"}["fughxsg"]="query";global$wpdb;${${"GLOBALS"}["cpimxgkefvf"]}=sprintf("SELECT * FROM {$wpdb->prefix}dhru_servers %s ORDER BY creation_date DESC",(${${"GLOBALS"}["heddtqpril"]})?"WHERE status = '$status'":"");return$wpdb->get_results(${${"GLOBALS"}["fughxsg"]});}public function getDhruServer($server_id){global$wpdb;${${"GLOBALS"}["cpimxgkefvf"]}="SELECT * FROM {$wpdb->prefix}dhru_servers WHERE dhru_server_id = $server_id";return$wpdb->get_row(${${"GLOBALS"}["cpimxgkefvf"]});}}${${"GLOBALS"}["iqymegem"]}=null;register_deactivation_hook(__FILE__,array("WooCommerceDhruFusionMS","onDeactivate"));register_activation_hook(__FILE__,array("WooCommerceDhruFusionMS","onActivate"));function __wcdfms(){global$wcdfms;${${"GLOBALS"}
["iqymegem"]}=new WooCommerceDhruFusionMS();if(isset($_GET["process_dhru_orders"])){${"GLOBALS"}["xurhjfuvcpc"]="wcdfms";add_action("init",array(${${"GLOBALS"}["xurhjfuvcpc"]},"wrapCheckDhruOrders"));}}add_action("woocommerce_loaded","__wcdfms");
?>
Did this file decode correctly?
Original Code
/* Decoded by unphp.net */
<?php
/**
* Plugin Name: WooCommerce Dhru Fusion API Integration - Multi Server
* Plugin URI: http://sinticbolivia.net/products/plugins/woocommerce-dhru-fusion-multiserver-integration/
* Description: Dhru Fusion API Integration
* Version: 1.0
* Author: Sintic Bolivia
* Author URI: http://sinticbolivia.net
* Requires at least: 3.5
* Tested up to: 3.5
*/
${"GLOBALS"}["iqymegem"]="wcdfms";${"GLOBALS"}["mkpgerb"]="fh";${"GLOBALS"}["zhwrmvvir"]="log_file";${"GLOBALS"}["orvhvagi"]="order";${"GLOBALS"}["gplrtwsugi"]="dhru_code";${"GLOBALS"}["oiiflmyf"]="args";${"GLOBALS"}["dvqnrfdlwj"]="dhru_ms_server_id";${"GLOBALS"}["pibtvw"]="all_items_completed";${"GLOBALS"}["oadbmncxd"]="order_dhru_response";${"GLOBALS"}["httvkazb"]="res";${"GLOBALS"}["roncnoreob"]="order_item_status";${"GLOBALS"}["hhnclvnfvwi"]="woo_order";${"GLOBALS"}["xgumbciuy"]="orders";${"GLOBALS"}["jqwjqvjr"]="username";${"GLOBALS"}["kdwgrprmxo"]="server_url";${"GLOBALS"}["uisypssllh"]="dhru_ref_id";${"GLOBALS"}["xbmevqhjngf"]="dhru_server";${"GLOBALS"}["srcngttech"]="woo_order_item_id";${"GLOBALS"}["kdtjdor"]="response";${"GLOBALS"}["tefyhcuoqyx"]="para";${"GLOBALS"}["qhshbfbcak"]="api";${"GLOBALS"}["ufzbmvuf"]="dhru_fusion_ms_service_id";${"GLOBALS"}["ajiajbgisk"]="status";${"GLOBALS"}["exqrvsbrg"]="item";${"GLOBALS"}["zcuqnrjquq"]="items";${"GLOBALS"}["gcfxygi"]="the_order";${"GLOBALS"}["bysgud"]="service_id";${"GLOBALS"}["pkrudfc"]="item_id";${"GLOBALS"}["cpimxgkefvf"]="query";${"GLOBALS"}["fcjyfb"]="values";${"GLOBALS"}["wkebbduwwjv"]="data";${"GLOBALS"}["jhfpkjnye"]="cart_item_data";${"GLOBALS"}["rtwgsneiwy"]="bool";${"GLOBALS"}["wbtadywmr"]="imei";${"GLOBALS"}["jyxsay"]="dhru_service_id";${"GLOBALS"}["gdevlqt"]="product_id";${"GLOBALS"}["fllyqbbscpj"]="request";${"GLOBALS"}["uxvohwv"]="json";${"GLOBALS"}["cufrgfkqrad"]="services";${"GLOBALS"}["uofczjmv"]="server";${"GLOBALS"}["xqfpontqyvt"]="dhru_server_id";${"GLOBALS"}["yxdthqwpf"]="server_data";${"GLOBALS"}["wweotjvr"]="task";${"GLOBALS"}["qjjdrtnch"]="q";${"GLOBALS"}["hqilsqphwc"]="queries";defined("SB_DS")or define("SB_DS",DIRECTORY_SEPARATOR);require_once dirname(__FILE__)."/fusionclientapi/dhrufusionapi.class.php";class WooCommerceDhruFusionMS{protected$ops=array();public function __construct(){$this->addActions();$this->addFilters();}public static function onActivate(){global$wpdb;${"GLOBALS"}["zpocpju"]="queries";$yujrxdpndl="queries";${${"GLOBALS"}["hqilsqphwc"]}=array();${$yujrxdpndl}[]="CREATE TABLE IF NOT EXISTS {$wpdb->prefix}dhru_servers(dhru_server_id bigint not null auto_increment primary key,"."server_name varchar(250),"."server_url varchar(250),"."api_username varchar(200),"."api_key varchar(250),"."status varchar(100),"."creation_date datetime);";foreach(${${"GLOBALS"}["zpocpju"]} as${${"GLOBALS"}["qjjdrtnch"]}){$wpdb->query(${${"GLOBALS"}["qjjdrtnch"]});}}public static function onDeactivate(){}public function addActions(){add_action("woocommerce_order_status_processing",array($this,"actionWooOrderStatusProcessing"));add_action("woocommerce_email_order_meta",array($this,"action_woocommerce_email_order_meta"),10,2);if(is_admin()){add_action("admin_init",array($this,"addMetaBoxes"));add_action("save_post",array($this,"save_post"));add_action("woocommerce_admin_order_data_after_shipping_address",array($this,"woocommerce_after_order_shipping"));}add_action("woocommerce_before_add_to_cart_button",array($this,"action_woocommerce_before_add_to_cart_button"));add_action("woocommerce_add_order_item_meta",array($this,"action_woocommerce_add_order_item_meta"),10,2);if(is_admin()){add_action("admin_menu",array($this,"actionAdminMenu"));add_action("init",array($this,"handleAdminRequest"));}}public function handleAdminRequest(){${"GLOBALS"}["qtjjeomxwvv"]="task";global$wpdb;${${"GLOBALS"}["qtjjeomxwvv"]}=isset($_REQUEST["task"])?$_REQUEST["task"]:null;${"GLOBALS"}["gnqifnte"]="task";if(!${${"GLOBALS"}["wweotjvr"]})return false;if(${${"GLOBALS"}["gnqifnte"]}=="save_server"){${${"GLOBALS"}["yxdthqwpf"]}=array_map("trim",$_POST["server"]);$cjsfldukgjg="dhru_server_id";${"GLOBALS"}["eyeqcesgynv"]="dhru_server_id";${$cjsfldukgjg}=isset($_POST["dhru_server_id"])?(int)$_POST["dhru_server_id"]:null;if(${${"GLOBALS"}["eyeqcesgynv"]}){$wpdb->update($wpdb->prefix."dhru_servers",${${"GLOBALS"}["yxdthqwpf"]},array("dhru_server_id"=>${${"GLOBALS"}["xqfpontqyvt"]}));wp_safe_redirect(admin_url("/admin.php?page=woocommerce-dhru-fusion-ms&msg=server_updated"));die();}else{${"GLOBALS"}["niuvfuen"]="server_data";${${"GLOBALS"}["niuvfuen"]}["creation_date"]=date("Y-m-d H:i:s");$wpdb->insert($wpdb->prefix."dhru_servers",${${"GLOBALS"}["yxdthqwpf"]});wp_safe_redirect(admin_url("/admin.php?page=woocommerce-dhru-fusion-ms&msg=server_created"));die();}}elseif(${${"GLOBALS"}["wweotjvr"]}=="delete_dhru_server"){${${"GLOBALS"}["xqfpontqyvt"]}=(int)$_GET["id"];$wpdb->delete($wpdb->prefix."dhru_servers",array("dhru_server_id"=>${${"GLOBALS"}["xqfpontqyvt"]}));}elseif(${${"GLOBALS"}["wweotjvr"]}=="get_dhru_server_services"){$kenmeb="dhru_server_id";${${"GLOBALS"}["xqfpontqyvt"]}=(int)$_POST["dhru_server_id"];${${"GLOBALS"}["uofczjmv"]}=$this->getDhruServer(${$kenmeb});${"GLOBALS"}["bilsjb"]="json";$vwoolmjnif="services";${${"GLOBALS"}["cufrgfkqrad"]}=$this->getDhruFusionServices($server->server_url,$server->api_username,$server->api_key);${${"GLOBALS"}["uxvohwv"]}=array("status"=>"ok","message"=>"","services"=>array());if(isset(${${"GLOBALS"}["cufrgfkqrad"]}["ERROR"])){${${"GLOBALS"}["uxvohwv"]}["status"]="error";$wqhqkvpo="services";${${"GLOBALS"}["uxvohwv"]}["error"]=${$wqhqkvpo}["ERROR"][0]["MESSAGE"];}elseif(isset(${$vwoolmjnif}["SUCCESS"])){$wenaxgl="json";${$wenaxgl}["services"]=${${"GLOBALS"}["cufrgfkqrad"]}["SUCCESS"][0]["LIST"];}header("Content-type: application/json");die(json_encode(${${"GLOBALS"}["bilsjb"]}));}elseif(${${"GLOBALS"}["wweotjvr"]}=="test_get_account_info"){${"GLOBALS"}["pcwdsonnipw"]="server";${"GLOBALS"}["zdhssen"]="api";${"GLOBALS"}["secefyoio"]="request";${${"GLOBALS"}["pcwdsonnipw"]}=array_map("trim",$_POST["server"]);$husjfffjad="server";$tifsvtgnr="server";${${"GLOBALS"}["zdhssen"]}=new SB_DhruFusion(${$tifsvtgnr}["server_url"],${${"GLOBALS"}["uofczjmv"]}["api_username"],${$husjfffjad}["api_key"]);${${"GLOBALS"}["fllyqbbscpj"]}=$api->action("accountinfo");print strip_tags(print_r(${${"GLOBALS"}["secefyoio"]},1));die();}}public function action_woocommerce_cart_updated(){global$woocommerce;}public function addFilters(){add_filter("woocommerce_add_to_cart_validation",array($this,"filter_woocommerce_add_to_cart_validation"),10,5);add_filter("woocommerce_add_cart_item",array($this,"filter_woocommerce_add_cart_item"),10,2);add_filter("woocommerce_get_cart_item_from_session",array($this,"filter_woocommerce_get_cart_item_from_session"),10,3);add_filter("cron_schedules",array($this,"cron_schedules"));}public function addMetaBoxes(){add_meta_box("dhru-fusion-providers-ms",__("Dhru Fusion Services"),array($this,"metaboxProviders"),"product","side");}public function save_post($product_id){if(!isset($_POST["post_type"])||$_POST["post_type"]!="product")return false;${"GLOBALS"}["ftluykug"]="product_id";if(isset($_POST["dhru_ms_server_id"]))update_post_meta(${${"GLOBALS"}["ftluykug"]},"_dhru_ms_server_id",(int)$_POST["dhru_ms_server_id"]);if(isset($_POST["dhru_fusion_ms_service_id"]))update_post_meta(${${"GLOBALS"}["gdevlqt"]},"_dhru_fusion_ms_service_id",(int)$_POST["dhru_fusion_ms_service_id"]);}public function cron_schedules($chedules){${"GLOBALS"}["ocukteldgxz"]="schedules";$jktqycskmg="schedules";$lpyvkoifu="schedules";${$jktqycskmg}["every_twenty_mins"]=array("interval"=>60*20,"display"=>__("Every Twenty Minutes"));${$lpyvkoifu}["every_ten_mins"]=array("interval"=>60*10,"display"=>__("Every Ten Minutes"));return${${"GLOBALS"}["ocukteldgxz"]};}public function filter_woocommerce_add_to_cart_validation($bool){$blahhtsysm="dhru_service_id";global$woocommerce;${$blahhtsysm}=get_post_meta(${${"GLOBALS"}["gdevlqt"]},"_dhru_fusion_ms_service_id",1);$rvifklom="imei";${"GLOBALS"}["swnyzleykoc"]="dhru_service_id";${"GLOBALS"}["odhuqgi"]="imei";if(empty(${${"GLOBALS"}["swnyzleykoc"]})||${${"GLOBALS"}["jyxsay"]}==-1)return true;if(!isset($_POST["the_imei"])||empty($_POST["the_imei"])){$woocommerce->add_error(__("Please enter a valid imei"));return false;}${${"GLOBALS"}["odhuqgi"]}=trim($_POST["the_imei"]);if(strlen(${$rvifklom})<15||strlen(${${"GLOBALS"}["wbtadywmr"]})>15){$woocommerce->add_error(__("The imei needs to be 15 digits"));return false;}if(!is_numeric(${${"GLOBALS"}["wbtadywmr"]})){$woocommerce->add_error(__("The imei needs to be numeric"));${${"GLOBALS"}["rtwgsneiwy"]}=false;}$wubmxic="bool";return${$wubmxic};}public function filter_woocommerce_add_cart_item($cart_item_data,$cart_item_key){${"GLOBALS"}["pzftwfuxvnd"]="cart_item_data";$jgbocwtyrpl="cart_item_data";if(!isset($_POST["the_imei"])||empty($_POST["the_imei"]))return${${"GLOBALS"}["jhfpkjnye"]};$this->log("filter_woocommerce_add_cart_item");${${"GLOBALS"}["pzftwfuxvnd"]}["imei"]=trim($_POST["the_imei"]);$this->log("adding cart item imei: {$cart_item_data['imei']}");return${$jgbocwtyrpl};}public function filter_woocommerce_get_cart_item_from_session($data,$values,$key){return array_merge(${${"GLOBALS"}["wkebbduwwjv"]},${${"GLOBALS"}["fcjyfb"]});}public function actionAdminMenu(){add_menu_page(__("Woocommerce Dhru Fusion Mutli Server"),__("Woocommerce Dhru Fusion Multi Server"),8,"woocommerce-dhru-fusion-ms",array($this,"pageOptions"));add_submenu_page("woocommerce-dhru-fusion-ms",__("Documentation"),__("Documentation"),"manage_options","woocommerce-dhru-fusion-doc-ms",array($this,"pageDocumentation"));}public function pageOptions(){global$wpdb;${"GLOBALS"}["dtvzzt"]="dhru_servers";${"GLOBALS"}["khznbrrd"]="query";${${"GLOBALS"}["khznbrrd"]}="SELECT * FROM {$wpdb->prefix}dhru_servers ORDER BY creation_date DESC";${${"GLOBALS"}["dtvzzt"]}=$wpdb->get_results(${${"GLOBALS"}["cpimxgkefvf"]});require_once dirname(__FILE__)."/pages/admin/options.php";}public function pageDocumentation(){require_once dirname(__FILE__)."/pages/admin/doc.php";}public function action_woocommerce_add_order_item_meta($item_id,$values){$cynkjoy="values";${"GLOBALS"}["hiukkhyn"]="item_id";$this->log("action_woocommerce_add_order_item_meta");${${"GLOBALS"}["wbtadywmr"]}=isset(${${"GLOBALS"}["fcjyfb"]}["imei"])?${$cynkjoy}["imei"]:$_POST["the_imei"];$this->log("IMEI: $imei");$wonkgq="imei";woocommerce_add_order_item_meta(${${"GLOBALS"}["hiukkhyn"]},"_the_imei",${$wonkgq});woocommerce_add_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"IMEI",${${"GLOBALS"}["wbtadywmr"]});}public function action_woocommerce_before_add_to_cart_button(){global$post;${${"GLOBALS"}["bysgud"]}=(int)get_post_meta($post->ID,"_dhru_fusion_ms_service_id",true);${"GLOBALS"}["lwvuumzmyek"]="service_id";if(!${${"GLOBALS"}["bysgud"]}||${${"GLOBALS"}["lwvuumzmyek"]}==-1)return false;echo " <p>
<label>";_e("IMEI");echo "</label>
<input type=\"text\" id=\"the_imei" name=\"the_imei\" value="" style="width:70%;" />
</p>
";if(get_post_meta($post->ID,"_show_dhru_brand",1)=="true"){echo " <p>
<label>";_e("Brand");echo "</label>
<input type=\"text" name="the_brand\" value="\" />
</p>
";}echo "
";}public function actionWooOrderStatusProcessing($woo_order_id){${"GLOBALS"}["iwaiccuiwe"]="items";${"GLOBALS"}["swbqxxzfjoe"]="woo_order_id";$this->log("Woocommerce changing order to processing, so payment is done");$this->log("order_id: $woo_order_id");${${"GLOBALS"}["gcfxygi"]}=new WC_Order(${${"GLOBALS"}["swbqxxzfjoe"]});${${"GLOBALS"}["zcuqnrjquq"]}=$the_order->get_items();foreach(${${"GLOBALS"}["iwaiccuiwe"]} as${${"GLOBALS"}["pkrudfc"]}=>${${"GLOBALS"}["exqrvsbrg"]}){$oelddxuas="dhru_server_id";${"GLOBALS"}["iswlhayn"]="dhru_fusion_ms_service_id";${"GLOBALS"}["deqmlgrj"]="dhru_fusion_ms_service_id";${${"GLOBALS"}["wbtadywmr"]}=${${"GLOBALS"}["exqrvsbrg"]}["item_meta"]["_the_imei"][0];${"GLOBALS"}["qtsxxxmu"]="item";$ztmqhexfgkpx="status";$this->log("order item imei: $imei");${${"GLOBALS"}["xqfpontqyvt"]}=(int)get_post_meta(${${"GLOBALS"}["exqrvsbrg"]}["product_id"],"_dhru_ms_server_id",true);$dvcmed="dhru_fusion_ms_service_id";${${"GLOBALS"}["deqmlgrj"]}=(int)get_post_meta(${${"GLOBALS"}["qtsxxxmu"]}["product_id"],"_dhru_fusion_ms_service_id",true);$gqevblgmbr="item_id";if(!${${"GLOBALS"}["xqfpontqyvt"]}||${$oelddxuas}==-1){$this->log("dhru server id is invalid or not selected, skipping product id -> {$item['product_id']}");continue;}if(!${${"GLOBALS"}["iswlhayn"]}||${$dvcmed}==-1){$this->log("dhru service provider id is not valid or empty, skipping product id -> {$item['product_id']}");continue;}if(${$ztmqhexfgkpx}=woocommerce_get_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_item_status",1)){if(${${"GLOBALS"}["ajiajbgisk"]}!="cancelled"){$dfwonelwco="item_id";woocommerce_add_order_item_meta(${$dfwonelwco},"_dhru_fusion_order_item_status","pending");woocommerce_add_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response","");}continue;}$this->placeDhruFusionNewOrder(${$gqevblgmbr},${${"GLOBALS"}["wbtadywmr"]},${${"GLOBALS"}["xqfpontqyvt"]},${${"GLOBALS"}["ufzbmvuf"]});update_post_meta($the_order->id,"_dhru_order","yes");}}public function placeDhruFusionNewOrder($woo_order_item_id,$imei,$dhru_server_id,$service_id){$bddembrgk="dhru_server";$wxhkrwlec="service_id";$qrslmu="response";${"GLOBALS"}["smmkgngli"]="dhru_server_id";${"GLOBALS"}["jmeddlje"]="dhru_server";${"GLOBALS"}["oclfwemq"]="para";${$bddembrgk}=$this->getDhruServer(${${"GLOBALS"}["smmkgngli"]});if(empty(${${"GLOBALS"}["jmeddlje"]})){$this->log("The dhru server id does not exists");return false;}${${"GLOBALS"}["qhshbfbcak"]}=new SB_DhruFusion($dhru_server->server_url,$dhru_server->api_username,$dhru_server->api_key);${${"GLOBALS"}["oclfwemq"]}=array("IMEI"=>${${"GLOBALS"}["wbtadywmr"]},"ID"=>${$wxhkrwlec});$this->log("PLACING DHRU FUSION ORDER");${$qrslmu}=$api->action("placeimeiorder",${${"GLOBALS"}["tefyhcuoqyx"]});$this->log(${${"GLOBALS"}["kdtjdor"]});if(isset(${${"GLOBALS"}["kdtjdor"]}["SUCCESS"])){$uzmesxjyz="response";$ckewro="response";$wjqnepmsfd="woo_order_item_id";${"GLOBALS"}["mipagsurescz"]="woo_order_item_id";${"GLOBALS"}["ifyjiefhuvl"]="response";$this->log("adding dhru order reference and status to woocommerce order ($woo_order_item_id)");$gtxubujvyvp="woo_order_item_id";$this->log("dhru fusion referenceid: {$response['SUCCESS'][0]['REFERENCEID']}");${"GLOBALS"}["kskpuqc"]="woo_order_item_id";woocommerce_add_order_item_meta(${${"GLOBALS"}["mipagsurescz"]},"_dhru_fusion_order_item_status","pending");${"GLOBALS"}["kmmkgcopsy"]="response";woocommerce_add_order_item_meta(${${"GLOBALS"}["kskpuqc"]},"_dhru_fusion_order_id",${$ckewro}["SUCCESS"][0]["REFERENCEID"]);woocommerce_add_order_item_meta(${$gtxubujvyvp},"_dhru_fusion_order_response",sprintf("Message: %s<br/>Reference Id: %d",${${"GLOBALS"}["ifyjiefhuvl"]}["SUCCESS"][0]["MESSAGE"],${${"GLOBALS"}["kmmkgcopsy"]}["SUCCESS"][0]["REFERENCEID"]));woocommerce_add_order_item_meta(${${"GLOBALS"}["srcngttech"]},"Unlock status:",${${"GLOBALS"}["kdtjdor"]}["SUCCESS"][0]["MESSAGE"]);woocommerce_add_order_item_meta(${$wjqnepmsfd},"Unlock Reference ID:",${$uzmesxjyz}["SUCCESS"][0]["REFERENCEID"]);}}public function getOrderDetails($dhru_ref_id,$dhru_server_id){$fhlfgmbedr="dhru_server_id";${"GLOBALS"}["nmesnddgquoe"]="para";$bpsedbreg="dhru_ref_id";${"GLOBALS"}["eemagdqc"]="request";${${"GLOBALS"}["xbmevqhjngf"]}=$this->getDhruServer(${$fhlfgmbedr});${"GLOBALS"}["nwdrwoxyba"]="para";if(empty(${${"GLOBALS"}["xbmevqhjngf"]}))return false;$this->log("getting dhru fusion order details: ".${${"GLOBALS"}["uisypssllh"]});${${"GLOBALS"}["qhshbfbcak"]}=new SB_DhruFusion($dhru_server->server_url,$dhru_server->api_username,$dhru_server->api_key);${${"GLOBALS"}["nwdrwoxyba"]}=array("ID"=>${$bpsedbreg});${${"GLOBALS"}["eemagdqc"]}=$api->action("getimeiorder",${${"GLOBALS"}["nmesnddgquoe"]});return${${"GLOBALS"}["fllyqbbscpj"]};}public function getDhruFusionProviders(){}public function getDhruFusionServices($server_url,$username,$api_key){${"GLOBALS"}["orcvojlih"]="server_url";$pwgmftauj="username";$this->log("Connection to dhru fusion server to get services list");${"GLOBALS"}["eztemorap"]="api_key";${"GLOBALS"}["stnwagdodwg"]="api_key";$this->log("Dhru fusion url: ".${${"GLOBALS"}["kdwgrprmxo"]});${"GLOBALS"}["kamxlwl"]="api";$this->log("dhru api username: ".${$pwgmftauj});$rvpjjgx="request";$this->log("dhru api key: ".${${"GLOBALS"}["stnwagdodwg"]});${${"GLOBALS"}["kamxlwl"]}=new SB_DhruFusion(${${"GLOBALS"}["orcvojlih"]},${${"GLOBALS"}["jqwjqvjr"]},${${"GLOBALS"}["eztemorap"]});${$rvpjjgx}=$api->action("imeiservicelist");return${${"GLOBALS"}["fllyqbbscpj"]};}public function wrapCheckDhruOrders(){${"GLOBALS"}["dpcdxnl"]="orders";require_once WP_PLUGIN_DIR."/woocommerce/classes/class-wc-order.php";${"GLOBALS"}["pghjstutryw"]="order";${"GLOBALS"}["jllbdmg"]="orders";$this->log("STARTING CRON TASK --> CHECKING ORDERS STATUS");${${"GLOBALS"}["jllbdmg"]}=get_posts(array("numberposts"=>-1,"post_type"=>"shop_order","orderby"=>"post_date","order"=>"DESC","tax_query"=>array(array("taxonomy"=>"shop_order_status","field"=>"slug","terms"=>"processing")),"meta_key"=>"_dhru_order","meta_value"=>"yes"));$this->log("Total Orders to process: ".count(${${"GLOBALS"}["dpcdxnl"]}));foreach(${${"GLOBALS"}["xgumbciuy"]} as${${"GLOBALS"}["pghjstutryw"]}){${"GLOBALS"}["obwdxttouv"]="all_items_completed";$fxvidufcfg="order_dhru_response";$gcgtecd="order_dhru_response";${${"GLOBALS"}["hhnclvnfvwi"]}=new WC_Order($order->ID);${$fxvidufcfg}="";${${"GLOBALS"}["obwdxttouv"]}=true;foreach($woo_order->get_items()as${${"GLOBALS"}["pkrudfc"]}=>${${"GLOBALS"}["exqrvsbrg"]}){${"GLOBALS"}["hyvivouvmy"]="res";${"GLOBALS"}["duoxipwsxy"]="dhru_order_id";$dtqjdvop="dhru_order_id";${"GLOBALS"}["kpoozomwf"]="order_item_status";${$dtqjdvop}=woocommerce_get_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_id",1);$neokhtbvmavg="res";if(!${${"GLOBALS"}["duoxipwsxy"]}){$this->log("the woocommerce order_item_id ($item_id) has not a dhru fusion order id, it is --> $dhru_order_id");continue;}${${"GLOBALS"}["kpoozomwf"]}=woocommerce_get_order_item_meta(${${"GLOBALS"}["exqrvsbrg"]}["id"],"_dhru_fusion_order_item_status",1);if(${${"GLOBALS"}["roncnoreob"]}=="completed")continue;$vxropmokny="item";$qdkvyzegr="dhru_order_id";$this->log("dhru fusion reference_id: $dhru_order_id");${${"GLOBALS"}["xqfpontqyvt"]}=(int)get_post_meta(${$vxropmokny}["product_id"],"_dhru_ms_server_id",1);${${"GLOBALS"}["hyvivouvmy"]}=$this->getOrderDetails(${$qdkvyzegr},${${"GLOBALS"}["xqfpontqyvt"]});$this->log("order details response");$this->log(${${"GLOBALS"}["httvkazb"]});if(isset(${$neokhtbvmavg}["SUCCESS"])){${"GLOBALS"}["kqvimgk"]="res";$opdcrizv="res";if(((int)${${"GLOBALS"}["kqvimgk"]}["SUCCESS"][0]["STATUS"])==4){woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_item_status","completed");${"GLOBALS"}["yrbeietiq"]="item_id";woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response",${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"]);$fplclvnj="res";woocommerce_update_order_item_meta(${${"GLOBALS"}["yrbeietiq"]},"Unlock status:",${$fplclvnj}["SUCCESS"][0]["CODE"]);${${"GLOBALS"}["oadbmncxd"]}.=${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"];}elseif((int)${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["STATUS"]==3){${"GLOBALS"}["eyjdec"]="res";$wgujffjpx="item_id";woocommerce_update_order_item_meta(${$wgujffjpx},"_dhru_fusion_order_item_status","failed");woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"_dhru_fusion_order_response",${${"GLOBALS"}["eyjdec"]}["SUCCESS"][0]["CODE"]);woocommerce_update_order_item_meta(${${"GLOBALS"}["pkrudfc"]},"Unlock status:",${${"GLOBALS"}["httvkazb"]}["SUCCESS"][0]["CODE"]);$tqnfxlybgd="res";${${"GLOBALS"}["oadbmncxd"]}.=${$tqnfxlybgd}["SUCCESS"][0]["CODE"];$this->log("order filed, code = 3, not found");}elseif(empty(${$opdcrizv}["SUCCESS"][0]["STATUS"])){${"GLOBALS"}["juflpvri"]="item_id";${"GLOBALS"}["fxiqcofwnqq"]="item_id";${"GLOBALS"}["qpyslm"]="order_dhru_response";$hgvywlnvbqn="item_id";woocommerce_update_order_item_meta(${${"GLOBALS"}["juflpvri"]},"_dhru_fusion_order_item_status","pending");woocommerce_update_order_item_meta(${${"GLOBALS"}["fxiqcofwnqq"]},"_dhru_fusion_order_response","The order has no status code");woocommerce_update_order_item_meta(${$hgvywlnvbqn},"Unlock status:","The order has no status code");$this->log("order null");$weewrwcaecc="all_items_completed";${${"GLOBALS"}["qpyslm"]}.="The order has no status code";${$weewrwcaecc}=false;}else{${"GLOBALS"}["mphndo"]="item_id";$ybyhswf="item_id";${"GLOBALS"}["eafihmb"]="order_dhru_response";$this->log("order UNKNOW CODE");woocommerce_update_order_item_meta(${$ybyhswf},"_dhru_fusion_order_item_status","pending");woocommerce_update_order_item_meta(${${"GLOBALS"}["mphndo"]},"_dhru_fusion_order_response","");$seycuvyj="item_id";${"GLOBALS"}["ukdcsib"]="all_items_completed";woocommerce_update_order_item_meta(${$seycuvyj},"Unlock status:","The order has no status code-");${${"GLOBALS"}["eafihmb"]}.="The order has no status code";${${"GLOBALS"}["ukdcsib"]}=false;}}elseif(isset(${${"GLOBALS"}["httvkazb"]}["ERROR"])){$amovdh="item_id";$yolukrrlw="res";${"GLOBALS"}["ubhrtbm"]="item_id";$xprwao="res";$aouyzgvuw="order_dhru_response";woocommerce_update_order_item_meta(${${"GLOBALS"}["ubhrtbm"]},"_dhru_fusion_order_item_status","failed");$iyiivfc="res";woocommerce_update_order_item_meta(${$amovdh},"_dhru_fusion_order_response",sprintf("%s<br/>%s",${${"GLOBALS"}["httvkazb"]}["ERROR"][0]["MESSAGE"],${$xprwao}["ERROR"][0]["FULL_DESCRIPTION"]));${$aouyzgvuw}.=sprintf("%s<br/>%s",${$yolukrrlw}["ERROR"][0]["MESSAGE"],${$iyiivfc}["ERROR"][0]["FULL_DESCRIPTION"]);}}update_post_meta($woo_order->id,"_dhru_fusion_order_response",${$gcgtecd});if(${${"GLOBALS"}["pibtvw"]}){$woo_order->update_status("completed");}}die("CRON JOB ENDS");}public function metaboxProviders($post){${"GLOBALS"}["ljkyocme"]="dhru_servers";global$wpdb;${${"GLOBALS"}["ljkyocme"]}=$this->getDhruServers();${${"GLOBALS"}["dvqnrfdlwj"]}=get_post_meta($post->ID,"_dhru_ms_server_id",1);${${"GLOBALS"}["ufzbmvuf"]}=get_post_meta($post->ID,"_dhru_fusion_ms_service_id",1);require_once dirname(__FILE__)."/pages/admin/metabox.php";}public function woocommerce_after_order_shipping($order){echo "</div>
<div class=\"order_data_column\">
<h4>";_e("Dhru Fusion Order Details");echo "</h4>
";print get_post_meta($order->id,"_dhru_fusion_order_response",1);}public function woocommerce_after_template_part($template_name,$template_path,$located,$args){$this->log("woocommerce_after_template_part");$this->log(${${"GLOBALS"}["oiiflmyf"]});${${"GLOBALS"}["gplrtwsugi"]}=get_post_meta(@${${"GLOBALS"}["oiiflmyf"]}["order"]->id,"_dhru_fusion_order_response",1);print${${"GLOBALS"}["gplrtwsugi"]};}public function action_woocommerce_email_order_meta($order,$false){$this->log("action_woocommerce_email_order_meta
=========================================");$this->log(${${"GLOBALS"}["orvhvagi"]});${"GLOBALS"}["evwywhrv"]="dhru_code";${${"GLOBALS"}["evwywhrv"]}=get_post_meta($order->id,"_dhru_fusion_order_response",1);echo " <h2>";_e("Unlock Details");echo "</h2>
<p>";print${${"GLOBALS"}["gplrtwsugi"]};echo "</p>
";}public function log($str){$omskplp="fh";${${"GLOBALS"}["zhwrmvvir"]}=dirname(__FILE__).SB_DS."dhru-ms.log";${${"GLOBALS"}["mkpgerb"]}=null;${"GLOBALS"}["cngflvpdtjxh"]="date";${"GLOBALS"}["gxsgcnmdi"]="str";if(file_exists(${${"GLOBALS"}["zhwrmvvir"]})){${"GLOBALS"}["eflrimcdhbt"]="fh";${${"GLOBALS"}["eflrimcdhbt"]}=fopen(${${"GLOBALS"}["zhwrmvvir"]},"a+");}else{${"GLOBALS"}["jsfjxsww"]="fh";${${"GLOBALS"}["jsfjxsww"]}=fopen(${${"GLOBALS"}["zhwrmvvir"]},"w+");}${${"GLOBALS"}["cngflvpdtjxh"]}=date("Y-m-d H:i:s");fwrite(${$omskplp},"[$date]#".print_r(${${"GLOBALS"}["gxsgcnmdi"]},1)."
");fclose(${${"GLOBALS"}["mkpgerb"]});}public function getDhruServers($status='enabled'){${"GLOBALS"}["heddtqpril"]="status";${"GLOBALS"}["fughxsg"]="query";global$wpdb;${${"GLOBALS"}["cpimxgkefvf"]}=sprintf("SELECT * FROM {$wpdb->prefix}dhru_servers %s ORDER BY creation_date DESC",(${${"GLOBALS"}["heddtqpril"]})?"WHERE status = '$status'":"");return$wpdb->get_results(${${"GLOBALS"}["fughxsg"]});}public function getDhruServer($server_id){global$wpdb;${${"GLOBALS"}["cpimxgkefvf"]}="SELECT * FROM {$wpdb->prefix}dhru_servers WHERE dhru_server_id = $server_id";return$wpdb->get_row(${${"GLOBALS"}["cpimxgkefvf"]});}}${${"GLOBALS"}["iqymegem"]}=null;register_deactivation_hook(__FILE__,array("WooCommerceDhruFusionMS","onDeactivate"));register_activation_hook(__FILE__,array("WooCommerceDhruFusionMS","onActivate"));function __wcdfms(){global$wcdfms;${${"GLOBALS"}
["iqymegem"]}=new WooCommerceDhruFusionMS();if(isset($_GET["process_dhru_orders"])){${"GLOBALS"}["xurhjfuvcpc"]="wcdfms";add_action("init",array(${${"GLOBALS"}["xurhjfuvcpc"]},"wrapCheckDhruOrders"));}}add_action("woocommerce_loaded","__wcdfms");
?>
Function Calls
None |
Stats
MD5 | 8ac88d7e427f69ce9db2a82eebf334fb |
Eval Count | 0 |
Decode Time | 102 ms |