/** * returns an array with all entries required for all * webserver-vhost-configs * * @return array */ public static function getVhostsToCreate() { $query = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`,\n\t\t\t\t`d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`,\n\t\t\t\t`c`.`documentroot` AS `customerroot`, `c`.`deactivated`,\n\t\t\t\t`c`.`phpenabled` AS `phpenabled`, `d`.`mod_fcgid_starter`,\n\t\t\t\t`d`.`mod_fcgid_maxrequests`\n\t\t\t\tFROM `" . TABLE_PANEL_DOMAINS . "` `d`\n\n\t\t\t\tLEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)\n\t\t\t\tLEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`)\n\n\t\t\t\tWHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'\n\t\t\t\tORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;\n\t\t"; $result_domains_stmt = Database::query($query); $domains = array(); while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { if (!checkDomainIPConfigured($domain['id'])) { continue; } // set whole domain $domains[$domain['domain']] = $domain; // set empty-defaults for non-ssl $domains[$domain['domain']]['ssl'] = ''; $domains[$domain['domain']]['ssl_cert_file'] = ''; $domains[$domain['domain']]['ssl_key_file'] = ''; $domains[$domain['domain']]['ssl_ca_file'] = ''; $domains[$domain['domain']]['ssl_cert_chainfile'] = ''; // now, if the domain has an ssl ip/port assigned, get // the corresponding information from the db if (domainHasSslIpPort($domain['id'])) { $ip_stmt = Database::prepare("\n\t\t\t\t\t\tSELECT `di`.`id_domain` , `p`.`ssl`, `p`.`ssl_cert_file`, `p`.`ssl_key_file`, `p`.`ssl_ca_file`, `p`.`ssl_cert_chainfile`\n\t\t\t\t\t\tFROM `" . TABLE_DOMAINTOIP . "` `di`, `" . TABLE_PANEL_IPSANDPORTS . "` `p`\n\t\t\t\t\t\tWHERE `p`.`id` = `di`.`id_ipandports`\n\t\t\t\t\t\tAND `di`.`id_domain` = :domainid\n\t\t\t\t\t\tAND `p`.`ssl` = '1'\n\t\t\t\t\t\t"); $ssl_ip = Database::pexecute_first($ip_stmt, array('domainid' => $domain['id'])); // set ssl info for domain $domains[$domain['domain']]['ssl'] = '1'; $domains[$domain['domain']]['ssl_cert_file'] = $ssl_ip['ssl_cert_file']; $domains[$domain['domain']]['ssl_key_file'] = $ssl_ip['ssl_key_file']; $domains[$domain['domain']]['ssl_ca_file'] = $ssl_ip['ssl_ca_file']; $domains[$domain['domain']]['ssl_cert_chainfile'] = $ssl_ip['ssl_cert_chainfile']; } } return $domains; }
<?php /** * This file is part of the Froxlor project. * Copyright (c) 2010 the Froxlor Team (see authors). * * For the full copyright and license information, please view the COPYING * file that was distributed with this source code. You can also view the * COPYING file online at http://files.froxlor.org/misc/COPYING.txt * * @copyright (c) the authors * @author Froxlor team <*****@*****.**> (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Formfields * */ return array('domain_edit' => array('title' => $lng['domains']['subdomain_edit'], 'image' => 'icons/domain_edit.png', 'sections' => array('section_a' => array('title' => $lng['domains']['subdomain_edit'], 'image' => 'icons/domain_edit.png', 'fields' => array('domain' => array('label' => $lng['domains']['domainname'], 'type' => 'label', 'value' => $result['domain']), 'dns' => array('label' => $lng['dns']['destinationip'], 'type' => 'label', 'value' => $domainip), 'alias' => array('visible' => $alias_check == '0' ? true : false, 'label' => $lng['domains']['aliasdomain'], 'type' => 'select', 'select_var' => $domains), 'path' => array('label' => $lng['panel']['path'], 'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescriptionSubdomain'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''), 'type' => $pathSelect['type'], 'select_var' => $pathSelect['value'], 'value' => $pathSelect['value']), 'url' => array('visible' => Settings::Get('panel.pathedit') == 'Dropdown' ? true : false, 'label' => $lng['panel']['urloverridespath'], 'type' => 'text', 'value' => $urlvalue), 'redirectcode' => array('visible' => Settings::Get('system.webserver') == 'apache2' && Settings::Get('customredirect.enabled') == '1' ? true : false, 'label' => $lng['domains']['redirectifpathisurl'], 'desc' => $lng['domains']['redirectifpathisurlinfo'], 'type' => 'select', 'select_var' => $redirectcode), 'selectserveralias' => array('visible' => $result['parentdomainid'] == '0' && $userinfo['subdomains'] != '0' ? true : false, 'label' => $lng['admin']['selectserveralias'], 'desc' => $lng['admin']['selectserveralias_desc'], 'type' => 'select', 'select_var' => $serveraliasoptions), 'isemaildomain' => array('visible' => ($result['subcanemaildomain'] == '1' || $result['subcanemaildomain'] == '2') && $result['parentdomainid'] != '0' ? true : false, 'label' => 'Emaildomain', 'type' => 'checkbox', 'values' => array(array('label' => $lng['panel']['yes'], 'value' => '1')), 'value' => array($result['isemaildomain'])), 'ssl_redirect' => array('visible' => Settings::Get('system.use_ssl') == '1' ? $ssl_ipsandports != '' ? domainHasSslIpPort($result['id']) ? true : false : false : false, 'label' => $lng['domains']['ssl_redirect']['title'], 'desc' => $lng['domains']['ssl_redirect']['description'], 'type' => 'checkbox', 'values' => array(array('label' => $lng['panel']['yes'], 'value' => '1')), 'value' => array($result['ssl_redirect'])), 'openbasedir_path' => array('visible' => $result['openbasedir'] == '1' ? true : false, 'label' => $lng['domain']['openbasedirpath'], 'type' => 'select', 'select_var' => $openbasedir))))));
if (isset($_POST['ssl_redirect']) && $_POST['ssl_redirect'] == '1') { // a ssl-redirect only works if there actually is a // ssl ip/port assigned to the domain if (domainHasSslIpPort($id) == true) { $ssl_redirect = '1'; $_doredirect = true; } else { standard_error('sslredirectonlypossiblewithsslipport'); } } else { $ssl_redirect = '0'; } if (isset($_POST['letsencrypt']) && $_POST['letsencrypt'] == '1') { // let's encrypt only works if there actually is a // ssl ip/port assigned to the domain if (domainHasSslIpPort($id) == true) { $letsencrypt = '1'; } else { standard_error('letsencryptonlypossiblewithsslipport'); } } else { $letsencrypt = '0'; } // We can't enable let's encrypt for wildcard - domains if ($iswildcarddomain == '1' && $letsencrypt == '1') { standard_error('nowildcardwithletsencrypt'); } // Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated if ($ssl_redirect > 0 && $letsencrypt == 1 && $result['letsencrypt'] != $letsencrypt) { $ssl_redirect = 2; }