Ejemplo n.º 1
0
global $DB;
//form action
if (isset($_POST['submit']) && _post('task') == 'save_acc') {
    $host = isset($_POST['cpanel_host']) ? $_POST['cpanel_host'] : '';
    $domain = isset($_POST['cpanel_domain']) ? $_POST['cpanel_domain'] : '';
    $user = isset($_POST['cpanel_user']) ? $_POST['cpanel_user'] : '';
    $pass = isset($_POST['cpanel_pass']) ? $_POST['cpanel_pass'] : '';
    $email = isset($_POST['cpanel_email']) ? $_POST['cpanel_email'] : '';
    //update acc
    $data = array('cpanel_host' => $host, 'cpanel_domain' => $domain, 'cpanel_user' => $user, 'cpanel_pass' => encrypt($pass), 'cpanel_email' => $email);
    $res = update_cpacct($data, isset($_POST['acc_id']) ? $_POST['acc_id'] : '');
    #var_dump($DB->Affected_Rows());
}
//edit acc
if (isset($_GET['id']) && is_numeric($_GET['id']) && _get('do') == 'edit') {
    $current = get_cpanel_acc(_get('id'));
    if (!count($current)) {
        unset($current);
    }
}
//delete acc
if (isset($_GET['id']) && _get('do') == 'delete') {
    del_cpanel_acc(_get('id'));
}
//list rows
$accts = list_whm_accts();
//get root account
$root_acc = get_cpanel_info(array('cpanel_user' => 'root'));
//update sqlite db used for cron job of backup
if (_get('do') == 'update_portable_db') {
    $db = new SQLite3('db/db');
Ejemplo n.º 2
0
include_once 'includes/common/require.php';
_load_class('cpanel');
_load_class('fileman', 'cpanel');
//check user login
check_user_session();
global $DB;
$task = _post('task');
if (isset($_POST['submit'])) {
    //validation
    if (_post('acc') == '') {
        add_message("Please select which account you want to use ?");
        goto invalid_form;
    }
    //get cpanel credentials
    $acc_id = _post('acc');
    $acc = get_cpanel_acc($acc_id);
    $host = isset($acc['cpanel_host']) ? $acc['cpanel_host'] : '';
    $cpaneluser = isset($acc['cpanel_user']) ? $acc['cpanel_user'] : "";
    $cpaneluser_pass = isset($acc['cpanel_pass']) ? decrypt($acc['cpanel_pass']) : '';
    $email_domain = isset($acc['cpanel_email']) ? $acc['cpanel_email'] : '*****@*****.**';
    //authorize
    $cpanel = new HW_CPanel($host, $cpaneluser, $cpaneluser_pass);
}
if (isset($cpanel)) {
    /**
     * upload file
     */
    if ($task == 'upload') {
        #$cpanel_file = HW_CPanel_Fileman::init($cpanel);
        $cpanel_file = HW_CPanel_Fileman::loadacct($acc_id);
        //start uploading file
Ejemplo n.º 3
0
/**
 * list users from any wordpress site
 * @param $acc_id
 * @param string $subdomain
 * @param int $output_json (0|1)
 */
function hw_wptool_list_users($acc_id, $output_json = 0, $subdomain = '')
{
    $acc = get_cpanel_acc($acc_id);
    $domain = isset($acc['cpanel_domain']) ? $acc['cpanel_domain'] : '';
    if (empty($domain)) {
        return;
    }
    //update wp tool
    $res = hw_upload_wptool($acc_id, $subdomain);
    ajax_output($res);
    //run this file
    $url = rtrim($domain, '/') . '/' . HW_WP_TOOL_FILE . '?do=list_users&json=1&acc=' . $acc_id;
    $res = curl_post($url, array('subdomain' => $subdomain));
    return (array) json_decode($res);
}