* @package AgileBill * @version 1.4.93 */ # Remote update retrieval if(empty($VAR)) { include_once('../../config.inc.php'); require_once(PATH_ADODB . 'adodb.inc.php'); require_once(PATH_CORE . 'database.inc.php'); require_once(PATH_CORE . 'setup.inc.php'); require_once(PATH_CORE . 'vars.inc.php'); require_once(PATH_CORE . 'xml.inc.php'); $C_debug = new CORE_debugger; $C_vars = new CORE_vars; $VAR = $C_vars->f; $C_db = &DB(); $C_setup = new CORE_setup; $plg = new plgn_prov_ENSIM_WINDOWS_3_5(); $plg->p_all($VAR); } # Main Class class plgn_prov_ENSIM_WINDOWS_3_5 { function plgn_prov_ENSIM_WINDOWS_3_5() { $this->name = 'ENSIM_WINDOWS_3_5'; $this->task_based = true; $this->remote_based = false; $this->nl = ' & '; } # add new service 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 "'; # ip based? if ($this->plugin_data['ipinfo_namebased'] == '0' && $this->ip != false) { $cmd .= 'IPBased'.$this->ip.''; $ssl = '1'; } else { $cmd .= 'NameBased'; $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 .= '' . $this->service['domain_name']. '.' . $this->service['domain_tld'] . ''. '' . $this->login['username'] . ''. '' . $this->login['password'] . ''. '' . $this->account['email'] . ''. '0na@na.comhellohello'. ''. '1'. '' . $this->plugin_data['dataDrive'] . ''. '' . $this->plugin_data['style_name'] . ''. '' . $this->plugin_data['diskquota'] . '' . '' . $this->plugin_data['maxusers'] . '' . ''. '' . $this->plugin_data['urchin'] . '' . '' . $this->plugin_data['winfiles'] . '' . '' . $this->plugin_data['winanalog'] . '' . '' . $this->plugin_data['odbc'] . '' . '' . $this->plugin_data['coldfusion'] . '' . '' . $this->plugin_data['frontpage'] . '' . '' . $this->plugin_data['perl'] . '' . '' . $this->plugin_data['php'] . '' . '' . $this->plugin_data['mysql'] . '' . '' . $this->plugin_data['urchin'] . '' . '' . $this->plugin_data['odbc'] . '' . ''. '1' . '1' . '900' . '1' . 'Goodbye' . 'Hello' . 'TO_MANY_USERS'. '' . $this->plugin_data['allowanonymous'] . '' . '' . $this->plugin_data['logtype'] . '' . '' . $this->plugin_data['ftp_maxconnections'] . '' . '' . $this->plugin_data['ftp_maxconnectionsunlimited'] . '' . '' . $this->plugin_data['msftpsvc'] . '' . ''. '' . '' . $this->plugin_data['ssi'] . '' . '' . $ssl . '' . '' . $this->plugin_data['w3svc_maxconnectionsunlimited'] . '' . '' . $this->plugin_data['w3svc_maxconnections'] . '' . '0'. '1' . '2' . '1' . '1' . '0' . '0' . '1' . '1' . '1' . 'Default.html' . '900' . '' . $this->plugin_data['logtype'] . '' . '' . $this->plugin_data['enablebandwidthquota'] . '' . '' . $this->plugin_data['maxbandwidth'] . '' . '' . $this->plugin_data['enablecpuquota'] . '' . '' . $this->plugin_data['cpuquota'] . '' . '' . $this->plugin_data['serversize'] . '' . '0' . 'footer' . '0' . '' . '' . '' . $this->plugin_data['w3svc'] . '' . '' . '' . '' . $this->plugin_data['autoresponder'] . '' . '' . $this->plugin_data['userforwards'] . '' . '' . $this->plugin_data['winmail'] . '' . '' . '' . '"'; return $cmd; } # edit service function p_edit() { # defaults while (list($key, $val) = each(@$this->plugin_data)) { if (empty($this->plugin_data[$key]) || $this->plugin_data[$key] == false) $this->plugin_data[$key] = '0'; } $cmd = 'editdomain -s "'. ''. '' . $this->service['domain_name']. '.' . $this->service['domain_tld'] . ''. '' . $this->service['host_username'] . ''. '' . $this->service['host_password'] . ''. '' . $this->account['email'] . ''. '0'. '' . $this->plugin_data['dataDrive'] . ''. '' . $this->plugin_data['style_name'] . ''. ''. '' . $this->plugin_data['diskquota'] . '' . '' . $this->plugin_data['maxusers'] . '' . ''. '' . $this->plugin_data['urchin'] . '' . '' . $this->plugin_data['winfiles'] . '' . '' . $this->plugin_data['winanalog'] . '' . '' . $this->plugin_data['odbc'] . '' . '' . $this->plugin_data['coldfusion'] . '' . '' . $this->plugin_data['frontpage'] . '' . '' . $this->plugin_data['perl'] . '' . '' . $this->plugin_data['php'] . '' . '' . $this->plugin_data['mysql'] . '' . '' . $this->plugin_data['urchin'] . '' . ''. '1' . '1' . '900' . '' . $this->plugin_data['allowanonymous'] . '' . '' . $this->plugin_data['logtype'] . '' . '' . $this->plugin_data['ftp_maxconnections'] . '' . '' . $this->plugin_data['ftp_maxconnectionsunlimited'] . '' . '1' . 'Goodbye' . 'Hello' . 'TryLater' . '' . $this->plugin_data['msftpsvc'] . '' . ''. '' . '' . $this->plugin_data['cgi'] . '' . '' . $this->plugin_data['ssi'] . '' . '' . $this->plugin_data['sslc'] . '' . '' . $this->plugin_data['w3svc_maxconnectionsunlimited'] . '' . '1' . '2' . '1' . '1' . '0' . '1' . '1' . '1' . '1' . 'Default.html' . '' . $this->plugin_data['logtype'] . '' . '' . $this->plugin_data['enablebandwidthquota'] . '' . '' . $this->plugin_data['enablecpuquota'] . '' . '"footer"' . '900' . '' . $this->plugin_data['cpuquota'] . '' . '' . $this->plugin_data['maxbandwidth'] . '' . '' . $this->plugin_data['w3svc_maxconnections'] . '' . '' . $this->plugin_data['serversize'] . '' . '0' . '0' . '0' . '0' . '' . $this->plugin_data['w3svc'] . '' . '' . '' . '' . $this->plugin_data['autoresponder'] . '' . '' . $this->plugin_data['userforwards'] . '' . '' . $this->plugin_data['winmail'] . '' . '' . '' . '"'; return $cmd; } # activate service function p_inactive() { return 'editdomain -s "'.$this->service['domain_name'].'.'.$this->service['domain_tld'].'000"'; } # deactivate service function p_active() { return 'editdomain -s "'.$this->service['domain_name'].'.'.$this->service['domain_tld'].''.$this->plugin_data['w3svc'].''.$this->plugin_data['winmail'].''.$this->plugin_data['msftpsvc'].'"'; } # delete service function p_delete() { # recycle the IP if ip_based: if ($this->plugin_data['ipinfo_namebased'] == '0') { include_once(PATH_MODULES.'host_server/host_server.inc.php'); $host = new host_server; $this->ip = $host->unuseipaddress($this->server, $this->service['host_ip']); } return 'deldomain -s "'.$this->service['domain_name']. "." . $this->service['domain_tld'].'"'; } # construct echo all updates function p_all($VAR) { global $C_debug; # Error checking if( empty($VAR['key']) ) { echo 'REM Server Key Missing!'; exit; } # Get the server details $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'host_server WHERE keycode = ' . $db->qstr( $VAR['key'] ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); if (@$rs->RecordCount() <= 0) { echo 'REM Server ID does not exist'; exit; } else { $this->server = $rs->fields; @$this->server_cnfg = unserialize($rs->fields['provision_plugin_data']); } # Check that this server is using this plugin if($this->server['provision_plugin'] != @$this->name) { echo 'REM Wrong plugin for this server '; exit; } # Check the auth for this post if (!empty($VAR['key']) && $VAR['key'] == $this->server['keycode']) { # authorized! } else { echo 'REM Unauthorized Key! '; exit; } # Get the service details $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'service WHERE type = ' . $db->qstr( 'host' ) . ' OR type = ' . $db->qstr( 'host_group' ) . ' AND host_server_id = ' . $db->qstr( $this->server['id'] ) . ' AND queue != ' . $db->qstr( 'none' ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $rs = $db->Execute($sql); if($rs->RecordCount() == 0) { echo 'REM No Records To Add/Update '; exit; } $i=0; while(!$rs->EOF) { # set details $this->service = $rs->fields; # Get the hosting plan plugin data for this product $this->plugin_data = unserialize($this->service['host_provision_plugin_data']); # Get the account details $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'account WHERE id = ' . $db->qstr( $this->service['account_id'] ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $acct = $db->Execute($sql); $this->account = $acct->fields; # determine the correct action switch ($this->service['queue']) { # new case 'new': $result = $this->p_new(); # 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'], $rs->fields['id'], '', ''); break; # active case 'active': $result = $this->p_active(); # send the user the details include_once(PATH_MODULES.'email_template/email_template.inc.php'); $email = new email_template; $email->send('host_edit_user', $this->account['id'], $rs->fields['id'], '', ''); break; # inactive case 'inactive': $result = $this->p_inactive(); break; # edit case 'edit': $result = $this->p_edit(); break; # delete case 'delete': $result = $this->p_delete(); break; } # formatting if (@$result != false) { if($i > 0) echo $this->nl; echo $result; $i++; } # check if we need to update the status after an edit if ($this->service['queue'] == 'edit') { if ($this->service['active'] == 1 ) echo $this->nl . $this->p_active(); else echo $this->nl . $this->p_inactive(); } # update service record if(@$result != false) { if($this->service['queue'] == "delete") { # delete $sql = 'DELETE FROM ' . AGILE_DB_PREFIX . 'service WHERE id = ' . $db->qstr( $rs->fields['id'] ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $upd = $db->Execute($sql); } else { # update $sql = 'UPDATE ' . AGILE_DB_PREFIX . 'service SET queue = ' . $db->qstr( 'none' ) . ', date_last = ' . $db->qstr( time() ) . ' WHERE id = ' . $db->qstr( $rs->fields['id'] ) . ' AND site_id = ' . $db->qstr(DEFAULT_SITE); $upd = $db->Execute($sql); } } else { # error log $C_debug->error($this->name.'php', $this->service['queue'], @$result); } $rs->MoveNext(); } } } ?>