- fixed some syntax errors from previous commit
| | |
| | | $vserver_server_enabled = ($conf['services']['vserver'])?1:0; |
| | | $sql = "UPDATE `server` SET mail_server = ?, web_server = ?, dns_server = ?, file_server = ?, db_server = ?, vserver_server = ? WHERE server_id = ?"; |
| | | |
| | | $this->db->query($sql, $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $conf['server_id']);); |
| | | $this->db->query($sql, $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $conf['server_id']); |
| | | if($conf['mysql']['master_slave_setup'] == 'y') { |
| | | $this->dbmaster->query($sql, $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $conf['server_id']);); |
| | | $this->dbmaster->query($sql, $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $conf['server_id']); |
| | | } |
| | | |
| | | // chown install dir to root and chmod 755 |
| | |
| | | // Get the limits of the client |
| | | $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); |
| | | $client = $app->db->queryOneRecord("SELECT default_slave_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ", $client_group_id); |
| | | $sql = "SELECT server_id,server_name FROM server WHERE server_id = ?"); |
| | | $sql = "SELECT server_id,server_name FROM server WHERE server_id = ?"; |
| | | } else { |
| | | $sql = "SELECT server_id,server_name FROM server WHERE dns_server = 1 ORDER BY server_name"; |
| | | } |
| | |
| | | $params = array($tablename); |
| | | $v_params = array(); |
| | | foreach($insert_data as $key => $val) { |
| | | $key_str .= '??,' |
| | | $key_str .= '??,'; |
| | | $params[] = $key; |
| | | |
| | | $val_str .= '?,'; |
| | |
| | | } |
| | | |
| | | //* Save the record |
| | | if ($app->db->query("INSERT INTO `sys_remoteaction` SET `server_id` = ?, `tstamp` = ?, `action_type` = ?, `action_param` = ?, `action_state` = ?"), $server_id, $tstamp, $action_type, $primary_id, $action_state) { |
| | | if ($app->db->query("INSERT INTO `sys_remoteaction` SET `server_id` = ?, `tstamp` = ?, `action_type` = ?, `action_param` = ?, `action_state` = ?", $server_id, $tstamp, $action_type, $primary_id, $action_state)) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | |
| | | if($only_domain == false) { |
| | | $qrystr = "SELECT d.domain_id, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ip_address, d.ip_address) as `ip_address`, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ipv6_address, d.ipv6_address) as `ipv6_address` FROM `web_domain` as d LEFT JOIN `web_domain` as p ON (p.domain_id = d.parent_domain_id) WHERE (CONCAT(d.subdomain, '.', d.domain)= ?" . $additional_sql2 . ") AND d.server_id = ? AND d.domain_id != ?" . ($primary_id ? " AND d.parent_domain_id != ?" : ""); |
| | | $params = array($domain_name) + $domain_params + array($domain['server_id'], $primary_id, $primary_id); |
| | | $checks = $app->db->queryAllRecords($qrystr, true $params); |
| | | $checks = $app->db->queryAllRecords($qrystr, true, $params); |
| | | if(is_array($checks) && !empty($checks)){ |
| | | foreach($checks as $check){ |
| | | if($domain['ip_address'] == '*') return false; |
| | |
| | | $tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = ?", $client_group_id); |
| | | $client_user_id = ($tmp['userid'] > 0)?$tmp['userid']:1; |
| | | $updates .= ", sys_userid = ?"; |
| | | $update_params[] = $client_user_id |
| | | $update_params[] = $client_user_id; |
| | | } |
| | | $update_params[] = $page_form->id; |
| | | $app->db->query("UPDATE mail_domain SET " . $updates . " WHERE domain_id = ?", true, $update_params); |
| | |
| | | $tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = ?", $client_group_id); |
| | | $client_user_id = ($tmp['userid'] > 0)?$tmp['userid']:1; |
| | | $updates .= ", sys_userid = ?"; |
| | | $update_params[] = $client_user_id |
| | | $update_params[] = $client_user_id; |
| | | } |
| | | $update_params[] = $page_form->id; |
| | | $app->db->query("UPDATE mail_domain SET " . $updates . " WHERE domain_id = ?", true, $update_params); |
| | |
| | | function onAfterInsert() { |
| | | global $app; |
| | | |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"]))); |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"])); |
| | | $app->db->query("update mail_forwarding SET sys_groupid = ? WHERE forwarding_id = ?", $domain['sys_groupid'], $this->id); |
| | | |
| | | } |
| | |
| | | function onAfterInsert() { |
| | | global $app; |
| | | |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"]))); |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"])); |
| | | $app->db->query("update mail_forwarding SET sys_groupid = ? WHERE forwarding_id = ?", $domain['sys_groupid'], $this->id); |
| | | |
| | | } |
| | |
| | | function onAfterInsert() { |
| | | global $app; |
| | | |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"]))); |
| | | $domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->idn_encode($_POST["email_domain"])); |
| | | $app->db->query("update mail_forwarding SET sys_groupid = ? WHERE forwarding_id = ?", $domain['sys_groupid'], $this->id); |
| | | |
| | | } |
| | |
| | | // The web folder user entry shall be owned by the same group as the web folder |
| | | $sys_groupid = $app->functions->intval($folder['sys_groupid']); |
| | | |
| | | $sql = "UPDATE web_folder_user SET sys_groupid = ? WHERE web_folder_user_id = ?", $sys_groupid, $this->id; |
| | | $app->db->query($sql); |
| | | $sql = "UPDATE web_folder_user SET sys_groupid = ? WHERE web_folder_user_id = ?"; |
| | | $app->db->query($sql, $sys_groupid, $this->id); |
| | | } |
| | | |
| | | function onAfterUpdate() { |
| | |
| | | // Manage and compress web logfiles and create traffic statistics |
| | | //###################################################################################################### |
| | | |
| | | $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain' or type = 'vhostalias') AND server_id = ?", $conf['server_id']; |
| | | $records = $app->db->queryAllRecords($sql); |
| | | $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain' or type = 'vhostalias') AND server_id = ?"; |
| | | $records = $app->db->queryAllRecords($sql, $conf['server_id']); |
| | | foreach($records as $rec) { |
| | | |
| | | //* create traffic statistics based on yesterdays access log file |
| | |
| | | $params = array($tablename); |
| | | $v_params = array(); |
| | | foreach($insert_data as $key => $val) { |
| | | $key_str .= '??,' |
| | | $key_str .= '??,'; |
| | | $params[] = $key; |
| | | |
| | | $val_str .= '?,'; |