Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.145.85.233
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/hc_php/unversioned/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/hc_php/unversioned/SoftaculousPHPSwitcher.php
<?php

function get_php_version($cpanel, $domain) {
    try {
        $phpVerResp = $cpanel->uapi(
            'PHPSelector', 'get_php_version_for_domain',
            array(
                'domain'    => $domain,
            )
        );
        return $phpVerResp["cpanelresult"]["result"]["data"]["version"];
    } catch (Exception $e) {
        $err = $e->getMessage();
        error_log("SOFTACULOUS can\'t get PHP version for domain: $domain - $err");
    }
}

function get_available_php_versions($cpanel) {
    try {
        $resp = $cpanel->uapi(
            'PHPSelector', 'list_php_versions',
        );
        $resp_parsed = print_r( $resp, true );
        return $resp["cpanelresult"]["result"]["data"]["versions"];
    } catch (Exception $e) {
        $err = $e->getMessage();
        error_log("SOFTACULOUS can't get php versions, live api error: $err");
    }
    return [];
}

function set_php_version($cpanel, $domain, $ver) {
    try {
        $phpVerResp = $cpanel->uapi(
            'PHPSelector', 'set_php_version_for_domain',
            array(
                'domain'    => $domain,
                "php"       => $ver,
            )
        );
        return $phpVerResp["cpanelresult"]["result"]["data"]["version"];
    } catch (Exception $e) {
        $err = $e->getMessage();
        error_log("SOFTACULOUS can't set php version $ver for domain $domain, live api error: $err");
    }
}

function get_extensions($cpanel, $domain, $ver) {
    try {
        $phpVerResp = $cpanel->uapi(
            'PHPSelector', 'get_php_extensions_for_domain',
            array(
                'domain'    => $domain,
                "php"       => $ver,
            )
        );
        return $phpVerResp["cpanelresult"]["result"]["data"];
    } catch (Exception $e) {
        $err = $e->getMessage();
        error_log("SOFTACULOUS error api: $err");
    }
    return [];
}


function resolve_domain($cpanel, $proxy_domain) {
    try {
        $res = $cpanel->uapi(
            'DomainInfo', 'domains_data',
            array(
                'format' => "list",
            )
        );
        foreach ($res["cpanelresult"]["result"]["data"] as $domain) {
            if ($domain["domain"] == $proxy_domain) {
                return $domain["servername"];
            }
        }
    } catch (Exception $e) {
        $err = $e->getMessage();
        error_log("SOFTACULOUS error api: $err");
    }
    return $proxy_domain;
}

function normalise_php_version($version) {
	$splited = explode(".", $version, 3);
	if (count($splited) == 3) {
		array_pop($splited);
	}
	return implode(".", $splited);
}


function get_php_version_mapping() {
	$php_map = [];
    @exec("/usr/bin/selectorctl --list --json", $raw, $ret);
    $json_data = json_decode($raw[0], true);
	foreach($json_data['data'] as $php) {
		$php_map[$php["short"]] = $php["full"];
	}
	return $php_map;
}

function resolve_full_php_version($version, $mapping) {
    return $mapping[$version];
}

function HOOK_PHP_VERSION_SWITCH($domain_alias) {
    global $cpanel, $soft, $scripts, $softpanel, $error, $__hooks;
    $domain = resolve_domain($cpanel, $domain_alias);
    $current_php = get_php_version($cpanel, $domain);
    $php_mapping = get_php_version_mapping();
    $current_php_full = resolve_full_php_version($current_php, $php_mapping);
    $cms_php_min = $scripts[$soft]['php_min'];
    $cms_php_max = $scripts[$soft]['php_max'];

    $fit_min_php = 1;
    $fit_max_php = 1;

    if(!empty($cms_php_min)){
        $fit_min_php = sversion_compare($current_php_full, $cms_php_min, '>=');
    }

    if(!empty($cms_php_max)){
        $fit_max_php = sversion_compare($current_php_full, $cms_php_max, '<=');
    }

    if(!$fit_min_php || !$fit_max_php){
        if(!empty($cms_php_min)){
            $fit_min_php = 0;
        }
        if(!empty($cms_php_max)){
            $fit_max_php = 0;
        }
        $available_php_versions = get_available_php_versions($cpanel);
        rsort($available_php_versions);
        foreach($available_php_versions as $ver){
            $ver_full = resolve_full_php_version($ver, $php_mapping);
            if(!$fit_min_php) {
                $fit_min_php = sversion_compare($ver_full, $cms_php_min, '>=');
            }
            if(!$fit_max_php) {
                $fit_max_php = sversion_compare($ver_full, $cms_php_max, '<=');
            }
            // error_log("Check ver: $ver_full max: $cms_php_max, min: $cms_php_min, fit: ($fit_max_php,$fit_min_php)"); // Left for debug
            if($fit_min_php && $fit_max_php){
                // Ask for a confirmation
                if(!checkbox('php_version_select')){
                    $error[] = 'Current PHP version is '.$current_php_full.', unfortunately it does not fit CMS requirements <br />
                                <input type="checkbox" name="php_version_select" '.POSTChecked('php_version_select').' />
                                Do you wish to enable PHP '.$ver_full.' ? (Might cause issues with your existing installations).';
                }else{
                    $current_php = set_php_version($cpanel, $domain, $ver);
                    $current_php_full = resolve_full_php_version($current_php, $php_mapping);
                }
                break;
            }
        }
    }


    $extensions = get_extensions($cpanel, $domain, $current_php);
    foreach ($extensions as $ext_name=>$ext_data){
        if ($ext_data["state"] != "disabled") {
            $__hooks['loaded_extension'][] = $ext_name;
        }
    }

    if(in_array('nd_mysqli', $extensions)){
        $__hooks['loaded_extension'][] = 'mysqli';
    }

    if(in_array('nd_mysql', $extensions)){
        $__hooks['loaded_extension'][] = 'mysql';
    }

    if(in_array('nd_pdo_mysql', $extensions)){
        $__hooks['loaded_extension'][] = 'pdo_mysql';
    }

    define('PHP_EXT_EXHAUSTIVE', 1);
    define('php_version', $current_php_full);

}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit