Changeset 3057544
- Timestamp:
- 03/24/2024 05:10:54 AM (4 months ago)
- Location:
- safe-ai-malware-protection-for-wp/trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
safe-ai-malware-protection-for-wp/trunk/README.txt
r3057167 r3057544 4 4 Requires at least: 5.0 5 5 Tested up to: 6.4.3 6 Stable tag: 1.0. 26 Stable tag: 1.0. 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 70 70 = 1.0.2 = 71 71 Update the version of the plugin for testing WordPress.org review team 72 73 74 75 76 77 -
safe-ai-malware-protection-for-wp/trunk/changelog.txt
r3057167 r3057544 6 6 = 1.0.2 = 7 7 Update the version of the plugin for testing WordPress.org review team 8 9 10 11 12 -
safe-ai-malware-protection-for-wp/trunk/includes/class-deployment-script.php
r3055224 r3057544 25 25 fclose($file); 26 26 } 27 28 public function move_folder_contents($sourceFolder, $destinationFolder)29 {30 // Get the list of files and directories in the source folder31 $items = scandir($sourceFolder);32 33 // Loop through each item34 foreach ($items as $item) {35 // Skip special directories (current and parent)36 if ($item == '.' || $item == '..') {37 continue;38 }39 40 // Build the full paths for the source and destination41 $sourcePath = $sourceFolder . '/' . $item;42 $destinationPath = $destinationFolder . '/' . $item;43 44 // Check if the item is a file or a directory45 if (is_file($sourcePath)) {46 // If it's a file, move it to the destination folder47 rename($sourcePath, $destinationPath);48 } elseif (is_dir($sourcePath)) {49 // If it's a directory, create the directory in the destination folder50 mkdir($destinationPath);51 52 // Recursively move the contents of the subfolder53 $this->move_folder_contents($sourcePath, $destinationPath);54 55 // Remove the empty source directory56 rmdir($sourcePath);57 }58 }59 }60 27 } -
safe-ai-malware-protection-for-wp/trunk/includes/class-malware-virus-scanner-plugin.php
r3057167 r3057544 74 74 $this->version = MVSP_PLUGIN_VERSION; 75 75 } else { 76 $this->version = '1.0. 2';76 $this->version = '1.0.'; 77 77 } 78 78 $this->plugin_name = 'malware-virus-scanner-plugin'; -
safe-ai-malware-protection-for-wp/trunk/includes/class-mvsp-export-db.php
r3055224 r3057544 9 9 { 10 10 require_once ABSPATH . 'wp-load.php'; 11 12 11 global $wpdb; 13 12 13 // Output file name and path 14 14 $exported_db_filename = get_option('mvsp_auth_token'); 15 16 // Use $wpdb to get database connection details 17 $db_user = $wpdb->dbuser; 18 $db_pass = $wpdb->dbpassword; 19 $db_name = $wpdb->dbname; 20 $db_host = $wpdb->dbhost; 21 22 // Use $wpdb to establish database connection 23 $wpdb->dbh = new mysqli($db_host, $db_user, $db_pass, $db_name); 24 25 // Check for connection error using $wpdb 26 if ($wpdb->dbh->connect_error) { 27 die(esc_html__('Connection failed: ', 'malware-virus-scanner-plugin') . esc_html($wpdb->dbh->connect_error)); 15 $output_file = $exported_db_filename.'.txt'; 16 17 // Open the output file for writing 18 $file = fopen($output_file, 'w'); 19 20 // Write the SQL dump header 21 fwrite($file, "-- phpMyAdmin SQL Dump\n"); 22 fwrite($file, "-- version 5.2.0\n"); 23 fwrite($file, "-- https://www.phpmyadmin.net/\n"); 24 fwrite($file, "--\n"); 25 fwrite($file, "-- Host: " . DB_HOST . "\n"); 26 fwrite($file, "-- Generation Time: " . date("M d, Y \a\\t H:i A") . "\n"); 27 fwrite($file, "-- Server version: " . $wpdb->db_version . "\n"); 28 fwrite($file, "-- PHP Version: " . phpversion() . "\n\n"); 29 30 // Set SQL mode and start transaction 31 fwrite($file, "SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\n"); 32 fwrite($file, "START TRANSACTION;\n"); 33 fwrite($file, "SET time_zone = \"+00:00\";\n\n"); 34 35 // Set character set settings 36 fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n"); 37 fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n"); 38 fwrite($file, "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n"); 39 fwrite($file, "/*!40101 SET NAMES utf8mb4 */;\n\n"); 40 41 // Write database information 42 fwrite($file, "--\n-- Database: `" . DB_NAME . "`\n--\n\n"); 43 44 // Iterate through each table and export structure and data 45 $tables = $wpdb->get_results("SHOW TABLES", ARRAY_N); 46 foreach ($tables as $table_row) { 47 $table = $table_row[0]; 48 49 // Export table structure 50 $table_structure = $wpdb->get_var("SHOW CREATE TABLE $table"); 51 fwrite($file, "$table_structure;\n\n"); 52 53 // Export table data 54 $data_rows = $wpdb->get_results("SELECT * FROM $table", ARRAY_A); 55 foreach ($data_rows as $data_row) { 56 $prepared_values = array_map(array($wpdb, 'prepare'), array_fill(0, count($data_row), "%s"), $data_row); 57 $insert_query = $wpdb->prepare("INSERT INTO $table VALUES (" . implode(', ', $prepared_values) . ")", $prepared_values); 58 fwrite($file, $insert_query . ";\n"); 59 } 60 61 fwrite($file, "\n"); 28 62 } 29 30 $dumpFilePath = $exported_db_filename . '.sql'; 31 $command = "mysqldump --host=$db_host --user=$db_user --password=$db_pass --databases $db_name > $dumpFilePath"; 32 exec($command); 33 34 // Close the database connection 35 $wpdb->dbh->close(); 36 37 return $dumpFilePath; 63 64 // Close the output file 65 fclose($file); 66 67 return $output_file; 38 68 } 39 69 -
safe-ai-malware-protection-for-wp/trunk/includes/class-mvsp-wp-info.php
r3055224 r3057544 101 101 return $outputFile; 102 102 } 103 104 // Function to send the encrypted file to another API105 public static function send_encrypted_file($encryptedFile, $apiEndpoint)106 {107 // Create a Guzzle HTTP client108 $client = new \GuzzleHttp\Client();109 110 try {111 // Send a POST request with the encrypted file112 $response = $client->post($apiEndpoint, [113 'multipart' => [114 [115 'name' => 'encrypted_file',116 'contents' => fopen($encryptedFile, 'r'),117 'filename' => basename($encryptedFile),118 ],119 ],120 ]);121 122 // Print the response from the API123 echo esc_html( $response->getBody() );124 } catch (\Exception $e) {125 // Handle exceptions126 echo 'Error: ' . esc_html( $e->getMessage() );127 }128 }129 103 } -
safe-ai-malware-protection-for-wp/trunk/includes/class-store-authorized-token.php
r3055224 r3057544 8 8 public static function store_token(string $string) 9 9 { 10 11 12 13 10 14 $token = get_option('mvsp_auth_token'); 11 15 if (!$token) { 12 add_option('mvsp_auth_token', $string); 16 // If not, add the token 17 add_option('mvsp_auth_token', $sanitized_string); 13 18 } 14 19 20 // Always return the stored token 15 21 return get_option('mvsp_auth_token'); 16 22 } 17 18 public static function set_aut orized()23 24 public static function set_autorized() 19 25 { 26 20 27 $token = get_option('mvsp_auth_token'); 21 if ($token) { 28 29 // Check if the token exists and is not empty 30 if ($token && !empty($token)) { 31 // Add the authorized flag 22 32 add_option('mvsp_site_connected', true); 23 33 } -
safe-ai-malware-protection-for-wp/trunk/malware-virus-scanner-plugin.php
r3057167 r3057544 17 17 * Plugin URI: https://wpsafe.ai/ 18 18 * Description: WP Safe AI - Stress-Free WordPress Malware Cleaner. 19 * Version: 1.0. 219 * Version: 1.0. 20 20 * Author: BoomDevs 21 21 * Author URI: https://boomdevs.com/ … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define('MVSP_PLUGIN_VERSION', '1.0. 2');36 define('MVSP_PLUGIN_VERSION', '1.0.'); 37 37 38 38 /**
Note: See TracChangeset
for help on using the changeset viewer.