예제 #1
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '1') {
         $host->useipaddress($this->service, $this->server);
     }
     # send the admin the creation email
     include_once PATH_MODULES . 'email_template/email_template.inc.php';
     $email = new email_template();
     $email->send('admin->host_new_admin', $this->account['id'], $this->service['id'], '', '');
     # send the user the alert email
     include_once PATH_MODULES . 'email_template/email_template.inc.php';
     $email = new email_template();
     $email->send('host_new_user', $this->account['id'], $this->service['id'], '', '');
     return true;
 }
예제 #2
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '1') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = false;
     }
     # ip based?
     if ($this->plugin_data['ipinfo_namebased'] == '1' && $this->ip != false) {
         $cmd = "AddVirtDomain " . "-p " . $this->plugin_data['plan'] . " -c siteinfo,domain=" . $this->service['domain_name'] . "." . $this->service['domain_tld'] . ",admin_user=\"" . $this->login['username'] . "\"" . ",tpasswd=" . $this->login['password'] . ",email=" . $this->account['email'] . " -c ipinfo,namebased=0,ipaddrs=\\[" . $this->ip . "\\]" . $this->nl;
     } else {
         $cmd = "AddVirtDomain " . "-p " . $this->plugin_data['plan'] . " -c siteinfo,domain=" . $this->service['domain_name'] . "." . $this->service['domain_tld'] . ",admin_user=\"" . $this->login['username'] . "\"" . ",tpasswd=" . $this->login['password'] . ",email=" . $this->account['email'];
     }
     return $cmd;
 }
예제 #3
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['type'] == '1') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = $this->server['name_based_ip'];
     }
     # Set the post vars:
     $this->host = 'https://' . $this->server_cfg['host'] . ':' . $this->server_cfg['port'] . '/CMD_ACCOUNT_USER';
     $this->post = "action=create" . "&add=Submit" . "&username={$this->login['username']}" . "&email={$this->account['email']}" . "&passwd={$this->login['password']}" . "&passwd2={$this->login['password']}" . "&domain={$this->service['domain_name']}.{$this->service['domain_tld']}" . "&package={$this->plugin_data['package']}" . "&ip={$this->ip}" . "&notify={$this->server_cfg['notify']}";
     # Connect & get response:
     $result = $this->connect('25');
     # Check the response & Debug
     if ($this->server['debug']) {
         echo "<pre> " . print_r($result) . " </pre>";
     }
     if (!empty($result)) {
         return true;
     } else {
         return false;
     }
 }
예제 #4
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     $cmd = "./create-domain.pl " . " --template " . $this->plugin_data['template'] . " --domain " . $this->service['domain_name'] . "." . $this->service['domain_tld'] . " --user " . $this->login['username'] . " --pass " . $this->login['password'] . " --email " . $this->account['email'];
     ### Get the op tions
     foreach ($this->options as $s) {
         if (empty($this->plugin_data["{$s}"])) {
             $cmd .= " --{$s}";
         }
     }
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '1') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = $this->server['name_based_ip'];
     }
     # ip based?
     if ($this->plugin_data['ipinfo_namebased'] == '0' && $this->ip != false) {
         $cmd .= " --ip " . $this->ip;
     }
     return $cmd;
 }
예제 #5
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '0') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = false;
     }
     # force on/off for specific vars
     $tf_array = array('mailscanner', 'develenv', 'aspmgr', 'scriptsmgr', 'logrotate', 'analog', 'files', 'vhbackup', 'bind', 'imap', 'tomcat4', 'openssl', 'ssi', 'weblogs', 'anonftp', 'majordomo', 'vacation', 'spam_filter', 'sqmail', 'mivamerchant', 'frontpage', 'webalizer', 'proftpd', 'sendmail', 'cgi', 'perl', 'subdomain', 'ssh', 'telnet', 'mysql');
     while (list($key, $val) = each($this->plugin_data)) {
         for ($i = 0; $i < count($tf_array); $i++) {
             if ($tf_array[$i] == $key) {
                 if ($val == 1) {
                     $this->plugin_data[$key] = 'on';
                 } else {
                     $this->plugin_data[$key] = 'off';
                 }
                 $i = 100;
             }
         }
     }
     # tomcat
     if ($this->plugin_data['tomcat4'] == 'on') {
         $this->plugin_data['apache_jail'] = 0;
     }
     # start the command
     $cmd = "AddVirtDomain " . " -c siteinfo" . ",domain=" . $this->service['domain_name'] . "." . $this->service['domain_tld'] . ",admin_user=\"" . $this->login['username'] . "\"" . ",passwd=" . $this->login['password'] . ",tpasswd=" . $this->login['password'] . ",email=" . $this->account['email'];
     # ip based?
     if ($this->plugin_data['ipinfo_namebased'] == '0' && $this->ip == false) {
         $cmd .= " -c ipinfo,namebased=0,ipaddrs=\\[" . $this->ip . "\\]";
         $cmd .= " -c openssl," . $this->plugin_data['openssl'];
         $cmd .= " -c ssh," . $this->plugin_data['ssh'];
         $cmd .= ",jail=" . $this->plugin_data['ssh_jail'];
     } else {
         $cmd .= " -c ipinfo,namebased=1";
     }
     $cmd .= " -c bandwidth" . ",threshold=" . $this->plugin_data['bandwidth_threshold'] . ",rollover=" . $this->plugin_data['bandwidth_rollover'] . " -c mailscanner," . $this->plugin_data['mailscanner'] . ",scan_incoming=" . $this->plugin_data['mailscanner_in'] . ",scan_outgoing=" . $this->plugin_data['mailscanner_out'] . " -c develenv," . $this->plugin_data['develenv'] . " -c aspmgr," . $this->plugin_data['aspmgr'] . " -c scriptsmgr," . $this->plugin_data['scriptsmgr'] . " -c logrotate," . $this->plugin_data['logrotate'] . " -c analog," . $this->plugin_data['analog'] . " -c files," . $this->plugin_data['files'] . " -c vhbackup," . $this->plugin_data['vhbackup'] . " -c bind," . $this->plugin_data['bind'] . " -c imap," . $this->plugin_data['imap'] . " -c tomcat4," . $this->plugin_data['tomcat4'] . " -c ssi," . $this->plugin_data['ssi'] . " -c weblogs," . $this->plugin_data['weblogs'] . " -c anonftp," . $this->plugin_data['anonftp'] . " -c majordomo," . $this->plugin_data['majordomo'] . " -c vacation," . $this->plugin_data['vacation'] . " -c spam_filter," . $this->plugin_data['spam_filter'] . " -c sqmail," . $this->plugin_data['sqmail'] . " -c mivamerchant," . $this->plugin_data['mivamerchant'] . " -c frontpage," . $this->plugin_data['frontpage'] . " -c webalizer," . $this->plugin_data['webalizer'] . " -c proftpd," . $this->plugin_data['proftpd'] . " -c sendmail," . $this->plugin_data['sendmail'] . " -c cgi," . $this->plugin_data['cgi'] . " -c mod_perl," . $this->plugin_data['perl'] . " -c subdomain," . $this->plugin_data['subdomain'] . ",max=" . $this->plugin_data['max_subdomain'] . " -c users,maxusers=" . $this->plugin_data['maxusers'] . " -c ssh," . $this->plugin_data['ssh'] . ",jail=" . $this->plugin_data['ssh_jail'] . " -c telnet," . $this->plugin_data['telnet'] . ",jail=" . $this->plugin_data['telnet_jail'] . " -c apache,on" . ",jail=" . $this->plugin_data['apache_jail'] . " -c diskquota,units=MB" . ",quota=" . $this->plugin_data['diskquota'] . " -c mysql," . $this->plugin_data['mysql'] . ",dbaseadmin=" . $this->login['username'] . ",dbasenum=" . $this->plugin_data['dbasenum'];
     $cmd .= $this->nl;
     return $cmd;
 }
예제 #6
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['hst_type'] == '0') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = $this->server['name_based_ip'];
         $this->plugin_data['fp_ssl'] = 'false';
         $this->plugin_data['ssl'] = 'false';
     }
     # force true/false for specific vars
     $tf_array = array('fp', 'fp_ssl', 'fpauth', 'ssi', 'php', 'cgi', 'perl', 'asp', 'python', 'coldfusion', 'ssl', 'webstat', 'err_docs', 'log_rotate', 'log_compress', 'mail_service', 'www', 'wuscripts', 'webmail');
     while (list($key, $val) = each($this->plugin_data)) {
         for ($i = 0; $i < count($tf_array); $i++) {
             if ($tf_array[$i] == $key) {
                 if ($val == 1) {
                     $this->plugin_data[$key] = 'true';
                 } else {
                     $this->plugin_data[$key] = 'false';
                 }
                 $i = 100;
             }
         }
     }
     #  Create the account
     $cmd = "client.exe" . " -c " . $this->account['username'] . " -name \"" . $this->account['first_name'] . " " . $this->account['last_name'] . "\"" . " -company \"" . $this->account['company'] . "\"" . " -passwd \"" . $this->login['password'] . "\"" . " -email \"" . $this->account['email'] . "\"" . " -state \"" . $this->account['state'] . "\"" . " -pcode \"" . $this->account['zip'] . "\"" . " -notify \"true\"" . $this->nl;
     # Set the account options
     $cmd .= "client_pref.exe -u " . $this->account['username'] . " -create_domains \"false\"" . " -manage_phosting \"true\"" . " -change_limits \"false\"" . " -manage_dns \"false\"" . " -manage_log \"true\"" . " -manage_crontab \"true\"" . " -manage_anonftp \"true\"" . " -manage_webapps \"true\"" . " -manage_maillists \"true\"" . " -manage_sh_access \"true\"" . " -manage_subdomains \"true\"" . " -manage_quota \"false\"" . " -max_dom \"-1\"" . " -disk_space \"-1\"" . " -max_traffic \"-1\"" . " -max_box \"-1\"" . " -max_redir \"-1\"" . " -max_mg \"-1\"" . " -max_resp \"-1\"" . " -max_wu \"-1\"" . " -max_db \"-1\"" . " -max_maillists \"-1\"" . " -max_webapps \"-1\"" . " -max_subdom \"-1\"" . " -ip_pool \"add:" . $this->ip . "\"" . $this->nl;
     # create the domain
     $cmd .= "domain.exe -c " . $this->service['domain_name'] . "." . $this->service['domain_tld'] . " -clogin \"" . $this->account['username'] . "\"" . " -du_passwd \"" . $this->login['password'] . "\"" . " -login \"" . $this->login['username'] . "\"" . " -passwd \"" . $this->login['password'] . "\"" . " -passwd_type \"plain\"" . " -notify \"false\"" . " -status \"true\"" . " -dom_user \"true\"" . " -dns \"true\"" . " -www \"true\"" . " -hosting \"true\"" . " -hst_type \"phys\"" . " -ip \"" . $this->ip . "\"" . " -shell \"" . $this->plugin_data['shell'] . "\"" . " -hard_quota \"" . $this->plugin_data['hard_quota'] . "\"" . " -fp \"" . $this->plugin_data['fp'] . "\"" . " -fp_ssl \"" . $this->plugin_data['fp_ssl'] . "\"" . " -fpauth \"" . $this->plugin_data['fpauth'] . "\"" . " -ssi \"" . $this->plugin_data['ssi'] . "\"" . " -php \"" . $this->plugin_data['php'] . "\"" . " -cgi \"" . $this->plugin_data['cgi'] . "\"" . " -perl \"" . $this->plugin_data['perl'] . "\"" . " -asp \"" . $this->plugin_data['asp'] . "\"" . " -python \"" . $this->plugin_data['python'] . "\"" . " -coldfusion \"" . $this->plugin_data['coldfusion'] . "\"" . " -ssl \"" . $this->plugin_data['ssl'] . "\"" . " -webstat \"" . $this->plugin_data['webstat'] . "\"" . " -err_docs \"" . $this->plugin_data['err_docs'] . "\"" . " -log_rotate \"" . $this->plugin_data['log_rotate'] . "\"" . " -log_bysize \"" . $this->plugin_data['log_bysize'] . "\"" . " -log_bytime \"" . $this->plugin_data['log_bytime'] . "\"" . " -log_max_num \"" . $this->plugin_data['log_max_num'] . "\"" . " -log_compress \"" . $this->plugin_data['log_compress'] . "\"" . " -mail_service \"" . $this->plugin_data['mail_service'] . "\"" . $this->nl;
     # set the domain prefs
     $cmd .= "domain_pref.exe -c " . $this->service['domain_name'] . "." . $this->service['domain_tld'] . " -www \"true\"" . " -disk_space \"" . $this->plugin_data['disk_space'] . "\"" . " -max_traffic \"" . $this->plugin_data['max_traffic'] . "\"" . " -max_box \"" . $this->plugin_data['max_box'] . "\"" . " -mbox_quota \"" . $this->plugin_data['mbox_quota'] . "\"" . " -max_redir \"" . $this->plugin_data['max_redir'] . "\"" . " -max_mg \"" . $this->plugin_data['max_mg'] . "\"" . " -max_resp \"" . $this->plugin_data['max_resp'] . "\"" . " -max_wu \"" . $this->plugin_data['max_wu'] . "\"" . " -max_db \"" . $this->plugin_data['max_db'] . "\"" . " -max_maillists \"" . $this->plugin_data['max_maillists'] . "\"" . " -max_webapps \"" . $this->plugin_data['max_webapps'] . "\"" . " -max_subdom \"" . $this->plugin_data['max_subdom'] . "\"" . " -wuscripts \"" . $this->plugin_data['wuscripts'] . "\"" . " -webmail \"" . $this->plugin_data['webmail'] . "\"" . " -keep_traf_stat \"" . $this->plugin_data['keep_traf_stat'] . "\"";
     return $cmd;
 }
예제 #7
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' && $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['hst_type'] == '0') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = $this->server['name_based_ip'];
         $this->plugin_data['enssl'] = 0;
     }
     #include the easyAdmin class (sorry, that file is encoded)
     include_once PATH_CORE . 'easyadmin.inc.php';
     $e = new EASYADMIN();
     $e->cookiepath = PATH_FILES . 'easyCookie.txt';
     $e->debug = $this->server['debug'];
     $e->host = $this->server_cfg['host'];
     $e->user = $this->server_cfg['user'];
     $e->pass = $this->server_cfg['pass'];
     $e->reseller = $this->server_cfg['reseller'];
     $e->domain = $this->service['domain_name'] . '.' . $this->service['domain_tld'];
     $e->username = $this->login['username'];
     $e->passwd = $this->login['password'];
     $e->email = $this->account['email'];
     $e->ip = $this->ip;
     $e->prod = array('users' => $this->plugin_data['users'], 'quota' => $this->plugin_data['quota'], 'enfp' => $this->plugin_data['enfp'], 'enphp' => $this->plugin_data['enphp'], 'enshell' => $this->plugin_data['enshell'], 'enssi' => $this->plugin_data['enssi'], 'encgi' => $this->plugin_data['encgi'], 'ensuexec' => $this->plugin_data['ensuexec'], 'enthrottle' => $this->plugin_data['enthrottle'], 'enraw' => $this->plugin_data['enraw'], 'enmiva' => $this->plugin_data['enmiva'], 'enssl' => $this->plugin_data['enssl'], 'enfilter' => $this->plugin_data['enfilter'], 'limit' => $this->plugin_data['limit'], 'bwunit' => $this->plugin_data['bwunit'], 'duration' => $this->plugin_data['duration'], 'durationunit' => $this->plugin_data['durationunit']);
     # add
     $result = $e->add();
     # send the user the details
     include_once PATH_MODULES . 'email_template/email_template.inc.php';
     $email = new email_template();
     $email->send('host_new_user', $this->account['id'], $this->service_id, '', '');
     return $result;
 }
예제 #8
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' && $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['network_interface'] == '1') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = $this->server['name_based_ip'];
     }
     #include the webmin class (sorry, that file is encoded)
     include_once PATH_CORE . 'webmin.inc.php';
     $e = new WEBMIN();
     $e->debug = $this->server['debug'];
     $e->host = $this->server_cfg['host'];
     $e->user = $this->server_cfg['user'];
     $e->pass = $this->server_cfg['pass'];
     $e->port = $this->server_cfg['port'];
     $e->ssl = $this->server_cfg['ssl'];
     $e->domain = $this->service['domain_name'] . '.' . $this->service['domain_tld'];
     $e->username = $this->login['username'];
     $e->password = $this->login['password'];
     $e->email = $this->account['email'];
     $e->ip = $this->ip;
     $e->prod = $this->plugin_data;
     # add
     $result = $e->add();
     # send the user the details
     include_once PATH_MODULES . 'email_template/email_template.inc.php';
     $email = new email_template();
     $email->send('host_new_user', $this->account['id'], $this->service_id, '', '');
     return $result;
 }
예제 #9
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # Add the site
     $cmd = "./addvsite -n www " . " -d " . strtolower($this->service['domain_name'] . "." . $this->service['domain_tld']);
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '1') {
         $this->ip = $host->useipaddress($this->service, $this->server);
         $cmd .= " --i " . $this->ip;
         if (!empty($this->options['enable-ssl'])) {
             $cmd .= " --enable-ssl";
         }
     } else {
         $this->ip = $this->server['name_based_ip'];
         $cmd .= " --i " . $this->ip;
     }
     ### Get site options
     foreach ($this->options as $s => $v) {
         if (empty($this->plugin_data["{$s}"])) {
             if ($v != 0 && $v != 1) {
                 $cmd .= " --{$s} {$v}";
             } else {
                 $cmd .= " --{$s}";
             }
         }
     }
     ### Add the user
     $cmd .= $this->nl;
     $cmd .= "./adduser -n www." . strtolower($this->service['domain_name'] . "." . $this->service['domain_tld']) . " -f \"" . $this->account['first_name'] . " " . $this->account['last_name'] . "\"" . " -u " . $this->login['username'] . " -p \"" . $this->login['password'] . "\"" . " -q " . $this->options['quota'] . " -e " . strtolower($this->account['first_name']) . ',' . strtolower($this->account['first_name'] . '.' . $this->account['last_name']);
     return $cmd;
 }
예제 #10
0
 function p_new()
 {
     # get the common server class and set login details
     include_once PATH_MODULES . 'host_server/host_server.inc.php';
     $host = new host_server();
     if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
         $this->login = $host->generate_login($this->service, $this->account, 4, 4, false);
     } else {
         $this->login['username'] = $this->service['host_username'];
         $this->login['password'] = $this->service['host_password'];
     }
     # get ip address
     if ($this->plugin_data['ipinfo_namebased'] == '0') {
         $this->ip = $host->useipaddress($this->service, $this->server);
     } else {
         $this->ip = false;
     }
     # start the command
     $cmd = 'adddomain -s "<xml>';
     # ip based?
     if ($this->plugin_data['ipinfo_namebased'] == '0' && $this->ip != false) {
         $cmd .= '<type>IPBased<type></ip>' . $this->ip . '</ip>';
         $ssl = '1';
     } else {
         $cmd .= '<type>NameBased</type>';
         $ssl = '0';
     }
     # defaults
     while (list($key, $val) = each($this->plugin_data)) {
         if (empty($this->plugin_data[$key])) {
             $this->plugin_data[$key] = '0';
         }
     }
     # construct the remaining XML:
     $cmd .= '<domain>' . $this->service['domain_name'] . '.' . $this->service['domain_tld'] . '</domain>' . '<user>' . $this->login['username'] . '</user>' . '<password>' . $this->login['password'] . '</password>' . '<email>' . $this->account['email'] . '</email>' . '<sendEmail>0</sendEmail><from>na@na.com</from><emailContent>hello</emailContent><subject>hello</subject>' . '<reseller></reseller>' . '<setDns>1</setDns>' . '<dataDrive>' . $this->plugin_data['dataDrive'] . '</dataDrive>' . '<style_name>' . $this->plugin_data['style_name'] . '</style_name>' . '<diskquota>' . $this->plugin_data['diskquota'] . '</diskquota>' . '<maxusers>' . $this->plugin_data['maxusers'] . '</maxusers>' . '<services>' . '<urchin>' . $this->plugin_data['urchin'] . '</urchin>' . '<winfiles>' . $this->plugin_data['winfiles'] . '</winfiles>' . '<winanalog>' . $this->plugin_data['winanalog'] . '</winanalog>' . '<odbc>' . $this->plugin_data['odbc'] . '</odbc>' . '<coldfusion>' . $this->plugin_data['coldfusion'] . '</coldfusion>' . '<frontpage>' . $this->plugin_data['frontpage'] . '</frontpage>' . '<perl>' . $this->plugin_data['perl'] . '</perl>' . '<php>' . $this->plugin_data['php'] . '</php>' . '<mysql>' . $this->plugin_data['mysql'] . '</mysql>' . '<urchin>' . $this->plugin_data['urchin'] . '</urchin>' . '<mssqlodbc>' . $this->plugin_data['odbc'] . '</mssqlodbc>' . '<msftpsvc>' . '<accessread>1</accessread>' . '<accesswrite>1</accesswrite>' . '<connectiontimeout>900</connectiontimeout>' . '<msdosdiroutput>1</msdosdiroutput>' . '<exitmessage>Goodbye</exitmessage>' . '<greetingmessage>Hello</greetingmessage>' . '<maxclientsmessage>TO_MANY_USERS</maxclientsmessage>' . '<allowanonymous>' . $this->plugin_data['allowanonymous'] . '</allowanonymous>' . '<logtype>' . $this->plugin_data['logtype'] . '</logtype>' . '<maxconnections>' . $this->plugin_data['ftp_maxconnections'] . '</maxconnections>' . '<maxconnectionsunlimited>' . $this->plugin_data['ftp_maxconnectionsunlimited'] . '</maxconnectionsunlimited>' . '<msftpsvc>' . $this->plugin_data['msftpsvc'] . '</msftpsvc>' . '</msftpsvc>' . '<w3svc>' . '<ssi>' . $this->plugin_data['ssi'] . '</ssi>' . '<sslc>' . $ssl . '</sslc>' . '<maxconnectionsunlimited>' . $this->plugin_data['w3svc_maxconnectionsunlimited'] . '</maxconnectionsunlimited>' . '<maxconnections>' . $this->plugin_data['w3svc_maxconnections'] . '</maxconnections>' . '<aspnet>0</aspnet>' . '<allowkeepalive>1</allowkeepalive>' . '<appisolated>2</appisolated>' . '<enablereversedns>1</enablereversedns>' . '<accessread>1</accessread>' . '<accesswrite>0</accesswrite>' . '<accesssslflags>0</accesssslflags>' . '<execflag>1</execflag>' . '<enabledirbrowsing>1</enabledirbrowsing>' . '<enabledefaultdoc>1</enabledefaultdoc>' . '<defaultdoc>Default.html</defaultdoc>' . '<connectiontimeout>900</connectiontimeout>' . '<logtype>' . $this->plugin_data['logtype'] . '</logtype>' . '<enablebandwidthquota>' . $this->plugin_data['enablebandwidthquota'] . '</enablebandwidthquota>' . '<maxbandwidth>' . $this->plugin_data['maxbandwidth'] . '</maxbandwidth>' . '<enablecpuquota>' . $this->plugin_data['enablecpuquota'] . '</enablecpuquota>' . '<cpuquota>' . $this->plugin_data['cpuquota'] . '</cpuquota>' . '<serversize>' . $this->plugin_data['serversize'] . '</serversize>' . '<enabledocfooter>0</enabledocfooter>' . '<defaultdocfooter>footer</defaultdocfooter>' . '<footertype>0</footertype>' . '<footerstring></footerstring>' . '<footerfile></footerfile>' . '<w3svc>' . $this->plugin_data['w3svc'] . '</w3svc>' . '</w3svc>' . '<winmail>' . '<autoresponder>' . $this->plugin_data['autoresponder'] . '</autoresponder>' . '<userforwards>' . $this->plugin_data['userforwards'] . '</userforwards>' . '<winmail>' . $this->plugin_data['winmail'] . '</winmail>' . '</winmail>' . '</services>' . '</xml>"';
     return $cmd;
 }
예제 #11
0
    function p_new()
    {
        # get the common server class and set login details
        include_once PATH_MODULES . 'host_server/host_server.inc.php';
        $host = new host_server();
        if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
            # set the limits
            $pass_len = 10;
            $user_len = 12;
            # Generate a new username/login:
            $domain = $this->service['domain_name'] . $this->service['domain_tld'];
            # set the username
            $username = trim($domain);
            $username = preg_replace("/[-_\\.]/", "", $username);
            if (strlen($username) < $user_len) {
                $rand = md5(md5($username) . time());
                $diff = $user_len - strlen($username);
                $username = $username . substr($rand, 0, $diff);
            } else {
                $rand = md5(microtime() . md5($username) . microtime());
                $username = substr($username, 0, $user_len - 5);
                $username = $username . substr($rand, 0, 5);
            }
            # Set the password
            $password = substr(md5(md5(time()) . $domain . $username), 0, 10);
            # Set the user/pass for the XML queries
            $this->login['username'] = $username;
            $this->login['password'] = $password;
        } else {
            # Validate
            $this->login['username'] = $this->service['host_username'];
            $this->login['password'] = $this->service['host_password'];
        }
        # get ip address
        if ($this->plugin_data['ip_based'] == '1') {
            $this->ip = $host->useipaddress($this->service, $this->server);
        } else {
            $this->ip = $this->server['name_based_ip'];
        }
        ####################################################
        ### Assemble the XML for the account creation:	####
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<client>
\t\t\t\t<add>
\t\t\t\t\t<gen_info>
\t\t\t\t\t\t<pname>{$this->account['first_name']} {$this->account['last_name']} ({$this->login['username']})</pname>
\t\t\t\t\t\t<login>{$this->login['username']}</login>
\t\t\t\t\t\t<passwd>{$this->login['password']}</passwd>
\t\t\t\t\t\t<email>{$this->account['email']}</email>
\t\t\t\t\t\t<pcode>00000</pcode>
\t\t\t\t\t\t<country>US</country>
\t\t\t\t\t\t<status>0</status>
\t\t\t\t\t\t<phone>18005551212</phone>
\t\t\t\t\t</gen_info>
\t\t\t\t\t<template-name>{$this->plugin_data['client_template_name']}</template-name>
\t\t\t\t</add>
\t\t\t</client>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        # Get the account id
        if (!($cl_id = $this->getid($result))) {
            return false;
        }
        ##############################
        ### ADD IP TO CLIENT POOL: ###
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<client>
\t\t\t\t<ippool_add_ip>
\t\t\t\t\t<client_id>{$cl_id}</client_id>
\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t</ippool_add_ip>
\t\t\t</client>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        #######################
        ### ADD NEW DOMAIN: ###
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<domain>
\t\t\t\t<add>
\t\t\t\t\t<gen_setup>
\t\t\t\t\t\t<name>{$this->service['domain_name']}.{$this->service['domain_tld']}</name>
\t\t\t\t\t\t<client_id>{$cl_id}</client_id>
\t\t\t\t\t\t<htype>vrt_hst</htype>
\t\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t\t\t<status />
\t\t\t\t\t</gen_setup>
\t\t\t\t\t<hosting>
\t\t\t\t\t\t<vrt_hst>
\t\t\t\t\t\t\t<ftp_login>{$this->login['username']}</ftp_login>
\t\t\t\t\t\t\t<ftp_password>{$this->login['password']}</ftp_password>
\t\t\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t\t\t</vrt_hst>
\t\t\t\t\t</hosting>
\t\t\t\t\t<template-name>{$this->plugin_data['domain_template_name']}</template-name>
\t\t\t\t</add>
\t\t\t</domain>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        # Get the account id
        if (!($domain_id = $this->getid($result))) {
            return false;
        } else {
            $db =& DB();
            $id = $this->service_id;
            $sql = "SELECT * FROM " . AGILE_DB_PREFIX . "service WHERE id = {$id}";
            $rs = $db->Execute($sql);
            $plugin_data = unserialize($rs->fields['host_provision_plugin_data']);
            $plugin_data['account_id'] = $cl_id;
            $plugin_data['domain_id'] = $domain_id;
            $insert = array('host_provision_plugin_data' => serialize($plugin_data), 'host_username' => $this->login['username'], 'host_password' => $this->login['password']);
            $sql = $db->GetUpdateSQL($rs, $insert);
            $result = $db->Execute($sql);
            if ($result === false) {
                global $C_debug;
                $C_debug->error('PLESK_8.php', 'plgn_prov_PLESK_8 :: p_new()', $db->ErrorMsg() . "\r\n\r\n" . $sql);
            }
            # send the user the details
            include_once PATH_MODULES . 'email_template/email_template.inc.php';
            $email = new email_template();
            $email->send('host_new_user', $this->account['id'], $this->service_id, '', '');
        }
        return true;
    }
    function p_new()
    {
        # get the common server class and set login details
        include_once PATH_MODULES . 'host_server/host_server.inc.php';
        $host = new host_server();
        if ($this->service['host_username'] == '' || $this->service['host_password'] == '') {
            # set the limits
            $pass_len = 10;
            $user_len = 12;
            # Generate a new username/login:
            $domain = $this->service['domain_name'] . $this->service['domain_tld'];
            # set the username
            $username = trim($domain);
            $username = preg_replace("/[-_\\.]/", "", $username);
            if (strlen($username) < $user_len) {
                $rand = md5(md5($username) . time());
                $diff = $user_len - strlen($username);
                $username = $username . substr($rand, 0, $diff);
            } else {
                $rand = md5(microtime() . md5($username) . microtime());
                $username = substr($username, 0, $user_len - 5);
                $username = $username . substr($rand, 0, 5);
            }
            # Set the password
            $password = substr(md5(md5(time()) . $domain . $username), 0, 10);
            # Set the user/pass for the XML queries
            $this->login['username'] = $username;
            $this->login['password'] = $password;
        } else {
            # Validate
            $this->login['username'] = $this->service['host_username'];
            $this->login['password'] = $this->service['host_password'];
        }
        # get ip address
        if ($this->plugin_data['ip_based'] == '1') {
            $this->ip = $host->useipaddress($this->service, $this->server);
        } else {
            $this->ip = $this->server['name_based_ip'];
        }
        ####################################################
        ### Assemble the XML for the account creation:	####
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<client> 
\t\t\t\t<add>
\t\t\t\t\t<gen_info> 
\t\t\t\t\t\t<pname>{$this->account['first_name']} {$this->account['last_name']} ({$this->login['username']})</pname>
\t\t\t\t\t\t<login>{$this->login['username']}</login>
\t\t\t\t\t\t<passwd>{$this->login['password']}</passwd> 
\t\t\t\t\t\t<email>{$this->account['email']}</email> 
\t\t\t\t\t\t<pcode>00000</pcode>
\t\t\t\t\t\t<country>US</country> 
\t\t\t\t\t\t<status>0</status>
\t\t\t\t\t\t<phone>18005551212</phone> \t\t\t\t\t
\t\t\t\t\t</gen_info>\t 
\t\t\t\t\t<limits> 
\t\t\t\t\t\t<max_webapps>{$this->plugin_data['max_webapps']}</max_webapps>
\t\t\t\t\t\t<max_maillists>{$this->plugin_data['max_maillists']}</max_maillists>
\t\t\t\t\t\t<max_resp>{$this->plugin_data['max_resp']}</max_resp>
\t\t\t\t\t\t<max_mg>{$this->plugin_data['max_mg']}</max_mg>
\t\t\t\t\t\t<max_redir>{$this->plugin_data['max_redir']}</max_redir>
\t\t\t\t\t\t<mbox_quota>{$this->plugin_data['mbox_quota']}</mbox_quota>
\t\t\t\t\t\t<max_box>{$this->plugin_data['max_box']}</max_box>
\t\t\t\t\t\t<max_db>{$this->plugin_data['max_db']}</max_db>
\t\t\t\t\t\t<max_wu>{$this->plugin_data['max_wu']}</max_wu>
\t\t\t\t\t\t<max_traffic>{$this->plugin_data['max_traffic']}</max_traffic>
\t\t\t\t\t\t<disk_space>{$this->plugin_data['disk_space']}</disk_space>
\t\t\t\t\t\t<max_subdom>{$this->plugin_data['max_subdom']}</max_subdom>
\t\t\t\t\t\t<max_dom>{$this->plugin_data['max_dom']}</max_dom> 
\t\t\t\t\t</limits>\t\t\t\t\t\t
\t\t\t\t</add>   
\t\t\t</client>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        # Get the account id
        $cl_id = $this->getid($result);
        ################################################
        ### SET CLIENT PERMISSIONS & ADD IP TO POOL: ###
        # Loop through the values below and convert to true or false:
        $tf_arr = array('create_domains', 'manage_phosting', 'manage_sh_access', 'manage_not_chroot_shell', 'manage_quota', 'manage_subdomains', 'manage_log', 'manage_anonftp', 'manage_crontab', 'site_builder', 'change_limits', 'manage_dns', 'manage_webapps', 'manage_maillists', 'manage_drweb', 'make_dumps', 'fp', 'fp_auth', 'fp_ssl', 'ssl', 'shell', 'php', 'ssi', 'cgi', 'mod_perl', 'mod_python', 'asp', 'asp_dot_net', 'coldfusion', 'webstat', 'errdocs', 'at_domains');
        for ($i = 0; $i < count($tf_arr); $i++) {
            if ($this->plugin_data["{$tf_arr[$i]}"] == 1) {
                $this->plugin_data["{$tf_arr[$i]}"] = 'true';
            } else {
                $this->plugin_data["{$tf_arr[$i]}"] = 'false';
            }
        }
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<client> 
\t\t\t\t<set>
\t\t\t\t\t<filter>
\t\t\t\t\t\t<id>{$cl_id}</id>
\t\t\t\t\t</filter>
\t\t\t        <values>
\t\t\t          <permissions> 
\t\t\t            <create_domains>{$this->plugin_data['create_domains']}</create_domains>
\t\t\t            <manage_phosting>false</manage_phosting>
\t\t\t            <manage_sh_access>{$this->plugin_data['manage_sh_access']}</manage_sh_access>
\t\t\t            <manage_not_chroot_shell>{$this->plugin_data['manage_not_chroot_shell']}</manage_not_chroot_shell>
\t\t\t            <manage_quota>{$this->plugin_data['manage_quota']}</manage_quota>
\t\t\t            <manage_subdomains>{$this->plugin_data['manage_subdomains']}</manage_subdomains> 
\t\t\t            <manage_log>{$this->plugin_data['manage_log']}</manage_log>
\t\t\t            <manage_anonftp>{$this->plugin_data['manage_anonftp']}</manage_anonftp>
\t\t\t            <manage_crontab>{$this->plugin_data['manage_crontab']}</manage_crontab>
\t\t\t            <site_builder>{$this->plugin_data['site_builder']}</site_builder>
\t\t\t            <change_limits>{$this->plugin_data['change_limits']}</change_limits>
\t\t\t            <manage_dns>{$this->plugin_data['manage_dns']}</manage_dns> 
\t\t\t            <manage_webapps>{$this->plugin_data['manage_webapps']}</manage_webapps>
\t\t\t            <manage_maillists>{$this->plugin_data['manage_maillists']}</manage_maillists>
\t\t\t            <manage_drweb>{$this->plugin_data['manage_drweb']}</manage_drweb>
\t\t\t            <make_dumps>{$this->plugin_data['make_dumps']}</make_dumps>
\t\t\t          </permissions> 
\t\t\t        </values>
\t\t\t\t</set>\t
\t\t\t\t<ippool_add_ip> 
\t\t\t\t\t<client_id>{$cl_id}</client_id>
\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t</ippool_add_ip>\t\t\t  
\t\t\t</client>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        # Calculate limits
        @($ftp_quota = ceil($this->plugin_data['ftp_quota']) * 1024 * 1024);
        @($disk_space = ceil($this->plugin_data['disk_space']) * 1024 * 1024);
        @($max_traffic = ceil($this->plugin_data['max_traffic']) * 1024 * 1024);
        @($mbox_quota = ceil($this->plugin_data['mbox_quota']) * 1024);
        if ($this->plugin_data['shell'] == 1) {
            $shell = 'true';
        } else {
            $shell = '/bin/false';
        }
        ###################################
        ### ADD NEW DOMAIN AND LIMITS:	###
        $data = <<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\t\t<packet version="{$this->proto}">
\t\t\t<domain> 
\t\t\t\t<add>
\t\t\t\t\t<gen_setup>
\t\t\t\t\t\t<name>{$this->service['domain_name']}.{$this->service['domain_tld']}</name>
\t\t\t\t\t\t<client_id>{$cl_id}</client_id> 
\t\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t\t\t<htype>vrt_hst</htype>
\t\t\t\t\t\t<status /> 
\t\t\t\t\t</gen_setup> 
\t\t\t\t\t<hosting>
\t\t\t\t\t\t<vrt_hst>
\t\t\t\t\t\t\t<ip_address>{$this->ip}</ip_address>
\t\t\t\t\t\t\t<ftp_login>{$this->login['username']}</ftp_login>
\t\t\t\t\t\t\t<ftp_password>{$this->login['password']}</ftp_password>
\t\t\t\t\t\t\t<ftp_quota>{$ftp_quota}</ftp_quota>
\t\t\t\t\t\t\t<fp>{$this->plugin_data['fp']}</fp>
\t\t\t\t\t\t\t<fp_ssl>{$this->plugin_data['fp_ssl']}</fp_ssl>
\t\t\t\t\t\t\t<fp_auth>{$this->plugin_data['fp_auth']}</fp_auth> 
\t\t\t\t\t\t\t<fp_admin_login>{$this->login['username']}</fp_admin_login>
\t\t\t\t\t\t\t<fp_admin_password>{$this->login['password']}</fp_admin_password>
\t\t\t\t\t\t\t<ssl>{$this->plugin_data['ssl']}</ssl>
\t\t\t\t\t\t\t<shell>{$shell}</shell>
\t\t\t\t\t\t\t<php>{$this->plugin_data['php']}</php>
\t\t\t\t\t\t\t<ssi>{$this->plugin_data['ssi']}</ssi>
\t\t\t\t\t\t\t<cgi>{$this->plugin_data['cgi']}</cgi>
\t\t\t\t\t\t\t<mod_perl>{$this->plugin_data['mod_perl']}</mod_perl>
\t\t\t\t\t\t\t<mod_python>{$this->plugin_data['mod_python']}</mod_python>
\t\t\t\t\t\t\t<asp>{$this->plugin_data['asp']}</asp>
\t\t\t\t\t\t\t<asp_dot_net>{$this->plugin_data['asp_dot_net']}</asp_dot_net>
\t\t\t\t\t\t\t<coldfusion>{$this->plugin_data['coldfusion']}</coldfusion>
\t\t\t\t\t\t\t<webstat>{$this->plugin_data['webstat']}</webstat>
\t\t\t\t\t\t\t<errdocs>{$this->plugin_data['errdocs']}</errdocs>
\t\t\t\t\t\t\t<at_domains>{$this->plugin_data['at_domains']}</at_domains>
\t\t\t\t\t\t</vrt_hst> 
\t\t\t\t\t</hosting>
\t\t\t\t\t<limits>
\t\t\t\t\t\t<max_subdom>{$this->plugin_data['max_subdom']}</max_subdom>
\t\t\t\t\t\t<disk_space>{$disk_space}</disk_space>
\t\t\t\t\t\t<max_traffic>{$max_traffic}</max_traffic>
\t\t\t\t\t\t<max_wu>{$this->plugin_data['max_wu']}</max_wu>
\t\t\t\t\t\t<max_db>{$this->plugin_data['max_db']}</max_db>
\t\t\t\t\t\t<max_box>{$this->plugin_data['max_box']}</max_box>
\t\t\t\t\t\t<mbox_quota>{$mbox_quota}</mbox_quota>
\t\t\t\t\t\t<max_redir>{$this->plugin_data['max_redir']}</max_redir>
\t\t\t\t\t\t<max_mg>{$this->plugin_data['max_mg']}</max_mg>
\t\t\t\t\t\t<max_resp>{$this->plugin_data['max_resp']}</max_resp> 
\t\t\t\t\t\t<max_maillists>{$this->plugin_data['max_maillists']}</max_maillists>
\t\t\t\t\t\t<max_webapps>{$this->plugin_data['max_webapps']}</max_webapps> \t\t\t\t\t\t\t\t\t\t\t\t
\t\t\t\t\t</limits>
\t\t\t\t\t<prefs>
\t\t\t\t\t\t<www>true</www> 
\t\t\t\t\t</prefs>\t 
\t\t\t\t</add>\t  
\t\t\t</domain>
</packet>
EOF;
        # Connect & get response:
        $result = $this->connect($this->server_cfg['host'], $this->server_cfg['port'], $this->server_cfg['user'], $this->server_cfg['pass'], $data);
        # Debug:
        $this->debug($data, $result);
        # Get the account id
        if (!($domain_id = $this->getid($result))) {
            return false;
        } else {
            $db =& DB();
            $id = $this->service_id;
            $sql = "SELECT * FROM " . AGILE_DB_PREFIX . "service WHERE id = {$id}";
            $rs = $db->Execute($sql);
            $plugin_data = unserialize($rs->fields['host_provision_plugin_data']);
            $plugin_data['account_id'] = $cl_id;
            $plugin_data['domain_id'] = $domain_id;
            $insert = array('host_provision_plugin_data' => serialize($plugin_data), 'host_username' => $this->login['username'], 'host_password' => $this->login['password']);
            $sql = $db->GetUpdateSQL($rs, $insert);
            $result = $db->Execute($sql);
            if ($result === false) {
                global $C_debug;
                $C_debug->error('PLESK_RELOADED_7_5.php', 'plgn_prov_PLESK_RELOADED_7_5 :: p_new()', $db->ErrorMsg() . "\r\n\r\n" . $sql);
            }
            # send the user the details
            include_once PATH_MODULES . 'email_template/email_template.inc.php';
            $email = new email_template();
            $email->send('host_new_user', $this->account['id'], $this->service_id, '', '');
        }
        return true;
    }