mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-22 02:47:34 +00:00
migrate ALL the crons to new PDO database class, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
parent
990e39cadb
commit
4426ab52d3
@ -420,7 +420,7 @@ return Array(
|
||||
'a2enmod suexec fcgid',
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'groupadd -f '.$settings['system']['mod_fcgid_httpgroup'] : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'useradd -s /bin/false -g '.$settings['system']['mod_fcgid_httpgroup'].' '.$settings['system']['mod_fcgid_httpuser'] : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'chown -R '.$settings['system']['mod_fcgid_httpuser'].':'.$settings['system']['mod_fcgid_httpgroup'].' '.$pathtophpfiles : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'chown -R '.$settings['system']['mod_fcgid_httpuser'].':'.$settings['system']['mod_fcgid_httpgroup'].' '.FROXLOR_INSTALL_DIR : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'mkdir -p '.makeCorrectDir($settings['system']['mod_fcgid_configdir']) : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'mkdir -p '.makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : null,
|
||||
($settings['system']['mod_fcgid_ownvhost'] == '1') ? 'a2dismod php5' : null
|
||||
@ -439,7 +439,7 @@ return Array(
|
||||
'a2enmod suexec fastcgi actions',
|
||||
($settings['phpfpm']['enabled_ownvhost'] == '1') ? 'groupadd -f '.$settings['phpfpm']['vhost_httpgroup'] : null,
|
||||
($settings['phpfpm']['enabled_ownvhost'] == '1') ? 'useradd -s /bin/false -g '.$settings['phpfpm']['vhost_httpgroup'].' '.$settings['phpfpm']['vhost_httpuser'] : null,
|
||||
($settings['phpfpm']['enabled_ownvhost'] == '1') ? 'chown -R '.$settings['phpfpm']['vhost_httpuser'].':'.$settings['phpfpm']['vhost_httpgroup'].' '.$pathtophpfiles : null,
|
||||
($settings['phpfpm']['enabled_ownvhost'] == '1') ? 'chown -R '.$settings['phpfpm']['vhost_httpuser'].':'.$settings['phpfpm']['vhost_httpgroup'].' '.FROXLOR_INSTALL_DIR : null,
|
||||
($settings['phpfpm']['enabled_ownvhost'] == '1') ? 'a2dismod php5' : null
|
||||
)
|
||||
)
|
||||
|
@ -16,10 +16,11 @@
|
||||
* @package Cron
|
||||
*
|
||||
*/
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
|
||||
if (@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi'
|
||||
) {
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
@ -39,17 +40,12 @@ $lockfile = $lockdir . $lockfName;
|
||||
// normally you should not need to modify this script anymore, if your
|
||||
// froxlor installation isn't in /var/www/froxlor
|
||||
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
||||
// TODO remove when not needed anymore
|
||||
$pathtophpfiles = dirname(dirname(__FILE__));
|
||||
|
||||
// should the froxlor installation guessing not work correctly,
|
||||
// uncomment the following line, and put your path in there!
|
||||
//$pathtophpfiles = '/var/www/froxlor/';
|
||||
// create and open the lockfile!
|
||||
$keepLockFile = false;
|
||||
$debugHandler = fopen($lockfile, 'w');
|
||||
fwrite($debugHandler, 'Setting Lockfile to ' . $lockfile . "\n");
|
||||
fwrite($debugHandler, 'Setting Froxlor installation path to ' . $pathtophpfiles . "\n");
|
||||
fwrite($debugHandler, 'Setting Froxlor installation path to ' . FROXLOR_INSTALL_DIR . "\n");
|
||||
|
||||
// open the lockfile directory and scan for existing lockfiles
|
||||
$lockDirHandle = opendir($lockdir);
|
||||
@ -119,27 +115,28 @@ require FROXLOR_INSTALL_DIR . '/lib/functions.php';
|
||||
require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
|
||||
fwrite($debugHandler, 'Table definitions included' . "\n");
|
||||
|
||||
//Includes the MySQL-Connection-Class
|
||||
fwrite($debugHandler, 'Database Class has been loaded' . "\n");
|
||||
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
|
||||
|
||||
if ($db->link_id == 0) {
|
||||
// try database connection, it will throw
|
||||
// and exception itself if failed
|
||||
try {
|
||||
Database::query("SELECT 1");
|
||||
} catch (Exception $e) {
|
||||
// Do not proceed further if no database connection could be established
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
die('Froxlor can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
|
||||
die($e->getMessage());
|
||||
}
|
||||
|
||||
fwrite($debugHandler, 'Database-connection established' . "\n");
|
||||
unset($sql);
|
||||
$result = $db->query("SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
|
||||
$result_stmt = Database::query("
|
||||
SELECT `settingid`, `settinggroup`, `varname`, `value`
|
||||
FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
");
|
||||
|
||||
while ($row = $db->fetch_array($result)) {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$settings[$row['settinggroup']][$row['varname']] = $row['value'];
|
||||
}
|
||||
|
||||
unset($row);
|
||||
unset($result);
|
||||
fwrite($debugHandler, 'Froxlor settings have been loaded from the database' . "\n");
|
||||
|
||||
/**
|
||||
@ -150,7 +147,7 @@ if ((int)$settings['system']['mod_fcgid'] == 1
|
||||
&& (int)$settings['system']['mod_fcgid_ownvhost'] == 1
|
||||
) {
|
||||
fwrite($debugHandler, 'Checking froxlor file permissions');
|
||||
$mypath = makeCorrectDir(dirname(dirname(__FILE__))); // /var/www/froxlor, needed for chown
|
||||
$mypath = makeCorrectDir(FROXLOR_INSTALL_DIR);
|
||||
$user = $settings['system']['mod_fcgid_httpuser'];
|
||||
$group = $settings['system']['mod_fcgid_httpgroup'];
|
||||
// all the files and folders have to belong to the local user
|
||||
@ -161,7 +158,6 @@ if ((int)$settings['system']['mod_fcgid'] == 1
|
||||
// be sure HTMLPurifier's cache folder is writable
|
||||
safe_exec('chmod -R 0755 '.escapeshellarg(dirname(__FILE__).'/classes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer'));
|
||||
|
||||
|
||||
if (!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $version
|
||||
) {
|
||||
|
@ -22,15 +22,6 @@ if ($settings['logger']['log_cron'] == '1') {
|
||||
fwrite($debugHandler, 'Logging for cron has been shutdown' . "\n");
|
||||
}
|
||||
|
||||
// TODO remove when completely migrated to PDO
|
||||
$db->close();
|
||||
fwrite($debugHandler, 'Closing database connection' . "\n");
|
||||
|
||||
if (isset($db_root)) {
|
||||
$db_root->close();
|
||||
fwrite($debugHandler, 'Closing database rootconnection' . "\n");
|
||||
}
|
||||
|
||||
if ($keepLockFile === true) {
|
||||
fwrite($debugHandler, '=== Keep lockfile because of exception ===');
|
||||
}
|
||||
|
@ -63,12 +63,10 @@ unset($key);
|
||||
|
||||
$filename = basename($_SERVER['PHP_SELF']);
|
||||
|
||||
// keep this for compatibility reasons
|
||||
$pathtophpfiles = dirname(dirname(__FILE__));
|
||||
|
||||
// define default theme for configurehint, etc.
|
||||
$_deftheme = 'Sparkle';
|
||||
|
||||
// define installation directory
|
||||
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
||||
|
||||
// check whether the userdata file exists
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
define('MASTER_CRONJOB', 1);
|
||||
|
||||
include_once(dirname(dirname(__FILE__)) . '/lib/cron_init.php');
|
||||
include_once dirname(dirname(__FILE__)) . '/lib/cron_init.php';
|
||||
|
||||
$jobs_to_run = includeCronjobs($debugHandler);
|
||||
|
||||
@ -37,7 +37,7 @@ if (isset($argv[1]) && strtolower($argv[1]) == '--help') {
|
||||
*/
|
||||
for ($x = 1; $x < count($argv); $x++) {
|
||||
if (isset($argv[$x]) && strtolower($argv[$x]) == '--force') {
|
||||
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_tasks.php');
|
||||
$crontasks = makeCorrectFile(FROXLOR_INSTALL_DIR.'/scripts/jobs/cron_tasks.php');
|
||||
// really force re-generating of config-files by
|
||||
// inserting task 1
|
||||
inserttask('1');
|
||||
@ -46,7 +46,7 @@ for ($x = 1; $x < count($argv); $x++) {
|
||||
}
|
||||
}
|
||||
elseif (isset($argv[$x]) && substr(strtolower($argv[$x]), 0, 8) == '--force-') {
|
||||
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_'.substr(strtolower($argv[$x]), 8).'.php');
|
||||
$crontasks = makeCorrectFile(FROXLOR_INSTALL_DIR.'/scripts/jobs/cron_'.substr(strtolower($argv[$x]), 8).'.php');
|
||||
if (file_exists($crontasks)) {
|
||||
if (!in_array($crontasks, $jobs_to_run)) {
|
||||
array_unshift($jobs_to_run, $crontasks);
|
||||
@ -69,7 +69,5 @@ fwrite($debugHandler, 'Cronfiles have been included' . "\n");
|
||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Checking system\'s last guid');
|
||||
checkLastGuid();
|
||||
|
||||
/*
|
||||
* shutdown cron
|
||||
*/
|
||||
include_once($pathtophpfiles . '/lib/cron_shutdown.php');
|
||||
// shutdown cron
|
||||
include_once FROXLOR_INSTALL_DIR . '/lib/cron_shutdown.php';
|
||||
|
@ -17,17 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class bind
|
||||
{
|
||||
public $db = false;
|
||||
public $logger = false;
|
||||
public $debugHandler = false;
|
||||
public $settings = array();
|
||||
@ -35,9 +26,8 @@ class bind
|
||||
public $mxservers = array();
|
||||
public $axfrservers = array();
|
||||
|
||||
public function __construct($db, $logger, $debugHandler, $settings) {
|
||||
public function __construct($logger, $debugHandler, $settings) {
|
||||
|
||||
$this->db = $db;
|
||||
$this->logger = $logger;
|
||||
$this->debugHandler = $debugHandler;
|
||||
$this->settings = $settings;
|
||||
@ -89,10 +79,14 @@ class bind
|
||||
$known_filenames = array();
|
||||
|
||||
$bindconf_file = '# ' . $this->settings['system']['bindconf_directory'] . 'froxlor_bind.conf' . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n";
|
||||
$result_domains = $this->db->query("SELECT `d`.`id`, `d`.`domain`, `d`.`iswildcarddomain`, `d`.`wwwserveralias`, `d`.`customerid`, `d`.`zonefile`, `d`.`bindserial`, `d`.`dkim`, `d`.`dkim_id`, `d`.`dkim_pubkey`, `c`.`loginname`, `c`.`guid` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) WHERE `d`.`isbinddomain` = '1' ORDER BY `d`.`domain` ASC");
|
||||
$result_domains_stmt = Database::query("
|
||||
SELECT `d`.`id`, `d`.`domain`, `d`.`iswildcarddomain`, `d`.`wwwserveralias`, `d`.`customerid`, `d`.`zonefile`, `d`.`bindserial`, `d`.`dkim`, `d`.`dkim_id`, `d`.`dkim_pubkey`, `c`.`loginname`, `c`.`guid`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
|
||||
WHERE `d`.`isbinddomain` = '1' ORDER BY `d`.`domain` ASC
|
||||
");
|
||||
|
||||
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
while($domain = $this->db->fetch_array($result_domains))
|
||||
{
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - Writing ' . $domain['id'] . '::' . $domain['domain'] . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Writing ' . $domain['id'] . '::' . $domain['domain']);
|
||||
|
||||
@ -181,9 +175,15 @@ class bind
|
||||
// Array to save DNS records
|
||||
$records = array();
|
||||
|
||||
$result_ip = $this->db->query("SELECT `p`.`ip` AS `ip` FROM `".TABLE_PANEL_IPSANDPORTS."` `p`, `".TABLE_DOMAINTOIP."` `di` WHERE `di`.`id_domain` = '$domain[id]' AND `p`.`id` = `di`.`id_ipandports` GROUP BY `p`.`ip`;");
|
||||
$result_ip_stmt = Database::prepare("
|
||||
SELECT `p`.`ip` AS `ip`
|
||||
FROM `".TABLE_PANEL_IPSANDPORTS."` `p`, `".TABLE_DOMAINTOIP."` `di`
|
||||
WHERE `di`.`id_domain` = :domainid AND `p`.`id` = `di`.`id_ipandports`
|
||||
GROUP BY `p`.`ip`;
|
||||
");
|
||||
Database::pexecute($result_ip_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while ($ip = $this->db->fetch_array($result_ip)) {
|
||||
while ($ip = $result_ip_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (filter_var($ip['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
||||
$ip_a_records[] = "A\t\t" . $ip['ip'];
|
||||
@ -198,15 +198,18 @@ class bind
|
||||
|
||||
$date = date('Ymd');
|
||||
$bindserial = (preg_match('/^' . $date . '/', $domain['bindserial']) ? $domain['bindserial'] + 1 : $date . '00');
|
||||
$this->db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `bindserial`='" . $bindserial . "' WHERE `id`='" . $domain['id'] . "'");
|
||||
$zonefile = '$TTL ' . (int)$this->settings['system']['defaultttl'] . "\n";
|
||||
|
||||
if(count($this->nameservers) == 0)
|
||||
{
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
`bindserial` = :serial
|
||||
WHERE `id` = :id
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('serial' => $bindserial, 'id' => $domain['id']));
|
||||
|
||||
$zonefile = '$TTL ' . (int)$this->settings['system']['defaultttl'] . "\n";
|
||||
if (count($this->nameservers) == 0) {
|
||||
$zonefile.= '@ IN SOA ns ' . str_replace('@', '.', $this->settings['panel']['adminmail']) . '. (' . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$zonefile.= '@ IN SOA ' . $this->nameservers[0]['hostname'] . ' ' . str_replace('@', '.', $this->settings['panel']['adminmail']) . '. (' . "\n";
|
||||
}
|
||||
|
||||
@ -261,22 +264,22 @@ class bind
|
||||
*/
|
||||
$zonefile.= $this->generateDkim($domain);
|
||||
|
||||
$nssubdomains = $this->db->query('SELECT `domain` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `isbinddomain`=\'1\' AND `domain` LIKE \'%.' . $domain['domain'] . '\'');
|
||||
$nssubdomains_stmt = Database::prepare("
|
||||
SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `isbinddomain` = '1' AND `domain` LIKE :domain
|
||||
");
|
||||
Database::pexecute($nssubdomains_stmt, array('domain' => '%.' . $domain['domain']));
|
||||
|
||||
while ($nssubdomain = $nssubdomains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (preg_match('/^[^\.]+\.' . preg_quote($domain['domain'], '/') . '/', $nssubdomain['domain'])) {
|
||||
|
||||
while($nssubdomain = $this->db->fetch_array($nssubdomains))
|
||||
{
|
||||
if(preg_match('/^[^\.]+\.' . preg_quote($domain['domain'], '/') . '/', $nssubdomain['domain']))
|
||||
{
|
||||
$nssubdomain = str_replace('.' . $domain['domain'], '', $nssubdomain['domain']);
|
||||
|
||||
if(count($this->nameservers) == 0)
|
||||
{
|
||||
if (count($this->nameservers) == 0) {
|
||||
$zonefile.= $nssubdomain . ' IN NS ns.' . $nssubdomain . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->nameservers as $nameserver)
|
||||
{
|
||||
} else {
|
||||
foreach ($this->nameservers as $nameserver) {
|
||||
$zonefile.= $nssubdomain . ' IN NS ' . trim($nameserver['hostname']) . "\n";
|
||||
}
|
||||
}
|
||||
@ -285,21 +288,22 @@ class bind
|
||||
|
||||
$records[] = '@';
|
||||
$records[] = 'www';
|
||||
|
||||
|
||||
if($domain['iswildcarddomain'] == '1')
|
||||
{
|
||||
if ($domain['iswildcarddomain'] == '1') {
|
||||
$records[] = '*';
|
||||
}
|
||||
|
||||
$subdomains = $this->db->query("SELECT `domain` FROM `".TABLE_PANEL_DOMAINS."` WHERE `parentdomainid` = '$domain[id]';");
|
||||
$subdomains_stmt = Database::prepare("
|
||||
SELECT `domain` FROM `".TABLE_PANEL_DOMAINS."`
|
||||
WHERE `parentdomainid` = :domainid
|
||||
");
|
||||
Database::pexecute($subdomains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while($subdomain = $this->db->fetch_array($subdomains))
|
||||
{
|
||||
while ($subdomain = $subdomains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
// Listing domains is enough as there currently is no support for choosing
|
||||
// different ips for a subdomain => use same IPs as toplevel
|
||||
$records[] = str_replace('.' . $domain['domain'], '', $subdomain['domain']);
|
||||
|
||||
|
||||
// Check whether to add a www.-prefix
|
||||
if ($domain['wwwserveralias'] == '1') {
|
||||
$records[] = str_replace('.' . $domain['domain'], '', $subdomain['domain']);
|
||||
@ -331,26 +335,21 @@ class bind
|
||||
// algorithm
|
||||
$algorithm = explode(',', $this->settings['dkim']['dkim_algorithm']);
|
||||
$alg = '';
|
||||
foreach($algorithm as $a)
|
||||
{
|
||||
if($a == 'all')
|
||||
{
|
||||
foreach ($algorithm as $a) {
|
||||
if ($a == 'all') {
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$alg.=$a.':';
|
||||
}
|
||||
}
|
||||
if($alg != '')
|
||||
{
|
||||
|
||||
if ($alg != '') {
|
||||
$alg = substr($alg, 0, -1);
|
||||
$dkim_txt.= 'h='.$alg.';';
|
||||
}
|
||||
|
||||
// notes
|
||||
if(trim($this->settings['dkim']['dkim_notes'] != ''))
|
||||
{
|
||||
if (trim($this->settings['dkim']['dkim_notes'] != '')) {
|
||||
$dkim_txt.= 'n='.trim($this->settings['dkim']['dkim_notes']).';';
|
||||
}
|
||||
|
||||
@ -358,8 +357,7 @@ class bind
|
||||
$dkim_txt.= 'k=rsa;p='.trim(preg_replace('/-----BEGIN PUBLIC KEY-----(.+)-----END PUBLIC KEY-----/s', '$1', str_replace("\n", '', $domain['dkim_pubkey']))).';';
|
||||
|
||||
// service-type
|
||||
if($this->settings['dkim']['dkim_servicetype'] == '1')
|
||||
{
|
||||
if ($this->settings['dkim']['dkim_servicetype'] == '1') {
|
||||
$dkim_txt.= 's=email;';
|
||||
}
|
||||
|
||||
@ -369,8 +367,7 @@ class bind
|
||||
// split if necessary
|
||||
$txt_record_split='';
|
||||
$lbr=50;
|
||||
for($pos=0; $pos<=strlen($dkim_txt)-1; $pos+=$lbr)
|
||||
{
|
||||
for ($pos=0; $pos<=strlen($dkim_txt)-1; $pos+=$lbr) {
|
||||
$txt_record_split.= (($pos==0) ? '("' : "\t\t\t\t\t \"") . substr($dkim_txt, $pos, $lbr) . (($pos>=strlen($dkim_txt)-$lbr) ? '")' : '"' ) ."\n";
|
||||
}
|
||||
|
||||
@ -378,8 +375,8 @@ class bind
|
||||
$zone_dkim .= 'dkim_' . $domain['dkim_id'] . '._domainkey IN TXT ' . $txt_record_split;
|
||||
|
||||
// adsp-entry
|
||||
if($this->settings['dkim']['dkim_add_adsp'] == "1")
|
||||
{
|
||||
if ($this->settings['dkim']['dkim_add_adsp'] == "1") {
|
||||
|
||||
$zone_dkim .= '_adsp._domainkey IN TXT "dkim=';
|
||||
switch((int)$this->settings['dkim']['dkim_add_adsppolicy'])
|
||||
{
|
||||
@ -411,17 +408,21 @@ class bind
|
||||
|
||||
$dkimdomains = '';
|
||||
$dkimkeys = '';
|
||||
$result_domains = $this->db->query("SELECT `id`, `domain`, `dkim`, `dkim_id`, `dkim_pubkey`, `dkim_privkey` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `dkim` = '1' ORDER BY `id` ASC");
|
||||
$result_domains_stmt = Database::query("
|
||||
SELECT `id`, `domain`, `dkim`, `dkim_id`, `dkim_pubkey`, `dkim_privkey`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `dkim` = '1' ORDER BY `id` ASC
|
||||
");
|
||||
|
||||
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
while($domain = $this->db->fetch_array($result_domains))
|
||||
{
|
||||
$privkey_filename = makeCorrectFile($this->settings['dkim']['dkim_prefix'] . '/dkim_' . $domain['dkim_id']);
|
||||
$pubkey_filename = makeCorrectFile($this->settings['dkim']['dkim_prefix'] . '/dkim_' . $domain['dkim_id'] . '.public');
|
||||
|
||||
if($domain['dkim_privkey'] == ''
|
||||
|| $domain['dkim_pubkey'] == '')
|
||||
{
|
||||
$max_dkim_id = $this->db->query_first("SELECT MAX(`dkim_id`) as `max_dkim_id` FROM `" . TABLE_PANEL_DOMAINS . "`");
|
||||
$max_dkim_id_stmt = Database::query("SELECT MAX(`dkim_id`) as `max_dkim_id` FROM `" . TABLE_PANEL_DOMAINS . "`");
|
||||
$max_dkim_id = $max_dkim_id_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$domain['dkim_id'] = (int)$max_dkim_id['max_dkim_id'] + 1;
|
||||
$privkey_filename = makeCorrectFile($this->settings['dkim']['dkim_prefix'] . '/dkim_' . $domain['dkim_id']);
|
||||
safe_exec('openssl genrsa -out ' . escapeshellarg($privkey_filename) . ' ' . $this->settings['dkim']['dkim_keylength']);
|
||||
@ -431,7 +432,20 @@ class bind
|
||||
safe_exec('openssl rsa -in ' . escapeshellarg($privkey_filename) . ' -pubout -outform pem -out ' . escapeshellarg($pubkey_filename));
|
||||
$domain['dkim_pubkey'] = file_get_contents($pubkey_filename);
|
||||
safe_exec("chmod 0664 " . escapeshellarg($pubkey_filename));
|
||||
$this->db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `dkim_id` = '" . $domain['dkim_id'] . "', `dkim_privkey` = '" . $domain['dkim_privkey'] . "', `dkim_pubkey` = '" . $domain['dkim_pubkey'] . "' WHERE `id` = '" . $domain['id'] . "'");
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
`dkim_id` = :dkimid,
|
||||
`dkim_privkey` = :privkey,
|
||||
`dkim_pubkey` = :pubkey
|
||||
WHERE `id` = :id
|
||||
");
|
||||
$upd_data = array(
|
||||
'dkimid' => $domain['dkim_id'],
|
||||
'privkey' => $domain['dkim_privkey'],
|
||||
'pubkey' => $domain['dkim_pubkey'],
|
||||
'id' => $domain['id']
|
||||
);
|
||||
Database::pexecute($upd_stmt, $upd_data);
|
||||
}
|
||||
|
||||
if(!file_exists($privkey_filename)
|
||||
@ -471,5 +485,3 @@ class bind
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -17,22 +17,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class apache
|
||||
{
|
||||
private $db = false;
|
||||
private $logger = false;
|
||||
private $debugHandler = false;
|
||||
private $idnaConvert = false;
|
||||
|
||||
// protected
|
||||
|
||||
protected $settings = array();
|
||||
protected $known_vhostfilenames = array();
|
||||
protected $known_diroptionsfilenames = array();
|
||||
@ -49,9 +40,8 @@ class apache
|
||||
*/
|
||||
private $_deactivated = false;
|
||||
|
||||
public function __construct($db, $logger, $debugHandler, $idnaConvert, $settings)
|
||||
public function __construct($logger, $debugHandler, $idnaConvert, $settings)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->logger = $logger;
|
||||
$this->debugHandler = $debugHandler;
|
||||
$this->idnaConvert = $idnaConvert;
|
||||
@ -59,11 +49,6 @@ class apache
|
||||
|
||||
}
|
||||
|
||||
protected function getDB()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function reload()
|
||||
{
|
||||
if((int)$this->settings['phpfpm']['enabled'] == 1)
|
||||
@ -157,9 +142,9 @@ class apache
|
||||
|
||||
public function createIpPort()
|
||||
{
|
||||
$result_ipsandports = $this->db->query("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC");
|
||||
$result_ipsandports_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC");
|
||||
|
||||
while ($row_ipsandports = $this->db->fetch_array($result_ipsandports)) {
|
||||
while ($row_ipsandports = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (filter_var($row_ipsandports['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$ipport = '[' . $row_ipsandports['ip'] . ']:' . $row_ipsandports['port'];
|
||||
} else {
|
||||
@ -375,10 +360,14 @@ class apache
|
||||
$this->_createStandardErrorHandler();
|
||||
}
|
||||
|
||||
/*
|
||||
* We put together the needed php options in the virtualhost entries
|
||||
*/
|
||||
|
||||
/**
|
||||
* We put together the needed php options in the virtualhost entries
|
||||
*
|
||||
* @param array $domain
|
||||
* @param bool $ssl_vhost
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
{
|
||||
$php_options_text = '';
|
||||
@ -404,12 +393,10 @@ class apache
|
||||
return $php_options_text;
|
||||
}
|
||||
|
||||
public function createOwnVhostStarter()
|
||||
{
|
||||
}
|
||||
public function createOwnVhostStarter() {}
|
||||
|
||||
/*
|
||||
* We collect all servernames and Aliases
|
||||
/**
|
||||
* We collect all servernames and Aliases
|
||||
*/
|
||||
protected function getServerNames($domain)
|
||||
{
|
||||
@ -426,9 +413,14 @@ class apache
|
||||
$servernames_text .= ' ServerAlias ' . $server_alias . "\n";
|
||||
}
|
||||
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain`= :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
$server_alias = ' ServerAlias ' . $alias_domain['domain'];
|
||||
|
||||
if ($alias_domain['iswildcarddomain'] == '1') {
|
||||
@ -446,7 +438,7 @@ class apache
|
||||
return $servernames_text;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Let's get the webroot
|
||||
*/
|
||||
protected function getWebroot($domain)
|
||||
@ -469,7 +461,7 @@ class apache
|
||||
return $webroot_text;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Lets set the text part for the stats software
|
||||
*/
|
||||
protected function getStats($domain)
|
||||
@ -506,9 +498,9 @@ class apache
|
||||
return $stats_text;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lets set the logfiles
|
||||
*/
|
||||
/**
|
||||
* Lets set the logfiles
|
||||
*/
|
||||
protected function getLogfiles($domain) {
|
||||
|
||||
$logfiles_text = '';
|
||||
@ -543,11 +535,14 @@ class apache
|
||||
if ((int)$domain['parentdomainid'] == 0) {
|
||||
// prepare the aliases and subdomains for stats config files
|
||||
$server_alias = '';
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
|
||||
WHERE `aliasdomain`=\'' . $domain['id'] . '\'
|
||||
OR `parentdomainid` =\''. $domain['id']. '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain` = :domainid OR `parentdomainid` = :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
|
||||
$server_alias .= ' ' . $alias_domain['domain'] . ' ';
|
||||
|
||||
@ -576,7 +571,7 @@ class apache
|
||||
return $logfiles_text;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the filename for the virtualhost
|
||||
*/
|
||||
protected function getVhostFilename($domain, $ssl_vhost = false)
|
||||
@ -605,7 +600,7 @@ class apache
|
||||
return $vhost_filename;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* We compose the virtualhost entry for one domain
|
||||
*/
|
||||
protected function getVhostContent($domain, $ssl_vhost = false)
|
||||
@ -618,7 +613,7 @@ class apache
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip`
|
||||
WHERE dip.id_domain = '".(int)$domain['id']."' AND i.id = dip.id_ipandports ";
|
||||
WHERE dip.id_domain = :domainid AND i.id = dip.id_ipandports ";
|
||||
|
||||
if ($ssl_vhost === true
|
||||
&& ($domain['ssl'] == '1' || $domain['ssl_redirect'] == '1')
|
||||
@ -630,11 +625,12 @@ class apache
|
||||
}
|
||||
|
||||
$vhost_content = '';
|
||||
$result = $this->db->query($query);
|
||||
$result_stmt = Database::prepare($query);
|
||||
Database::pexecute($result_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
$ipportlist = '';
|
||||
$_vhost_content = '';
|
||||
while ($ipandport = $this->db->fetch_array($result)) {
|
||||
while ($ipandport = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$ipport = '';
|
||||
$domain['ip'] = $ipandport['ip'];
|
||||
@ -677,13 +673,14 @@ class apache
|
||||
// This returns the first port that is != 443 with ssl enabled, if any
|
||||
// ordered by ssl-certificate (if any) so that the ip/port combo
|
||||
// with certificate is used
|
||||
$ssldestport = $this->db->query_first(
|
||||
"SELECT `ip`.`port` FROM ".TABLE_PANEL_IPSANDPORTS." `ip`
|
||||
$ssldestport_stmt = Database::prepare("
|
||||
SELECT `ip`.`port` FROM ".TABLE_PANEL_IPSANDPORTS." `ip`
|
||||
LEFT JOIN `".TABLE_DOMAINTOIP."` `dip` ON (`ip`.`id` = `dip`.`id_ipandports`)
|
||||
WHERE `dip`.`id_domain` = '".(int)$domain['id']."'
|
||||
WHERE `dip`.`id_domain` = :domainid
|
||||
AND `ip`.`ssl` = '1' AND `ip`.`port` != 443
|
||||
ORDER BY `ip`.`ssl_cert_file` DESC, `ip`.`port` LIMIT 1;"
|
||||
);
|
||||
ORDER BY `ip`.`ssl_cert_file` DESC, `ip`.`port` LIMIT 1;
|
||||
");
|
||||
$ssldestport = Database::pexecute_first($ssldestport_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
if ($ssldestport['port'] != '') {
|
||||
$_sslport = ":".$ssldestport['port'];
|
||||
@ -737,7 +734,7 @@ class apache
|
||||
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
|
||||
$corrected_docroot = $this->idnaConvert->encode($domain['documentroot']);
|
||||
|
||||
/* Get domain's redirect code */
|
||||
// Get domain's redirect code
|
||||
$code = getDomainRedirectCode($domain['id']);
|
||||
$modrew_red = '';
|
||||
if ($code != '') {
|
||||
@ -782,7 +779,7 @@ class apache
|
||||
return $vhost_content;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* We compose the virtualhost entries for the domains
|
||||
*/
|
||||
public function createVirtualHosts()
|
||||
@ -811,8 +808,8 @@ class apache
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$result_domains = $this->db->query($query);
|
||||
while ($domain = $this->db->fetch_array($result_domains)) {
|
||||
$result_domains_stmt = Database::query($query);
|
||||
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
fwrite($this->debugHandler, ' apache::createVirtualHosts: creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname'] . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname']);
|
||||
$vhosts_filename = $this->getVhostFilename($domain);
|
||||
@ -838,15 +835,20 @@ class apache
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* We compose the diroption entries for the paths
|
||||
*/
|
||||
public function createFileDirOptions()
|
||||
{
|
||||
$result = $this->db->query('SELECT `htac`.*, `c`.`guid`, `c`.`documentroot` AS `customerroot` FROM `' . TABLE_PANEL_HTACCESS . '` `htac` LEFT JOIN `' . TABLE_PANEL_CUSTOMERS . '` `c` USING (`customerid`) ORDER BY `htac`.`path`');
|
||||
$result_stmt = Database::query("
|
||||
SELECT `htac`.*, `c`.`guid`, `c`.`documentroot` AS `customerroot`
|
||||
FROM `" . TABLE_PANEL_HTACCESS . "` `htac`
|
||||
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING (`customerid`)
|
||||
ORDER BY `htac`.`path`
|
||||
");
|
||||
$diroptions = array();
|
||||
|
||||
while ($row_diroptions = $this->db->fetch_array($result)) {
|
||||
while ($row_diroptions = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($row_diroptions['customerid'] != 0
|
||||
&& isset($row_diroptions['customerroot'])
|
||||
&& $row_diroptions['customerroot'] != ''
|
||||
@ -856,9 +858,14 @@ class apache
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->db->query('SELECT `htpw`.*, `c`.`guid`, `c`.`documentroot` AS `customerroot` FROM `' . TABLE_PANEL_HTPASSWDS . '` `htpw` LEFT JOIN `' . TABLE_PANEL_CUSTOMERS . '` `c` USING (`customerid`) ORDER BY `htpw`.`path`, `htpw`.`username`');
|
||||
$result_stmt = Database::query("
|
||||
SELECT `htpw`.*, `c`.`guid`, `c`.`documentroot` AS `customerroot`
|
||||
FROM `" . TABLE_PANEL_HTPASSWDS . "` `htpw`
|
||||
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING (`customerid`)
|
||||
ORDER BY `htpw`.`path`, `htpw`.`username`
|
||||
");
|
||||
|
||||
while ($row_htpasswds = $this->db->fetch_array($result)) {
|
||||
while ($row_htpasswds = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($row_htpasswds['customerid'] != 0
|
||||
&& isset($row_htpasswds['customerroot'])
|
||||
&& $row_htpasswds['customerroot'] != ''
|
||||
@ -1013,20 +1020,18 @@ class apache
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* We write the configs
|
||||
*/
|
||||
public function writeConfigs()
|
||||
{
|
||||
// Write diroptions
|
||||
|
||||
fwrite($this->debugHandler, ' apache::writeConfigs: rebuilding ' . $this->settings['system']['apacheconf_diroptions'] . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, "rebuilding " . $this->settings['system']['apacheconf_diroptions']);
|
||||
|
||||
if (count($this->diroptions_data) > 0) {
|
||||
if (!isConfigDir($this->settings['system']['apacheconf_diroptions'])) {
|
||||
// Save one big file
|
||||
|
||||
$diroptions_file = '';
|
||||
|
||||
foreach ($this->diroptions_data as $diroptions_filename => $diroptions_content) {
|
||||
@ -1036,7 +1041,6 @@ class apache
|
||||
$diroptions_filename = $this->settings['system']['apacheconf_diroptions'];
|
||||
|
||||
// Apply header
|
||||
|
||||
$diroptions_file = '# ' . basename($diroptions_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $diroptions_file;
|
||||
$diroptions_file_handler = fopen($diroptions_filename, 'w');
|
||||
fwrite($diroptions_file_handler, $diroptions_file);
|
||||
@ -1049,7 +1053,6 @@ class apache
|
||||
}
|
||||
|
||||
// Write a single file for every diroption
|
||||
|
||||
foreach ($this->diroptions_data as $diroptions_filename => $diroptions_file) {
|
||||
$this->known_diroptionsfilenames[] = basename($diroptions_filename);
|
||||
|
||||
@ -1063,7 +1066,6 @@ class apache
|
||||
}
|
||||
|
||||
// Write htpasswds
|
||||
|
||||
fwrite($this->debugHandler, ' apache::writeConfigs: rebuilding ' . $this->settings['system']['apacheconf_htpasswddir'] . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, "rebuilding " . $this->settings['system']['apacheconf_htpasswddir']);
|
||||
|
||||
@ -1090,7 +1092,6 @@ class apache
|
||||
}
|
||||
|
||||
// Write virtualhosts
|
||||
|
||||
fwrite($this->debugHandler, ' apache::writeConfigs: rebuilding ' . $this->settings['system']['apacheconf_vhost'] . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, "rebuilding " . $this->settings['system']['apacheconf_vhost']);
|
||||
|
||||
@ -1111,7 +1112,6 @@ class apache
|
||||
}
|
||||
|
||||
// Include diroptions file in case it exists
|
||||
|
||||
if (file_exists($this->settings['system']['apacheconf_diroptions'])) {
|
||||
$vhosts_file.= "\n" . 'Include ' . $this->settings['system']['apacheconf_diroptions'] . "\n\n";
|
||||
}
|
||||
|
@ -17,13 +17,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class apache_fcgid extends apache
|
||||
{
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
|
@ -18,22 +18,13 @@
|
||||
* @TODO ssl-redirect to non-standard port
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi'
|
||||
) {
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class lighttpd
|
||||
{
|
||||
private $db = false;
|
||||
private $logger = false;
|
||||
private $debugHandler = false;
|
||||
private $idnaConvert = false;
|
||||
|
||||
// protected
|
||||
|
||||
protected $settings = array();
|
||||
protected $lighttpd_data = array();
|
||||
protected $needed_htpasswds = array();
|
||||
@ -49,20 +40,14 @@ class lighttpd
|
||||
*/
|
||||
private $_deactivated = false;
|
||||
|
||||
public function __construct($db, $logger, $debugHandler, $idnaConvert, $settings)
|
||||
public function __construct($logger, $debugHandler, $idnaConvert, $settings)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->logger = $logger;
|
||||
$this->debugHandler = $debugHandler;
|
||||
$this->idnaConvert = $idnaConvert;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
protected function getDB()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function reload()
|
||||
{
|
||||
if ((int)$this->settings['phpfpm']['enabled'] == 1) {
|
||||
@ -77,10 +62,9 @@ class lighttpd
|
||||
|
||||
public function createIpPort()
|
||||
{
|
||||
$query = "SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC";
|
||||
$result_ipsandports = $this->db->query($query);
|
||||
$result_ipsandports_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC");
|
||||
|
||||
while ($row_ipsandports = $this->db->fetch_array($result_ipsandports)) {
|
||||
while ($row_ipsandports = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (filter_var($row_ipsandports['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$ip = '[' . $row_ipsandports['ip'] . ']';
|
||||
$port = $row_ipsandports['port'];
|
||||
@ -242,11 +226,14 @@ class lighttpd
|
||||
protected function create_htaccess($domain)
|
||||
{
|
||||
$needed_htpasswds = array();
|
||||
$htpasswd_query = "SELECT * FROM " . TABLE_PANEL_HTPASSWDS . " WHERE `path` LIKE '" . $domain['documentroot'] . "%'";
|
||||
$result_htpasswds = $this->db->query($htpasswd_query);
|
||||
$result_htpasswds_stmt = Database::prepare("
|
||||
SELECT * FROM " . TABLE_PANEL_HTPASSWDS . "
|
||||
WHERE `path` LIKE :docroot
|
||||
");
|
||||
Database::pexecute($result_htpasswds_stmt, array('docroot' => $domain['documentroot'] . '%'));
|
||||
|
||||
$htaccess_text = '';
|
||||
while ($row_htpasswds = $this->db->fetch_array($result_htpasswds)) {
|
||||
while ($row_htpasswds = $result_htpasswds_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$row_htpasswds['path'] = makeCorrectDir($row_htpasswds['path']);
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row_htpasswds['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
@ -328,8 +315,8 @@ class lighttpd
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$included_vhosts = array();
|
||||
$result_domains = $this->db->query($query);
|
||||
while ($domain = $this->db->fetch_array($result_domains)) {
|
||||
$result_domains_stmt = Database::query($query);
|
||||
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (is_dir($this->settings['system']['apacheconf_vhost'])) {
|
||||
safe_exec('mkdir -p '.escapeshellarg(makeCorrectDir($this->settings['system']['apacheconf_vhost'].'/vhosts/')));
|
||||
@ -418,13 +405,14 @@ class lighttpd
|
||||
// This returns the first port that is != 443 with ssl enabled, if any
|
||||
// ordered by ssl-certificate (if any) so that the ip/port combo
|
||||
// with certificate is used
|
||||
$ssldestport = $this->db->query_first(
|
||||
$ssldestport_stmt = Database::prepare(
|
||||
"SELECT `ip`.`port` FROM ".TABLE_PANEL_IPSANDPORTS." `ip`
|
||||
LEFT JOIN `".TABLE_DOMAINTOIP."` `dip` ON (`ip`.`id` = `dip`.`id_ipandports`)
|
||||
WHERE `dip`.`id_domain` = '".(int)$domain['id']."'
|
||||
WHERE `dip`.`id_domain` = :domainid
|
||||
AND `ip`.`ssl` = '1' AND `ip`.`port` != 443
|
||||
ORDER BY `ip`.`ssl_cert_file` DESC, `ip`.`port` LIMIT 1;"
|
||||
);
|
||||
$ssldestport = Database::pexecute_first($ssldestport_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
if ($ssldestport['port'] != '') {
|
||||
$_sslport = ":".$ssldestport['port'];
|
||||
@ -457,8 +445,11 @@ class lighttpd
|
||||
$vhost_content.= $this->composePhpOptions($domain);
|
||||
$vhost_content.= $this->getStats($domain);
|
||||
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` WHERE `id`='".$ipid."';";
|
||||
$ipandport = $this->db->query_first($query);
|
||||
$ipandport_stmt = Database::prepare("
|
||||
SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."`
|
||||
WHERE `id` = :id
|
||||
");
|
||||
$ipandport = Database::pexecute_first($ipandport_stmt, array('id' => $ipid));
|
||||
|
||||
$domain['ip'] = $ipandport['ip'];
|
||||
$domain['port'] = $ipandport['port'];
|
||||
@ -544,7 +535,6 @@ class lighttpd
|
||||
// The normal access/error - logging is enabled
|
||||
// error log cannot be set conditionally see
|
||||
// https://redmine.lighttpd.net/issues/665
|
||||
|
||||
$access_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
// Create the logfile if it does not exist (fixes #46)
|
||||
touch($access_log);
|
||||
@ -558,11 +548,14 @@ class lighttpd
|
||||
if ((int)$domain['parentdomainid'] == 0) {
|
||||
// prepare the aliases and subdomains for stats config files
|
||||
$server_alias = '';
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
|
||||
WHERE `aliasdomain`=\'' . $domain['id'] . '\'
|
||||
OR `parentdomainid` =\''. $domain['id']. '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain` = :domainid OR `parentdomainid` = :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
|
||||
$server_alias.= ' ' . $alias_domain['domain'] . ' ';
|
||||
|
||||
@ -600,13 +593,16 @@ class lighttpd
|
||||
|
||||
protected function create_pathOptions($domain)
|
||||
{
|
||||
$query = "SELECT * FROM " . TABLE_PANEL_HTACCESS . " WHERE `path` LIKE '" . $domain['documentroot'] . "%'";
|
||||
$result = $this->db->query($query);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM " . TABLE_PANEL_HTACCESS . "
|
||||
WHERE `path` LIKE :docroot
|
||||
");
|
||||
Database::pexecute($result_stmt, array('docroot' => $domain['documentroot'] . '%'));
|
||||
|
||||
$path_options = '';
|
||||
$error_string = '';
|
||||
|
||||
while ($row = $this->db->fetch_array($result)) {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (!empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
@ -661,10 +657,13 @@ class lighttpd
|
||||
|
||||
protected function getDirOptions($domain)
|
||||
{
|
||||
$query = "SELECT * FROM " . TABLE_PANEL_HTPASSWDS . " WHERE `customerid`='" . $domain['customerid'] . "'";
|
||||
$result = $this->db->query($query);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM " . TABLE_PANEL_HTPASSWDS . "
|
||||
WHERE `customerid` = :customerid
|
||||
");
|
||||
Database::pexecute($result_stmt, array('customerid' => $domain['customerid']));
|
||||
|
||||
while ($row_htpasswds = $this->db->fetch_array($result)) {
|
||||
while ($row_htpasswds = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($auth_backend_loaded[$domain['ipandport']] != 'yes'
|
||||
&& $auth_backend_loaded[$domain['ssl_ipandport']] != 'yes'
|
||||
) {
|
||||
@ -721,9 +720,14 @@ class lighttpd
|
||||
}
|
||||
}
|
||||
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain` = :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
$alias_domain_name = ereg_replace('\.', '\.', $alias_domain['domain']);
|
||||
|
||||
if ($alias_domain['iswildcarddomain'] == '1') {
|
||||
@ -800,10 +804,9 @@ class lighttpd
|
||||
return $webroot_text;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lets set the text part for the stats software
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lets set the text part for the stats software
|
||||
*/
|
||||
protected function getStats($domain)
|
||||
{
|
||||
$stats_text = '';
|
||||
@ -896,7 +899,6 @@ class lighttpd
|
||||
}
|
||||
|
||||
// Write the diroptions
|
||||
|
||||
if (isConfigDir($this->settings['system']['apacheconf_htpasswddir'])) {
|
||||
foreach ($this->needed_htpasswds as $key => $data) {
|
||||
if (!is_dir($this->settings['system']['apacheconf_htpasswddir'])) {
|
||||
|
@ -15,13 +15,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class lighttpd_fcgid extends lighttpd
|
||||
{
|
||||
protected function composePhpOptions($domain)
|
||||
|
@ -15,23 +15,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class nginx
|
||||
{
|
||||
private $db = false;
|
||||
private $logger = false;
|
||||
private $debugHandler = false;
|
||||
private $idnaConvert = false;
|
||||
private $nginx_server = array();
|
||||
|
||||
// protected
|
||||
|
||||
protected $settings = array();
|
||||
protected $nginx_data = array();
|
||||
protected $needed_htpasswds = array();
|
||||
@ -49,9 +40,8 @@ class nginx
|
||||
*/
|
||||
private $_deactivated = false;
|
||||
|
||||
public function __construct($db, $logger, $debugHandler, $idnaConvert, $settings, $nginx_server=array())
|
||||
public function __construct($logger, $debugHandler, $idnaConvert, $settings, $nginx_server=array())
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->logger = $logger;
|
||||
$this->debugHandler = $debugHandler;
|
||||
$this->idnaConvert = $idnaConvert;
|
||||
@ -59,11 +49,6 @@ class nginx
|
||||
$this->nginx_server = $nginx_server;
|
||||
}
|
||||
|
||||
protected function getDB()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function reload()
|
||||
{
|
||||
fwrite($this->debugHandler, ' nginx::reload: reloading nginx' . "\n");
|
||||
@ -134,10 +119,11 @@ class nginx
|
||||
|
||||
public function createIpPort()
|
||||
{
|
||||
$query = "SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC";
|
||||
$result_ipsandports = $this->db->query($query);
|
||||
$result_ipsandports_stmt = Database::query("
|
||||
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC
|
||||
");
|
||||
|
||||
while ($row_ipsandports = $this->db->fetch_array($result_ipsandports)) {
|
||||
while ($row_ipsandports = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (filter_var($row_ipsandports['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$ip = '[' . $row_ipsandports['ip'] . ']';
|
||||
} else {
|
||||
@ -287,8 +273,8 @@ class nginx
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$result_domains = $this->db->query($query);
|
||||
while ($domain = $this->db->fetch_array($result_domains)) {
|
||||
$result_domains_stmt = Database::query($query);
|
||||
while ($domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (is_dir($this->settings['system']['apacheconf_vhost'])) {
|
||||
safe_exec('mkdir -p '.escapeshellarg(makeCorrectDir($this->settings['system']['apacheconf_vhost'])));
|
||||
@ -356,7 +342,9 @@ class nginx
|
||||
$vhost_content = '';
|
||||
$_vhost_content = '';
|
||||
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip` WHERE dip.id_domain = '".$domain['id']."' AND i.id = dip.id_ipandports ";
|
||||
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip`
|
||||
WHERE dip.id_domain = :domainid AND i.id = dip.id_ipandports ";
|
||||
|
||||
if ($ssl_vhost === true
|
||||
&& ($domain['ssl'] == '1' || $domain['ssl_redirect'] == '1')
|
||||
) {
|
||||
@ -370,8 +358,10 @@ class nginx
|
||||
// start vhost
|
||||
$vhost_content.= 'server { ' . "\n";
|
||||
|
||||
$result = $this->db->query($query);
|
||||
while ($ipandport = $this->db->fetch_array($result)) {
|
||||
$result_stmt = Database::prepare($query);
|
||||
Database::pexecute($result_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while ($ipandport = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$domain['ip'] = $ipandport['ip'];
|
||||
$domain['port'] = $ipandport['port'];
|
||||
@ -415,13 +405,14 @@ class nginx
|
||||
// This returns the first port that is != 443 with ssl enabled, if any
|
||||
// ordered by ssl-certificate (if any) so that the ip/port combo
|
||||
// with certificate is used
|
||||
$ssldestport = $this->db->query_first(
|
||||
$ssldestport_stmt = Database::prepare(
|
||||
"SELECT `ip`.`port` FROM ".TABLE_PANEL_IPSANDPORTS." `ip`
|
||||
LEFT JOIN `".TABLE_DOMAINTOIP."` `dip` ON (`ip`.`id` = `dip`.`id_ipandports`)
|
||||
WHERE `dip`.`id_domain` = '".(int)$domain['id']."'
|
||||
WHERE `dip`.`id_domain` = :domainid
|
||||
AND `ip`.`ssl` = '1' AND `ip`.`port` != 443
|
||||
ORDER BY `ip`.`ssl_cert_file` DESC, `ip`.`port` LIMIT 1;"
|
||||
);
|
||||
$ssldestport = Database::pexecute_first($ssldestport_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
if ($ssldestport['port'] != '') {
|
||||
$_sslport = ":".$ssldestport['port'];
|
||||
@ -575,14 +566,17 @@ class nginx
|
||||
{
|
||||
$has_location = false;
|
||||
|
||||
$query = "SELECT * FROM " . TABLE_PANEL_HTACCESS . " WHERE `path` LIKE '" . $domain['documentroot'] . "%'";
|
||||
$result = $this->db->query($query);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM " . TABLE_PANEL_HTACCESS . "
|
||||
WHERE `path` LIKE :docroot
|
||||
");
|
||||
Database::pexecute($result_stmt, array('docroot' => $domain['documentroot'] . '%'));
|
||||
|
||||
$path_options = '';
|
||||
$htpasswds = $this->getHtpasswds($domain);
|
||||
|
||||
// for each entry in the htaccess table
|
||||
while ($row = $this->db->fetch_array($result)) {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (!empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
if (!validateUrl($defhandler)) {
|
||||
@ -680,9 +674,7 @@ class nginx
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* now the rest of the htpasswds
|
||||
*/
|
||||
// now the rest of the htpasswds
|
||||
if (count($htpasswds) > 0) {
|
||||
foreach ($htpasswds as $idx => $single) {
|
||||
//if ($single['path'] != '/') {
|
||||
@ -708,17 +700,17 @@ class nginx
|
||||
|
||||
protected function getHtpasswds($domain) {
|
||||
|
||||
$query = 'SELECT DISTINCT *
|
||||
FROM ' . TABLE_PANEL_HTPASSWDS . ' AS a
|
||||
JOIN ' . TABLE_PANEL_DOMAINS . ' AS b
|
||||
USING (`customerid`)
|
||||
WHERE b.customerid=' . $domain['customerid'] . ' AND b.domain="' . $domain['domain'] . '";';
|
||||
|
||||
$result = $this->db->query($query);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT DISTINCT *
|
||||
FROM `" . TABLE_PANEL_HTPASSWDS . "` AS a
|
||||
JOIN `" . TABLE_PANEL_DOMAINS . "` AS b USING (`customerid`)
|
||||
WHERE b.customerid = :customerid AND b.domain = :domain
|
||||
");
|
||||
Database::pexecute($result_stmt, array('customerid' => $domain['customerid'], 'domain' => $domain['domain']));
|
||||
|
||||
$returnval = array();
|
||||
$x = 0;
|
||||
while ($row_htpasswds = $this->db->fetch_array($result)) {
|
||||
while ($row_htpasswds = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (count($row_htpasswds) > 0) {
|
||||
$htpasswd_filename = makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd');
|
||||
|
||||
@ -874,11 +866,14 @@ class nginx
|
||||
if ((int)$domain['parentdomainid'] == 0) {
|
||||
// prepare the aliases and subdomains for stats config files
|
||||
$server_alias = '';
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
|
||||
WHERE `aliasdomain`=\'' . $domain['id'] . '\'
|
||||
OR `parentdomainid` =\''. $domain['id']. '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain` = :domainid OR `parentdomainid` = :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
$server_alias .= ' ' . $alias_domain['domain'] . ' ';
|
||||
|
||||
if ($alias_domain['iswildcarddomain'] == '1') {
|
||||
@ -924,9 +919,14 @@ class nginx
|
||||
$server_alias = 'www.' . $domain['domain'];
|
||||
}
|
||||
|
||||
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\'');
|
||||
$alias_domains_stmt = Database::prepare("
|
||||
SELECT `domain`, `iswildcarddomain`, `wwwserveralias`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `aliasdomain` = :domainid
|
||||
");
|
||||
Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id']));
|
||||
|
||||
while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
|
||||
while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) {
|
||||
$server_alias .= ' ' . $alias_domain['domain'];
|
||||
|
||||
if ($alias_domain['iswildcarddomain'] == '1') {
|
||||
@ -994,9 +994,7 @@ class nginx
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* htaccess stuff
|
||||
*/
|
||||
// htaccess stuff
|
||||
if (count($this->htpasswds_data) > 0) {
|
||||
if (!file_exists($this->settings['system']['apacheconf_htpasswddir'])) {
|
||||
$umask = umask();
|
||||
|
@ -15,13 +15,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script only works in the shell.');
|
||||
}
|
||||
|
||||
class nginx_phpfpm extends nginx
|
||||
{
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
|
@ -73,7 +73,7 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
}
|
||||
}
|
||||
|
||||
$webserver = new $websrv($db, $cronlog, $debugHandler, $idna_convert, $settings);
|
||||
$webserver = new $websrv($cronlog, $debugHandler, $idna_convert, $settings);
|
||||
}
|
||||
|
||||
if (isset($webserver)) {
|
||||
@ -153,7 +153,7 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
*/
|
||||
elseif ($row['type'] == '4' && (int)$settings['system']['bind_enable'] != 0) {
|
||||
if (!isset($nameserver)) {
|
||||
$nameserver = new bind($db, $cronlog, $debugHandler, $settings);
|
||||
$nameserver = new bind($cronlog, $debugHandler, $settings);
|
||||
}
|
||||
|
||||
if ($settings['dkim']['use_dkim'] == '1') {
|
||||
|
@ -64,9 +64,9 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
}
|
||||
|
||||
// include english language file (fallback)
|
||||
include_once makeCorrectFile($pathtophpfiles . '/lng/english.lng.php');
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
|
||||
// include admin/customer language file
|
||||
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
|
||||
|
||||
// Get mail templates from database; the ones from 'admin' are fetched for fallback
|
||||
$result2_stmt = Database::prepare("
|
||||
@ -154,9 +154,9 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
}
|
||||
|
||||
// include english language file (fallback)
|
||||
include_once makeCorrectFile($pathtophpfiles . '/lng/english.lng.php');
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
|
||||
// include admin/customer language file
|
||||
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
|
||||
|
||||
// Get mail templates from database; the ones from 'admin' are fetched for fallback
|
||||
$result2_stmt = Database::prepare("
|
||||
|
@ -84,9 +84,9 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
}
|
||||
|
||||
// include english language file (fallback)
|
||||
include_once makeCorrectFile($pathtophpfiles . '/lng/english.lng.php');
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
|
||||
// include admin/customer language file
|
||||
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
|
||||
|
||||
// Get mail templates from database; the ones from 'admin' are fetched for fallback
|
||||
$result2_stmt = Database::prepare("
|
||||
@ -182,9 +182,9 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
}
|
||||
|
||||
// include english language file (fallback)
|
||||
include_once makeCorrectFile($pathtophpfiles . '/lng/english.lng.php');
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/lng/english.lng.php');
|
||||
// include admin/customer language file
|
||||
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
|
||||
include_once makeCorrectFile(FROXLOR_INSTALL_DIR . '/' . $langfile);
|
||||
|
||||
// Get mail templates from database; the ones from 'admin' are fetched for fallback
|
||||
$result2_stmt = Database::prepare("
|
||||
|
Loading…
Reference in New Issue
Block a user