public function __construct($ip = '', $cpaneluser = '', $cpanelpass = '') { parent::__construct($ip, $cpaneluser, $cpanelpass); }
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 = get_cpanel_acc(_post('acc')); $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,false); $cpanel = HW_CPanel::loadacct_instance(_post('acc'), 0); //add an ftp if (_post('task') == 'add_ftp') { //authorize #$cpanel_ftp = new HW_CPanel_Ftp($host, $cpaneluser, $cpaneluser_pass); $cpanel_ftp = HW_CPanel_Ftp::init($cpanel); $ftp = array('user' => _post('ftp_username'), 'pass' => _post('ftp_passwd'), 'quota' => _post('ftp_quota'), 'homedir' => _post('ftp_homedir')); $res = $cpanel_ftp->create_ftp($ftp); add_message($res); if (is_string($res)) { $res = json_decode($res); } if (isset($res->cpanelresult->event->result) && $res->cpanelresult->event->result == '1') { //success ftp creation //save ftp acct to db if (_post('acc')) {
/** * create user acct token * @param $data */ function create_cpuser_token($data) { $cpanel = new HW_CPanel(); $res = $cpanel->create_cpuser_session(_get('id')); ajax_output($res); }
/** * @param $name * @return HW_CPanel_Mysql */ public function get_instance($name) { static $instances = array(); if ($name == 'mysql' && !isset($instances[$name])) { $instances[$name] = new HW_CPanel_Mysql($this->host, $this->cpaneluser, $this->cpaneluser_pass); } elseif ($name == 'user' && !isset($instances[$name])) { $instances[$name] = new HW_CPanel_User($this->host, $this->cpaneluser, $this->cpaneluser_pass); } elseif ($name == 'fileman' && !isset($instances[$name])) { $instances[$name] = HW_CPanel_Fileman::loadacct($this->acc_id, true); } elseif ($name == 'fileman_no_auth' && !isset($instances[$name])) { $instances[$name] = HW_CPanel_Fileman::loadacct($this->acc_id, false); } elseif ($name == 'fileman1' && !isset($instances[$name])) { $instances[$name] = new HW_CPanel_Fileman($this->host, $this->cpaneluser, $this->cpaneluser_pass); } elseif ($name == 'cpanel' && !isset($instances[$name])) { $instances[$name] = HW_CPanel::loadacct_instance($this->acc_id, false); } elseif ($name == 'ftp' && !isset($instances[$name])) { $instances[$name] = new HW_CPanel_Ftp($this->host, $this->cpaneluser, $this->cpaneluser_pass); } return isset($instances[$name]) ? $instances[$name] : null; }