diff --git a/.gitignore b/.gitignore index 1a3b8bd98ef0ed25aa2dcfd12fa9671e256d0e5d..d42aee61f4caf9d716977a21353bf598c3092220 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +.phplint-cache diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..f2f552088d76ac018c4df2caac9858ac7af2c77a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +# Defines stages which are to be executed +stages: + - syntax + +# +### Stage syntax +# + +syntax:lint: + stage: syntax + image: bobey/docker-gitlab-ci-runner-php7 + allow_failure: false + only: + - schedules + - web + + script: + - composer require overtrue/phplint + - echo "Syntax checking PHP files" + - echo "For more information http://www.icosaedro.it/phplint/" + - vendor/bin/phplint diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000000000000000000000000000000000000..10fd2a25afd2045c793bba0fd59d188fbbb6edf6 --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,9 @@ +path: ./ +jobs: 10 +cache: .phplint-cache +extensions: + - php + - lng +exclude: + - vendor + diff --git a/README.md b/README.md index 32a565477585ffc1230f20505f96c544b0891c2f..79b657b574b9a16854958b3c2e404523fff3f5cc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # ISPConfig - Hosting Control Panel +Nightly (master): [![pipeline status](https://git.ispconfig.org/ispconfig/ispconfig3/badges/master/pipeline.svg)](https://git.ispconfig.org/ispconfig/ispconfig3/commits/master) +Stable branch: [![pipeline status](https://git.ispconfig.org/ispconfig/ispconfig3/badges/stable-3.1/pipeline.svg)](https://git.ispconfig.org/ispconfig/ispconfig3/commits/stable-3.1) + + - Manage multiple servers from one control panel - Web server management (Apache2 and nginx) - Mail server management (with virtual mail users) diff --git a/addons/empty.dir b/addons/empty.dir new file mode 100644 index 0000000000000000000000000000000000000000..95ba9ef37cca69318bcba17e67cd44ae84bd41e1 --- /dev/null +++ b/addons/empty.dir @@ -0,0 +1 @@ +This empty directory is needed by ISPConfig. diff --git a/docs/autoinstall_samples/autoinstall.conf_sample.php b/docs/autoinstall_samples/autoinstall.conf_sample.php index b5f3a577305e2780ae1c5de46138e08d72d53c6b..922664629f93bf66f7ac4adb0d53e1d8c1c24f2a 100644 --- a/docs/autoinstall_samples/autoinstall.conf_sample.php +++ b/docs/autoinstall_samples/autoinstall.conf_sample.php @@ -57,9 +57,7 @@ $autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no $autoupdate['svc_detect_change_mail_server'] = 'yes'; // yes (default), no $autoupdate['svc_detect_change_web_server'] = 'yes'; // yes (default), no $autoupdate['svc_detect_change_dns_server'] = 'yes'; // yes (default), no -$autoupdate['svc_detect_change_xmpp_server'] = 'yes'; // yes (default), no $autoupdate['svc_detect_change_firewall_server'] = 'yes'; // yes (default), no -$autoupdate['svc_detect_change_vserver_server'] = 'yes'; // yes (default), no $autoupdate['svc_detect_change_db_server'] = 'yes'; // yes (default), no ?> \ No newline at end of file diff --git a/docs/hardening/anti-bruteforce/wp-auth.conf b/docs/hardening/anti-bruteforce/wp-auth.conf index 2acad450ca7f5f8a41f38a4e45a91418f9478c60..1fc420c87d36994c5f3b1c2bff0dd5c7b2717c4f 100644 --- a/docs/hardening/anti-bruteforce/wp-auth.conf +++ b/docs/hardening/anti-bruteforce/wp-auth.conf @@ -2,4 +2,9 @@ # This goes into /etc/fail2ban/filter.d/wp-auth.conf # [Definition] - failregex = ^ .* "POST /wp-login.php \ No newline at end of file +failregex = ^ .* "POST /wp-login.php + ^ .* "POST /wordpress/wp-login.php + ^ .* "POST /wp/wp-login.php + ^ .* "GET /login_page.php +#ignoreregex = + \ No newline at end of file diff --git a/helper_scripts/gentoo_setup.sh b/helper_scripts/gentoo_setup.sh index 3c736a378eb5ac53f7411ad284ab5e588f4d7479..526d2ac1108a6c04499c08d7b088386d69358773 100644 --- a/helper_scripts/gentoo_setup.sh +++ b/helper_scripts/gentoo_setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2009, Scott Barr # All rights reserved. # diff --git a/helper_scripts/pdns-slave-zone-cleanup.sh b/helper_scripts/pdns-slave-zone-cleanup.sh index 0e64a50432a231335f5a71f04b00ed54a9246faa..65348da870ff4f85dff91bebf60ebdbdbdbed468 100755 --- a/helper_scripts/pdns-slave-zone-cleanup.sh +++ b/helper_scripts/pdns-slave-zone-cleanup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #### Config ################################ DBHOST="localhost" diff --git a/helper_scripts/setup_in_openvz/diff_openssl.cnf b/helper_scripts/setup_in_openvz/diff_openssl.cnf deleted file mode 100644 index 4a3c7e6aa19504cb5f646cefe8c29ee57952826e..0000000000000000000000000000000000000000 --- a/helper_scripts/setup_in_openvz/diff_openssl.cnf +++ /dev/null @@ -1,25 +0,0 @@ -# diff openssl.cnf /usr/lib/ssl/openssl.cnf -68c68 -< default_days = 3653 # how long to certify for ---- -> default_days = 365 # how long to certify for -125c125 -< countryName_default = YOURCOUNTRY ---- -> countryName_default = AU -130c130 -< stateOrProvinceName_default = YOURPROVINCE ---- -> stateOrProvinceName_default = Some-State -135c135 -< 0.organizationName_default = YOURDOMAIN ---- -> 0.organizationName_default = Internet Widgits Pty Ltd -142c142 -< organizationalUnitName_default = ISP ---- -> #organizationalUnitName_default = -145d144 -< commonName_default = YOURHOSTNAME -149d147 -< emailAddress_default = postmaster@YOURDOMAIN diff --git a/helper_scripts/setup_in_openvz/install_server.sh b/helper_scripts/setup_in_openvz/install_server.sh deleted file mode 100644 index 1cc05841703b3fe7cb268b4086ea90d8991a9261..0000000000000000000000000000000000000000 --- a/helper_scripts/setup_in_openvz/install_server.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# Script to configuring an ispconfig3 server in a Debian VPS -# by calocen [at] gmail [dot] com - -# getting some enviromment values -myhostname=`hostname -f` -mydomain=`hostname -d` -myip=`hostname -i` -[ ! -x /usr/bin/geoiplookup ] && apt-get --assume-yes install geoip-bin -mycountry=`geoiplookup $myip | cut -f4 -d" " | cut -f1 -d","` -myprovince=`geoiplookup $myip | cut -f5 -d" "` - -# reconfiguring webalizer, postfix -# could be cool to modify here webalizer values -dpkg-reconfigure -u webalizer -postconf -e "myhostname = $myhostname" -postconf -e "mydestination = $myhostname, localhost" -echo $myhostname > /etc/mailname -dpkg-reconfigure -u postfix - -# request new password -oldpwd=`grep password /root/.my.cnf | tr "\t" " " | tr -s " " | cut -f3 -d" "` -read -p "mysql password: [$oldpwd] " mysqlpwd -[ -z $mysqlpwd ] && mysqlpwd=$oldpwd -echo $mysqlpwd -#read -p "Are you sure? (y/n) " sure -## who said fear ## -set -x -mysqladmin -u root -p$oldpwd password $mysqlpwd -mysqladmin -u root -p$mysqlpwd -h localhost password $mysqlpwd -cat << EOF > /root/.my.cnf -[client] -password = $mysqlpwd -EOF -chmod 600 /root/.my.cnf - -# changing mydns password -mysql -e "SET PASSWORD FOR 'mydns'@'%' = PASSWORD( '$mysqlpwd' )" -mysql -e "SET PASSWORD FOR 'mydns'@'localhost' = PASSWORD( '$mysqlpwd' )" -cp -ax /etc/mydns.conf /etc/mydns.conf~ -sed s/$oldpwd/$mysqlpwd/g < /etc/mydns.conf~ > /etc/mydns.conf - -# enabling mydns -mydns --create-tables > /tmp/mydns.sql -mysql -e "CREATE DATABASE IF NOT EXISTS mydns ; USE mydns ; SOURCE /tmp/mydns.sql;" -rm /tmp/mydns.* -invoke-rc.d mydns restart - -# preparing server installation -mv /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf~ -sed s/"YOURHOSTNAME"/"$myhostname"/g < /usr/local/bin/openssl.cnf | -sed s/"YOURDOMAIN"/"$mydomain"/g | \ -sed s/"YOURCOUNTRY"/"$mycountry"/g | \ -sed s/"YOURPROVINCE"/"$myprovince"/g > /etc/ssl/openssl.cnf - -tar xfz /root/downloads/ISPConfig-3.0.0.7-beta.tar.gz -C /usr/local/src -# here would be some stuff to update from SVN -cd /usr/local/src/ispconfig3_install/install/ -php -q install.php - - diff --git a/helper_scripts/setup_in_openvz/recreate_ssh_and_hostname.sh b/helper_scripts/setup_in_openvz/recreate_ssh_and_hostname.sh deleted file mode 100644 index 72c2ab61a2779f8acaa69ae32225c89e31187862..0000000000000000000000000000000000000000 --- a/helper_scripts/setup_in_openvz/recreate_ssh_and_hostname.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -x -echo "" > /etc/resolv.conf -echo "" > /etc/hostname -echo "" > /etc/mailname -rm -f /etc/ssh/ssh_host_* -cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys -#!/bin/bash -ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N '' -ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N '' -dpkg-reconfigure -u webalizer -postconf -e "myhostname = $(hostname -f)" -postconf -e "mydestination = $(hostname -f), localhost" -echo $(hostname -f) > /etc/mailname -dpkg-reconfigure -u postfix -rm -f \$0 -EOF -chmod a+x /etc/rc2.d/S15ssh_gen_host_keys diff --git a/helper_scripts/test_mailqueue.php b/helper_scripts/test_mailqueue.php new file mode 100644 index 0000000000000000000000000000000000000000..0d5600b390ae02020d4a19e766bc7186060fe99a --- /dev/null +++ b/helper_scripts/test_mailqueue.php @@ -0,0 +1,45 @@ +auth->check_module_permissions('admin'); + +$app->uses('getconf,ispcmail'); +$mail_config = $app->getconf->get_global_config('mail'); +if($mail_config['smtp_enabled'] == 'y') { + $mail_config['use_smtp'] = true; + $app->ispcmail->setOptions($mail_config); +} + +$to = 't.heller@timmehosting.de'; +$subject = 'Test von ISPConfig-Mailqueue'; +$text = '123'."\n\n".date(DATE_RFC822)."\n\n".'SMTP: '.$mail_config['use_smtp']; +$from = 'ispconfig@thomas.timmeserver.de'; +$filepath = ''; +$filetype = 'application/pdf'; +$filename = ''; +$cc = ''; +$bcc = ''; +$from_name = 'ISPConfig'; + +$app->ispcmail->setSender($from, $from_name); +$app->ispcmail->setSubject($subject); +$app->ispcmail->setMailText($text); + +if($filepath != '') { + if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath); + $app->ispcmail->readAttachFile($filepath); +} + +if($cc != '') $app->ispcmail->setHeader('Cc', $cc); +if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc); + +$app->ispcmail->send($to); +$app->ispcmail->finish(); + +echo $text; + diff --git a/helper_scripts/ubuntu-amavisd-new-2.11.patch b/helper_scripts/ubuntu-amavisd-new-2.11.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac0ecb2dc0512b6fe91c2ba905bd0797fd2edc5b --- /dev/null +++ b/helper_scripts/ubuntu-amavisd-new-2.11.patch @@ -0,0 +1,18 @@ +--- amavisd-new.orig 2017-11-16 11:51:19.000000000 +0100 ++++ amavisd-new 2018-05-25 16:53:45.623398108 +0200 +@@ -22829,6 +22829,7 @@ + } + # load policy banks from the 'client_ipaddr_policy' lookup + Amavis::load_policy_bank($_,$msginfo) for @bank_names_cl; ++ $msginfo->originating(c('originating')); + + $msginfo->client_addr($cl_ip); # ADDR + $msginfo->client_port($cl_port); # PORT +@@ -34361,6 +34362,7 @@ + $sig_ind++; + } + Amavis::load_policy_bank($_,$msginfo) for @bank_names; ++ $msginfo->originating(c('originating')); + $msginfo->dkim_signatures_valid(\@signatures_valid) if @signatures_valid; + # if (ll(5) && $sig_ind > 0) { + # # show which header fields are covered by which signature diff --git a/helper_scripts/utils.sh b/helper_scripts/utils.sh index b42fd32dc2e9bcca2aebe84e77c5f03adc073d0f..2a473b7fbddbb3f36b4c0327e00105d2f0fdddff 100644 --- a/helper_scripts/utils.sh +++ b/helper_scripts/utils.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # this is a bash script library to be called by other scripts, # but not to be run directly diff --git a/install/apps/metronome-init b/install/apps/metronome-init deleted file mode 100644 index 19e0a19c086dc43954a0a6921e49b89f1d0327ef..0000000000000000000000000000000000000000 --- a/install/apps/metronome-init +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh -# -# metronome Start/stop metronome server -# - -### BEGIN INIT INFO -# Provides: metronome -# Required-Start: $remote_fs $network $named $time -# Required-Stop: $remote_fs $network $named $time -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Starts metronome server -# Description: Starts metronome server, an XMPP server written in Lua. -### END INIT INFO - -METRONOME=/usr/bin/metronomectl -PIDDIR=/var/run/metronome -NAME=metronome - -test -e $METRONOME || exit 0 - -start() -{ - mkdir $PIDDIR -p - chown metronome:metronome $PIDDIR - chmod 750 $PIDDIR - - $METRONOME start >> /dev/null -} - -stop() -{ - $METRONOME stop >> /dev/null -} - -reload() -{ - $METRONOME reload >> /dev/null -} - -restart() -{ - $METRONOME restart >> /dev/null -} - -case "$1" in - start) - echo -n "Starting Metronome..." - start & - ;; - stop) - echo -n "Stopping Metronome..." - stop & - ;; - reload) - echo -n "Reloading Metronome config..." - reload & - ;; - restart) - echo -n "Restarting Metronome..." - restart & - ;; - *) - echo "Usage: $0 {start|stop|reload|restart}" >&2 - exit 1 - ;; -esac - -if [ $? -eq 0 ]; then - echo . -else - echo " failed!" -fi - -exit 0 diff --git a/install/apps/xmpp_libs/auth_prosody/authenticate_isp.sh b/install/apps/xmpp_libs/auth_prosody/authenticate_isp.sh deleted file mode 100644 index 1992fae0b7f3ae54391ea9aa25a6582bd42aaa5c..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/auth_prosody/authenticate_isp.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -IFS=":" -AUTH_OK=1 -AUTH_FAILED=0 -LOGFILE="/var/log/prosody/auth.log" -USELOG=true - -while read ACTION USER HOST PASS ; do - - [ $USELOG == true ] && { echo "Date: $(date) Action: $ACTION User: $USER Host: $HOST" >> $LOGFILE; } - - case $ACTION in - "auth") - if [ `/usr/bin/php /usr/local/lib/prosody/auth/db_auth.php $USER $HOST $PASS 2>/dev/null` == 1 ] ; then - echo $AUTH_OK - [ $USELOG == true ] && { echo "AUTH OK" >> $LOGFILE; } - else - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "AUTH FAILED" >> $LOGFILE; } - fi - ;; - "isuser") - if [ `/usr/bin/php /usr/local/lib/prosody/auth/db_isuser.php $USER $HOST 2>/dev/null` == 1 ] ; then - echo $AUTH_OK - [ $USELOG == true ] && { echo "ISUSER OK" >> $LOGFILE; } - else - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "ISUSER FAILED" >> $LOGFILE; } - fi - ;; - *) - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "UNKNOWN ACTION GIVEN: $ACTION" >> $LOGFILE; } - ;; - esac - -done diff --git a/install/apps/xmpp_libs/auth_prosody/db_auth.php b/install/apps/xmpp_libs/auth_prosody/db_auth.php deleted file mode 100644 index 2d3faa3379eb6765b20f9d12dff210cd47147f41..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/auth_prosody/db_auth.php +++ /dev/null @@ -1,48 +0,0 @@ -real_escape_string($arg_email); - $query = $db->prepare("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?"); - $query->bind_param('si', $arg_email, $isp_server_id); - $query->execute(); - $query->bind_result($jid, $password); - $query->fetch(); - $query->close(); - - result_false(is_null($jid)); - checkAuth($arg_password, $password); -}catch(Exception $ex){ - echo 0; - exit(); -} - -function result_false($cond = true){ - if(!$cond) return; - echo 0; - exit(); -} -function result_true(){ - echo 1; - exit(); -} -function checkAuth($pw_arg, $pw_db){ - if(crypt($pw_arg, $pw_db) == $pw_db) - result_true(); - result_false(); -} -?> \ No newline at end of file diff --git a/install/apps/xmpp_libs/auth_prosody/db_conf.inc.php b/install/apps/xmpp_libs/auth_prosody/db_conf.inc.php deleted file mode 100644 index 1aba63d6ea051ff4826312757b10af2a1c590525..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/auth_prosody/db_conf.inc.php +++ /dev/null @@ -1,6 +0,0 @@ -real_escape_string($arg_email); - $query = $db->prepare("SELECT count(*) AS usercount FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?"); - $query->bind_param('si', $arg_email, $isp_server_id); - $query->execute(); - $query->bind_result($usercount); - $query->fetch(); - $query->close(); - - result_false($usercount != 1); - result_true(); - -}catch(Exception $ex){ - echo 0; - exit(); -} - -function result_false($cond = true){ - if(!$cond) return; - echo 0; - exit(); -} -function result_true(){ - echo 1; - exit(); -} - -?> diff --git a/install/apps/xmpp_libs/auth_prosody/prosody-purge b/install/apps/xmpp_libs/auth_prosody/prosody-purge deleted file mode 100644 index df50105da01451d4577d6d5edb0c3ee7596c581e..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/auth_prosody/prosody-purge +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/php - 4); - -$operation = $argv[1]; -$host = $argv[2]; - -$configFile = file_get_contents('/etc/prosody/storage.cfg.lua'); -preg_match_all('/(host|database|port|username|password) *= *"?([^"\n]*)"?;/', $configFile, $matches); -$config = array(); -foreach($matches[1] AS $ix => $key) { - $config[$key] = $matches[2][$ix]; -} - -try { - // Connect to database - $db = new mysqli($config['host'], $config['username'], $config['password'], $config['database']); - - switch($operation){ - case 'user': - usage(count($argv) != 4); - $user = $argv[3]; - do_query($db->prepare("DELETE FROM prosody WHERE user = ? AND host = ?"), $host, $user); - do_query($db->prepare("DELETE FROM prosodyarchive WHERE user = ? AND host = ?"), $host, $user); - break; - case 'domain': - do_query($db->prepare("DELETE FROM prosody WHERE host = ?"), $host); - do_query($db->prepare("DELETE FROM prosodyarchive WHERE host = ?"), $host); - do_query($db->prepare("DELETE FROM prosody WHERE host LIKE ?"), "%.$host"); - do_query($db->prepare("DELETE FROM prosodyarchive WHERE host LIKE ?"), "%.$host"); - break; - } - $db->close(); -} catch (Exception $ex) { - var_dump($ex); -} - - -function do_query($query, $host, $user = false){ - if($user !== false) - $query->bind_param('ss', $user, $host); - else - $query->bind_param('s', $host); - $query->execute(); - $entries = $query->affected_rows; - $query->close(); - if(DEBUG) echo "$entries deleted!\n"; - return $entries; -} - -function result_false($cond = true) { - if(!$cond) return; - exit(1); -} - -function usage($cond = false){ - if(!$cond) return; - echo "USAGE: \n prosody-purge domain my.domain.com \n prosody-purge user my.domain.com username \n"; - result_false(); -} diff --git a/install/apps/xmpp_libs/mod_auth_external/authenticate_isp.sh b/install/apps/xmpp_libs/mod_auth_external/authenticate_isp.sh deleted file mode 100644 index c5a0c8e6846b85087bcc6f3f1ba3ae764f1a7a3c..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_auth_external/authenticate_isp.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -IFS=":" -AUTH_OK=1 -AUTH_FAILED=0 -LOGFILE="/var/log/metronome/auth.log" -USELOG=true - -while read ACTION USER HOST PASS ; do - - [ $USELOG == true ] && { echo "Date: $(date) Action: $ACTION User: $USER Host: $HOST" >> $LOGFILE; } - - case $ACTION in - "auth") - if [ `/usr/bin/php /usr/lib/metronome/isp-modules/mod_auth_external/db_auth.php $USER $HOST $PASS 2>/dev/null` == 1 ] ; then - echo $AUTH_OK - [ $USELOG == true ] && { echo "AUTH OK" >> $LOGFILE; } - else - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "AUTH FAILED" >> $LOGFILE; } - fi - ;; - "isuser") - if [ `/usr/bin/php /usr/lib/metronome/isp-modules/mod_auth_external/db_isuser.php $USER $HOST 2>/dev/null` == 1 ] ; then - echo $AUTH_OK - [ $USELOG == true ] && { echo "ISUSER OK" >> $LOGFILE; } - else - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "ISUSER FAILED" >> $LOGFILE; } - fi - ;; - *) - echo $AUTH_FAILED - [ $USELOG == true ] && { echo "UNKNOWN ACTION GIVEN: $ACTION" >> $LOGFILE; } - ;; - esac - -done diff --git a/install/apps/xmpp_libs/mod_auth_external/db_auth.php b/install/apps/xmpp_libs/mod_auth_external/db_auth.php deleted file mode 100644 index 2d3faa3379eb6765b20f9d12dff210cd47147f41..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_auth_external/db_auth.php +++ /dev/null @@ -1,48 +0,0 @@ -real_escape_string($arg_email); - $query = $db->prepare("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?"); - $query->bind_param('si', $arg_email, $isp_server_id); - $query->execute(); - $query->bind_result($jid, $password); - $query->fetch(); - $query->close(); - - result_false(is_null($jid)); - checkAuth($arg_password, $password); -}catch(Exception $ex){ - echo 0; - exit(); -} - -function result_false($cond = true){ - if(!$cond) return; - echo 0; - exit(); -} -function result_true(){ - echo 1; - exit(); -} -function checkAuth($pw_arg, $pw_db){ - if(crypt($pw_arg, $pw_db) == $pw_db) - result_true(); - result_false(); -} -?> \ No newline at end of file diff --git a/install/apps/xmpp_libs/mod_auth_external/db_conf.inc.php b/install/apps/xmpp_libs/mod_auth_external/db_conf.inc.php deleted file mode 100644 index 1aba63d6ea051ff4826312757b10af2a1c590525..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_auth_external/db_conf.inc.php +++ /dev/null @@ -1,6 +0,0 @@ -real_escape_string($arg_email); - $query = $db->prepare("SELECT count(*) AS usercount FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?"); - $query->bind_param('si', $arg_email, $isp_server_id); - $query->execute(); - $query->bind_result($usercount); - $query->fetch(); - $query->close(); - - result_false($usercount != 1); - result_true(); - -}catch(Exception $ex){ - echo 0; - exit(); -} - -function result_false($cond = true){ - if(!$cond) return; - echo 0; - exit(); -} -function result_true(){ - echo 1; - exit(); -} - -?> diff --git a/install/apps/xmpp_libs/mod_auth_external/mod_auth_external.lua b/install/apps/xmpp_libs/mod_auth_external/mod_auth_external.lua deleted file mode 100644 index c86400610e2389b61b502b52b6b277fdad9419e7..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_auth_external/mod_auth_external.lua +++ /dev/null @@ -1,118 +0,0 @@ -local nodeprep = require "util.encodings".stringprep.nodeprep; -local lpc = require "lpc"; - -local config = require "core.configmanager"; -local log = module._log; -local host = module.host; -local script_type = config.get(host, "external_auth_protocol") or "generic"; -assert(script_type == "ejabberd" or script_type == "generic"); -local command = config.get(host, "external_auth_command") or ""; -assert(type(command) == "string"); -assert(not host:find(":")); -local usermanager = require "core.usermanager"; -local jid_bare = require "util.jid".bare; -local new_sasl = require "util.sasl".new; - -local pid; -local readfile; -local writefile; - -local function send_query(text) - if pid and lpc.wait(pid,1) ~= nil then - log("debug","error, process died, force reopen"); - pid=nil; - end - if not pid then - log("debug", "Opening process " .. command); - pid, writefile, readfile = lpc.run(command); - end - if not pid then - log("debug", "Process failed to open"); - return nil; - end - - writefile:write(text); - writefile:flush(); - if script_type == "ejabberd" then - return readfile:read(4); - elseif script_type == "generic" then - return readfile:read(); - end -end - -function do_query(kind, username, password) - if not username then return nil, "not-acceptable"; end - username = nodeprep(username); - if not username then return nil, "jid-malformed"; end - - local query = (password and "%s:%s:%s:%s" or "%s:%s:%s"):format(kind, username, host, password); - local len = #query - if len > 1000 then return nil, "policy-violation"; end - - if script_type == "ejabberd" then - local lo = len % 256; - local hi = (len - lo) / 256; - query = string.char(hi, lo)..query; - end - if script_type == "generic" then - query = query..'\n'; - end - - local response = send_query(query); - if (script_type == "ejabberd" and response == "\0\2\0\0") or - (script_type == "generic" and response == "0") then - return nil, "not-authorized"; - elseif (script_type == "ejabberd" and response == "\0\2\0\1") or - (script_type == "generic" and response == "1") then - return true; - else - log("debug", "Nonsense back"); - return nil, "internal-server-error"; - end -end - -function new_external_provider(host) - local provider = { name = "external" }; - - function provider.test_password(username, password) - return do_query("auth", username, password); - end - - function provider.set_password(username, password) - return do_query("setpass", username, password); - end - - function provider.user_exists(username) - return do_query("isuser", username); - end - - function provider.create_user(username, password) return nil, "Account creation/modification not available."; end - - function provider.get_sasl_handler() - local testpass_authentication_profile = { - plain_test = function(sasl, username, password, realm) - return usermanager.test_password(username, realm, password), true; - end, - }; - return new_sasl(module.host, testpass_authentication_profile); - end - - function provider.is_admin(jid) - local admins = config.get(host, "admins"); - if admins ~= config.get("*", "admins") then - if type(admins) == "table" then - jid = jid_bare(jid); - for _,admin in ipairs(admins) do - if admin == jid then return true; end - end - elseif admins then - log("error", "Option 'admins' for host '%s' is not a table", host); - end - end - return usermanager.is_admin(jid); - end - - return provider; -end - -module:add_item("auth-provider", new_external_provider(host)); \ No newline at end of file diff --git a/install/apps/xmpp_libs/mod_discoitems.lua b/install/apps/xmpp_libs/mod_discoitems.lua deleted file mode 100644 index f05b9049073f540cef8686f4ed80579e9fa9ed28..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_discoitems.lua +++ /dev/null @@ -1,24 +0,0 @@ --- * Metronome IM * --- --- This file is part of the Metronome XMPP server and is released under the --- ISC License, please see the LICENSE file in this source package for more --- information about copyright and licensing. --- --- As per the sublicensing clause, this file is also MIT/X11 Licensed. --- ** Copyright (c) 2009, Waqas Hussain - -local st = require "util.stanza"; - -local result_query = st.stanza("query", {xmlns = "http://jabber.org/protocol/disco#items"}); -for _, item in ipairs(module:get_option("disco_items") or {}) do - result_query:tag("item", {jid = item[1], name = item[2]}):up(); -end - -module:hook("iq/host/http://jabber.org/protocol/disco#items:query", function(event) - local stanza = event.stanza; - local query = stanza.tags[1]; - if stanza.attr.type == "get" and not query.attr.node then - event.origin.send(st.reply(stanza):add_child(result_query)); - return true; - end -end, 100); diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_away.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_away.png deleted file mode 100644 index 0de5c6ab3d35e958b2c2c9fa9ee6e5876312b54b..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_away.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_chat.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_chat.png deleted file mode 100644 index 324f40baf379ec677e4b7b9791f94298481d7e86..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_chat.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_dnd.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_dnd.png deleted file mode 100644 index 015f3da95dfe2a6c9dcdf414951c277104ae6b2e..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_dnd.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_offline.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_offline.png deleted file mode 100644 index 12db2af7dd86308f5abed00e3930d7f961e1ecc3..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_offline.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_online.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_online.png deleted file mode 100644 index fb257c3144736fd691d81ac82242f7d51f909679..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_online.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/icons/status_xa.png b/install/apps/xmpp_libs/mod_webpresence/icons/status_xa.png deleted file mode 100644 index 321d35b5a3f1c832669154c1bc8f4f000c42e761..0000000000000000000000000000000000000000 Binary files a/install/apps/xmpp_libs/mod_webpresence/icons/status_xa.png and /dev/null differ diff --git a/install/apps/xmpp_libs/mod_webpresence/mod_webpresence.lua b/install/apps/xmpp_libs/mod_webpresence/mod_webpresence.lua deleted file mode 100644 index c1de0e0d37eaecba6afb4244a12d6d4a5245912d..0000000000000000000000000000000000000000 --- a/install/apps/xmpp_libs/mod_webpresence/mod_webpresence.lua +++ /dev/null @@ -1,118 +0,0 @@ -module:depends("http"); - -local jid_split = require "util.jid".prepped_split; -local b64 = require "util.encodings".base64.encode; -local sha1 = require "util.hashes".sha1; -local stanza = require "util.stanza".stanza; -local json = require "util.json".encode_ordered; - -local function require_resource(name) - local icon_path = module:get_option_string("presence_icons", "icons"); - local f, err = module:load_resource(icon_path.."/"..name); - if f then - return f:read("*a"); - end - module:log("warn", "Failed to open image file %s", icon_path..name); - return ""; -end - -local statuses = { online = {}, away = {}, xa = {}, dnd = {}, chat = {}, offline = {} }; - -local function handle_request(event, path) - local status, message; - local jid, type = path:match("([^/]+)/?(.*)$"); - if jid then - local user, host = jid_split(jid); - if host and not user then - user, host = host, event.request.headers.host; - if host then host = host:gsub(":%d+$", ""); end - end - if user and host then - local user_sessions = hosts[host] and hosts[host].sessions[user]; - if user_sessions then - status = user_sessions.top_resources[1]; - if status and status.presence then - message = status.presence:child_with_name("status"); - status = status.presence:child_with_name("show"); - if not status then - status = "online"; - else - status = status:get_text(); - end - if message then - message = message:get_text(); - end - end - end - end - end - status = status or "offline"; - - statuses[status].image = function() - return { status_code = 200, headers = { content_type = "image/png" }, - body = require_resource("status_"..status..".png") - }; - end; - statuses[status].html = function() - local jid_hash = sha1(jid, true); - return { status_code = 200, headers = { content_type = "text/html" }, - body = [[]].. - tostring( - stanza("html") - :tag("head") - :tag("title"):text("XMPP Status Page for "..jid):up():up() - :tag("body") - :tag("div", { id = jid_hash.."_status", class = "xmpp_status" }) - :tag("img", { id = jid_hash.."_img", class = "xmpp_status_image xmpp_status_"..status, - src = "data:image/png;base64,"..b64(require_resource("status_"..status..".png")) }):up() - :tag("span", { id = jid_hash.."_status_name", class = "xmpp_status_name" }) - :text("\194\160"..status):up() - :tag("span", { id = jid_hash.."_status_message", class = "xmpp_status_message" }) - :text(message and "\194\160"..message.."" or "") - ) - }; - end; - statuses[status].text = function() - return { status_code = 200, headers = { content_type = "text/plain" }, - body = status - }; - end; - statuses[status].message = function() - return { status_code = 200, headers = { content_type = "text/plain" }, - body = (message and message or "") - }; - end; - statuses[status].json = function() - return { status_code = 200, headers = { content_type = "application/json" }, - body = json({ - jid = jid, - show = status, - status = (message and message or "null") - }) - }; - end; - statuses[status].xml = function() - return { status_code = 200, headers = { content_type = "application/xml" }, - body = [[]].. - tostring( - stanza("result") - :tag("jid"):text(jid):up() - :tag("show"):text(status):up() - :tag("status"):text(message) - ) - }; - end - - if ((type == "") or (not statuses[status][type])) then - type = "image" - end; - - return statuses[status][type](); -end - -module:provides("http", { - default_path = "/status"; - route = { - ["GET /*"] = handle_request; - }; -}); diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php deleted file mode 100644 index 77462bd7f4a1cb8392832853a8af10308205a30b..0000000000000000000000000000000000000000 --- a/install/dist/conf/centos52.conf.php +++ /dev/null @@ -1,223 +0,0 @@ - diff --git a/install/dist/conf/centos53.conf.php b/install/dist/conf/centos53.conf.php deleted file mode 100644 index 77462bd7f4a1cb8392832853a8af10308205a30b..0000000000000000000000000000000000000000 --- a/install/dist/conf/centos53.conf.php +++ /dev/null @@ -1,223 +0,0 @@ - diff --git a/install/dist/conf/centos70.conf.php b/install/dist/conf/centos70.conf.php index c3076c4aab5c8fb531bbe898d683aff0341d1dac..08afc5441ef22ca2bd24868b94c6cc7e32afa55d 100644 --- a/install/dist/conf/centos70.conf.php +++ b/install/dist/conf/centos70.conf.php @@ -50,7 +50,8 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; +$conf['services']['proxy'] = false; +$conf['services']['firewall'] = false; //* MySQL $conf['mysql']['installed'] = false; // will be detected automatically during installation @@ -113,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/authlib'; -$conf['courier']['courier-authdaemon'] = 'courier-authlib'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = ''; -$conf['courier']['courier-pop'] = ''; -$conf['courier']['courier-pop-ssl'] = ''; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd@amavisd'; @@ -209,6 +192,10 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php-fpm.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; +//*Bastille-Firwall +$conf['bastille']['installed'] = false; +$conf['bastille']['config_dir'] = '/etc/Bastille'; + //* vlogger $conf['vlogger']['config_dir'] = '/etc'; @@ -216,8 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'crond'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - -?> diff --git a/install/dist/conf/centos72.conf.php b/install/dist/conf/centos72.conf.php index b6cbcabe216328f736d22ef4b0b12f24b5ef0c6b..a0b118308108f4897d29569fcf639977e0a97a4b 100644 --- a/install/dist/conf/centos72.conf.php +++ b/install/dist/conf/centos72.conf.php @@ -50,7 +50,8 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; +$conf['services']['proxy'] = false; +$conf['services']['firewall'] = false; //* MySQL $conf['mysql']['installed'] = false; // will be detected automatically during installation @@ -113,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/authlib'; -$conf['courier']['courier-authdaemon'] = 'courier-authlib'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = ''; -$conf['courier']['courier-pop'] = ''; -$conf['courier']['courier-pop-ssl'] = ''; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd@amavisd'; @@ -209,6 +192,10 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php-fpm.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; +//*Bastille-Firwall +$conf['bastille']['installed'] = false; +$conf['bastille']['config_dir'] = '/etc/Bastille'; + //* vlogger $conf['vlogger']['config_dir'] = '/etc'; @@ -216,8 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'crond'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - -?> diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php index a85841e4ff6c6d40b53cd70880313f0c2a867245..c2eb4953380b47b814ac7b4beb6d1da3b258e991 100644 --- a/install/dist/conf/debian40.conf.php +++ b/install/dist/conf/debian40.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -170,7 +151,7 @@ $conf['mydns']['init_script'] = 'mydns'; //* PowerDNS $conf['powerdns']['installed'] = false; // will be detected automatically during installation $conf['powerdns']['database'] = 'powerdns'; -$conf["powerdns"]["config_dir"] = '/etc/powerdns/pdns.d'; +$conf['powerdns']['config_dir'] = '/etc/powerdns/pdns.d'; $conf['powerdns']['init_script'] = 'pdns'; //* BIND DNS Server @@ -215,7 +196,6 @@ $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; - //* vlogger $conf['vlogger']['config_dir'] = '/etc'; @@ -223,9 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - - -?> diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php index 01c275bd59d815681d34153f2bc3a2e1248c3072..09356dbe1824d28e1fd74eaaeff46d64ab95cc4d 100644 --- a/install/dist/conf/debian60.conf.php +++ b/install/dist/conf/debian60.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -211,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -225,19 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['metronome']['installed'] = false; -$conf['metronome']['init_script'] = 'metronome'; -$conf['metronome']['initial_modules'] = 'saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons'; - -//* Prosody XMPP -$conf['prosody']['installed'] = false; -$conf['prosody']['init_script'] = 'prosody'; -$conf['prosody']['storage_database'] = 'prosody'; -$conf['prosody']['storage_user'] = 'prosody'; -$conf['prosody']['storage_password'] = md5(uniqid(rand())); -$conf['prosody']['initial_modules'] = 'roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access'; - - -?> diff --git a/install/dist/conf/debian90.conf.php b/install/dist/conf/debian90.conf.php index 58aeff24364427510b3e00151b8140b0e3872c4c..a92ed1049b275ec09dead63ccad659215366154a 100644 --- a/install/dist/conf/debian90.conf.php +++ b/install/dist/conf/debian90.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -211,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.0/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.0-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -225,18 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['metronome']['installed'] = false; -$conf['metronome']['init_script'] = 'metronome'; -$conf['metronome']['initial_modules'] = 'saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons'; - -//* Prosody XMPP -$conf['prosody']['installed'] = false; -$conf['prosody']['init_script'] = 'prosody'; -$conf['prosody']['storage_database'] = 'prosody'; -$conf['prosody']['storage_user'] = 'prosody'; -$conf['prosody']['storage_password'] = md5(uniqid(rand())); -$conf['prosody']['initial_modules'] = 'roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access'; - -?> diff --git a/install/dist/conf/debiantesting.conf.php b/install/dist/conf/debiantesting.conf.php index 4ad9b17325b5d002e29588dc6d38fd69b22782c0..350be08cb5e52e773a2a7cce4db4fc846a02ff03 100644 --- a/install/dist/conf/debiantesting.conf.php +++ b/install/dist/conf/debiantesting.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -170,7 +151,7 @@ $conf['mydns']['init_script'] = 'mydns'; //* PowerDNS $conf['powerdns']['installed'] = false; // will be detected automatically during installation $conf['powerdns']['database'] = 'powerdns'; -$conf["powerdns"]["config_dir"] = '/etc/powerdns/pdns.d'; +$conf['powerdns']['config_dir'] = '/etc/powerdns/pdns.d'; $conf['powerdns']['init_script'] = 'pdns'; //* BIND DNS Server @@ -211,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.0/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.0-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -225,19 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['metronome']['installed'] = false; -$conf['metronome']['init_script'] = 'metronome'; -$conf['metronome']['initial_modules'] = 'saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons'; - -//* Prosody XMPP -$conf['prosody']['installed'] = false; -$conf['prosody']['init_script'] = 'prosody'; -$conf['prosody']['storage_database'] = 'prosody'; -$conf['prosody']['storage_user'] = 'prosody'; -$conf['prosody']['storage_password'] = md5(uniqid(rand())); -$conf['prosody']['initial_modules'] = 'roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access'; - - -?> diff --git a/install/dist/conf/fedora9.conf.php b/install/dist/conf/fedora9.conf.php index 85121e7c841658e39935ba6548ada4c8a105f2dc..46f3da03ce06a894dc8dfe94cb06475d70c945f2 100644 --- a/install/dist/conf/fedora9.conf.php +++ b/install/dist/conf/fedora9.conf.php @@ -50,7 +50,8 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; +$conf['services']['proxy'] = false; +$conf['services']['firewall'] = false; //* MySQL $conf['mysql']['installed'] = false; // will be detected automatically during installation @@ -113,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/authlib'; -$conf['courier']['courier-authdaemon'] = 'courier-authlib'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap'; -$conf['courier']['courier-pop'] = 'courier-imap'; -$conf['courier']['courier-pop-ssl'] = 'courier-imap'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd.amavisd'; @@ -209,6 +192,10 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php-fpm.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; +//*Bastille-Firwall +$conf['bastille']['installed'] = false; +$conf['bastille']['config_dir'] = '/etc/Bastille'; + //* vlogger $conf['vlogger']['config_dir'] = '/etc'; @@ -216,8 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'crond'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - -?> diff --git a/install/dist/conf/gentoo.conf.php b/install/dist/conf/gentoo.conf.php index 83a487f29097df9d68cbfea369d63ccbcac72fd4..15ecefb6c34ff6897777a73279d31382f145b72c 100644 --- a/install/dist/conf/gentoo.conf.php +++ b/install/dist/conf/gentoo.conf.php @@ -50,7 +50,8 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; +$conf['services']['proxy'] = false; +$conf['services']['firewall'] = false; //* MySQL $conf['mysql']['installed'] = false; // will be detected automatically during installation @@ -72,9 +73,6 @@ $conf['mysql']['master_admin_password'] = ''; $conf['mysql']['master_ispconfig_user'] = ''; $conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand())); -//* SuPHP -$conf['suphp']['config_file'] = '/etc/suphp.conf'; - //* Apache $conf['apache']['installed'] = false; // will be detected automatically during installation $conf['apache']['user'] = 'apache'; @@ -126,46 +124,27 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['user'] = 'getmail'; $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier/authlib'; -$conf['courier']['courier-authdaemon'] = 'courier-authlib'; -$conf['courier']['courier-imap'] = 'courier-imapd'; -$conf['courier']['courier-imap-ssl'] = 'courier-imapd-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop3d'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop3d-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config_file'] = '/etc/conf.d/saslauthd'; -$conf['saslauthd']['config_dir'] = '/etc/sasl2'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_file'] = '/etc/amavisd.conf'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd'; @@ -225,6 +204,10 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; +//*Bastille-Firwall +$conf['bastille']['installed'] = false; +$conf['bastille']['config_dir'] = '/etc/Bastille'; + //* vlogger $conf['vlogger']['config_dir'] = '/etc/vlogger'; @@ -233,8 +216,3 @@ $conf['cron']['init_script'] = 'vixie-cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['group'] = 'cron'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - -?> diff --git a/install/dist/conf/opensuse110.conf.php b/install/dist/conf/opensuse110.conf.php deleted file mode 100644 index 909a53aba0ecf727e4da0004b148fdae8b0bb5f6..0000000000000000000000000000000000000000 --- a/install/dist/conf/opensuse110.conf.php +++ /dev/null @@ -1,223 +0,0 @@ - diff --git a/install/dist/conf/opensuse112.conf.php b/install/dist/conf/opensuse112.conf.php index 648a9222e4c092c1ac4b091569a0b141d9c2aeb2..12b5748fbe9714cb8c05e9adec322d554233e07e 100644 --- a/install/dist/conf/opensuse112.conf.php +++ b/install/dist/conf/opensuse112.conf.php @@ -50,7 +50,8 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; +$conf['services']['proxy'] = false; +$conf['services']['firewall'] = false; //* MySQL $conf['mysql']['installed'] = false; // will be detected automatically during installation @@ -113,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/authlib'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd'; @@ -209,6 +192,10 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm'; +//*Bastille-Firwall +$conf['bastille']['installed'] = false; +$conf['bastille']['config_dir'] = '/etc/Bastille'; + //* vlogger $conf['vlogger']['config_dir'] = '/etc'; @@ -216,8 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* OpenVZ -$conf['openvz']['installed'] = false; - -?> diff --git a/install/dist/conf/ubuntu1604.conf.php b/install/dist/conf/ubuntu1604.conf.php index 6159638d0f99f86276be590aa2fc6c3218d07de1..afa0ea7c94bc6843e52e3906761c7e3600bfee67 100644 --- a/install/dist/conf/ubuntu1604.conf.php +++ b/install/dist/conf/ubuntu1604.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,44 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - -//* mlmmj -$conf['mlmmj']['installed'] = false; // will be detected automatically during installation -$conf['mlmmj']['config_dir'] = '/etc/mlmmj'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -211,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.0/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.0-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -225,19 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['metronome']['installed'] = false; -$conf['metronome']['init_script'] = 'metronome'; -$conf['metronome']['initial_modules'] = 'saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons'; - -//* Prosody XMPP -$conf['prosody']['installed'] = false; -$conf['prosody']['init_script'] = 'prosody'; -$conf['prosody']['storage_database'] = 'prosody'; -$conf['prosody']['storage_user'] = 'prosody'; -$conf['prosody']['storage_password'] = md5(uniqid(rand())); -$conf['prosody']['initial_modules'] = 'roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access'; - - -?> diff --git a/install/dist/conf/ubuntu1710.conf.php b/install/dist/conf/ubuntu1710.conf.php index e04f4116ff21711167e67bb57b86fbf29ce9461a..2a4c364f740174c27907493ba8eb95f7edf8e5b6 100644 --- a/install/dist/conf/ubuntu1710.conf.php +++ b/install/dist/conf/ubuntu1710.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,40 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -207,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.1/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.1-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -221,19 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['metronome']['installed'] = false; -$conf['metronome']['init_script'] = 'metronome'; -$conf['metronome']['initial_modules'] = 'saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons'; - -//* Prosody XMPP -$conf['prosody']['installed'] = false; -$conf['prosody']['init_script'] = 'prosody'; -$conf['prosody']['storage_database'] = 'prosody'; -$conf['prosody']['storage_user'] = 'prosody'; -$conf['prosody']['storage_password'] = md5(uniqid(rand())); -$conf['prosody']['initial_modules'] = 'roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access'; - - -?> diff --git a/install/dist/conf/ubuntu1804.conf.php b/install/dist/conf/ubuntu1804.conf.php index 15cdb1c5ebbb74c45ab1f1df2f1c5caf8a008464..d7eb1972db97529943fcac854471fbf0b1de2f19 100644 --- a/install/dist/conf/ubuntu1804.conf.php +++ b/install/dist/conf/ubuntu1804.conf.php @@ -50,7 +50,6 @@ $conf['services']['web'] = true; $conf['services']['dns'] = true; $conf['services']['file'] = true; $conf['services']['db'] = true; -$conf['services']['vserver'] = true; $conf['services']['proxy'] = false; $conf['services']['firewall'] = false; @@ -115,40 +114,26 @@ $conf['postfix']['vmail_groupid'] = '5000'; $conf['postfix']['vmail_groupname'] = 'vmail'; $conf['postfix']['vmail_mailbox_base'] = '/var/vmail'; -//* Mailman -$conf['mailman']['installed'] = false; // will be detected automatically during installation -$conf['mailman']['config_dir'] = '/etc/mailman'; -$conf['mailman']['init_script'] = 'mailman'; - //* Getmail $conf['getmail']['installed'] = false; // will be detected automatically during installation $conf['getmail']['config_dir'] = '/etc/getmail'; $conf['getmail']['program'] = '/usr/bin/getmail'; -//* Courier -$conf['courier']['installed'] = false; // will be detected automatically during installation -$conf['courier']['config_dir'] = '/etc/courier'; -$conf['courier']['courier-authdaemon'] = 'courier-authdaemon'; -$conf['courier']['courier-imap'] = 'courier-imap'; -$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl'; -$conf['courier']['courier-pop'] = 'courier-pop'; -$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl'; - //* Dovecot $conf['dovecot']['installed'] = false; // will be detected automatically during installation $conf['dovecot']['config_dir'] = '/etc/dovecot'; $conf['dovecot']['init_script'] = 'dovecot'; -//* SASL -$conf['saslauthd']['installed'] = false; // will be detected automatically during installation -$conf['saslauthd']['config'] = '/etc/default/saslauthd'; -$conf['saslauthd']['init_script'] = 'saslauthd'; - //* Amavisd $conf['amavis']['installed'] = false; // will be detected automatically during installation $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -207,9 +192,6 @@ $conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.2/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; $conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.2-fpm'; -//* OpenVZ -$conf['openvz']['installed'] = false; - //*Bastille-Firwall $conf['bastille']['installed'] = false; $conf['bastille']['config_dir'] = '/etc/Bastille'; @@ -221,10 +203,3 @@ $conf['vlogger']['config_dir'] = '/etc'; $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; - -//* Metronome XMPP -$conf['xmpp']['installed'] = false; -$conf['xmpp']['init_script'] = 'metronome'; - - -?> \ No newline at end of file diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php deleted file mode 100644 index 2cec3447b58059d38e3cfadb905e9c3a882e8075..0000000000000000000000000000000000000000 --- a/install/dist/lib/centos52.lib.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php deleted file mode 100644 index b7f45bcfb375b86fbe0b58aa3c81176f4bd2d83d..0000000000000000000000000000000000000000 --- a/install/dist/lib/centos53.lib.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index 730058f6e77d499dec6a23dcf7455ff1eba26bb7..69d9758b3d1731c89a071588071be6057c9c3878 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -68,7 +68,6 @@ class installer extends installer_base { } //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', 'virtual_transport = '.$virtual_transport, diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index f8ca1eb6abe8c233847e25ed153038f922309813..88da3fb0ddae1cc59f0c0d46b795ca0d8c8291a5 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -29,7 +29,6 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ class installer_dist extends installer_base { - protected $mailman_group = 'mailman'; public function __construct() { //** check apache modules */ @@ -183,19 +182,6 @@ class installer_dist extends installer_base { touch($config_dir.'/nested_header_checks'); touch($config_dir.'/body_checks'); - //* Create the mailman files - if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data'); - //if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases'); - if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases'); - if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases'); - if(!is_dir('/etc/mailman')) mkdir('/etc/mailman'); - if(!is_file('/etc/mailman/aliases')) touch('/etc/mailman/aliases'); - exec('postalias /var/lib/mailman/data/aliases'); - if(!is_file('/etc/mailman/virtual-mailman')) touch('/etc/mailman/virtual-mailman'); - exec('postmap /etc/mailman/virtual-mailman'); - if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); - exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); - //* Create auxillary postfix conf files $configfile = 'helo_access'; if(is_file($config_dir.'/'.$configfile)) { @@ -241,10 +227,6 @@ class installer_dist extends installer_base { caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); } - //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. - $command = 'chmod 755 /var/spool/authdaemon'; - caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - //* Changing maildrop lines in posfix master.cf if(is_file($config_dir.'/master.cf')){ copy($config_dir.'/master.cf', $config_dir.'/master.cf~'); @@ -297,70 +279,6 @@ class installer_dist extends installer_base { } - public function configure_saslauthd() { - global $conf; - - $configfile = 'tpl/fedora_saslauthd_smtpd_conf.master'; - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_saslauthd_smtpd_conf.master', $configfile); - wf('/usr/lib/sasl2/smtpd.conf', $content); - if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf', $content); - if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf', $content); - - } - - public function configure_pam() - { - global $conf; - $pam = $conf['pam']; - //* configure pam for SMTP authentication agains the ispconfig database - $configfile = 'pamd_smtp'; - if(is_file("$pam/smtp")) copy("$pam/smtp", "$pam/smtp~"); - if(is_file("$pam/smtp~")) exec("chmod 400 $pam/smtp~"); - - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master"); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - wf("$pam/smtp", $content); - // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. - if(is_file("$pam/smtp")) exec("chmod o= $pam/smtp"); - } - - public function configure_courier() - { - global $conf; - $config_dir = $conf['courier']['config_dir']; - //* authmysqlrc - $configfile = 'authmysqlrc'; - if(is_file("$config_dir/$configfile")){ - copy("$config_dir/$configfile", "$config_dir/$configfile~"); - } - exec("chmod 400 $config_dir/$configfile~"); - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master"); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); - $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); - wf("$config_dir/$configfile", $content); - - exec("chmod 660 $config_dir/$configfile"); - exec("chown root:root $config_dir/$configfile"); - - //* authdaemonrc - $configfile = $conf['courier']['config_dir'].'/authdaemonrc'; - if(is_file($configfile)){ - copy($configfile, $configfile.'~'); - } - if(is_file($configfile.'~')){ - exec('chmod 400 '.$configfile.'~'); - } - $content = rf($configfile); - $content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content); - wf($configfile, $content); - } - public function configure_dovecot() { global $conf; @@ -401,7 +319,6 @@ class installer_dist extends installer_base { } //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', 'virtual_transport = '.$virtual_transport, @@ -696,11 +613,6 @@ class installer_dist extends installer_base { global $conf; if($conf['apache']['installed'] == false) return; - if(is_file('/etc/suphp.conf')) { - //replaceLine('/etc/suphp.conf','php=php:/usr/bin','x-httpd-suphp=php:/usr/bin/php-cgi',0); - replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/var/www', 0); - replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0); - } //* Create the logging directory for the vhost logfiles exec('mkdir -p /var/log/ispconfig/httpd'); @@ -1059,12 +971,11 @@ class installer_dist extends installer_base { $dns_server_enabled = ($conf['services']['dns'])?1:0; $file_server_enabled = ($conf['services']['file'])?1:0; $db_server_enabled = ($conf['services']['db'])?1:0; - $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 = ?"; + $sql = "UPDATE `server` SET mail_server = ?, web_server = ?, dns_server = ?, file_server = ?, db_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, $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, $conf['server_id']); } // chown install dir to root and chmod 755 diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php index f0c28a61c27d24f17162e12811cff88d2dab6b62..511ed69718a87ab99974ba70f1faf82001682420 100644 --- a/install/dist/lib/gentoo.lib.php +++ b/install/dist/lib/gentoo.lib.php @@ -181,12 +181,6 @@ class installer extends installer_base caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); } - //* We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. - $command = 'chmod 755 /var/lib/courier/authdaemon/'; - if (is_dir('/var/lib/courier/authdaemon')) { - caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - } - //* Changing maildrop lines in posfix master.cf $configfile = $config_dir.'/master.cf'; $content = rf($configfile); @@ -233,43 +227,6 @@ class installer extends installer_base } - public function configure_saslauthd() - { - global $conf; - - $content = $this->get_template_file('sasl_smtpd.conf', true, true); //* get contents & insert db cred - $this->write_config_file($conf['saslauthd']['config_dir'].'/smtpd.conf', $content); - - //* Edit the file saslauthd config file - $content = rf($conf['saslauthd']['config_file']); - $content = preg_replace('/(?<=\n)SASLAUTHD_OPTS="\$\{SASLAUTHD_OPTS\}[^"]+"/', 'SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -a pam -r -c -s 128 -t 30 -n 5"', $content); - - $this->write_config_file($conf['saslauthd']['config_file'], $content); - } - - public function configure_courier() - { - global $conf; - - //* authmysqlrc - $content = $this->get_template_file('authmysqlrc', true, true); //* get contents & insert db cred - $this->write_config_file($conf['courier']['config_dir'].'/authmysqlrc', $content); - - //* authdaemonrc - $configfile = $conf['courier']['config_dir'].'/authdaemonrc'; - - $content = rf($configfile); - $content = preg_replace('/(?<=\n)authmodulelist="[^"]+"/', "authmodulelist=\"authmysql\"", $content); - $this->write_config_file($configfile, $content); - - //* create certificates - $command = 'mkimapdcert'; - caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - $command = 'mkpop3dcert'; - caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - } - public function configure_dovecot() { global $conf; @@ -555,19 +512,6 @@ class installer extends installer_base mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); } - if (is_file($conf['suphp']['config_file'])) - { - $content = rf($conf['suphp']['config_file']); - - if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content)) - { - $content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content); - $content = preg_replace('/;?umask=\d+/', 'umask=0022', $content); - } - - $this->write_config_file($conf['suphp']['config_file'], $content); - } - //* Enable ISPConfig default vhost settings $default_vhost_path = $conf['apache']['vhost_conf_dir'].'/'.$conf['apache']['vhost_default']; if (is_file($default_vhost_path)) @@ -961,13 +905,12 @@ class installer extends installer_base $dns_server_enabled = ($conf['services']['dns'])?1:0; $file_server_enabled = ($conf['services']['file'])?1:0; $db_server_enabled = ($conf['services']['db'])?1:0; - $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 = ?"; + $sql = "UPDATE `server` SET mail_server = ?, web_server = ?, dns_server = ?, file_server = ?, db_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, $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, $conf['server_id']); } // chown install dir to root and chmod 755 diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php index 1525b4a644d0e1b3a19d81ff525a7654e4b0b8f0..0688471cda1590d2d443f37184cf2a1d911b9801 100644 --- a/install/dist/lib/opensuse.lib.php +++ b/install/dist/lib/opensuse.lib.php @@ -29,8 +29,6 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ class installer_dist extends installer_base { - protected $mailman_group = 'mailman'; - public function __construct() { //** check apache modules */ $mods = getapachemodules(); @@ -194,15 +192,6 @@ class installer_dist extends installer_base { touch($config_dir.'/nested_header_checks'); touch($config_dir.'/body_checks'); - //* Create the mailman files - if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data'); - if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases'); - exec('postalias /var/lib/mailman/data/aliases'); - if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman'); - exec('postmap /var/lib/mailman/data/virtual-mailman'); - if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); - exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); - //* Create auxillary postfix conf files $configfile = 'helo_access'; if(is_file($config_dir.'/'.$configfile)) { @@ -248,10 +237,6 @@ class installer_dist extends installer_base { caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); } - //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. - $command = 'chmod 755 /var/run/authdaemon.courier-imap'; - caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - //* Check maildrop service in posfix master.cf $regex = "/^maildrop unix.*pipe flags=DRhu user=vmail argv=\\/usr\\/bin\\/maildrop -d ".$cf['vmail_username']." \\$\{extension} \\$\{recipient} \\$\{user} \\$\{nexthop} \\$\{sender}/"; $configfile = $config_dir.'/master.cf'; @@ -304,73 +289,6 @@ class installer_dist extends installer_base { } - public function configure_saslauthd() { - global $conf; - - // Edit the file /etc/init.d/saslauthd - $configfile = $conf["init_scripts"].'/'.$conf["saslauthd"]["init_script"]; - $content = rf($configfile); - $content = str_replace('/sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content); - $content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content); - - - if(is_file($configfile)) wf($configfile, $content); - - } - - public function configure_pam() - { - global $conf; - $pam = $conf['pam']; - //* configure pam for SMTP authentication agains the ispconfig database - $configfile = 'pamd_smtp'; - if(is_file("$pam/smtp")) copy("$pam/smtp", "$pam/smtp~"); - if(is_file("$pam/smtp~")) exec("chmod 400 $pam/smtp~"); - - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master"); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - wf("$pam/smtp", $content); - // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. - if(is_file("$pam/smtp")) exec("chmod o= $pam/smtp"); - } - - public function configure_courier() - { - global $conf; - $config_dir = $conf['courier']['config_dir']; - //* authmysqlrc - $configfile = 'authmysqlrc'; - if(is_file("$config_dir/$configfile")){ - copy("$config_dir/$configfile", "$config_dir/$configfile~"); - } - exec("chmod 400 $config_dir/$configfile~"); - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master"); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); - $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); - wf("$config_dir/$configfile", $content); - - exec("chmod 660 $config_dir/$configfile"); - exec("chown root:root $config_dir/$configfile"); - - //* authdaemonrc - $configfile = $conf['courier']['config_dir'].'/authdaemonrc'; - if(is_file($configfile)){ - copy($configfile, $configfile.'~'); - } - if(is_file($configfile.'~')){ - exec('chmod 400 '.$configfile.'~'); - } - $content = rf($configfile); - $content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content); - wf($configfile, $content); - } - public function configure_dovecot() { global $conf; @@ -507,7 +425,7 @@ class installer_dist extends installer_base { $content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content); $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); $content = str_replace('{hostname}', $conf['hostname'], $content); - $content = str_replace('{amavis_config_dir}', $conf['amavis']['config_dir']); + $content = str_replace('{amavis_config_dir}', $conf['amavis']['config_dir'], $content); wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content); chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640); @@ -663,13 +581,6 @@ class installer_dist extends installer_base { //* enable apache logio module exec('a2enmod logio'); - //if(is_file('/etc/suphp.conf')) { - replaceLine('/etc/suphp.conf', 'php=php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0); - replaceLine('/etc/suphp.conf', 'php="php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0); - replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/srv/www', 0, 0); - replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0); - //} - if(!file_exists('/srv/www/cgi-bin/php5') && file_exists('/srv/www/cgi-bin/php')) { symlink('/srv/www/cgi-bin/php', '/srv/www/cgi-bin/php5'); } @@ -1069,12 +980,11 @@ class installer_dist extends installer_base { $dns_server_enabled = ($conf['services']['dns'])?1:0; $file_server_enabled = ($conf['services']['file'])?1:0; $db_server_enabled = ($conf['services']['db'])?1:0; - $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 = ?"; + $sql = "UPDATE `server` SET mail_server = ?, web_server = ?, dns_server = ?, file_server = ?, db_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, $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, $conf['server_id']); } // chown install dir to root and chmod 755 @@ -1249,9 +1159,6 @@ class installer_dist extends installer_base { } } - - // Fix a setting in vhost master file for suse - replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master', "suPHP_UserGroup", " suPHP_UserGroup ", 0); } if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){ diff --git a/install/dist/lib/opensuse110.lib.php b/install/dist/lib/opensuse110.lib.php deleted file mode 100644 index aeda9b9fd1c6b83d7388fc91bde429a6e4dd5b81..0000000000000000000000000000000000000000 --- a/install/dist/lib/opensuse110.lib.php +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/install/dist/tpl/gentoo/apache_apps.vhost.master b/install/dist/tpl/gentoo/apache_apps.vhost.master index ac29f81bb3ba72fbc1e06d075e5c039151e5635a..aff93d06ffd9d0c5c3e8ff5e74005cc2777c7711 100644 --- a/install/dist/tpl/gentoo/apache_apps.vhost.master +++ b/install/dist/tpl/gentoo/apache_apps.vhost.master @@ -21,8 +21,7 @@ SetHandler fcgid-script FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php - Order allow,deny - Allow from all + Require all granted DirectoryIndex index.php @@ -33,8 +32,7 @@ Options +FollowSymLinks AllowOverride None - Order allow,deny - Allow from all + Require all granted diff --git a/install/dist/tpl/gentoo/apache_ispconfig.conf.master b/install/dist/tpl/gentoo/apache_ispconfig.conf.master index 799a39601ab99c0362079627ffc90444cbf37459..2cd17d3f1890e532252098a89244b44d7f5a7f52 100644 --- a/install/dist/tpl/gentoo/apache_ispconfig.conf.master +++ b/install/dist/tpl/gentoo/apache_ispconfig.conf.master @@ -9,13 +9,11 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m AllowOverride None - Order Deny,Allow - Deny from all + Require all denied # allow path to awstats and alias for awstats icons - Order allow,deny - Allow from all + Require all granted Alias /awstats/icon "/usr/share/awstats/htdocs/icon" diff --git a/install/dist/tpl/gentoo/apache_ispconfig.vhost.master b/install/dist/tpl/gentoo/apache_ispconfig.vhost.master index f4f08d2bb6e878d742ae023de172f9d664b189b1..fb1b9d2a1ffd2d359fd108f96b19f0df34768f54 100644 --- a/install/dist/tpl/gentoo/apache_ispconfig.vhost.master +++ b/install/dist/tpl/gentoo/apache_ispconfig.vhost.master @@ -20,8 +20,7 @@ NameVirtualHost *:{vhost_port} SetHandler fcgid-script FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php - Order allow,deny - Allow from all + Require all granted DirectoryIndex index.php @@ -32,8 +31,7 @@ NameVirtualHost *:{vhost_port} Options +FollowSymLinks AllowOverride None - Order allow,deny - Allow from all + Require all granted php_value magic_quotes_gpc 0 diff --git a/install/install.php b/install/install.php index 524918454839238b73d4fe41a2ffdbc774dd8cd3..5c821cadf7974ade1d6dbbbe4f24d3e6f474d3bd 100644 --- a/install/install.php +++ b/install/install.php @@ -99,13 +99,14 @@ require_once 'lib/classes/tpl.inc.php'; die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.'); }*/ -// Patch is required to reapir latest amavis versions +// Patch is required to repair latest amavis versions if(is_installed('amavisd-new') && !is_installed('patch')) die('The patch command is missing. Install patch command and start installation again.'); //** Get distribution identifier $dist = get_distname(); if($dist['id'] == '') die('Linux distribution or version not recognized.'); +if(!$dist['supported']) die('This distribution is not supported.'); //** Include the autoinstaller configuration (for non-interactive setups) error_reporting(E_ALL ^ E_NOTICE); @@ -170,7 +171,9 @@ if(is_dir('/usr/local/ispconfig')) { } //** Detect the installed applications +$inst->raiseEvent('find_installed_apps::before'); $inst->find_installed_apps(); +$inst->raiseEvent('find_installed_apps::after'); //** Select the language and set default timezone $conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en','language'); @@ -182,6 +185,7 @@ $conf['language_file_import_enabled'] = true; //** Select installation mode $install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard','install_mode'); +$inst->set_install_mode($install_mode); //** tRNG dependencies $conf['tRNG']=''; @@ -252,10 +256,8 @@ $conf['services']['web'] = false; $conf['services']['dns'] = false; $conf['services']['file'] = false; $conf['services']['db'] = true; -$conf['services']['vserver'] = false; $conf['services']['firewall'] = false; $conf['services']['proxy'] = false; -$conf['services']['xmpp'] = false; //** Get Server ID // $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); @@ -339,48 +341,16 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Mail } if($conf['services']['mail']) { - //* Configure Mailman - $force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', ($install_mode == 'expert')); - if($force) { - swriteln('Configuring Mailman'); - $inst->configure_mailman(); - } - - //* Configure mlmmj - if($conf['mlmmj']['installed'] == true) { - swriteln('Configuring Mlmmj'); - $inst->configure_mlmmj(/*install*/); - } - - //* Check for Dovecot and Courier - if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { + //* Check for Dovecot + if(!$conf['dovecot']['installed']) { $conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', ($install_mode == 'expert')); - $conf['courier']['installed'] = $inst->force_configure_app('Courier', ($install_mode == 'expert')); - } - //* Configure Mailserver - Dovecot or Courier - if($conf['dovecot']['installed'] && $conf['courier']['installed']) { - $mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server'); - if($mail_server_to_use == 'dovecot'){ - $conf['courier']['installed'] = false; - } else { - $conf['dovecot']['installed'] = false; - } } //* Configure Dovecot if($conf['dovecot']['installed']) { swriteln('Configuring Dovecot'); $inst->configure_dovecot(); } - //* Configure Courier - if($conf['courier']['installed']) { - swriteln('Configuring Courier'); - $inst->configure_courier(); - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - swriteln('Configuring PAM'); - $inst->configure_pam(); - } - + //* Configure Spamasassin $force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', ($install_mode == 'expert')); if($force) { @@ -395,6 +365,12 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Mail $inst->configure_amavis(); } + //* Configure Rspamd + $force = @($conf['rspamd']['installed']) ? true : $inst->force_configure_app('Rspamd', ($install_mode == 'expert')); + if($force) { + swriteln('Configuring Rspamd'); + $inst->configure_rspamd(); + } //* Configure Getmail $force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', ($install_mode == 'expert')); if($force) { @@ -483,12 +459,7 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Web } } -//* Configure OpenVZ -$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', ($install_mode == 'expert')); -if($force) { - $conf['services']['vserver'] = true; - swriteln('Configuring OpenVZ'); -} +$inst->raiseEvent('configure_webserver_selection::after'); if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') { //* Check for Firewall @@ -520,22 +491,6 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Fire } } -if($install_mode == 'standard' || strtolower($inst->simple_query('Configure XMPP Server', array('y', 'n') , 'y','configure_xmpp') ) == 'y') { -//* Configure XMPP Metronome - if ($conf['metronome']['installed']) { - swriteln('Configuring Metronome XMPP Server'); - $inst->configure_metronome(); - $conf['services']['xmpp'] = true; - } - -//* Configure XMPP Prosody - if ($conf['prosody']['installed']) { - swriteln('Configuring Prosody XMPP Server'); - $inst->configure_prosody(); - $conf['services']['xmpp'] = true; - } -} - //* Configure Fail2ban $force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', ($install_mode == 'expert')); if($force) { @@ -554,20 +509,6 @@ $install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') { swriteln('Installing ISPConfig'); - //** We want to check if the server is a module or cgi based php enabled server - //** TODO: Don't always ask for this somehow ? - /* - $fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); - - if($fast_cgi == 'yes') { - $alias = $inst->free_query('Script Alias', '/php/'); - $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); - $conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); - } else { - $conf['apache']['vhost_cgi_alias'] = ""; - } - */ - //** Customise the port ISPConfig runs on $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); $temp_admin_password = str_shuffle(bin2hex(openssl_random_pseudo_bytes(4))); @@ -597,7 +538,16 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPCon $inst->install_ispconfig_interface = false; } +// Create SSL certs for non-webserver(s)? +if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) { + if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') { + $inst->make_ispconfig_ssl_cert(); + } +} + +$inst->raiseEvent('install_ispconfig::before'); $inst->install_ispconfig(); +$inst->raiseEvent('install_ispconfig::after'); //* Configure DBServer swriteln('Configuring DBServer'); @@ -606,7 +556,6 @@ $inst->configure_dbserver(); //* Configure ISPConfig swriteln('Installing ISPConfig crontab'); if($conf['cron']['installed']) { - swriteln('Installing ISPConfig crontab'); $inst->install_crontab(); } else swriteln('[ERROR] Cron not found'); @@ -616,18 +565,10 @@ $inst->detect_ips(); swriteln('Restarting services ...'); if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); -if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); +if($conf['rspamd']['installed'] == true && $conf['rspamd']['init_script'] != '') system($inst->getinitcommand($conf['rspamd']['init_script'], 'restart')); if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); -if($conf['courier']['installed'] == true){ - if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); - if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); - if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); - if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); - if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); -} if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); -if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); //* Reload is enough for nginx if($conf['nginx']['installed'] == true){ @@ -641,7 +582,6 @@ if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') sys //if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null'); -if($conf['metronome']['installed'] == true && $conf['metronome']['init_script'] != '') system($inst->getinitcommand($conf['metronome']['init_script'], 'restart').' &> /dev/null'); //* test tRNG if($conf['tRNG']) tRNG(); diff --git a/install/lib/classes/ispconfig_addon_installer.inc.php b/install/lib/classes/ispconfig_addon_installer.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..f1b457af8c7b18c4fcb1c96e2b2baeb03f6de51c --- /dev/null +++ b/install/lib/classes/ispconfig_addon_installer.inc.php @@ -0,0 +1,20 @@ +addon_ident = preg_replace('/_addon_installer$/', '', get_called_class()); + } + + public function onRaisedInstallerEvent($event_name, $data = false) { + + } +} diff --git a/install/lib/classes/tpl.inc.php b/install/lib/classes/tpl.inc.php index 73ff19230b6b95f83e8e32d26b86f1e8f243fec8..5bd8ded1f8818f2e1bb8b6d473d479facc1a0db0 100644 --- a/install/lib/classes/tpl.inc.php +++ b/install/lib/classes/tpl.inc.php @@ -357,147 +357,6 @@ if (!defined('vlibTemplateClassLoaded')) { return true; } - /** - * [** EXPERIMENTAL **] - * Function to create a loop from a Db result resource link. - * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop() - * @param string $result link to a Db result resource - * @param string $db_type, type of db that the result resource belongs to. - * @return boolean true/false - * @access public - */ - public function setDbLoop($loopname, $result, $db_type = 'MYSQL') - { - /* - $db_type = strtoupper($db_type); - if (!in_array($db_type, $this->allowed_loop_dbs)) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type); - return false; - } - - $loop_arr = array(); - // TODO: Are all these necessary as were onyl using mysql and possible postgres ? - pedro - switch ($db_type) { - - case 'MYSQL': - if (get_resource_type($result) != 'mysql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = mysql_fetch_assoc($result)) { - $loop_arr[] = $r; - } - break; - - case 'POSTGRESQL': - if (get_resource_type($result) != 'pgsql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - - $nr = (function_exists('pg_num_rows')) ? pg_num_rows($result) : pg_numrows($result); - - for ($i=0; $i < $nr; $i++) { - $loop_arr[] = pg_fetch_array($result, $i, PGSQL_ASSOC); - } - break; - - case 'INFORMIX': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ifx_fetch_row($result, 'NEXT')) { - $loop_arr[] = $r; - } - break; - - case 'INTERBASE': - if (get_resource_type($result) != 'interbase result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ibase_fetch_row($result)) { - $loop_arr[] = $r; - } - break; - - case 'INGRES': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ingres_fetch_array(INGRES_ASSOC, $result)) { - $loop_arr[] = $r; - } - break; - - case 'MSSQL': - if (get_resource_type($result) != 'mssql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = mssql_fetch_array($result)) { - $loop_arr[] = $r; - } - break; - - case 'MSQL': - if (get_resource_type($result) != 'msql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = msql_fetch_array($result, MSQL_ASSOC)) { - $loop_arr[] = $r; - } - break; - - case 'OCI8': - if (get_resource_type($result) != 'oci8 statement') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(OCIFetchInto($result, &$r, OCI_ASSOC+OCI_RETURN_LOBS)) { - $loop_arr[] = $r; - } - break; - - case 'ORACLE': - if (get_resource_type($result) != 'oracle Cursor') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(ora_fetch_into($result, &$r, ORA_FETCHINTO_ASSOC)) { - $loop_arr[] = $r; - } - break; - - case 'OVRIMOS': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(ovrimos_fetch_into($result, &$r, 'NEXT')) { - $loop_arr[] = $r; - } - break; - - case 'SYBASE': - if (get_resource_type($result) != 'sybase-db result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - - while($r = sybase_fetch_array($result)) { - $loop_arr[] = $r; - } - break; - } - $this->setLoop($loopname, $loop_arr); - return true; - */ - } - /** * Sets the name for the curent loop in the 3 step loop process. * @param string $name string to define loop name diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index b2d9e66f76deec5cc3697c77e7f1c20ac04b2769..fd0510faf53c164a4b6a2ea49ea906252fe5c8bc 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -48,6 +48,7 @@ function get_distname() { $distver = ''; $distid = ''; $distbaseid = ''; + $distsupported = false; //** Debian or Ubuntu if(file_exists('/etc/debian_version')) { @@ -100,22 +101,27 @@ function get_distname() { case "18.04": $relname = "(Bionic Beaver)"; $distconfid = 'ubuntu1804'; + $distsupported = true; break; case "17.10": $relname = "(Artful Aardvark)"; $distconfid = 'ubuntu1710'; + $distsupported = true; break; case "17.04": $relname = "(Zesty Zapus)"; $distconfid = 'ubuntu1604'; + $distsupported = true; break; case "16.10": $relname = "(Yakkety Yak)"; $distconfid = 'ubuntu1604'; + $distsupported = true; break; case "16.04": $relname = "(Xenial Xerus)"; $distconfid = 'ubuntu1604'; + $distsupported = true; break; case "15.10": $relname = "(Wily Werewolf)"; @@ -221,6 +227,7 @@ function get_distname() { $distver = 'Jessie'; $distid = 'debian60'; $distbaseid = 'debian'; + $distsupported = true; swriteln("Operating System: Debian 8.0 (Jessie) or compatible\n"); } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '9') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '9') { $distname = 'Debian'; @@ -228,6 +235,7 @@ function get_distname() { $distconfid = 'debian90'; $distid = 'debian60'; $distbaseid = 'debian'; + $distsupported = true; swriteln("Operating System: Debian 9.0 (Stretch) or compatible\n"); } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) { $distname = 'Debian'; @@ -235,6 +243,7 @@ function get_distname() { $distid = 'debian60'; $distconfid = 'debiantesting'; $distbaseid = 'debian'; + $distsupported = true; swriteln("Operating System: Debian Testing\n"); } else { $distname = 'Debian'; @@ -242,6 +251,7 @@ function get_distname() { $distid = 'debian60'; $distconfid = 'debian90'; $distbaseid = 'debian'; + $distsupported = true; swriteln("Operating System: Debian or compatible, unknown version.\n"); } } @@ -259,6 +269,7 @@ function get_distname() { $distver = 'Ceres'; $distid = 'debiantesting'; $distbaseid = 'debian'; + $distsupported = true; swriteln("Operating System: Devuan Unstable (Ceres) or compatible\n"); } } @@ -282,12 +293,14 @@ function get_distname() { $distver = '11.2'; $distid = 'opensuse112'; $distbaseid = 'opensuse'; + $distsupported = true; swriteln("Operating System: openSUSE 11.2 or compatible\n"); } else { $distname = 'openSUSE'; $distver = 'Unknown'; $distid = 'opensuse112'; $distbaseid = 'opensuse'; + $distsupported = true; swriteln("Operating System: openSUSE or compatible, unknown version.\n"); } } @@ -321,6 +334,7 @@ function get_distname() { $distver = '5.2'; $distid = 'centos52'; $distbaseid = 'fedora'; + $distsupported = true; swriteln("Operating System: CentOS 5.2 or compatible\n"); } elseif(stristr($content, 'CentOS release 5.3 (Final)')) { $distname = 'CentOS'; @@ -347,6 +361,8 @@ function get_distname() { $var=explode(" ", $content); $var=explode(".", $var[3]); $var=$var[0].".".$var[1]; + $distver = $var; + $distsupported = true; if($var=='7.0' || $var=='7.1') { $distid = 'centos70'; } else { @@ -372,6 +388,7 @@ function get_distname() { $distver = $version[0][0].$version[0][1]; $distid = 'gentoo'; $distbaseid = 'gentoo'; + $distsupported = true; swriteln("Operating System: Gentoo $distver or compatible\n"); } else { @@ -381,7 +398,7 @@ function get_distname() { // Set $distconfid to distid, if no different id for the config is defined if(!isset($distconfid)) $distconfid = $distid; - return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid); + return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid, 'supported' => $distsupported); } function sread() { @@ -970,20 +987,20 @@ function getapacheversion($get_minor = false) { elseif(is_installed('apachectl')) $cmd = 'apachectl -v'; else { ilog("Could not check apache version, apachectl not found."); - return '2.2'; + return '2.4'; } exec($cmd, $output, $return_var); if($return_var != 0 || !$output[0]) { ilog("Could not check apache version, apachectl did not return any data."); - return '2.2'; + return '2.4'; } if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) { return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : ''); } else { ilog("Could not check apache version, did not find version string in apachectl output."); - return '2.2'; + return '2.4'; } } diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 686621f9214bfb44e087ef7d97308b7cced4692b..1d7db11e9abf21ef6e3396e947ad40504ac5eace 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1,7 +1,7 @@ conf = $conf; @@ -58,6 +60,14 @@ class installer_base { echo 'WARNING: '.$msg."\n"; } + public function set_install_mode($mode) { + $this->install_mode = $mode; + } + + public function get_install_mode() { + return $this->install_mode; + } + public function simple_query($query, $answers, $default, $name = '') { global $autoinstall, $autoupdate; $finished = false; @@ -152,18 +162,15 @@ class installer_base { //** Detect installed applications public function find_installed_apps() { global $conf; - + if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true; if(is_installed('postfix')) $conf['postfix']['installed'] = true; if(is_installed('postgrey')) $conf['postgrey']['installed'] = true; - if(is_installed('mailman') || is_installed('mmsitepass')) $conf['mailman']['installed'] = true; - if(is_installed('mlmmj') || is_installed('mlmmj-make-ml')) $conf['mlmmj']['installed'] = true; if(is_installed('apache') || is_installed('apache2') || is_installed('httpd') || is_installed('httpd2')) $conf['apache']['installed'] = true; if(is_installed('getmail')) $conf['getmail']['installed'] = true; - if(is_installed('courierlogger')) $conf['courier']['installed'] = true; if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; - if(is_installed('saslauthd')) $conf['saslauthd']['installed'] = true; if(is_installed('amavisd-new') || is_installed('amavisd')) $conf['amavis']['installed'] = true; + if(is_installed('rspamd')) $conf['rspamd']['installed'] = true; if(is_installed('clamdscan')) $conf['clamav']['installed'] = true; if(is_installed('pure-ftpd') || is_installed('pure-ftpd-wrapper')) $conf['pureftpd']['installed'] = true; if(is_installed('mydns') || is_installed('mydns-ng')) $conf['mydns']['installed'] = true; @@ -178,9 +185,6 @@ class installer_base { $conf['firewall']['installed'] = true; } if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true; - if(is_installed('vzctl')) $conf['openvz']['installed'] = true; - if(is_installed('metronome') && is_installed('metronomectl')) $conf['metronome']['installed'] = true; - if(is_installed('prosody') && is_installed('prosodyctl')) $conf['prosody']['installed'] = true; if(is_installed('spamassassin')) $conf['spamassassin']['installed'] = true; // if(is_installed('vlogger')) $conf['vlogger']['installed'] = true; // ISPConfig ships with vlogger, so it is always installed. @@ -288,7 +292,6 @@ class installer_base { // Delete ISPConfig user in the local database, in case that it exists $this->db->query("DROP USER ?@?", $conf['mysql']['ispconfig_user'], $from_host); - $this->db->query("DROP DATABASE IF EXISTS ?", $conf['mysql']['database']); //* Create the ISPConfig database user in the local database $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ?? TO ?@? IDENTIFIED BY ?'; @@ -321,9 +324,6 @@ class installer_base { $tpl_ini_array['web']['group'] = $conf['apache']['group']; $tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache']; $tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi']; - $tpl_ini_array['mail']['pop3_imap_daemon'] = ($conf['dovecot']['installed'] == true)?'dovecot':'courier'; - $tpl_ini_array['mail']['mail_filter_syntax'] = ($conf['dovecot']['installed'] == true)?'sieve':'maildrop'; - $tpl_ini_array['mail']['mailinglist_manager'] = ($conf['mlmmj']['installed'] == true)?'mlmmj':'mailman'; $tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user']; $tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group']; $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; @@ -341,9 +341,6 @@ class installer_base { $tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port']; $tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir']; - $tpl_ini_array['xmpp']['xmpp_daemon'] = ($conf['metronome']['installed'] == true)?'metronome':'prosody'; - $tpl_ini_array['xmpp']['xmpp_modules_enabled'] = $conf[$tpl_ini_array['xmpp']['xmpp_daemon']]['initial_modules']; - if ($conf['nginx']['installed'] == true) { $tpl_ini_array['web']['server_type'] = 'nginx'; $tpl_ini_array['global']['webserver'] = 'nginx'; @@ -362,7 +359,6 @@ class installer_base { $dns_server_enabled = ($conf['services']['dns'])?1:0; $file_server_enabled = ($conf['services']['file'])?1:0; $db_server_enabled = ($conf['services']['db'])?1:0; - $vserver_server_enabled = ($conf['openvz']['installed'])?1:0; $proxy_server_enabled = (isset($conf['services']['proxy']) && $conf['services']['proxy'])?1:0; $firewall_server_enabled = (isset($conf['services']['firewall']) && $conf['services']['firewall'])?1:0; @@ -384,14 +380,13 @@ class installer_base { if($conf['mysql']['master_slave_setup'] == 'y') { //* Insert the server record in master DB - $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; - $this->dbmaster->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->dbmaster->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); $conf['server_id'] = $this->dbmaster->insertID(); - $conf['server_id'] = $conf['server_id']; //* Insert the same record in the local DB - $sql = "INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (?,1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; - $this->db->query($sql, $conf['server_id'], $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + $sql = "INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server``, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (?,1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->db->query($sql, $conf['server_id'], $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); //* username for the ispconfig user $conf['mysql']['master_ispconfig_user'] = 'ispcsrv'.$conf['server_id']; @@ -400,13 +395,10 @@ class installer_base { } else { //* Insert the server, if its not a mster / slave setup - $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; - $this->db->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->db->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); $conf['server_id'] = $this->db->insertID(); - $conf['server_id'] = $conf['server_id']; } - - } public function detect_ips(){ @@ -686,7 +678,7 @@ class installer_base { $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); } - $query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`) ON ?? TO ?@?"; + $query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`, `status`, `status_txt`) ON ?? TO ?@?"; if ($verbose){ echo $query ."\n"; } @@ -757,171 +749,6 @@ class installer_base { } - public function configure_mailman($status = 'insert') { - global $conf; - - $config_dir = $conf['mailman']['config_dir'].'/'; - $full_file_name = $config_dir.'mm_cfg.py'; - //* Backup exiting file - if(is_file($full_file_name)) { - copy($full_file_name, $config_dir.'mm_cfg.py~'); - } - - // load files - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master'); - $old_file = rf($full_file_name); - - $old_options = array(); - $lines = explode("\n", $old_file); - foreach ($lines as $line) - { - if (trim($line) != '' && substr($line, 0, 1) != '#') - { - @list($key, $value) = @explode("=", $line); - if (isset($value) && $value !== '') - { - $key = rtrim($key); - $old_options[$key] = trim($value); - } - } - } - - $virtual_domains = ''; - if($status == 'update') - { - // create virtual_domains list - $domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain"); - - if(is_array($domainAll)) { - foreach($domainAll as $domain) - { - if ($domainAll[0]['domain'] == $domain['domain']) - $virtual_domains .= "'".$domain['domain']."'"; - else - $virtual_domains .= ", '".$domain['domain']."'"; - } - } - } - else - $virtual_domains = "' '"; - - $content = str_replace('{hostname}', $conf['hostname'], $content); - if(!isset($old_options['DEFAULT_SERVER_LANGUAGE']) || $old_options['DEFAULT_SERVER_LANGUAGE'] == '') $old_options['DEFAULT_SERVER_LANGUAGE'] = "'en'"; - $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content); - $content = str_replace('{virtual_domains}', $virtual_domains, $content); - - wf($full_file_name, $content); - - //* Write virtual_to_transport.sh script - $config_dir = $conf['mailman']['config_dir'].'/'; - $full_file_name = $config_dir.'virtual_to_transport.sh'; - - //* Backup exiting virtual_to_transport.sh script - if(is_file($full_file_name)) { - copy($full_file_name, $config_dir.'virtual_to_transport.sh~'); - } - - if(is_dir('/etc/mailman')) { - if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) { - copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name); - } else { - copy('tpl/mailman-virtual_to_transport.sh', $full_file_name); - } - chgrp($full_file_name, $this->mailman_group); - chmod($full_file_name, 0755); - } - - //* Create aliasaes - if($status == 'install') exec('/usr/lib/mailman/bin/genaliases 2>/dev/null'); - - if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); - exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); - } - - public function configure_mlmmj() { - global $conf; - - $configDir = $conf['mlmmj']['config_dir']; - @mkdir($configDir, 0755, true); - - $configFile = 'mlmmj.conf'; - - //* Backup exiting file - if(is_file("$configDir/$configFile")) { - copy("$configDir/$configFile", "$configDir/$configFile~"); - } - - // load files - if(is_file($conf['ispconfig_install_dir']."/server/conf-custom/install/$configFile.master")) { - copy($conf['ispconfig_install_dir']."/server/conf-custom/install/$configFile.master", "$configDir/$configFile"); - } else { - copy("tpl/$configFile.master", "$configDir/$configFile"); - } - - $mlConfig = @parse_ini_file("$configDir/$configFile"); - // Force PHP7 to use # to mark comments - if(PHP_MAJOR_VERSION >= 7) - $mlConfig = array_filter($mlConfig, function($v){return(substr($v,0,1)!=='#');}, ARRAY_FILTER_USE_KEY); - - $command = 'useradd --system mlmmj --home '.$mlConfig['spool_dir'].' --shell /usr/false'; - if(!is_user('mlmmj')) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - - @mkdir($mlConfig['spool_dir'], 0755, true); - chown($mlConfig['spool_dir'], 'mlmmj'); - chgrp($mlConfig['spool_dir'], 'mlmmj'); - - // Make a backup copy of master.cf and main.cf files - copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~mlmmj'); - - //* Update postfix main.cf - $content = rf($conf['postfix']['config_dir'].'/main.cf'); - - if(!preg_match("/^alias_maps = .*hash:\/etc\/mlmmj\/aliases.*/m", $content)) { - $content = preg_replace("/^alias_maps = (.*)/m", "$0, hash:$configDir/aliases", $content); - } - - if(!preg_match("/^alias_database = .*hash:\/etc\/mlmmj\/aliases.*/m", $content)) { - $content = preg_replace("/^alias_database = (.*)/m", "$0, hash:$configDir/aliases", $content); - } - - if(!preg_match("/^virtual_alias_maps = .*hash:\/etc\/mlmmj\/virtual.*/m", $content)) { - $content = preg_replace("/^virtual_alias_maps = (.*)/m", "$0, hash:$configDir/virtual", $content); - } - - if(!preg_match("/^transport_maps = .*hash:\/etc\/mlmmj\/transport.*/m", $content)) { - $content = preg_replace("/transport_maps = (.*)/m", "$0, hash:$configDir/transport", $content); - } - - if(!preg_match("/^mlmmj_destination_recipient_limit.*/m", $content)) { - $content .= "\n# Only deliver one message to Mlmmj at a time\nmlmmj_destination_recipient_limit = 1\n"; - } - - wf($conf['postfix']['config_dir'].'/main.cf', $content); - - //* Update postfix master.cf - $content = rf($conf['postfix']['config_dir'].'/master.cf'); - if(!preg_match('/^mlmmj\s+unix\s+-\s+n\s+n\s+-\s+-\s+pipe\s*$/m', $content)) { - copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~mlmmj'); - $content .= "\n# mlmmj mailing lists\n"; - $content .= "mlmmj unix - n n - - pipe\n"; - $content .= " flags=ORhu user=mlmmj argv=/usr/bin/mlmmj-receive -F -L "; - $content .= $mlConfig['spool_dir']."/\$nexthop\n\n"; - wf($conf['postfix']['config_dir'].'/master.cf', $content); - } - - //* Create aliasaes - touch("$configDir/aliases"); - exec("nohup /usr/sbin/postalias $configDir/aliases >/dev/null 2>&1"); - touch("$configDir/virtual"); - exec("nohup /usr/sbin/postmap $configDir/virtual >/dev/null 2>&1"); - touch("$configDir/transport"); - exec("nohup /usr/sbin/postmap $configDir/transport >/dev/null 2>&1"); - - //* Create/update cron entry - $cronEntry = '0 */2 * * * find /var'.$mlConfig['spool_dir'].'/ -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/mlmmj-maintd -F -d {} \;'; - file_put_contents('/etc/cron.d/mlmmj', $cronEntry); - } - public function get_postfix_service($service, $type) { global $conf; @@ -1081,15 +908,6 @@ class installer_base { touch($config_dir.'/nested_header_checks'); touch($config_dir.'/body_checks'); - //* Create the mailman files - if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data'); - if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases'); - exec('postalias /var/lib/mailman/data/aliases'); - if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman'); - exec('postmap /var/lib/mailman/data/virtual-mailman'); - if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); - exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); - //* Create auxillary postfix conf files $configfile = 'helo_access'; if(is_file($config_dir.'/'.$configfile)) { @@ -1120,6 +938,9 @@ class installer_base { caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); } + //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. + $command = 'chmod 755 /var/run/courier/authdaemon/'; + if(is_file('/var/run/courier/authdaemon/')) caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); if(!stristr($options, 'dont-create-certs')) { //* Create the SSL certificate if(AUTOINSTALL){ @@ -1135,10 +956,6 @@ class installer_base { caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); } - //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. - $command = 'chmod 755 /var/run/courier/authdaemon/'; - if(is_file('/var/run/courier/authdaemon/')) caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); - //* Check maildrop service in posfix master.cf $regex = "/^maildrop unix.*pipe flags=DRhu user=vmail argv=\\/usr\\/bin\\/maildrop -d ".$cf['vmail_username']." \\$\{extension} \\$\{recipient} \\$\{user} \\$\{nexthop} \\$\{sender}/"; $configfile = $config_dir.'/master.cf'; @@ -1188,119 +1005,6 @@ class installer_base { } - public function configure_saslauthd() { - global $conf; - - //* Get saslsauthd version - exec('saslauthd -v 2>&1', $out); - $parts = explode(' ', $out[0]); - $saslversion = $parts[1]; - unset($parts); - unset($out); - - if(version_compare($saslversion , '2.1.23', '<=')) { - //* Configfile for saslauthd versions up to 2.1.23 - $configfile = 'sasl_smtpd.conf'; - } else { - //* Configfile for saslauthd versions 2.1.24 and newer - $configfile = 'sasl_smtpd2.conf'; - } - - if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $conf['postfix']['config_dir'].'/sasl/smtpd.conf~'); - if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400); - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $content); - - // TODO: Chmod and chown on the config file - - - // Recursively create the spool directory - if(!@is_dir('/var/spool/postfix/var/run/saslauthd')) mkdir('/var/spool/postfix/var/run/saslauthd', 0755, true); - - // Edit the file /etc/default/saslauthd - $configfile = $conf['saslauthd']['config']; - if(is_file($configfile)) copy($configfile, $configfile.'~'); - if(is_file($configfile.'~')) chmod($configfile.'~', 0400); - $content = rf($configfile); - $content = str_replace('START=no', 'START=yes', $content); - // Debian - $content = str_replace('OPTIONS="-c"', 'OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"', $content); - // Ubuntu - $content = str_replace('OPTIONS="-c -m /var/run/saslauthd"', 'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"', $content); - wf($configfile, $content); - - // Edit the file /etc/init.d/saslauthd - $configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script']; - $content = rf($configfile); - $content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid', 'PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"', $content); - wf($configfile, $content); - - // add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well. - exec('adduser postfix sasl'); - - - } - - public function configure_pam() { - global $conf; - $pam = $conf['pam']; - //* configure pam for SMTP authentication agains the ispconfig database - $configfile = 'pamd_smtp'; - if(is_file($pam.'/smtp')) copy($pam.'/smtp', $pam.'/smtp~'); - if(is_file($pam.'/smtp~')) chmod($pam.'/smtp~', 0400); - - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - wf($pam.'/smtp', $content); - // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. - if(is_file($pam.'/smtp')) exec("chmod o= $pam/smtp"); - chmod($pam.'/smtp', 0660); - chown($pam.'/smtp', 'daemon'); - chgrp($pam.'/smtp', 'daemon'); - - } - - public function configure_courier() { - global $conf; - $config_dir = $conf['courier']['config_dir']; - //* authmysqlrc - $configfile = 'authmysqlrc'; - if(is_file($config_dir.'/'.$configfile)) { - copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); - } - chmod($config_dir.'/'.$configfile.'~', 0400); - $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); - $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); - wf($config_dir.'/'.$configfile, $content); - - chmod($config_dir.'/'.$configfile, 0660); - chown($config_dir.'/'.$configfile, 'daemon'); - chgrp($config_dir.'/'.$configfile, 'daemon'); - - //* authdaemonrc - $configfile = $config_dir.'/authdaemonrc'; - if(is_file($configfile)) { - copy($configfile, $configfile.'~'); - } - if(is_file($configfile.'~')) { - chmod($configfile.'~', 0400); - } - $content = rf($configfile); - $content = str_replace('authmodulelist="authpam"', 'authmodulelist="authmysql"', $content); - wf($configfile, $content); - } - public function configure_dovecot() { global $conf; @@ -1340,7 +1044,6 @@ class installer_base { } //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', 'virtual_transport = '.$virtual_transport, @@ -1518,6 +1221,171 @@ class installer_base { if(!empty($amavis_group)) exec('chgrp -R '.$amavis_group.' /var/lib/amavis/dkim'); } + + public function configure_rspamd() { + global $conf; + + //* These postconf commands will be executed on installation and update + $server_ini_rec = $this->db->queryOneRecord("SELECT config FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']); + $server_ini_array = ini_to_array(stripslashes($server_ini_rec['config'])); + unset($server_ini_rec); + + $mail_config = $server_ini_array['mail']; + if($mail_config['content_filter'] === 'rspamd') { + exec("postconf -X 'receive_override_options'"); + exec("postconf -X 'content_filter'"); + + exec("postconf -e 'smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'non_smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'milter_protocol = 6'"); + exec("postconf -e 'milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}'"); + exec("postconf -e 'milter_default_action = accept'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, permit_mynetworks, permit_sasl_authenticated'"); + + $new_options = array(); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); + foreach ($options as $value) { + if (!preg_match('/check_policy_service\s+inet:127.0.0.1:10023/', $value)) { + $new_options[] = $value; + } + } + exec("postconf -e 'smtpd_recipient_restrictions = ".implode(", ", $new_options)."'"); + } + + if(!is_dir('/etc/rspamd/local.d/')){ + mkdir('/etc/rspamd/local.d/', 0755, true); + } + + if(!is_dir('/etc/rspamd/override.d/')){ + mkdir('/etc/rspamd/override.d/', 0755, true); + } + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.conf.master'); + + $whitelist_ips = array(); + $ips = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ?", $conf['server_id']); + if(is_array($ips) && !empty($ips)){ + foreach($ips as $ip){ + $whitelist_ips[] = array('ip' => $ip['ip_address']); + } + } + $tpl->setLoop('whitelist_ips', $whitelist_ips); + wf('/etc/rspamd/local.d/users.conf', $tpl->grab()); + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf'); + } else { + exec('cp tpl/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf'); + } else { + exec('cp tpl/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf'); + } else { + exec('cp tpl/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf'); + } else { + exec('cp tpl/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf'); + } else { + exec('cp tpl/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf'); + } else { + exec('cp tpl/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf'); + } else { + exec('cp tpl/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf'); + } else { + exec('cp tpl/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf'); + } else { + exec('cp tpl/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf'); + } else { + exec('cp tpl/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master /etc/rspamd/local.d/options.inc'); + } else { + exec('cp tpl/rspamd_options.inc.master /etc/rspamd/local.d/options.inc'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } else { + exec('cp tpl/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } else { + exec('cp tpl/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } + + exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*'); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_dkim_signing.conf.master'); + $tpl->setVar('dkim_path', $mail_config['dkim_path']); + wf('/etc/rspamd/local.d/dkim_signing.conf', $tpl->grab()); + + $command = 'usermod -a -G amavis _rspamd'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if(strpos(rf('/etc/rspamd/rspamd.conf'), '.include "$LOCAL_CONFDIR/local.d/users.conf"') === false){ + af('/etc/rspamd/rspamd.conf', '.include "$LOCAL_CONFDIR/local.d/users.conf"'); + } + + if(!isset($mail_config['rspamd_password']) || !$mail_config['rspamd_password']) { + $mail_config['rspamd_password'] = str_shuffle(bin2hex(openssl_random_pseudo_bytes(12))); + + $server_ini_array['mail']['rspamd_password'] = $mail_config['rspamd_password']; + } + + $server_ini_array['mail']['rspamd_available'] = 'y'; + $server_ini_string = array_to_ini($server_ini_array); + if($this->dbmaster != $this->db) { + $this->dbmaster->query('UPDATE `server` SET `config` = ? WHERE `server_id` = ?', $server_ini_string, $conf['server_id']); + } + $this->db->query('UPDATE `server` SET `config` = ? WHERE `server_id` = ?', $server_ini_string, $conf['server_id']); + unset($server_ini_array); + unset($server_ini_string); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_worker-controller.inc.master'); + $tpl->setVar('rspamd_password', $mail_config['rspamd_password']); + wf('/etc/rspamd/local.d/worker-controller.inc', $tpl->grab()); + } public function configure_spamassassin() { global $conf; @@ -1722,215 +1590,6 @@ class installer_base { $this->process_bind_file('named.conf.options', '/etc/bind/', true); //TODO replace hardcoded path } - - public function configure_metronome($options = '') { - global $conf; - - if($conf['metronome']['installed'] == false) return; - //* Create the logging directory for xmpp server - if(!@is_dir('/var/log/metronome')) mkdir('/var/log/metronome', 0755, true); - chown('/var/log/metronome', 'metronome'); - if(!@is_dir('/var/run/metronome')) mkdir('/var/run/metronome', 0755, true); - chown('/var/run/metronome', 'metronome'); - if(!@is_dir('/var/lib/metronome')) mkdir('/var/lib/metronome', 0755, true); - chown('/var/lib/metronome', 'metronome'); - if(!@is_dir('/etc/metronome/hosts')) mkdir('/etc/metronome/hosts', 0755, true); - if(!@is_dir('/etc/metronome/status')) mkdir('/etc/metronome/status', 0755, true); - unlink('/etc/metronome/metronome.cfg.lua'); - - $row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $conf["server_id"]); - $server_name = $row["server_name"]; - - $tpl = new tpl('xmpp_metronome_conf_main.master'); - wf('/etc/metronome/metronome.cfg.lua', $tpl->grab()); - unset($tpl); - - $tpl = new tpl('xmpp_metronome_conf_global.master'); - $tpl->setVar('xmpp_admins',''); - wf('/etc/metronome/global.cfg.lua', $tpl->grab()); - unset($tpl); - - // Copy isp libs - if(!@is_dir('/usr/lib/metronome/isp-modules')) mkdir('/usr/lib/metronome/isp-modules', 0755, true); - caselog('cp -rf apps/xmpp_libs/* /usr/lib/metronome/isp-modules/', __FILE__, __LINE__); - caselog('chmod 755 /usr/lib/metronome/isp-modules/mod_auth_external/authenticate_isp.sh', __FILE__, __LINE__); - // Process db config - $full_file_name = '/usr/lib/metronome/isp-modules/mod_auth_external/db_conf.inc.php'; - $content = rf($full_file_name); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - $content = str_replace('{server_id}', $conf['server_id'], $content); - wf($full_file_name, $content); - - if(!stristr($options, 'dont-create-certs')){ - // Create SSL Certificate for localhost - // Ensure no line is left blank - echo "writing new private key to 'localhost.key'\n-----\n"; - $ssl_country = $this->free_query('Country Name (2 letter code)', 'AU','ssl_cert_country'); - $ssl_locality = $this->free_query('Locality Name (eg, city)', 'City Name','ssl_cert_locality'); - $ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd','ssl_cert_organisation'); - $ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', 'Infrastructure','ssl_cert_organisation_unit'); - $ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname'],'ssl_cert_common_name'); - $ssl_email = $this->free_query('Email Address', 'hostmaster@'.$conf['hostname'],'ssl_cert_email'); - - $tpl = new tpl('xmpp_conf_ssl.master'); - $tpl->setVar('ssl_country',$ssl_country); - $tpl->setVar('ssl_locality',$ssl_locality); - $tpl->setVar('ssl_organisation',$ssl_organisation); - $tpl->setVar('ssl_organisation_unit',$ssl_organisation_unit); - $tpl->setVar('domain',$ssl_domain); - $tpl->setVar('ssl_email',$ssl_email); - wf('/etc/metronome/certs/localhost.cnf', $tpl->grab()); - unset($tpl); - // Generate new key, csr and cert - exec("(cd /etc/metronome/certs && make localhost.key)"); - exec("(cd /etc/metronome/certs && make localhost.csr)"); - exec("(cd /etc/metronome/certs && make localhost.cert)"); - exec('chmod 0400 /etc/metronome/certs/localhost.key'); - exec('chown metronome /etc/metronome/certs/localhost.key'); - - echo "IMPORTANT:\n"; - echo "Localhost Key, Csr and a self-signed Cert have been saved to /etc/metronome/certs\n"; - echo "In order to work with all clients, the server must have a trusted certificate, so use the Csr\n"; - echo "to get a trusted certificate from your CA or replace Key and Cert with already signed files for\n"; - echo "your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.\n"; - echo "\n"; - - }else{ - /* - echo "-----\n"; - echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n"; - echo "# (cd /etc/metronome/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown metronome localhost.key)\n"; - echo "-----\n"; - */ - } - - // Copy init script - caselog('cp -f apps/metronome-init /etc/init.d/metronome', __FILE__, __LINE__); - caselog('chmod u+x /etc/init.d/metronome', __FILE__, __LINE__); - caselog('update-rc.d metronome defaults', __FILE__, __LINE__); - - exec($this->getinitcommand($conf['metronome']['init_script'], 'restart')); - } - - public function configure_prosody($options = '') { - global $conf; - - if($conf['prosody']['installed'] == false) return; - //* Create the logging directory for xmpp server - if(!@is_dir('/var/log/prosody')) mkdir('/var/log/prosody', 0755, true); - chown('/var/log/prosody', 'prosody'); - if(!@is_dir('/var/run/prosody')) mkdir('/var/run/prosody', 0755, true); - chown('/var/run/prosody', 'prosody'); - if(!@is_dir('/var/lib/prosody')) mkdir('/var/lib/prosody', 0755, true); - chown('/var/lib/prosody', 'prosody'); - if(!@is_dir('/etc/prosody/hosts')) mkdir('/etc/prosody/hosts', 0755, true); - if(!@is_dir('/etc/prosody/status')) mkdir('/etc/prosody/status', 0755, true); - unlink('/etc/prosody/prosody.cfg.lua'); - - $tpl = new tpl('xmpp_prosody_conf_main.master'); - wf('/etc/prosody/prosody.cfg.lua', $tpl->grab()); - unset($tpl); - - $tpl = new tpl('xmpp_prosody_conf_global.master'); - $tpl->setVar('main_host', $conf['hostname']); - $tpl->setVar('xmpp_admins',''); - wf('/etc/prosody/global.cfg.lua', $tpl->grab()); - unset($tpl); - - //** Create the database - if(!$this->db->query('CREATE DATABASE IF NOT EXISTS ?? DEFAULT CHARACTER SET ?', $conf['prosody']['storage_database'], $conf['mysql']['charset'])) { - $this->error('Unable to create MySQL database: '.$conf['prosody']['storage_database'].'.'); - } - if($conf['mysql']['host'] == 'localhost') { - $from_host = 'localhost'; - } else { - $from_host = $conf['hostname']; - } - $this->dbmaster->query("CREATE USER ?@? IDENTIFIED BY ?", $conf['prosody']['storage_user'], $from_host, $conf['prosody']['storage_password']); // ignore the error - $query = 'GRANT ALL PRIVILEGES ON ?? TO ?@? IDENTIFIED BY ?'; - if(!$this->db->query($query, $conf['prosody']['storage_database'] . ".*", $conf['prosody']['storage_user'], $from_host, $conf['prosody']['storage_password'])) { - $this->error('Unable to create database user: '.$conf['prosody']['storage_user'].' Error: '.$this->db->errorMessage); - } - - - - $tpl = new tpl('xmpp_prosody_conf_storage.master'); - $tpl->setVar('db_name', $conf['prosody']['storage_database']); - $tpl->setVar('db_host', $conf['mysql']['host']); - $tpl->setVar('db_port', $conf['mysql']['port']); - $tpl->setVar('db_username', $conf['prosody']['storage_user']); - $tpl->setVar('db_password', $conf['prosody']['storage_password']); - wf('/etc/prosody/storage.cfg.lua', $tpl->grab()); - unset($tpl); - - - // Copy isp libs - if(!@is_dir('/usr/local/lib/prosody/auth')) mkdir('/usr/local/lib/prosody/auth', 0755, true); - caselog('cp -rf apps/xmpp_libs/auth_prosody/* /usr/local/lib/prosody/auth/', __FILE__, __LINE__); - caselog('chmod 755 /usr/local/lib/prosody/auth/authenticate_isp.sh', __FILE__, __LINE__); - caselog('chown root:ispconfig /usr/local/lib/prosody/auth/prosody-purge', __FILE__, __LINE__); - caselog('chmod 750 /usr/local/lib/prosody/auth/prosody-purge', __FILE__, __LINE__); - - // Process db config - $full_file_name = '/usr/local/lib/prosody/auth/db_conf.inc.php'; - $content = rf($full_file_name); - $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); - $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); - $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); - $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); - $content = str_replace('{server_id}', $conf['server_id'], $content); - wf($full_file_name, $content); - - if(!stristr($options, 'dont-create-certs')){ - // Create SSL Certificate for localhost - // Ensure no line is left blank - echo "writing new private key to 'localhost.key'\n-----\n"; - $ssl_country = $this->free_query('Country Name (2 letter code)', 'AU','ssl_cert_country'); - $ssl_locality = $this->free_query('Locality Name (eg, city)', 'City Name','ssl_cert_locality'); - $ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd','ssl_cert_organisation'); - $ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', 'Infrastructure','ssl_cert_organisation_unit'); - $ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname'],'ssl_cert_common_name'); - $ssl_email = $this->free_query('Email Address', 'hostmaster@'.$conf['hostname'],'ssl_cert_email'); - - $tpl = new tpl('xmpp_prosody_conf_ssl.master'); - $tpl->setVar('ssl_country',$ssl_country); - $tpl->setVar('ssl_locality',$ssl_locality); - $tpl->setVar('ssl_organisation',$ssl_organisation); - $tpl->setVar('ssl_organisation_unit',$ssl_organisation_unit); - $tpl->setVar('domain',$ssl_domain); - $tpl->setVar('ssl_email',$ssl_email); - wf('/etc/prosody/certs/localhost.cnf', $tpl->grab()); - unset($tpl); - // Generate new key, csr and cert - exec("(cd /etc/prosody/certs && make localhost.key)"); - exec("(cd /etc/prosody/certs && make localhost.csr)"); - exec("(cd /etc/prosody/certs && make localhost.crt)"); - exec('chmod 0400 /etc/prosody/certs/localhost.key'); - exec('chown prosody /etc/prosody/certs/localhost.key'); - - echo "IMPORTANT:\n"; - echo "Localhost Key, Csr and a self-signed Cert have been saved to /etc/prosody/certs\n"; - echo "In order to work with all clients, the server must have a trusted certificate, so use the Csr\n"; - echo "to get a trusted certificate from your CA or replace Key and Cert with already signed files for\n"; - echo "your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.\n"; - echo "\n"; - - }else{ - /* - echo "-----\n"; - echo "Prosody XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n"; - echo "# (cd /etc/prosody/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown prosody localhost.key)\n"; - echo "-----\n"; - */ - } - - exec($this->getinitcommand($conf['prosody']['init_script'], 'restart')); - } - - public function configure_apache() { global $conf; @@ -1938,12 +1597,6 @@ class installer_base { //* Create the logging directory for the vhost logfiles if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); - if(is_file('/etc/suphp/suphp.conf')) { - replaceLine('/etc/suphp/suphp.conf', 'php="php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0); - //replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0); - replaceLine('/etc/suphp/suphp.conf', 'umask=00', 'umask=0022', 0); - } - if(is_file('/etc/apache2/sites-enabled/000-default')) { replaceLine('/etc/apache2/sites-available/000-default', 'NameVirtualHost *', 'NameVirtualHost *:80', 1, 0); replaceLine('/etc/apache2/sites-available/000-default', '', '', 1, 0); @@ -2367,13 +2020,13 @@ class installer_base { $content = str_replace('{use_socket}', $use_socket, $content); // SSL in apps vhost is off by default. Might change later. - $content = str_replace('{ssl_on}', 'off', $content); + $content = str_replace('{ssl_on}', '', $content); $content = str_replace('{ssl_comment}', '#', $content); // Fix socket path on PHP 7 systems - if(file_exists('/var/run/php/php7.0-fpm.sock')) { - $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); - } + if(file_exists('/var/run/php/php7.0-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); + if(file_exists('/var/run/php/php7.1-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.1-fpm.sock', $content); + if(file_exists('/var/run/php/php7.2-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.2-fpm.sock', $content); wf($vhost_conf_dir.'/apps.vhost', $content); @@ -2398,29 +2051,135 @@ class installer_base { } public function make_ispconfig_ssl_cert() { - global $conf,$autoinstall; + global $conf, $autoinstall; + + //* Get hostname from user entry or shell command */ + if($conf['hostname'] !== ('localhost' || '')) $hostname = $conf['hostname']; + else $hostname = exec('hostname -f'); + + // Check dns a record exist and its ip equal to server public ip + $svr_ip = file_get_contents('http://dynamicdns.park-your-domain.com/getip'); + if (checkdnsrr(idn_to_ascii($hostname, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46), 'A')) { + $dnsa=dns_get_record($hostname, DNS_A); + $dns_ips = array(); + foreach ($dnsa as $rec) { + $dns_ips[] = $rec['ip']; + } + } + + // Request for certs if no LE SSL folder for server fqdn exist + $le_live_dir = '/etc/letsencrypt/live/' . $hostname; + if (!@is_dir($le_live_dir) && in_array($svr_ip, $dns_ips)) { + + // Get the default LE client name and version + $le_client = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt /opt/eff.org/certbot/venv/bin/certbot')); + $le_client = reset($le_client); + $le_info = exec($le_client . ' --version 2>&1', $ret, $val); + if(preg_match('/^(\S+|\w+)\s+(\d+(\.\d+)+)$/', $le_info, $matches)) { $le_name = $matches[1]; $le_version = $matches[2]; } + + // Define certbot commands + $acme_version = '--server https://acme-v0' . (($le_version >=0.22) ? '2' : '1') . '.api.letsencrypt.org/directory'; + $certonly = 'certonly --agree-tos --non-interactive --expand --rsa-key-size 4096'; + $webroot = '--authenticator webroot --webroot-path /var/www/html'; + $standalone = '--authenticator standalone'; + + // Only certbot is supported to prevent unknown failures + if($le_name == 'certbot' && is_executable($le_client)) { + // If this is a webserver, we use webroot + if(($conf['nginx']['installed'] || $conf['apache']['installed']) == true) { + $well_known = '/var/www/html/.well-known'; + $challenge = "$well_known/acme_challenge"; + $acme_challenge = '/usr/local/ispconfig/interface/acme/.well-known/acme-challenge'; + if (!is_dir($well_known)) mkdir($well_known, 0755, true); + if (!is_dir($challenge)) exec("ln -sf $acme_challenge $challenge"); + exec("$le_client $certonly $acme_version $webroot --email postmaster@$hostname -d $hostname"); + } + // Else, it is not webserver, so we use standalone + else + exec("$le_client $certonly $acme_version $standalone --email postmaster@$hostname -d $hostname"); + } + } + //* Define and check ISPConfig SSL folder */ $install_dir = $conf['ispconfig_install_dir']; $ssl_crt_file = $install_dir.'/interface/ssl/ispserver.crt'; $ssl_csr_file = $install_dir.'/interface/ssl/ispserver.csr'; $ssl_key_file = $install_dir.'/interface/ssl/ispserver.key'; + $ssl_pem_file = $install_dir.'/interface/ssl/ispserver.pem'; if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true); - $ssl_pw = substr(md5(mt_rand()), 0, 6); - exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096"); - if(AUTOINSTALL){ - exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -subj '/C=".escapeshellcmd($autoinstall['ssl_cert_country'])."/ST=".escapeshellcmd($autoinstall['ssl_cert_state'])."/L=".escapeshellcmd($autoinstall['ssl_cert_locality'])."/O=".escapeshellcmd($autoinstall['ssl_cert_organisation'])."/OU=".escapeshellcmd($autoinstall['ssl_cert_organisation_unit'])."/CN=".escapeshellcmd($autoinstall['ssl_cert_common_name'])."' -key $ssl_key_file -out $ssl_csr_file"); + $date = new DateTime(); + + // If the LE SSL certs for this hostname exists + if (is_dir($le_live_dir) && in_array($svr_ip, $dns_ips)) { + + // Backup existing ispserver ssl files + if (file_exists($ssl_crt_file)) rename($ssl_crt_file, $ssl_crt_file . '-' .$date->format('YmdHis') . '.bak'); + if (file_exists($ssl_crt_file)) rename($ssl_key_file, $ssl_key_file . '-' .$date->format('YmdHis') . '.bak'); + if (file_exists($ssl_crt_file)) rename($ssl_pem_file, $ssl_pem_file . '-' .$date->format('YmdHis') . '.bak'); + + // Create symlink to LE fullchain and key for ISPConfig + symlink($le_live_dir.'/fullchain.pem', $ssl_crt_file); + symlink($le_live_dir.'/privkey.pem', $ssl_key_file); + } else { - exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file"); - } - exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650"); - exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure"); - rename($ssl_key_file, $ssl_key_file.'.secure'); - rename($ssl_key_file.'.insecure', $ssl_key_file); - exec('chown -R root:root /usr/local/ispconfig/interface/ssl'); + // We can still use the old self-signed method + $ssl_pw = substr(md5(mt_rand()), 0, 6); + exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096"); + if(AUTOINSTALL){ + exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -subj '/C=".escapeshellcmd($autoinstall['ssl_cert_country'])."/ST=".escapeshellcmd($autoinstall['ssl_cert_state'])."/L=".escapeshellcmd($autoinstall['ssl_cert_locality'])."/O=".escapeshellcmd($autoinstall['ssl_cert_organisation'])."/OU=".escapeshellcmd($autoinstall['ssl_cert_organisation_unit'])."/CN=".escapeshellcmd($autoinstall['ssl_cert_common_name'])."' -key $ssl_key_file -out $ssl_csr_file"); + } else { + exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file"); + } + exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650"); + exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure"); + rename($ssl_key_file, $ssl_key_file.'.secure'); + rename($ssl_key_file.'.insecure', $ssl_key_file); + } + + // Build ispserver.pem file and chmod it + exec("cat $ssl_key_file $ssl_crt_file > $ssl_pem_file; chmod 600 $ssl_pem_file"); + + // Extend LE SSL certs to postfix + if ($conf['postfix']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig LE SSL certs to postfix?', array('y', 'n'), 'y')) == 'y') { + + // Define folder, file(s) + $cf = $conf['postfix']; + $postfix_dir = $cf['config_dir']; + if(!is_dir($postfix_dir)) $this->error("The postfix configuration directory '$postfix_dir' does not exist."); + $smtpd_crt = $postfix_dir.'/smtpd.cert'; + $smtpd_key = $postfix_dir.'/smtpd.key'; + + // Backup existing postfix ssl files + if (file_exists($smtpd_crt)) rename($smtpd_crt, $smtpd_crt . '-' .$date->format('YmdHis') . '.bak'); + if (file_exists($smtpd_key)) rename($smtpd_key, $smtpd_key . '-' .$date->format('YmdHis') . '.bak'); + + // Create symlink to ISPConfig SSL files + symlink($ssl_crt_file, $smtpd_crt); + symlink($ssl_key_file, $smtpd_key); + } + + // Extend LE SSL certs to pureftpd + if ($conf['pureftpd']['installed'] == true && strtolower($this->simple_query('Symlink ISPConfig LE SSL certs to pureftpd? Creating dhparam file takes some times.', array('y', 'n'), 'y')) == 'y') { + + // Define folder, file(s) + $pureftpd_dir = '/etc/ssl/private'; + if(!is_dir($pureftpd_dir)) mkdir($pureftpd_dir, 0755, true); + $pureftpd_pem = $pureftpd_dir.'/pure-ftpd.pem'; + + // Backup existing pureftpd ssl files + if (file_exists($pureftpd_pem)) rename($pureftpd_pem, $pureftpd_pem . '-' .$date->format('YmdHis') . '.bak'); + + // Create symlink to ISPConfig SSL files + symlink($ssl_pem_file, $pureftpd_pem); + if (!file_exists("$pureftpd_dir/pure-ftpd-dhparams.pem")) + exec("cd $pureftpd_dir; openssl dhparam -out dhparam4096.pem 4096; ln -sf dhparam4096.pem pure-ftpd-dhparams.pem"); + } + + exec("chown -R root:root $install_dir/interface/ssl"); } @@ -2545,7 +2304,7 @@ class installer_base { // TODO: Implement a selector which modules and plugins shall be enabled. $dir = $install_dir.'/server/mods-available/'; if (is_dir($dir)) { - if ($dh = opendir($dir)) { + if (($dh = opendir($dir))) { while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') { include_once $install_dir.'/server/mods-available/'.$file; @@ -2572,7 +2331,7 @@ class installer_base { $dir = $install_dir.'/server/plugins-available/'; if (is_dir($dir)) { - if ($dh = opendir($dir)) { + if (($dh = opendir($dir))) { while (($file = readdir($dh)) !== false) { if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue; if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue; @@ -2605,12 +2364,10 @@ class installer_base { $dns_server_enabled = ($conf['services']['dns'])?1:0; $file_server_enabled = ($conf['services']['file'])?1:0; $db_server_enabled = ($conf['services']['db'])?1:0; - $vserver_server_enabled = ($conf['openvz']['installed'])?1:0; $proxy_server_enabled = ($conf['services']['proxy'])?1:0; $firewall_server_enabled = ($conf['services']['firewall'])?1:0; - $xmpp_server_enabled = ($conf['services']['xmpp'])?1:0; - $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled', xmpp_server = '$xmpp_server_enabled' WHERE server_id = ?"; + $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled' WHERE server_id = ?"; $this->db->query($sql, $conf['server_id']); if($conf['mysql']['master_slave_setup'] == 'y') { @@ -2802,11 +2559,11 @@ class installer_base { $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content); if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { - $content = str_replace('{ssl_on}', 'on', $content); + $content = str_replace('{ssl_on}', ' ssl', $content); $content = str_replace('{ssl_comment}', '', $content); $content = str_replace('{fastcgi_ssl}', 'on', $content); } else { - $content = str_replace('{ssl_on}', 'off', $content); + $content = str_replace('{ssl_on}', '', $content); $content = str_replace('{ssl_comment}', '#', $content); $content = str_replace('{fastcgi_ssl}', 'off', $content); } @@ -2942,6 +2699,7 @@ class installer_base { $content = str_replace('{hostname}', $conf['mysql']['host'], $content); $content = str_replace('{username}', $conf['mysql']['admin_user'], $content); $content = str_replace('{password}', addslashes($conf['mysql']['admin_password']), $content); + $content = str_replace('{port}', addslashes($conf['mysql']['port']), $content); wf($install_dir.'/server/lib/mysql_clientdb.conf', $content); chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); @@ -3190,7 +2948,62 @@ class installer_base { return $tContents; } + + private function loadAddonClasses($path) { + if(!is_dir($path)) { + return false; + } + $libpath = $path; + if(($dir = opendir($libpath))) { + while(false !== ($cur = readdir($dir))) { + if($cur === '.' || $cur === '..' || strpos($cur, '..') !== false || !is_dir($libpath . '/' . $cur)) { + continue; + } + $addon_file = $libpath . '/' . $cur . '/' . $cur . '.addon.php'; + if(!is_file($addon_file)) { + continue; + } + + $class_name = $cur . '_addon_installer'; + + if(isset($this->addon_classes[$class_name]) && is_object($this->addon_classes[$class_name])) { + // don't override + continue; + } + + include_once $addon_file; + if(!class_exists($class_name)) { + continue; + } + + if(!is_array($this->addon_classes)) { + $this->addon_classes = array(); + } + + $this->addon_classes[$class_name] = new $class_name; + } + closedir($dir); + } + } + + public function raiseEvent($event_name, $data = false) { + global $conf; + + if(is_null($this->addon_classes)) { + // load addon libs + $this->addon_classes = array(); + + $addonpath = $conf['ispconfig_install_dir'] . '/addons'; + $this->loadAddonClasses($addonpath); + } + + $call_method = 'onRaisedInstallerEvent'; + reset($this->addon_classes); + foreach($this->addon_classes as $cl) { + if(method_exists($cl, $call_method)) { + call_user_func(array($cl, $call_method), $event_name, $data); + } + } + } } - -?> diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php index f410722c4e3bf1873f946afe53ee2dda6d2918b3..2351fbd4de1496db1c51c8d1565a6fed36dee949 100644 --- a/install/lib/update.lib.php +++ b/install/lib/update.lib.php @@ -103,7 +103,8 @@ function checkDbHealth() { $notok = array(); echo "Checking ISPConfig database .. "; - exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -r ".escapeshellarg($conf["mysql"]["database"]), $result); + $result = null; + exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf["mysql"]["database"]), $result); for( $i=0; $i - ServerAdmin webmaster@localhost - {tmpl_var name='apps_vhost_servername'} - - - SetHandler None - - - - RequestHeader unset Proxy early - - - - DocumentRoot {tmpl_var name='apps_vhost_dir'} - AddType application/x-httpd-php .php - - Options FollowSymLinks - AllowOverride None - - Require all granted - - Order allow,deny - Allow from all - - - - - - DocumentRoot {tmpl_var name='apps_vhost_dir'} - AddType application/x-httpd-php .php - - Options FollowSymLinks - AllowOverride None - - Require all granted - - Order allow,deny - Allow from all - - - - - - DocumentRoot {tmpl_var name='apps_vhost_dir'} - SuexecUserGroup ispapps ispapps - - Options +Indexes +FollowSymLinks +MultiViews +ExecCGI - AllowOverride AuthConfig Indexes Limit Options FileInfo - - SetHandler fcgid-script - - FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php - - Require all granted - - Order allow,deny - Allow from all - - - - - - - diff --git a/install/tpl/apache_apps.vhost.master b/install/tpl/apache_apps.vhost.master new file mode 120000 index 0000000000000000000000000000000000000000..098d52b9f134ebddcaaa86ecbb832d2d8f8aac4c --- /dev/null +++ b/install/tpl/apache_apps.vhost.master @@ -0,0 +1 @@ +../../server/conf/apache_apps.vhost.master \ No newline at end of file diff --git a/install/tpl/apache_ispconfig.conf.master b/install/tpl/apache_ispconfig.conf.master deleted file mode 100644 index 333450726ba8f407b76d1e214bae6e80f99c78fa..0000000000000000000000000000000000000000 --- a/install/tpl/apache_ispconfig.conf.master +++ /dev/null @@ -1,157 +0,0 @@ -################################################ -# ISPConfig General Apache Options -################################################ -ServerTokens ProductOnly -ServerSignature Off - - - -SSLStaplingCache shmcb:/var/run/ocsp(128000) - - - -################################################ -# ISPConfig Logfile configuration for vlogger -################################################ - - -LogFormat '%v %h %l %u %t "%r" %>s %S "%{Referer}i" "%{User-Agent}i"' combined_ispconfig - -LogFormat "%v %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig - -CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -p -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog - - -CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog - - - - AllowOverride None - - Require all denied - - Order Deny,Allow - Deny from all - - - -# Do not allow access to the root file system of the server for security reasons - - Options -Indexes - AllowOverride None - - Require all denied - - Order Deny,Allow - Deny from all - - - - - AllowOverride None - - Require all denied - - Order Deny,Allow - Deny from all - - - -# Except of the following directories that contain website scripts - - - Require all granted - - Order allow,deny - Allow from all - - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - - Require all granted - - Order allow,deny - Allow from all - - - -# Allow access to mailman on OpenSuSE - - - Require all granted - - Order allow,deny - Allow from all - - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - Options +FollowSymLinks - - Require all granted - - Order allow,deny - Allow from all - - - -# allow path to awstats and alias for awstats icons - - - Require all granted - - Order allow,deny - Allow from all - - - -Alias /awstats-icon "/usr/share/awstats/icon" - -Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge - - - Require all granted - - Order allow,deny - Allow from all - - - AssignUserId www-data www-data - - - - -NameVirtualHost *:80 -NameVirtualHost *:443 - -NameVirtualHost {tmpl_var name="ip_address"}:{tmpl_var name="port"} - - diff --git a/install/tpl/apache_ispconfig.conf.master b/install/tpl/apache_ispconfig.conf.master new file mode 120000 index 0000000000000000000000000000000000000000..f67719f45ee7477245b0f2f3d083bd12fb85efec --- /dev/null +++ b/install/tpl/apache_ispconfig.conf.master @@ -0,0 +1 @@ +../../server/conf/apache_ispconfig.conf.master \ No newline at end of file diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master index 69e15838a960c42ffe235ead964b255622075ffe..f97dad85b4bbaf89a8d1c93579cfe6abfc945997 100644 --- a/install/tpl/apache_ispconfig.vhost.master +++ b/install/tpl/apache_ispconfig.vhost.master @@ -4,7 +4,6 @@ ###################################################### Listen -NameVirtualHost *: > ServerAdmin webmaster@localhost @@ -33,12 +32,7 @@ SetHandler fcgid-script FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php - Require all granted - - Order allow,deny - Allow from all - IPCCommTimeout 7200 MaxRequestLen 15728640 @@ -52,12 +46,7 @@ # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp" Options +FollowSymLinks AllowOverride None - Require all granted - - Order allow,deny - Allow from all - php_value magic_quotes_gpc 0 @@ -81,7 +70,7 @@ SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key SSLCertificateChainFile /usr/local/ispconfig/interface/ssl/ispserver.bundle - SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS + SSLCipherSuite TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS SSLHonorCipherOrder On SSLCompression Off @@ -91,8 +80,19 @@ - Header always add Strict-Transport-Security "max-age=15768000" - RequestHeader unset Proxy early + # ISPConfig 3.1 currently requires unsafe-line for both scripts and styles, as well as unsafe-eval + Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; object-src 'none'; upgrade-insecure-requests" + Header set X-Content-Type-Options: nosniff + Header set X-Frame-Options: SAMEORIGIN + Header set X-XSS-Protection: "1; mode=block" + Header always edit Set-Cookie (.*) "$1; HTTPOnly; Secure" + = 2.4.7> + Header setifempty Strict-Transport-Security "max-age=15768000" + + + Header set Strict-Transport-Security "max-age=15768000" + + RequestHeader unset Proxy early @@ -110,20 +110,10 @@ AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - diff --git a/install/tpl/apps_php_fpm_pool.conf.master b/install/tpl/apps_php_fpm_pool.conf.master deleted file mode 100644 index 74597272c0e998f5b1d7412188b9e71e18ed9ee0..0000000000000000000000000000000000000000 --- a/install/tpl/apps_php_fpm_pool.conf.master +++ /dev/null @@ -1,20 +0,0 @@ -[{fpm_pool}-{fpm_domain}] - -listen = {fpm_socket} -listen.owner = {fpm_user} -listen.group = {fpm_group} -listen.mode = 0660 - -user = {fpm_user} -group = {fpm_group} - -pm = dynamic -pm.max_children = 500 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 5 - -chdir = / - -; php_admin_value[open_basedir] = /var/www/apps:/srv/www/apps:/usr/share -php_admin_flag[magic_quotes_gpc] = off \ No newline at end of file diff --git a/install/tpl/apps_php_fpm_pool.conf.master b/install/tpl/apps_php_fpm_pool.conf.master new file mode 120000 index 0000000000000000000000000000000000000000..02e5c53cf56cc09399c43613d22111c0f8479a6f --- /dev/null +++ b/install/tpl/apps_php_fpm_pool.conf.master @@ -0,0 +1 @@ +../../server/conf/apps_php_fpm_pool.conf.master \ No newline at end of file diff --git a/install/tpl/bastille-firewall.cfg.master b/install/tpl/bastille-firewall.cfg.master deleted file mode 100644 index 408713d74631a8922bafc4348d8168bebf396a1c..0000000000000000000000000000000000000000 --- a/install/tpl/bastille-firewall.cfg.master +++ /dev/null @@ -1,320 +0,0 @@ -# -# /etc/bastille-firewall.cfg -# -# Configuration file for both 2.2/ipchains and 2.4/netfilter scripts -# -# $Source: /cvsroot/bastille-linux/dev/working_tree/Bastille/bastille-firewall.cfg,v $ -# Modified by: $Author: peterw $ -# $Date: 2002/01/04 13:34:18 $ -# $Revision: 1.7 $ -# -# Copyright (C) 1999-2001 Peter Watkins -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Thanks to David Ranch, Brad A, Don G, and others for their suggestions - -# the configuration values should be whitespace-delimited lists of -# appropriate values, e.g. -# TCP_PUBLIC_SERVICES="80 smtp ssh" -# lists Web (port 80), SMTP mail, and Secure Shell ports -# -# This script is suitable for workstations or simple NAT firewalls; -# you may want to add more "output" restrictions for serious servers - -# 0) DNS servers (Linux 2.2/ipchains only) -# You must list your DNS servers here so that -# the firewall will allow them to service your lookup requests -# -# List of DNS servers/networks to allow "domain" responses from -# This _could_ be nameservers as a list of /32 entries -#DNS_SERVERS="a.b.c.d/32 e.f.g.h/32" -# If you are running a caching nameserver, you'll need to allow from -# "0.0.0.0/0" so named can query any arbitrary nameserver -# (To enable a caching nameserver, you will also probably need to -# add "domain" to the TCP and UDP public service lists.) -#DNS_SERVERS="0.0.0.0/0" -# -# To have the DNS servers parsed from /etc/resolv.conf at runtime, -# as normal workstations will want, make this variable empty -#DNS_SERVERS="" -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -DNS_SERVERS="{DNS_SERVERS}" - - -# 1) define your interfaces (all systems) -# Note a "+" acts as a wildcard, e.g. ppp+ would match any PPP -# interface -# -# list internal/trusted interfaces -# traffic from these interfaces will be allowed -# through the firewall, no restrictions -#TRUSTED_IFACES="lo" # MINIMAL/SAFEST -# -# list external/untrusted interfaces -#PUBLIC_IFACES="eth+ ppp+ slip+" # SAFEST -# -# list internal/partially-trusted interfaces -# e.g. if this acts as a NAT/IP Masq server and you -# don't want clients on those interfaces having -# full network access to services running on this -# server (as the TRUSTED_IFACES allows) -#INTERNAL_IFACES="" # SAFEST -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -TRUSTED_IFACES="lo" # MINIMAL/SAFEST -PUBLIC_IFACES="eth+ ppp+ slip+ venet+ bond+ en+" # SAFEST -INTERNAL_IFACES="" # SAFEST - - -# 2) services for which we want to log access attempts to syslog (all systems) -# Note this only audits connection attempts from public interfaces -# -# Also see item 12, LOG_FAILURES -# -#TCP_AUDIT_SERVICES="telnet ftp imap pop3 finger sunrpc exec login linuxconf ssh" -# anyone probing for BackOrifice? -#UDP_AUDIT_SERVICES="31337" -# how about ICMP? -#ICMP_AUDIT_TYPES="" -#ICMP_AUDIT_TYPES="echo-request" # ping/MS tracert -# -# To enable auditing, you must have syslog configured to log "kern" -# messages of "info" level; typically you'd do this with a line in -# syslog.conf like -# kern.info /var/log/messages -# though the Bastille port monitor will normally want these messages -# logged to a named pipe instead, and the Bastille script normally -# configures syslog for "kern.*" which catches these messages -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -#TCP_AUDIT_SERVICES="telnet ftp imap pop3 finger sunrpc exec login linuxconf ssh" -#UDP_AUDIT_SERVICES="31337" -#ICMP_AUDIT_TYPES="" - - -# 3) services we allow connections to (all systems) -# -# FTP note: -# To allow your machine to service "passive" FTP clients, -# you will need to make allowances for the passive data -# ports; Bastille users should read README.FTP for more -# information -# -# "public" interfaces: -# TCP services that "public" hosts should be allowed to connect to -#TCP_PUBLIC_SERVICES="" # MINIMAL/SAFEST -# -# UDP services that "public" hosts should be allowed to connect to -#UDP_PUBLIC_SERVICES="" # MINIMAL/SAFEST -# -# "internal" interfaces: -# (NB: you will need to repeat the "public" services if you want -# to allow "internal" hosts to reach those services, too.) -# TCP services that internal clients can connect to -#TCP_INTERNAL_SERVICES="" # MINIMAL/SAFEST -# -# UDP services that internal clients can connect to -#UDP_INTERNAL_SERVICES="" # MINIMAL/SAFEST -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -TCP_PUBLIC_SERVICES="{TCP_PUBLIC_SERVICES}" # MINIMAL/SAFEST -UDP_PUBLIC_SERVICES="{UDP_PUBLIC_SERVICES}" # MINIMAL/SAFEST -TCP_INTERNAL_SERVICES="" # MINIMAL/SAFEST -UDP_INTERNAL_SERVICES="" # MINIMAL/SAFEST - -# 4) passive/active FTP (Linux 2.2/ipchains only) -# FTP is a firewall nightmare; if you allow "normal" FTP connections, -# you must be careful to block any TCP services that are listening -# on high ports; it's safer to require your FTP clients to use -# "passive" mode. -# -# Note this will also force clients on machines -# that use this one for NAT/IP Masquerading to use passive mode -# for connections that go through this server (e.g. from the -# internal network to public Internet machines -# -# For more information about FTP, see the Bastille README.FTP doc -# -#FORCE_PASV_FTP="N" -#FORCE_PASV_FTP="Y" # SAFEST -# -FORCE_PASV_FTP="Y" # SAFEST - - -# 5) Services to explicitly block. (Linux 2.2/ipchains only) -# See FTP note above -# Note that ranges of ports are specified with colons, and you -# can specify an open range by using only one number, e.g. -# 1024: means ports >= 1024 and :6000 means ports <= 6000 -# -# TCP services on high ports that should be blocked if not forcing passive FTP -# This should include X (6000:6010) and anything else revealed by 'netstat -an' -# (this does not matter unless you're not forcing "passive" FTP) -#TCP_BLOCKED_SERVICES="6000:6020" -# -# UDP services to block: this should be UDP services on high ports. -# Your only vulnerability from public interfaces are the DNS and -# NTP servers/networks (those with 0.0.0.0 for DNS servers should -# obviously be very careful here!) -#UDP_BLOCKED_SERVICES="2049" -# -# types of ICMP packets to allow -#ICMP_ALLOWED_TYPES="destination-unreachable" # MINIMAL/SAFEST -# the following allows you to ping/traceroute outbound -#ICMP_ALLOWED_TYPES="destination-unreachable echo-reply time-exceeded" -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -TCP_BLOCKED_SERVICES="6000:6020" -UDP_BLOCKED_SERVICES="2049" -ICMP_ALLOWED_TYPES="destination-unreachable echo-reply time-exceeded echo-request" - - -# 6) Source Address Verification (all Linux systems) -# This helps prevent "IP Spoofing" attacks -# -ENABLE_SRC_ADDR_VERIFY="Y" # SAFEST - - -# 7) IP Masquerading / NAT. (all systems) -# List your internal/masq'ed networks here -# -# Also see item 4, FORCE_PASV_FTP, as that setting affects -# clients using IP Masquerading through this machine -# -# Set this variable if you're using IP Masq / NAT for a local network -#IP_MASQ_NETWORK="" # DISABLE/SAFEST -#IP_MASQ_NETWORK="10.0.0.0/8" # example -#IP_MASQ_NETWORK="192.168.0.0/16" # example -# -# Have lots of masq hosts? uncomment the following six lines -# and list the hosts/networks in /etc/firewall-masqhosts -# the script assumes any address without a "/" netmask afterwards -# is an individual address (netmask /255.255.255.255): -#if [ -f /etc/firewall-masqhosts ]; then -# echo "Reading list of masq hosts from /etc/firewall-masqhosts" -# # Read the file, but use 'awk' to strip comments -# # Note the sed bracket phrase includes a space and tab char -# IP_MASQ_NETWORK=`cat /etc/firewall-masqhosts | awk -F\# '/\// {print $1; next} /[0-9]/ {print $1"/32"}' |sed 's:[ ]*::g'` -#fi -# -# Masq modules -# NB: The script will prepend "ip_masq_" to each module name -#IP_MASQ_MODULES="cuseeme ftp irc quake raudio vdolive" # ALL (?) -#IP_MASQ_MODULES="ftp raudio vdolive" # RECOMMENDED -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -IP_MASQ_NETWORK="" # DISABLE/SAFEST -IP_MASQ_MODULES="ftp raudio vdolive" # RECOMMENDED - - -# 8) How to react to disallowed packets (all systems) -# whether to "REJECT" or "DROP" disallowed packets; if you're running any -# public services, you probably ought to use "REJECT"; if in serious stealth -# mode, choose "DROP" so simple probes don't know if there's anything out there -# NOTE: disallowed ICMP packets are discarded with "DROP", as -# it would not make sense to "reject" the packet if you're -# trying to disallow ping/traceroute -# NOTE: the scripts that set up the filter rules will interpret these -# keywords as needed, e.g. "DROP" becomes "DENY" for Linux 2.2/ipchains -# -REJECT_METHOD="DROP" - - -# 9) DHCP (Linux 2.2/ipchains only) -# In case your server needs to get a DHCP address from some other -# machine (e.g. cable modem) -#DHCP_IFACES="eth0" # example, to allow you to query on eth0 -#DHCP_IFACES="" # DISABLED -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -DHCP_IFACES="" # DISABLED - - -# 10) NTP servers (Linux 2.2/ipchains only) -# more UDP fun. List IP addresses or network space of NTP servers -# -#NTP_SERVERS="" # DISABLE NTP QUERIES / SAFEST -#NTP_SERVERS="a.b.c.d/32 e.f.g.h/32" # example, to allow querying 2 servers -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -NTP_SERVERS="" # DISABLE NTP QUERIES / SAFEST - - -# 11) more ICMP. (Linux 2.2/ipchains only) -# Control the outbound ICMP to make yourself invisible to -# traceroute probes -# -#ICMP_OUTBOUND_DISABLED_TYPES="destination-unreachable time-exceeded" -# -# Please make sure variable assignments are on single lines; do NOT -# use the "\" continuation character (so Bastille can change the -# values if it is run more than once) -ICMP_OUTBOUND_DISABLED_TYPES="destination-unreachable time-exceeded" - - -# 12) Logging (all systems) -# With this enabled, ipchains will log all blocked packets. -# ** this could generate huge logs ** -# This is primarily intended for the port mointoring system; -# also note that you probably do not want to "AUDIT" any services -# that you are not allowing, as doing so would mean duplicate -# logging -LOG_FAILURES="N" # do not log blocked packets - -# 13) Block fragmented packets (all systems) -# There's no good reason to allow these -#ALLOW_FRAGMENTS="N" # safest -ALLOW_FRAGMENTS="Y" # old behavior - -# 14) Prevent SMB broadcasts from leaking out NAT setup (all systems) -# Windows machines will poll teh net with SMB broadcasts, -# basically advertising their existence. Most folks agree -# that this traffic should be dropped -#DROP_SMB_NAT_BCAST="N" # allow them (are you sure?) -DROP_SMB_NAT_BCAST="Y" # drop those packets - -# 15) Log level (iptables/netfilter/Linux 2.4 only) -# Control what level of logging is used when the firewall logs -# information. Default is warning (4). Lowest priority is -# debug (7); highest is emergency (0). To prevent syslog -# from copying iptables error messages to the console, set -# this to 6 (7 would also work, but 6 is recommended) -# You can also stop syslogd/klogd from printing kernel -# messages to the console by issuing the command -# setterm -msg off -#IP_LOG_LEVEL=6 # level used in 2.2/ipchains -IP_LOG_LEVEL=4 # iptables/netfilter default - -# 16) Always attempt to use stateful features for inbound connections -# Always using state will allow the firewall to reject invalid -# packets sent to otherwise open TCP services, e.g. XMAS, NULL -# and SIN/FYN scans. The downside to choosing this behavior is that -# services may become unreachable if the packet filter's state -# table becomes full. -IP_ALWAYS_USE_STATE="N" # default, ensures services remain available -#IP_ALWAYS_USE_STATE="Y" # disallow invalid packets \ No newline at end of file diff --git a/install/tpl/bastille-firewall.cfg.master b/install/tpl/bastille-firewall.cfg.master new file mode 120000 index 0000000000000000000000000000000000000000..42986da0c60aee3df21520aaba3052082715d61c --- /dev/null +++ b/install/tpl/bastille-firewall.cfg.master @@ -0,0 +1 @@ +../../server/conf/bastille-firewall.cfg.master \ No newline at end of file diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master index 02a7b2f65ccccde2db89cfcaac24e86307e88843..c3ed1c06b90a58f3c48dfcc1c827a42aedcf3f72 100644 --- a/install/tpl/config.inc.php.master +++ b/install/tpl/config.inc.php.master @@ -56,7 +56,7 @@ $revision = str_replace(array('Revision:','$',' '), '', $svn_revision); //** Application define('ISPC_APP_TITLE', 'ISPConfig'); -define('ISPC_APP_VERSION', '3.1dev'); +define('ISPC_APP_VERSION', '3.2.0dev'); define('DEVSYSTEM', 0); diff --git a/install/tpl/debian6_dovecot2.conf.master b/install/tpl/debian6_dovecot2.conf.master index 155453bd355abbfb5c3f49f173eed73d28d5aae0..fd6a87ee06423b0e9247899ae2ef72c3519df110 100644 --- a/install/tpl/debian6_dovecot2.conf.master +++ b/install/tpl/debian6_dovecot2.conf.master @@ -8,6 +8,7 @@ ssl_cert = > {dist_postfix_vmail_mailbox_base}/$HOST/$USER/ispconfig_mailsize` -} - - -# -# Test if the user has his own maildrop include, -# if not available, check if $DEFAULT is set -# (newer maildrop get's that from the DB and updates -# it) and deliver or fail temporarily if not available -# - -`test -f {dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.mailfilter` -if ( $RETURNCODE == 0 ) -{ - include "{dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.mailfilter" -} -else -{ - if ( "$DEFAULT" ne "" ) - { - to "$DEFAULT" - } - else - { - EXITCODE=75 - exit - } -} \ No newline at end of file diff --git a/install/tpl/mailman-virtual_to_transport.sh b/install/tpl/mailman-virtual_to_transport.sh deleted file mode 100644 index 6c57d25c06620922774823aa9e798823302fd5c5..0000000000000000000000000000000000000000 --- a/install/tpl/mailman-virtual_to_transport.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -sed -r -e 's/(^[^#]\S+\s+).+$/\1local/' $1 > /var/lib/mailman/data/transport-mailman -/usr/sbin/postmap /var/lib/mailman/data/transport-mailman \ No newline at end of file diff --git a/install/tpl/mlmmj.conf.master b/install/tpl/mlmmj.conf.master deleted file mode 100644 index 44ba9e8728d2f9b08168525c232377491fe946a3..0000000000000000000000000000000000000000 --- a/install/tpl/mlmmj.conf.master +++ /dev/null @@ -1,5 +0,0 @@ -# Path of the skeleton for mailing lists -skel_dir = /usr/share/mlmmj/text.skel - -# Where to store ML data and archive -spool_dir = /var/spool/mlmmj \ No newline at end of file diff --git a/install/tpl/mm_cfg.py.master b/install/tpl/mm_cfg.py.master deleted file mode 100644 index c0de780e0d19eec4ca07e900a7e1beb8459a3ba5..0000000000000000000000000000000000000000 --- a/install/tpl/mm_cfg.py.master +++ /dev/null @@ -1,108 +0,0 @@ -# -*- python -*- - -# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301 USA - - -"""This is the module which takes your site-specific settings. - -From a raw distribution it should be copied to mm_cfg.py. If you -already have an mm_cfg.py, be careful to add in only the new settings -you want. The complete set of distributed defaults, with annotation, -are in ./Defaults. In mm_cfg, override only those you want to -change, after the - - from Defaults import * - -line (see below). - -Note that these are just default settings - many can be overridden via the -admin and user interfaces on a per-list or per-user basis. - -Note also that some of the settings are resolved against the active list -setting by using the value as a format string against the -list-instance-object's dictionary - see the distributed value of -DEFAULT_MSG_FOOTER for an example.""" - - -####################################################### -# Here's where we get the distributed defaults. # - -from Defaults import * - -############################################################## -# Put YOUR site-specific configuration below, in mm_cfg.py . # -# See Defaults.py for explanations of the values. # - -#------------------------------------------------------------- -# The name of the list Mailman uses to send password reminders -# and similar. Don't change if you want mailman-owner to be -# a valid local part. -MAILMAN_SITE_LIST = 'mailman' - -#------------------------------------------------------------- -# If you change these, you have to configure your http server -# accordingly (Alias and ScriptAlias directives in most httpds) -DEFAULT_URL_PATTERN = 'https://%s/cgi-bin/mailman/' -PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private' -IMAGE_LOGOS = '/images/mailman/' - -#------------------------------------------------------------- -# Default domain for email addresses of newly created MLs -DEFAULT_EMAIL_HOST = '{hostname}' -#------------------------------------------------------------- -# Default host for web interface of newly created MLs -DEFAULT_URL_HOST = '{hostname}' -#------------------------------------------------------------- -# Required when setting any of its arguments. -add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) - -#------------------------------------------------------------- -# The default language for this server. -DEFAULT_SERVER_LANGUAGE = {default_language} - -#------------------------------------------------------------- -# Iirc this was used in pre 2.1, leave it for now -USE_ENVELOPE_SENDER = 0 # Still used? - -#------------------------------------------------------------- -# Unset send_reminders on newly created lists -DEFAULT_SEND_REMINDERS = 0 - -#------------------------------------------------------------- -# Uncomment this if you configured your MTA such that it -# automatically recognizes newly created lists. -# (see /usr/share/doc/mailman/README.Exim4.Debian or -# /usr/share/mailman/postfix-to-mailman.py) -# MTA=None # Misnomer, suppresses alias output on newlist - -#------------------------------------------------------------- -# Uncomment if you use Postfix virtual domains (but not -# postfix-to-mailman.py), but be sure to see -# /usr/share/doc/mailman/README.Debian first. -MTA='Postfix' -POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}] -#------------------------------------------------------------- -# Uncomment if you want to filter mail with SpamAssassin. For -# more information please visit this website: -# http://www.jamesh.id.au/articles/mailman-spamassassin/ -# GLOBAL_PIPELINE.insert(1, 'SpamAssassin') - -POSTFIX_MAP_CMD = '/etc/mailman/virtual_to_transport.sh' - -# Note - if you're looking for something that is imported from mm_cfg, but you -# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py. \ No newline at end of file diff --git a/install/tpl/mysql_clientdb.conf.master b/install/tpl/mysql_clientdb.conf.master index e6eba12615e75403810f554a365c0a19d2c4384d..c205d7142874e279074eecf5502f9b2fd3d86ee2 100644 --- a/install/tpl/mysql_clientdb.conf.master +++ b/install/tpl/mysql_clientdb.conf.master @@ -3,5 +3,6 @@ $clientdb_host = '{hostname}'; $clientdb_user = '{username}'; $clientdb_password = '{password}'; +$clientdb_port = '{port}'; ?> \ No newline at end of file diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master deleted file mode 100644 index 701f3defb1db35963a2c7a04f7b3fe097f8b968b..0000000000000000000000000000000000000000 --- a/install/tpl/nginx_apps.vhost.master +++ /dev/null @@ -1,211 +0,0 @@ -server { - listen {apps_vhost_port}; - listen [::]:{apps_vhost_port} ipv6only=on; - ssl {ssl_on}; - {ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; - {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; - - # redirect to https if accessed with http - {ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri; - - server_name {apps_vhost_servername}; - - root {apps_vhost_dir}; - - client_max_body_size 100M; - - location / { - index index.php index.html; - } - - # serve static files directly - location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { - access_log off; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - fastcgi_param HTTP_PROXY ""; - - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS $https; - - # PHP only, required if PHP was built with --enable-force-cgi-redirect - fastcgi_param REDIRECT_STATUS 200; - fastcgi_pass unix:{fpm_socket}; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - #fastcgi_param PATH_INFO $fastcgi_script_name; - fastcgi_buffer_size 128k; - fastcgi_buffers 256 4k; - fastcgi_busy_buffers_size 256k; - fastcgi_temp_file_write_size 256k; - } - - location ~ /\. { - deny all; - } - - location /phpmyadmin { - root /usr/share/; - index index.php index.html index.htm; - location ~ ^/phpmyadmin/(.+\.php)$ { - try_files $uri =404; - root /usr/share/; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS $https; - - # PHP only, required if PHP was built with --enable-force-cgi-redirect - fastcgi_param REDIRECT_STATUS 200; - # To access phpMyAdmin, the default user (like www-data on Debian/Devuan/Ubuntu) must be used - {use_tcp}fastcgi_pass 127.0.0.1:9000; - {use_socket}fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_buffer_size 128k; - fastcgi_buffers 256 4k; - fastcgi_busy_buffers_size 256k; - fastcgi_temp_file_write_size 256k; - fastcgi_read_timeout 1200; - } - location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { - root /usr/share/; - } - } - location /phpMyAdmin { - rewrite ^/* /phpmyadmin last; - } - - location /squirrelmail { - root /usr/share/; - index index.php index.html index.htm; - location ~ ^/squirrelmail/(.+\.php)$ { - try_files $uri =404; - root /usr/share/; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS $https; - - # PHP only, required if PHP was built with --enable-force-cgi-redirect - fastcgi_param REDIRECT_STATUS 200; - # To access SquirrelMail, the default user (like www-data on Debian/Devuan/Ubuntu) must be used - {use_tcp}fastcgi_pass 127.0.0.1:9000; - {use_socket}fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_buffer_size 128k; - fastcgi_buffers 256 4k; - fastcgi_busy_buffers_size 256k; - fastcgi_temp_file_write_size 256k; - } - location ~* ^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { - root /usr/share/; - } - } - location /webmail { - rewrite ^/* /squirrelmail last; - } - - location /cgi-bin/mailman { - root /usr/lib/; - fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS $https; - - # PHP only, required if PHP was built with --enable-force-cgi-redirect - fastcgi_param REDIRECT_STATUS 200; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - fastcgi_intercept_errors on; - fastcgi_pass unix:{cgi_socket}; - } - - location /images/mailman { - alias /usr/share/images/mailman; - } - - location /pipermail { - alias /var/lib/mailman/archives/public; - autoindex on; - } -} diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master new file mode 120000 index 0000000000000000000000000000000000000000..e59b73601552c4bb8638c961fce1640a6c5ecc0f --- /dev/null +++ b/install/tpl/nginx_apps.vhost.master @@ -0,0 +1 @@ +../../server/conf/nginx_apps.vhost.master \ No newline at end of file diff --git a/install/tpl/nginx_ispconfig.vhost.master b/install/tpl/nginx_ispconfig.vhost.master index 3c8bf5dbaf749f4fca8ba08a44fa8ebe4404a8d3..cd9bb1852772a54105211a3099542263208ffbdf 100644 --- a/install/tpl/nginx_ispconfig.vhost.master +++ b/install/tpl/nginx_ispconfig.vhost.master @@ -1,11 +1,11 @@ server { - listen {vhost_port}; - listen [::]:{vhost_port} ipv6only=on; - ssl {ssl_on}; + listen {vhost_port}{ssl_on}; + listen [::]:{vhost_port} ipv6only=on{ssl_on}; + {ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; - {ssl_comment}ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; + {ssl_comment}ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; {ssl_comment}ssl_prefer_server_ciphers on; # redirect to https if accessed with http diff --git a/install/tpl/opensuse_dovecot2.conf.master b/install/tpl/opensuse_dovecot2.conf.master index 49ba52e5f58ba4d3ff913702932e8778ab29f1fa..a8eb1cc089e9400967fe627ae389a897d760fbed 100644 --- a/install/tpl/opensuse_dovecot2.conf.master +++ b/install/tpl/opensuse_dovecot2.conf.master @@ -7,6 +7,7 @@ mail_privileged_group = vmail ssl_cert = n bytes in size are not scanned + #max_size = 20000000; + # symbol to add (add it to metric if you want non-zero weight) + symbol = "CLAM_VIRUS"; + # type of scanner: "clamav", "fprot", "sophos" or "savapi" + type = "clamav"; + # For "savapi" you must also specify the following variable + #product_id = 12345; + # You can enable logging for clean messages + #log_clean = true; + # servers to query (if port is unspecified, scanner-specific default is used) + # can be specified multiple times to pool servers + # can be set to a path to a unix socket + # Enable this in local.d/antivirus.conf + #servers = "127.0.0.1:3310"; + servers = "/var/run/clamav/clamd.ctl"; + # if `patterns` is specified virus name will be matched against provided regexes and the related + # symbol will be yielded if a match is found. If no match is found, default symbol is yielded. + patterns { + # symbol_name = "pattern"; + JUST_EICAR = "^Eicar-Test-Signature$"; + } + # `whitelist` points to a map of IP addresses. Mail from these addresses is not scanned. + whitelist = "/etc/rspamd/antivirus.wl"; +} \ No newline at end of file diff --git a/install/tpl/rspamd_classifier-bayes.conf.master b/install/tpl/rspamd_classifier-bayes.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..1688d57e217673cdfa50ff36c31f4beb782aae70 --- /dev/null +++ b/install/tpl/rspamd_classifier-bayes.conf.master @@ -0,0 +1,3 @@ +autolearn = [-0.01, 5.00]; +per_user = true; +per_language = true; \ No newline at end of file diff --git a/install/tpl/rspamd_dkim_signing.conf.master b/install/tpl/rspamd_dkim_signing.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..0e55a7ead24c371004df6bb4bad5c620a0cca295 --- /dev/null +++ b/install/tpl/rspamd_dkim_signing.conf.master @@ -0,0 +1,2 @@ +path = "/$domain.private"; +selector = "default"; \ No newline at end of file diff --git a/install/tpl/rspamd_greylist.conf.master b/install/tpl/rspamd_greylist.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..74ea715a22cc6fa76671fd47a3f1bf89cfe92d49 --- /dev/null +++ b/install/tpl/rspamd_greylist.conf.master @@ -0,0 +1 @@ +servers = "127.0.0.1:6379"; \ No newline at end of file diff --git a/install/tpl/rspamd_groups.conf.master b/install/tpl/rspamd_groups.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..62a986533abb66fe28203358f0d6ef5854f9e0e6 --- /dev/null +++ b/install/tpl/rspamd_groups.conf.master @@ -0,0 +1,4 @@ +group "antivirus" { + .include(try=true; priority=1; duplicate=merge) "$LOCAL_CONFDIR/local.d/antivirus_group.conf" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/antivirus_group.conf" +} diff --git a/install/tpl/rspamd_milter_headers.conf.master b/install/tpl/rspamd_milter_headers.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..d399bbf4ecc37e39ff900260a4884335767e9957 --- /dev/null +++ b/install/tpl/rspamd_milter_headers.conf.master @@ -0,0 +1,2 @@ +use = ["x-spamd-bar", "x-spam-level", "authentication-results"]; +authenticated_headers = ["authentication-results"]; \ No newline at end of file diff --git a/install/tpl/rspamd_mx_check.conf.master b/install/tpl/rspamd_mx_check.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..0a628f9c8382ee1f0def03883c91b91d7701e625 --- /dev/null +++ b/install/tpl/rspamd_mx_check.conf.master @@ -0,0 +1,9 @@ +enabled = true; +servers = "localhost"; +key_prefix = "rmx"; +symbol_bad_mx = "MX_INVALID"; +symbol_no_mx = "MX_MISSING"; +symbol_good_mx = "MX_GOOD"; +expire = 86400; +expire_novalid = 7200; +greylist_invalid = false; \ No newline at end of file diff --git a/install/tpl/rspamd_neural.conf.master b/install/tpl/rspamd_neural.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..76f8a6d34479f05dfb638d736fdb5c975b31a7a0 --- /dev/null +++ b/install/tpl/rspamd_neural.conf.master @@ -0,0 +1,31 @@ +servers = 127.0.0.1:6379; +enabled = true; + +rules { + "LONG" { + train { + max_trains = 5000; + max_usages = 200; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 10; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_LONG"; + symbol_ham = "NEURAL_HAM_LONG"; + ann_expire = 100d; + } + "SHORT" { + train { + max_trains = 100; + max_usages = 2; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 10; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_SHORT"; + symbol_ham = "NEURAL_HAM_SHORT"; + ann_expire = 1d; + } +} \ No newline at end of file diff --git a/install/tpl/rspamd_neural_group.conf.master b/install/tpl/rspamd_neural_group.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..5aabdefaff0599b633b5589eb80c6c85f7e4692f --- /dev/null +++ b/install/tpl/rspamd_neural_group.conf.master @@ -0,0 +1,18 @@ +symbols = { + "NEURAL_SPAM_LONG" { + weight = 1.0; # sample weight + description = "Neural network spam (long)"; + } + "NEURAL_HAM_LONG" { + weight = -2.0; # sample weight + description = "Neural network ham (long)"; + } + "NEURAL_SPAM_SHORT" { + weight = 0.5; # sample weight + description = "Neural network spam (short)"; + } + "NEURAL_HAM_SHORT" { + weight = -1.0; # sample weight + description = "Neural network ham (short)"; + } +} diff --git a/install/tpl/rspamd_options.inc.master b/install/tpl/rspamd_options.inc.master new file mode 100644 index 0000000000000000000000000000000000000000..69e40365b7dc653b046b6e3cb3ff0539936a816e --- /dev/null +++ b/install/tpl/rspamd_options.inc.master @@ -0,0 +1,5 @@ +local_addrs = "127.0.0.0/8, ::1"; + +dns { + nameserver = ["127.0.0.1:53:10"]; +} diff --git a/install/tpl/rspamd_override_rbl.conf.master b/install/tpl/rspamd_override_rbl.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..310e722832376f6e049fc2e1ac4c4179a3c3259e --- /dev/null +++ b/install/tpl/rspamd_override_rbl.conf.master @@ -0,0 +1,53 @@ +# RBL +symbols = { + "RBL_SENDERSCORE" { + weight = 4.0; + description = "From address is listed in senderscore.com BL"; + } + "RBL_SPAMHAUS_SBL" { + weight = 2.0; + description = "From address is listed in zen sbl"; + } + "RBL_SPAMHAUS_CSS" { + weight = 2.0; + description = "From address is listed in zen css"; + } + "RBL_SPAMHAUS_XBL" { + weight = 4.0; + description = "From address is listed in zen xbl"; + } + "RBL_SPAMHAUS_XBL_ANY" { + weight = 4.0; + description = "From or receive address is listed in zen xbl (any list)"; + } + "RBL_SPAMHAUS_PBL" { + weight = 2.0; + description = "From address is listed in zen pbl (ISP list)"; + } + "RBL_SPAMHAUS_DROP" { + weight = 7.0; + description = "From address is listed in zen drop bl"; + } + "RECEIVED_SPAMHAUS_XBL" { + weight = 3.0; + description = "Received address is listed in zen xbl"; + one_shot = true; + } + "RBL_MAILSPIKE_WORST" { + weight = 2.0; + description = "From address is listed in RBL - worst possible reputation"; + } + "RBL_MAILSPIKE_VERYBAD" { + weight = 1.5; + description = "From address is listed in RBL - very bad reputation"; + } + "RBL_MAILSPIKE_BAD" { + weight = 1.0; + description = "From address is listed in RBL - bad reputation"; + } + "RBL_SEM" { + weight = 1.0; + description = "Address is listed in Spameatingmonkey RBL"; + } + # /RBL +} diff --git a/install/tpl/rspamd_override_surbl.conf.master b/install/tpl/rspamd_override_surbl.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..30676a46fde75e4e4d21bf3e5cc1e6aabc4e749d --- /dev/null +++ b/install/tpl/rspamd_override_surbl.conf.master @@ -0,0 +1,108 @@ +symbols = { + # SURBL + "PH_SURBL_MULTI" { + weight = 5.5; + description = "SURBL: Phishing sites"; + } + "MW_SURBL_MULTI" { + weight = 5.5; + description = "SURBL: Malware sites"; + } + "ABUSE_SURBL" { + weight = 5.5; + description = "SURBL: ABUSE"; + } + "CRACKED_SURBL" { + weight = 4.0; + description = "SURBL: cracked site"; + } + "RAMBLER_URIBL" { + weight = 4.5; + description = "Rambler uribl"; + one_shot = true; + } + "RAMBLER_EMAILBL" { + weight = 9.5; + description = "Rambler emailbl"; + one_shot = true; + } + "MSBL_EBL" { + weight = 7.5; + description = "MSBL emailbl"; + one_shot = true; + } + "SEM_URIBL" { + weight = 3.5; + description = "Spameatingmonkey uribl"; + } + "SEM_URIBL_FRESH15" { + weight = 3.0; + description = "Spameatingmonkey uribl. Domains registered in the last 15 days (.AERO,.BIZ,.COM,.INFO,.NAME,.NET,.PRO,.SK,.TEL,.US)"; + } + "DBL" { + weight = 0.0; + description = "DBL unknown result"; + } + "DBL_SPAM" { + weight = 6.5; + description = "DBL uribl spam"; + } + "DBL_PHISH" { + weight = 6.5; + description = "DBL uribl phishing"; + } + "DBL_MALWARE" { + weight = 6.5; + description = "DBL uribl malware"; + } + "DBL_BOTNET" { + weight = 5.5; + description = "DBL uribl botnet C&C domain"; + } + "DBL_ABUSE" { + weight = 6.5; + description = "DBL uribl abused legit spam"; + } + "DBL_ABUSE_REDIR" { + weight = 1.5; + description = "DBL uribl abused spammed redirector domain"; + } + "DBL_ABUSE_PHISH" { + weight = 7.5; + description = "DBL uribl abused legit phish"; + } + "DBL_ABUSE_MALWARE" { + weight = 7.5; + description = "DBL uribl abused legit malware"; + } + "DBL_ABUSE_BOTNET" { + weight = 5.5; + description = "DBL uribl abused legit botnet C&C"; + } + "URIBL_BLACK" { + weight = 7.5; + description = "uribl.com black url"; + } + "URIBL_RED" { + weight = 3.5; + description = "uribl.com red url"; + } + "URIBL_GREY" { + weight = 1.5; + description = "uribl.com grey url"; + one_shot = true; + } + "URIBL_SBL" { + weight = 6.5; + description = "Spamhaus SBL URIBL"; + } + "URIBL_SBL_CSS" { + weight = 6.5; + description = "Spamhaus SBL CSS URIBL"; + } + "RBL_SARBL_BAD" { + weight = 2.5; + description = "A domain listed in the mail is blacklisted in SARBL"; + } + # /SURBL +} diff --git a/install/tpl/rspamd_redis.conf.master b/install/tpl/rspamd_redis.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..b908af9f5ebe0e23293797e234eb9dd455838a01 --- /dev/null +++ b/install/tpl/rspamd_redis.conf.master @@ -0,0 +1 @@ +servers = "127.0.0.1"; \ No newline at end of file diff --git a/install/tpl/rspamd_symbols_antivirus.conf.master b/install/tpl/rspamd_symbols_antivirus.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..8c2d93d89eeacf816ad870f5bab97a7d406cc143 --- /dev/null +++ b/install/tpl/rspamd_symbols_antivirus.conf.master @@ -0,0 +1,15 @@ +subject = "***SPAM*** %s"; +symbols = { + "CLAM_VIRUS" { + weight = 50; + description = "Clamav has found a virus."; + } + "JUST_EICAR" { + weight = 50; + description = "Clamav has found a virus."; + } + "R_DUMMY" { + weight = 0.0; + description = "Dummy symbol"; + } +} \ No newline at end of file diff --git a/install/tpl/rspamd_users.conf.master b/install/tpl/rspamd_users.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..73d437d6cbdd3a7292af84855364cdfee7de977a --- /dev/null +++ b/install/tpl/rspamd_users.conf.master @@ -0,0 +1,43 @@ +settings { + authenticated { + priority = 10; + authenticated = yes; + #apply "default" { groups_disabled = ["rbl", "spf"]; } + apply "default" { + #symbols_enabled = []; + symbols_disabled = []; + #groups_enabled = []; + groups_disabled = ["rbl"]; + } + } + whitelist { + priority = 10; + rcpt = "postmaster"; + rcpt = "hostmaster"; + rcpt = "abuse"; + want_spam = yes; + } + whitelist-ip { + priority = 10; + + ip = ""; + + + want_spam = yes; + } +# whitelist-timmehosting { +# priority = 20; +# from = "@xxx"; +# from = "@xxx"; +# want_spam = yes; +# } + whitelist-ca { + priority = 20; + from = "@comodo.com"; + from = "@geotrust.com"; + from = "@geotrusteurope.com"; + want_spam = yes; + } + .include(try=true; glob=true) "$LOCAL_CONFDIR/local.d/users/*.conf" + .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/users.local.conf" +} diff --git a/install/tpl/rspamd_wblist.inc.conf.master b/install/tpl/rspamd_wblist.inc.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..fc06127eae69ed43309f050983c90a5c12bdc9f0 --- /dev/null +++ b/install/tpl/rspamd_wblist.inc.conf.master @@ -0,0 +1,18 @@ +spamfilter_wblist- { + priority = ; + from = ""; + rcpt = ""; + + want_spam = yes; + + apply "default" { + R_DUMMY = 999.0; + actions { + reject = 0.2; + add_header = 0.1; + greylist = 0.1; + rewrite_subject = 0.1; + } + } + +} \ No newline at end of file diff --git a/install/tpl/rspamd_worker-controller.inc.master b/install/tpl/rspamd_worker-controller.inc.master new file mode 120000 index 0000000000000000000000000000000000000000..dae19323690f604babdb0682108b49f420476fb7 --- /dev/null +++ b/install/tpl/rspamd_worker-controller.inc.master @@ -0,0 +1 @@ +../../server/conf/rspamd_worker-controller.inc.master \ No newline at end of file diff --git a/install/tpl/sasl_smtpd.conf.master b/install/tpl/sasl_smtpd.conf.master deleted file mode 100644 index 72371270099bcd02d82de2ebf8d0424248eca438..0000000000000000000000000000000000000000 --- a/install/tpl/sasl_smtpd.conf.master +++ /dev/null @@ -1,9 +0,0 @@ -pwcheck_method: saslauthd -mech_list: plain login -allow_plaintext: true -auxprop_plugin: mysql -sql_hostnames: {mysql_server_ip} -sql_user: {mysql_server_ispconfig_user} -sql_passwd: {mysql_server_ispconfig_password} -sql_database: {mysql_server_database} -sql_select: select password from mail_user where (login = '%u' or email = '%u@%r') and postfix = 'y' and disablesmtp = 'n' \ No newline at end of file diff --git a/install/tpl/sasl_smtpd2.conf.master b/install/tpl/sasl_smtpd2.conf.master deleted file mode 100644 index 5fafe3670ccf3cd5adf17ae3575b75124c4d4a93..0000000000000000000000000000000000000000 --- a/install/tpl/sasl_smtpd2.conf.master +++ /dev/null @@ -1,10 +0,0 @@ -pwcheck_method: saslauthd -mech_list: plain login -allow_plaintext: true -auxprop_plugin: sql -sql_engine: mysql -sql_hostnames: {mysql_server_ip} -sql_user: {mysql_server_ispconfig_user} -sql_passwd: {mysql_server_ispconfig_password} -sql_database: {mysql_server_database} -sql_select: select password from mail_user where (login = '%u' or email = '%u@%r') and postfix = 'y' and disablesmtp = 'n' diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 8a8661801c36266a95c66dd9d9d52af680c8fb9d..996c388f2813279e7dfed84335c23b0f011e67c5 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -38,8 +38,8 @@ homedir_path=/var/vmail maildir_format=maildir dkim_path=/var/lib/amavis/dkim dkim_strength=1024 -pop3_imap_daemon=courier -mail_filter_syntax=maildrop +content_filter=rspamd +rspamd_password= mailuser_uid=5000 mailuser_gid=5000 mailuser_name=vmail @@ -57,7 +57,6 @@ overquota_notify_client=y overquota_notify_freq=7 overquota_notify_onok=n sendmail_path=/usr/sbin/sendmail -mailinglist_manager=mlmmj [getmail] getmail_config_dir=/etc/getmail @@ -103,6 +102,7 @@ php_fpm_ini_path=/etc/php5/fpm/php.ini php_fpm_pool_dir=/etc/php5/fpm/pool.d php_fpm_start_port=9010 php_fpm_socket_dir=/var/lib/php5-fpm +php_default_name=Default set_folder_permissions_on_update=n add_web_users_to_sshusers_group=y connect_userid_to_webid=n @@ -133,12 +133,11 @@ fastcgi_phpini_path=/etc/php5/cgi/ fastcgi_children=8 fastcgi_max_requests=5000 fastcgi_bin=/usr/bin/php-cgi -fastcgi_config_syntax=2 [jailkit] jailkit_chroot_home=/home/[username] jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh -jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2 /opt/php-5.6.8/bin/php /opt/php-5.6.8/include /opt/php-5.6.8/lib +jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2 /usr/bin/rsync /usr/bin/jpegoptim /usr/bin/optipng /usr/share/ca-certificates/ /etc/ssl/certs/ /opt/th-php-libs/ /etc/ld.so.conf.d/ /bin/bzip2 /usr/local/bin/composer /usr/lib/ssl /usr/bin/env /usr/bin/xargs jailkit_chroot_cron_programs=/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php [vlogger] @@ -154,14 +153,3 @@ try_rescue=n do_not_try_rescue_httpd=n do_not_try_rescue_mysql=n do_not_try_rescue_mail=n - -[xmpp] -xmpp_daemon=prosody -xmpp_use_ispv6=n -xmpp_bosh_max_inactivity=30 -xmpp_server_admins= -xmpp_modules_enabled=roster, saslauth, tls, dialback, disco, carbons, pep, private, blocklist, vcard, version, uptime, time, ping, admin_adhoc, mam, bosh, websocket, http_files, announce, proxy65, offline, posix, webpresence, smacks, csi_battery_saver, pep_vcard_avatar, omemo_all_access -xmpp_port_http=5290 -xmpp_port_https=5291 -xmpp_port_pastebin=5292 -xmpp_port_bosh=5280 diff --git a/install/tpl/xmpp_metronome_conf_global.master b/install/tpl/xmpp_metronome_conf_global.master deleted file mode 100644 index 68f4c59b6b34badb6abb216eccbbbd053ac897f0..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_metronome_conf_global.master +++ /dev/null @@ -1,65 +0,0 @@ -pidfile = "/var/run/metronome/metronome.pid"; -metronome_max_files_soft = 200000; -metronome_max_files_hard = 300000; -plugin_paths = { - "/usr/lib/metronome/isp-modules", -}; -use_libevent = true; -log = { - debug = "/var/log/metronome/metronome.dbg", - info = "/var/log/metronome/metronome.log", - error = "/var/log/metronome/metronome.err", -}; -use_ipv6 = true; -http_ports = { - 5290, -}; -https_ports = { - 5291, -}; -pastebin_ports = { - 5292, -}; -bosh_ports = { - 5280, -}; -admins = { - {tmpl_var xmpp_admins} -}; -modules_enabled = { - "saslauth", - "tls", - "dialback", - "disco", - "discoitems", - "version", - "uptime", - "time", - "ping", - "admin_adhoc", - "admin_telnet", - "bosh", - "posix", - "announce", - "offline", - "webpresence", - "mam", - "stream_management", - "message_carbons" -}; -modules_disabled = { -}; -bosh_max_inactivity = 30; -consider_bosh_secure = true; -cross_domain_bosh = true; -allow_registration = false; -ssl = { - key = "/etc/metronome/certs/localhost.key", - certificate = "/etc/metronome/certs/localhost.cert", -}; -c2s_require_encryption = false; -s2s_secure = true; -s2s_insecure_domains = { - "gmail.com", -}; -authentication = "internal_plain"; diff --git a/install/tpl/xmpp_metronome_conf_main.master b/install/tpl/xmpp_metronome_conf_main.master deleted file mode 100644 index f9c8fbdd655f0771c277df692916f5e1ba78cf5e..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_metronome_conf_main.master +++ /dev/null @@ -1,3 +0,0 @@ -Include "/etc/metronome/global.cfg.lua" -Include "/etc/metronome/hosts/*.lua" -Include "/etc/metronome/status/*.lua" diff --git a/install/tpl/xmpp_metronome_conf_ssl.master b/install/tpl/xmpp_metronome_conf_ssl.master deleted file mode 100644 index 922dfd22a1ab6c4f726fcc4b0eb84cdd60f73ec4..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_metronome_conf_ssl.master +++ /dev/null @@ -1,48 +0,0 @@ -oid_section = new_oids - -[ new_oids ] - -# RFC 3920 section 5.1.1 defines this OID -xmppAddr = 1.3.6.1.5.5.7.8.5 - -# RFC 4985 defines this OID -SRVName = 1.3.6.1.5.5.7.8.7 - -[ req ] - -default_bits = 4096 -default_keyfile = {tmpl_var name='domain'}.key -distinguished_name = distinguished_name -req_extensions = v3_extensions -x509_extensions = v3_extensions - -# ask about the DN? -prompt = no - -[ distinguished_name ] - -commonName = {tmpl_var name='domain'} -countryName = {tmpl_var name='ssl_country'} -localityName = {tmpl_var name='ssl_locality'} -organizationName = {tmpl_var name='ssl_organisation'} -organizationalUnitName = {tmpl_var name='ssl_organisation_unit'} -emailAddress = {tmpl_var name='ssl_email'} - -[ v3_extensions ] - -# for certificate requests (req_extensions) -# and self-signed certificates (x509_extensions) - -basicConstraints = CA:FALSE -keyUsage = digitalSignature,keyEncipherment -extendedKeyUsage = serverAuth,clientAuth -subjectAltName = @subject_alternative_name - -[ subject_alternative_name ] - -# See http://tools.ietf.org/html/draft-ietf-xmpp-3920bis#section-13.7.1.2 for more info. - -DNS.0 = {tmpl_var name='domain'} -otherName.0 = xmppAddr;FORMAT:UTF8,UTF8:{tmpl_var name='domain'} -otherName.1 = SRVName;IA5STRING:_xmpp-client.{tmpl_var name='domain'} -otherName.2 = SRVName;IA5STRING:_xmpp-server.{tmpl_var name='domain'} \ No newline at end of file diff --git a/install/tpl/xmpp_prosody_conf_global.master b/install/tpl/xmpp_prosody_conf_global.master deleted file mode 100644 index 14a0ae970295b4c5bb25993bce2f3ecd6dc7f3d6..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_prosody_conf_global.master +++ /dev/null @@ -1,94 +0,0 @@ -plugin_paths = { - "/usr/local/lib/prosody/modules", -}; -use_libevent = true; -log = { - -- optional: uncomment debug log here - -- debug = "/var/log/prosody/prosody.dbg", - info = "/var/log/prosody/prosody.log", - error = "/var/log/prosody/prosody.err", - "syslog", -}; -use_ipv6 = true; -http_ports = { - 5290, -}; -https_ports = { - 5291, -}; -pastebin_ports = { - 5292, -}; -bosh_ports = { - 5280, -}; -admins = { - {tmpl_var xmpp_admins} -}; -modules_enabled = { - "roster", - "saslauth", - "tls", - "dialback", - "disco", - "carbons", - "pep", - "private", - "blocklist", - "vcard", - "version", - "uptime", - "time", - "ping", - "admin_adhoc", - "mam", - "bosh", - "websocket", - "http_files", - "announce", - "proxy65", - "offline", - "posix", - "websocket", - -- community modules - "webpresence", - "smacks", - "csi_battery_saver", - "pep_vcard_avatar", - "omemo_all_access", -}; -modules_disabled = { -}; - -allow_registration = false; -c2s_require_encryption = false; -s2s_require_encryption = true; -s2s_secure_auth = false; -s2s_insecure_domains = { - "gmail.com", -}; - -pidfile = "/var/run/prosody/prosody.pid"; - -authentication = "external"; - -archive_expires_after = "2w"; - -statistics = "internal"; - -certificates = "certs"; -bosh_max_inactivity = 60; -consider_bosh_secure = true; -cross_domain_bosh = true; -consider_websocket_secure = true; - -ssl = { - key = "/etc/prosody/certs/localhost.key", - certificate = "/etc/prosody/certs/localhost.crt", -}; - -Component "{tmpl_var main_host}" "http_upload" - ud_disco_name = "HTTP File Upload"; - http_upload_file_size_limit = 1024 * 1024 * 10; - http_upload_quota = 1024 * 1024 * 10; - http_upload_expire_after = 60 * 60 * 24 * 2; \ No newline at end of file diff --git a/install/tpl/xmpp_prosody_conf_main.master b/install/tpl/xmpp_prosody_conf_main.master deleted file mode 100644 index 9c57f3292e292645bd4f1bd9b6184ddbc80e08c0..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_prosody_conf_main.master +++ /dev/null @@ -1,3 +0,0 @@ -Include "/etc/prosody/storage.cfg.lua" -Include "/etc/prosody/global.cfg.lua" -Include "/etc/prosody/hosts/*.lua" diff --git a/install/tpl/xmpp_prosody_conf_ssl.master b/install/tpl/xmpp_prosody_conf_ssl.master deleted file mode 100644 index 97b088a6adf0886203020a9d23a4f32266d46b59..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_prosody_conf_ssl.master +++ /dev/null @@ -1,48 +0,0 @@ -oid_section = new_oids - -[ new_oids ] - -# RFC 3920 section 5.1.1 defines this OID -xmppAddr = 1.3.6.1.5.5.7.8.5 - -# RFC 4985 defines this OID -SRVName = 1.3.6.1.5.5.7.8.7 - -[ req ] - -default_bits = 4096 -default_keyfile = {tmpl_var name='domain'}.key -distinguished_name = distinguished_name -req_extensions = v3_extensions -x509_extensions = v3_extensions - -# ask about the DN? -prompt = no - -[ distinguished_name ] - -commonName = {tmpl_var name='domain'} -countryName = {tmpl_var name='ssl_country'} -localityName = {tmpl_var name='ssl_locality'} -organizationName = {tmpl_var name='ssl_organisation'} -organizationalUnitName = {tmpl_var name='ssl_organisation_unit'} -emailAddress = {tmpl_var name='ssl_email'} - -[ v3_extensions ] - -# for certificate requests (req_extensions) -# and self-signed certificates (x509_extensions) - -basicConstraints = CA:TRUE -keyUsage = digitalSignature,keyEncipherment -extendedKeyUsage = serverAuth,clientAuth -subjectAltName = @subject_alternative_name - -[ subject_alternative_name ] - -# See http://tools.ietf.org/html/draft-ietf-xmpp-3920bis#section-13.7.1.2 for more info. - -DNS.0 = {tmpl_var name='domain'} -otherName.0 = xmppAddr;FORMAT:UTF8,UTF8:{tmpl_var name='domain'} -otherName.1 = SRVName;IA5STRING:_xmpp-client.{tmpl_var name='domain'} -otherName.2 = SRVName;IA5STRING:_xmpp-server.{tmpl_var name='domain'} \ No newline at end of file diff --git a/install/tpl/xmpp_prosody_conf_storage.master b/install/tpl/xmpp_prosody_conf_storage.master deleted file mode 100644 index 217e5163b79ea5754f23afb12da36a0ef1b1041e..0000000000000000000000000000000000000000 --- a/install/tpl/xmpp_prosody_conf_storage.master +++ /dev/null @@ -1,9 +0,0 @@ -storage = "sql" -sql = { - driver = "MySQL"; - database = "{tmpl_var db_name}"; - host = "{tmpl_var db_host}"; - port = {tmpl_var db_port}; - username = "{tmpl_var db_username}"; - password = "{tmpl_var db_password}"; -} \ No newline at end of file diff --git a/install/update.php b/install/update.php index 3361c3c1918c6bb8803bc67d44473bcbe0488016..03c203d2bf223ebc9da7cdf7039d0b49fb259ba5 100644 --- a/install/update.php +++ b/install/update.php @@ -98,7 +98,7 @@ if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); } -// Patch is required to reapir latest amavis versions +// Patch is required to repair latest amavis versions if(is_installed('amavisd-new') && !is_installed('patch')) die('The patch command is missing. Install patch command and start update again.'); //** Get distribution identifier @@ -109,6 +109,7 @@ $conf_old = $conf; unset($conf); if($dist['id'] == '') die('Linux distribution or version not recognized.'); +if(!$dist['supported']) die('This distribution is not supported.'); //** Include the autoinstaller configuration (for non-interactive setups) error_reporting(E_ALL ^ E_NOTICE); @@ -141,11 +142,18 @@ if(isset($cmd_opt['autoinstall']) && is_file($cmd_opt['autoinstall'])) { define('AUTOINSTALL', false); } + //** Include the distribution-specific installer class library and configuration if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php'; include_once 'dist/lib/'.$dist['id'].'.lib.php'; include_once 'dist/conf/'.$dist['confid'].'.conf.php'; +$inst = new installer(); +if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n"); +$inst->is_update = true; + +$inst->raiseEvent('set_dist_config', $dist); + //** tRNG dependencies $conf['tRNG']=''; @@ -186,10 +194,6 @@ if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to $conf['server_id'] = intval($conf_old["server_id"]); $conf['ispconfig_log_priority'] = $conf_old["log_priority"]; -$inst = new installer(); -if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n"); -$inst->is_update = true; - echo "This application will update ISPConfig 3 on your server.\n\n"; //* Make a backup before we start the update @@ -298,7 +302,9 @@ checkDbHealth(); /* * dump the new Database and reconfigure the server.ini */ +$inst->raiseEvent('updateDbAndIni::before'); updateDbAndIni(); +$inst->raiseEvent('updateDbAndIni::after'); //** read server config from db into $conf['server_config'] $tmp = $inst->db->queryOneRecord("SELECT config FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']); @@ -320,22 +326,24 @@ if($reconfigure_master_database_rights_answer == 'yes') { //} //** Detect the installed applications +$inst->raiseEvent('find_installed_apps::before'); $inst->find_installed_apps(); +$inst->raiseEvent('find_installed_apps::after'); //** Check for current service config state and compare to our results -if ($conf['mysql']['master_slave_setup'] == 'y') $current_svc_config = $inst->dbmaster->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf['mysql']['master_database'] . '.server', $conf['server_id']); -else $current_svc_config = $inst->db->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf["mysql"]["database"] . '.server', $conf['server_id']); +$inst->raiseEvent('check_service_config_state::before'); +if ($conf['mysql']['master_slave_setup'] == 'y') $current_svc_config = $inst->dbmaster->queryOneRecord("SELECT mail_server,web_server,dns_server,firewall_server,db_server FROM ?? WHERE server_id=?", $conf['mysql']['master_database'] . '.server', $conf['server_id']); +else $current_svc_config = $inst->db->queryOneRecord("SELECT mail_server,web_server,dns_server,firewall_server,db_server FROM ?? WHERE server_id=?", $conf["mysql"]["database"] . '.server', $conf['server_id']); $conf['services']['mail'] = check_service_config_state('mail_server', $conf['postfix']['installed']); $conf['services']['dns'] = check_service_config_state('dns_server', ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed'])); $conf['services']['web'] = check_service_config_state('web_server', ($conf['apache']['installed'] || $conf['nginx']['installed'])); -$conf['services']['xmpp'] = check_service_config_state('xmpp_server', $conf['metronome']['installed']); $conf['services']['firewall'] = check_service_config_state('firewall_server', ($conf['ufw']['installed'] || $conf['firewall']['installed'])); -$conf['services']['vserver'] = check_service_config_state('vserver_server', $conf['services']['vserver']); $conf['services']['db'] = check_service_config_state('db_server', true); /* Will always offer as MySQL is of course installed on this host as it's a requirement for ISPC to work... */ unset($current_svc_config); +$inst->raiseEvent('check_service_config_state::after'); //** Write new decisions into DB -$sql = "UPDATE ?? SET mail_server = '{$conf['services']['mail']}', web_server = '{$conf['services']['web']}', dns_server = '{$conf['services']['dns']}', file_server = '{$conf['services']['file']}', db_server = '{$conf['services']['db']}', vserver_server = '{$conf['services']['vserver']}', proxy_server = '{$conf['services']['proxy']}', firewall_server = '$firewall_server_enabled', xmpp_server = '$xmpp_server_enabled' WHERE server_id = ?"; +$sql = "UPDATE ?? SET mail_server = '{$conf['services']['mail']}', web_server = '{$conf['services']['web']}', dns_server = '{$conf['services']['dns']}', file_server = '{$conf['services']['file']}', db_server = '{$conf['services']['db']}', proxy_server = '{$conf['services']['proxy']}', firewall_server = '$firewall_server_enabled' WHERE server_id = ?"; $inst->db->query($sql, $conf['mysql']['database'].'.server', $conf['server_id']); if($conf['mysql']['master_slave_setup'] == 'y') { $inst->dbmaster->query($sql, $conf['mysql']['master_database'].'.server', $conf['server_id']); @@ -365,34 +373,10 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel //* Configure dovecot swriteln('Configuring Dovecot'); $inst->configure_dovecot(); - } elseif ($conf['courier']['installed'] == true) { - //** Configure saslauthd - swriteln('Configuring SASL'); - $inst->configure_saslauthd(); - - //** Configure PAM - swriteln('Configuring PAM'); - $inst->configure_pam(); - - //* Configure courier - swriteln('Configuring Courier'); - $inst->configure_courier(); } } - //** Configure mailman - if($conf['mailman']['installed'] == true && $inst->reconfigure_app('Mailman', $reconfigure_services_answer)) { - swriteln('Configuring Mailman'); - $inst->configure_mailman('update'); - } - - //* Configure mlmmj - if($conf['mlmmj']['installed'] == true && $inst->reconfigure_app('Mlmmj', $reconfigure_services_answer)) { - swriteln('Configuring Mlmmj'); - $inst->configure_mlmmj(/*update*/); - } - //** Configure Spamasassin if($inst->reconfigure_app('Spamassassin', $reconfigure_services_answer)) { swriteln('Configuring Spamassassin'); @@ -405,6 +389,12 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel $inst->configure_amavis(); } + //** Configure Rspamd + if($conf['rspamd']['installed'] == true && $inst->reconfigure_app('Rspamd', $reconfigure_services_answer)) { + swriteln('Configuring Rspamd'); + $inst->configure_rspamd(); + } + //** Configure Getmail if ($inst->reconfigure_app('Getmail', $reconfigure_services_answer)) { swriteln('Configuring Getmail'); @@ -465,17 +455,6 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel } - if($conf['services']['xmpp'] && $inst->reconfigure_app('XMPP', $reconfigure_services_answer)) { - //** Configure Metronome XMPP - if($conf['prosody']['installed'] == true) { - swriteln('Configuring Prosody XMPP'); - $inst->configure_prosody('dont-create-certs'); - } elseif ($conf['metronome']['installed'] == true) { - swriteln('Configuring Metronome XMPP'); - $inst->configure_metronome('dont-create-certs'); - } - } - if($conf['services']['firewall'] && $inst->reconfigure_app('Firewall', $reconfigure_services_answer)) { if($conf['ufw']['installed'] == true) { //* Configure Ubuntu Firewall @@ -524,7 +503,16 @@ if ($inst->install_ispconfig_interface) { } } +// Create SSL certs for non-webserver(s)? +if(!file_exists('/usr/local/ispconfig/interface/ssl/ispserver.crt')) { + if(strtolower($inst->simple_query('Do you want to create SSL certs for your server?', array('y', 'n'), 'y')) == 'y') { + $inst->make_ispconfig_ssl_cert(); + } +} + +$inst->raiseEvent('install_ispconfig::before'); $inst->install_ispconfig(); +$inst->raiseEvent('install_ispconfig::after'); // Cleanup $inst->cleanup_ispconfig(); @@ -542,18 +530,10 @@ if($reconfigure_services_answer == 'yes') { if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); if($conf['services']['mail']) { if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); - if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); + if($conf['rspamd']['installed'] == true && $conf['rspamd']['init_script'] != '') system($inst->getinitcommand($conf['rspamd']['init_script'], 'restart')); if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); - if($conf['courier']['installed'] == true){ - if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); - if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); - if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); - if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); - if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); - } if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); - if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); } if($conf['services']['web'] || $inst->install_ispconfig_interface) { if($conf['webserver']['server_type'] == 'apache' && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); @@ -570,11 +550,7 @@ if($reconfigure_services_answer == 'yes') { if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null'); } - if($conf['services']['xmpp']) { - if($conf['metronome']['installed'] == true && $conf['metronome']['init_script'] != '') system($inst->getinitcommand($conf['metronome']['init_script'], 'restart').' &> /dev/null'); - } - - if($conf['services']['proxy']) { + if($conf['services']['proxy']) { // if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); } diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index b107ca3624e3f6548bb0b70f37e7da7397e0f282..0a624330e3caaacb6528efa029199f9fc42ab1ca 100755 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -62,7 +62,11 @@ class app { $this->_conf = $conf; if($this->_conf['start_db'] == true) { $this->load('db_'.$this->_conf['db_type']); - $this->db = new db; + try { + $this->db = new db; + } catch (Exception $e) { + $this->db = false; + } } //* Start the session @@ -191,14 +195,14 @@ class app { /* if (is_writable($this->_conf['log_file'])) { if (!$fp = fopen ($this->_conf['log_file'], 'a')) { - $this->error('Unable to open logfile.'); + $this->error('Unable to open logfile: ' . $this->_conf['log_file']); } if (!fwrite($fp, date('d.m.Y-H:i').' - '. $msg."\r\n")) { - $this->error('Unable to write to logfile.'); + $this->error('Unable to write to logfile: ' . $this->_conf['log_file']); } fclose($fp); } else { - $this->error('Unable to write to logfile.'); + $this->error('Unable to write to logfile: ' . $this->_conf['log_file']); } */ } diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php index 6658c4c116366177ca09aefb891885cf0ae7dfa2..0c891fc318ccf86242780acaad94529f474c5b94 100644 --- a/interface/lib/classes/auth.inc.php +++ b/interface/lib/classes/auth.inc.php @@ -188,6 +188,36 @@ class auth { } + /** + * Get the minimum password length. + */ + public function get_min_password_length() { + global $app; + $server_config_array = $app->getconf->get_global_config(); + $min_password_length = 8; + if(isset($server_config_array['misc']['min_password_length'])) $min_password_length = $server_config_array['misc']['min_password_length']; + return $min_password_length; + } + + /** + * Get the minimum password strength. + */ + public function get_min_password_strength() { + global $app; + $server_config_array = $app->getconf->get_global_config(); + $min_password_strength = 0; + if(isset($server_config_array['misc']['min_password_strength'])) $min_password_strength = $server_config_array['misc']['min_password_strength'];; + return $min_password_strength; + } + + /** + * Generate a ranmdom password. + * + * @param int $minLength + * Minimum number of characters. + * @param boolean $special + * Include special characters, like # and ! + */ public function get_random_password($minLength = 8, $special = false) { if($minLength < 8) $minLength = 8; $maxLength = $minLength + 5; diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php index cb4426a2e183a0ff2963e4b074b45028347641f3..dc3e9e837932041e60022e2828d660782e7a20b0 100644 --- a/interface/lib/classes/custom_datasource.inc.php +++ b/interface/lib/classes/custom_datasource.inc.php @@ -136,12 +136,6 @@ class custom_datasource { case 'default_dbserver': $field = 'db_server'; break; - case 'default_xmppserver': - $field = 'xmpp_server'; - break; - case 'default_vserverserver': - $field = 'vserver_server'; - break; case 'mail_servers': $field = 'mail_server'; break; @@ -154,9 +148,6 @@ class custom_datasource { case 'db_servers': $field = 'db_server'; break; - case 'xmpp_servers': - $field = 'xmpp_server'; - break; default: $field = 'web_server'; break; diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php index e3bf695dfcd8cc5b339131ed00f7ea6e5f7341fd..c4764cb5558539bed8e990b4418798ef24833d77 100644 --- a/interface/lib/classes/db_mysql.inc.php +++ b/interface/lib/classes/db_mysql.inc.php @@ -1,4 +1,12 @@ dbHost = $conf[$prefix.'db_host']; - $this->dbPort = $conf[$prefix.'db_port']; - $this->dbName = $conf[$prefix.'db_database']; - $this->dbUser = $conf[$prefix.'db_user']; - $this->dbPass = $conf[$prefix.'db_password']; - $this->dbCharset = $conf[$prefix.'db_charset']; - $this->dbNewLink = $conf[$prefix.'db_new_link']; - $this->dbClientFlags = $conf[$prefix.'db_client_flags']; + public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL, $flags = NULL) { + global $app, $conf; + + $this->dbHost = $host ? $host : $conf['db_host']; + $this->dbPort = $port ? $port : $conf['db_port']; + $this->dbName = $database ? $database : $conf['db_database']; + $this->dbUser = $user ? $user : $conf['db_user']; + $this->dbPass = $pass ? $pass : $conf['db_password']; + $this->dbCharset = $conf['db_charset']; + $this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags']; $this->_iConnId = mysqli_init(); mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags); - for($try=0;(!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5;++$try) { + for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) { sleep($try); - mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags); + if(!is_object($this->_iConnId)) { + $this->_iConnId = mysqli_init(); + } + if(!mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags)) { + $this->_sqlerror('Database connection failed'); + } } - if(!is_object($this->_iConnId) || mysqli_connect_error()) { + if(!is_object($this->_iConnId) || mysqli_connect_errno()) { $this->_iConnId = null; - $this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!'); - return false; + $this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!', '', true); // sets errorMessage + throw new Exception($this->errorMessage); } if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) { $this->close(); - $this->_sqlerror('Datenbank nicht gefunden / Database not found'); - return false; + $this->_sqlerror('Datenbank nicht gefunden / Database not found', '', true); // sets errorMessage + throw new Exception($this->errorMessage); } $this->_setCharset(); @@ -105,6 +116,23 @@ class db { $this->_iConnId = null; } + /* + * Test mysql connection. + * + * @return boolean returns true if db connection is good. + */ + public function testConnection() { + if(mysqli_connect_errno()) { + return false; + } + return (boolean)(is_object($this->_iConnId) && mysqli_ping($this->_iConnId)); + } + + /* This allows our private variables to be "read" out side of the class */ + public function __get($var) { + return isset($this->$var) ? $this->$var : NULL; + } + public function _build_query_string($sQuery = '') { $iArgs = func_num_args(); if($iArgs > 1) { @@ -127,7 +155,7 @@ class db { if($iPos2 !== false && ($iPos === false || $iPos2 <= $iPos)) { $sTxt = $this->escape($sValue); - + $sTxt = str_replace('`', '', $sTxt); if(strpos($sTxt, '.') !== false) { $sTxt = preg_replace('/^(.+)\.(.+)$/', '`$1`.`$2`', $sTxt); @@ -169,33 +197,33 @@ class db { /**#@+ - * @access private - */ + * @access private + */ private function _setCharset() { - mysqli_query($this->_iConnId, 'SET NAMES '.$this->dbCharset); - mysqli_query($this->_iConnId, "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'"); + $this->query('SET NAMES '.$this->dbCharset); + $this->query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'"); } - + private function securityScan($string) { global $app, $conf; - + // get security config if(isset($app)) { $app->uses('getconf'); $ids_config = $app->getconf->get_security_config('ids'); - + if($ids_config['sql_scan_enabled'] == 'yes') { - + // Remove whitespace $string = trim($string); if(substr($string,-1) == ';') $string = substr($string,0,-1); - + // Save original string $string_orig = $string; - + //echo $string; $chars = array(';', '#', '/*', '*/', '--', '\\\'', '\\"'); - + $string = str_replace('\\\\', '', $string); $string = preg_replace('/(^|[^\\\])([\'"])\\2/is', '$1', $string); $string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\])\\2/is', '$1', $string); @@ -239,14 +267,28 @@ class db { $try = 0; do { $try++; - $ok = mysqli_ping($this->_iConnId); + $ok = (is_object($this->_iConnId)) ? mysqli_ping($this->_iConnId) : false; if(!$ok) { - if(!mysqli_real_connect(mysqli_init(), $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort, NULL, $this->dbClientFlags)) { - if($try > 4) { - $this->_sqlerror('DB::query -> reconnect'); + if(!is_object($this->_iConnId)) { + $this->_iConnId = mysqli_init(); + } + if(!mysqli_real_connect($this->_isConnId, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort, NULL, $this->dbClientFlags)) { + if(mysqli_connect_errno() == '111') { + // server is not available + if($try > 9) { + if(isset($app) && isset($app->forceErrorExit)) { + $app->forceErrorExit('Database connection failure!'); + } + // if we reach this, the app object is missing or has no exit method, so we continue as normal + } + sleep(30); // additional seconds, please! + } + + if($try > 9) { + $this->_sqlerror('db::_query -> reconnect', '', true); return false; } else { - sleep(1); + sleep(($try > 7 ? 5 : 1)); } } else { $this->_setCharset(); @@ -258,7 +300,7 @@ class db { $aArgs = func_get_args(); $sQuery = call_user_func_array(array(&$this, '_build_query_string'), $aArgs); $this->securityScan($sQuery); - $this->_iQueryId = @mysqli_query($this->_iConnId, $sQuery); + $this->_iQueryId = mysqli_query($this->_iConnId, $sQuery); if (!$this->_iQueryId) { $this->_sqlerror('Falsche Anfrage / Wrong Query', 'SQL-Query = ' . $sQuery); return false; @@ -390,7 +432,7 @@ class db { } public function query_all_array($sQuery = '') { - return $this->queryAllArray($sQuery); + return call_user_func_array(array(&$this, 'queryAllArray'), func_get_args()); } @@ -404,13 +446,14 @@ class db { * @return int id of last inserted row or 0 if none */ public function insert_id() { - $iRes = mysqli_query($this->_iConnId, 'SELECT LAST_INSERT_ID() as `newid`'); - if(!is_object($iRes)) return false; - - $aReturn = mysqli_fetch_assoc($iRes); - mysqli_free_result($iRes); - - return $aReturn['newid']; + $oResult = $this->query('SELECT LAST_INSERT_ID() as `newid`'); + if(!$oResult) { + $this->_sqlerror('Unable to select last_insert_id()'); + return false; + } + $aReturn = $oResult->get(); + $oResult->free(); + return isset($aReturn['newid']) ? $aReturn['newid'] : 0; } @@ -431,6 +474,7 @@ class db { } + /** * check if a utf8 string is valid * @@ -470,7 +514,7 @@ class db { public function escape($sString) { global $app; if(!is_string($sString) && !is_numeric($sString)) { - $app->log('NON-String given in escape function! (' . gettype($sString) . ')', LOGLEVEL_DEBUG); + $app->log('NON-String given in escape function! (' . gettype($sString) . ')', LOGLEVEL_INFO); //$sAddMsg = getDebugBacktrace(); $app->log($sAddMsg, LOGLEVEL_DEBUG); $sString = ''; @@ -479,7 +523,7 @@ class db { $cur_encoding = mb_detect_encoding($sString); if($cur_encoding != "UTF-8") { if($cur_encoding != 'ASCII') { - if(is_object($app) && method_exists($app, 'log')) $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_DEBUG); + if(is_object($app) && method_exists($app, 'log')) $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO); if($cur_encoding) $sString = mb_convert_encoding($sString, 'UTF-8', $cur_encoding); else $sString = mb_convert_encoding($sString, 'UTF-8'); } @@ -496,20 +540,27 @@ class db { * * @access private */ - private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '') { + private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '', $bNoLog = false) { global $app, $conf; - $mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error()); - $mysql_errno = (is_object($this->_iConnId) ? mysqli_errno($this->_iConnId) : mysqli_connect_errno()); + $mysql_errno = mysqli_connect_errno(); + $mysql_error = mysqli_connect_error(); + if ($mysql_errno === 0 && is_object($this->_iConnId)) { + $mysql_errno = mysqli_errno($this->_iConnId); + $mysql_error = mysqli_error($this->_iConnId); + } + $this->errorNumber = $mysql_error; $this->errorMessage = $mysql_error; //$sAddMsg .= getDebugBacktrace(); if($this->show_error_messages && $conf['demo_mode'] === false) { echo $sErrormsg . $sAddMsg; - } else if(is_object($app) && method_exists($app, 'log')) { - $app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN); - } + } elseif(is_object($app) && method_exists($app, 'log') && $bNoLog == false) { + $app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN, false); + } elseif(php_sapi_name() == 'cli') { + echo $sErrormsg . $sAddMsg; + } } public function affectedRows() { @@ -541,27 +592,27 @@ class db { } return $out; } - + public function insertFromArray($tablename, $data) { if(!is_array($data)) return false; - + $k_query = ''; $v_query = ''; - + $params = array($tablename); $v_params = array(); - + foreach($data as $key => $value) { $k_query .= ($k_query != '' ? ', ' : '') . '??'; $v_query .= ($v_query != '' ? ', ' : '') . '?'; $params[] = $key; $v_params[] = $value; } - + $query = 'INSERT INTO ?? (' . $k_query . ') VALUES (' . $v_query . ')'; return $this->query($query, true, array_merge($params, $v_params)); } - + public function diffrec($record_old, $record_new) { $diffrec_full = array(); $diff_num = 0; @@ -597,15 +648,47 @@ class db { } + /** + * Function to get the database-size + * @param string $database_name + * @return int - database-size in bytes + */ + public function getDatabaseSize($database_name) { + global $app, $conf; + static $db=null; + + if ( ! $db ) { + $clientdb_host = ($conf['db_host']) ? $conf['db_host'] : NULL; + $clientdb_user = ($conf['db_user']) ? $conf['db_user'] : NULL; + $clientdb_password = ($conf['db_password']) ? $conf['db_password'] : NULL; + $clientdb_port = ((int)$conf['db_port']) ? (int)$conf['db_port'] : NULL; + $clientdb_flags = ($conf['db_flags'] !== NULL) ? $conf['db_flags'] : NULL; + + require_once 'lib/mysql_clientdb.conf'; + + $db = new db($clientdb_host, $clientdb_user, $clientdb_password, NULL, $clientdb_port, $clientdb_flags); + } + + $result = $db->_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$db->escape($database_name)."'"); + if(!$result) { + $db->_sqlerror('Unable to determine the size of database ' . $database_name); + return; + } + $database_size = $result->getAsRow(); + $result->free(); + return $database_size[0] ? $database_size[0] : 0; + } + //** Function to fill the datalog with a full differential record. public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) { - global $app, $conf; + global $app; - // Check fields - if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$db_table)) $app->error('Invalid table name '.$db_table); - if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$primary_field)) $app->error('Invalid primary field '.$primary_field.' in table '.$db_table); - - $primary_id = intval($primary_id); + // Insert backticks only for incomplete table names. + if(stristr($db_table, '.')) { + $escape = ''; + } else { + $escape = '`'; + } if($force_update == true) { //* We force a update even if no record has changed @@ -625,18 +708,19 @@ class db { if($diff_num > 0) { - //print_r($diff_num); - //print_r($diffrec_full); $diffstr = serialize($diffrec_full); - $username = $_SESSION['s']['user']['username']; + if(isset($_SESSION)) { + $username = $_SESSION['s']['user']['username']; + } else { + $username = 'admin'; + } $dbidx = $primary_field.':'.$primary_id; - if(trim($username) == '') $username = 'none'; if($action == 'INSERT') $action = 'i'; if($action == 'UPDATE') $action = 'u'; if($action == 'DELETE') $action = 'd'; - $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES (?, ?, ?, ?, ?, ?, ?)"; - $app->db->query($sql, $db_table, $dbidx, $server_id, $action, time(), $username, $diffstr); + $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data,session_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + $app->db->query($sql, $db_table, $dbidx, $server_id, $action, time(), $username, $diffstr, session_id()); } return true; @@ -645,11 +729,11 @@ class db { //** Inserts a record and saves the changes into the datalog public function datalogInsert($tablename, $insert_data, $index_field) { global $app; - + // Check fields if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); - + if(is_array($insert_data)) { $key_str = ''; $val_str = ''; @@ -675,6 +759,9 @@ class db { $old_rec = array(); $index_value = $this->insertID(); + if(!$index_value && isset($insert_data[$index_field])) { + $index_value = $insert_data[$index_field]; + } $new_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec); @@ -688,7 +775,7 @@ class db { // Check fields if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); - + $old_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); if(is_array($update_data)) { @@ -723,7 +810,7 @@ class db { // Check fields if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); - + $old_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $this->query("DELETE FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $new_rec = array(); @@ -732,13 +819,20 @@ class db { return true; } + //** Deletes a record and saves the changes into the datalog + public function datalogError($errormsg) { + global $app; + + if(isset($app->modules->current_datalog_id) && $app->modules->current_datalog_id > 0) $this->query("UPDATE sys_datalog set error = ? WHERE datalog_id = ?", $errormsg, $app->modules->current_datalog_id); + + return true; + } + //* get the current datalog status for the specified login (or currently logged in user) public function datalogStatus($login = '') { global $app; $return = array('count' => 0, 'entries' => array()); - //if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users - // removed in favor of new non intrusive datalogstatus notification header if($login == '' && isset($_SESSION['s']['user'])) { $login = $_SESSION['s']['user']['username']; @@ -747,14 +841,24 @@ class db { $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = ? AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action", $login); foreach($result as $row) { if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come - $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable'])); - $return['count'] += $row['cnt']; + $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable'])); $return['count'] += $row['cnt']; } unset($result); return $return; } + + public function freeResult($query) + { + if(is_object($query) && (get_class($query) == "mysqli_result")) { + $query->free(); + return true; + } else { + return false; + } + } + /* $columns = array(action => add | alter | drop name => Spaltenname @@ -879,15 +983,6 @@ class db { if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM ??', $table_name)){ foreach($rows as $row) { - /* - $name = $row[0]; - $default = $row[4]; - $key = $row[3]; - $extra = $row[5]; - $isnull = $row[2]; - $type = $row[1]; - */ - $name = $row['Field']; $default = $row['Default']; $key = $row['Key']; @@ -988,7 +1083,7 @@ class db { return 'char'; break; case 'varchar': - if($typeValue < 1) die('Database failure: Lenght required for these data types.'); + if($typeValue < 1) die('Database failure: Length required for these data types.'); return 'varchar('.$typeValue.')'; break; case 'text': diff --git a/interface/lib/classes/finediff.inc.php b/interface/lib/classes/finediff.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..43b542f3629ec5ce14741267a0cdf991865bd193 --- /dev/null +++ b/interface/lib/classes/finediff.inc.php @@ -0,0 +1,752 @@ +copy->insert +* command (swap) for when the inserted segment is exactly the same +* as the deleted one, and with only a copy operation in between. +* TODO: How often this case occurs? Is it worth it? Can only +* be done as a postprocessing method (->optimize()?) +*/ +abstract class FineDiffOp { + abstract public function getFromLen(); + abstract public function getToLen(); + abstract public function getOpcode(); + } + +class FineDiffDeleteOp extends FineDiffOp { + public function __construct($len) { + $this->fromLen = $len; + } + public function getFromLen() { + return $this->fromLen; + } + public function getToLen() { + return 0; + } + public function getOpcode() { + if ( $this->fromLen === 1 ) { + return 'd'; + } + return "d{$this->fromLen}"; + } + } + +class FineDiffInsertOp extends FineDiffOp { + public function __construct($text) { + $this->text = $text; + } + public function getFromLen() { + return 0; + } + public function getToLen() { + return strlen($this->text); + } + public function getText() { + return $this->text; + } + public function getOpcode() { + $to_len = strlen($this->text); + if ( $to_len === 1 ) { + return "i:{$this->text}"; + } + return "i{$to_len}:{$this->text}"; + } + } + +class FineDiffReplaceOp extends FineDiffOp { + public function __construct($fromLen, $text) { + $this->fromLen = $fromLen; + $this->text = $text; + } + public function getFromLen() { + return $this->fromLen; + } + public function getToLen() { + return strlen($this->text); + } + public function getText() { + return $this->text; + } + public function getOpcode() { + if ( $this->fromLen === 1 ) { + $del_opcode = 'd'; + } + else { + $del_opcode = "d{$this->fromLen}"; + } + $to_len = strlen($this->text); + if ( $to_len === 1 ) { + return "{$del_opcode}i:{$this->text}"; + } + return "{$del_opcode}i{$to_len}:{$this->text}"; + } + } + +class FineDiffCopyOp extends FineDiffOp { + public function __construct($len) { + $this->len = $len; + } + public function getFromLen() { + return $this->len; + } + public function getToLen() { + return $this->len; + } + public function getOpcode() { + if ( $this->len === 1 ) { + return 'c'; + } + return "c{$this->len}"; + } + public function increase($size) { + return $this->len += $size; + } + } + +/** +* FineDiff ops +* +* Collection of ops +*/ +class FineDiffOps { + public function appendOpcode($opcode, $from, $from_offset, $from_len) { + if ( $opcode === 'c' ) { + $edits[] = new FineDiffCopyOp($from_len); + } + else if ( $opcode === 'd' ) { + $edits[] = new FineDiffDeleteOp($from_len); + } + else /* if ( $opcode === 'i' ) */ { + $edits[] = new FineDiffInsertOp(substr($from, $from_offset, $from_len)); + } + } + public $edits = array(); + } + +/** +* FineDiff class +* +* TODO: Document +* +*/ +class FineDiff { + + /**------------------------------------------------------------------------ + * + * Public section + * + */ + + /** + * Constructor + * ... + * The $granularityStack allows FineDiff to be configurable so that + * a particular stack tailored to the specific content of a document can + * be passed. + */ + public function __construct($from_text = '', $to_text = '', $granularityStack = null) { + // setup stack for generic text documents by default + $this->granularityStack = $granularityStack ? $granularityStack : FineDiff::$characterGranularity; + $this->edits = array(); + $this->from_text = $from_text; + $this->doDiff($from_text, $to_text); + } + + public function getOps() { + return $this->edits; + } + + public function getOpcodes() { + $opcodes = array(); + foreach ( $this->edits as $edit ) { + $opcodes[] = $edit->getOpcode(); + } + return implode('', $opcodes); + } + + public function renderDiffToHTML() { + $in_offset = 0; + ob_start(); + foreach ( $this->edits as $edit ) { + $n = $edit->getFromLen(); + if ( $edit instanceof FineDiffCopyOp ) { + FineDiff::renderDiffToHTMLFromOpcode('c', $this->from_text, $in_offset, $n); + } + else if ( $edit instanceof FineDiffDeleteOp ) { + FineDiff::renderDiffToHTMLFromOpcode('d', $this->from_text, $in_offset, $n); + } + else if ( $edit instanceof FineDiffInsertOp ) { + FineDiff::renderDiffToHTMLFromOpcode('i', $edit->getText(), 0, $edit->getToLen()); + } + else /* if ( $edit instanceof FineDiffReplaceOp ) */ { + FineDiff::renderDiffToHTMLFromOpcode('d', $this->from_text, $in_offset, $n); + FineDiff::renderDiffToHTMLFromOpcode('i', $edit->getText(), 0, $edit->getToLen()); + } + $in_offset += $n; + } + return ob_get_clean(); + } + + /**------------------------------------------------------------------------ + * Return an opcodes string describing the diff between a "From" and a + * "To" string + */ + public static function getDiffOpcodes($from, $to, $granularities = null) { + $diff = new FineDiff($from, $to, $granularities); + return $diff->getOpcodes(); + } + + /**------------------------------------------------------------------------ + * Return an iterable collection of diff ops from an opcodes string + */ + public static function getDiffOpsFromOpcodes($opcodes) { + $diffops = new FineDiffOps(); + FineDiff::renderFromOpcodes(null, $opcodes, array($diffops,'appendOpcode')); + return $diffops->edits; + } + + /**------------------------------------------------------------------------ + * Re-create the "To" string from the "From" string and an "Opcodes" string + */ + public static function renderToTextFromOpcodes($from, $opcodes) { + ob_start(); + FineDiff::renderFromOpcodes($from, $opcodes, array('FineDiff','renderToTextFromOpcode')); + return ob_get_clean(); + } + + /**------------------------------------------------------------------------ + * Render the diff to an HTML string -- UTF8 unsafe + */ + public static function renderDiffToHTMLFromOpcodes($from, $opcodes) { + ob_start(); + FineDiff::renderFromOpcodes($from, $opcodes, array('FineDiff','renderDiffToHTMLFromOpcode')); + return ob_get_clean(); + } + + /**------------------------------------------------------------------------ + * Render the diff to an HTML string -- UTF8 safe + */ + public static function renderUTF8DiffToHTMLFromOpcodes($from, $opcodes) { + ob_start(); + FineDiff::renderUTF8FromOpcode($from, $opcodes, array('FineDiff','renderDiffToHTMLFromOpcode')); + return ob_get_clean(); + } + + /**------------------------------------------------------------------------ + * Generic opcodes parser, user must supply callback for handling + * single opcode + */ + public static function renderFromOpcodes($from, $opcodes, $callback) { + if ( !is_callable($callback) ) { + return; + } + $opcodes_len = strlen($opcodes); + $from_offset = $opcodes_offset = 0; + while ( $opcodes_offset < $opcodes_len ) { + $opcode = substr($opcodes, $opcodes_offset, 1); + $opcodes_offset++; + $n = intval(substr($opcodes, $opcodes_offset)); + if ( $n ) { + $opcodes_offset += strlen(strval($n)); + } + else { + $n = 1; + } + if ( $opcode === 'c' ) { // copy n characters from source + call_user_func($callback, 'c', $from, $from_offset, $n, ''); + $from_offset += $n; + } + else if ( $opcode === 'd' ) { // delete n characters from source + call_user_func($callback, 'd', $from, $from_offset, $n, ''); + $from_offset += $n; + } + else /* if ( $opcode === 'i' ) */ { // insert n characters from opcodes + call_user_func($callback, 'i', $opcodes, $opcodes_offset + 1, $n); + $opcodes_offset += 1 + $n; + } + } + } + + /**------------------------------------------------------------------------ + * Generic opcodes parser, user must supply callback for handling + * single opcode + */ + private static function renderUTF8FromOpcode($from, $opcodes, $callback) { + if ( !is_callable($callback) ) { + return; + } + $from_len = strlen($from); + $opcodes_len = strlen($opcodes); + $from_offset = $opcodes_offset = 0; + $last_to_chars = ''; + while ( $opcodes_offset < $opcodes_len ) { + $opcode = substr($opcodes, $opcodes_offset, 1); + $opcodes_offset++; + $n = intval(substr($opcodes, $opcodes_offset)); + if ( $n ) { + $opcodes_offset += strlen(strval($n)); + } + else { + $n = 1; + } + if ( $opcode === 'c' || $opcode === 'd' ) { + $beg = $from_offset; + $end = $from_offset + $n; + while ( $beg > 0 && (ord($from[$beg]) & 0xC0) === 0x80 ) { $beg--; } + while ( $end < $from_len && (ord($from[$end]) & 0xC0) === 0x80 ) { $end++; } + if ( $opcode === 'c' ) { // copy n characters from source + call_user_func($callback, 'c', $from, $beg, $end - $beg, ''); + $last_to_chars = substr($from, $beg, $end - $beg); + } + else /* if ( $opcode === 'd' ) */ { // delete n characters from source + call_user_func($callback, 'd', $from, $beg, $end - $beg, ''); + } + $from_offset += $n; + } + else /* if ( $opcode === 'i' ) */ { // insert n characters from opcodes + $opcodes_offset += 1; + if ( strlen($last_to_chars) > 0 && (ord($opcodes[$opcodes_offset]) & 0xC0) === 0x80 ) { + $beg = strlen($last_to_chars) - 1; + while ( $beg > 0 && (ord($last_to_chars[$beg]) & 0xC0) === 0x80 ) { $beg--; } + $prefix = substr($last_to_chars, $beg); + } else { + $prefix = ''; + } + $end = $from_offset; + while ( $end < $from_len && (ord($from[$end]) & 0xC0) === 0x80 ) { $end++; } + $toInsert = $prefix . substr($opcodes, $opcodes_offset, $n) . substr($from, $end, $end - $from_offset); + call_user_func($callback, 'i', $toInsert, 0, strlen($toInsert)); + $opcodes_offset += $n; + $last_to_chars = $toInsert; + } + } + } + + /** + * Stock granularity stacks and delimiters + */ + + const paragraphDelimiters = "\n\r"; + public static $paragraphGranularity = array( + FineDiff::paragraphDelimiters + ); + const sentenceDelimiters = ".\n\r"; + public static $sentenceGranularity = array( + FineDiff::paragraphDelimiters, + FineDiff::sentenceDelimiters + ); + const wordDelimiters = " \t.\n\r"; + public static $wordGranularity = array( + FineDiff::paragraphDelimiters, + FineDiff::sentenceDelimiters, + FineDiff::wordDelimiters + ); + const characterDelimiters = ""; + public static $characterGranularity = array( + FineDiff::paragraphDelimiters, + FineDiff::sentenceDelimiters, + FineDiff::wordDelimiters, + FineDiff::characterDelimiters + ); + + public static $textStack = array( + ".", + " \t.\n\r", + "" + ); + + /**------------------------------------------------------------------------ + * + * Private section + * + */ + + /** + * Entry point to compute the diff. + */ + private function doDiff($from_text, $to_text) { + $this->last_edit = false; + $this->stackpointer = 0; + $this->from_text = $from_text; + $this->from_offset = 0; + // can't diff without at least one granularity specifier + if ( empty($this->granularityStack) ) { + return; + } + $this->_processGranularity($from_text, $to_text); + } + + /** + * This is the recursive function which is responsible for + * handling/increasing granularity. + * + * Incrementally increasing the granularity is key to compute the + * overall diff in a very efficient way. + */ + private function _processGranularity($from_segment, $to_segment) { + $delimiters = $this->granularityStack[$this->stackpointer++]; + $has_next_stage = $this->stackpointer < count($this->granularityStack); + foreach ( FineDiff::doFragmentDiff($from_segment, $to_segment, $delimiters) as $fragment_edit ) { + // increase granularity + if ( $fragment_edit instanceof FineDiffReplaceOp && $has_next_stage ) { + $this->_processGranularity( + substr($this->from_text, $this->from_offset, $fragment_edit->getFromLen()), + $fragment_edit->getText() + ); + } + // fuse copy ops whenever possible + else if ( $fragment_edit instanceof FineDiffCopyOp && $this->last_edit instanceof FineDiffCopyOp ) { + $this->edits[count($this->edits)-1]->increase($fragment_edit->getFromLen()); + $this->from_offset += $fragment_edit->getFromLen(); + } + else { + /* $fragment_edit instanceof FineDiffCopyOp */ + /* $fragment_edit instanceof FineDiffDeleteOp */ + /* $fragment_edit instanceof FineDiffInsertOp */ + $this->edits[] = $this->last_edit = $fragment_edit; + $this->from_offset += $fragment_edit->getFromLen(); + } + } + $this->stackpointer--; + } + + /** + * This is the core algorithm which actually perform the diff itself, + * fragmenting the strings as per specified delimiters. + * + * This function is naturally recursive, however for performance purpose + * a local job queue is used instead of outright recursivity. + */ + private static function doFragmentDiff($from_text, $to_text, $delimiters) { + // Empty delimiter means character-level diffing. + // In such case, use code path optimized for character-level + // diffing. + if ( empty($delimiters) ) { + return FineDiff::doCharDiff($from_text, $to_text); + } + + $result = array(); + + // fragment-level diffing + $from_text_len = strlen($from_text); + $to_text_len = strlen($to_text); + $from_fragments = FineDiff::extractFragments($from_text, $delimiters); + $to_fragments = FineDiff::extractFragments($to_text, $delimiters); + + $jobs = array(array(0, $from_text_len, 0, $to_text_len)); + + $cached_array_keys = array(); + + while ( $job = array_pop($jobs) ) { + + // get the segments which must be diff'ed + list($from_segment_start, $from_segment_end, $to_segment_start, $to_segment_end) = $job; + + // catch easy cases first + $from_segment_length = $from_segment_end - $from_segment_start; + $to_segment_length = $to_segment_end - $to_segment_start; + if ( !$from_segment_length || !$to_segment_length ) { + if ( $from_segment_length ) { + $result[$from_segment_start * 4] = new FineDiffDeleteOp($from_segment_length); + } + else if ( $to_segment_length ) { + $result[$from_segment_start * 4 + 1] = new FineDiffInsertOp(substr($to_text, $to_segment_start, $to_segment_length)); + } + continue; + } + + // find longest copy operation for the current segments + $best_copy_length = 0; + + $from_base_fragment_index = $from_segment_start; + + $cached_array_keys_for_current_segment = array(); + + while ( $from_base_fragment_index < $from_segment_end ) { + $from_base_fragment = $from_fragments[$from_base_fragment_index]; + $from_base_fragment_length = strlen($from_base_fragment); + // performance boost: cache array keys + if ( !isset($cached_array_keys_for_current_segment[$from_base_fragment]) ) { + if ( !isset($cached_array_keys[$from_base_fragment]) ) { + $to_all_fragment_indices = $cached_array_keys[$from_base_fragment] = array_keys($to_fragments, $from_base_fragment, true); + } + else { + $to_all_fragment_indices = $cached_array_keys[$from_base_fragment]; + } + // get only indices which falls within current segment + if ( $to_segment_start > 0 || $to_segment_end < $to_text_len ) { + $to_fragment_indices = array(); + foreach ( $to_all_fragment_indices as $to_fragment_index ) { + if ( $to_fragment_index < $to_segment_start ) { continue; } + if ( $to_fragment_index >= $to_segment_end ) { break; } + $to_fragment_indices[] = $to_fragment_index; + } + $cached_array_keys_for_current_segment[$from_base_fragment] = $to_fragment_indices; + } + else { + $to_fragment_indices = $to_all_fragment_indices; + } + } + else { + $to_fragment_indices = $cached_array_keys_for_current_segment[$from_base_fragment]; + } + // iterate through collected indices + foreach ( $to_fragment_indices as $to_base_fragment_index ) { + $fragment_index_offset = $from_base_fragment_length; + // iterate until no more match + for (;;) { + $fragment_from_index = $from_base_fragment_index + $fragment_index_offset; + if ( $fragment_from_index >= $from_segment_end ) { + break; + } + $fragment_to_index = $to_base_fragment_index + $fragment_index_offset; + if ( $fragment_to_index >= $to_segment_end ) { + break; + } + if ( $from_fragments[$fragment_from_index] !== $to_fragments[$fragment_to_index] ) { + break; + } + $fragment_length = strlen($from_fragments[$fragment_from_index]); + $fragment_index_offset += $fragment_length; + } + if ( $fragment_index_offset > $best_copy_length ) { + $best_copy_length = $fragment_index_offset; + $best_from_start = $from_base_fragment_index; + $best_to_start = $to_base_fragment_index; + } + } + $from_base_fragment_index += strlen($from_base_fragment); + // If match is larger than half segment size, no point trying to find better + // TODO: Really? + if ( $best_copy_length >= $from_segment_length / 2) { + break; + } + // no point to keep looking if what is left is less than + // current best match + if ( $from_base_fragment_index + $best_copy_length >= $from_segment_end ) { + break; + } + } + + if ( $best_copy_length ) { + $jobs[] = array($from_segment_start, $best_from_start, $to_segment_start, $best_to_start); + $result[$best_from_start * 4 + 2] = new FineDiffCopyOp($best_copy_length); + $jobs[] = array($best_from_start + $best_copy_length, $from_segment_end, $best_to_start + $best_copy_length, $to_segment_end); + } + else { + $result[$from_segment_start * 4 ] = new FineDiffReplaceOp($from_segment_length, substr($to_text, $to_segment_start, $to_segment_length)); + } + } + + ksort($result, SORT_NUMERIC); + return array_values($result); + } + + /** + * Perform a character-level diff. + * + * The algorithm is quite similar to doFragmentDiff(), except that + * the code path is optimized for character-level diff -- strpos() is + * used to find out the longest common subequence of characters. + * + * We try to find a match using the longest possible subsequence, which + * is at most the length of the shortest of the two strings, then incrementally + * reduce the size until a match is found. + * + * I still need to study more the performance of this function. It + * appears that for long strings, the generic doFragmentDiff() is more + * performant. For word-sized strings, doCharDiff() is somewhat more + * performant. + */ + private static function doCharDiff($from_text, $to_text) { + $result = array(); + $jobs = array(array(0, strlen($from_text), 0, strlen($to_text))); + while ( $job = array_pop($jobs) ) { + // get the segments which must be diff'ed + list($from_segment_start, $from_segment_end, $to_segment_start, $to_segment_end) = $job; + $from_segment_len = $from_segment_end - $from_segment_start; + $to_segment_len = $to_segment_end - $to_segment_start; + + // catch easy cases first + if ( !$from_segment_len || !$to_segment_len ) { + if ( $from_segment_len ) { + $result[$from_segment_start * 4 + 0] = new FineDiffDeleteOp($from_segment_len); + } + else if ( $to_segment_len ) { + $result[$from_segment_start * 4 + 1] = new FineDiffInsertOp(substr($to_text, $to_segment_start, $to_segment_len)); + } + continue; + } + if ( $from_segment_len >= $to_segment_len ) { + $copy_len = $to_segment_len; + while ( $copy_len ) { + $to_copy_start = $to_segment_start; + $to_copy_start_max = $to_segment_end - $copy_len; + while ( $to_copy_start <= $to_copy_start_max ) { + $from_copy_start = strpos(substr($from_text, $from_segment_start, $from_segment_len), substr($to_text, $to_copy_start, $copy_len)); + if ( $from_copy_start !== false ) { + $from_copy_start += $from_segment_start; + break 2; + } + $to_copy_start++; + } + $copy_len--; + } + } + else { + $copy_len = $from_segment_len; + while ( $copy_len ) { + $from_copy_start = $from_segment_start; + $from_copy_start_max = $from_segment_end - $copy_len; + while ( $from_copy_start <= $from_copy_start_max ) { + $to_copy_start = strpos(substr($to_text, $to_segment_start, $to_segment_len), substr($from_text, $from_copy_start, $copy_len)); + if ( $to_copy_start !== false ) { + $to_copy_start += $to_segment_start; + break 2; + } + $from_copy_start++; + } + $copy_len--; + } + } + // match found + if ( $copy_len ) { + $jobs[] = array($from_segment_start, $from_copy_start, $to_segment_start, $to_copy_start); + $result[$from_copy_start * 4 + 2] = new FineDiffCopyOp($copy_len); + $jobs[] = array($from_copy_start + $copy_len, $from_segment_end, $to_copy_start + $copy_len, $to_segment_end); + } + // no match, so delete all, insert all + else { + $result[$from_segment_start * 4] = new FineDiffReplaceOp($from_segment_len, substr($to_text, $to_segment_start, $to_segment_len)); + } + } + ksort($result, SORT_NUMERIC); + return array_values($result); + } + + /** + * Efficiently fragment the text into an array according to + * specified delimiters. + * No delimiters means fragment into single character. + * The array indices are the offset of the fragments into + * the input string. + * A sentinel empty fragment is always added at the end. + * Careful: No check is performed as to the validity of the + * delimiters. + */ + private static function extractFragments($text, $delimiters) { + // special case: split into characters + if ( empty($delimiters) ) { + $chars = str_split($text, 1); + $chars[strlen($text)] = ''; + return $chars; + } + $fragments = array(); + $start = $end = 0; + for (;;) { + $end += strcspn($text, $delimiters, $end); + $end += strspn($text, $delimiters, $end); + if ( $end === $start ) { + break; + } + $fragments[$start] = substr($text, $start, $end - $start); + $start = $end; + } + $fragments[$start] = ''; + return $fragments; + } + + /** + * Stock opcode renderers + */ + private static function renderToTextFromOpcode($opcode, $from, $from_offset, $from_len) { + if ( $opcode === 'c' || $opcode === 'i' ) { + echo substr($from, $from_offset, $from_len); + } + } + + private static function renderDiffToHTMLFromOpcode($opcode, $from, $from_offset, $from_len) { + if ( $opcode === 'c' ) { + echo htmlspecialchars(substr($from, $from_offset, $from_len)); + } + else if ( $opcode === 'd' ) { + $deletion = substr($from, $from_offset, $from_len); + if ( strcspn($deletion, " \n\r") === 0 ) { + $deletion = str_replace(array("\n","\r"), array('\n','\r'), $deletion); + } + echo '', htmlspecialchars($deletion), ''; + } + else /* if ( $opcode === 'i' ) */ { + echo '', htmlspecialchars(substr($from, $from_offset, $from_len)), ''; + } + } + } + diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php index 3ee0556226758989ce3b21c48af98767f370e8c6..25e8b4aa222fd74da940780865aba9ac4734b39a 100644 --- a/interface/lib/classes/functions.inc.php +++ b/interface/lib/classes/functions.inc.php @@ -232,12 +232,6 @@ class functions { } } - $results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM openvz_ip"); - if(!empty($results) && is_array($results)){ - foreach($results as $result){ - if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; - } - } $results = $groupid != 1 ? $app->db->queryAllRecords("SELECT rr.data AS server_ip, rr.name as server_name, soa.origin as domain FROM dns_rr as rr, dns_soa as soa WHERE (rr.type = 'A' OR rr.type = 'AAAA') AND soa.id = rr.zone AND rr.sys_groupid = ?", $groupid) : $results = $app->db->queryAllRecords("SELECT rr.data AS server_ip, rr.name as server_name, soa.origin as domain FROM dns_rr as rr, dns_soa as soa WHERE (rr.type = 'A' OR rr.type = 'AAAA') AND soa.id = rr.zone"); if(!empty($results) && is_array($results)){ @@ -259,6 +253,12 @@ class functions { } } } + + $tmp_ips = $app->plugin->raiseEvent('get_server_ips', 0, true); + if(is_array($tmp_ips) && !empty($tmp_ips)) { + $ips = array_merge($ips, $tmp_ips); + } + $results = $groupid != 1 ? $app->db->queryAllRecords("SELECT database_name as name,remote_ips as ip FROM web_database WHERE remote_ips != '' AND sys_groupid = ?", $groupid) : $results = $app->db->queryAllRecords("SELECT database_name as name,remote_ips as ip FROM web_database WHERE remote_ips != ''"); @@ -513,6 +513,29 @@ class functions { return $out; } + + // Function to check paths before we use it as include. Use with absolute paths only. + public function check_include_path($path) { + if(strpos($path,'//') !== false) die('Include path seems to be an URL: '.$this->htmlentities($path)); + if(strpos($path,'..') !== false) die('Two dots are not allowed in include path: '.$this->htmlentities($path)); + if(!preg_match("/^[a-zA-Z0-9_\/\.\-]+$/", $path)) die('Wrong chars in include path: '.$this->htmlentities($path)); + $path = realpath($path); + if($path == '') die('Include path does not exist.'); + if(substr($path,0,strlen(ISPC_ROOT_PATH)) != ISPC_ROOT_PATH) die('Path '.$this->htmlentities($path).' is outside of ISPConfig installation directory.'); + return $path; + } + + // Function to check language strings + public function check_language($language) { + global $app; + if(preg_match('/^[a-z]{2}$/',$language)) { + return $language; + } else { + $app->log('Wrong language string: '.$this->htmlentities($language),1); + return 'en'; + } + } + } ?> diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php index b818e1e44a6732db717bee6560001a6ebba9ef35..dfe27edca6296b0cd58074cfabfc3616ae6fb484 100644 --- a/interface/lib/classes/ispcmail.inc.php +++ b/interface/lib/classes/ispcmail.inc.php @@ -430,6 +430,9 @@ class ispcmail { if($text == true && $html == false && $attach == false) { // only text $content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"'; + if($this->mail_charset == 'UTF-8') { + $this->headers['Content-Transfer-Encoding'] = '8bit'; + } $textonly = true; } elseif($text == true && $html == false && $attach == true) { // text and attachment @@ -440,6 +443,9 @@ class ispcmail { } elseif($html == true && $text == false && $attach == false) { // html only (or text too) $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; + if($this->mail_charset == 'UTF-8') { + $this->headers['Content-Transfer-Encoding'] = '8bit'; + } $htmlonly = true; } elseif($html == true && $attach == true) { // html and attachments @@ -564,17 +570,14 @@ class ispcmail { * @access private */ private function _encodeSubject($input, $charset = 'ISO-8859-1') { - /* - if($charset == 'UTF-8' && function_exists('imap_8bit')) { - $input = "=?utf-8?Q?" . imap_8bit($input) . "?="; - } else { - preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches); - foreach ($matches[1] as $value) { - $replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value); - $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input); + if(preg_match('/(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})/s', $input)) { + // needs encoding + if(function_exists('imap_8bit')) { + $input = "=?utf-8?Q?" . str_replace("?","=3F", imap_8bit($input)) . "?="; + } else { + $input = '=?utf-8?B?' . base64_encode($input) . '?='; } - }*/ - $input='=?UTF-8?B?'.base64_encode($input).'?='; + } return $input; } @@ -744,32 +747,22 @@ class ispcmail { } if($this->use_smtp == true) { - if(!$this->_logged_in || !$this->_smtp_conn) { - $result = $this->_smtp_login(); - if(!$result) return false; - } $bcc_cc_sent = false; foreach($recipients as $recipname => $recip) { - if($this->_sent_mails >= $this->smtp_max_mails) { - // close connection to smtp and reconnect - $this->_sent_mails = 0; - $this->_smtp_close(); - $result = $this->_smtp_login(); - if(!$result) return false; - } - $this->_sent_mails += 1; + // Build mail headers, content etc. + + $m_recipients = array(); + $m_mail_content = ''; $recipname = trim(str_replace('"', '', $recipname)); $recip = $this->_encodeHeader($recip, $this->mail_charset); $recipname = $this->_encodeHeader($recipname, $this->mail_charset); //Email From - fputs($this->_smtp_conn, 'MAIL FROM: <' . $this->_mail_sender . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_from = $this->_mail_sender; //Email To - fputs($this->_smtp_conn, 'RCPT TO: <' . $recip . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_recipients[] = $recip; if($bcc_cc_sent == false) { $add_recips = array(); @@ -777,17 +770,12 @@ class ispcmail { if($this->getHeader('Bcc') != '') $add_recips = array_merge($add_recips, $this->_extract_names($this->getHeader('Bcc'))); foreach($add_recips as $add_recip) { if(!$add_recip['mail']) continue; - fputs($this->_smtp_conn, 'RCPT TO: <' . $this->_encodeHeader($add_recip['mail'], $this->mail_charset) . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_recipients[] = $this->_encodeHeader($add_recip['mail'], $this->mail_charset); } unset($add_recips); $bcc_cc_sent = true; } - //The Email - fputs($this->_smtp_conn, 'DATA' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); - //Construct Headers if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>'); else $this->setHeader('To', $recip); @@ -797,10 +785,32 @@ class ispcmail { if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf; $mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body; - fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_mail_content = $mail_content; + + // Attempt SMTP login: + + if(!$this->_logged_in || !$this->_smtp_conn) { + $result = $this->_smtp_login(); + } + + if($this->_sent_mails >= $this->smtp_max_mails) { + // close connection to smtp and reconnect + $this->_sent_mails = 0; + $this->_smtp_close(); + $result = $this->_smtp_login(); + } + $this->_sent_mails += 1; + + // Send mail or queue it + + if ($result) { + $this->send_smtp($m_from, $m_recipients, $m_mail_content); + } else { + $this->add_to_queue($m_from, $m_recipients, $m_mail_content); + } + + // hopefully message was correctly sent or queued now - // hopefully message was correctly sent now $result = true; } } else { @@ -828,7 +838,87 @@ class ispcmail { return $result; } + /** + * Send all mails in queue (usually called from cron) + */ + public function send_queue() { + global $app; + + $mails = $app->db->queryAllRecords('SELECT * FROM sys_mailqueue'); + if (is_array($mails)) { + foreach ($mails as $mail) { + // Open SMTP connections if not open: + + if(!$this->_logged_in || !$this->_smtp_conn) { + $result = $this->_smtp_login(); + } + + if($this->_sent_mails >= $this->smtp_max_mails) { + // close connection to smtp and reconnect + $this->_sent_mails = 0; + $this->_smtp_close(); + $result = $this->_smtp_login(); + } + $this->_sent_mails += 1; + + if (!$result) { + return false; + } + + // Send mail: + + $id = $mail['id']; + $from = $mail['from_address']; + $recipients = explode("\n", $mail['recipients']); + $mail_content = $mail['mail_content']; + + $this->send_smtp($from, $recipients, $mail_content); + + // Delete from queue: + + $app->db->query('DELETE FROM sys_mailqueue WHERE id = ?', $id); + } + } + } + + /** + * Send mail via SMTP + */ + private function send_smtp($from, $recipients, $mail_content) { + // from: + + fputs($this->_smtp_conn, 'MAIL FROM: <' . $from . '>' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + // recipients (To, Cc or Bcc): + + foreach ($recipients as $recipient) { + fputs($this->_smtp_conn, 'RCPT TO: <' . $recipient . '>' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + } + + // mail content: + + fputs($this->_smtp_conn, 'DATA' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + // hopefully message was correctly sent now + $result = true; + + return $result; + } + + /** + * Add mail to queue for sending later + */ + private function add_to_queue($from, $recipients, $mail_content) { + global $app; + $app->db->query('INSERT INTO `sys_mailqueue` (`from_address`, `recipients`, `mail_content`) VALUES (?,?,?)', $from, implode("\n", $recipients), $mail_content); + } /** * Close mail connections diff --git a/interface/lib/classes/json_handler.inc.php b/interface/lib/classes/json_handler.inc.php index de8dd5ba0dd254053821ae910f3a868ba943597f..edc57132b70ba7de24c6353b47f6ecefcb85e6ab 100644 --- a/interface/lib/classes/json_handler.inc.php +++ b/interface/lib/classes/json_handler.inc.php @@ -115,11 +115,17 @@ class ISPConfigJSONHandler { try { $this->_return_json('ok', '', call_user_func_array(array($this->classes[$class_name], $method), $params)); - } catch(SoapFault $e) { + } catch(ISPConfigRemoteException $e) { $this->_return_json('remote_fault', $e->getMessage()); } } } -?> +if(!class_exists('ISPConfigRemoteException')) { + class ISPConfigRemoteException extends Exception { + public function __construct($code = '', $message = '') { + parent::__construct($message . ' (' . $code . ')', 0); + } + } +} \ No newline at end of file diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php index 15a1a53add169892e4aaba3e1b7d4dcb775d398c..665f2e457b6ab4b6e3b68cc9f256f788b0f906fc 100644 --- a/interface/lib/classes/listform.inc.php +++ b/interface/lib/classes/listform.inc.php @@ -60,12 +60,76 @@ class listform { } //* Set local Language File - $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_'.$this->listDef['name'].'_list.lng'; + $lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_'.$this->listDef['name'].'_list.lng'; if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$this->listDef['name'].'_list.lng'; include $lng_file; $this->wordbook = $wb; + $module = (isset($_SESSION['s']['module']['name']) ? $_SESSION['s']['module']['name'] : ''); + + // load wordbook/lang files from addons + if($module == '') { + $lng_path = 'lib/lang.d'; + } else { + $lng_path = '../' . $module . '/lib/lang.d'; + } + if(($dir = opendir($lng_path))) { + $fallback_files = array(); + $use_files = array(); + while(false !== ($cur = readdir($dir))) { + $lng_file = $lng_path . '/' . $cur; + if(is_file($lng_file) && substr($cur, -strlen('.'.$app->listform->listDef["name"].".lng")) === '.'.$app->listform->listDef["name"].".lng") { + if(substr($cur, 0, 3) === 'en_') { + $fallback_files[] = $cur; + } elseif(substr($cur, 0, 3) === $app->functions->check_language($_SESSION["s"]["language"]) . '_') { + $use_files[] = $cur; + } + } + } + closedir($dir); + + foreach($fallback_files as $cur) { + $cur_lng = $app->functions->check_language($_SESSION["s"]["language"]) . '_' . substr($cur, 3); + if(in_array($cur_lng, $use_files, true) == false) { + $use_files[] = $cur; + } + } + unset($fallback_files); + + reset($use_files); + foreach($use_files as $cur) { + $lng_file = $lng_path . '/' . $cur; + + include $lng_file; + if(isset($wb) && is_array($wb)) { + $this->wordbook = $app->functions->array_merge($this->wordbook, $wb); + } + } + unset($use_files); + } + + + if($module) { + // load list files from addons + $listform_path = '../' . $module . '/lib/form.d'; + if(($dir = opendir($listform_path))) { + $items = null; + while(false !== ($cur = readdir($dir))) { + $listform_file = $listform_path . '/' . $cur; + if(is_file($listform_file) && substr($cur, -strlen('.'.$app->listform->listDef["name"].".list.php")) === '.'.$app->listform->listDef["name"].".list.php") { + unset($items); // just in case someone does not create a new array in the list file + include($listform_file); + if(isset($items) && is_array($items) && !empty($items)) { + $this->listDef['item'] = array_merge($this->listDef['item'], $items); + } + } + } + closedir($dir); + } + } + + return true; } diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php index b4366feaa6535782c082cee801ecbf08924f224b..a13c3fdb739691b6f49f494a1d0de15f1aa406a6 100644 --- a/interface/lib/classes/listform_actions.inc.php +++ b/interface/lib/classes/listform_actions.inc.php @@ -249,7 +249,7 @@ class listform_actions { global $app; //* Set global Language File - $lng_file = ISPC_LIB_PATH.'/lang/'.$_SESSION['s']['language'].'.lng'; + $lng_file = ISPC_LIB_PATH.'/lang/'.$app->functions->check_language($_SESSION['s']['language']).'.lng'; if(!file_exists($lng_file)) $lng_file = ISPC_LIB_PATH.'/lang/en.lng'; include $lng_file; diff --git a/interface/lib/classes/listform_tpl_generator.inc.php b/interface/lib/classes/listform_tpl_generator.inc.php index 0cb158bb39ee6666738b9c28d9bee673030ecd80..031f7a1e564516f037d4f81a4ca6180ba351f673 100644 --- a/interface/lib/classes/listform_tpl_generator.inc.php +++ b/interface/lib/classes/listform_tpl_generator.inc.php @@ -153,10 +153,10 @@ class listform_tpl_generator { } function lng_add($lang, $listDef, $module = '') { - global $go_api, $go_info, $conf; + global $app, $conf; if($module == '') { - $lng_file = "lib/lang/".$conf["language"]."_".$listDef['name']."_list.lng"; + $lng_file = "lib/lang/".$app->functions->check_language($conf["language"])."_".$listDef['name']."_list.lng"; } else { $lng_file = '../'.$module."/lib/lang/en_".$listDef['name']."_list.lng"; } diff --git a/interface/lib/classes/plugin.inc.php b/interface/lib/classes/plugin.inc.php index 8a8ac20012976866518a72b4f6bb8685c5e142e5..a01b2588cf7d69ab330b796a4f29419595d61ffe 100644 --- a/interface/lib/classes/plugin.inc.php +++ b/interface/lib/classes/plugin.inc.php @@ -124,17 +124,35 @@ class plugin { $tmp_event = $sub_events[2]; if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG); $tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data); - if($return_data == true && $tmpresult) $result .= $tmpresult; + if($return_data == true && $tmpresult) { + if(is_array($tmpresult) && (!$result || is_array($result))) { + $result = array_merge($result, $tmpresult); + } elseif(!is_array($tmpresult)) { + $result .= $tmpresult; + } + } $tmp_event = $sub_events[0].':'.$sub_events[2]; if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG); $tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data); - if($return_data == true && $tmpresult) $result .= $tmpresult; + if($return_data == true && $tmpresult) { + if(is_array($tmpresult) && (!$result || is_array($result))) { + $result = array_merge($result, $tmpresult); + } elseif(!is_array($tmpresult)) { + $result .= $tmpresult; + } + } $tmp_event = $sub_events[0].':'.$sub_events[1].':'.$sub_events[2]; if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG); $tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data); - if($return_data == true && $tmpresult) $result .= $tmpresult; + if($return_data == true && $tmpresult) { + if(is_array($tmpresult) && (!$result || is_array($result))) { + $result = array_merge($result, $tmpresult); + } elseif(!is_array($tmpresult)) { + $result .= $tmpresult; + } + } /*$sub_events = array_reverse($sub_events); $tmp_event = ''; @@ -147,7 +165,13 @@ class plugin { } else { if($this->debug) $app->log("Called Event '$sub_events[0]'", LOGLEVEL_DEBUG); $tmpresult = $this->callPluginEvent($sub_events[0], $data, $return_data); - if($return_data == true && $tmpresult) $result .= $tmpresult; + if($return_data == true && $tmpresult) { + if(is_array($tmpresult) && (!$result || is_array($result))) { + $result = array_merge($result, $tmpresult); + } elseif(!is_array($tmpresult)) { + $result .= $tmpresult; + } + } } } @@ -187,7 +211,13 @@ class plugin { // call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data); $tmpresult = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data); - if($return_data == true && $tmpresult) $result .= $tmpresult; + if($return_data == true && $tmpresult) { + if(is_array($tmpresult) && (!$result || is_array($result))) { + $result = array_merge($result, $tmpresult); + } elseif(!is_array($tmpresult)) { + $result .= $tmpresult; + } + } } } diff --git a/interface/lib/classes/plugin_backuplist.inc.php b/interface/lib/classes/plugin_backuplist.inc.php index 8e62589f76e5de1c3dcfe01cbb4dddb6bae9ec6f..e96be012e3d6847d43ba990cd9b79c82c3f247f3 100644 --- a/interface/lib/classes/plugin_backuplist.inc.php +++ b/interface/lib/classes/plugin_backuplist.inc.php @@ -45,7 +45,7 @@ class plugin_backuplist extends plugin_base { $listTpl->newTemplate('templates/web_backup_list.htm'); //* Loading language file - $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng"; + $lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_web_backup_list.lng"; include $lng_file; $listTpl->setVar($wb); diff --git a/interface/lib/classes/plugin_backuplist_mail.inc.php b/interface/lib/classes/plugin_backuplist_mail.inc.php index 512fb8c9f05a6de50e0b54a1745cbce031d8f483..af133556097d4d329132a31199900eec004f2e70 100644 --- a/interface/lib/classes/plugin_backuplist_mail.inc.php +++ b/interface/lib/classes/plugin_backuplist_mail.inc.php @@ -46,7 +46,7 @@ class plugin_backuplist_mail extends plugin_base { $listTpl->newTemplate('templates/mail_user_backup_list.htm'); //* Loading language file - $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_mail_backup_list.lng"; + $lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_mail_backup_list.lng"; include($lng_file); $listTpl->setVar($wb); diff --git a/interface/lib/classes/plugin_directive_snippets.inc.php b/interface/lib/classes/plugin_directive_snippets.inc.php index 41138bca1e5891723289a548b9edb9c4ccf19789..555526444692816837a52bfbd393da77edefce57 100644 --- a/interface/lib/classes/plugin_directive_snippets.inc.php +++ b/interface/lib/classes/plugin_directive_snippets.inc.php @@ -18,7 +18,7 @@ class plugin_directive_snippets extends plugin_base $listTpl->newTemplate('templates/web_directive_snippets.htm'); //* Loading language file - $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_directive_snippets.lng"; + $lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_web_directive_snippets.lng"; include $lng_file; $listTpl->setVar($wb); diff --git a/interface/lib/classes/plugin_listview.inc.php b/interface/lib/classes/plugin_listview.inc.php index c9d8340e02e290de97bedba9a4edb530aca6a7b4..bd0aa0e160105701a956f69780c95daa6b18dc2a 100644 --- a/interface/lib/classes/plugin_listview.inc.php +++ b/interface/lib/classes/plugin_listview.inc.php @@ -120,7 +120,7 @@ class plugin_listview extends plugin_base { } // Loading language field - $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng"; + $lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_".$app->listform->listDef['name']."_list.lng"; include $lng_file; $listTpl->setVar($wb); diff --git a/interface/lib/classes/plugin_system_config_dns_ca.inc.php b/interface/lib/classes/plugin_system_config_dns_ca.inc.php index 6144a7349a174d11c0204dae0d3ecfbcd6227892..d9a99496550d82e92e1663c0c383401edf3d45e8 100644 --- a/interface/lib/classes/plugin_system_config_dns_ca.inc.php +++ b/interface/lib/classes/plugin_system_config_dns_ca.inc.php @@ -43,11 +43,11 @@ class plugin_system_config_dns_ca extends plugin_base { $pluginTpl = new tpl; $pluginTpl->newTemplate('templates/system_config_dns_ca_edit.htm'); - include 'lib/lang/'.$_SESSION['s']['language'].'_system_config.lng'; + include 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_system_config.lng'; $pluginTpl->setVar($wb); - if(isset($_GET['action']) && ($_GET['action'] == 'edit') && $_GET['id'] > 0) { + $ca_id = $app->functions->intval($_GET['id']); + if(isset($_GET['action']) && ($_GET['action'] == 'edit') && $ca_id > 0) { $pluginTpl->setVar('edit_record', 1); - $ca_id = intval($_GET['id']); $rec = $app->db->queryOneRecord("SELECT * FROM dns_ssl_ca WHERE id = ?", $ca_id); $pluginTpl->setVar('id', $rec['id']); $pluginTpl->setVar('ca_name', $rec['ca_name']); @@ -56,16 +56,15 @@ class plugin_system_config_dns_ca extends plugin_base { $pluginTpl->setVar('ca_critical', $rec['ca_critical']); $pluginTpl->setVar('ca_iodef', $rec['ca_iodef']); $pluginTpl->setVar('active', $rec['active']); - } elseif(isset($_GET['action']) && ($_GET['action'] == 'save') && $_GET['id'] > 0) { + } elseif(isset($_GET['action']) && ($_GET['action'] == 'save') && $ca_id > 0) { $pluginTpl->setVar('edit_record', 0); - $ca_id = intval($_GET['id']); $pluginTpl->setVar('id', $ca_id); - $pluginTpl->setVar('ca_name', $_POST['ca_name']); - $pluginTpl->setVar('ca_issue', $_POST['ca_issue']); - $pluginTpl->setVar('ca_wildcard', $_POST['ca_wildcard']); - $pluginTpl->setVar('ca_critical', $_POST['ca_critical']); - $pluginTpl->setVar('ca_iodef', $_POST['ca_iodef']); - $pluginTpl->setVar('active', $_POST['active']); + $pluginTpl->setVar('ca_name', $app->functions->htmlentities($_POST['ca_name'])); + $pluginTpl->setVar('ca_issue', $app->functions->htmlentities($_POST['ca_issue'])); + $pluginTpl->setVar('ca_wildcard', $app->functions->htmlentities($_POST['ca_wildcard'])); + $pluginTpl->setVar('ca_critical', $app->functions->htmlentities($_POST['ca_critical'])); + $pluginTpl->setVar('ca_iodef', $app->functions->htmlentities($_POST['ca_iodef'])); + $pluginTpl->setVar('active', $app->functions->htmlentities($_POST['active'])); } else { $pluginTpl->setVar('edit_record', 0); } @@ -77,10 +76,10 @@ class plugin_system_config_dns_ca extends plugin_base { function onUpdate() { global $app; - $id = intval($_GET['id']); + $ca_id = $app->functions->intval($_GET['id']); if(isset($_GET['action']) && $_GET['action'] == 'save') { - if($id > 0) { - $app->db->query("UPDATE dns_ssl_ca SET ca_name = ?, ca_issue = ?, ca_wildcard = ?, ca_iodef = ?, active = ? WHERE id = ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active'], $_GET['id']); + if($ca_id > 0) { + $app->db->query("UPDATE dns_ssl_ca SET ca_name = ?, ca_issue = ?, ca_wildcard = ?, ca_iodef = ?, active = ? WHERE id = ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active'], $ca_id); } else { $app->db->query("INSERT INTO (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, ca_name, ca_issue, ca_wildcard, ca_iodef, active) VALUES(1, 1, 'riud', 'riud', '', ?, ?, ?, ?, ?", $_POST['ca_name'], $_POST['ca_issue'], $_POST['ca_wildcard'], $_POST['ca_iodef'], $_POST['active']); } diff --git a/interface/lib/classes/plugin_system_config_dns_ca_list.inc.php b/interface/lib/classes/plugin_system_config_dns_ca_list.inc.php index eb5882bd3b5bf68ed2b42dbc6577df79d927eaa6..6b82c06043bcb4942b9d03ad394675d9339690d1 100644 --- a/interface/lib/classes/plugin_system_config_dns_ca_list.inc.php +++ b/interface/lib/classes/plugin_system_config_dns_ca_list.inc.php @@ -44,7 +44,7 @@ class plugin_system_config_dns_ca_list extends plugin_base { $listTpl->newTemplate('templates/system_config_dns_ca_list.htm'); //* Loading language file - $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_system_config.lng'; + $lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_system_config.lng'; include $lng_file; $listTpl->setVar($wb); if($_SESSION['s']['user']['typ'] == 'admin') { diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index e5d55ff80c17c00354fa6001d6add5c49def61a5..3946b216dd1af6cfe7da05e292a915164e5c0ffa 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -54,19 +54,19 @@ class quota_lib { if($used_ratio >= 1) $sites[$i]['display_colour'] = '#cc0000'; if($sites[$i]['used'] > 1024) { - $sites[$i]['used'] = round($sites[$i]['used'] / 1024, 2).' MB'; + $sites[$i]['used'] = round($sites[$i]['used'] / 1024, 1).' MB'; } else { if ($sites[$i]['used'] != '') $sites[$i]['used'] .= ' KB'; } if($sites[$i]['soft'] > 1024) { - $sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 2).' MB'; + $sites[$i]['soft'] = round($sites[$i]['soft'] / 1024, 1).' MB'; } else { $sites[$i]['soft'] .= ' KB'; } if($sites[$i]['hard'] > 1024) { - $sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 2).' MB'; + $sites[$i]['hard'] = round($sites[$i]['hard'] / 1024, 1).' MB'; } else { $sites[$i]['hard'] .= ' KB'; } @@ -268,14 +268,14 @@ class quota_lib { if($emails[$i]['quota'] == 0){ $emails[$i]['quota'] = $app->lng('unlimited'); } else { - $emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 4).' MB'; + $emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576, 1).' MB'; } if($emails[$i]['used'] < 1544000) { - $emails[$i]['used'] = round($emails[$i]['used'] / 1024, 4).' KB'; + $emails[$i]['used'] = round($emails[$i]['used'] / 1024, 1).' KB'; } else { - $emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 4).' MB'; + $emails[$i]['used'] = round($emails[$i]['used'] / 1048576, 1).' MB'; } } } @@ -334,9 +334,9 @@ class quota_lib { if($databases[$i]['used'] < 1544000) { - $databases[$i]['used'] = round($databases[$i]['used'] / 1024, 4).' KB'; + $databases[$i]['used'] = round($databases[$i]['used'] / 1024, 1).' KB'; } else { - $databases[$i]['used'] = round($databases[$i]['used'] / 1048576, 4).' MB'; + $databases[$i]['used'] = round($databases[$i]['used'] / 1048576, 1).' MB'; } } } diff --git a/interface/lib/classes/remote.d/admin.inc.php b/interface/lib/classes/remote.d/admin.inc.php index 347f8520b7490a3cc9502c2be072c629e2b6a40d..b07476fb5778d20cf10cb613cccac431bfd0b261 100644 --- a/interface/lib/classes/remote.d/admin.inc.php +++ b/interface/lib/classes/remote.d/admin.inc.php @@ -52,7 +52,7 @@ class remoting_admin extends remoting { global $app; if(!$this->checkPerm($session_id, 'admin_record_permissions')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -62,7 +62,7 @@ class remoting_admin extends remoting { // check if userid is valid $check = $app->db->queryOneRecord('SELECT userid FROM sys_user WHERE userid = ?', $app->functions->intval($value)); if(!$check || !$check['userid']) { - throw new SoapFault('invalid parameters', $value . ' is no valid sys_userid.'); + throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid sys_userid.'); return false; } $permissions[$key] = $app->functions->intval($value); @@ -71,7 +71,7 @@ class remoting_admin extends remoting { // check if groupid is valid $check = $app->db->queryOneRecord('SELECT groupid FROM sys_group WHERE groupid = ?', $app->functions->intval($value)); if(!$check || !$check['groupid']) { - throw new SoapFault('invalid parameters', $value . ' is no valid sys_groupid.'); + throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid sys_groupid.'); return false; } $permissions[$key] = $app->functions->intval($value); @@ -81,7 +81,7 @@ class remoting_admin extends remoting { // check if permissions are valid $value = strtolower($value); if(!preg_match('/^[riud]+$/', $value)) { - throw new SoapFault('invalid parameters', $value . ' is no valid permission string.'); + throw new ISPConfigRemoteException('invalid parameters', $value . ' is no valid permission string.'); return false; } @@ -95,7 +95,7 @@ class remoting_admin extends remoting { break; default: - throw new SoapFault('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.'); + throw new ISPConfigRemoteException('invalid parameters', 'Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.'); break; } } @@ -113,7 +113,7 @@ class remoting_admin extends remoting { public function system_config_set($session_id, $section, $key, $value) { global $app; if(!$this->checkPerm($session_id, 'system_config_set')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if ($section != '' && $key != '') { @@ -123,7 +123,7 @@ class remoting_admin extends remoting { $system_config_str = $app->ini_parser->get_ini_string($system_config_array); return $app->db->datalogUpdate('sys_ini', array("config" => $system_config_str), 'sysini_id', 1); } else { - throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.'); + throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.'); return false; } } @@ -138,7 +138,7 @@ class remoting_admin extends remoting { public function system_config_get($session_id, $section, $key) { global $app; if(!$this->checkPerm($session_id, 'system_config_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if ($section != '') { @@ -152,10 +152,169 @@ class remoting_admin extends remoting { else return false; } } else { - throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.'); + throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.'); return false; } } + + // config_value_* functions --------------------------------------------------------------------------------------- + + //* Get config_value details + public function config_value_get($session_id, $group, $name) + { + global $app; + + if(!$this->checkPerm($session_id, 'config_value_get')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + // validate fields + if($group == '' || $name == '') { + throw new ISPConfigRemoteException('field_empty_error', 'Group and name parameter may not be empty.'); + return false; + } + + return $app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name); + } + + //* Add a config_value record + public function config_value_add($session_id, $group, $name, $value) + { + global $app; + + if(!$this->checkPerm($session_id, 'config_value_add')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + // validate fields + if($group == '' || $name == '' || $value == '') { + throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.'); + return false; + } + + if(is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) { + throw new ISPConfigRemoteException('record_unique_error', 'Group plus name field combination is not unique.'); + return false; + } + + return $app->db->query('INSERT INTO sys_config (`group`,`name`,`value`) VALUES (?,?,?)',$group,$name,$value); + } + + //* Update config_value record + public function config_value_update($session_id, $group, $name, $value) + { + global $app; + + if(!$this->checkPerm($session_id, 'config_value_update')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + // validate fields + if($group == '' || $name == '' || $value == '') { + throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.'); + return false; + } + + if(!is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) { + throw new ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.'); + return false; + } + + return $app->db->query('UPDATE sys_config SET `value` = ? WHERE `group` = ? AND `name` = ?',$value,$group,$name); + } + + //* Replace config_value record + public function config_value_replace($session_id, $group, $name, $value) + { + global $app; + + if(!$this->checkPerm($session_id, 'config_value_replace')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + // validate fields + if($group == '' || $name == '' || $value == '') { + throw new ISPConfigRemoteException('field_empty_error', 'Group, name, and value parameter may not be empty.'); + return false; + } + + if(is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) { + return $app->db->query('UPDATE sys_config SET `value` = ? WHERE `group` = ? AND `name` = ?',$value,$group,$name); + } else { + return $app->db->query('INSERT INTO sys_config (`group`,`name`,`value`) VALUES (?,?,?)',$group,$name,$value); + } + } + + //* Delete config_value record + public function config_value_delete($session_id, $group, $name) + { + global $app; + + if(!$this->checkPerm($session_id, 'config_value_delete')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + // validate fields + if($group == '' || $name == '') { + throw new ISPConfigRemoteException('field_empty_error', 'Group and name parameter may not be empty.'); + return false; + } + + if(!is_array($app->db->queryOneRecord('SELECT * FROM sys_config WHERE `group` = ? AND `name` = ?', $group, $name))) { + throw new ISPConfigRemoteException('record_nonexist_error', 'There is no record with this group plus name field combination.'); + return false; + } + + return $app->db->query('DELETE FROM sys_config WHERE `group` = ? AND `name` = ?',$group,$name); + } + + // Get datalog information with tstamp >= + public function sys_datalog_get_by_tstamp($session_id, $tstamp) + { + global $app; + + if(!$this->checkPerm($session_id, 'server_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $tstamp = $app->functions->intval($tstamp); + + if($tstamp > 0) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE tstamp >= ? ORDER BY datalog_id DESC", $tstamp); + return $rec; + } + } + + // Get datalog information by datalog_id + public function sys_datalog_get($session_id, $datalog_id, $newer = false) + { + global $app; + + if(!$this->checkPerm($session_id, 'server_get')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $tstamp = $app->functions->intval($tstamp); + + if($datalog_id > 0 && $newer === true) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id >= ? ORDER BY datalog_id DESC", $datalog_id); + return $rec; + } elseif ($datalog_id > 0) { + $rec = $app->db->queryAllRecords("SELECT datalog_id, server_id, dbtable, dbidx, action, tstamp, user, data, status, error FROM sys_datalog WHERE datalog_id = ? ORDER BY datalog_id DESC", $datalog_id); + return $rec; + } else { + throw new SoapFault('invalid_datalog_id', 'The ID passed to the function must be > 0'); + return false; + } + } + } diff --git a/interface/lib/classes/remote.d/aps.inc.php b/interface/lib/classes/remote.d/aps.inc.php index 50dda4825577555eac85e0ca56891b866db1352f..2e1770be42a1ece22d64bccfa976dd9b5286453c 100644 --- a/interface/lib/classes/remote.d/aps.inc.php +++ b/interface/lib/classes/remote.d/aps.inc.php @@ -40,7 +40,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_update_package_list')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -60,7 +60,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_available_packages_list')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -82,7 +82,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -98,14 +98,14 @@ class remoting_aps extends remoting { // Make sure an integer ID is given if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag - throw new SoapFault('package_error', 'The given Package ID is not valid.'); + throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.'); return false; } // Get package details $details = $gui->getPackageDetails($primary_id); if (isset($details['error'])) { - throw new SoapFault('package_error', $details['error']); + throw new ISPConfigRemoteException('package_error', $details['error']); return false; } @@ -121,7 +121,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_get_package_file')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -137,14 +137,14 @@ class remoting_aps extends remoting { // Make sure an integer ID is given if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag - throw new SoapFault('package_error', 'The given Package ID is not valid.'); + throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.'); return false; } // Get package details $details = $gui->getPackageDetails($primary_id); if (isset($details['error'])) { - throw new SoapFault('package_error', $details['error']); + throw new ISPConfigRemoteException('package_error', $details['error']); return false; } @@ -155,7 +155,7 @@ class remoting_aps extends remoting { foreach ($details['Screenshots'] as $screen) { if (basename($screen['ScreenPath']) == $filename) { $found = true; break; } } if (!$found) { - throw new SoapFault('package_error', 'File not found in package.'); + throw new ISPConfigRemoteException('package_error', 'File not found in package.'); return false; } @@ -167,7 +167,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_get_package_details')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -183,14 +183,14 @@ class remoting_aps extends remoting { // Make sure an integer ID is given if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag - throw new SoapFault('package_error', 'The given Package ID is not valid.'); + throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.'); return false; } // Get package settings $settings = $gui->getPackageSettings($primary_id); if (isset($settings['error'])) { - throw new SoapFault('package_error', $settings['error']); + throw new ISPConfigRemoteException('package_error', $settings['error']); return false; } @@ -205,7 +205,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_change_package_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -215,12 +215,12 @@ class remoting_aps extends remoting { // Make sure an integer ID is given if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag - throw new SoapFault('package_error', 'The given Package ID is not valid.'); + throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.'); return false; } if(!isset($params['package_status']) || (($params['package_status'] != PACKAGE_ENABLED) && ($params['package_status'] != PACKAGE_LOCKED))) { - throw new SoapFault('package_error', 'Wrong new status: '.$params['package_status']); + throw new ISPConfigRemoteException('package_error', 'Wrong new status: '.$params['package_status']); return false; } @@ -235,7 +235,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_install_package')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -251,25 +251,25 @@ class remoting_aps extends remoting { // Make sure an integer ID is given if (!isset($primary_id) || !$gui->isValidPackageID($primary_id, true)) {// always adminflag - throw new SoapFault('package_error', 'The given Package ID is not valid.'); + throw new ISPConfigRemoteException('package_error', 'The given Package ID is not valid.'); return false; } // Get package details $details = $gui->getPackageDetails($primary_id); if (isset($details['error'])) { - throw new SoapFault('package_error', $details['error']); + throw new ISPConfigRemoteException('package_error', $details['error']); return false; } $settings = $gui->getPackageSettings($primary_id); if (isset($settings['error'])) { - throw new SoapFault('package_error', $settings['error']); + throw new ISPConfigRemoteException('package_error', $settings['error']); return false; } // Check given Site/VHostDomain if (!isset($params['main_domain'])) { - throw new SoapFault('invalid parameters', 'No valid domain given.'); + throw new ISPConfigRemoteException('invalid parameters', 'No valid domain given.'); return false; } @@ -284,7 +284,7 @@ class remoting_aps extends remoting { } if (!$domain) { - throw new SoapFault('invalid parameters', 'No valid domain given.'); + throw new ISPConfigRemoteException('invalid parameters', 'No valid domain given.'); return false; } @@ -295,7 +295,7 @@ class remoting_aps extends remoting { return $gui->createPackageInstance($result['input'], $primary_id); } - throw new SoapFault('invalid parameters', implode('
', $result['error'])); + throw new ISPConfigRemoteException('invalid parameters', implode('
', $result['error'])); return false; } @@ -304,7 +304,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -318,7 +318,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_instance_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -332,7 +332,7 @@ class remoting_aps extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_aps_instance_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -344,7 +344,7 @@ class remoting_aps extends remoting { $result = $app->db->queryOneRecord($sql, $primary_id); if (!$result) { - throw new SoapFault('instance_error', 'No valid instance id given.'); + throw new ISPConfigRemoteException('instance_error', 'No valid instance id given.'); return false; } diff --git a/interface/lib/classes/remote.d/client.inc.php b/interface/lib/classes/remote.d/client.inc.php index d1f447de274b2579e6a71832d6e11ef8c1d97ab5..b7cb439bad0917c3876a70aa9cb6c922fd8a8122 100644 --- a/interface/lib/classes/remote.d/client.inc.php +++ b/interface/lib/classes/remote.d/client.inc.php @@ -53,7 +53,7 @@ class remoting_client extends remoting { global $app; if(!$this->checkPerm($session_id, 'client_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -98,7 +98,7 @@ class remoting_client extends remoting { { global $app; if(!$this->checkPerm($session_id, 'client_get_id')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -108,7 +108,7 @@ class remoting_client extends remoting { if(isset($rec['client_id'])) { return $app->functions->intval($rec['client_id']); } else { - throw new SoapFault('no_client_found', 'There is no sysuser account for this client ID.'); + throw new ISPConfigRemoteException('no_client_found', 'There is no sysuser account for this client ID.'); return false; } @@ -119,7 +119,7 @@ class remoting_client extends remoting { global $app; if(!$this->checkPerm($session_id, 'client_get_emailcontact')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -130,7 +130,7 @@ class remoting_client extends remoting { if(is_array($rec)) { return $rec; } else { - throw new SoapFault('no_client_found', 'There is no client with this client ID.'); + throw new ISPConfigRemoteException('no_client_found', 'There is no client with this client ID.'); return false; } } @@ -139,7 +139,7 @@ class remoting_client extends remoting { { global $app; if(!$this->checkPerm($session_id, 'client_get_id')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -149,7 +149,7 @@ class remoting_client extends remoting { if(isset($rec['groupid'])) { return $app->functions->intval($rec['groupid']); } else { - throw new SoapFault('no_group_found', 'There is no group for this client ID.'); + throw new ISPConfigRemoteException('no_group_found', 'There is no group for this client ID.'); return false; } @@ -162,7 +162,7 @@ class remoting_client extends remoting { if (!$this->checkPerm($session_id, 'client_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id; @@ -174,7 +174,7 @@ class remoting_client extends remoting { // Selected client is not a reseller. REMOVING PARENT_CLIENT_ID!!! $params['parent_client_id'] = 0; } elseif(isset($params['limit_client']) && $params['limit_client'] != 0) { - throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.'); + throw new ISPConfigRemoteException('Invalid reseller', 'Reseller cannot be client of another reseller.'); return false; } } @@ -191,7 +191,7 @@ class remoting_client extends remoting { if (!$this->checkPerm($session_id, 'client_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -212,12 +212,12 @@ class remoting_client extends remoting { // check if this one is reseller $check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id'])); if($check['limit_client'] == 0) { - throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.'); + throw new ISPConfigRemoteException('Invalid reseller', 'Selected client is not a reseller.'); return false; } if(isset($params['limit_client']) && $params['limit_client'] != 0) { - throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.'); + throw new ISPConfigRemoteException('Invalid reseller', 'Reseller cannot be client of another reseller.'); return false; } } @@ -255,7 +255,7 @@ class remoting_client extends remoting { global $app; if(!$this->checkPerm($session_id, 'client_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -263,7 +263,7 @@ class remoting_client extends remoting { $sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?"; return $app->db->queryOneRecord($sql, $client_id); } else { - throw new SoapFault('The ID must be an integer.'); + throw new ISPConfigRemoteException('The ID must be an integer.'); return array(); } } @@ -293,7 +293,7 @@ class remoting_client extends remoting { global $app; if(!$this->checkPerm($session_id, 'client_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -301,13 +301,13 @@ class remoting_client extends remoting { // check if client exists $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id); if(!$check) { - throw new SoapFault('Invalid client'); + throw new ISPConfigRemoteException('Invalid client'); return false; } // check if template exists $check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ?', $template_id); if(!$check) { - throw new SoapFault('Invalid template'); + throw new ISPConfigRemoteException('Invalid template'); return false; } @@ -322,7 +322,7 @@ class remoting_client extends remoting { return $insert_id; } else { - throw new SoapFault('The IDs must be of type integer.'); + throw new ISPConfigRemoteException('The IDs must be of type integer.'); return false; } } @@ -331,7 +331,7 @@ class remoting_client extends remoting { global $app; if(!$this->checkPerm($session_id, 'client_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -339,13 +339,13 @@ class remoting_client extends remoting { // check if client exists $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ?', $client_id); if(!$check) { - throw new SoapFault('Invalid client'); + throw new ISPConfigRemoteException('Invalid client'); return false; } // check if template exists $check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `client_id` = ? AND `client_template_id` = ?', $client_id, $assigned_template_id); if(!$check) { - throw new SoapFault('Invalid template'); + throw new ISPConfigRemoteException('Invalid template'); return false; } @@ -360,7 +360,7 @@ class remoting_client extends remoting { return $affected_rows; } else { - throw new SoapFault('The IDs must be of type integer.'); + throw new ISPConfigRemoteException('The IDs must be of type integer.'); return false; } } @@ -371,7 +371,7 @@ class remoting_client extends remoting { if (!$this->checkPerm($session_id, 'client_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id); @@ -388,7 +388,7 @@ class remoting_client extends remoting { global $app, $conf; if(!$this->checkPerm($session_id, 'client_delete_everything')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -408,7 +408,7 @@ class remoting_client extends remoting { $app->db->query("DELETE FROM sys_user WHERE client_id = ?", $client_id); //* Delete all records (sub-clients, mail, web, etc....) of this client. - $tables = 'cron,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain,mail_mailinglist,client'; + $tables = 'cron,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic,domain,client'; $tables_array = explode(',', $tables); $client_group_id = $app->functions->intval($client_group['groupid']); if($client_group_id > 1) { @@ -444,7 +444,7 @@ class remoting_client extends remoting { } if (!$this->checkPerm($session_id, 'client_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id); @@ -464,14 +464,14 @@ class remoting_client extends remoting { public function client_get_by_username($session_id, $username) { global $app; if(!$this->checkPerm($session_id, 'client_get_by_username')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = ?", $username); if (isset($rec)) { return $rec; } else { - throw new SoapFault('no_client_found', 'There is no user account for this user name.'); + throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this user name.'); return false; } } @@ -479,12 +479,12 @@ class remoting_client extends remoting { public function client_get_by_customer_no($session_id, $customer_no) { global $app; if(!$this->checkPerm($session_id, 'client_get_by_customer_no')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $customer_no = trim($customer_no); if($customer_no == '') { - throw new SoapFault('permission_denied', 'There was no customer number specified.'); + throw new ISPConfigRemoteException('permission_denied', 'There was no customer number specified.'); return false; } $customer_no = $app->db->quote($customer_no); @@ -492,7 +492,7 @@ class remoting_client extends remoting { if (isset($rec)) { return $rec; } else { - throw new SoapFault('no_client_found', 'There is no user account for this customer number.'); + throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this customer number.'); return false; } } @@ -505,7 +505,7 @@ class remoting_client extends remoting { public function client_get_all($session_id) { global $app; if(!$this->checkPerm($session_id, 'client_get_all')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1"); @@ -533,7 +533,7 @@ class remoting_client extends remoting { $app->uses('auth'); if(!$this->checkPerm($session_id, 'client_change_password')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -546,7 +546,7 @@ class remoting_client extends remoting { $app->db->query($sql, $new_password, $client_id); return true; } else { - throw new SoapFault('no_client_found', 'There is no user account for this client_id'); + throw new ISPConfigRemoteException('no_client_found', 'There is no user account for this client_id'); return false; } } @@ -559,7 +559,7 @@ class remoting_client extends remoting { public function client_templates_get_all($session_id) { global $app; if(!$this->checkPerm($session_id, 'client_templates_get_all')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $sql = "SELECT * FROM client_template"; @@ -572,17 +572,17 @@ class remoting_client extends remoting { //* Check permissions if(!$this->checkPerm($session_id, 'client_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } //* Check username and password if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $username)) { - throw new SoapFault('user_regex_error', 'Username contains invalid characters.'); + throw new ISPConfigRemoteException('user_regex_error', 'Username contains invalid characters.'); return false; } if(!preg_match("/^.{1,64}$/i", $password)) { - throw new SoapFault('password_length_error', 'Invalid password length or no password provided.'); + throw new ISPConfigRemoteException('password_length_error', 'Invalid password length or no password provided.'); return false; } @@ -592,7 +592,7 @@ class remoting_client extends remoting { //* too many failedlogins if($alreadyfailed['times'] > 5) { - throw new SoapFault('error_user_too_many_logins', 'Too many failed logins.'); + throw new ISPConfigRemoteException('error_user_too_many_logins', 'Too many failed logins.'); return false; } @@ -663,7 +663,7 @@ class remoting_client extends remoting { 'language' => $user['language'], 'country' => 'de'); } else { - throw new SoapFault('login_failed', 'Login failed.'); + throw new ISPConfigRemoteException('login_failed', 'Login failed.'); } } @@ -681,6 +681,7 @@ class remoting_client extends remoting { } return $returnval; +<<<<<<< HEAD } function client_disable_all_services($session_id, $client_id) { @@ -863,6 +864,29 @@ class remoting_client extends remoting { return false; } } +======= + } + + public function client_get_by_groupid($session_id, $group_id) + { + global $app; + if(!$this->checkPerm($session_id, 'client_get_id')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + $group_id = $app->functions->intval($group_id); + + $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $group_id); + if(isset($rec['client_id'])) { + $client_id = $app->functions->intval($rec['client_id']); + return $this->client_get($session_id, $client_id); + } else { + throw new SoapFault('no_group_found', 'There is no client for this group ID.'); + return false; + } + } +>>>>>>> d10c482eef6eced3cf2cc8b13821099ec9ab6f7c } diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php index 49209b183636ed76bc876d0090144bc918d97cb5..d383f395a53dd02224717030fcbc8ff3e8e19895 100644 --- a/interface/lib/classes/remote.d/dns.inc.php +++ b/interface/lib/classes/remote.d/dns.inc.php @@ -42,11 +42,10 @@ class remoting_dns extends remoting { // DNS Function -------------------------------------------------------------------------------------------------- //* Create Zone with Template - public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email) - { + public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email) { global $app, $conf; if(!$this->checkPerm($session_id, 'dns_templatezone_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -180,18 +179,17 @@ class remoting_dns extends remoting { return $dns_soa_id; exit; } else { - throw new SoapFault('permission_denied', $error); + throw new ISPConfigRemoteException('permission_denied', $error); } } //* Get record details - public function dns_zone_get($session_id, $primary_id) - { + public function dns_zone_get($session_id, $primary_id) { global $app; if(!$this->checkPerm($session_id, 'dns_zone_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -199,21 +197,33 @@ class remoting_dns extends remoting { return $app->remoting_lib->getDataRecord($primary_id); } + //* Get slave zone details + public function dns_slave_get($session_id, $primary_id) { + global $app; + + if(!$this->checkPerm($session_id, 'dns_zone_get')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + $app->uses('remoting_lib'); + $app->remoting_lib->loadFormDef('../dns/form/dns_slave.tform.php'); + return $app->remoting_lib->getDataRecord($primary_id); + } + + //* Add a slave zone - public function dns_slave_add($session_id, $client_id, $params) - { + public function dns_slave_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'dns_zone_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../dns/form/dns_slave.tform.php', $client_id, $params); } //* Update a slave zone - public function dns_slave_update($session_id, $client_id, $primary_id, $params) - { + public function dns_slave_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'dns_zone_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../dns/form/dns_slave.tform.php', $client_id, $primary_id, $params); @@ -221,27 +231,25 @@ class remoting_dns extends remoting { } //* Delete a slave zone - public function dns_slave_delete($session_id, $primary_id) - { + public function dns_slave_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'dns_zone_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->deleteQuery('../dns/form/dns_slave.tform.php', $primary_id); } //* Get record id by origin - public function dns_zone_get_id($session_id, $origin) - { + public function dns_zone_get_id($session_id, $origin) { global $app; if(!$this->checkPerm($session_id, 'dns_zone_get_id')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if(!preg_match('/^([a-z0-9][a-z0-9\-]+[a-z0-9]|[a-z0-9]{2})(\.[a-z]{2,63})+$/i', $origin)){ - throw new SoapFault('no_domain_found', 'Invalid domain name.'); + throw new ISPConfigRemoteException('no_domain_found', 'Invalid domain name.'); return false; } @@ -249,26 +257,24 @@ class remoting_dns extends remoting { if(isset($rec['id'])) { return $app->functions->intval($rec['id']); } else { - throw new SoapFault('no_domain_found', 'There is no domain ID with informed domain name.'); + throw new ISPConfigRemoteException('no_domain_found', 'There is no domain ID with informed domain name.'); return false; } } //* Add a record - public function dns_zone_add($session_id, $client_id, $params) - { + public function dns_zone_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'dns_zone_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../dns/form/dns_soa.tform.php', $client_id, $params); } //* Update a record - public function dns_zone_update($session_id, $client_id, $primary_id, $params) - { + public function dns_zone_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'dns_zone_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params); @@ -276,10 +282,9 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_zone_delete($session_id, $primary_id) - { + public function dns_zone_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'dns_zone_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php', $primary_id); @@ -288,563 +293,312 @@ class remoting_dns extends remoting { // ---------------------------------------------------------------------------------------------------------------- - //* Get record details - public function dns_aaaa_get($session_id, $primary_id) - { + private function dns_rr_get($session_id, $primary_id, $rr_type = 'A') { global $app; - - if(!$this->checkPerm($session_id, 'dns_aaaa_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + + $rr_type = strtolower($rr_type); + if(!preg_match('/^[a-z]+$/', $rr_type)) { + throw new ISPConfigRemoteException('permission denied', 'Invalid rr type'); + } + + if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_get')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); } $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php'); + $app->remoting_lib->loadFormDef('../dns/form/dns_' . $rr_type . '.tform.php'); return $app->remoting_lib->getDataRecord($primary_id); } - + //* Add a record - public function dns_aaaa_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + private function dns_rr_add($session_id, $client_id, $params, $update_serial=false, $rr_type = 'A') { + $rr_type = strtolower($rr_type); + if(!preg_match('/^[a-z]+$/', $rr_type)) { + throw new ISPConfigRemoteException('permission denied', 'Invalid rr type'); } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_aaaa.tform.php', $client_id, $params); + + if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_add')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + } + if($update_serial) { + $this->increase_serial($session_id, $client_id, $params); + } + return $this->insertQuery('../dns/form/dns_' . $rr_type . '.tform.php', $client_id, $params); } //* Update a record - public function dns_aaaa_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + private function dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial=false, $rr_type = 'A') { + $rr_type = strtolower($rr_type); + if(!preg_match('/^[a-z]+$/', $rr_type)) { + throw new ISPConfigRemoteException('permission denied', 'Invalid rr type'); + } + + if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_update')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php', $client_id, $primary_id, $params); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); + $affected_rows = $this->updateQuery('../dns/form/dns_' . $rr_type . '.tform.php', $client_id, $primary_id, $params); + if($update_serial) { + $this->increase_serial($session_id, $client_id, $params); + } return $affected_rows; } - + //* Delete a record - public function dns_aaaa_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + private function dns_rr_delete($session_id, $primary_id, $update_serial=false, $rr_type = 'A') { + $rr_type = strtolower($rr_type); + if(!preg_match('/^[a-z]+$/', $rr_type)) { + throw new ISPConfigRemoteException('permission denied', 'Invalid rr type'); + } + if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_delete')) { + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); + } + if($update_serial) { + $this->increase_serial($session_id, 0, array('dns_rr_id' => $primary_id)); } - $affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); + $affected_rows = $this->deleteQuery('../dns/form/dns_' . $rr_type . '.tform.php', $primary_id); return $affected_rows; } + + // ---------------------------------------------------------------------------------------------------------------- + + //* Get record details + public function dns_aaaa_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'AAAA'); + } + + //* Add a record + public function dns_aaaa_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'AAAA'); + } + + //* Update a record + public function dns_aaaa_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'AAAA'); + } + + //* Delete a record + public function dns_aaaa_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'AAAA'); + } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_a_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_a_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_a_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'A'); } //* Add a record - public function dns_a_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_a_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_a.tform.php', $client_id, $params); + public function dns_a_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'A'); } //* Update a record - public function dns_a_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_a_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_a_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'A'); } //* Delete a record - public function dns_a_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_a_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_a_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'A'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_alias_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_alias_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_alias_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'ALIAS'); } //* Add a record - public function dns_alias_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_alias_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_alias.tform.php', $client_id, $params); + public function dns_alias_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'ALIAS'); } //* Update a record - public function dns_alias_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_alias_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_alias_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'ALIAS'); } //* Delete a record - public function dns_alias_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_alias_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_alias_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'ALIAS'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_cname_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_cname_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_cname_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'CNAME'); } //* Add a record - public function dns_cname_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_cname_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_cname.tform.php', $client_id, $params); + public function dns_cname_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'CNAME'); } //* Update a record - public function dns_cname_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_cname_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_cname_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'CNAME'); } //* Delete a record - public function dns_cname_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_cname_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_cname_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'CNAME'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_hinfo_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_hinfo_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_hinfo_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'HINFO'); } //* Add a record - public function dns_hinfo_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_hinfo.tform.php', $client_id, $params); + public function dns_hinfo_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'HINFO'); } //* Update a record - public function dns_hinfo_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_hinfo_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'HINFO'); } //* Delete a record - public function dns_hinfo_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_hinfo_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'HINFO'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_mx_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_mx_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_mx_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'MX'); } //* Add a record - public function dns_mx_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_mx_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_mx.tform.php', $client_id, $params); + public function dns_mx_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'MX'); } //* Update a record - public function dns_mx_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_mx_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_mx_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'MX'); } //* Delete a record - public function dns_mx_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_mx_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_mx_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'MX'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_ns_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_ns_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_ns_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'NS'); } //* Add a record - public function dns_ns_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ns_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_ns.tform.php', $client_id, $params); + public function dns_ns_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'NS'); } //* Update a record - public function dns_ns_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ns_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_ns_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'NS'); } //* Delete a record - public function dns_ns_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ns_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_ns_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'NS'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_ptr_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_ptr_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_ptr_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'PTR'); } //* Add a record - public function dns_ptr_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ptr_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_ptr.tform.php', $client_id, $params); + public function dns_ptr_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'PTR'); } //* Update a record - public function dns_ptr_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ptr_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_ptr_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'PTR'); } //* Delete a record - public function dns_ptr_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_ptr_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_ptr_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'PTR'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_rp_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_rp_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_rp_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'RP'); } //* Add a record - public function dns_rp_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_rp_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_rp.tform.php', $client_id, $params); + public function dns_rp_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'RP'); } //* Update a record - public function dns_rp_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_rp_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_rp_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'RP'); } //* Delete a record - public function dns_rp_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_rp_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_rp_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'RP'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_srv_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_srv_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_srv_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'SRV'); } //* Add a record - public function dns_srv_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_srv_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_srv.tform.php', $client_id, $params); + public function dns_srv_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'SRV'); } //* Update a record - public function dns_srv_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_srv_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_srv_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'SRV'); } //* Delete a record - public function dns_srv_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_srv_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_srv_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'SRV'); } // ---------------------------------------------------------------------------------------------------------------- //* Get record details - public function dns_txt_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'dns_txt_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); + public function dns_txt_get($session_id, $primary_id) { + return $this->dns_rr_get($session_id, $primary_id, 'TXT'); } //* Add a record - public function dns_txt_add($session_id, $client_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_txt_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $this->insertQuery('../dns/form/dns_txt.tform.php', $client_id, $params); + public function dns_txt_add($session_id, $client_id, $params, $update_serial=false) { + return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'TXT'); } //* Update a record - public function dns_txt_update($session_id, $client_id, $primary_id, $params, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_txt_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - $affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php', $client_id, $primary_id, $params); - return $affected_rows; + public function dns_txt_update($session_id, $client_id, $primary_id, $params, $update_serial=false) { + return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'TXT'); } //* Delete a record - public function dns_txt_delete($session_id, $primary_id, $update_serial=false) - { - if(!$this->checkPerm($session_id, 'dns_txt_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php', $primary_id); - if($update_serial) $this->increase_serial($session_id, $client_id, $params); - return $affected_rows; + public function dns_txt_delete($session_id, $primary_id, $update_serial=false) { + return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'TXT'); } /** @@ -856,7 +610,7 @@ class remoting_dns extends remoting { public function dns_zone_get_by_user($session_id, $client_id, $server_id) { global $app; if(!$this->checkPerm($session_id, 'dns_zone_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($client_id) && !empty($server_id)) { @@ -880,7 +634,7 @@ class remoting_dns extends remoting { public function dns_rr_get_all_by_zone($session_id, $zone_id) { global $app; if(!$this->checkPerm($session_id, 'dns_zone_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $sql = "SELECT * FROM dns_rr WHERE zone = ?"; @@ -898,7 +652,7 @@ class remoting_dns extends remoting { public function dns_zone_set_status($session_id, $primary_id, $status) { global $app; if(!$this->checkPerm($session_id, 'dns_zone_set_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if(in_array($status, array('active', 'inactive'))) { @@ -912,12 +666,18 @@ class remoting_dns extends remoting { $result = $app->db->affectedRows(); return $result; } else { - throw new SoapFault('status_undefined', 'The status is not available'); + throw new ISPConfigRemoteException('status_undefined', 'The status is not available'); return false; } } private function increase_serial($session_id, $client_id, $params) { + global $app; + if(!isset($params['zone']) && isset($params['dns_rr_id'])) { + $tmp = $app->db->queryOneRecord('SELECT zone FROM dns_rr WHERE id = ?',$params['dns_rr_id']); + $params['zone'] = $tmp['zone']; + unset($tmp); + } $soa = $this->dns_zone_get($session_id, $params['zone']); $serial=$soa['serial']; $serial_date = intval(substr($serial, 0, 8)); @@ -938,5 +698,3 @@ class remoting_dns extends remoting { $this->dns_zone_update($session_id, $client_id, $soa['id'], $soa); } } - -?> diff --git a/interface/lib/classes/remote.d/domains.inc.php b/interface/lib/classes/remote.d/domains.inc.php index 33830335d8989990cd1c4f4613ab290679763184..f1e3fcc34f5b28e730fe093ce49b3eb6807c70f5 100644 --- a/interface/lib/classes/remote.d/domains.inc.php +++ b/interface/lib/classes/remote.d/domains.inc.php @@ -47,7 +47,7 @@ class remoting_domains extends remoting { global $app; if(!$this->checkPerm($session_id, 'domains_domain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -59,17 +59,27 @@ class remoting_domains extends remoting { public function domains_domain_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'domains_domain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../client/form/domain.tform.php', $client_id, $params); } + //* Update a record + public function domains_domain_update($session_id, $client_id, $primary_id, $params) + { + if(!$this->checkPerm($session_id, 'domains_domain_update')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + return $this->updateQuery('../client/form/domain.tform.php', $client_id, $primary_id, $params); + } + //* Delete a record public function domains_domain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'domains_domain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../client/form/domain.tform.php', $primary_id); @@ -82,7 +92,7 @@ class remoting_domains extends remoting { { global $app; if(!$this->checkPerm($session_id, 'domains_get_all_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $group_id = $app->functions->intval($group_id); diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php index 3900269541dcaf902cc1518219a3d84f88d84b0d..6beebe7c27df26e27eedc25a685110f99d2ca0be 100644 --- a/interface/lib/classes/remote.d/mail.inc.php +++ b/interface/lib/classes/remote.d/mail.inc.php @@ -45,7 +45,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_domain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -57,7 +57,7 @@ class remoting_mail extends remoting { public function mail_domain_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'mail_domain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php', $client_id, $params); @@ -68,7 +68,7 @@ class remoting_mail extends remoting { public function mail_domain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'mail_domain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params); @@ -79,7 +79,7 @@ class remoting_mail extends remoting { public function mail_domain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'mail_domain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php', $primary_id); @@ -92,7 +92,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_aliasdomain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -105,7 +105,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_aliasdomain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $params); @@ -117,7 +117,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_aliasdomain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params); @@ -128,13 +128,14 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id); return $affected_rows; } +<<<<<<< HEAD //* Get mail mailinglist details public function mail_mailinglist_get($session_id, $primary_id) { @@ -211,13 +212,15 @@ class remoting_mail extends remoting { return $all; } +======= +>>>>>>> d10c482eef6eced3cf2cc8b13821099ec9ab6f7c //* Get mail user details public function mail_user_get($session_id, $primary_id) { global $app; if(!$this->checkPerm($session_id, 'mail_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -231,7 +234,7 @@ class remoting_mail extends remoting { global $app; if (!$this->checkPerm($session_id, 'mail_user_add')){ - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -239,7 +242,7 @@ class remoting_mail extends remoting { $email_parts = explode('@', $params['email']); $tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = ?", $email_parts[1]); if($tmp['domain'] != $email_parts[1]) { - throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.'); + throw new ISPConfigRemoteException('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.'); return false; } @@ -248,8 +251,8 @@ class remoting_mail extends remoting { if (!isset($params['gid'])) $params['gid'] = -1; if (!isset($params['maildir_format'])) $params['maildir_format'] = 'maildir'; - $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); - return $affected_rows; + $mailuser_id = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); + return $mailuser_id; } //* Update mail user @@ -259,7 +262,7 @@ class remoting_mail extends remoting { if (!$this->checkPerm($session_id, 'mail_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -267,7 +270,7 @@ class remoting_mail extends remoting { $email_parts = explode('@', $params['email']); $tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = ?", $email_parts[1]); if($tmp['domain'] != $email_parts[1]) { - throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.'); + throw new ISPConfigRemoteException('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.'); return false; } @@ -281,7 +284,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php', $primary_id); @@ -294,7 +297,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_user_filter_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -306,7 +309,7 @@ class remoting_mail extends remoting { { global $app; if (!$this->checkPerm($session_id, 'mail_user_filter_add')){ - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params, 'mail:mail_user_filter:on_after_insert'); @@ -319,7 +322,7 @@ class remoting_mail extends remoting { global $app; if (!$this->checkPerm($session_id, 'mail_user_filter_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params, 'mail:mail_user_filter:on_after_update'); @@ -332,7 +335,7 @@ class remoting_mail extends remoting { global $app; if (!$this->checkPerm($session_id, 'mail_user_filter_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id, 'mail:mail_user_filter:on_after_delete'); @@ -340,13 +343,13 @@ class remoting_mail extends remoting { return $affected_rows; } - // Mail backup list function by Dominik Mller, info@profi-webdesign.net + // Mail backup list function by Dominik M�ller, info@profi-webdesign.net public function mail_user_backup_list($session_id, $primary_id = null) { global $app; if(!$this->checkPerm($session_id, 'mail_user_backup')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -363,13 +366,13 @@ class remoting_mail extends remoting { return $result; } - // Mail backup restore/download functions by Dominik Mller, info@profi-webdesign.net + // Mail backup restore/download functions by Dominik M�ller, info@profi-webdesign.net public function mail_user_backup($session_id, $primary_id, $action_type) { global $app; if(!$this->checkPerm($session_id, 'mail_user_backup')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -383,19 +386,19 @@ class remoting_mail extends remoting { //* Basic validation of variables if ($server_id <= 0) { - throw new SoapFault('invalid_backup_id', "Invalid or non existant backup_id $primary_id"); + throw new ISPConfigRemoteException('invalid_backup_id', "Invalid or non existant backup_id $primary_id"); return false; } if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') { - throw new SoapFault('invalid_action', "Invalid action_type $action_type"); + throw new ISPConfigRemoteException('invalid_action', "Invalid action_type $action_type"); return false; } //* Validate instance $instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`=? and `action_type`=? and `action_state`='pending'", $primary_id, $action_type); if ($instance_record['action_id'] >= 1) { - throw new SoapFault('duplicate_action', "There is already a pending $action_type action"); + throw new ISPConfigRemoteException('duplicate_action', "There is already a pending $action_type action"); return false; } @@ -413,7 +416,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_alias_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -428,14 +431,14 @@ class remoting_mail extends remoting { if (!$this->checkPerm($session_id, 'mail_alias_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } //* Check if there is no active mailbox with this address $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = ?", $params["source"]); if($tmp['number'] > 0) { - throw new SoapFault('duplicate', 'There is already a mailbox with this email address.'); + throw new ISPConfigRemoteException('duplicate', 'There is already a mailbox with this email address.'); } unset($tmp); @@ -450,14 +453,14 @@ class remoting_mail extends remoting { if (!$this->checkPerm($session_id, 'mail_alias_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } //* Check if there is no active mailbox with this address $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = ?", $params["source"]); if($tmp['number'] > 0) { - throw new SoapFault('duplicate', 'There is already a mailbox with this email address.'); + throw new ISPConfigRemoteException('duplicate', 'There is already a mailbox with this email address.'); } unset($tmp); @@ -469,7 +472,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_alias_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id); @@ -482,7 +485,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_forward_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -495,7 +498,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_forward_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params); @@ -507,7 +510,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_forward_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params); @@ -519,7 +522,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_forward_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id); @@ -532,7 +535,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_catchall_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -545,7 +548,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_catchall_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params); @@ -556,7 +559,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_catchall_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params); @@ -567,7 +570,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_catchall_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id); @@ -580,7 +583,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_transport_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -593,7 +596,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_transport_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params); @@ -605,7 +608,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_transport_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params); @@ -617,7 +620,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_transport_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id); @@ -630,7 +633,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_relay_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -644,7 +647,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_relay_add')) { - throw new SoapFault('permission_denied','You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied','You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_relay_recipient.tform.php', $client_id, $params); @@ -656,7 +659,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_relay_update')) { - throw new SoapFault('permission_denied','You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied','You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_relay_recipient.tform.php', $client_id, $primary_id, $params); @@ -668,7 +671,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_relay_delete')) { - throw new SoapFault('permission_denied','You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied','You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_relay_recipient.tform.php', $primary_id); @@ -681,7 +684,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -694,7 +697,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params); @@ -706,7 +709,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params); @@ -718,7 +721,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id); @@ -731,7 +734,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -744,7 +747,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params); @@ -756,7 +759,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params); @@ -768,7 +771,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id); @@ -781,7 +784,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_spamfilter_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -794,7 +797,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params); @@ -806,7 +809,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params); @@ -818,7 +821,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id); @@ -831,7 +834,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_policy_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -844,7 +847,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_policy_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params); @@ -856,7 +859,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_policy_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params); @@ -868,7 +871,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_policy_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id); @@ -881,7 +884,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_fetchmail_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -894,7 +897,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_fetchmail_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params); @@ -906,7 +909,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_fetchmail_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params); @@ -918,7 +921,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_fetchmail_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id); @@ -931,7 +934,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_whitelist_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -944,7 +947,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_whitelist_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params); @@ -956,7 +959,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_whitelist_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params); @@ -968,7 +971,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_whitelist_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id); @@ -981,7 +984,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_blacklist_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -994,7 +997,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_blacklist_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params); @@ -1006,7 +1009,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_blacklist_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params); @@ -1018,7 +1021,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_blacklist_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id); @@ -1031,7 +1034,7 @@ class remoting_mail extends remoting { global $app; if(!$this->checkPerm($session_id, 'mail_filter_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -1044,7 +1047,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_filter_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params); @@ -1056,7 +1059,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_filter_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params); @@ -1068,7 +1071,7 @@ class remoting_mail extends remoting { { if (!$this->checkPerm($session_id, 'mail_filter_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id); @@ -1087,7 +1090,7 @@ class remoting_mail extends remoting { public function mail_domain_get_by_domain($session_id, $domain) { global $app; if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($domain)) { @@ -1101,7 +1104,7 @@ class remoting_mail extends remoting { public function mail_domain_set_status($session_id, $primary_id, $status) { global $app; if(!$this->checkPerm($session_id, 'mail_domain_set_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if(in_array($status, array('active', 'inactive'))) { @@ -1115,7 +1118,7 @@ class remoting_mail extends remoting { $result = $app->db->affectedRows(); return $result; } else { - throw new SoapFault('status_undefined', 'The status is not available'); + throw new ISPConfigRemoteException('status_undefined', 'The status is not available'); return false; } } @@ -1127,179 +1130,12 @@ class remoting_mail extends remoting { $app->uses('quota_lib'); if(!$this->checkPerm($session_id, 'mailquota_get_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $app->quota_lib->get_mailquota_data($client_id, false); } - //** xmpp functions ----------------------------------------------------------------------------------- - - public function xmpp_domain_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'xmpp_domain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/xmpp_domain.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - public function xmpp_domain_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'xmpp_domain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $primary_id = $this->insertQuery('../mail/form/xmpp_domain.tform.php', $client_id, $params); - return $primary_id; - } - - public function xmpp_domain_update($session_id, $client_id, $primary_id, $params) - { - if(!$this->checkPerm($session_id, 'xmpp_domain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../mail/form/xmpp_domain.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - public function xmpp_domain_delete($session_id, $primary_id) - { - if(!$this->checkPerm($session_id, 'xmpp_domain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/xmpp_domain.tform.php', $primary_id); - return $affected_rows; - } - - public function xmpp_user_get($session_id, $primary_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'xmpp_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../mail/form/xmpp_user.tform.php'); - return $app->remoting_lib->getDataRecord($primary_id); - } - - public function xmpp_user_add($session_id, $client_id, $params){ - global $app; - - if (!$this->checkPerm($session_id, 'xmpp_user_add')){ - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $jid_parts = explode('@', $params['jid']); - $tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]); - if($tmp['domain'] != $jid_parts[1]) { - throw new SoapFault('xmpp_domain_does_not_exist', 'XMPP domain - '.$jid_parts[1].' - does not exist.'); - return false; - } - - $affected_rows = $this->insertQuery('../mail/form/xmpp_user.tform.php', $client_id, $params); - return $affected_rows; - } - - public function xmpp_user_update($session_id, $client_id, $primary_id, $params) - { - global $app; - - if (!$this->checkPerm($session_id, 'xmpp_user_update')) - { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $jid_parts = explode('@', $jid_parts['jid']); - $tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]); - if($tmp['domain'] != $jid_parts[1]) { - throw new SoapFault('xmpp_domain_does_not_exist', 'Mail domain - '.$jid_parts[1].' - does not exist.'); - return false; - } - - $affected_rows = $this->updateQuery('../mail/form/xmpp_user.tform.php', $client_id, $primary_id, $params); - return $affected_rows; - } - - public function xmpp_user_delete($session_id, $primary_id) - { - if (!$this->checkPerm($session_id, 'xmpp_user_delete')) - { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../mail/form/xmpp_user.tform.php', $primary_id); - return $affected_rows; - } - - public function xmpp_domain_get_by_domain($session_id, $domain) { - global $app; - if(!$this->checkPerm($session_id, 'xmpp_domain_get_by_domain')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if (!empty($domain)) { - $sql = "SELECT * FROM xmpp_domain WHERE domain = ?"; - $result = $app->db->queryAllRecords($sql, $domain); - return $result; - } - return false; - } - - public function xmpp_domain_set_status($session_id, $primary_id, $status) { - global $app; - if(!$this->checkPerm($session_id, 'xmpp_domain_set_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if(in_array($status, array('active', 'inactive'))) { - if ($status == 'active') { - $status = 'y'; - } else { - $status = 'n'; - } - $sql = "UPDATE xmpp_domain SET active = ? WHERE domain_id = ?"; - $app->db->query($sql, $status, $primary_id); - $result = $app->db->affectedRows(); - return $result; - } else { - throw new SoapFault('status_undefined', 'The status is not available'); - return false; - } - } - - public function xmpp_user_set_status($session_id, $primary_id, $status) { - global $app; - if(!$this->checkPerm($session_id, 'xmpp_user_set_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - if(in_array($status, array('active', 'inactive'))) { - if ($status == 'active') { - $status = 'y'; - } else { - $status = 'n'; - } - $sql = "UPDATE xmpp_user SET active = ? WHERE xmppuser_id = ?"; - $app->db->query($sql, $status, $primary_id); - $result = $app->db->affectedRows(); - return $result; - } else { - throw new SoapFault('status_undefined', 'The status is not available'); - return false; - } - } - } -?> + diff --git a/interface/lib/classes/remote.d/monitor.inc.php b/interface/lib/classes/remote.d/monitor.inc.php index d3689b94caaa0e40ea65b3b906950ab114f9688f..9d207f0796b4df020c658f18dbb81e378300c720 100644 --- a/interface/lib/classes/remote.d/monitor.inc.php +++ b/interface/lib/classes/remote.d/monitor.inc.php @@ -38,7 +38,7 @@ class remoting_monitor extends remoting { global $app; if(!$this->checkPerm($session_id, 'monitor_jobqueue_count')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } diff --git a/interface/lib/classes/remote.d/openvz.inc.php b/interface/lib/classes/remote.d/openvz.inc.php deleted file mode 100644 index a4ef38ad792003aaaf9e28fe293a1fbc0fd0f974..0000000000000000000000000000000000000000 --- a/interface/lib/classes/remote.d/openvz.inc.php +++ /dev/null @@ -1,480 +0,0 @@ - - -*/ - -class remoting_openvz extends remoting { - //* Functions for virtual machine management - - //* Get OpenVZ OStemplate details - public function openvz_ostemplate_get($session_id, $ostemplate_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_ostemplate.tform.php'); - return $app->remoting_lib->getDataRecord($ostemplate_id); - } - - //* Add a openvz ostemplate record - public function openvz_ostemplate_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $params); - } - - //* Update openvz ostemplate record - public function openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $ostemplate_id, $params); - return $affected_rows; - } - - //* Delete openvz ostemplate record - public function openvz_ostemplate_delete($session_id, $ostemplate_id) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php', $ostemplate_id); - return $affected_rows; - } - - //* Get OpenVZ template details - public function openvz_template_get($session_id, $template_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_template.tform.php'); - return $app->remoting_lib->getDataRecord($template_id); - } - - //* Add a openvz template record - public function openvz_template_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../vm/form/openvz_template.tform.php', $client_id, $params); - } - - //* Update openvz template record - public function openvz_template_update($session_id, $client_id, $template_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php', $client_id, $template_id, $params); - return $affected_rows; - } - - //* Delete openvz template record - public function openvz_template_delete($session_id, $template_id) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php', $template_id); - return $affected_rows; - } - - //* Get OpenVZ ip details - public function openvz_ip_get($session_id, $ip_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_ip.tform.php'); - return $app->remoting_lib->getDataRecord($ip_id); - } - - //* Get OpenVZ a free IP address - public function openvz_get_free_ip($session_id, $server_id = 0) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $server_id = $app->functions->intval($server_id); - - if($server_id > 0) { - $tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1", $server_id); - } else { - $tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1"); - } - - if(count($tmp) > 0) { - return $tmp; - } else { - throw new SoapFault('no_free_ip', 'There is no free IP available.'); - } - } - - //* Add a openvz ip record - public function openvz_ip_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../vm/form/openvz_ip.tform.php', $client_id, $params); - } - - //* Update openvz ip record - public function openvz_ip_update($session_id, $client_id, $ip_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php', $client_id, $ip_id, $params); - return $affected_rows; - } - - //* Delete openvz ip record - public function openvz_ip_delete($session_id, $ip_id) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php', $ip_id); - return $affected_rows; - } - - //* Get OpenVZ vm details - public function openvz_vm_get($session_id, $vm_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php'); - return $app->remoting_lib->getDataRecord($vm_id); - } - - //* Get OpenVZ list - public function openvz_vm_get_by_client($session_id, $client_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - if (!empty($client_id)) { - $client_id = $app->functions->intval($client_id); - $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client_id); - $sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ?"; - $result = $app->db->queryAllRecords($sql, $tmp['groupid']); - return $result; - } - return false; - } - - //* Add a openvz vm record - public function openvz_vm_add($session_id, $client_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params); - } - - //* Add a openvz vm record from template - public function openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $override_params = array()) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - - $template_id = $app->functions->intval($template_id); - $ostemplate_id = $app->functions->intval($ostemplate_id); - - //* Verify parameters - if($template_id == 0) { - throw new SoapFault('template_id_error', 'Template ID must be > 0.'); - return false; - } - if($ostemplate_id == 0) { - throw new SoapFault('ostemplate_id_error', 'OSTemplate ID must be > 0.'); - return false; - } - - // Verify if template and ostemplate exist - $tmp = $app->db->queryOneRecord("SELECT template_id FROM openvz_template WHERE template_id = ?", $template_id); - if(!is_array($tmp)) { - throw new SoapFault('template_id_error', 'Template does not exist.'); - return false; - } - $tmp = $app->db->queryOneRecord("SELECT ostemplate_id FROM openvz_ostemplate WHERE ostemplate_id = ?", $ostemplate_id); - if(!is_array($tmp)) { - throw new SoapFault('ostemplate_id_error', 'OSTemplate does not exist.'); - return false; - } - - //* Get the template - $vtpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ?", $template_id); - - //* Get the IP address and server_id - if($override_params['server_id'] > 0) { - $vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1", $override_params['server_id']); - } else { - $vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1"); - } - if(!is_array($vmip)) { - throw new SoapFault('vm_ip_error', 'Unable to get a free VM IP.'); - return false; - } - - //* Build the $params array - $params = array(); - $params['server_id'] = $vmip['server_id']; - $params['ostemplate_id'] = $ostemplate_id; - $params['template_id'] = $template_id; - $params['ip_address'] = $vmip['ip_address']; - $params['hostname'] = (isset($override_params['hostname']))?$override_params['hostname']:$vtpl['hostname']; - $params['vm_password'] = (isset($override_params['vm_password']))?$override_params['vm_password']:$app->auth->get_random_password(10); - $params['start_boot'] = (isset($override_params['start_boot']))?$override_params['start_boot']:'y'; - $params['active'] = (isset($override_params['active']))?$override_params['active']:'y'; - $params['active_until_date'] = (isset($override_params['active_until_date']))?$override_params['active_until_date']:null; - $params['description'] = (isset($override_params['description']))?$override_params['description']:''; - - //* The next params get filled with pseudo values, as the get replaced - //* by the openvz event plugin anyway with values from the template - $params['veid'] = 1; - $params['diskspace'] = 1; - $params['ram'] = 1; - $params['ram_burst'] = 1; - $params['cpu_units'] = 1; - $params['cpu_num'] = 1; - $params['cpu_limit'] = 1; - $params['io_priority'] = 1; - $params['nameserver'] = '8.8.8.8 8.8.4.4'; - $params['create_dns'] = 'n'; - $params['capability'] = ''; - - return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params, 'vm:openvz_vm:on_after_insert'); - } - - //* Update openvz vm record - public function openvz_vm_update($session_id, $client_id, $vm_id, $params) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php', $client_id, $vm_id, $params, 'vm:openvz_vm:on_after_update'); - return $affected_rows; - } - - //* Delete openvz vm record - public function openvz_vm_delete($session_id, $vm_id) - { - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - $affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php', $vm_id, 'vm:openvz_vm:on_after_delete'); - return $affected_rows; - } - - //* Start VM - public function openvz_vm_start($session_id, $vm_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php'); - $vm = $app->remoting_lib->getDataRecord($vm_id); - - if(!is_array($vm)) { - throw new SoapFault('action_pending', 'No VM with this ID available.'); - return false; - } - - if($vm['active'] == 'n') { - throw new SoapFault('action_pending', 'VM is not in active state.'); - return false; - } - - $action = 'openvz_start_vm'; - - $tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction - WHERE server_id = ? - AND action_type = ? - AND action_param = ? - AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']); - - if($tmp['actions'] > 0) { - throw new SoapFault('action_pending', 'There is already a action pending for this VM.'); - return false; - } else { - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, ?, ?, ?, 'pending', '')"; - $app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']); - } - } - - //* Stop VM - public function openvz_vm_stop($session_id, $vm_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php'); - $vm = $app->remoting_lib->getDataRecord($vm_id); - - if(!is_array($vm)) { - throw new SoapFault('action_pending', 'No VM with this ID available.'); - return false; - } - - if($vm['active'] == 'n') { - throw new SoapFault('action_pending', 'VM is not in active state.'); - return false; - } - - $action = 'openvz_stop_vm'; - - $tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction - WHERE server_id = ? - AND action_type = ? - AND action_param = ? - AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']); - - if($tmp['actions'] > 0) { - throw new SoapFault('action_pending', 'There is already a action pending for this VM.'); - return false; - } else { - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, ?, ?, ?, 'pending', '')"; - $app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']); - } - } - - //* Restart VM - public function openvz_vm_restart($session_id, $vm_id) - { - global $app; - - if(!$this->checkPerm($session_id, 'vm_openvz')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; - } - - $app->uses('remoting_lib'); - $app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php'); - $vm = $app->remoting_lib->getDataRecord($vm_id); - - if(!is_array($vm)) { - throw new SoapFault('action_pending', 'No VM with this ID available.'); - return false; - } - - if($vm['active'] == 'n') { - throw new SoapFault('action_pending', 'VM is not in active state.'); - return false; - } - - $action = 'openvz_restart_vm'; - - $tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction - WHERE server_id = ? - AND action_type = ? - AND action_param = ? - AND action_state = 'pending'", $vm['server_id'], $action, $vm['veid']); - - if($tmp['actions'] > 0) { - throw new SoapFault('action_pending', 'There is already a action pending for this VM.'); - return false; - } else { - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, ?, ?, ?, 'pending', '')"; - $app->db->query($sql, (int)$vm['server_id'], time(), $action, $vm['veid']); - } - } - -} - -?> diff --git a/interface/lib/classes/remote.d/server.inc.php b/interface/lib/classes/remote.d/server.inc.php index a9961784e2f2fc31c1da7eb768439b07574708d1..b14b10d0db279d74ee2db8cb63b7f58436b1a9fa 100644 --- a/interface/lib/classes/remote.d/server.inc.php +++ b/interface/lib/classes/remote.d/server.inc.php @@ -52,7 +52,7 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $sql = "SELECT server_id FROM server_ip WHERE ip_address = ?"; @@ -66,7 +66,7 @@ class remoting_server extends remoting { global $app; if(!$this->checkPerm($session_id, 'server_ip_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -78,7 +78,7 @@ class remoting_server extends remoting { public function server_ip_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'server_ip_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../admin/form/server_ip.tform.php', $client_id, $params); @@ -88,7 +88,7 @@ class remoting_server extends remoting { public function server_ip_update($session_id, $client_id, $ip_id, $params) { if(!$this->checkPerm($session_id, 'server_ip_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php', $client_id, $ip_id, $params); @@ -99,7 +99,7 @@ class remoting_server extends remoting { public function server_ip_delete($session_id, $ip_id) { if(!$this->checkPerm($session_id, 'server_ip_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php', $ip_id); @@ -118,7 +118,7 @@ class remoting_server extends remoting { public function server_get($session_id, $server_id = null, $section ='') { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($session_id)) { @@ -155,7 +155,7 @@ class remoting_server extends remoting { public function server_config_set($session_id, $server_id, $section, $key, $value) { global $app; if(!$this->checkPerm($session_id, 'server_config_set')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($server_id) && $server_id > 0 && $section != '' && $key != '') { @@ -165,7 +165,7 @@ class remoting_server extends remoting { $server_config_str = $app->ini_parser->get_ini_string($server_config_array); return $app->db->datalogUpdate('server', array("config" => $server_config_str), 'server_id', $server_id); } else { - throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.'); + throw new ISPConfigRemoteException('invalid_function_parameter', 'Invalid function parameter.'); return false; } } @@ -180,7 +180,7 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($session_id)) { @@ -202,8 +202,7 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); } if (!empty($session_id) && !empty($server_name)) { $sql = "SELECT server_id FROM server WHERE server_name = ?"; @@ -224,13 +223,23 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); } if (!empty($session_id) && !empty($server_id)) { - $sql = "SELECT mail_server, web_server, dns_server, file_server, db_server, vserver_server, proxy_server, firewall_server, xmpp_server, mirror_server_id FROM server WHERE server_id = ?"; + $sql = "SELECT * FROM server WHERE server_id = ?"; $all = $app->db->queryOneRecord($sql, $server_id); - return $all; + if(empty($all)) return false; + + $func = array(); + foreach($all as $key => $value) { + if($key === 'mirror_server_id' || substr($key, -7) === '_server') { + if(is_numeric($value)) { + $func[$key] = $value; + } + } + } + + return $func; } else { return false; } @@ -240,8 +249,7 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); - return false; + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); } if (!empty($session_id)) { if($server_id == 0) $ispc_app_version = array('ispc_app_version' => ISPC_APP_VERSION); @@ -261,7 +269,7 @@ class remoting_server extends remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); } if (!empty($session_id) && !empty($server_id) && !empty($php)) { $php_versions = array(); @@ -269,7 +277,7 @@ class remoting_server extends remoting { $web_config[$server_id] = $app->getconf->get_server_config($server_id, 'web'); $server_type = !empty($web_config[$server_id]['server_type']) ? $web_config[$server_id]['server_type'] : 'apache'; - if ($php === 'php-fpm' || ($php === 'hhvm' && $server_type === 'nginx')) { + if ($php === 'php-fpm') { $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0)", $server_id); foreach ($php_records as $php_record) { $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php index cc7a2eca4eb363f7ba3df447aec086dede670dab..56f10eb07169f39f444616e49a1b33982ccebf28 100644 --- a/interface/lib/classes/remote.d/sites.inc.php +++ b/interface/lib/classes/remote.d/sites.inc.php @@ -47,7 +47,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_cron_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -59,7 +59,7 @@ class remoting_sites extends remoting { public function sites_cron_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_cron_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/cron.tform.php', $client_id, $params); @@ -69,7 +69,7 @@ class remoting_sites extends remoting { public function sites_cron_update($session_id, $client_id, $cron_id, $params) { if(!$this->checkPerm($session_id, 'sites_cron_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/cron.tform.php', $client_id, $cron_id, $params); @@ -80,7 +80,7 @@ class remoting_sites extends remoting { public function sites_cron_delete($session_id, $cron_id) { if(!$this->checkPerm($session_id, 'sites_cron_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/cron.tform.php', $cron_id); @@ -95,7 +95,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -110,14 +110,14 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } //* Check for duplicates $tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = ? AND server_id = ?", $params['database_name'], $params["server_id"]); if($tmp['dbnum'] > 0) { - throw new SoapFault('database_name_error_unique', 'There is already a database with that name on the same server.'); + throw new ISPConfigRemoteException('database_name_error_unique', 'There is already a database with that name on the same server.'); return false; } @@ -151,7 +151,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -183,7 +183,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_database_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -202,7 +202,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -214,7 +214,7 @@ class remoting_sites extends remoting { public function sites_database_user_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_database_user_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -227,7 +227,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -257,7 +257,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_database_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -285,7 +285,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -297,7 +297,7 @@ class remoting_sites extends remoting { public function sites_ftp_user_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/ftp_user.tform.php', $client_id, $params); @@ -307,7 +307,7 @@ class remoting_sites extends remoting { public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php', $client_id, $primary_id, $params); @@ -318,7 +318,7 @@ class remoting_sites extends remoting { public function sites_ftp_user_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php', $primary_id); @@ -331,7 +331,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_ftp_user_server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -353,7 +353,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_shell_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -365,7 +365,7 @@ class remoting_sites extends remoting { public function sites_shell_user_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_shell_user_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/shell_user.tform.php', $client_id, $params); @@ -375,7 +375,7 @@ class remoting_sites extends remoting { public function sites_shell_user_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_shell_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php', $client_id, $primary_id, $params); @@ -386,7 +386,7 @@ class remoting_sites extends remoting { public function sites_shell_user_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php', $primary_id); @@ -416,7 +416,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_domain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -429,7 +429,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_web_domain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -460,7 +460,7 @@ class remoting_sites extends remoting { public function sites_web_domain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_domain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -480,7 +480,7 @@ class remoting_sites extends remoting { public function sites_web_domain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_vhost_domain.tform.php', $primary_id); @@ -495,7 +495,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -508,7 +508,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -532,7 +532,7 @@ class remoting_sites extends remoting { public function sites_web_vhost_aliasdomain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -552,7 +552,7 @@ class remoting_sites extends remoting { public function sites_web_vhost_aliasdomain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_vhost_domain.tform.php', $primary_id); @@ -567,7 +567,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -580,7 +580,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -604,7 +604,7 @@ class remoting_sites extends remoting { public function sites_web_vhost_subdomain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -624,7 +624,7 @@ class remoting_sites extends remoting { public function sites_web_vhost_subdomain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_vhost_domain.tform.php', $primary_id); @@ -639,7 +639,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -651,7 +651,7 @@ class remoting_sites extends remoting { public function sites_web_aliasdomain_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/web_childdomain.tform.php', $client_id, $params); @@ -661,7 +661,7 @@ class remoting_sites extends remoting { public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/web_childdomain.tform.php', $client_id, $primary_id, $params); @@ -672,7 +672,7 @@ class remoting_sites extends remoting { public function sites_web_aliasdomain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_childdomain.tform.php', $primary_id); @@ -687,7 +687,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -699,7 +699,7 @@ class remoting_sites extends remoting { public function sites_web_subdomain_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/web_childdomain.tform.php', $client_id, $params); @@ -709,7 +709,7 @@ class remoting_sites extends remoting { public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/web_childdomain.tform.php', $client_id, $primary_id, $params); @@ -720,7 +720,7 @@ class remoting_sites extends remoting { public function sites_web_subdomain_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_childdomain.tform.php', $primary_id); @@ -735,7 +735,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_folder_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -747,7 +747,7 @@ class remoting_sites extends remoting { public function sites_web_folder_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_folder_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/web_folder.tform.php', $client_id, $params); @@ -757,7 +757,7 @@ class remoting_sites extends remoting { public function sites_web_folder_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_folder_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php', $client_id, $primary_id, $params); @@ -769,7 +769,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_web_folder_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -793,7 +793,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_folder_user_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $app->uses('remoting_lib'); @@ -805,7 +805,7 @@ class remoting_sites extends remoting { public function sites_web_folder_user_add($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_folder_user_add')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->insertQuery('../sites/form/web_folder_user.tform.php', $client_id, $params); @@ -815,7 +815,7 @@ class remoting_sites extends remoting { public function sites_web_folder_user_update($session_id, $client_id, $primary_id, $params) { if(!$this->checkPerm($session_id, 'sites_web_folder_user_update')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php', $client_id, $primary_id, $params); @@ -826,7 +826,7 @@ class remoting_sites extends remoting { public function sites_web_folder_user_delete($session_id, $primary_id) { if(!$this->checkPerm($session_id, 'sites_web_folder_user_delete')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php', $primary_id); @@ -846,7 +846,7 @@ class remoting_sites extends remoting { public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) { global $app; if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $sys_userid = $app->functions->intval($sys_userid); @@ -861,7 +861,7 @@ class remoting_sites extends remoting { if(isset($result)) { return $result; } else { - throw new SoapFault('no_client_found', 'There is no site for this user'); + throw new ISPConfigRemoteException('no_client_found', 'There is no site for this user'); return false; } } @@ -879,7 +879,7 @@ class remoting_sites extends remoting { public function sites_web_domain_set_status($session_id, $primary_id, $status) { global $app; if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if(in_array($status, array('active', 'inactive'))) { @@ -895,7 +895,7 @@ class remoting_sites extends remoting { $affected_rows = $this->updateQuery('../sites/form/web_vhost_domain.tform.php', 0, $primary_id, $params); return $affected_rows; } else { - throw new SoapFault('status_undefined', 'The status is not available'); + throw new ISPConfigRemoteException('status_undefined', 'The status is not available'); return false; } } @@ -923,7 +923,7 @@ class remoting_sites extends remoting { { global $app; if(!$this->checkPerm($session_id, 'sites_database_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } $client_id = $app->functions->intval($client_id); @@ -938,7 +938,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_domain_backup')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -952,7 +952,7 @@ class remoting_sites extends remoting { global $app; if(!$this->checkPerm($session_id, 'sites_web_domain_backup')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -966,19 +966,19 @@ class remoting_sites extends remoting { //* Basic validation of variables if ($server_id <= 0) { - throw new SoapFault('invalid_backup_id', "Invalid or non existant backup_id $primary_id"); + throw new ISPConfigRemoteException('invalid_backup_id', "Invalid or non existant backup_id $primary_id"); return false; } if ($action_type != 'backup_download' and $action_type != 'backup_restore' and $action_type != 'backup_delete') { - throw new SoapFault('invalid_action', "Invalid action_type $action_type"); + throw new ISPConfigRemoteException('invalid_action', "Invalid action_type $action_type"); return false; } //* Validate instance $instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`= ? and `action_type`= ? and `action_state`= ?", $primary_id, $action_type, 'pending'); if ($instance_record['action_id'] >= 1) { - throw new SoapFault('duplicate_action', "There is already a pending $action_type action"); + throw new ISPConfigRemoteException('duplicate_action', "There is already a pending $action_type action"); return false; } @@ -997,7 +997,7 @@ class remoting_sites extends remoting { $app->uses('quota_lib'); if(!$this->checkPerm($session_id, 'quota_get_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } @@ -1010,7 +1010,7 @@ class remoting_sites extends remoting { $app->uses('quota_lib'); if(!$this->checkPerm($session_id, 'trafficquota_get_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if ($client_id != null) @@ -1025,7 +1025,7 @@ class remoting_sites extends remoting { $app->uses('quota_lib'); if(!$this->checkPerm($session_id, 'trafficquota_get_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if ($client_id != null) @@ -1040,7 +1040,7 @@ class remoting_sites extends remoting { $app->uses('quota_lib'); if(!$this->checkPerm($session_id, 'databasequota_get_by_user')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 8522ebc6fd802cd07ebd32936b5359de22d27ad8..0e0b1370f2c3c7e2a43aa8680f3344b0c0634a75 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -206,7 +206,7 @@ class remoting { fwrite($authlog_handle, $authlog ."\n"); fclose($authlog_handle); - throw new SoapFault($error['faultcode'], $error['faultstring']); + throw new ISPConfigRemoteException($error['faultcode'], $error['faultstring']); return false; } else { // User login right, so attempts can be deleted @@ -231,7 +231,7 @@ class remoting { global $app; if(empty($session_id)) { - throw new SoapFault('session_id_empty', 'The SessionID is empty.'); + throw new ISPConfigRemoteException('session_id_empty', 'The SessionID is empty.'); return false; } @@ -265,14 +265,14 @@ class remoting { //* Stop on error while preparing the sql query if($app->remoting_lib->errorMessage != '') { - throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage); + throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage); return false; } //* Execute the SQL query $app->db->query($sql); if($app->db->errorMessage != '') { - throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql); + throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql); return false; } if ( isset($params['_primary_id'] )) @@ -283,7 +283,7 @@ class remoting { //* Stop on error while executing the sql query if($app->remoting_lib->errorMessage != '') { - throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage); + throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage); return false; } @@ -294,7 +294,7 @@ class remoting { /* if($app->db->errorMessage != '') { - throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql); + throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql); return false; } */ @@ -345,7 +345,7 @@ class remoting { //* Get the SQL query $sql = $app->remoting_lib->getSQL($params, 'INSERT', 0); if($app->remoting_lib->errorMessage != '') { - throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage); + throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage); return false; } $app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG); @@ -361,7 +361,7 @@ class remoting { $app->db->query($sql); if($app->db->errorMessage != '') { - throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql); + throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql); return false; } @@ -407,7 +407,7 @@ class remoting { $app->remoting_lib->loadFormDef($formdef_file); //* get old record and merge with params, so only new values have to be set in $params - $old_rec = $app->remoting_lib->getDataRecord($primary_id); + $old_rec = $app->remoting_lib->getDataRecord($primary_id, $client_id); foreach ($app->remoting_lib->formDef['fields'] as $fieldName => $fieldConf) { @@ -421,9 +421,9 @@ class remoting { //* Get the SQL query $sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id); - // throw new SoapFault('debug', $sql); + // throw new ISPConfigRemoteException('debug', $sql); if($app->remoting_lib->errorMessage != '') { - throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage); + throw new ISPConfigRemoteException('data_processing_error', $app->remoting_lib->errorMessage); return false; } @@ -446,7 +446,7 @@ class remoting { $app->db->query($sql); if($app->db->errorMessage != '') { - throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql); + throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql); return false; } @@ -492,7 +492,7 @@ class remoting { $affected_rows = $app->db->affectedRows(); if($app->db->errorMessage != '') { - throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql); + throw new ISPConfigRemoteException('database_error', $app->db->errorMessage . ' '.$sql); return false; } @@ -543,7 +543,7 @@ class remoting { global $app; if(empty($session_id)) { - throw new SoapFault('session_id_empty', 'The SessionID is empty.'); + throw new ISPConfigRemoteException('session_id_empty', 'The SessionID is empty.'); return false; } @@ -552,7 +552,7 @@ class remoting { if($session['remote_userid'] > 0) { return $session; } else { - throw new SoapFault('session_does_not_exist', 'The Session is expired or does not exist.'); + throw new ISPConfigRemoteException('session_does_not_exist', 'The Session is expired or does not exist.'); return false; } } @@ -560,7 +560,7 @@ class remoting { public function server_get($session_id, $server_id = null, $section ='') { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($session_id)) { @@ -594,7 +594,7 @@ class remoting { { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } if (!empty($session_id)) { @@ -617,7 +617,7 @@ class remoting { public function get_function_list($session_id) { if(!$this->checkPerm($session_id, 'get_function_list')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->_methods; diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php index 0f313de6bded35da1314350a971861a9609f276c..32e9543b2a8aa5d34f7ac3f2b05eb4bf8b85d275 100644 --- a/interface/lib/classes/remoting_lib.inc.php +++ b/interface/lib/classes/remoting_lib.inc.php @@ -225,10 +225,10 @@ class remoting_lib extends tform_base { return $sql; } - function getDataRecord($primary_id) { + function getDataRecord($primary_id, $client_id = 0) { global $app; $escape = '`'; - $this->loadUserProfile(); + $this->loadUserProfile($client_id); if(@is_numeric($primary_id)) { if($primary_id > 0) { // Return a single record @@ -238,7 +238,7 @@ class remoting_lib extends tform_base { $sql = "SELECT * FROM ??"; return $app->db->queryAllRecords($sql, $this->formDef['db_table']); } else { - throw new SoapFault('invalid_id', 'The ID has to be > 0 or -1.'); + throw new ISPConfigRemoteException('invalid_id', 'The ID has to be > 0 or -1.'); return array(); } } elseif (@is_array($primary_id) || @is_object($primary_id)) { @@ -308,7 +308,9 @@ class remoting_lib extends tform_base { global $app; $username = $params["username"]; $clear_password = $params["password"]; + $language = $params['language']; $client_id = $app->functions->intval($client_id); + if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($clear_password)); else $password = $clear_password; $params = array($username); @@ -318,8 +320,15 @@ class remoting_lib extends tform_base { } else { $pwstring ="" ; } + + $langstring = ''; + if (!empty($language)) { + $langstring = ', language = ?'; + $params[] = $language; + } + $params[] = $client_id; - $sql = "UPDATE sys_user set username = ? $pwstring WHERE client_id = ?"; + $sql = "UPDATE sys_user set username = ? $pwstring $langstring WHERE client_id = ?"; $app->db->query($sql, true, $params); } diff --git a/interface/lib/classes/rest_handler.inc.php b/interface/lib/classes/rest_handler.inc.php index ceaa7c63be32fc95198769c0398a6f46cc1e4b31..ebca73c40ecc683104e52bbedec668d318b46d74 100644 --- a/interface/lib/classes/rest_handler.inc.php +++ b/interface/lib/classes/rest_handler.inc.php @@ -173,11 +173,17 @@ class ISPConfigRESTHandler { try { $this->_return_json($return_code, call_user_func_array(array($this->classes[$class_name], $method), $params)); - } catch(SoapFault $e) { + } catch(ISPConfigRemoteException $e) { $this->_return_error(500, 'REQUEST ERROR', $e->getMessage()); } } } -?> +if(!class_exists('ISPConfigRemoteException')) { + class ISPConfigRemoteException extends Exception { + public function __construct($code = '', $message = '') { + parent::__construct($message . ' (' . $code . ')', 0); + } + } +} \ No newline at end of file diff --git a/interface/lib/classes/searchform.inc.php b/interface/lib/classes/searchform.inc.php deleted file mode 100644 index 0a290c1d699bcae630af474c76190d92f5ec1d42..0000000000000000000000000000000000000000 --- a/interface/lib/classes/searchform.inc.php +++ /dev/null @@ -1,349 +0,0 @@ -listDef = $liste; - $this->module = $module; - - //* Fill datasources - foreach($this->listDef['item'] as $key => $field) { - if(is_array($field['datasource'])) { - $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field); - } - } - return true; - } - - /** - * Get the key => value array of a form filed from a datasource definitiom - * - * @param field = array with field definition - * @param record = Dataset as array - * @return key => value array for the value field of a form - */ - - - public function getDatasourceData($field) - { - global $app; - $values = array(); - - if($field['datasource']['type'] == 'SQL') { - //* Preparing SQL string. We will replace some common placeholders - $querystring = $field['datasource']['querystring']; - $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring); - $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring); - $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring); - $table_idx = $this->formDef['db_table_idx']; - //$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring); - $app->uses('tform'); - $querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring); - - //* Getting the records - $tmp_records = $app->db->queryAllRecords($querystring); - if($app->db->errorMessage != ''){ - die($app->db->errorMessage); - } - if(is_array($tmp_records)) { - $key_field = $field['datasource']['keyfield']; - $value_field = $field['datasource']['valuefield']; - foreach($tmp_records as $tmp_rec) { - $values[$tmp_rec[$key_field]] = $tmp_rec[$value_field]; - } - } - } - if($field['datasource']['type'] == 'CUSTOM') { - //* Calls a custom class to validate this record - if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') { - $datasource_class = $field['datasource']['class']; - $datasource_function = $field['datasource']['function']; - $app->uses($datasource_class); - $record = array(); - $values = $app->$datasource_class->$datasource_function($field, $record); - }else{ - $this->errorMessage .= "Custom datasource class or function is empty
\r\n"; - } - } - return $values; - } - - public function getSearchSQL($sql_where = '') - { - global $db; - - //* Config vars - $list_name = $this->listDef['name']; - $search_prefix = $this->listDef['search_prefix']; - - //* store retrieval query - foreach($this->listDef['item'] as $i) { - $field = $i['field']; - - //* TODO ? hat sich die suche ge�ndert - has itself search ? - $ki = $search_prefix.$field; - if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){ - $this->searchChanged = 1; - } - - //* suchfield in session store. - if(isset($_REQUEST[$ki])){ - $_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki]; - } - - if($i['formtype'] == 'SELECT'){ - if(is_array($i['value'])) { - $out = ''; - foreach($i['value'] as $k => $v) { - $selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : ''; - $out .= "\r\n"; - } - } - $this->searchValues[$ki] = $out; - }else{ - $this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki]; - } - } - - //* store variables in object. $this->searchValues = $_SESSION["search"][$list_name]; - foreach($this->listDef['item'] as $i) { - $field = $i['field']; - //if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and"; - if($_SESSION['search'][$list_name][$ki] != ''){ - $sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and"; - } - } - return ($sql_where != '') ? substr($sql_where, 0, -3) : '1'; - } - - public function getPagingSQL($sql_where = '1') { - global $app, $conf; - - $list_name = $this->listDef['name']; - $search_prefix = $this->listDef['search_prefix']; - $records_per_page = $this->listDef['records_per_page']; - $table = $this->listDef['table']; - - //* set page to seror id session not set - if($_SESSION['search'][$list_name]['page'] == '') $_SESSION['search'][$list_name]['page'] = 0; - - //* Set page size to request if set - if(isset($_REQUEST['page'])) $_SESSION['search'][$list_name]['page'] = $_REQUEST['page']; - - //* TODO PAGE to 0 set, if look for themselves ge?ndert. = page auf 0 setzen, wenn suche sich ge�ndert hat. - if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0; - - $sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page; - $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM ?? WHERE $sql_where", $table); - $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page); - - $vars['list_file'] = $this->listDef['file']; - $vars['page'] = $_SESSION['search'][$list_name]['page']; - $vars['last_page'] = $_SESSION['search'][$list_name]['page'] - 1; - $vars['next_page'] = $_SESSION['search'][$list_name]['page'] + 1; - $vars['pages'] = $pages; - $vars['max_pages'] = $pages + 1; - $vars['records_gesamt'] = $record_count['anzahl']; - $vars['page_params'] = $this->listDef['page_params']; - - if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1; - if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1; - - $this->pagingValues = $vars; - $this->pagingHTML = $this->getPagingHTML($vars); - - return "LIMIT $sql_von, $records_per_page"; - } - - public function getPagingHTML($vars) { - global $app; - $page_params = $vars['page_params']; - $list_file = $vars['list_file']; - $content = '   '; - if($vars['show_page_back'] == 1){ - $content .= ' '; - } - $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' '; - if($vars['show_page_next'] == 1){ - $content .= '   '; - } else{ - $content .= ' '; - } - $content .= ' '; - return $content; - } - - public function getPagingHTMLasTXT($vars) - { - global $app; - $page_params = $vars['page_params']; - $list_file = $vars['list_file']; - $content = '[|<< ]'; - if($vars['show_page_back'] == 1){ - $content .= '[<< '.$app->lng('Back').'] '; - } - $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' '; - if($vars['show_page_next'] == 1){ - $content .= '['.$app->lng('Next').' >>] '; - } - $content .= '[ >>|]'; - return $content; - } - - public function getSortSQL() - { - $sort_field = $this->listDef['sort_field']; - $sort_direction = $this->listDef['sort_direction']; - return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : ''; - } - - public function saveSearchSettings($searchresult_name) - { - global $app, $conf; - - $list_name = $this->listDef['name']; - $settings = $_SESSION['search'][$list_name]; - unset($settings['page']); - $data = serialize($settings); - - $userid = $_SESSION['s']['user']['userid']; - $groupid = $_SESSION['s']['user']['default_group']; - $sys_perm_user = 'riud'; - $sys_perm_group = 'r'; - $sys_perm_other = ''; - $module = $_SESSION['s']['module']['name']; - $searchform = $this->listDef['name']; - $title = $searchresult_name; - - $sql = 'INSERT INTO `searchform` ( ' - .'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` ' - .')VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)'; - $app->db->query($sql, $userid, $groupid, $sys_perm_user, $sys_perm_group, $sys_perm_other, $module, $searchform, $title, $data); - } - - public function decode($record) - { - global $app; - if(is_array($record)) { - foreach($this->listDef['item'] as $field) { - $key = $field['field']; - switch ($field['datatype']) - { - case 'DATE': - if($val > 0) { - $record[$key] = date($this->dateformat, $record[$key]); - } - break; - - case 'INTEGER': - $record[$key] = $app->functions->intval($record[$key]); - break; - - case 'DOUBLE': - $record[$key] = $record[$key]; - break; - - case 'CURRENCY': - $record[$key] = number_format($record[$key], 2, ',', ''); - break; - - - case 'VARCHAR': - case 'TEXT': - default: - $record[$key] = stripslashes($record[$key]); - break; - } - } - } - return $record; - } - - /* TODO: check for double quoting mysql value */ - public function encode($record) - { - global $app; - if(is_array($record)) { - foreach($this->listDef['item'] as $field) { - $key = $field['field']; - switch ($field['datatype']) - { - case 'VARCHAR': - case 'TEXT': - if(!is_array($record[$key])) { - $record[$key] = $app->db->quote($record[$key]); - } else { - $record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]); - } - break; - - case 'DATE': - if($record[$key] > 0) { - list($tag, $monat, $jahr) = explode('.', $record[$key]); - $record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr); - } - break; - - case 'INTEGER': - $record[$key] = $app->functions->intval($record[$key]); - break; - - case 'DOUBLE': - $record[$key] = $app->db->quote($record[$key]); - break; - - case 'CURRENCY': - $record[$key] = str_replace(',', '.', $record[$key]); - break; - } - } - } - return $record; - } - -} - -?> diff --git a/interface/lib/classes/searchform_actions.inc.php b/interface/lib/classes/searchform_actions.inc.php deleted file mode 100644 index e48eb8544de5bfbfe2c5efd2fd419ba1eb184e08..0000000000000000000000000000000000000000 --- a/interface/lib/classes/searchform_actions.inc.php +++ /dev/null @@ -1,202 +0,0 @@ -tpl)) $app->uses('tpl'); - if(!is_object($app->searchform)) $app->uses('searchform'); - if(!is_object($app->tform)) $app->uses('tform'); - - // Load list definition - $app->searchform->loadListDef($list_def_file); - - // Delete the search form contents, if requested - if($_REQUEST["empty_searchfields"] == 'yes') { - $list_name = $app->searchform->listDef["name"]; - unset($_SESSION["search"][$list_name]); - } - - // Save the search for later usage - if($_REQUEST["btn_submit_search_save"] && $_REQUEST["search_save_as"] != '') { - $app->searchform->saveSearchSettings($_REQUEST["search_save_as"]); - } - - // Set th returnto value for forms - $_SESSION["s"]["form"]["return_to_url"] = $app->searchform->listDef["file"]; - - if(!is_file('templates/'.$app->searchform->listDef["name"].'_search.htm')) { - $app->uses('searchform_tpl_generator'); - $app->searchform_tpl_generator->buildHTML($app->searchform->listDef); - } - - $app->tpl->newTemplate("searchpage.tpl.htm"); - $app->tpl->setInclude('content_tpl', 'templates/'.$app->searchform->listDef["name"].'_search.htm'); - - // Getting Datasets from DB - $records = $app->db->queryAllRecords($this->getQueryString()); - - - $this->DataRowColor = "#FFFFFF"; - if(is_array($records)) { - $this->idx_key = $app->searchform->listDef["table_idx"]; - foreach($records as $rec) { - $records_new[] = $this->prepareDataRow($rec); - } - } - - $app->tpl->setLoop('records', $records_new); - - //print_r($records_new); - - $this->onShow(); - - - } - - function prepareDataRow($rec) { - global $app; - - $rec = $app->searchform->decode($rec); - - // Alternating datarow colors - $this->DataRowColor = ($this->DataRowColor == "#FFFFFF")?"#EEEEEE":"#FFFFFF"; - $rec["bgcolor"] = $this->DataRowColor; - - // substitute value for select fields - foreach($app->searchform->listDef["item"] as $field) { - $key = $field["field"]; - if($field['formtype'] == "SELECT") { - if($rec[$key] == 'y' or $rec[$key] == 'n') { - // Set a additional image variable for bolean fields - $rec['_'.$key.'_'] = ($rec[$key] == 'y')?'list_icon_true.png':'list_icon_false.png'; - } - // substitute value for select field - $rec[$key] = $field['value'][$rec[$key]]; - } - } - - // The variable "id" contains always the index variable - $rec["id"] = $rec[$this->idx_key]; - - return $rec; - } - - function getQueryString() { - global $app; - - // Generate the search sql - if($app->searchform->listDef["auth"] != 'no') { - if($_SESSION["s"]["user"]["typ"] == "admin") { - $sql_where = ""; - } else { - $sql_where = $app->tform->getAuthSQL('r')." and"; - } - } - - if($this->SQLExtWhere != '') { - $sql_where .= " ".$this->SQLExtWhere." and"; - } - - $sql_where = $app->searchform->getSearchSQL($sql_where); - $app->tpl->setVar($app->searchform->searchValues); - - $order_by_sql = $this->SQLOrderBy; - - // Generate SQL for paging - $limit_sql = $app->searchform->getPagingSQL($sql_where); - $app->tpl->setVar("paging", $app->searchform->pagingHTML); - - return "SELECT * FROM ".$app->searchform->listDef["table"]." WHERE $sql_where $order_by_sql $limit_sql"; - - } - - - function onShow() { - global $app; - - // Language File setzen - $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/'.$_SESSION['s']['language'].'_list.lng'; - if(!file_exists($lng_file)) $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/en_'.'_list.lng'; - include $lng_file; - $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->searchform->listDef['name']."_search.lng"; - if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$app->searchform->listDef['name']."_search.lng"; - include $lng_file; - $app->tpl->setVar($wb); - $app->tpl->setVar("form_action", $app->searchform->listDef["file"]); - - // Parse the templates and send output to the browser - $this->onShowEnd(); - } - - function onShowEnd() { - global $app; - - if(count($_REQUEST) > 0) { - $app->tpl->setVar('searchresult_visible', 1); - if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible', 0); - - if($_REQUEST['searchform_visible'] == 'yes') { - $app->tpl->setVar('searchform_visible', 1); - } else { - $app->tpl->setVar('searchform_visible', 0); - } - } else { - $app->tpl->setVar('searchform_visible', 1); - if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible', 0); - - if($_REQUEST['searchresult_visible'] == 'yes') { - $app->tpl->setVar('searchresult_visible', 1); - } else { - $app->tpl->setVar('searchresult_visible', 0); - } - } - - // make columns visible - $visible_columns = explode(",", $app->searchform->listDef['default_columns']); - foreach($visible_columns as $col) { - $app->tpl->setVar($col.'_visible', 1); - } - - $app->tpl_defaults(); - $app->tpl->pparse(); - } - -} - -?> diff --git a/interface/lib/classes/searchform_tpl_generator.inc.php b/interface/lib/classes/searchform_tpl_generator.inc.php deleted file mode 100644 index 81e2f4ef1a6ee42c0b948c64742b958faf1a4007..0000000000000000000000000000000000000000 --- a/interface/lib/classes/searchform_tpl_generator.inc.php +++ /dev/null @@ -1,136 +0,0 @@ - -

- -'; - - $lang["list_head_txt"] = $listDef["name"]; - foreach($listDef["item"] as $field) { - $key = $field["field"]; - - if($field["formtype"] == 'SELECT') { - $html .= " - - - - "; - } else { - $html .= " - - - - "; - } - } - - $html .= ' - - - -
:
:
-
- -

-[Neue Suche] -[Suchkriterien ändern] -Suche speichern unter: -

- - -'; - - $lang["list_head_txt"] = $listDef["name"]; - foreach($listDef["item"] as $field) { - $key = $field["field"]; - $html .= ""; - $html .= " \r\n"; - $html .= ""; - $lang[$key."_txt"] = $key; - } - - $html .= ' - - - -'; - - foreach($listDef["item"] as $field) { - $key = $field["field"]; - $html .= ""; - $html .= " \r\n"; - $html .= ""; - } - - $html .= " - - -"; - $html .= ' -
 
{tmpl_var name=\"".$key."\"}[{tmpl_var name='delete_txt'}]
- - - -
-
-'; - - if($module == '') { - $filename = 'templates/'.$listDef["name"].'_search.htm'; - } else { - $filename = '../'.$module.'/templates/'.$listDef["name"].'_search.htm'; - } - - - // speichere Template - if (!$handle = fopen($filename, 'w')) { - print "Cannot open file ($filename)"; - exit; - } - - if (!fwrite($handle, $html)) { - print "Cannot write to file ($filename)"; - exit; - } - fclose($handle); - - } - -} - -?> diff --git a/interface/lib/classes/session.inc.php b/interface/lib/classes/session.inc.php index f4a90beda9ae46276598d9381e0206dcf0e3ac4c..3e93cd4314faded0b1f32e7a0e0b094a183de693 100644 --- a/interface/lib/classes/session.inc.php +++ b/interface/lib/classes/session.inc.php @@ -36,7 +36,11 @@ class session { private $permanent = false; function __construct($session_timeout = 0) { - $this->db = new db; + try { + $this->db = new db; + } catch (Exception $e) { + $this->db = false; + } $this->timeout = $session_timeout; } diff --git a/interface/lib/classes/soap_handler.inc.php b/interface/lib/classes/soap_handler.inc.php index 704e21b20ba282fc45d661dd2d1b78c66981e0ba..31221bcfe5a67c6db616ceecb780bc13535cfe18 100644 --- a/interface/lib/classes/soap_handler.inc.php +++ b/interface/lib/classes/soap_handler.inc.php @@ -71,25 +71,31 @@ class ISPConfigSoapHandler { public function __call($method, $params) { if(array_key_exists($method, $this->methods) == false) { - throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist'); + throw new ISPConfigRemoteException('invalid_method', 'Method ' . $method . ' does not exist'); } $class_name = $this->methods[$method]; if(array_key_exists($class_name, $this->classes) == false) { - throw new SoapFault('invalid_class', 'Class ' . $class_name . ' does not exist'); + throw new ISPConfigRemoteException('invalid_class', 'Class ' . $class_name . ' does not exist'); } if(method_exists($this->classes[$class_name], $method) == false) { - throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')'); + throw new ISPConfigRemoteException('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')'); } try { return call_user_func_array(array($this->classes[$class_name], $method), $params); - } catch(SoapFault $e) { + } catch(ISPConfigRemoteException $e) { throw $e; } } } -?> +if(!class_exists('ISPConfigRemoteException')) { + class ISPConfigRemoteException extends SoapFault { + public function __construct($code = '', $message = '') { + parent::__construct($code, $message); + } + } +} diff --git a/interface/lib/classes/system.inc.php b/interface/lib/classes/system.inc.php index cef9424a75d61203e57060fb8aee39eb85a14435..7107228278d969c6218b39c44376f41e89e2d3c9 100644 --- a/interface/lib/classes/system.inc.php +++ b/interface/lib/classes/system.inc.php @@ -41,7 +41,7 @@ class system { // simple query cache if($this->client_service===null) - $this->client_service = $app->db->queryOneRecord("SELECT client.* FROM sys_user, client WHERE sys_user.userid = ? AND sys_user.client_id = client.client_id", $userid); + $this->client_service = $app->db->queryOneRecord("SELECT client.* FROM sys_user, client WHERE sys_user.userid = ? AND sys_user.client_id = client.client_id", $userid); // isn't service if(!$this->client_service) return false; diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index b28e50322454c93df811dc94a70549d0a23931a2..920541cacc9cc9eb71c8051c1660467de43d1094 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -132,20 +132,25 @@ class tform extends tform_base { function isReadonlyTab($tab, $primary_id) { global $app, $conf; + + if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true) { - // Add backticks for incomplete table names. - if(stristr($this->formDef['db_table'], '.')) { - $escape = ''; - } else { - $escape = '`'; - } + // Add backticks for incomplete table names. + if(stristr($this->formDef['db_table'], '.')) { + $escape = ''; + } else { + $escape = '`'; + } - $sql = "SELECT sys_userid FROM ?? WHERE ?? = ?"; - $record = $app->db->queryOneRecord($sql, $this->formDef['db_table'], $this->formDef['db_table_idx'], $primary_id); + $sql = "SELECT sys_userid FROM ?? WHERE ?? = ?"; + $record = $app->db->queryOneRecord($sql, $this->formDef['db_table'], $this->formDef['db_table_idx'], $primary_id); - // return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record. - if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) { - return true; + // return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record. + if($record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) { + return true; + } else { + return false; + } } else { return false; } diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index 12583e210dbf951a0b659f99ac68293e9d29b623..c3afbf35356f9db6e6e78dc5aa044fdc984ff6f4 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -134,7 +134,7 @@ class tform_base { $this->module = $module; $wb = array(); - include_once ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng'; + include_once ISPC_ROOT_PATH.'/lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'.lng'; if(is_array($wb)) $wb_global = $wb; @@ -143,7 +143,7 @@ class tform_base { if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng"; include $lng_file; } else { - $lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng"; + $lng_file = "../$module/lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_".$this->formDef["name"].".lng"; if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng"; include $lng_file; } @@ -155,6 +155,66 @@ class tform_base { $this->wordbook = $wb; + // load wordbook/lang files from addons + if($module == '') { + $lng_path = 'lib/lang.d'; + } else { + $lng_path = '../' . $module . '/lib/lang.d'; + } + if(($dir = opendir($lng_path))) { + $fallback_files = array(); + $use_files = array(); + while(false !== ($cur = readdir($dir))) { + $lng_file = $lng_path . '/' . $cur; + if(is_file($lng_file) && substr($cur, -strlen('.'.$this->formDef["name"].".lng")) === '.'.$this->formDef["name"].".lng") { + if(substr($cur, 0, 3) === 'en_') { + $fallback_files[] = $cur; + } elseif(substr($cur, 0, 3) === $app->functions->check_language($_SESSION["s"]["language"]) . '_') { + $use_files[] = $cur; + } + } + } + closedir($dir); + + foreach($fallback_files as $cur) { + $cur_lng = $app->functions->check_language($_SESSION["s"]["language"]) . '_' . substr($cur, 3); + if(in_array($cur_lng, $use_files, true) == false) { + $use_files[] = $cur; + } + } + unset($fallback_files); + + reset($use_files); + foreach($use_files as $cur) { + $lng_file = $lng_path . '/' . $cur; + + include $lng_file; + if(isset($wb) && is_array($wb)) { + $this->wordbook = $app->functions->array_merge($this->wordbook, $wb); + } + } + unset($use_files); + } + + if($module != '') { + // load tform files from addons + $tform_path = '../' . $module . '/lib/form.d'; + if(($dir = opendir($tform_path))) { + $tabs = null; + while(false !== ($cur = readdir($dir))) { + $tform_file = $tform_path . '/' . $cur; + if(is_file($tform_file) && substr($cur, -strlen('.'.$this->formDef["name"].".tform.php")) === '.'.$this->formDef["name"].".tform.php") { + unset($tabs); // just in case someone does not create a new array in the tform file + include($tform_file); + if(isset($tabs) && is_array($tabs) && !empty($tabs)) { + $this->tform['tabs'] = array_replace_recursive($this->tform['tabs'], $tabs); + } + } + } + closedir($dir); + } + } + $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'] . ':on_after_formdef', $this); $this->dateformat = $app->lng('conf_format_dateshort'); @@ -1393,7 +1453,7 @@ class tform_base { } else { if($this->formDef['auth'] == 'yes') { if($primary_id != 0) { - if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["iserid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) { + if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["userid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) { $sql_update .= '`sys_userid` = '.$this->sys_userid.', '; $sql_update .= '`sys_groupid` = '.$this->sys_default_group.', '; } diff --git a/interface/lib/classes/tform_tpl_generator.inc.php b/interface/lib/classes/tform_tpl_generator.inc.php index f841a09a69f2a08e0c6e46dbdb6dc3cf59642b1d..f0d9649b9c8aed746d46177bf02ddc1e6d483038 100644 --- a/interface/lib/classes/tform_tpl_generator.inc.php +++ b/interface/lib/classes/tform_tpl_generator.inc.php @@ -298,7 +298,7 @@ class tform_tpl_generator { function lng_add($lang, $formDef) { global $go_api, $go_info, $conf; - $lng_file = "lib/lang/".$conf["language"]."_".$formDef['name'].".lng"; + $lng_file = "lib/lang/".$app->functions->check_language($conf["language"])."_".$formDef['name'].".lng"; if(is_file($lng_file)) { include $lng_file; } else { diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php index ce3ffca1eba13e81ab2565eb6665fb0e4da31201..1bb96f1699554c30b28e06b02f8c26dde7d676c4 100644 --- a/interface/lib/classes/tools_monitor.inc.php +++ b/interface/lib/classes/tools_monitor.inc.php @@ -504,39 +504,6 @@ class tools_monitor { return $html; } - function showMongoDB() { - global $app; - - /* fetch the Data from the DB */ - $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = ? ORDER BY created DESC", $_SESSION['monitor']['server_id']); - - if(isset($record['data'])) { - $html = - '
-
'; - - /* - * First, we have to detect, if there is any monitoring-data. - * If not (because mongodb is not installed) show this. - */ - $data = unserialize($record['data']); - if ($data == '') { - $html .= '

'. - 'MongoDB is not installed on this server.
' . - '

'; - } - else { - $html .= nl2br($data); - } - $html .= '
'; - - } else { - $html = '

There is no data available at the moment.

'; - } - - return $html; - } - function showIPTables() { global $app; $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = ? ORDER BY created DESC", $_SESSION['monitor']['server_id']); diff --git a/interface/lib/classes/validate_autoresponder.inc.php b/interface/lib/classes/validate_autoresponder.inc.php index 98d49fdf6d36bb43d61366690e903a3141e01f39..8fefa33b301ad707c3eca7ada45591122f979a6d 100755 --- a/interface/lib/classes/validate_autoresponder.inc.php +++ b/interface/lib/classes/validate_autoresponder.inc.php @@ -52,8 +52,9 @@ class validate_autoresponder extends validate_datetime //$start_date = $app->tform_actions->dataRecord['autoresponder_start_date']; // Parse date - $start_date_array = date_parse_from_format($app->lng('conf_format_datetime'),$start_date); - $end_date_array = date_parse_from_format($app->lng('conf_format_datetime'),$field_value); + $datetimeformat = (isset($app->remoting_lib) ? $app->remoting_lib->datetimeformat : $app->tform->datetimeformat); + $start_date_array = date_parse_from_format($datetimeformat,$start_date); + $end_date_array = date_parse_from_format($datetimeformat,$field_value); //calculate timestamps $start_date_tstamp = mktime($start_date_array['hour'], $start_date_array['minute'], $start_date_array['second'], $start_date_array['month'], $start_date_array['day'], $start_date_array['year']); diff --git a/interface/lib/classes/validate_client.inc.php b/interface/lib/classes/validate_client.inc.php index 4652e2a07b1ddc65f5776a4538ec34d4ab382db4..20050d8cb5d77e94bc2a5b0cdbf4004d6fab9da4 100644 --- a/interface/lib/classes/validate_client.inc.php +++ b/interface/lib/classes/validate_client.inc.php @@ -124,9 +124,6 @@ class validate_client { $used_servers = $app->db->queryAllRecords('SELECT domain_id FROM mail_domain INNER JOIN sys_user ON mail_domain.sys_userid = sys_user.userid WHERE client_id = ? AND server_id NOT IN ?', $client_id, $field_value); break; - case 'xmpp_servers': - $used_servers = $app->db->queryAllRecords('SELECT domain_id FROM xmpp_domain INNER JOIN sys_user ON xmpp_domain.sys_userid = sys_user.userid WHERE client_id = ? AND server_id NOT IN ?', $client_id, $field_value); - break; } if ($used_servers === null || count($used_servers)) @@ -196,7 +193,7 @@ class validate_client { } */ - } catch(SoapFault $e) { + } catch(ISPConfigRemoteException $e) { //echo 'Error, see message: '.$e->faultstring; switch ($e->faultstring) { case 'INVALID_INPUT': @@ -215,7 +212,7 @@ class validate_client { break; } } - } catch(SoapFault $e){ + } catch(ISPConfigRemoteException $e){ // Connection to host not possible, europe.eu down? // this shouldn't be the user's fault, so we return no error } diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php index 01293abd6dee259d722f64417c4bc311129bf935..57187805cf926289f450b31088cf3540b36a7fb8 100644 --- a/interface/lib/classes/validate_domain.inc.php +++ b/interface/lib/classes/validate_domain.inc.php @@ -191,7 +191,7 @@ class validate_domain { /* internal validator function to match regexp */ function _regex_validate($domain_name, $allow_wildcard = false) { - $pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/'; + $pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{1,255}\.[a-zA-Z0-9\-]{2,30}$/'; return preg_match($pattern, $domain_name); } diff --git a/interface/lib/classes/validate_openvz.inc.php b/interface/lib/classes/validate_openvz.inc.php deleted file mode 100644 index 4aa1a709c7f28d9267cb734b9bd0ca51f3c968bf..0000000000000000000000000000000000000000 --- a/interface/lib/classes/validate_openvz.inc.php +++ /dev/null @@ -1,66 +0,0 @@ -tform->wordbook[$errmsg])) { - return $app->tform->wordbook[$errmsg].$additional."
\r\n"; - } else { - return $errmsg."
".$additional."
\r\n"; - } - } - - function check_custom($field_name, $field_value, $validator) { - $template = file('../vm/templates/openvz.conf.tpl', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $custom_array = explode("\n", $field_value); - $used_parameters = array(); - foreach ($template as $line) { - $line = trim ($line); - if (preg_match('/^[^#].*=\".*\"/', $line)) { - $line = explode('=', $line, 2); - $used_parameters[] = $line[0]; - } - } - foreach ($custom_array as $check) { - $check = trim(strtoupper($check)); - $check = explode('=', trim($check), 2); - $check = trim($check[0]); - if (in_array($check, $used_parameters)) { - return $this->get_error($validator['errmsg'], $check); - } - } - } - -} diff --git a/interface/lib/classes/validate_password.inc.php b/interface/lib/classes/validate_password.inc.php index f36f16220cfca1ae3f76cd600a4bd864639300b5..fc7b9698436bc41902bc8ddd3decbcf24c752e7c 100644 --- a/interface/lib/classes/validate_password.inc.php +++ b/interface/lib/classes/validate_password.inc.php @@ -71,7 +71,7 @@ class validate_password { } else if ($points == 1) { if ($length >= 5 && $length <= 6) { return 2; - } else if (length >= 7 && length <=10) { + } else if ($length >= 7 && $length <=10) { return 3; } else { return 4; @@ -111,10 +111,8 @@ class validate_password { $app->uses('ini_parser,getconf'); $server_config_array = $app->getconf->get_global_config(); - $min_password_strength = 0; - $min_password_length = 5; - if(isset($server_config_array['misc']['min_password_length'])) $min_password_length = $server_config_array['misc']['min_password_length']; - if(isset($server_config_array['misc']['min_password_strength'])) $min_password_strength = $server_config_array['misc']['min_password_strength']; + $min_password_length = $app->auth->get_min_password_length(); + $min_password_strength = $app->auth->get_min_password_strength(); if($min_password_strength > 0) { $lng_text = $app->lng('weak_password_txt'); diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php index 3c534f3f2144ec3e1d2af0b45b77f0b33fbf9d74..e5789ace37c8a3a95b1cfa994985684f163824cc 100644 --- a/interface/lib/config.inc.php +++ b/interface/lib/config.inc.php @@ -45,7 +45,7 @@ $revision = str_replace(array('Revision:', '$', ' '), '', $svn_revision); //** Application define('ISPC_APP_TITLE', 'ISPConfig'); -define('ISPC_APP_VERSION', '3.1dev'); +define('ISPC_APP_VERSION', '3.2.0dev'); define('DEVSYSTEM', 0); diff --git a/interface/lib/lang/cz.lng b/interface/lib/lang/cz.lng index b1518d96bbb88130625606c151a35b88c9377041..edd7a720a6315780ad82f41ff24793a60e3e765f 100644 --- a/interface/lib/lang/cz.lng +++ b/interface/lib/lang/cz.lng @@ -1,5 +1,6 @@ diff --git a/interface/lib/lang/fa.lng b/interface/lib/lang/fa.lng new file mode 100644 index 0000000000000000000000000000000000000000..c961d7a6988e68a2f4218f66a624d5029d5fab6a --- /dev/null +++ b/interface/lib/lang/fa.lng @@ -0,0 +1,166 @@ + \ No newline at end of file diff --git a/interface/lib/plugins/mail_mail_domain_plugin.inc.php b/interface/lib/plugins/mail_mail_domain_plugin.inc.php index e72c4aa06b2d8ce82fce9e895db40aba5f331a20..f90c6f961742aa99d8481278aa5f4cddb716be7e 100644 --- a/interface/lib/plugins/mail_mail_domain_plugin.inc.php +++ b/interface/lib/plugins/mail_mail_domain_plugin.inc.php @@ -88,14 +88,6 @@ class mail_mail_domain_plugin { } } - //* Update the mailinglist - $mailing_lists = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = ?", $page_form->oldDataRecord['domain']); - if(is_array($mailing_lists)) { - foreach($mailing_lists as $rec) { - $app->db->datalogUpdate('mail_mailinglist', array("sys_userid" => $client_user_id, "sys_groupid" => $sys_groupid), 'mailinglist_id', $rec['mailinglist_id']); - } - } - //* Update the mailget records $mail_gets = $app->db->queryAllRecords("SELECT mailget_id, destination FROM mail_get WHERE destination LIKE ?", "%@" . $page_form->oldDataRecord['domain']); if(is_array($mail_gets)) { diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php index a4e973973e66629deca2949698168b4acf559801..b2d1c18ced8125e08a066945881e1d5dc05ac9fd 100644 --- a/interface/lib/plugins/mail_user_filter_plugin.inc.php +++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php @@ -125,154 +125,84 @@ class mail_user_filter_plugin { $mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ?", $page_form->dataRecord["mailuser_id"]); $mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]), 'mail'); - if($mail_config['mail_filter_syntax'] == 'sieve') { - - // ####################################################### - // Filter in Sieve Syntax - // ####################################################### - - $content = ''; - $content .= '### BEGIN FILTER_ID:'.$page_form->id."\n"; - - //$content .= 'require ["fileinto", "regex", "vacation"];'."\n"; - - if($page_form->dataRecord["op"] == 'domain') { - $content .= 'if address :domain :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n"; - } elseif ($page_form->dataRecord["op"] == 'localpart') { - $content .= 'if address :localpart :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n"; - } elseif ($page_form->dataRecord["source"] == 'Size') { - if(substr(trim($page_form->dataRecord["searchterm"]),-1) == 'k' || substr(trim($page_form->dataRecord["searchterm"]),-1) == 'K') { - $unit = 'k'; - } else { - $unit = 'm'; - } - $content .= 'if size :over '.intval($page_form->dataRecord["searchterm"]).$unit.' {'."\n"; - } else { - if($page_form->dataRecord["source"] == 'Detail') { - $content .= 'if envelope :detail :regex "to" ["'; - } else { - if($page_form->dataRecord["source"] == 'Header') { - $parts = explode(':',trim($page_form->dataRecord["searchterm"])); - $page_form->dataRecord["source"] = trim($parts[0]); - unset($parts[0]); - $page_form->dataRecord["searchterm"] = trim(implode(':',$parts)); - unset($parts); - } - - $content .= 'if header :regex ["'.strtolower($page_form->dataRecord["source"]).'"] ["'; - } - - $searchterm = preg_quote($page_form->dataRecord["searchterm"]); - $searchterm = str_replace( - array( - '"', - '\\[', - '\\]' - ), - array( - '\\"', - '\\\\[', - '\\\\]' - ), $searchterm); - - if($page_form->dataRecord["op"] == 'contains') { - $content .= ".*".$searchterm; - } elseif ($page_form->dataRecord["op"] == 'is') { - $content .= "^".$searchterm."$"; - } elseif ($page_form->dataRecord["op"] == 'begins') { - $content .= "^".$searchterm.""; - } elseif ($page_form->dataRecord["op"] == 'ends') { - $content .= ".*".$searchterm."$"; - } - - $content .= '"] {'."\n"; - } - - if($page_form->dataRecord["action"] == 'move') { - $content .= ' fileinto "'.$page_form->dataRecord["target"].'";' . "\n stop;\n"; - } elseif ($page_form->dataRecord["action"] == 'keep') { - $content .= " keep;\n"; - } elseif ($page_form->dataRecord["action"] == 'stop') { - $content .= " stop;\n"; - } elseif ($page_form->dataRecord["action"] == 'reject') { - $content .= ' reject "'.$page_form->dataRecord["target"].'"; stop;\n\n'; - } elseif ($page_form->dataRecord["action"] == 'read') { - $content .= ' setflag "\\\\Seen";\n stop;\n'; + // ####################################################### + // Filter in Sieve Syntax + // ####################################################### + + $content = ''; + $content .= '### BEGIN FILTER_ID:'.$page_form->id."\n"; + + //$content .= 'require ["fileinto", "regex", "vacation"];'."\n"; + + if($page_form->dataRecord["op"] == 'domain') { + $content .= 'if address :domain :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n"; + } elseif ($page_form->dataRecord["op"] == 'localpart') { + $content .= 'if address :localpart :is "'.strtolower($page_form->dataRecord["source"]).'" "'.$page_form->dataRecord["searchterm"].'" {'."\n"; + } elseif ($page_form->dataRecord["source"] == 'Size') { + if(substr(trim($page_form->dataRecord["searchterm"]),-1) == 'k' || substr(trim($page_form->dataRecord["searchterm"]),-1) == 'K') { + $unit = 'k'; } else { - $content .= " discard;\n stop;\n"; + $unit = 'm'; } - - $content .= "}\n"; - - $content .= '### END FILTER_ID:'.$page_form->id."\n"; - + $content .= 'if size :over '.intval($page_form->dataRecord["searchterm"]).$unit.' {'."\n"; } else { + if($page_form->dataRecord["source"] == 'Detail') { + $content .= 'if envelope :detail :regex "to" ["'; + } else { + if($page_form->dataRecord["source"] == 'Header') { + $parts = explode(':',trim($page_form->dataRecord["searchterm"])); + $page_form->dataRecord["source"] = trim($parts[0]); + unset($parts[0]); + $page_form->dataRecord["searchterm"] = trim(implode(':',$parts)); + unset($parts); + } - // ####################################################### - // Filter in Maildrop Syntax - // ####################################################### - $content = ''; - $content .= '### BEGIN FILTER_ID:'.$page_form->id."\n"; - - $TargetNoQuotes = $page_form->dataRecord["target"]; - $TargetQuotes = "\"$TargetNoQuotes\""; - - $TestChDirNoQuotes = '$DEFAULT/.'.$TargetNoQuotes; - $TestChDirQuotes = "\"$TestChDirNoQuotes\""; - - $MailDirMakeNoQuotes = $TargetQuotes.' $DEFAULT'; - - $EchoTargetFinal = $TargetNoQuotes; - - - if($page_form->dataRecord["action"] == 'move') { - - $content .= " -`test -e ".$TestChDirQuotes." && exit 1 || exit 0` -if ( ".'$RETURNCODE'." != 1 ) -{ - `maildirmake -f $MailDirMakeNoQuotes` - `chmod -R 0700 ".$TestChDirQuotes."` - `echo \"INBOX.$EchoTargetFinal\" >> ".'$DEFAULT'."/courierimapsubscribed` -} -"; + $content .= 'if header :regex ["'.strtolower($page_form->dataRecord["source"]).'"] ["'; } - $content .= "if (/^".$page_form->dataRecord["source"].": "; - $searchterm = preg_quote($page_form->dataRecord["searchterm"]); + $searchterm = str_replace( + array( + '"', + '\\[', + '\\]' + ), + array( + '\\"', + '\\\\[', + '\\\\]' + ), $searchterm); if($page_form->dataRecord["op"] == 'contains') { - $content .= ".*".$searchterm."/:h)\n"; + $content .= ".*".$searchterm; } elseif ($page_form->dataRecord["op"] == 'is') { - $content .= $searchterm."$/:h)\n"; + $content .= "^".$searchterm."$"; } elseif ($page_form->dataRecord["op"] == 'begins') { - $content .= $searchterm."/:h)\n"; + $content .= "^".$searchterm.""; } elseif ($page_form->dataRecord["op"] == 'ends') { - $content .= ".*".$searchterm."$/:h)\n"; - } - - $content .= "{\n"; - $content .= "exception {\n"; - - if($page_form->dataRecord["action"] == 'move') { - $content .= 'ID' . "$page_form->id" . 'EndFolder = "$DEFAULT/.' . $page_form->dataRecord['target'] . '/"' . "\n"; - $content .= "xfilter \"/usr/bin/formail -A \\\"X-User-Mail-Filter-ID"."$page_form->id".": Yes\\\"\"" . "\n"; - $content .= "to ". '$ID' . "$page_form->id" . 'EndFolder' . "\n"; - } elseif ($page_form->dataRecord["action"] == 'read') { - $content .= ''; // mark as read currently not supported for Maildrop - } else { - $content .= "to /dev/null\n"; + $content .= ".*".$searchterm."$"; } - $content .= "}\n"; - $content .= "}\n"; + $content .= '"] {'."\n"; + } - //} + if($page_form->dataRecord["action"] == 'move') { + $content .= ' fileinto "'.$page_form->dataRecord["target"].'";' . "\n stop;\n"; + } elseif ($page_form->dataRecord["action"] == 'keep') { + $content .= " keep;\n"; + } elseif ($page_form->dataRecord["action"] == 'stop') { + $content .= " stop;\n"; + } elseif ($page_form->dataRecord["action"] == 'reject') { + $content .= ' reject "'.$page_form->dataRecord["target"].'"; stop;\n\n'; + } elseif ($page_form->dataRecord["action"] == 'read') { + $content .= ' setflag "\\\\Seen";\n stop;\n'; + } else { + $content .= " discard;\n stop;\n"; + } - $content .= '### END FILTER_ID:'.$page_form->id."\n"; + $content .= "}\n"; - } + $content .= '### END FILTER_ID:'.$page_form->id."\n"; return $content; } diff --git a/interface/lib/plugins/system_config_dns_ca_plugin.inc.php b/interface/lib/plugins/system_config_dns_ca_plugin.inc.php index 5ab338640c006065a653abbaa97f3ce507972459..c35934e5bfa542b9d5540802100eec148306f74c 100644 --- a/interface/lib/plugins/system_config_dns_ca_plugin.inc.php +++ b/interface/lib/plugins/system_config_dns_ca_plugin.inc.php @@ -62,7 +62,7 @@ class system_config_dns_ca_plugin { } } } - } //* End function + } function web_vhost_domain_edit($event_name, $page_form) { global $app; diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php deleted file mode 100644 index 281fae4a1f62f69d48a0fc91cae3fdba05db2f7a..0000000000000000000000000000000000000000 --- a/interface/lib/plugins/vm_openvz_plugin.inc.php +++ /dev/null @@ -1,298 +0,0 @@ -plugin->registerEvent('vm:openvz_vm:on_after_insert', 'vm_openvz_plugin', 'openvz_vm_insert'); - $app->plugin->registerEvent('vm:openvz_vm:on_after_update', 'vm_openvz_plugin', 'openvz_vm_update'); - $app->plugin->registerEvent('vm:openvz_vm:on_after_delete', 'vm_openvz_plugin', 'openvz_vm_delete'); - } - - /* - Function that gets called after a new vm was inserted - */ - function openvz_vm_insert($event_name, $page_form) { - global $app, $conf; - - $this->id = $app->functions->intval($page_form->id); - $this->dataRecord = $page_form->dataRecord; - $this->oldDataRecord = $page_form->oldDataRecord; - - // make sure that the record belongs to the clinet group and not the admin group when admin inserts it - // also make sure that the user can not delete domain created by a admin - if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE openvz_vm SET sys_groupid = ? WHERE vm_id = ?", $client_group_id, $this->id); - } - if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE openvz_vm SET sys_groupid = ? WHERE vm_id = ?", $client_group_id, $this->id); - } - - // Set the VEID - $tmp = $app->db->queryOneRecord('SELECT MAX(veid) + 1 as newveid FROM openvz_vm'); - $veid = ($tmp['newveid'] > 100)?$tmp['newveid']:101; - $app->db->query("UPDATE openvz_vm SET veid = ? WHERE vm_id = ?", $veid, $this->id); - unset($tmp); - - // Apply template values to the advanced tab settings - $this->applyTemplate(); - - // Set the IP address - $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']); - - // Set additional IPs - if (isset($this->dataRecord['additional_ip'])) { - $app->db->query("UPDATE openvz_ip SET vm_id = 0, additional = 'n' WHERE vm_id = ? AND additional='y'", $this->id); - foreach ($this->dataRecord['additional_ip'] as $idx => $rec) { - $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'y' WHERE ip_address = ?", $this->id, $rec); - } - } - - // Create the OpenVZ config file and store it in config field - $this->makeOpenVZConfig(); - - // Create the DNS record - $this->createDNS(); - - } - - /* - Function that gets called after a vm was updated - */ - function openvz_vm_update($event_name, $page_form) { - global $app, $conf; - - $this->id = $app->functions->intval($page_form->id); - $this->dataRecord = $page_form->dataRecord; - $this->oldDataRecord = $page_form->oldDataRecord; - - // make sure that the record belongs to the clinet group and not the admin group when a admin inserts it - // also make sure that the user can not delete domain created by a admin - if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE openvz_vm SET sys_groupid = ? WHERE vm_id = ?", $client_group_id, $this->id); - } - if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); - $app->db->query("UPDATE openvz_vm SET sys_groupid = ? WHERE vm_id = ?", $client_group_id, $this->id); - } - - if(isset($this->dataRecord["ostemplate_id"]) && $this->oldDataRecord["ostemplate_id"] != $this->dataRecord["ostemplate_id"]) { - $this->applyTemplate(); - } - - // Set the IP address - if(isset($this->dataRecord['ip_address'])) { - $app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = ? AND additional='n'", $this->id); - $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'n' WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']); - } - - // Set additional IPs - if (isset($this->dataRecord['additional_ip'])) { - $app->db->query("UPDATE openvz_ip SET vm_id = 0, additional = 'n' WHERE (vm_id = ? AND additional='y')", $this->id); - foreach ($this->dataRecord['additional_ip'] as $idx => $rec) { - $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'y' WHERE ip_address = ?", $this->id, $rec); - } - } - - // Create the OpenVZ config file and store it in config field - $this->makeOpenVZConfig(); - - // Create the DNS record - if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname']) - or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) { - $this->createDNS(); - } - - } - - function openvz_vm_delete($event_name, $page_form) { - global $app, $conf; - - //* Free the IP address - $tmp_rec = $app->db->queryAllRecords("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ?", $page_form->id); - foreach ($tmp_rec as $tmp) { - $app->db->datalogUpdate('openvz_ip', array('vm_id' => 0), 'ip_address_id', $tmp['ip_address_id']); - } - } - - private function applyTemplate() { - global $app, $conf; - - $tpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ?", $this->dataRecord["template_id"]); - - $sql = "UPDATE openvz_vm SET "; - $sql .= "diskspace = ?, "; - $sql .= "ram = ?, "; - $sql .= "ram_burst = ?, "; - $sql .= "cpu_units = ?, "; - $sql .= "cpu_num = ?, "; - $sql .= "cpu_limit = ?, "; - $sql .= "io_priority = ?, "; - $sql .= "nameserver = ?, "; - $sql .= "create_dns = ?, "; - $sql .= "capability = ?, "; - $sql .= "features = ?, "; - $sql .= "iptables = ? "; - $sql .= "custom = ? "; - $sql .= "WHERE vm_id = ?"; - $app->db->query($sql, $tpl['diskspace'], $tpl['ram'], $tpl['ram_burst'], $tpl['cpu_units'], $tpl['cpu_num'], $tpl['cpu_limit'], $tpl['io_priority'], $tpl['nameserver'], $tpl['create_dns'], $tpl['capability'], $tpl['features'], $tpl['iptables'], $tpl['custom'], $this->id); - - } - - private function makeOpenVZConfig() { - global $app, $conf; - - $vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ?",$app->functions->intval($this->id)); - $vm_template = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ?",$app->functions->intval($vm['template_id'])); - $burst_ram = $vm['ram_burst']*256; - $guar_ram = $vm['ram']*256; - - $app->load('tpl'); - $tpl = new tpl(); - $tpl->newTemplate('../vm/templates/openvz.conf.tpl'); - - $onboot = ($vm['start_boot'] == 'y')?'yes':'no'; - $tpl->setVar('onboot', $onboot); - - $tpl->setVar('bootorder', $vm['bootorder']); - $tpl->setVar('kmemsize', $vm_template['kmemsize']); - $tpl->setVar('lockedpages', $vm_template['lockedpages']); - $tpl->setVar('privvmpages', $burst_ram.':'.$burst_ram*1.0625); - $tpl->setVar('shmpages', $guar_ram.':'.$guar_ram); - $tpl->setVar('numproc', $vm_template['numproc']); - $tpl->setVar('physpages', $vm_template['physpages']); - $tpl->setVar('vmguarpages', $guar_ram.':unlimited'); - $tpl->setVar('oomguarpages', $guar_ram.':'.$guar_ram); - $tpl->setVar('numtcpsock', $vm_template['numtcpsock']); - $tpl->setVar('numflock', $vm_template['numflock']); - $tpl->setVar('numpty', $vm_template['numpty']); - $tpl->setVar('numsiginfo', $vm_template['numsiginfo']); - $tpl->setVar('tcpsndbuf', $vm_template['tcpsndbuf']); - $tpl->setVar('tcprcvbuf', $vm_template['tcprcvbuf']); - $tpl->setVar('othersockbuf', $vm_template['othersockbuf']); - $tpl->setVar('dgramrcvbuf', $vm_template['dgramrcvbuf']); - $tpl->setVar('numothersock', $vm_template['numothersock']); - $tpl->setVar('dcachesize', $vm_template['dcachesize']); - $tpl->setVar('numfile', $vm_template['numfile']); - $tpl->setVar('avnumproc', $vm_template['avnumproc']); - $tpl->setVar('numiptent', $vm_template['numiptent']); - $tpl->setVar('swappages', $vm_template['swappages']); - - $diskspace = $vm['diskspace']*1048576; - $diskinodes = $vm['diskspace']*524288; - - $tpl->setVar('diskspace', $diskspace.":".$diskspace); - $tpl->setVar('diskinodes', $diskinodes.":".$diskinodes); - $tpl->setVar('io_priority', $vm['io_priority']); - - $tpl->setVar('cpu_num', $vm['cpu_num']); - $tpl->setVar('cpu_units', $vm['cpu_units']); - $tpl->setVar('cpu_limit', $vm['cpu_limit']); - - $hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']); - - $tpl->setVar('hostname', $hostname); - - $additional_ips = $app->db->queryAllRecords("SELECT * FROM openvz_ip WHERE vm_id = ?",$this->id); - if (isset($additional_ips)) { - $vm['ip_address']=''; - foreach ($additional_ips as $ip) { - $vm['ip_address'] .= " ".$ip['ip_address']; - } - $vm['ip_address'] = substr($vm['ip_address'],1); - } - $tpl->setVar('ip_address', $vm['ip_address']); - - $tpl->setVar('ip_address', $vm['ip_address']); - $tpl->setVar('nameserver', $vm['nameserver']); - $tpl->setVar('capability', $vm['capability']); - $tpl->setVar('features', $vm['features']); - $tpl->setVar('iptables', $vm['iptables']); - - $tpl->setVar('custom', $vm['custom']); - - $tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ?", $app->functions->intval($vm['ostemplate_id'])); - $tpl->setVar('ostemplate', $tmp['template_file']); - unset($tmp); - - $openvz_config = $tpl->grab(); - $app->db->query("UPDATE openvz_vm SET config = ? WHERE vm_id = ?", $openvz_config, $app->functions->intval($this->id)); - - unset($tpl); - - } - - private function createDNS() { - global $app, $conf; - - $vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ?", $app->functions->intval($this->id)); - - if($vm['create_dns'] != 'y') return; - - $full_hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']); - $hostname_parts = explode('.', $full_hostname); - $hostname = $hostname_parts[0]; - unset($hostname_parts[0]); - $zone = implode('.', $hostname_parts); - unset($hostname_parts); - - // Find the dns zone - $zone_rec = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = ?", $zone); - $rr_rec = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND name = ?", $zone_rec['id'], $hostname); - - if($zone_rec['id'] > 0) { - $ip_address = $vm['ip_address']; - $sys_userid = $app->functions->intval($zone_rec['sys_userid']); - $sys_groupid = $app->functions->intval($zone_rec['sys_groupid']); - $server_id = $app->functions->intval($zone_rec['server_id']); - $dns_soa_id = $app->functions->intval($zone_rec['id']); - - if($rr_rec['id'] > 0) { - $app->uses('validate_dns'); - $app->db->datalogUpdate('dns_rr', array("data" => $ip_address), 'id', $app->functions->intval($rr_rec['id'])); - $serial = $app->validate_dns->increase_serial($zone_rec['serial']); - $app->db->datalogUpdate('dns_soa', array("serial" => $serial), 'id', $app->functions->intval($zone_rec['id'])); - } else { - $insert_data = array( - "sys_userid" => $sys_userid, - "sys_groupid" => $sys_groupid, - "sys_perm_user" => 'riud', - "sys_perm_group" => 'riud', - "sys_perm_other" => '', - "server_id" => $server_id, - "zone" => $dns_soa_id, - "name" => $hostname, - "type" => @(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $ip_address))?'A':'AAAA', - "data" => $ip_address, - "aux" => '0', - "ttl" => '3600', - "active" => 'Y' - ); - $dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id'); - } - - } - } - -} diff --git a/interface/lib/server_conf.master b/interface/lib/server_conf.master index 8fd54d9926967b1b3ec5b9759808e7262079439d..7e705935e6829e3327dd3d784a3779ffa1468f0f 100644 --- a/interface/lib/server_conf.master +++ b/interface/lib/server_conf.master @@ -21,6 +21,3 @@ module=generic [file] module=generic - -[vserver] -module=generic \ No newline at end of file diff --git a/interface/web/admin/form/server.tform.php b/interface/web/admin/form/server.tform.php index 95dca6c33b5cb552b29692b3c0f27f2e76924024..e28e3e34d85ef085e763c7d864c4be4d7d2797c8 100644 --- a/interface/web/admin/form/server.tform.php +++ b/interface/web/admin/form/server.tform.php @@ -102,18 +102,6 @@ $form["tabs"]['services'] = array ( 'default' => '0', 'value' => array(0 => 0, 1 => 1) ), - 'vserver_server' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'CHECKBOX', - 'default' => '0', - 'value' => array(0 => 0, 1 => 1) - ), - 'xmpp_server' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'CHECKBOX', - 'default' => '0', - 'value' => array(0 => 0, 1 => 1) - ), 'mirror_server_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index ad4171c3168bc0a3539b3b27413917ddd0dc8c83..2ff4b5350c5b364488bd8daa4d02fb7b58ec959a 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -331,7 +331,12 @@ $form["tabs"]['server'] = array( ), 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'monit_user' => array( 'datatype' => 'VARCHAR', @@ -345,7 +350,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'monit_password' => array( 'datatype' => 'VARCHAR', @@ -353,7 +363,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'munin_url' => array( 'datatype' => 'VARCHAR', @@ -365,7 +380,12 @@ $form["tabs"]['server'] = array( ), 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'munin_user' => array( 'datatype' => 'VARCHAR', @@ -379,7 +399,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'munin_password' => array( 'datatype' => 'VARCHAR', @@ -387,7 +412,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'nagios_url' => array( 'datatype' => 'VARCHAR', @@ -399,7 +429,12 @@ $form["tabs"]['server'] = array( ), 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'nagios_user' => array( 'datatype' => 'VARCHAR', @@ -407,7 +442,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'nagios_password' => array( 'datatype' => 'VARCHAR', @@ -415,7 +455,12 @@ $form["tabs"]['server'] = array( 'default' => '', 'value' => '', 'width' => '40', - 'maxlength' => '255' + 'maxlength' => '255', + 'filters' => array( 0 => array( + 'event' => 'SAVE', + 'type' => 'TRIM' + ), + ) ), 'monitor_system_updates' => array( 'datatype' => 'VARCHAR', @@ -494,6 +539,29 @@ $form["tabs"]['mail'] = array( 'width' => '40', 'maxlength' => '255' ), + 'content_filter' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'rspamd', + 'value' => array('amavisd' => 'Amavisd', 'rspamd' => 'Rspamd') + ), + 'rspamd_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255', + 'filters' => array( 0 => array( 'event' => 'SAVE', + 'type' => 'TRIM'), + ), + ), + 'rspamd_available' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'dkim_path' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', @@ -523,18 +591,6 @@ $form["tabs"]['mail'] = array( 'maxlength' => '255' ), - 'pop3_imap_daemon' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '20', - 'value' => array('courier' => 'Courier', 'dovecot' => 'Dovecot') - ), - 'mail_filter_syntax' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '20', - 'value' => array('maildrop' => 'Maildrop', 'sieve' => 'Sieve') - ), 'mailuser_uid' => array( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', @@ -703,12 +759,6 @@ $form["tabs"]['mail'] = array( 'default' => 'n', 'value' => array(0 => 'n', 1 => 'y') ), - 'mailinglist_manager' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '20', - 'value' => array('mlmmj' => 'Mlmmj', 'mailman' => 'Mailman') - ), //################################# // ENDE Datatable fields //################################# @@ -1128,6 +1178,24 @@ $form["tabs"]['web'] = array( 'width' => '40', 'maxlength' => '255' ), + 'php_default_name' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'Default', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_default_name_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'TRIM'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 2 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'width' => '40', + 'maxlength' => '255' + ), 'php_fpm_init_script' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', @@ -1224,7 +1292,7 @@ $form["tabs"]['web'] = array( 'datatype' => 'VARCHAR', 'formtype' => 'SELECT', 'default' => 'fast-cgi', - 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'), + 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM'), 'searchable' => 2 ), 'nginx_cgi_socket' => array( @@ -1584,15 +1652,7 @@ $form["tabs"]['fastcgi'] = array( 'value' => '', 'width' => '40', 'maxlength' => '255' - ), - 'fastcgi_config_syntax' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '2', - 'value' => array('1' => 'Old (apache 2.0)', '2' => 'New (apache 2.2)'), - 'width' => '40', - 'maxlength' => '255' - ), + ) //################################# // ENDE Datatable fields //################################# @@ -1600,104 +1660,6 @@ $form["tabs"]['fastcgi'] = array( ); -$form["tabs"]['xmpp'] = array( - 'title' => "XMPP", - 'width' => 80, - 'template' => "templates/server_config_xmpp_edit.htm", - 'fields' => array( - //################################# - // Begin Datatable fields - //################################# - 'xmpp_daemon' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'default' => '20', - 'value' => array('prosody' => 'Prosody', 'metronome' => 'Metronome') - ), - 'xmpp_use_ipv6' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'xmpp_bosh_max_inactivity' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '30', - 'validators' => array(0 => array('type' => 'ISINT', - 'errmsg' => 'ip_address_error_wrong'), - array('type'=>'RANGE', 'range'=>'15:360', 'errmsg' => 'xmpp_bosh_timeout_range_wrong') - ), - 'value' => '', - 'width' => '15' - ), - - 'xmpp_server_admins' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => 'admin@service.com, superuser@service.com', - 'value' => '', - 'width' => '15' - ), - - 'xmpp_modules_enabled' => array( - 'datatype' => 'TEXT', - 'formtype' => 'TEXT', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => "saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons", - 'value' => '', - 'separator' => "," - ), - - 'xmpp_port_http' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '5290', - 'validators' => array(0 => array('type' => 'ISINT')), - 'value' => '5290', - 'width' => '15' - ), - 'xmpp_port_https' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '5291', - 'validators' => array(0 => array('type' => 'ISINT')), - 'value' => '5291', - 'width' => '15' - ), - 'xmpp_port_pastebin' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '5292', - 'validators' => array(0 => array('type' => 'ISINT')), - 'value' => '5292', - 'width' => '15' - ), - 'xmpp_port_bosh' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '5280', - 'validators' => array(0 => array('type' => 'ISINT')), - 'value' => '5280', - 'width' => '15' - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - $form["tabs"]['jailkit'] = array( 'title' => "Jailkit", 'width' => 80, @@ -1735,13 +1697,13 @@ $form["tabs"]['jailkit'] = array( 'maxlength' => '1000' ), 'jailkit_chroot_app_programs' => array( - 'datatype' => 'VARCHAR', + 'datatype' => 'TEXT', 'formtype' => 'TEXT', 'default' => '', 'validators' => array( 0 => array('type' => 'NOTEMPTY', 'errmsg' => 'jailkit_chroot_app_programs_error_empty'), 1 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-9\*\.\-\_\/\ ]{1,}$/', + 'regex' => '/^[a-zA-Z0-9\*\.\-\_\/\ \r\n]{1,}$/', 'errmsg'=> 'jailkit_chroot_app_programs_error_regex'), ), 'value' => '', @@ -1938,12 +1900,6 @@ $form["tabs"]['rescue'] = array( 'default' => 'n', 'value' => array(0 => 'n', 1 => 'y') ), - 'do_not_try_rescue_mongodb' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), 'do_not_try_rescue_mysql' => array( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', @@ -1961,4 +1917,10 @@ $form["tabs"]['rescue'] = array( //################################# ) ); -?> + +$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); +if(!isset($mail_config['rspamd_available']) || $mail_config['rspamd_available'] != 'y') { + $form['tabs']['mail']['fields']['content_filter']['default'] = 'amavisd'; + unset($form['tabs']['mail']['fields']['content_filter']['value']['rspamd']); + unset($form['tabs']['mail']['fields']['rspamd_password']); +} \ No newline at end of file diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php index ea1ce1aaf773bc0cabb0e179c337e72a26af45ad..4762e0028365c2ab60cbd7ae8c4db5565d99e5ea 100644 --- a/interface/web/admin/form/system_config.tform.php +++ b/interface/web/admin/form/system_config.tform.php @@ -269,24 +269,6 @@ $form["tabs"]['mail'] = array ( 'width' => '30', 'maxlength' => '255' ), - 'mailmailinglist_link' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'mailmailinglist_url' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/', - 'errmsg'=> 'mailinglist_url_error_regex'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), 'admin_mail' => array ( 'datatype' => 'VARCHAR', 'filters' => array( 0 => array( 'event' => 'SAVE', @@ -470,30 +452,6 @@ $form["tabs"]['domains'] = array ( ) ); -/* TODO_ BEGIN: Branding - -$form["tabs"]['domains'] = array ( - 'title' => "Branding", - 'width' => 70, - 'template' => "templates/system_config_branding_edit.htm", - 'fields' => array ( - ################################## - # Begin Datatable fields - ################################## - 'allow_themechange' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'N', - 'value' => array(0 => 'n',1 => 'y') - ), - ################################## - # ENDE Datatable fields - ################################## - ) -); - - - END: Branding */ $form["tabs"]['misc'] = array ( 'title' => "Misc", 'width' => 70, diff --git a/interface/web/admin/language_add.php b/interface/web/admin/language_add.php index f58a2db16dbb6ce159149a8a6e17e86e9a7b6ddc..f36fd946d2de8523279c47286deae3f2617044d4 100644 --- a/interface/web/admin/language_add.php +++ b/interface/web/admin/language_add.php @@ -104,7 +104,7 @@ $app->tpl->setVar('_csrf_id',$csrf_token['csrf_id']); $app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_add.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_add.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/language_complete.php b/interface/web/admin/language_complete.php index d28e89aa2576ee51d8b6e41030c10fdbded2c3c4..234685498d0486e8b7086e34e69e7c91f5e84d10 100644 --- a/interface/web/admin/language_complete.php +++ b/interface/web/admin/language_complete.php @@ -166,7 +166,7 @@ $app->tpl->setVar('_csrf_id',$csrf_token['csrf_id']); $app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_complete.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_complete.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/language_edit.php b/interface/web/admin/language_edit.php index c94a5eb2804ed1ef0323a960d49ef58e2c621f5e..39baec55e3421b1b8639b4f2ce6c180a9fd3217c 100644 --- a/interface/web/admin/language_edit.php +++ b/interface/web/admin/language_edit.php @@ -49,7 +49,7 @@ $lang_file = $_REQUEST['lang_file']; if(!preg_match("/^[a-z]+$/i", $lang)) die('unallowed characters in language name.'); if(!preg_match("/^[a-z_]+$/i", $module)) die('unallowed characters in module name.'); -if(!preg_match("/^[a-z\._]+$/i", $lang_file)) die('unallowed characters in language file name.'); +if(!preg_match("/^[a-z\._]+$/i", $lang_file) || strpos($lang_file,'..') !== false || substr($lang_file,-4) != '.lng') die('unallowed characters in language file name.'); $msg = ''; @@ -104,7 +104,7 @@ $app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_edit.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_edit.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/language_export.php b/interface/web/admin/language_export.php index 44bc787bd33eefdc29a28f5f3ee00bba9cddd921..3f54e53af8f590e1fa071ba5cd622c19b9e882d5 100644 --- a/interface/web/admin/language_export.php +++ b/interface/web/admin/language_export.php @@ -111,7 +111,7 @@ if(isset($_POST['lng_select']) && $error == '') { $app->tpl->setVar('msg', $msg); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_export.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_export.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/language_import.php b/interface/web/admin/language_import.php index 2e702198048a1de1fdb5a787d9aebe0b6d16a496..6a2d0b5ba65a2e14afb0a8a0f756439388209fb1 100644 --- a/interface/web/admin/language_import.php +++ b/interface/web/admin/language_import.php @@ -194,7 +194,7 @@ $app->tpl->setVar('_csrf_id',$csrf_token['csrf_id']); $app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_import.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_import.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/language_list.php b/interface/web/admin/language_list.php index 2cb28dc187f1a7f2649715029ae4b584df690576..b935bddd9599bd13d645f3e23af4a35fd2c68127 100644 --- a/interface/web/admin/language_list.php +++ b/interface/web/admin/language_list.php @@ -97,7 +97,7 @@ $app->tpl->setLoop('records', $language_files_list); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_list.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_language_list.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/admin/lib/lang/ar_server_config.lng b/interface/web/admin/lib/lang/ar_server_config.lng index 683efce3126486df43aa775c95635b3cf5d47b3e..b7e75ffd44f11d21e65905ae2cb309e83b9ba328 100644 --- a/interface/web/admin/lib/lang/ar_server_config.lng +++ b/interface/web/admin/lib/lang/ar_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/bg_server_config.lng b/interface/web/admin/lib/lang/bg_server_config.lng index 277cee8b9f9e736b000bd14856674982c4558f9a..37f654d5a6d3ce57b7f05fb63166ce003225842e 100644 --- a/interface/web/admin/lib/lang/bg_server_config.lng +++ b/interface/web/admin/lib/lang/bg_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/br_server_config.lng b/interface/web/admin/lib/lang/br_server_config.lng index a46db9f1c9868b1d79ea11c5c4351606c04143b3..b016ad04c30a1f93750e29b8b0390b9d0c3cc1c5 100644 --- a/interface/web/admin/lib/lang/br_server_config.lng +++ b/interface/web/admin/lib/lang/br_server_config.lng @@ -291,4 +291,6 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/ca_server_config.lng b/interface/web/admin/lib/lang/ca_server_config.lng index 3d8491cf99db921477932d6479447299cc3db38d..a83144b33493f4cfded92981b0fbee9bafa13f03 100644 --- a/interface/web/admin/lib/lang/ca_server_config.lng +++ b/interface/web/admin/lib/lang/ca_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/cz.lng b/interface/web/admin/lib/lang/cz.lng index 957ddffebf24f2573eff609ccf4f45b87486cd7a..a54f348b3b27415c0c7fff3758ef4e29e911dc06 100644 --- a/interface/web/admin/lib/lang/cz.lng +++ b/interface/web/admin/lib/lang/cz.lng @@ -1,52 +1,64 @@ diff --git a/interface/web/admin/lib/lang/cz_server_config.lng b/interface/web/admin/lib/lang/cz_server_config.lng index 204828d7a63a156065d1cc8d053f04ec2fcfd4d8..9a765635228bfeb8fe1201efb9b6e164fd1ae0be 100644 --- a/interface/web/admin/lib/lang/cz_server_config.lng +++ b/interface/web/admin/lib/lang/cz_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng index fd8cbc40b85c0fd23dc9c16cead465883f73b53e..b0d5aac0d9f099b955dc1e961ed5f8d5eac5d605 100644 --- a/interface/web/admin/lib/lang/de_server_config.lng +++ b/interface/web/admin/lib/lang/de_server_config.lng @@ -297,4 +297,10 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; -?> +$wb['php_default_name_txt'] = 'Beschreibung Standard PHP'; +$wb['php_default_name_error_empty'] = 'Beschreibung Standard PHP ist leer.'; +$wb['content_filter_txt'] = 'Content-Filter'; +$wb['rspamd_url_txt'] = 'Rspamd-URL'; +$wb['rspamd_user_txt'] = 'Rspamd-Benutzer'; +$wb['rspamd_password_txt'] = 'Rspamd-Passwort'; +$wb['error_mailbox_message_size_txt'] = 'Mailboxgröße muss gleich oder größer als max. Nachrichtengröße sein.'; diff --git a/interface/web/admin/lib/lang/de_server_php_list.lng b/interface/web/admin/lib/lang/de_server_php_list.lng index d775fc6c00b535376441399a9c4d6f3b016b3e43..fe9a72ea150a4fc513dfea3f1ddf6c1ad1933f9b 100644 --- a/interface/web/admin/lib/lang/de_server_php_list.lng +++ b/interface/web/admin/lib/lang/de_server_php_list.lng @@ -4,4 +4,5 @@ $wb['server_id_txt'] = 'Server'; $wb['add_new_record_txt'] = 'Neue PHP Version hinzufügen'; $wb['client_id_txt'] = 'Kunde'; $wb['name_txt'] = 'PHP Name'; +$wb['active_txt'] = 'Aktiv'; ?> diff --git a/interface/web/admin/lib/lang/dk_server_config.lng b/interface/web/admin/lib/lang/dk_server_config.lng index fcf4d2007e790f81479e79b3e071542c49d9b1a2..26f953d5b44a654558fbf565394d1ef919c3dc5c 100644 --- a/interface/web/admin/lib/lang/dk_server_config.lng +++ b/interface/web/admin/lib/lang/dk_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/el_server_config.lng b/interface/web/admin/lib/lang/el_server_config.lng index f7c475c5705cbe2e6868f0613bcdaa0ed70a5d91..1298ea71aed74b3eccc906d8d01e058c511a18e6 100644 --- a/interface/web/admin/lib/lang/el_server_config.lng +++ b/interface/web/admin/lib/lang/el_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index d6c0737c3a4d6ccab012b61fe53fcf709687668b..d16f721c688da19a679ad1d84a29614759c76f20 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -299,4 +299,10 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; -?> +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['content_filter_txt'] = 'Content Filter'; +$wb['rspamd_url_txt'] = 'Rspamd URL'; +$wb['rspamd_user_txt'] = 'Rspamd User'; +$wb['rspamd_password_txt'] = 'Rspamd Password'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; diff --git a/interface/web/admin/lib/lang/en_server_php_list.lng b/interface/web/admin/lib/lang/en_server_php_list.lng index b402fd1ed19978b32027a9ed16e7b44f241db93e..62cbe6168714b18ba4fca490280c30c945e09e7c 100644 --- a/interface/web/admin/lib/lang/en_server_php_list.lng +++ b/interface/web/admin/lib/lang/en_server_php_list.lng @@ -4,4 +4,5 @@ $wb['server_id_txt'] = 'Server'; $wb['add_new_record_txt'] = 'Add new PHP version'; $wb['client_id_txt'] = 'Client'; $wb['name_txt'] = 'PHP Name'; +$wb['active_txt'] = 'Active'; ?> diff --git a/interface/web/admin/lib/lang/es_server_config.lng b/interface/web/admin/lib/lang/es_server_config.lng index aaee15ec0b2f19324c89a682f71d068731fcd16d..5ce3381d9818e2e48843e4d720ae3e9cc80ce59a 100755 --- a/interface/web/admin/lib/lang/es_server_config.lng +++ b/interface/web/admin/lib/lang/es_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/fi_server_config.lng b/interface/web/admin/lib/lang/fi_server_config.lng index 99c1524dc56c8df911061b98f08d30c4f573e5a6..4609ce5b13971ab55622547d74b63f16d79195cc 100755 --- a/interface/web/admin/lib/lang/fi_server_config.lng +++ b/interface/web/admin/lib/lang/fi_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/fr_server_config.lng b/interface/web/admin/lib/lang/fr_server_config.lng index 43e67450ec7bce990aa648c8a2230c41a8e0cffd..e31d68383ef021f763e4a927d9391dd699a1108c 100644 --- a/interface/web/admin/lib/lang/fr_server_config.lng +++ b/interface/web/admin/lib/lang/fr_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/hr_server_config.lng b/interface/web/admin/lib/lang/hr_server_config.lng index 797f0eb71f0e209ba2688a43a10aba55d22d07b7..c54a67659d17845ca25ee9d8096f6daeffe965e0 100644 --- a/interface/web/admin/lib/lang/hr_server_config.lng +++ b/interface/web/admin/lib/lang/hr_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/hu_server_config.lng b/interface/web/admin/lib/lang/hu_server_config.lng index 04370d1b4d021e6e1a53676ed04f6bcba770623e..1ac1cd268530c5fa158474ae0782b1cd417cb19f 100644 --- a/interface/web/admin/lib/lang/hu_server_config.lng +++ b/interface/web/admin/lib/lang/hu_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/id_server_config.lng b/interface/web/admin/lib/lang/id_server_config.lng index 2993c5c5993d9d2ee0ea558363abdfcee01c2ae2..a4738919645c1e2f09caa36a214ff823670ecd6e 100644 --- a/interface/web/admin/lib/lang/id_server_config.lng +++ b/interface/web/admin/lib/lang/id_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/it_server_config.lng b/interface/web/admin/lib/lang/it_server_config.lng index 5db4de114c93400f2fc30484725e6791b67953a3..36cedf46ef15acbd45f3a6ac70609bd294636512 100644 --- a/interface/web/admin/lib/lang/it_server_config.lng +++ b/interface/web/admin/lib/lang/it_server_config.lng @@ -281,7 +281,7 @@ $wb['xmpp_port_bosh_txt'] = 'BOSH'; $wb['disable_bind_log_txt'] = 'Disable bind9 messages for Loglevel WARN'; $wb['apps_vhost_enabled_txt'] = 'Apps-vhost enabled'; $wb['backup_time_txt'] = 'Backup time'; -$wb["mailinglist_manager_txt"] = 'Gestore delle Liste' +$wb["mailinglist_manager_txt"] = 'Gestore delle Liste'; $wb['skip_le_check_txt'] = 'Skip Lets Encrypt Check'; $wb['migration_mode_txt'] = 'Server Migration Mode'; $wb['nginx_enable_pagespeed_txt'] = 'Makes Pagespeed available'; @@ -292,4 +292,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/ja_server_config.lng b/interface/web/admin/lib/lang/ja_server_config.lng index 353aaa809effdd4fd6299782c811f94a7c8ee149..76c400728b695f4918fd9b3109b5c9672a585d37 100644 --- a/interface/web/admin/lib/lang/ja_server_config.lng +++ b/interface/web/admin/lib/lang/ja_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/nl_server_config.lng b/interface/web/admin/lib/lang/nl_server_config.lng index b51c089632a4e0daa0c4a2f867c2024b3d2e97eb..41692444fd5c7a6b473f461b59ee2447acbd2ef1 100644 --- a/interface/web/admin/lib/lang/nl_server_config.lng +++ b/interface/web/admin/lib/lang/nl_server_config.lng @@ -297,4 +297,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/pl_server_config.lng b/interface/web/admin/lib/lang/pl_server_config.lng index e2288f905071568df751efad9e132c19d11ccb5e..c052b7f3731688da34e1de81818a256dcfe3ef65 100644 --- a/interface/web/admin/lib/lang/pl_server_config.lng +++ b/interface/web/admin/lib/lang/pl_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/pt_server_config.lng b/interface/web/admin/lib/lang/pt_server_config.lng index 9d7fa04cde58088111acc1de90e7ab4394ce5565..4767022e4902fa8ea08dfcfc23ef6ed5d23c7e8c 100644 --- a/interface/web/admin/lib/lang/pt_server_config.lng +++ b/interface/web/admin/lib/lang/pt_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/ro_server_config.lng b/interface/web/admin/lib/lang/ro_server_config.lng index e7787e186649a1219b4909ba63766987ad3ca562..41b967b7355f2623481d89943b7293bc2b3785e9 100644 --- a/interface/web/admin/lib/lang/ro_server_config.lng +++ b/interface/web/admin/lib/lang/ro_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/ru_server_config.lng b/interface/web/admin/lib/lang/ru_server_config.lng index eb004bcfc71fdeeeb6fd4b00a42c3111e9be7abe..0775ab7f88f5763c17a91dc53cc012fc7475ede1 100644 --- a/interface/web/admin/lib/lang/ru_server_config.lng +++ b/interface/web/admin/lib/lang/ru_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/se_server_config.lng b/interface/web/admin/lib/lang/se_server_config.lng index a38c3e6d12f18148f3eb0148d345a03a6bcb30b1..5808fb2f5e83a831b7f5970c10dce36a0211b543 100644 --- a/interface/web/admin/lib/lang/se_server_config.lng +++ b/interface/web/admin/lib/lang/se_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/sk_server_config.lng b/interface/web/admin/lib/lang/sk_server_config.lng index f20c681e23a14d4f5fa4b7506a28f394a54bb53a..d5b1f92bf0e37887ba80140a57fff6d651553832 100644 --- a/interface/web/admin/lib/lang/sk_server_config.lng +++ b/interface/web/admin/lib/lang/sk_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/lang/tr_server_config.lng b/interface/web/admin/lib/lang/tr_server_config.lng index 59a11a28cc352933abaea4e7fc79baef6821fce6..c7be379260f85b9261dea8d2565fc138773aeaa3 100644 --- a/interface/web/admin/lib/lang/tr_server_config.lng +++ b/interface/web/admin/lib/lang/tr_server_config.lng @@ -291,4 +291,7 @@ $wb['logging_txt'] = 'Store website access and error logs'; $wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; $wb['log_retention_txt'] = 'Log retention (days)'; $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; ?> diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php index 01e03695f839720f73ea61e233d97c54a88f7d8c..a1067a992f8c035e727355e503e517180430f540 100644 --- a/interface/web/admin/lib/remote.conf.php +++ b/interface/web/admin/lib/remote.conf.php @@ -1,6 +1,6 @@ diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php index 58779eec9c6a1e84c9c175b78fc3824969b71c42..ee8f590021a14e2876605323be3e3b3afb7c72a8 100644 --- a/interface/web/admin/list/server.list.php +++ b/interface/web/admin/list/server.list.php @@ -100,23 +100,3 @@ $liste['item'][] = array( 'field' => 'db_server', 'suffix' => '%', 'width' => '', 'value' => array('1' => $app->lng('yes_txt'), '0' => $app->lng('no_txt'))); - -$liste['item'][] = array( 'field' => 'vserver_server', - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'op' => 'like', - 'prefix' => '%', - 'suffix' => '%', - 'width' => '', - 'value' => array('1' => $app->lng('yes_txt'), '0' => $app->lng('no_txt'))); - -$liste['item'][] = array( 'field' => 'xmpp_server', - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'op' => 'like', - 'prefix' => '%', - 'suffix' => '%', - 'width' => '', - 'value' => array('1' => $app->lng('yes_txt'), '0' => $app->lng('no_txt'))); - -?> diff --git a/interface/web/admin/list/server_php.list.php b/interface/web/admin/list/server_php.list.php index ee4ad1ab918c17271d847b9dfad76fbe3963252a..a4a38901ab4565bf9f704265e240b280f2c5bacb 100644 --- a/interface/web/admin/list/server_php.list.php +++ b/interface/web/admin/list/server_php.list.php @@ -44,6 +44,15 @@ $liste['auth'] = 'no'; * Suchfelder *****************************************************/ +$liste['item'][] = array( 'field' => 'active', + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'op' => '=', + 'prefix' => '', + 'suffix' => '', + 'width' => '', + 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); + $liste['item'][] = array( 'field' => 'server_id', 'datatype' => 'INTEGER', 'formtype' => 'SELECT', diff --git a/interface/web/admin/remote_action_ispcupdate.php b/interface/web/admin/remote_action_ispcupdate.php index f22661e1d47282215c4921f04241f7bfe9407154..938f25a1a37259a0ea229fe1124a27c1f9c0ea7b 100644 --- a/interface/web/admin/remote_action_ispcupdate.php +++ b/interface/web/admin/remote_action_ispcupdate.php @@ -44,7 +44,7 @@ $app->tpl->newTemplate('form.tpl.htm'); $app->tpl->setInclude('content_tpl', 'templates/remote_action_ispcupdate.htm'); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_remote_action.lng'; include $lng_file; /* diff --git a/interface/web/admin/remote_action_osupdate.php b/interface/web/admin/remote_action_osupdate.php index 5e73cdfd0f874bccc5d3ee780112ea56113cff35..e39cf0eedfe5c0925e14bc2cf1b7cdd0bbd10b62 100644 --- a/interface/web/admin/remote_action_osupdate.php +++ b/interface/web/admin/remote_action_osupdate.php @@ -43,7 +43,7 @@ $app->tpl->newTemplate('form.tpl.htm'); $app->tpl->setInclude('content_tpl', 'templates/remote_action_osupdate.htm'); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_remote_action.lng'; include $lng_file; /* diff --git a/interface/web/admin/server_config_edit.php b/interface/web/admin/server_config_edit.php index 4c03e7ee431ef77f8358bfee0b98d1b59048f49b..fc37163e718a1add5c067d30f34dc3e4cee63c5e 100644 --- a/interface/web/admin/server_config_edit.php +++ b/interface/web/admin/server_config_edit.php @@ -52,6 +52,30 @@ $app->load('tform_actions'); class page_action extends tform_actions { + function onShow() { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + if($web_config['server_type'] == 'nginx'){ + unset($app->tform->formDef["tabs"]["fastcgi"]); + unset($app->tform->formDef["tabs"]["vlogger"]); + } + + parent::onShow(); + } + + function onSubmit() { + global $app, $conf; + + if(isset($this->dataRecord['mailbox_size_limit']) && $this->dataRecord['mailbox_size_limit'] != 0 && $this->dataRecord['mailbox_size_limit'] < $this->dataRecord['message_size_limit']) { + $app->tform->errorMessage .= $app->tform->lng("error_mailbox_message_size_txt").'
'; + } + parent::onSubmit(); + } + function onShowEdit() { global $app, $conf; @@ -64,14 +88,30 @@ class page_action extends tform_actions { $server_id = $this->id; $this->dataRecord = $app->getconf->get_server_config($server_id, $section); + + $this->dataRecord['jailkit_chroot_app_programs'] = str_replace(' ', "\r\n", $this->dataRecord['jailkit_chroot_app_programs']); + + if($section == 'mail'){ + $server_config = $app->getconf->get_server_config($server_id, 'server'); + $rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/'; + } } $record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT'); $record['id'] = $this->id; + if(isset($rspamd_url)) $record['rspamd_url'] = $rspamd_url; $app->tpl->setVar($record); } + function onShowEnd() { + global $app; + + $app->tpl->setVar('server_name', $app->functions->htmlentities($app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ? AND ((SELECT COUNT(*) FROM server) > 1)", $this->id)['server_name'])); + + parent::onShowEnd(); + } + function onUpdateSave($sql) { global $app, $conf; @@ -92,6 +132,28 @@ class page_action extends tform_actions { } } } + + if($section === 'mail') { + if(isset($server_config_array['mail']['rspamd_available']) && $server_config_array['mail']['rspamd_available'] === 'y') { + $this->dataRecord['rspamd_available'] = 'y'; + } else { + $this->dataRecord['rspamd_available'] = 'n'; + } + } + + if(isset($this->dataRecord['jailkit_chroot_app_programs'])) { + $app->uses('file'); + $jailkit_chroot_app_programs = $this->dataRecord['jailkit_chroot_app_programs']; + $jailkit_chroot_app_programs = $app->file->unix_nl($jailkit_chroot_app_programs); + $jailkit_chroot_app_programs = explode("\n", $jailkit_chroot_app_programs); + $jailkit_chroot_app_programs = array_unique($jailkit_chroot_app_programs); + foreach ($jailkit_chroot_app_programs as $key => $value) { + if (trim($value)=='') { + unset($jailkit_chroot_app_programs[$key]); + } + } + $this->dataRecord['jailkit_chroot_app_programs'] = implode(' ', $jailkit_chroot_app_programs); + } if($app->tform->errorMessage == '') { $server_config_array[$section] = $app->tform->encode($this->dataRecord, $section); @@ -104,6 +166,49 @@ class page_action extends tform_actions { } } + function onAfterUpdate() { + global $app; + + if(isset($this->dataRecord['content_filter'])){ + $app->uses('ini_parser'); + $old_config = $app->ini_parser->parse_ini_string(stripslashes($this->oldDataRecord['config'])); + if($this->dataRecord['content_filter'] == 'rspamd' && $old_config['mail']['content_filter'] != $this->dataRecord['content_filter']){ + + $spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE server_id = ?", intval($this->id)); + if(is_array($spamfilter_users) && !empty($spamfilter_users)){ + foreach($spamfilter_users as $spamfilter_user){ + $app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true); + } + } + + $spamfilter_wblists = $app->db->queryAllRecords("SELECT * FROM spamfilter_wblist WHERE server_id = ?", intval($this->id)); + if(is_array($spamfilter_wblists) && !empty($spamfilter_wblists)){ + foreach($spamfilter_wblists as $spamfilter_wblist){ + $app->db->datalogUpdate('spamfilter_wblist', $spamfilter_wblist, 'wblist_id', $spamfilter_wblist["wblist_id"], true); + } + } + + $mail_users = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE server_id = ? AND (autoresponder = 'y' OR move_junk = 'y')", intval($this->id)); + if(is_array($mail_users) && !empty($mail_users)){ + foreach($mail_users as $mail_user){ + if($mail_user['autoresponder'] == 'y'){ + $mail_user['autoresponder'] = 'n'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + $mail_user['autoresponder'] = 'y'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + } else { + $mail_user['move_junk'] = 'n'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + $mail_user['move_junk'] = 'y'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + } + + } + } + } + } + } + } $app->tform_actions = new page_action; diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php index 5e552dbee7b9497c26bf17571c561cb85c4efbe9..b6664d4234ce27fdfc398877ad77e31f80d7e181 100644 --- a/interface/web/admin/software_package_list.php +++ b/interface/web/admin/software_package_list.php @@ -184,7 +184,7 @@ if(is_array($packages) && count($packages) > 0) { $app->tpl->setLoop('records', $packages); $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language']; -include_once 'lib/lang/'.$language.'_software_package_list.lng'; +include_once 'lib/lang/'.$app->functions->check_language($language).'_software_package_list.lng'; $app->tpl->setVar($wb); diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php index c987e9e04bebe9606a45cbac217d5c40925a7947..6d680c0ec1ce613db0e448866dbd0036a30c78fa 100644 --- a/interface/web/admin/software_update_list.php +++ b/interface/web/admin/software_update_list.php @@ -193,7 +193,7 @@ if(is_array($installed_packages)) { $app->tpl->setLoop('records', $records_out); $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language']; -include_once 'lib/lang/'.$language.'_software_update_list.lng'; +include_once 'lib/lang/'.$app->functions->check_language($language).'_software_update_list.lng'; $app->tpl->setVar($wb); diff --git a/interface/web/admin/templates/server_config_cron_edit.htm b/interface/web/admin/templates/server_config_cron_edit.htm index 908e6246b2d5abeffd864d2f5242d34bab3bd0c8..62e6efea76bc85d734cf1d214c38b40f4e22a80d 100644 --- a/interface/web/admin/templates/server_config_cron_edit.htm +++ b/interface/web/admin/templates/server_config_cron_edit.htm @@ -1,5 +1,5 @@

@@ -21,4 +21,4 @@
-
\ No newline at end of file + diff --git a/interface/web/admin/templates/server_config_dns_edit.htm b/interface/web/admin/templates/server_config_dns_edit.htm index b2b79665748f8f0d7815a33333123fb7dc8ab499..a4f7a26adef5ebe754dde5c9afe1fa95376ced93 100644 --- a/interface/web/admin/templates/server_config_dns_edit.htm +++ b/interface/web/admin/templates/server_config_dns_edit.htm @@ -1,5 +1,5 @@

diff --git a/interface/web/admin/templates/server_config_fastcgi_edit.htm b/interface/web/admin/templates/server_config_fastcgi_edit.htm index b4c5cac19eb79b9f93c6103e1d45d30b87ef5344..db476a091c4fc687df9e01dd86c6ffcaa5b4135e 100644 --- a/interface/web/admin/templates/server_config_fastcgi_edit.htm +++ b/interface/web/admin/templates/server_config_fastcgi_edit.htm @@ -1,5 +1,5 @@

@@ -26,12 +26,6 @@
-
- -
-
@@ -39,4 +33,4 @@
-
\ No newline at end of file + diff --git a/interface/web/admin/templates/server_config_getmail_edit.htm b/interface/web/admin/templates/server_config_getmail_edit.htm index 406dff412d5e04ee5938c8373411d50385d76278..84ca1ec73ffbac9a7f4901a2e75a39d220eabb2c 100644 --- a/interface/web/admin/templates/server_config_getmail_edit.htm +++ b/interface/web/admin/templates/server_config_getmail_edit.htm @@ -1,5 +1,5 @@

@@ -15,4 +15,4 @@
-
\ No newline at end of file + diff --git a/interface/web/admin/templates/server_config_jailkit_edit.htm b/interface/web/admin/templates/server_config_jailkit_edit.htm index 3371fd8a30063ac6b3aa6c29d54059564e3a29cb..47416797a02d6ba4af45069bccf42f5d0ad8924e 100644 --- a/interface/web/admin/templates/server_config_jailkit_edit.htm +++ b/interface/web/admin/templates/server_config_jailkit_edit.htm @@ -1,5 +1,5 @@

@@ -13,7 +13,7 @@
-
+
diff --git a/interface/web/admin/templates/server_config_mail_edit.htm b/interface/web/admin/templates/server_config_mail_edit.htm index 499a47f5985f0f51beca75fb74cb69959869050f..0cbef290216079dfaa379ac2bece98e3d5ad0577 100644 --- a/interface/web/admin/templates/server_config_mail_edit.htm +++ b/interface/web/admin/templates/server_config_mail_edit.htm @@ -1,5 +1,5 @@

@@ -32,18 +32,20 @@ {tmpl_var name='dkim_strength'} -
- -
+ {tmpl_var name='content_filter'}
-
- -
+
+ +
+
+ +
+
@@ -117,12 +119,6 @@ {tmpl_var name='overquota_notify_onok'}
-
- -
-
@@ -131,3 +127,24 @@ + + diff --git a/interface/web/admin/templates/server_config_rescue_edit.htm b/interface/web/admin/templates/server_config_rescue_edit.htm index 435449bf2413729d048abdf6bb8aaecab9c914c2..855ca877ee2586122c00d508298d33a221eadf49 100644 --- a/interface/web/admin/templates/server_config_rescue_edit.htm +++ b/interface/web/admin/templates/server_config_rescue_edit.htm @@ -1,5 +1,5 @@

@@ -17,14 +17,6 @@ {tmpl_var name='do_not_try_rescue_httpd'} -
diff --git a/interface/web/admin/templates/server_config_server_edit.htm b/interface/web/admin/templates/server_config_server_edit.htm index b69d7c9347afbfa33c9f72bd7c10beb90410e182..7c300124577f35e95aaae9a7e3e02c55d5b5a4c9 100644 --- a/interface/web/admin/templates/server_config_server_edit.htm +++ b/interface/web/admin/templates/server_config_server_edit.htm @@ -1,5 +1,5 @@

diff --git a/interface/web/admin/templates/server_config_ufw_edit.htm b/interface/web/admin/templates/server_config_ufw_edit.htm index e84260bc7aabf0868fc979e0f00bae5bac3bec72..85e9c782973dc69cc465323d4ac2d6e22440374d 100644 --- a/interface/web/admin/templates/server_config_ufw_edit.htm +++ b/interface/web/admin/templates/server_config_ufw_edit.htm @@ -1,5 +1,5 @@

@@ -60,4 +60,4 @@
-
\ No newline at end of file +
diff --git a/interface/web/admin/templates/server_config_vlogger_edit.htm b/interface/web/admin/templates/server_config_vlogger_edit.htm index edcbaeda84dc1304c81a7e16f4243dc950d54d55..a53ab7667682a6942b3733525f87929c33a17749 100644 --- a/interface/web/admin/templates/server_config_vlogger_edit.htm +++ b/interface/web/admin/templates/server_config_vlogger_edit.htm @@ -1,5 +1,5 @@

@@ -15,4 +15,4 @@
-
\ No newline at end of file + diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm index c1bae44c06f042850131ebe915062840ad7c7bad..bb61d866ca0a64b5381ecb51d94a9c7ac04d24a8 100644 --- a/interface/web/admin/templates/server_config_web_edit.htm +++ b/interface/web/admin/templates/server_config_web_edit.htm @@ -1,5 +1,5 @@

@@ -256,7 +256,10 @@
-
+
+ +
+
diff --git a/interface/web/admin/templates/server_config_xmpp_edit.htm b/interface/web/admin/templates/server_config_xmpp_edit.htm deleted file mode 100644 index 737b452c19c17492de330287e8ecbb17d0ce8b3c..0000000000000000000000000000000000000000 --- a/interface/web/admin/templates/server_config_xmpp_edit.htm +++ /dev/null @@ -1,78 +0,0 @@ - -

- - -
- -
-
-
- -
- {tmpl_var name='xmpp_use_ipv6'} -
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
-
-
-

{tmpl_var name='xmpp_ports_txt'}

-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
- - - -
- - -
diff --git a/interface/web/admin/templates/server_edit_services.htm b/interface/web/admin/templates/server_edit_services.htm index 2775e029d3d6a1b85ab3012e40b6e0ca2b0b8ba9..cfcc2fb8b2829a65c98b23c0940675ac1e39b019 100644 --- a/interface/web/admin/templates/server_edit_services.htm +++ b/interface/web/admin/templates/server_edit_services.htm @@ -4,7 +4,7 @@

- + {tmpl_hook name="begin_form"}
@@ -38,19 +38,9 @@ {tmpl_var name='db_server'}
-
- -
- {tmpl_var name='vserver_server'} -
-
-
- -
- {tmpl_var name='xmpp_server'} -
-
- + {tmpl_hook name="field_db_server"} + {tmpl_hook name="end_service_fields"} +
- + {tmpl_hook name="end_form"} diff --git a/interface/web/admin/templates/server_list.htm b/interface/web/admin/templates/server_list.htm index 1152909320f758d7e9fbe086296a4c1e7255c46b..25c18c01f0ac226da2ed356bfe310f8def146270 100644 --- a/interface/web/admin/templates/server_list.htm +++ b/interface/web/admin/templates/server_list.htm @@ -15,8 +15,7 @@ - - + {tmpl_hook name="end_table_headers"} {tmpl_var name='search_limit'} @@ -26,11 +25,10 @@ - - + {tmpl_hook name="end_table_filters"} - + "} @@ -42,8 +40,7 @@ {tmpl_var name="dns_server"} {tmpl_var name="file_server"} {tmpl_var name="db_server"} - {tmpl_var name="vserver_server"} - {tmpl_var name="xmpp_server"} + {tmpl_hook name="end_table_columns"} diff --git a/interface/web/admin/templates/server_php_list.htm b/interface/web/admin/templates/server_php_list.htm index 0fb98965bdd58931a6463933919b5fc8a3e76c6d..5a6392eea33a18664e1d9459ba05142d38c3768b 100644 --- a/interface/web/admin/templates/server_php_list.htm +++ b/interface/web/admin/templates/server_php_list.htm @@ -15,12 +15,14 @@ + + @@ -32,6 +34,7 @@ + @@ -54,4 +57,4 @@
{tmpl_var name='search_limit'}
{tmpl_var name="active"} {tmpl_var name="server_id"} {tmpl_var name="client_id"} {tmpl_var name="name"}
- \ No newline at end of file + diff --git a/interface/web/admin/templates/system_config_mail_edit.htm b/interface/web/admin/templates/system_config_mail_edit.htm index e29c5f44282d004e28ff5989c5b471025789d588..ae5fbc4d0a4681f743311fc169f77dd11fdd9359 100644 --- a/interface/web/admin/templates/system_config_mail_edit.htm +++ b/interface/web/admin/templates/system_config_mail_edit.htm @@ -45,15 +45,6 @@
 {tmpl_var name='webmail_url_note_txt'} [SERVERNAME]
-
- -
- {tmpl_var name='mailmailinglist_link'} -
-
-
- -
diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php index dfb4e7464909dfe4d31724ec844b4e064230953d..58ee7cf093d4b89165c1d7690c61aa50de5658c3 100644 --- a/interface/web/client/client_del.php +++ b/interface/web/client/client_del.php @@ -97,7 +97,7 @@ class page_action extends tform_actions { $app->tpl->setLoop('records', $table_list); //* load language file - $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_del.lng'; + $lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_client_del.lng'; include $lng_file; $app->tpl->setVar($wb); @@ -128,7 +128,7 @@ class page_action extends tform_actions { $app->db->query("DELETE FROM sys_user WHERE client_id = ?", $client_id); // Delete all records (sub-clients, mail, web, etc....) of this client. - $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_folder,web_folder_user,domain,mail_mailinglist,spamfilter_wblist'; + $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_folder,web_folder_user,domain,spamfilter_wblist'; $tables_array = explode(',', $tables); $client_group_id = $app->functions->intval($client_group['groupid']); if($client_group_id > 1) { diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index 8577a1b32d94a5c1e27de0c622495d3f0b4ca2be..0d06a42fe2956554eeb93d299c8784bd3c6d55b5 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -438,7 +438,6 @@ class page_action extends tform_actions { 'mail_user_smtp' => 'mailuser_id', 'mail_forwarding' => 'forwarding_id', 'mail_get' => 'mailget_id', - 'openvz_vm' => 'vm_id', 'shell_user' => 'shell_user_id', 'webdav_user' => 'webdav_user_id', 'web_database' => 'database_id', @@ -446,6 +445,11 @@ class page_action extends tform_actions { 'web_folder' => 'web_folder_id', 'web_folder_user' => 'web_folder_user_id' ); + + $addons_disable = $app->plugin->raiseEvent('client::get_lockable_data', $this->id, true); + if(is_array($addons_disable) && !empty($addons_disable)) { + $to_disable = array_merge($to_disable, $addons_disable); + } $udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ?', $this->id); $gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ?', $this->id); diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php index b4638bd2151ce076df7d96970166e163552d21ea..2617bbe67d9408a711933d6a68229022be4ed64b 100644 --- a/interface/web/client/client_message.php +++ b/interface/web/client/client_message.php @@ -42,7 +42,7 @@ $app->tpl->newTemplate('form.tpl.htm'); $app->tpl->setInclude('content_tpl', 'templates/client_message.htm'); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_message.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_client_message.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/client/domain_del.php b/interface/web/client/domain_del.php index 701b4494b8f92a1885a45ca750931a1f30a852f2..1165f3f936c141288955268a18b9d2080195f8c5 100644 --- a/interface/web/client/domain_del.php +++ b/interface/web/client/domain_del.php @@ -54,7 +54,7 @@ class page_action extends tform_actions { global $app; $conf; //* load language file - $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng'; + $lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'.lng'; include $lng_file; /* diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php index 8867e295783b6280bd6d26bff8c6f5e22a29b544..094e1899be3b8b7eb16f0c1b322d092884d5e851 100644 --- a/interface/web/client/domain_edit.php +++ b/interface/web/client/domain_edit.php @@ -49,7 +49,7 @@ $app->uses('tpl,tform,tform_actions'); $app->load('tform_actions'); //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'.lng'; include $lng_file; diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index 396cbff4ecd66cc093434f4cf8fdec703e4d9b00..b272fcbe264ad6d9befd0840c7ef93eea3038683 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -784,20 +784,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_mailmailinglist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailmailinglist_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), 'limit_mailforward' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', @@ -924,118 +910,7 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'default_xmppserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_xmppserver' - ), - 'xmpp_servers' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'MULTIPLE', - 'separator' => ',', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'validators' => array ( - 0 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_client', - 'function' => 'check_used_servers', - 'errmsg'=> 'xmpp_servers_used'), - ), - 'value' => '', - 'name' => 'xmpp_servers' - ), - 'limit_xmpp_domain' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_domain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_user' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_muc' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_anon' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_vjud' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_proxy' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_status' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_webpresence' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_http_upload' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_pastebin' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_httparchive' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'default_webserver' => array ( + 'default_webserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => '1', @@ -1100,7 +975,7 @@ $form["tabs"]['limits'] = array ( 'default' => '', 'separator' => ',', 'valuelimit' => 'client:web_php_options', - 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM') + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM') ), 'limit_cgi' => array ( 'datatype' => 'VARCHAR', @@ -1468,31 +1343,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_openvz_vm' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_openvz_vm_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_openvz_vm_template_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name', - 'keyfield'=> 'template_id', - 'valuefield'=> 'template_name' - ), - 'value' => array(0 => ' ') - ), 'limit_aps' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php index 76cc26c024fb1992a7c268b58dcd74b506bb7c7b..b6dc1b202a970f9e9b4e019688667645c0745c11 100644 --- a/interface/web/client/form/client_template.tform.php +++ b/interface/web/client/form/client_template.tform.php @@ -200,20 +200,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_mailmailinglist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailmailinglist_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), 'limit_mailforward' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', @@ -339,118 +325,8 @@ $form["tabs"]['limits'] = array ( 'maxlength' => '10', 'rows' => '', 'cols' => '' - ),/* - 'default_xmppserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_xmppserver' - ),*/ - 'xmpp_servers' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'MULTIPLE', - 'separator' => ',', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'validators' => array ( - 0 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_client', - 'function' => 'check_used_servers', - 'errmsg'=> 'xmpp_servers_used'), - ), - 'value' => '', - 'name' => 'xmpp_servers' - ), - 'limit_xmpp_domain' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_domain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_user' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_muc' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_anon' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_vjud' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_proxy' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_status' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_webpresence' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_http_upload' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_pastebin' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_httparchive' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ),/* + ), + /* 'default_webserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', @@ -508,7 +384,7 @@ $form["tabs"]['limits'] = array ( 'default' => '', 'separator' => ',', 'valuelimit' => 'client:web_php_options', - 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM') + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM') ), 'limit_cgi' => array ( 'datatype' => 'VARCHAR', @@ -872,31 +748,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_openvz_vm' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_openvz_vm_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_openvz_vm_template_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name', - 'keyfield'=> 'template_id', - 'valuefield'=> 'template_name' - ), - 'value' => array(0 => ' ') - ), 'limit_aps' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index bd839da34624064016f9b11a61f1047d4fdc9da8..53acfd602e872ca0448949cc34cbba275e658ccc 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -740,20 +740,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_mailmailinglist' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_mailmailinglist_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), 'limit_mailbox' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', @@ -922,118 +908,7 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'default_xmppserver' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'value' => '', - 'name' => 'default_xmppserver' - ), - 'xmpp_servers' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'MULTIPLE', - 'separator' => ',', - 'default' => '1', - 'datasource' => array ( 'type' => 'CUSTOM', - 'class'=> 'custom_datasource', - 'function'=> 'client_servers' - ), - 'validators' => array ( - 0 => array ( 'type' => 'CUSTOM', - 'class' => 'validate_client', - 'function' => 'check_used_servers', - 'errmsg'=> 'xmpp_servers_used'), - ), - 'value' => '', - 'name' => 'xmpp_servers' - ), - 'limit_xmpp_domain' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_domain_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_user' => array( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_xmpp_user_error_notint'), - ), - 'default' => '-1', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_xmpp_muc' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_anon' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_vjud' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_proxy' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_status' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_webpresence' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_http_upload' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_pastebin' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'limit_xmpp_httparchive' => array( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'default_webserver' => array ( + 'default_webserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', 'default' => '1', @@ -1097,7 +972,7 @@ $form["tabs"]['limits'] = array ( ), 'default' => '', 'separator' => ',', - 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM') + 'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM') ), 'limit_cgi' => array ( 'datatype' => 'VARCHAR', @@ -1467,31 +1342,6 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), - 'limit_openvz_vm' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'ISINT', - 'errmsg'=> 'limit_openvz_vm_error_notint'), - ), - 'default' => '0', - 'value' => '', - 'separator' => '', - 'width' => '10', - 'maxlength' => '10', - 'rows' => '', - 'cols' => '' - ), - 'limit_openvz_vm_template_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name', - 'keyfield'=> 'template_id', - 'valuefield'=> 'template_name' - ), - 'value' => array(0 => ' ') - ), 'limit_aps' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/client/lib/lang/cz.lng b/interface/web/client/lib/lang/cz.lng index 447810f9401ae7f7f5adc0db53bb260232827e6d..dabaf58eb7e9d8276e5e7e97264328d8c43f9f08 100644 --- a/interface/web/client/lib/lang/cz.lng +++ b/interface/web/client/lib/lang/cz.lng @@ -19,11 +19,11 @@ $wb['Edit Client Circle'] = 'Upravit skupinu klientů'; $wb['Domains'] = 'Domény'; $wb['domain_txt'] = 'Doména'; $wb['client_txt'] = 'Klient'; +$wb['error_domain_in dnsuse'] = 'Tato doména nemůže být odstraněna, jelikož je použitá jako DNS zóna'; +$wb['error_domain_in dnsslaveuse'] = 'Tato doména nemůže být odstraněna, jelikož je použitá jako sekundární DNS zóna'; $wb['error_domain_in mailuse'] = 'Tato doména nelze odstranit, protože je v používána jako poštovní doména'; $wb['error_domain_in webuse'] = 'Tato doména nelze odstranit, protože je v používána jako webová doména'; $wb['error_client_can_not_add_domain'] = 'Nemůžete přidat novou doménu'; $wb['error_client_group_id_empty'] = 'Musíte vybrat zákazníka
'; -$wb['error_domain_in dnsuse'] = 'This domain cannot be deleted, because it is in use as dns zone'; -$wb['error_domain_in dnsslaveuse'] = 'This domain cannot be deleted, because it is in use as secondary dns zone'; $wb['Email-Templates'] = 'E-mailové šablony'; ?> diff --git a/interface/web/client/lib/lang/de_client_template_list.lng b/interface/web/client/lib/lang/de_client_template_list.lng index 552035fd702e2a09d76ec7fb147245d6b2324616..cd5f339eea8c209b26267116db9ae9275e9237af 100644 --- a/interface/web/client/lib/lang/de_client_template_list.lng +++ b/interface/web/client/lib/lang/de_client_template_list.lng @@ -3,4 +3,5 @@ $wb['list_head_txt'] = 'Kundenvorlagen'; $wb['template_type_txt'] = 'Typ'; $wb['template_name_txt'] = 'Vorlagenname'; $wb['template_id_txt'] = 'Template ID'; +$wb['sys_groupid_txt'] = 'Reseller'; ?> diff --git a/interface/web/client/lib/lang/en.lng b/interface/web/client/lib/lang/en.lng index 743516c96cf4db5a74d987adeabca9cd254b89ef..40154b03acf30fc62bab7d14196f0e5f06ec5fc4 100644 --- a/interface/web/client/lib/lang/en.lng +++ b/interface/web/client/lib/lang/en.lng @@ -24,7 +24,6 @@ $wb['error_domain_in dnsslaveuse'] = 'This domain cannot be deleted, because it $wb['error_domain_in mailuse'] = 'This domain cannot be deleted, because it is in use as mail-domain'; $wb['error_domain_in webuse'] = 'This domain cannot be deleted, because it is in use as web-domain'; $wb['error_client_can_not_add_domain'] = 'You cannot add a new domain'; -$wb['domain_txt'] = 'Domain'; $wb['error_client_group_id_empty'] = 'You have to select a customer
'; $wb['Email-Templates'] = 'Email-Templates'; -?> \ No newline at end of file +?> diff --git a/interface/web/client/lib/lang/en_client_template_list.lng b/interface/web/client/lib/lang/en_client_template_list.lng index 1906cefc469e063b01a1ea409cb7fe311f964977..a0442c835c152dbc00b79613abeae1bc5732c025 100644 --- a/interface/web/client/lib/lang/en_client_template_list.lng +++ b/interface/web/client/lib/lang/en_client_template_list.lng @@ -3,4 +3,5 @@ $wb["list_head_txt"] = 'Client and Reseller Templates'; $wb["template_type_txt"] = 'Type'; $wb["template_name_txt"] = 'Template name'; $wb['template_id_txt'] = 'Template ID'; +$wb['sys_groupid_txt'] = 'Reseller'; ?> diff --git a/interface/web/client/lib/lang/fa_client_circle.lng b/interface/web/client/lib/lang/fa_client_circle.lng new file mode 100644 index 0000000000000000000000000000000000000000..72fb916425b7e5ef472ff80391e8800576d8be45 --- /dev/null +++ b/interface/web/client/lib/lang/fa_client_circle.lng @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_client_circle_list.lng b/interface/web/client/lib/lang/fa_client_circle_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..e51ad368efb1d1667d124d70257d2a18339e7131 --- /dev/null +++ b/interface/web/client/lib/lang/fa_client_circle_list.lng @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_client_message.lng b/interface/web/client/lib/lang/fa_client_message.lng new file mode 100644 index 0000000000000000000000000000000000000000..b11ce20ff86d1e48c8baef6dc66c098f7eac2dbf --- /dev/null +++ b/interface/web/client/lib/lang/fa_client_message.lng @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_client_message_template_list.lng b/interface/web/client/lib/lang/fa_client_message_template_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..13ee5d914014ad4ca1765b9f6c532395b6204bf1 --- /dev/null +++ b/interface/web/client/lib/lang/fa_client_message_template_list.lng @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_client_template_list.lng b/interface/web/client/lib/lang/fa_client_template_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..150a9055ca2bbc3b3888296b9c9c930b7e0cfa92 --- /dev/null +++ b/interface/web/client/lib/lang/fa_client_template_list.lng @@ -0,0 +1,7 @@ + diff --git a/interface/web/client/lib/lang/fa_clients_list.lng b/interface/web/client/lib/lang/fa_clients_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..0285e38c640ed9a018ae33113c6e10438d4c2844 --- /dev/null +++ b/interface/web/client/lib/lang/fa_clients_list.lng @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_domain.lng b/interface/web/client/lib/lang/fa_domain.lng new file mode 100644 index 0000000000000000000000000000000000000000..7288bfee2e3c3bbd5506cd3f0bb84fccfee30572 --- /dev/null +++ b/interface/web/client/lib/lang/fa_domain.lng @@ -0,0 +1,6 @@ + diff --git a/interface/web/client/lib/lang/fa_domain_list.lng b/interface/web/client/lib/lang/fa_domain_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..a6434f5a4dc045252771c28d1b1c04926e733cbf --- /dev/null +++ b/interface/web/client/lib/lang/fa_domain_list.lng @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/fa_resellers_list.lng b/interface/web/client/lib/lang/fa_resellers_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..3f0c881ca39f2098f1664655f05ce0856dfa4108 --- /dev/null +++ b/interface/web/client/lib/lang/fa_resellers_list.lng @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/remote.conf.php b/interface/web/client/lib/remote.conf.php index d58029e8513ad78a26ca2abfa783ec41d70bfea8..0c2449b93901911b18098b4e2627e8ddedfc3a75 100644 --- a/interface/web/client/lib/remote.conf.php +++ b/interface/web/client/lib/remote.conf.php @@ -1,7 +1,7 @@ 'sys_groupid', + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'op' => '=', + 'prefix' => '', + 'suffix' => '', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'keyfield'=> 'groupid', + 'valuefield'=> 'name' + ), + 'width' => '', + 'value' => '' + ); +} $liste["item"][] = array( 'field' => "template_id", 'datatype' => "INTEGER", diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index 83ba88d12dbac2f0fd06cdbbd6dc7b6284eeb136..16cd1fc201a043ccda0b77a503ad2046fafc2aea 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -207,9 +207,6 @@
-
- -
@@ -242,91 +239,7 @@ -
- -
-
-
- -
-
-
- -
-
- -
- -
- -
- {tmpl_var name='limit_xmpp_muc'} -
-
-
- -
- {tmpl_var name='limit_xmpp_pastebin'} -
-
-
- -
- {tmpl_var name='limit_xmpp_httparchive'} -
-
-
- -
- {tmpl_var name='limit_xmpp_anon'} -
-
-
- -
- {tmpl_var name='limit_xmpp_vjud'} -
-
-
- -
- {tmpl_var name='limit_xmpp_proxy'} -
-
-
- -
- {tmpl_var name='limit_xmpp_status'} -
-
-
- -
- {tmpl_var name='limit_xmpp_webpresence'} -
-
-
- -
- {tmpl_var name='limit_xmpp_http_upload'} -
-
-
-
-
+
-
- -
-
-
- -
-
- -
-
-
-
-
+ {tmpl_hook name="end_form"} diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm index 4e10891c97a9a505d8d9d2a56e32159f122d086d..abaf65aad71bdd6c96dbc3e3ffff4ea3dba12199 100644 --- a/interface/web/client/templates/client_template_edit_limits.htm +++ b/interface/web/client/templates/client_template_edit_limits.htm @@ -165,9 +165,6 @@
-
- -
@@ -200,91 +197,6 @@ -
- -
-
-
- -
-
-
- -
-
- -
- -
- -
- {tmpl_var name='limit_xmpp_muc'} -
-
-
- -
- {tmpl_var name='limit_xmpp_pastebin'} -
-
-
- -
- {tmpl_var name='limit_xmpp_httparchive'} -
-
-
- -
- {tmpl_var name='limit_xmpp_anon'} -
-
-
- -
- {tmpl_var name='limit_xmpp_vjud'} -
-
-
- -
- {tmpl_var name='limit_xmpp_proxy'} -
-
-
- -
- {tmpl_var name='limit_xmpp_status'} -
-
-
- -
- {tmpl_var name='limit_xmpp_webpresence'} -
-
-
- -
- {tmpl_var name='limit_xmpp_http_upload'} -
-
-
-
-
-
- -
-
-
- -
-
- -
-
-
-
-
+ {tmpl_hook name="end_form"}
diff --git a/interface/web/client/templates/client_template_list.htm b/interface/web/client/templates/client_template_list.htm index 16176b131cec403d2f02ed595c13ad17a1b36c82..37564f7197c2f6c01749cd6ee8b00f61da0c7b0c 100644 --- a/interface/web/client/templates/client_template_list.htm +++ b/interface/web/client/templates/client_template_list.htm @@ -17,12 +17,14 @@ + {tmpl_var name='search_limit'} + {tmpl_var name='search_template_type'} @@ -34,6 +36,7 @@ {tmpl_var name="template_id"} + {tmpl_var name="sys_groupid"} {tmpl_var name="template_type"} {tmpl_var name="template_name"} @@ -43,16 +46,16 @@ - {tmpl_var name='globalsearch_noresults_text_txt'} + {tmpl_var name='globalsearch_noresults_text_txt'} - +
- \ No newline at end of file + diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm index 87691e3d2ef2f7a02ff129c5fc232007f380a7db..539b7d5e4107204e1490f134e37123e1b834d706 100644 --- a/interface/web/client/templates/reseller_edit_limits.htm +++ b/interface/web/client/templates/reseller_edit_limits.htm @@ -209,9 +209,6 @@
-
- -
@@ -244,91 +241,7 @@ -
- -
-
-
- -
-
-
- -
-
- -
- -
- -
- {tmpl_var name='limit_xmpp_muc'} -
-
-
- -
- {tmpl_var name='limit_xmpp_pastebin'} -
-
-
- -
- {tmpl_var name='limit_xmpp_httparchive'} -
-
-
- -
- {tmpl_var name='limit_xmpp_anon'} -
-
-
- -
- {tmpl_var name='limit_xmpp_vjud'} -
-
-
- -
- {tmpl_var name='limit_xmpp_proxy'} -
-
-
- -
- {tmpl_var name='limit_xmpp_status'} -
-
-
- -
- {tmpl_var name='limit_xmpp_webpresence'} -
-
-
- -
- {tmpl_var name='limit_xmpp_http_upload'} -
-
-
-
-
+
-
- -
-
-
- -
-
- -
-
-
-
-
+ {tmpl_hook name="end_form"}
+
+ +
+ {tmpl_var name='jailkit_jkupdate_cron'} +
+
- {tmpl_var name="available_apache_directive_snippets_txt"}

 {tmpl_var name="apache_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT} + {tmpl_var name="available_apache_directive_snippets_txt"}

 {tmpl_var name="apache_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT}, {DOCROOT_CLIENT}
- {tmpl_var name="available_nginx_directive_snippets_txt"}

 {tmpl_var name="nginx_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT}, {FASTCGIPASS}, {PHPFALLBACKFASTCGIPASS} + {tmpl_var name="available_nginx_directive_snippets_txt"}

 {tmpl_var name="nginx_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT}, {DOCROOT_CLIENT}, {FASTCGIPASS}, {PHPFALLBACKFASTCGIPASS}
diff --git a/interface/web/sites/templates/web_vhost_domain_edit.htm b/interface/web/sites/templates/web_vhost_domain_edit.htm index 86fd3b294f8f01120a7f20950394ad27b875607a..6a6dc2d288809179c37b447b608c8aa176fc348a 100644 --- a/interface/web/sites/templates/web_vhost_domain_edit.htm +++ b/interface/web/sites/templates/web_vhost_domain_edit.htm @@ -293,31 +293,21 @@ reloadFastcgiPHPVersions(); }); - if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm' || (jQuery('#php').val() == 'hhvm' && serverType == 'nginx')){ + if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){ jQuery('.fastcgi_php_version:hidden').show(); - if(jQuery('#php').val() == 'hhvm'){ - jQuery('#fastcgi_php_version_txt').hide(); - jQuery('#fastcgi_php_fallback_version_txt').show(); - } else { - jQuery('#fastcgi_php_version_txt').show(); - jQuery('#fastcgi_php_fallback_version_txt').hide(); - } - } else { + jQuery('#fastcgi_php_version_txt').show(); + jQuery('#fastcgi_php_fallback_version_txt').hide(); + } else { jQuery('.fastcgi_php_version:visible').hide(); } //ISPConfig.resetFormChanged(); jQuery('#php').change(function(){ reloadFastcgiPHPVersions(); - if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm' || (jQuery(this).val() == 'hhvm' && serverType == 'nginx')){ + if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){ jQuery('.fastcgi_php_version:hidden').show(); - if(jQuery(this).val() == 'hhvm'){ - jQuery('#fastcgi_php_version_txt').hide(); - jQuery('#fastcgi_php_fallback_version_txt').show(); - } else { - jQuery('#fastcgi_php_version_txt').show(); - jQuery('#fastcgi_php_fallback_version_txt').hide(); - } + jQuery('#fastcgi_php_version_txt').show(); + jQuery('#fastcgi_php_fallback_version_txt').hide(); } else { jQuery('.fastcgi_php_version:visible').hide(); } @@ -373,21 +363,17 @@ } }); */ - if(selected != "no" && selected != "php-fpm" && selected != "hhvm") { + if(selected != "no" && selected != "php-fpm") { jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm'); } jQuery('#php option[value="fast-cgi"]').hide(); - jQuery('#php option[value="cgi"]').hide(); jQuery('#php option[value="mod"]').hide(); - jQuery('#php option[value="suphp"]').hide(); } else { serverType = 'apache'; jQuery('.nginx').hide(); jQuery('.apache').show(); jQuery('#php option[value="fast-cgi"]').show(); - jQuery('#php option[value="cgi"]').show(); jQuery('#php option[value="mod"]').show(); - jQuery('#php option[value="suphp"]').show(); } if(noFormChange) { ISPConfig.resetFormChanged(); @@ -444,8 +430,8 @@ function reloadFastcgiPHPVersions(noFormChange) { jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi", client_group_id : clientGroupId}, function(data) { - var options = ''; - //var options = ''; + //var options = ''; + var options = ''; var phpfastcgiselected = ''; $.each(data, function(key, val) { @@ -468,7 +454,7 @@ phpfastcgiselected = ''; - options += ''; + //options += ''; $('#fastcgi_php_version').html(options).change(); if(noFormChange) ISPConfig.resetFormChanged(); }); diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 674d4c7b23d341e9d6af6a008f73aa72171f44d2..d85e5da9a1b0f761f1d0f7f3cd2fc3d1218bfe50 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -243,24 +243,24 @@ class page_action extends tform_actions { if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; if($this->_vhostdomain_type == 'domain') { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']); } if($this->dataRecord['php'] == 'fast-cgi'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']); } } else { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); } if($this->dataRecord['php'] == 'fast-cgi'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); } } - $php_select = ""; + $php_select = ""; if(is_array($php_records) && !empty($php_records)) { foreach( $php_records as $php_record) { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; } else { $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; @@ -390,24 +390,24 @@ class page_action extends tform_actions { $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id); $sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'"; if($this->_vhostdomain_type == 'domain') { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where." ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']); } if($this->dataRecord['php'] == 'fast-cgi') { $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where." ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']); } } else { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); } if($this->dataRecord['php'] == 'fast-cgi') { $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']); } } - $php_select = ""; + $php_select = ""; if(is_array($php_records) && !empty($php_records)) { foreach( $php_records as $php_record) { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; } else { $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; @@ -610,24 +610,24 @@ class page_action extends tform_actions { $selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id); $sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'"; if($this->_vhostdomain_type == 'domain') { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where." ORDER BY name", $server_id, $selected_client['client_id']); } if($this->dataRecord['php'] == 'fast-cgi') { $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where." ORDER BY name", $server_id, $selected_client['client_id']); } } else { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND active = 'y' ORDER BY name", $parent_domain['server_id']); } if($this->dataRecord['php'] == 'fast-cgi') { $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND active = 'y' ORDER BY name", $parent_domain['server_id']); } } - $php_select = ""; + $php_select = ""; if(is_array($php_records) && !empty($php_records)) { foreach( $php_records as $php_record) { - if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){ + if($this->dataRecord['php'] == 'php-fpm'){ $php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir']; } else { $php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir']; @@ -952,7 +952,6 @@ class page_action extends tform_actions { function onSubmit() { global $app, $conf; - // Set a few fixed values $this->dataRecord["vhost_type"] = 'name'; if($this->_vhostdomain_type == 'domain') { diff --git a/interface/web/themes/default/assets/stylesheets/bootstrap.min.css b/interface/web/themes/default/assets/stylesheets/bootstrap.min.css index 4af8905e5b8a97dee4470a7d15ebbf0ad2a22a7d..e351b378aac550b368b318e6f5ac2bedf2f0c00a 100644 --- a/interface/web/themes/default/assets/stylesheets/bootstrap.min.css +++ b/interface/web/themes/default/assets/stylesheets/bootstrap.min.css @@ -2,4 +2,4 @@ * Bootstrap v3.3.0 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - *//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:before,:after{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before,.glyphicon-eur:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px;line-height:1.5 \0}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px;line-height:1.33 \0}_:-ms-fullscreen,:root input[type=date],_:-ms-fullscreen,:root input[type=time],_:-ms-fullscreen,:root input[type=datetime-local],_:-ms-fullscreen,:root input[type=month]{line-height:1.42857143}_:-ms-fullscreen.input-sm,:root input[type=date].input-sm,_:-ms-fullscreen.input-sm,:root input[type=time].input-sm,_:-ms-fullscreen.input-sm,:root input[type=datetime-local].input-sm,_:-ms-fullscreen.input-sm,:root input[type=month].input-sm{line-height:1.5}_:-ms-fullscreen.input-lg,:root input[type=date].input-lg,_:-ms-fullscreen.input-lg,:root input[type=time].input-lg,_:-ms-fullscreen.input-lg,:root input[type=datetime-local].input-lg,_:-ms-fullscreen.input-lg,:root input[type=month].input-lg{line-height:1.33}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm,select.form-group-sm .form-control{height:30px;line-height:30px}textarea.input-sm,textarea.form-group-sm .form-control,select[multiple].input-sm,select[multiple].form-group-sm .form-control{height:auto}.input-lg,.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg,select.form-group-lg .form-control{height:46px;line-height:46px}textarea.input-lg,textarea.form-group-lg .form-control,select[multiple].input-lg,select[multiple].form-group-lg .form-control{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus,.btn.focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default.focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled.focus,.btn-default[disabled].focus,fieldset[disabled] .btn-default.focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary.focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled.focus,.btn-primary[disabled].focus,fieldset[disabled] .btn-primary.focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success.focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled.focus,.btn-success[disabled].focus,fieldset[disabled] .btn-success.focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info.focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled.focus,.btn-info[disabled].focus,fieldset[disabled] .btn-info.focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning.focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled.focus,.btn-warning[disabled].focus,fieldset[disabled] .btn-warning.focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger.focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled.focus,.btn-danger[disabled].focus,fieldset[disabled] .btn-danger.focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;border-radius:0}.btn-link,.btn-link:active,.btn-link.active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none;visibility:hidden}.collapse.in{display:block;visibility:visible}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=radio],[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none;visibility:hidden}.tab-content>.active{display:block;visibility:visible}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important;visibility:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-left,.media-right,.media-body{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table caption,.panel>.table-responsive>.table caption,.panel>.panel-collapse>.table caption{padding-right:15px;padding-left:15px}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body,.panel-group .panel-heading+.panel-collapse>.list-group{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-size:14px;font-weight:400;line-height:1.42857143;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000}.carousel-inner>.item.next,.carousel-inner>.item.active.right{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.prev,.carousel-inner>.item.active.left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right,.carousel-inner>.item.active{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file + *//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:before,:after{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before,.glyphicon-eur:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}.form-control[type=radio]{-webkit-box-shadow: none;box-shadow: none;}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px;line-height:1.5 \0}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px;line-height:1.33 \0}_:-ms-fullscreen,:root input[type=date],_:-ms-fullscreen,:root input[type=time],_:-ms-fullscreen,:root input[type=datetime-local],_:-ms-fullscreen,:root input[type=month]{line-height:1.42857143}_:-ms-fullscreen.input-sm,:root input[type=date].input-sm,_:-ms-fullscreen.input-sm,:root input[type=time].input-sm,_:-ms-fullscreen.input-sm,:root input[type=datetime-local].input-sm,_:-ms-fullscreen.input-sm,:root input[type=month].input-sm{line-height:1.5}_:-ms-fullscreen.input-lg,:root input[type=date].input-lg,_:-ms-fullscreen.input-lg,:root input[type=time].input-lg,_:-ms-fullscreen.input-lg,:root input[type=datetime-local].input-lg,_:-ms-fullscreen.input-lg,:root input[type=month].input-lg{line-height:1.33}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm,select.form-group-sm .form-control{height:30px;line-height:30px}textarea.input-sm,textarea.form-group-sm .form-control,select[multiple].input-sm,select[multiple].form-group-sm .form-control{height:auto}.input-lg,.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg,select.form-group-lg .form-control{height:46px;line-height:46px}textarea.input-lg,textarea.form-group-lg .form-control,select[multiple].input-lg,select[multiple].form-group-lg .form-control{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus,.btn.focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default.focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled.focus,.btn-default[disabled].focus,fieldset[disabled] .btn-default.focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary.focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled.focus,.btn-primary[disabled].focus,fieldset[disabled] .btn-primary.focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success.focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled.focus,.btn-success[disabled].focus,fieldset[disabled] .btn-success.focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info.focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled.focus,.btn-info[disabled].focus,fieldset[disabled] .btn-info.focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning.focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled.focus,.btn-warning[disabled].focus,fieldset[disabled] .btn-warning.focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger.focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled.focus,.btn-danger[disabled].focus,fieldset[disabled] .btn-danger.focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;border-radius:0}.btn-link,.btn-link:active,.btn-link.active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none;visibility:hidden}.collapse.in{display:block;visibility:visible}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=radio],[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none;visibility:hidden}.tab-content>.active{display:block;visibility:visible}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important;visibility:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-left,.media-right,.media-body{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table caption,.panel>.table-responsive>.table caption,.panel>.panel-collapse>.table caption{padding-right:15px;padding-left:15px}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body,.panel-group .panel-heading+.panel-collapse>.list-group{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-size:14px;font-weight:400;line-height:1.42857143;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000}.carousel-inner>.item.next,.carousel-inner>.item.active.right{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.prev,.carousel-inner>.item.active.left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right,.carousel-inner>.item.active{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file diff --git a/interface/web/themes/default/assets/stylesheets/ispconfig.css b/interface/web/themes/default/assets/stylesheets/ispconfig.css index 23366e919d4644833b876825657cfca076b259ac..76055e6c7ecee863c7c2c25bde694d25d0d6c889 100644 --- a/interface/web/themes/default/assets/stylesheets/ispconfig.css +++ b/interface/web/themes/default/assets/stylesheets/ispconfig.css @@ -25,6 +25,9 @@ body { .form-group input[type='checkbox'] { margin-top: 10px; } +.form-group .checkbox-inline input[type='checkbox'] { + margin-top: 4px; } + .control-label { font-weight: normal; } .control-label:after { @@ -168,7 +171,6 @@ body { #select_server a { padding:0 10px; } - .page-header { margin: 20px 0; padding: 0; } @@ -807,3 +809,16 @@ span.pbvaluemargin { .ip_suggestion_server { font-weight: bold; } +.finediff { + font-family: monospace; +} +.finediff ins { + color: green; + background: #dfd; + text-decoration: none; +} +.finediff del { + color: red; + background: #fdd; + text-decoration: none; +} diff --git a/interface/web/themes/default/assets/stylesheets/ispconfig.sass b/interface/web/themes/default/assets/stylesheets/ispconfig.sass index 9855d07dc1ccbdded77d195b1796753506d919fd..3ea081053405df2cbbe81b98661e1f3e9d9cc055 100644 --- a/interface/web/themes/default/assets/stylesheets/ispconfig.sass +++ b/interface/web/themes/default/assets/stylesheets/ispconfig.sass @@ -25,6 +25,9 @@ body .form-group input[type='checkbox'] margin-top: 10px +.form-group .checkbox-inline input[type='checkbox'] + margin-top: 4px + .control-label font-weight: normal @@ -311,4 +314,4 @@ thead.dark .input-group-field:last-child border-top-left-radius: 0 - border-bottom-left-radius: 0 \ No newline at end of file + border-bottom-left-radius: 0 diff --git a/interface/web/tools/dns_import_tupa.php b/interface/web/tools/dns_import_tupa.php index 12bd03529673c39a8b5d9979e2f4cf4bc6a84111..d1b4e1af3b05e86624e9b9d500f7c6664d996488 100644 --- a/interface/web/tools/dns_import_tupa.php +++ b/interface/web/tools/dns_import_tupa.php @@ -49,32 +49,27 @@ if(isset($_POST['start']) && $_POST['start'] == 1) { //* CSRF Check $app->auth->csrf_token_check(); - //* Set variable sin template + //* Set variables in template $app->tpl->setVar('dbhost', $_POST['dbhost'], true); $app->tpl->setVar('dbname', $_POST['dbname'], true); $app->tpl->setVar('dbuser', $_POST['dbuser'], true); $app->tpl->setVar('dbpassword', $_POST['dbpassword'], true); + $app->tpl->setVar('dbssl', 'true', true); //* Establish connection to external database $msg .= 'Connecting to external database...
'; - //* Backup DB login details - /*$conf_bak['db_host'] = $conf['db_host']; - $conf_bak['db_database'] = $conf['db_database']; - $conf_bak['db_user'] = $conf['db_user']; - $conf_bak['db_password'] = $conf['db_password'];*/ + //* Set external db client flags + $db_client_flags = 0; + if(isset($_POST['dbssl']) && $_POST['dbssl'] == 1) $db_client_flags |= MYSQLI_CLIENT_SSL; - //* Set external Login details - $conf['imp_db_host'] = $_POST['dbhost']; - $conf['imp_db_database'] = $_POST['dbname']; - $conf['imp_db_user'] = $_POST['dbuser']; - $conf['imp_db_password'] = $_POST['dbpassword']; - $conf['imp_db_charset'] = $conf['db_charset']; - $conf['imp_db_new_link'] = $conf['db_new_link']; - $conf['imp_db_client_flags'] = $conf['db_client_flags']; - - //* create new db object - $exdb = new db('imp'); + //* create new db object with external login details + try { + $exdb = new db($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpassword'], $_POST['dbname'], 3306, $db_client_flags); + } catch (Exception $e) { + $error .= "Error connecting to Tupa database" . ($e->getMessage() ? ": " . $e->getMessage() : '.') . "
\n"; + $exdb = false; + } $server_id = 1; $sys_userid = 1; @@ -159,26 +154,13 @@ if(isset($_POST['start']) && $_POST['start'] == 1) { ); $dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id'); //$msg .= $insert_data.'
'; - } } } - } } - - - - } else { - $error .= $exdb->errorMessage; } - //* restore db login details - /*$conf['db_host'] = $conf_bak['db_host']; - $conf['db_database'] = $conf_bak['db_database']; - $conf['db_user'] = $conf_bak['db_user']; - $conf['db_password'] = $conf_bak['db_password'];*/ - } $app->tpl->setVar('msg', $msg); diff --git a/interface/web/tools/import_ispconfig.php b/interface/web/tools/import_ispconfig.php index a1ab9e14a41b17e262c72060c75045f60fa03306..e2b8bad6479d43aeced846ebf2669da516276054 100644 --- a/interface/web/tools/import_ispconfig.php +++ b/interface/web/tools/import_ispconfig.php @@ -44,7 +44,7 @@ $msg = ''; $error = ''; //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_import_ispconfig.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_import_ispconfig.lng'; include $lng_file; $app->tpl->setVar($wb); @@ -109,16 +109,17 @@ if(isset($_POST['connected'])) { try { - //* Second connections to self signed SSL certs + //* Allow connections to self signed SSL certs $context = stream_context_create( array( - 'ssl' => array ( - 'verify_peer' => false, - 'verify_peer_name' => false, - 'allow_self_signed' => true - ) + 'ssl' => array ( + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true ) + ) ); + $client = new SoapClient(null, array('location' => $_POST['remote_server'], 'uri' => $_POST['remote_server'].'/index.php', 'trace' => 1, diff --git a/interface/web/tools/import_vpopmail.php b/interface/web/tools/import_vpopmail.php index 3ef87710e593cb37c6980e5cfa4e16c54052dc3d..036b9fbd5fc4ee42ebcb8883d935b210be1588ea 100644 --- a/interface/web/tools/import_vpopmail.php +++ b/interface/web/tools/import_vpopmail.php @@ -46,23 +46,23 @@ $msg = ''; $error = ''; //* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_import_vpopmail.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_import_vpopmail.lng'; include $lng_file; $app->tpl->setVar($wb); if(isset($_POST['db_hostname']) && $_POST['db_hostname'] != '') { - //* Set external Login details - $conf['imp_db_host'] = $_POST['db_hostname']; - $conf['imp_db_database'] = $_POST['db_name']; - $conf['imp_db_user'] = $_POST['db_user']; - $conf['imp_db_password'] = $_POST['db_password']; - $conf['imp_db_charset'] = 'utf8'; - $conf['imp_db_new_link'] = false; - $conf['imp_db_client_flags'] = 0; + //* Set external db client flags + $db_client_flags = 0; + if(isset($_POST['db_ssl']) && $_POST['db_ssl'] == 1) $db_client_flags |= MYSQLI_CLIENT_SSL; - //* create new db object - $exdb = new db('imp'); + //* create new db object with external login details + try { + $exdb = new db($_POST['db_hostname'], $_POST['db_user'], $_POST['db_password'], $_POST['db_name'], 3306, $db_client_flags); + } catch (Exception $e) { + $error .= "Error connecting to database" . ($e->getMessage() ? ": " . $e->getMessage() : '.') . "
\n"; + $exdb = false; + } if($exdb !== false) { $msg .= 'Databse connection succeeded
'; @@ -75,9 +75,6 @@ if(isset($_POST['db_hostname']) && $_POST['db_hostname'] != '') { } else { $msg .= 'The server with the ID $local_server_id is not a mail server.
'; } - - } else { - $msg .= 'Database connection failed
'; } } else { @@ -88,6 +85,7 @@ $app->tpl->setVar('db_hostname', $_POST['db_hostname'], true); $app->tpl->setVar('db_user', $_POST['db_user'], true); $app->tpl->setVar('db_password', $_POST['db_password'], true); $app->tpl->setVar('db_name', $_POST['db_name'], true); +$app->tpl->setVar('db_ssl', 'true', true); $app->tpl->setVar('local_server_id', $_POST['local_server_id'], true); $app->tpl->setVar('msg', $msg); $app->tpl->setVar('error', $error); @@ -112,8 +110,8 @@ function start_import() { $country = 'FI'; //* add client - $sql = "INSERT INTO `client` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `company_name`, `company_id`, `contact_name`, `customer_no`, `vat_id`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `notes`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `default_mailserver`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `default_webserver`, `limit_web_ip`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_web_subdomain`, `limit_web_aliasdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_aps`, `default_dnsserver`, `limit_dns_zone`, `limit_dns_slave_zone`, `limit_dns_record`, `default_dbserver`, `limit_database`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_client`, `limit_mailmailinglist`, `limit_openvz_vm`, `limit_openvz_vm_template_id`, `parent_client_id`, `username`, `password`, `language`, `usertheme`, `template_master`, `template_additional`, `created_at`, `id_rsa`, `ssh_rsa`) - VALUES(1, 1, 'riud', 'riud', '', '', '', ?, '', '', '', '', '', '', ?, '', '', '', '', 'http://', '', '', '', '', '', '', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,cgi,mod,suphp', 'n', 'n', 'n', 'n', 'n', 'y', 'n', 'n', 'n', -1, -1, -1, 0, 'no,jailkit', 0, 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, -1, 0, 0, 0, ?, ?, ?, 'default', 0, '', NOW(), '', '')"; + $sql = "INSERT INTO `client` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `company_name`, `company_id`, `contact_name`, `customer_no`, `vat_id`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `notes`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `default_mailserver`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `default_webserver`, `limit_web_ip`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_web_subdomain`, `limit_web_aliasdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_aps`, `default_dnsserver`, `limit_dns_zone`, `limit_dns_slave_zone`, `limit_dns_record`, `default_dbserver`, `limit_database`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_client`, `parent_client_id`, `username`, `password`, `language`, `usertheme`, `template_master`, `template_additional`, `created_at`, `id_rsa`, `ssh_rsa`) + VALUES(1, 1, 'riud', 'riud', '', '', '', ?, '', '', '', '', '', '', ?, '', '', '', '', 'http://', '', '', '', '', '', '', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,mod', 'n', 'n', 'n', 'n', 'n', 'y', 'n', 'n', 'n', -1, -1, -1, 0, 'no,jailkit', 0, 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, 0, ?, ?, ?, 'default', 0, '', NOW(), '', '')"; $app->db->query($sql, $pw_domain,$country, $pw_domain, $pw_crypt_password, $conf['language']); $client_id = $app->db->insertID(); diff --git a/interface/web/tools/index.php b/interface/web/tools/index.php index 05c7f71fbafee1d68e017102693f9738b59b8824..0e223b98a457789172c947c8d545eaa38edd460c 100644 --- a/interface/web/tools/index.php +++ b/interface/web/tools/index.php @@ -41,7 +41,7 @@ $app->uses('tpl'); $app->tpl->newTemplate('listpage.tpl.htm'); $app->tpl->setInclude('content_tpl', 'templates/index.htm'); -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_index.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/tools/lib/lang/cz.lng b/interface/web/tools/lib/lang/cz.lng index 66bcaf49ae1aca04f3c85100ce9bf0a87f1c74c9..9e790f35e8b2899a25161244ad94b0bac5ef7268 100644 --- a/interface/web/tools/lib/lang/cz.lng +++ b/interface/web/tools/lib/lang/cz.lng @@ -2,12 +2,12 @@ $wb['User Settings'] = 'Uživatelská nastavení'; $wb['Settings'] = 'Nastavení'; $wb['ISPConfig Tools'] = 'ISPConfig nástroje'; +$wb['Interface'] = 'Rozhraní'; $wb['Password and Language'] = 'Heslo a jazyk'; $wb['ispconfig_tools_note'] = 'Tento modul umožňuje změnit heslo a jazyk pro zahájení resynchronizace DNS záznamů.'; -$wb['Resync'] = 'Resynchronizace'; $wb['Sync Tools'] = 'Synchronizační nástroje'; +$wb['Resync'] = 'Resynchronizace'; $wb['Import'] = 'Importovat'; $wb['ISPConfig 3 mail'] = 'ISPConfig 3 vzdalený e-mail server'; $wb['PDNS Tupa'] = 'PowerDNS Tupa'; -$wb['Interface'] = 'Rozhraní'; ?> diff --git a/interface/web/tools/lib/lang/nl_index.lng b/interface/web/tools/lib/lang/nl_index.lng index a3ef38f21934a9d02669da2c2722feefc3f64325..6c82e4db99e3bafca20bb24ee7b233c52e927a52 100644 --- a/interface/web/tools/lib/lang/nl_index.lng +++ b/interface/web/tools/lib/lang/nl_index.lng @@ -1,4 +1,4 @@ diff --git a/interface/web/tools/resync.php b/interface/web/tools/resync.php index 7e3e9b4da2f55410659ab6e92d8ca166dde5d2d8..b7cd96585208930d27e5e169ce5790a4252ad25e 100644 --- a/interface/web/tools/resync.php +++ b/interface/web/tools/resync.php @@ -74,8 +74,8 @@ class page_action extends tform_actions { //* check the database for existing records $server_data = $this->server_has_data($server_type, $server['server_id']); foreach ($search as $needle) -// if (in_array($needle, $server_data) && strpos($options_servers, $server['server_name']) === false) { - if (in_array($needle, $server_data)) { + if (in_array($needle, $server_data) && strpos($options_servers, $server['server_name']) === false) { +// if (in_array($needle, $server_data)) { $options_servers .= ""; $server_count++; } @@ -103,11 +103,6 @@ class page_action extends tform_actions { 'server_type' => 'mail', 'server_id' => $server_id, ), - 'mail_mailinglist' => array ( - 'index_field' => 'mailinglist_id', - 'server_type' => 'mail', - 'server_id' => $server_id, - ), 'mail_user' => array ( 'index_field' => 'mailuser_id', 'server_type' => 'mail', @@ -207,15 +202,6 @@ class page_action extends tform_actions { ), ); } - if($type == 'vserver' ) { - $server_data = array ( - 'openvz_vm' => array ( - 'index_field' => 'vm_id', - 'server_type' => 'vserver', - 'server_id' => $server_id, - ), - ); - } //* proxy //* firewall $array_out = array(); @@ -291,17 +277,6 @@ class page_action extends tform_actions { unset($options_servers); } - //* mailinglist - $server_list = $this->create_list($mail_server_rec, 'mail', 'mail_mailinglist'); - $options_servers = $server_list[0];$server_count = $server_list[1]; - unset($server_list); - if (isset($options_servers)) { //* server with data found - if ($server_count > 1) $options_servers = "" . $options_servers; - $app->tpl->setVar('mailinglist_server_id', $options_servers); - $app->tpl->setVar('mailinglist_found', 1); - unset($options_servers); - } - //* mailtransport $server_list = $this->create_list($mail_server_rec, 'mail', 'mail_transport'); $options_servers = $server_list[0];$server_count = $server_list[1]; @@ -423,22 +398,6 @@ class page_action extends tform_actions { } } - //* fetch vserver - $v_server_rec = $app->db->queryAllRecords("SELECT server_id, server_name FROM server WHERE vserver_server = 1 AND active = 1 AND mirror_server_id = 0 ORDER BY active DESC, server_name"); - if (!empty($db_server_rec)) { - $app->tpl->setVar('vserver_server_found', 1); - - $server_list = $this->create_list($v_server_rec, 'vserver', 'openvz_vm'); - $options_servers = $server_list[0];$server_count = $server_list[1]; - unset($server_list); - if (isset($options_servers)) { //* server with data found - if ($server_count > 1) $options_servers = "" . $options_servers; - $app->tpl->setVar('vserver_server_id', $options_servers); - $app->tpl->setVar('vserver_found', 1); - unset($options_servers); - } - } - $csrf_token = $app->auth->csrf_token_get('tools_resync'); $app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']); $app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']); @@ -511,10 +470,8 @@ class page_action extends tform_actions { $this->dataRecord['resync_mailget'] = 1; $this->dataRecord['resync_mailbox'] = 1; $this->dataRecord['resync_mailfilter'] = 1; - $this->dataRecord['resync_mailinglist'] = 1; $this->dataRecord['resync_mailtransport'] = 1; $this->dataRecord['resync_mailrelay'] = 1; - $this->dataRecord['resync_vserver'] = 1; $this->dataRecord['resync_dns'] = 1; $this->dataRecord['resync_client'] = 1; $this->dataRecord['web_server_id'] = $this->dataRecord['all_server_id']; @@ -525,7 +482,6 @@ class page_action extends tform_actions { $this->dataRecord['db_server_id'] = $this->dataRecord['all_server_id']; $this->dataRecord['mail_server_id'] = $this->dataRecord['all_server_id']; $this->dataRecord['mailbox_server_id'] = $this->dataRecord['all_server_id']; - $this->dataRecord['verserver_server_id'] = $this->dataRecord['all_server_id']; $this->dataRecord['dns_server_id'] = $this->dataRecord['all_server_id']; } @@ -582,10 +538,6 @@ class page_action extends tform_actions { $msg .= $this->do_resync('spamfilter_wblist', 'wblist_id', 'mail', $this->dataRecord['mailbox_server_id'], '', $app->tform->wordbook['do_mail_spamfilter_txt']) ; } - //* mailinglists - if($this->dataRecord['resync_mailinglist'] == 1) - $msg .= $this->do_resync('mail_mailinglist', 'mailinglist_id', 'mail', $this->dataRecord['mail_server_id'], 'listname', $app->tform->wordbook['do_mailinglist_txt'], false); - //* mailtransport if($this->dataRecord['resync_mailtransport'] == 1) $msg .= $this->do_resync('mail_transport', 'transport_id', 'mail', $this->dataRecord['mail_server_id'], 'domain', $app->tform->wordbook['do_mailtransport_txt'], false); @@ -594,10 +546,6 @@ class page_action extends tform_actions { if($this->dataRecord['resync_mailrelay'] == 1) $msg .= $this->do_resync('mail_relay_recipient', 'relay_recipient_id', 'mail', $this->dataRecord['mail_server_id'], 'source', $app->tform->wordbook['do_mailrelay_txt'], false); - //* vserver - if($this->dataRecord['resync_vserver'] == 1) - $msg .= $this->do_resync('openvz_vm', 'vm_id', 'vserver', $this->dataRecord['verserver_server_id'], 'hostname', $app->tform->wordbook['do_vserver_txt']); - //* dns if($this->dataRecord['resync_dns'] == 1) { $rec=$this->query_server('dns_soa', $this->dataRecord['dns_server_id'], 'dns'); @@ -651,6 +599,19 @@ class page_action extends tform_actions { } $msg .= '
'; } + + $entries = $app->plugin->raiseEvent('tools:resync:get_resync_entries', $this->dataRecord, true); + if(is_array($entries) && !empty($entries)) { + foreach($entries as $entry) { + if(!isset($entry['db_table']) || !isset($entry['db_table']) || !isset($entry['db_table']) || !isset($entry['db_table']) || !isset($entry['db_table']) || !isset($entry['db_table'])) { + continue; + } + if(!isset($entry['active'])) { + $entry['active'] = true; + } + $msg .= $this->do_resync($entry['db_table'], $entry['index_field'], $entry['server_type'], $entry['server_id'], $entry['msg_field'], $entry['wordbook'], $entry['active']); + } + } echo $msg; } //* end onSumbmit diff --git a/interface/web/tools/templates/dns_import_tupa.htm b/interface/web/tools/templates/dns_import_tupa.htm index 2d37a6a0419fec37ada787f3ec33d989bfbc250c..cd47f431e017f967aa316fce7fbe75d528cdcb65 100644 --- a/interface/web/tools/templates/dns_import_tupa.htm +++ b/interface/web/tools/templates/dns_import_tupa.htm @@ -4,22 +4,27 @@ PowerDNS Tupa import
- +
- +
- +
- +
- +
+ +
+ +
+

@@ -34,4 +39,4 @@
-
\ No newline at end of file +
diff --git a/interface/web/tools/templates/import_vpopmail.htm b/interface/web/tools/templates/import_vpopmail.htm index 749ce74a411d1543ca0aec6a07c65948f14c709e..7876875b9828e9bc9d1f2be90b75bf3449f268c0 100644 --- a/interface/web/tools/templates/import_vpopmail.htm +++ b/interface/web/tools/templates/import_vpopmail.htm @@ -8,26 +8,31 @@
{tmpl_var name="legend_txt"}
- +
- +
- +
- +
+
+
+ +
+ +
- +
-
diff --git a/interface/web/tools/templates/resync.htm b/interface/web/tools/templates/resync.htm index 3e66290fb0fd46e2117a7550bf0d0a12e18d76cd..d9d76a50e378e3b0e3cdd48273ff3359ff3cc550 100644 --- a/interface/web/tools/templates/resync.htm +++ b/interface/web/tools/templates/resync.htm @@ -89,13 +89,6 @@
- -
- -
-
-
-
@@ -122,16 +115,6 @@ - - -
- -
-
-
-
-
-
@@ -139,6 +122,8 @@
+ +{tmpl_hook name="end_form"}
diff --git a/interface/web/tools/tpl_default.php b/interface/web/tools/tpl_default.php index dacbeae9b271966565af0a4904ac4d59f740ad51..b4ac189daaec04d4dc3674af9f63611eabecf9f3 100644 --- a/interface/web/tools/tpl_default.php +++ b/interface/web/tools/tpl_default.php @@ -41,7 +41,7 @@ $app->uses('tpl'); $app->tpl->newTemplate('listpage.tpl.htm'); $app->tpl->setInclude('content_tpl', 'templates/tpl_default.htm'); -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_tpl_default.lng'; +$lng_file = 'lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_tpl_default.lng'; include $lng_file; $app->tpl->setVar($wb); diff --git a/interface/web/tools/user_settings.php b/interface/web/tools/user_settings.php index ccf86adda98f9f6696696de24ec700de1fdf25a5..5c3876fb864d8036338dda594437adcf0208d765 100644 --- a/interface/web/tools/user_settings.php +++ b/interface/web/tools/user_settings.php @@ -86,12 +86,10 @@ class page_action extends tform_actions { if($_POST['passwort'] != $_POST['repeat_password']) { $app->tform->errorMessage = $app->tform->lng('password_mismatch'); } - if(preg_match('/[a-z]{2}/',$_POST['language'])) { - $_SESSION['s']['user']['language'] = $_POST['language']; - $_SESSION['s']['language'] = $_POST['language']; - } else { - $app->error('Invalid language.'); - } + + $language = $app->functions->check_language($_POST['language']); + $_SESSION['s']['user']['language'] = $language; + $_SESSION['s']['language'] = $language; } function onAfterUpdate() { diff --git a/interface/web/vm/ajax_get_ip.php b/interface/web/vm/ajax_get_ip.php deleted file mode 100644 index 3ff5c0d294a296167f0031f2fd80bf7155da4e99..0000000000000000000000000000000000000000 --- a/interface/web/vm/ajax_get_ip.php +++ /dev/null @@ -1,55 +0,0 @@ -auth->check_module_permissions('vm'); - -$server_id = $app->functions->intval($_GET["server_id"]); - -if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { - - $sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND server_id = ?"; - $ips = $app->db->queryAllRecords($sql, $server_id); - $ip_select = ""; - if(is_array($ips)) { - foreach( $ips as $ip) { - //$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':''; - $ip_select .= "$ip[ip_address]#"; - } - } - unset($tmp); - unset($ips); -} -$ip_select = substr($ip_select, 0, -1); -echo $ip_select; -?> diff --git a/interface/web/vm/form/openvz_ip.tform.php b/interface/web/vm/form/openvz_ip.tform.php deleted file mode 100644 index e43b28de2028e4469629930918dd7e27152429ab..0000000000000000000000000000000000000000 --- a/interface/web/vm/form/openvz_ip.tform.php +++ /dev/null @@ -1,117 +0,0 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['main'] = array ( - 'title' => "IP address", - 'width' => 100, - 'template' => "templates/openvz_ip_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'server_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'ip_address' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( - 0 => array ( 'type' => 'ISIP', 'errmsg'=> 'ip_error_wrong'), - 1 => array ( 'type' => 'UNIQUE', 'errmsg'=> 'ip_error_unique'), - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '15', - 'maxlength' => '15', - 'rows' => '', - 'cols' => '', - 'searchable' => 1 - ), - 'vm_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname', - 'keyfield'=> 'vm_id', - 'valuefield'=> 'hostname' - ), - 'value' => array(0 => '- Not assigned -') - ), - 'reserved' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'n', - 'value' => array(0 => 'n', 1 => 'y') - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - - -?> diff --git a/interface/web/vm/form/openvz_ostemplate.tform.php b/interface/web/vm/form/openvz_ostemplate.tform.php deleted file mode 100644 index a28bbc6adeaf9ea3d28318f1d6d63945b5230db3..0000000000000000000000000000000000000000 --- a/interface/web/vm/form/openvz_ostemplate.tform.php +++ /dev/null @@ -1,148 +0,0 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['main'] = array ( - 'title' => "Template", - 'width' => 100, - 'template' => "templates/openvz_ostemplate_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'template_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'template_name_error_empty'), - ), - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255', - 'searchable' => 1 - ), - 'template_file' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'template_file_error_empty'), - ), - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255', - 'searchable' => 2 - ), - 'server_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'allservers' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'active' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'description' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS') - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30', - 'searchable' => 2 - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - - -?> diff --git a/interface/web/vm/form/openvz_template.tform.php b/interface/web/vm/form/openvz_template.tform.php deleted file mode 100644 index 1a069361cbdeb6d74ff5b792aab36f1a0dcc6efa..0000000000000000000000000000000000000000 --- a/interface/web/vm/form/openvz_template.tform.php +++ /dev/null @@ -1,523 +0,0 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['main'] = array ( - 'title' => "Template", - 'width' => 100, - 'template' => "templates/openvz_template_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'template_name' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'template_name_error_empty'), - ), - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255', - 'searchable' => 1 - ), - 'diskspace' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'diskspace_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'ram' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'ram_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'ram_burst' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'ram_burst_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_units' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_units_error_empty'), - ), - 'default' => '1000', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_num' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_num_error_empty'), - ), - 'default' => '4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_limit' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_limit_error_empty'), - ), - 'default' => '400', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'io_priority' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'io_priority_error_empty'), - ), - 'default' => '4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'hostname' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'create_dns' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'nameserver' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'template_nameserver_error_empty'), - ), - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 1 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'default' => '8.8.8.8 8.8.4.4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255', - 'searchable' => 2 - ), - 'active' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'description' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS') - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30' - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - -$form["tabs"]['advanced'] = array ( - 'title' => "Advanced", - 'width' => 100, - 'template' => "templates/openvz_template_advanced_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'numproc' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numproc_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numtcpsock' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numtcpsock_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numothersock' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numothersock_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'vmguarpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'vmguarpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'kmemsize' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'kmemsize_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'tcpsndbuf' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'tcpsndbuf_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'tcprcvbuf' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'tcprcvbuf_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'othersockbuf' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'othersockbuf_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'dgramrcvbuf' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'dgramrcvbuf_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'oomguarpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'oomguarpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'privvmpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'privvmpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'lockedpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'lockedpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'shmpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'shmpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'physpages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'physpages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numfile' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numfile_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'avnumproc' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'avnumproc_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numflock' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numflock_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numpty' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numpty_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numsiginfo' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numsiginfo_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'dcachesize' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'dcachesize_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'numiptent' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'numiptent_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'swappages' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'swappages_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'capability' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'features' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'iptables' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'custom' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30', - 'validators' => array ( 0 => array ('type' => 'CUSTOM', - 'class' => 'validate_openvz', - 'function' => 'check_custom', - 'errmsg'=> 'custom_error'), - ), - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - - -?> diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php deleted file mode 100644 index fe61e27c453e2957d5c8066ba50bccc6d98e258a..0000000000000000000000000000000000000000 --- a/interface/web/vm/form/openvz_vm.tform.php +++ /dev/null @@ -1,375 +0,0 @@ - 0 id must match with id of current user -$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user -$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete -$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete - -$form["tabs"]['main'] = array ( - 'title' => "Virtual server", - 'width' => 100, - 'template' => "templates/openvz_vm_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'server_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'value' => '' - ), - 'ostemplate_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE 1 ORDER BY template_name', - 'keyfield'=> 'ostemplate_id', - 'valuefield'=> 'template_name' - ), - 'value' => '' - ), - 'template_id' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'SELECT', - 'default' => '', - /* - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name', - 'keyfield'=> 'template_id', - 'valuefield'=> 'template_name' - ), - */ - 'value' => '' - ), - 'ip_address' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'SELECT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'ip_address_error_empty'), - ), - 'default' => '', - /* - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '{RECORDID}') ORDER BY ip_address", - 'keyfield'=> 'ip_address', - 'valuefield'=> 'ip_address' - ), - */ - 'value' => '' - ), - 'hostname' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'filters' => array( 0 => array( 'event' => 'SAVE', - 'type' => 'IDNTOASCII'), - 1 => array( 'event' => 'SHOW', - 'type' => 'IDNTOUTF8'), - 2 => array( 'event' => 'SAVE', - 'type' => 'TOLOWER'), - 3 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS'), - 4 => array( 'event' => 'SAVE', - 'type' => 'STRIPNL') - ), - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'hostname_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255', - 'searchable' => 1 - ), - 'vm_password' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'vm_password_error_empty'), - ), - 'default' => $app->auth->get_random_password(10), - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'start_boot' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'bootorder' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'default' => '0', - 'value' => '', - 'width' => '3', - 'maxlength' => '3', - 'validators' => array ( 0 => array ( 'type' => 'ISPOSITIVE', - 'errmsg'=> 'bootorder_error_notpositive'), - ), - ), - 'active' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'active_until_date' => array ( - 'datatype' => 'DATE', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'description' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'filters' => array( - 0 => array( 'event' => 'SAVE', - 'type' => 'STRIPTAGS') - ), - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30', - 'searchable' => 2 - ), - //################################# - // ENDE Datatable fields - //################################# - ) -); - -if($_SESSION["s"]["user"]["typ"] == 'admin') { - $form["tabs"]['advanced'] = array ( - 'title' => "Advanced", - 'width' => 100, - 'template' => "templates/openvz_vm_advanced_edit.htm", - 'fields' => array ( - //################################# - // Begin Datatable fields - //################################# - 'veid' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'veid_error_empty'), - 1 => array ( 'type' => 'UNIQUE', - 'errmsg'=> 'veid_error_unique'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'create_dns' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'CHECKBOX', - 'default' => 'y', - 'value' => array(0 => 'n', 1 => 'y') - ), - 'diskspace' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'diskspace_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'ram' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'ram_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'ram_burst' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'ram_burst_error_empty'), - ), - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_units' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_units_error_empty'), - ), - 'default' => '1000', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_num' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_num_error_empty'), - ), - 'default' => '4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'cpu_limit' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'cpu_limit_error_empty'), - ), - 'default' => '400', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'io_priority' => array ( - 'datatype' => 'INTEGER', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'io_priority_error_empty'), - ), - 'default' => '4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'nameserver' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', - 'errmsg'=> 'template_nameserver_error_empty'), - ), - 'default' => '8.8.8.8 8.8.4.4', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'capability' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'features' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'iptables' => array ( - 'datatype' => 'VARCHAR', - 'formtype' => 'TEXT', - 'default' => '', - 'value' => '', - 'width' => '30', - 'maxlength' => '255' - ), - 'custom' => array ( - 'datatype' => 'TEXT', - 'formtype' => 'TEXTAREA', - 'default' => '', - 'value' => '', - 'separator' => '', - 'width' => '', - 'maxlength' => '', - 'rows' => '10', - 'cols' => '30', - 'searchable' => 2, - 'validators' => array ( 0 => array ('type' => 'CUSTOM', - 'class' => 'validate_openvz', - 'function' => 'check_custom', - 'errmsg'=> 'custom_error'), - ), - ), - //################################# - // ENDE Datatable fields - //################################# - ) - ); - - $form["tabs"]['additional_ip'] = array ( - 'title' => "Additional IP", - 'width' => 100, - 'template' => "templates/openvz_vm_additional_ip_edit.htm", - ); -} - - -?> diff --git a/interface/web/vm/lib/admin.conf.php b/interface/web/vm/lib/admin.conf.php deleted file mode 100644 index acb6c3546c6150b4edbafb782d3ed85c499210b5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/admin.conf.php +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar.lng b/interface/web/vm/lib/lang/ar.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_action.lng b/interface/web/vm/lib/lang/ar_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_ip.lng b/interface/web/vm/lib/lang/ar_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_ip_list.lng b/interface/web/vm/lib/lang/ar_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_ostemplate.lng b/interface/web/vm/lib/lang/ar_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/ar_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_template.lng b/interface/web/vm/lib/lang/ar_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_template_list.lng b/interface/web/vm/lib/lang/ar_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_vm.lng b/interface/web/vm/lib/lang/ar_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ar_openvz_vm_list.lng b/interface/web/vm/lib/lang/ar_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ar_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg.lng b/interface/web/vm/lib/lang/bg.lng deleted file mode 100644 index b42a772d5b0cb34a9833f8bc7add1d2be8945ea4..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_action.lng b/interface/web/vm/lib/lang/bg_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_ip.lng b/interface/web/vm/lib/lang/bg_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_ip_list.lng b/interface/web/vm/lib/lang/bg_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_ostemplate.lng b/interface/web/vm/lib/lang/bg_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/bg_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_template.lng b/interface/web/vm/lib/lang/bg_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_template_list.lng b/interface/web/vm/lib/lang/bg_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_vm.lng b/interface/web/vm/lib/lang/bg_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/bg_openvz_vm_list.lng b/interface/web/vm/lib/lang/bg_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/bg_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br.lng b/interface/web/vm/lib/lang/br.lng deleted file mode 100644 index 513a018bf515ddded5fc5a8cd55310f95c4c7101..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_action.lng b/interface/web/vm/lib/lang/br_openvz_action.lng deleted file mode 100644 index a301f51d0ed92567fe5fbf18626d95ba1f1b5e05..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_ip.lng b/interface/web/vm/lib/lang/br_openvz_ip.lng deleted file mode 100644 index 61fbd6ed6839aa1a1e15523b025063b2cdecb1be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_ip_list.lng b/interface/web/vm/lib/lang/br_openvz_ip_list.lng deleted file mode 100644 index 99ddfbc7d88fefb63a0901c21c58c1d632eebfeb..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_ostemplate.lng b/interface/web/vm/lib/lang/br_openvz_ostemplate.lng deleted file mode 100644 index edce912056486708dfafd3b167fe2c53757f24e9..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/br_openvz_ostemplate_list.lng deleted file mode 100644 index 04e94a889d079ae3d2851c81f32bb43ad2000030..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_template.lng b/interface/web/vm/lib/lang/br_openvz_template.lng deleted file mode 100644 index 4190a31f9cd16067c6d529837e11c11f82fc823d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_template_list.lng b/interface/web/vm/lib/lang/br_openvz_template_list.lng deleted file mode 100644 index 390869859ac1bb8ddabb9017d234439cdb3606d5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_vm.lng b/interface/web/vm/lib/lang/br_openvz_vm.lng deleted file mode 100644 index 04794daf86b2d3305ca3363c204af3f3dabd6f44..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/br_openvz_vm_list.lng b/interface/web/vm/lib/lang/br_openvz_vm_list.lng deleted file mode 100644 index 03d510f2f765743f1d9be45a3ba8df08952bf815..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/br_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca.lng b/interface/web/vm/lib/lang/ca.lng deleted file mode 100644 index 12ed30c07e14e10a2d49528061e916767267920f..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_action.lng b/interface/web/vm/lib/lang/ca_openvz_action.lng deleted file mode 100644 index 22b6b07d2fa00077ed42e80dd0fef7deb076fa92..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_ip.lng b/interface/web/vm/lib/lang/ca_openvz_ip.lng deleted file mode 100644 index 9aa6f97ea79c466017aabe7c4e5b368998860331..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_ip_list.lng b/interface/web/vm/lib/lang/ca_openvz_ip_list.lng deleted file mode 100644 index 4f1d3706b74a29bb417087ca7052c5570a331438..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_ostemplate.lng b/interface/web/vm/lib/lang/ca_openvz_ostemplate.lng deleted file mode 100644 index ba9193da2fd671af2016991bf00234f1891f160a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/ca_openvz_ostemplate_list.lng deleted file mode 100644 index 377713cb9a60881c0d2366d46d86b335c5d951aa..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_template.lng b/interface/web/vm/lib/lang/ca_openvz_template.lng deleted file mode 100644 index f46b001bdf70b72b87ca2556cdf04a36803608d0..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_template_list.lng b/interface/web/vm/lib/lang/ca_openvz_template_list.lng deleted file mode 100644 index c4ce4edd5fe15b7df96e2ba445c467f78ab4c6ee..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_vm.lng b/interface/web/vm/lib/lang/ca_openvz_vm.lng deleted file mode 100644 index 06710577d9a9a7e303103cadc6366e2b32c1bd3b..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ca_openvz_vm_list.lng b/interface/web/vm/lib/lang/ca_openvz_vm_list.lng deleted file mode 100644 index 9a6f78f581edb1eb61149c880a181d02bc5f10a1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ca_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz.lng b/interface/web/vm/lib/lang/cz.lng deleted file mode 100644 index 556a5935644a7d6ec43639c19e34541bea8f5d08..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_action.lng b/interface/web/vm/lib/lang/cz_openvz_action.lng deleted file mode 100644 index 3e2e3e0b84a82c5520e13f71eba231d40fe25eb1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_ip.lng b/interface/web/vm/lib/lang/cz_openvz_ip.lng deleted file mode 100644 index e749c286487b84c832e4a69ec6ae0857b44b1e15..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_ip_list.lng b/interface/web/vm/lib/lang/cz_openvz_ip_list.lng deleted file mode 100644 index 7778c6d8c76279e6221599a1afd8bc50c5eb2ae7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_ostemplate.lng b/interface/web/vm/lib/lang/cz_openvz_ostemplate.lng deleted file mode 100644 index 72838a20de8c8ff4944856821cfd1786cde17674..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/cz_openvz_ostemplate_list.lng deleted file mode 100644 index 7705a4d18f342e0d87d90f049fae07fc75efc721..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_template.lng b/interface/web/vm/lib/lang/cz_openvz_template.lng deleted file mode 100644 index e54a2a9dbbb7a55db7e5d8a6172f6b7fd41d3eda..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_template_list.lng b/interface/web/vm/lib/lang/cz_openvz_template_list.lng deleted file mode 100644 index 89c11ef5d1926da64f4f787a778b7c0f9793149f..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_vm.lng b/interface/web/vm/lib/lang/cz_openvz_vm.lng deleted file mode 100644 index 7c610fbe0421501e05b119d52cbbb03bf0b2a0c5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/cz_openvz_vm_list.lng b/interface/web/vm/lib/lang/cz_openvz_vm_list.lng deleted file mode 100644 index c402181601eae2d72d3e15f3e77650ea37dc9256..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/cz_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de.lng b/interface/web/vm/lib/lang/de.lng deleted file mode 100644 index 474d2ac7b7c2a68a8f00f3841440390f21e3eac5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_action.lng b/interface/web/vm/lib/lang/de_openvz_action.lng deleted file mode 100644 index f40d2f28b1aa50485c994b8b2221986736ffe3fa..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_ip.lng b/interface/web/vm/lib/lang/de_openvz_ip.lng deleted file mode 100644 index 48c9a520c448c5d9a2cfc8a13db90ddb39d26d7d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_ip_list.lng b/interface/web/vm/lib/lang/de_openvz_ip_list.lng deleted file mode 100644 index f4302d813acc8a4eebaaf6193e017cc67abfa10a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_ostemplate.lng b/interface/web/vm/lib/lang/de_openvz_ostemplate.lng deleted file mode 100644 index 8e4cfcb977fb52b136f96e937e737a0c9d856e31..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/de_openvz_ostemplate_list.lng deleted file mode 100644 index dff6bd2ded79845ca70f2a54f42b4fdb82680c8a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_template.lng b/interface/web/vm/lib/lang/de_openvz_template.lng deleted file mode 100644 index 66ad4377bee0c2d32d0ae7b9c4b1c685adda2852..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_template_list.lng b/interface/web/vm/lib/lang/de_openvz_template_list.lng deleted file mode 100644 index 9e32b341b50d4cc945cde1d75676f469ce0661f1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_vm.lng b/interface/web/vm/lib/lang/de_openvz_vm.lng deleted file mode 100644 index a5b8d54b204df764f4d7a77cd62e2b1a68910120..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/de_openvz_vm_list.lng b/interface/web/vm/lib/lang/de_openvz_vm_list.lng deleted file mode 100644 index 0b3ac30c7fe26d7bb47cde5a456cd75e297e5f98..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/de_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk.lng b/interface/web/vm/lib/lang/dk.lng deleted file mode 100644 index 6a7764588e96b345ca6f7b65590f25c32ffce85d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_action.lng b/interface/web/vm/lib/lang/dk_openvz_action.lng deleted file mode 100644 index ec4b1c4663c6cc1ba754fb4f84f4d22419f4d0d4..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_ip.lng b/interface/web/vm/lib/lang/dk_openvz_ip.lng deleted file mode 100644 index 0ad41f87a38ab63152ffbcedebfb70847ffd6137..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_ip_list.lng b/interface/web/vm/lib/lang/dk_openvz_ip_list.lng deleted file mode 100644 index 2467d5c0b8e3df1de8c72770fee1cd312eeca2ef..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_ostemplate.lng b/interface/web/vm/lib/lang/dk_openvz_ostemplate.lng deleted file mode 100644 index 5b71160eb1b718830f4b907609e52836778b96a6..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/dk_openvz_ostemplate_list.lng deleted file mode 100644 index 94a5ccc18e84fd717ab7c2ba673e31322f537fca..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_template.lng b/interface/web/vm/lib/lang/dk_openvz_template.lng deleted file mode 100644 index 9de4a6fd9266b3aef3579da5240ffbc0d1731450..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_template_list.lng b/interface/web/vm/lib/lang/dk_openvz_template_list.lng deleted file mode 100644 index 0d0d574c205f432508252129fa93b970933c204c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_vm.lng b/interface/web/vm/lib/lang/dk_openvz_vm.lng deleted file mode 100644 index b4b2a5ad90fed2d9884fdfccd954ba6fd0209842..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/dk_openvz_vm_list.lng b/interface/web/vm/lib/lang/dk_openvz_vm_list.lng deleted file mode 100644 index 1d684a1adc1f365caf42f3265a7913851570693b..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/dk_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el.lng b/interface/web/vm/lib/lang/el.lng deleted file mode 100644 index f6b13b9504d9514cd27ddf4234c17d6364ad83c3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_action.lng b/interface/web/vm/lib/lang/el_openvz_action.lng deleted file mode 100644 index d03a007696b44dcc24e9d2b5bec959f2f4d56d3f..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_ip.lng b/interface/web/vm/lib/lang/el_openvz_ip.lng deleted file mode 100644 index 8aecd92058ad6ab26b62918c4e889cdca91d3294..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_ip_list.lng b/interface/web/vm/lib/lang/el_openvz_ip_list.lng deleted file mode 100644 index 5af2ea055bc9042997d8729be2e8b7f4414ef446..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_ostemplate.lng b/interface/web/vm/lib/lang/el_openvz_ostemplate.lng deleted file mode 100644 index 6f8a98ef7e2bc85827acce3636302d72c63d7298..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/el_openvz_ostemplate_list.lng deleted file mode 100644 index 7dbc03f06df9ae4b3ff3ccb48a61b85cbe605070..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_template.lng b/interface/web/vm/lib/lang/el_openvz_template.lng deleted file mode 100644 index 8e2a673de293498cd66050218ccd744d1fb26981..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_template_list.lng b/interface/web/vm/lib/lang/el_openvz_template_list.lng deleted file mode 100644 index 2b053470ab9b3e141471f0db95abf573aaf6e34d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_vm.lng b/interface/web/vm/lib/lang/el_openvz_vm.lng deleted file mode 100644 index 2a413883474b5b0d068b6773debbacf2fc8d3e65..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/el_openvz_vm_list.lng b/interface/web/vm/lib/lang/el_openvz_vm_list.lng deleted file mode 100644 index e4298e66b093c413d9f8429feca6b3cba020a9fa..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/el_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/en.lng b/interface/web/vm/lib/lang/en.lng deleted file mode 100644 index 860fc499dddd1425dcc9f9cdacb02164a56e9bf0..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en.lng +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_action.lng b/interface/web/vm/lib/lang/en_openvz_action.lng deleted file mode 100644 index d504e3ae5d79b0145ccf63fb306c5ab49ed27baa..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_action.lng +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/en_openvz_ip.lng b/interface/web/vm/lib/lang/en_openvz_ip.lng deleted file mode 100644 index 13c16afb32b2540ca32b9b87798fe33605456076..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_ip_list.lng b/interface/web/vm/lib/lang/en_openvz_ip_list.lng deleted file mode 100644 index cb6a0b53b9527ece0280e4c757b5ec8f4357006e..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_ostemplate.lng b/interface/web/vm/lib/lang/en_openvz_ostemplate.lng deleted file mode 100644 index 55a4ae3938a1898d328a9e105852d36f592960fb..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng deleted file mode 100644 index 7fcfbb7e0cb62c9302fdb10dd8e4597c82479b04..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_template.lng b/interface/web/vm/lib/lang/en_openvz_template.lng deleted file mode 100644 index cb648cbd6aab68f5249f7b72bbbb06a2674ef197..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/en_openvz_template_list.lng b/interface/web/vm/lib/lang/en_openvz_template_list.lng deleted file mode 100644 index 248c57ff5bc60adda96d6ee744b79b65a3118f70..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/en_openvz_vm.lng b/interface/web/vm/lib/lang/en_openvz_vm.lng deleted file mode 100644 index f3562cb0543ff90192af351ee1d6e9f6a6ee75b1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/en_openvz_vm_list.lng b/interface/web/vm/lib/lang/en_openvz_vm_list.lng deleted file mode 100644 index 89c17a1bffa4adf27211876e0d58fe4d1d80c1b1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/en_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - \ No newline at end of file diff --git a/interface/web/vm/lib/lang/es.lng b/interface/web/vm/lib/lang/es.lng deleted file mode 100644 index 1bd8750a155ad2179306d32c4f9830ea71fe84c5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_action.lng b/interface/web/vm/lib/lang/es_openvz_action.lng deleted file mode 100644 index ca0f39d6e42e9763762f0be85483b86d139b8004..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_ip.lng b/interface/web/vm/lib/lang/es_openvz_ip.lng deleted file mode 100644 index b1cfd4901ff994427366d4e36cdec3d7bf9d0990..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_ip_list.lng b/interface/web/vm/lib/lang/es_openvz_ip_list.lng deleted file mode 100644 index 7e070b10c61357b4daf7c319c2ccda43af25a691..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_ostemplate.lng b/interface/web/vm/lib/lang/es_openvz_ostemplate.lng deleted file mode 100644 index 493d3b918264cb9ba1dfcf9dc57ad88a664fae98..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/es_openvz_ostemplate_list.lng deleted file mode 100644 index e6851a116d08d0492649dc4d44a5a1eb34682816..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_template.lng b/interface/web/vm/lib/lang/es_openvz_template.lng deleted file mode 100644 index 1abd562ed58126a73c61eee80753dc9140c8d06c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_template_list.lng b/interface/web/vm/lib/lang/es_openvz_template_list.lng deleted file mode 100644 index dfeab8b67e81f7d4dbc8b50146d659cf4aac9e02..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_vm.lng b/interface/web/vm/lib/lang/es_openvz_vm.lng deleted file mode 100644 index d197d3f572ea8d14caba717138373e91164d716a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/es_openvz_vm_list.lng b/interface/web/vm/lib/lang/es_openvz_vm_list.lng deleted file mode 100644 index 7dffa2d1edc74195d85a2f1c8d73de0139c11482..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/es_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi.lng b/interface/web/vm/lib/lang/fi.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_action.lng b/interface/web/vm/lib/lang/fi_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_ip.lng b/interface/web/vm/lib/lang/fi_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_ip_list.lng b/interface/web/vm/lib/lang/fi_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_ostemplate.lng b/interface/web/vm/lib/lang/fi_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/fi_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_template.lng b/interface/web/vm/lib/lang/fi_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_template_list.lng b/interface/web/vm/lib/lang/fi_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_vm.lng b/interface/web/vm/lib/lang/fi_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fi_openvz_vm_list.lng b/interface/web/vm/lib/lang/fi_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fi_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr.lng b/interface/web/vm/lib/lang/fr.lng deleted file mode 100644 index ade277c2d0b609c9688ed16b85e8376289ba580d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_action.lng b/interface/web/vm/lib/lang/fr_openvz_action.lng deleted file mode 100644 index 78958fda88c8575fbfc0f7d2c915f9e9e4621da3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_ip.lng b/interface/web/vm/lib/lang/fr_openvz_ip.lng deleted file mode 100644 index 4be05dafee57c8aae76009189bc4b9f8b0db0b30..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_ip_list.lng b/interface/web/vm/lib/lang/fr_openvz_ip_list.lng deleted file mode 100644 index 4f1d3706b74a29bb417087ca7052c5570a331438..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_ostemplate.lng b/interface/web/vm/lib/lang/fr_openvz_ostemplate.lng deleted file mode 100644 index ba9193da2fd671af2016991bf00234f1891f160a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/fr_openvz_ostemplate_list.lng deleted file mode 100644 index f84a0b0d3e93a180645f635019105fe5f33531b3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_template.lng b/interface/web/vm/lib/lang/fr_openvz_template.lng deleted file mode 100644 index e86bd1c74e1553c3e86fec798efdf63733d72bd7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_template_list.lng b/interface/web/vm/lib/lang/fr_openvz_template_list.lng deleted file mode 100644 index c4ce4edd5fe15b7df96e2ba445c467f78ab4c6ee..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_vm.lng b/interface/web/vm/lib/lang/fr_openvz_vm.lng deleted file mode 100644 index 32741946cce204b0aff93c4de9e95cf3e8073659..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/fr_openvz_vm_list.lng b/interface/web/vm/lib/lang/fr_openvz_vm_list.lng deleted file mode 100644 index 287069e3b70890d1e8faa063049f014a051deed5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/fr_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr.lng b/interface/web/vm/lib/lang/hr.lng deleted file mode 100644 index 4f5dbe9e60a7ab11a355aeec476a46e2d1b35c61..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_action.lng b/interface/web/vm/lib/lang/hr_openvz_action.lng deleted file mode 100644 index d6e5fb4ed61bcc829922814c3195f38bbbddacc8..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_ip.lng b/interface/web/vm/lib/lang/hr_openvz_ip.lng deleted file mode 100644 index debb04b96fa37a3c96961791830bda5960f7bbcc..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_ip_list.lng b/interface/web/vm/lib/lang/hr_openvz_ip_list.lng deleted file mode 100644 index c578fc9976123c605de62d04c86ae4018e4eeb23..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_ostemplate.lng b/interface/web/vm/lib/lang/hr_openvz_ostemplate.lng deleted file mode 100644 index df88ca9f7b4e68889c971910a636fb4fe7247db3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/hr_openvz_ostemplate_list.lng deleted file mode 100644 index 430d36b92986cdd38f7d04e22791162e31d0efb7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_template.lng b/interface/web/vm/lib/lang/hr_openvz_template.lng deleted file mode 100644 index 68fd60e0bcc10756e6da4e52839279c45b180748..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_template_list.lng b/interface/web/vm/lib/lang/hr_openvz_template_list.lng deleted file mode 100644 index f9c8642f1d6b53c908bd8947dd307f391c04a2dc..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_vm.lng b/interface/web/vm/lib/lang/hr_openvz_vm.lng deleted file mode 100644 index e5b9fe14c46bdc0a5b6f6090a381a0ad66972374..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hr_openvz_vm_list.lng b/interface/web/vm/lib/lang/hr_openvz_vm_list.lng deleted file mode 100644 index ab3ef52529a3bf748df1edcf3d903226d3231bc8..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hr_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu.lng b/interface/web/vm/lib/lang/hu.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_action.lng b/interface/web/vm/lib/lang/hu_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_ip.lng b/interface/web/vm/lib/lang/hu_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_ip_list.lng b/interface/web/vm/lib/lang/hu_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_ostemplate.lng b/interface/web/vm/lib/lang/hu_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/hu_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_template.lng b/interface/web/vm/lib/lang/hu_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_template_list.lng b/interface/web/vm/lib/lang/hu_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_vm.lng b/interface/web/vm/lib/lang/hu_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/hu_openvz_vm_list.lng b/interface/web/vm/lib/lang/hu_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/hu_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id.lng b/interface/web/vm/lib/lang/id.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_action.lng b/interface/web/vm/lib/lang/id_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_ip.lng b/interface/web/vm/lib/lang/id_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_ip_list.lng b/interface/web/vm/lib/lang/id_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_ostemplate.lng b/interface/web/vm/lib/lang/id_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/id_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_template.lng b/interface/web/vm/lib/lang/id_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_template_list.lng b/interface/web/vm/lib/lang/id_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_vm.lng b/interface/web/vm/lib/lang/id_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/id_openvz_vm_list.lng b/interface/web/vm/lib/lang/id_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/id_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it.lng b/interface/web/vm/lib/lang/it.lng deleted file mode 100644 index c59bc303bc4678243a0a083df58c797a2280f1b3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_action.lng b/interface/web/vm/lib/lang/it_openvz_action.lng deleted file mode 100644 index ecbe5eec258757d5cfe32eaf691a026bbaf09010..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_ip.lng b/interface/web/vm/lib/lang/it_openvz_ip.lng deleted file mode 100644 index 0a22248027640cbd27d27730cf3aa0726d80a360..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_ip_list.lng b/interface/web/vm/lib/lang/it_openvz_ip_list.lng deleted file mode 100644 index c639477c4f0ec26651732ac1d81bae938a837c70..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_ostemplate.lng b/interface/web/vm/lib/lang/it_openvz_ostemplate.lng deleted file mode 100644 index 5b58e7ebc5c30df7f3e5a67f28d5803b20221601..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/it_openvz_ostemplate_list.lng deleted file mode 100644 index 7df4dc7fe63d8e2b1892bb6eb2fbe301590f7cc4..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_template.lng b/interface/web/vm/lib/lang/it_openvz_template.lng deleted file mode 100644 index b23f8623632c780e5e70f0156de887c00a3700d2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_template_list.lng b/interface/web/vm/lib/lang/it_openvz_template_list.lng deleted file mode 100644 index f7520680851c11968f134ea1fa881d95cf83af53..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_vm.lng b/interface/web/vm/lib/lang/it_openvz_vm.lng deleted file mode 100644 index 8290d94e99935a339ac53ce1b5c64d0b53101a9a..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/it_openvz_vm_list.lng b/interface/web/vm/lib/lang/it_openvz_vm_list.lng deleted file mode 100644 index 3ed0a012af67354c2de67299b9428c29c21c4507..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/it_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja.lng b/interface/web/vm/lib/lang/ja.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_action.lng b/interface/web/vm/lib/lang/ja_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_ip.lng b/interface/web/vm/lib/lang/ja_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_ip_list.lng b/interface/web/vm/lib/lang/ja_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_ostemplate.lng b/interface/web/vm/lib/lang/ja_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/ja_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_template.lng b/interface/web/vm/lib/lang/ja_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_template_list.lng b/interface/web/vm/lib/lang/ja_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_vm.lng b/interface/web/vm/lib/lang/ja_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ja_openvz_vm_list.lng b/interface/web/vm/lib/lang/ja_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ja_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl.lng b/interface/web/vm/lib/lang/nl.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_action.lng b/interface/web/vm/lib/lang/nl_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_ip.lng b/interface/web/vm/lib/lang/nl_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_ip_list.lng b/interface/web/vm/lib/lang/nl_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_ostemplate.lng b/interface/web/vm/lib/lang/nl_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/nl_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_template.lng b/interface/web/vm/lib/lang/nl_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_template_list.lng b/interface/web/vm/lib/lang/nl_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_vm.lng b/interface/web/vm/lib/lang/nl_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/nl_openvz_vm_list.lng b/interface/web/vm/lib/lang/nl_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/nl_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl.lng b/interface/web/vm/lib/lang/pl.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_action.lng b/interface/web/vm/lib/lang/pl_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_ip.lng b/interface/web/vm/lib/lang/pl_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_ip_list.lng b/interface/web/vm/lib/lang/pl_openvz_ip_list.lng deleted file mode 100644 index f675aa57c90b098f904b8e9ea793903e2f028c36..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_ostemplate.lng b/interface/web/vm/lib/lang/pl_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/pl_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_template.lng b/interface/web/vm/lib/lang/pl_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_template_list.lng b/interface/web/vm/lib/lang/pl_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_vm.lng b/interface/web/vm/lib/lang/pl_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pl_openvz_vm_list.lng b/interface/web/vm/lib/lang/pl_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pl_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt.lng b/interface/web/vm/lib/lang/pt.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_action.lng b/interface/web/vm/lib/lang/pt_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_ip.lng b/interface/web/vm/lib/lang/pt_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_ip_list.lng b/interface/web/vm/lib/lang/pt_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_ostemplate.lng b/interface/web/vm/lib/lang/pt_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/pt_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_template.lng b/interface/web/vm/lib/lang/pt_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_template_list.lng b/interface/web/vm/lib/lang/pt_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_vm.lng b/interface/web/vm/lib/lang/pt_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/pt_openvz_vm_list.lng b/interface/web/vm/lib/lang/pt_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/pt_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro.lng b/interface/web/vm/lib/lang/ro.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_action.lng b/interface/web/vm/lib/lang/ro_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_ip.lng b/interface/web/vm/lib/lang/ro_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_ip_list.lng b/interface/web/vm/lib/lang/ro_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_ostemplate.lng b/interface/web/vm/lib/lang/ro_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/ro_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_template.lng b/interface/web/vm/lib/lang/ro_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_template_list.lng b/interface/web/vm/lib/lang/ro_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_vm.lng b/interface/web/vm/lib/lang/ro_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ro_openvz_vm_list.lng b/interface/web/vm/lib/lang/ro_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ro_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru.lng b/interface/web/vm/lib/lang/ru.lng deleted file mode 100644 index b0691cfdae1f900b3f1bcbda7480a62e3e1ce710..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_action.lng b/interface/web/vm/lib/lang/ru_openvz_action.lng deleted file mode 100644 index d1a95eb7ced962ed9be2bb59da92a55ed59d2f23..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_ip.lng b/interface/web/vm/lib/lang/ru_openvz_ip.lng deleted file mode 100644 index 5fcca20bbbe5ab502ec34ed01d53d15b08c973fb..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_ip_list.lng b/interface/web/vm/lib/lang/ru_openvz_ip_list.lng deleted file mode 100644 index 787f378030f5168a9fc4a21eeb03584f4465ffce..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_ostemplate.lng b/interface/web/vm/lib/lang/ru_openvz_ostemplate.lng deleted file mode 100644 index 3d8de5c9442dc1bb93ae02a352e22cdca81854c5..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/ru_openvz_ostemplate_list.lng deleted file mode 100644 index 86af3ab1c32a87fcbfa0b51d5b44cb5e636f3dff..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_template.lng b/interface/web/vm/lib/lang/ru_openvz_template.lng deleted file mode 100644 index e8abefee5531cf09edd3add024374f694ecf2181..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_template_list.lng b/interface/web/vm/lib/lang/ru_openvz_template_list.lng deleted file mode 100644 index 4f85f544edd222d76df1abb4405a46d62f984c27..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_vm.lng b/interface/web/vm/lib/lang/ru_openvz_vm.lng deleted file mode 100644 index 4794b7e169d4e3f0544acbbf65ba3e18c95f1f05..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/ru_openvz_vm_list.lng b/interface/web/vm/lib/lang/ru_openvz_vm_list.lng deleted file mode 100644 index f88013e208b4fe68b3272096564135426f66faec..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/ru_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se.lng b/interface/web/vm/lib/lang/se.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_action.lng b/interface/web/vm/lib/lang/se_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_ip.lng b/interface/web/vm/lib/lang/se_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_ip_list.lng b/interface/web/vm/lib/lang/se_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_ostemplate.lng b/interface/web/vm/lib/lang/se_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/se_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_template.lng b/interface/web/vm/lib/lang/se_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_template_list.lng b/interface/web/vm/lib/lang/se_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_vm.lng b/interface/web/vm/lib/lang/se_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/se_openvz_vm_list.lng b/interface/web/vm/lib/lang/se_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/se_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk.lng b/interface/web/vm/lib/lang/sk.lng deleted file mode 100644 index 4167e14a8a150090ecfb1aa6738fb8a6abf17760..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_action.lng b/interface/web/vm/lib/lang/sk_openvz_action.lng deleted file mode 100644 index 52f73285824f2d6c4107d8c9eec5980a251d505c..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_ip.lng b/interface/web/vm/lib/lang/sk_openvz_ip.lng deleted file mode 100644 index 6016681df89f13323f60379acff5e7abd98f4c77..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_ip_list.lng b/interface/web/vm/lib/lang/sk_openvz_ip_list.lng deleted file mode 100644 index e6a3a68c2c3b9cad34982f035b86d4446ea68439..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_ostemplate.lng b/interface/web/vm/lib/lang/sk_openvz_ostemplate.lng deleted file mode 100644 index 256750f19a0cf4d459214a327d3f86773f9312d7..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/sk_openvz_ostemplate_list.lng deleted file mode 100644 index 6471ec0e277b63b6e110ef8deef7ca35511a2a52..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_template.lng b/interface/web/vm/lib/lang/sk_openvz_template.lng deleted file mode 100644 index 4c098565a35b2573df455929e0d092a25e3e32be..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_template_list.lng b/interface/web/vm/lib/lang/sk_openvz_template_list.lng deleted file mode 100644 index de4045c36a75506c0452b17c1e9d61080b534ce2..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_vm.lng b/interface/web/vm/lib/lang/sk_openvz_vm.lng deleted file mode 100644 index 3094f0aa8d3ee7538b84dc2de381d5051cbfe409..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/sk_openvz_vm_list.lng b/interface/web/vm/lib/lang/sk_openvz_vm_list.lng deleted file mode 100644 index 2238e2b8f4fa4db72f1b785d6e0849e356922faf..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/sk_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr.lng b/interface/web/vm/lib/lang/tr.lng deleted file mode 100644 index 82599dd038568772d46f805c842d38d8c7223bc1..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_action.lng b/interface/web/vm/lib/lang/tr_openvz_action.lng deleted file mode 100644 index 29759e0266fdabd3883e23f8a93792a0a6df7554..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_action.lng +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_ip.lng b/interface/web/vm/lib/lang/tr_openvz_ip.lng deleted file mode 100644 index 637a70f2ea87b83d0bfb467860a3c8722f111ac3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_ip.lng +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_ip_list.lng b/interface/web/vm/lib/lang/tr_openvz_ip_list.lng deleted file mode 100644 index 588273188abe2dd25fd7ab61a27413b1f5bff11b..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_ip_list.lng +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_ostemplate.lng b/interface/web/vm/lib/lang/tr_openvz_ostemplate.lng deleted file mode 100644 index 6ff2d2b9f53b33492ebfc1bc899a6ec238fbc798..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_ostemplate.lng +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_ostemplate_list.lng b/interface/web/vm/lib/lang/tr_openvz_ostemplate_list.lng deleted file mode 100644 index bf5923aed17fe4dc744a7e9bd50877dfb3bbdbd3..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_ostemplate_list.lng +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_template.lng b/interface/web/vm/lib/lang/tr_openvz_template.lng deleted file mode 100644 index fb1452e8853141d0135cf9607cc4a3b968bdfcc6..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_template.lng +++ /dev/null @@ -1,97 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_template_list.lng b/interface/web/vm/lib/lang/tr_openvz_template_list.lng deleted file mode 100644 index 5be17843134e05cdf984bf9de4d5968c8941c916..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_template_list.lng +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_vm.lng b/interface/web/vm/lib/lang/tr_openvz_vm.lng deleted file mode 100644 index fad86d9f3a29185664fa6c9bfe37ccff09f5742f..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_vm.lng +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/interface/web/vm/lib/lang/tr_openvz_vm_list.lng b/interface/web/vm/lib/lang/tr_openvz_vm_list.lng deleted file mode 100644 index 1a4ed0e7b93f99627887ec8d3e7ba746c79f01a0..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/lang/tr_openvz_vm_list.lng +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/interface/web/vm/lib/module.conf.php b/interface/web/vm/lib/module.conf.php deleted file mode 100644 index ee5e6b6ad11b0f4eeb1dffc748ab5056426bff22..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/module.conf.php +++ /dev/null @@ -1,69 +0,0 @@ - 'Virtual Servers', - 'target' => 'content', - 'link' => 'vm/openvz_vm_list.php', - 'html_id' => 'openvz_vm_list'); - -if($_SESSION["s"]["user"]["typ"] == 'admin') { - $items[] = array( 'title' => 'OS Templates', - 'target' => 'content', - 'link' => 'vm/openvz_ostemplate_list.php', - 'html_id' => 'openvz_ostemplate_list'); - - $items[] = array( 'title' => 'VM Templates', - 'target' => 'content', - 'link' => 'vm/openvz_template_list.php', - 'html_id' => 'openvz_template_list'); - - $items[] = array( 'title' => 'IP addresses', - 'target' => 'content', - 'link' => 'vm/openvz_ip_list.php', - 'html_id' => 'openvz_ip_list'); -} -if(count($items)) -{ - $module['nav'][] = array( 'title' => 'OpenVZ', - 'open' => 1, - 'items' => $items); -} - - -//**** Statistics menu -/* -$items = array(); - -$items[] = array( 'title' => 'Traffic', - 'target' => 'content', - 'link' => 'vm/traffic_stats.php', - 'html_id' => 'vm_traffic_stats'); - -$items[] = array( 'title' => 'Vserver monitor', - 'target' => 'content', - 'link' => 'vm/traffic_stats.php', - 'html_id' => 'vm_traffic_stats'); - -if(count($items)) -{ - $module['nav'][] = array( 'title' => 'Statistics', - 'open' => 1, - 'items' => $items); -} -*/ - - - - - - -?> diff --git a/interface/web/vm/lib/remote.conf.php b/interface/web/vm/lib/remote.conf.php deleted file mode 100644 index 77222bf90b46b08d3892a0cd1f24cda737b4ed4d..0000000000000000000000000000000000000000 --- a/interface/web/vm/lib/remote.conf.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/interface/web/vm/list/openvz_ip.list.php b/interface/web/vm/list/openvz_ip.list.php deleted file mode 100644 index 80869918ad4dfc0b1275bde69a358d25ae433881..0000000000000000000000000000000000000000 --- a/interface/web/vm/list/openvz_ip.list.php +++ /dev/null @@ -1,100 +0,0 @@ - "server_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "vm_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname', - 'keyfield'=> 'vm_id', - 'valuefield'=> 'hostname' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "ip_address", - 'datatype' => "VARCHAR", - 'formtype' => "TEXT", - 'op' => "like", - 'prefix' => "%", - 'suffix' => "%", - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "reserved", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); - - - - - -?> diff --git a/interface/web/vm/list/openvz_ostemplate.list.php b/interface/web/vm/list/openvz_ostemplate.list.php deleted file mode 100644 index c2df7eb3867924ce031b0275b9dbb08ca859fdd4..0000000000000000000000000000000000000000 --- a/interface/web/vm/list/openvz_ostemplate.list.php +++ /dev/null @@ -1,103 +0,0 @@ - "active", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); - -$liste["item"][] = array( 'field' => "ostemplate_id", - 'datatype' => "INTEGER", - 'formtype' => "TEXT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => ""); - - -$liste["item"][] = array( 'field' => "template_name", - 'datatype' => "VARCHAR", - 'formtype' => "TEXT", - 'op' => "like", - 'prefix' => "%", - 'suffix' => "%", - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "server_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "allservers", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); - - - -?> diff --git a/interface/web/vm/list/openvz_template.list.php b/interface/web/vm/list/openvz_template.list.php deleted file mode 100644 index 2d92f7baf4bf1aef12d19b7a5edb38938e7e0fb3..0000000000000000000000000000000000000000 --- a/interface/web/vm/list/openvz_template.list.php +++ /dev/null @@ -1,70 +0,0 @@ - "active", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); - - -$liste["item"][] = array( 'field' => "template_name", - 'datatype' => "VARCHAR", - 'formtype' => "TEXT", - 'op' => "like", - 'prefix' => "%", - 'suffix' => "%", - 'width' => "", - 'value' => ""); - - -?> diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php deleted file mode 100644 index 261427491bf1a3e6130bfca9be4a5fbf40d2b557..0000000000000000000000000000000000000000 --- a/interface/web/vm/list/openvz_vm.list.php +++ /dev/null @@ -1,132 +0,0 @@ - "active", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => array('y' => $app->lng('yes_txt'), 'n' => $app->lng('no_txt'))); - -$liste["item"][] = array( 'field' => "veid", - 'datatype' => "VARCHAR", - 'formtype' => "TEXT", - 'op' => "=", - 'prefix' => "", - 'suffix' => "", - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "server_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name', - 'keyfield'=> 'server_id', - 'valuefield'=> 'server_name' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "ostemplate_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name', - 'keyfield'=> 'ostemplate_id', - 'valuefield'=> 'template_name' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "template_id", - 'datatype' => "VARCHAR", - 'formtype' => "SELECT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "", - 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name', - 'keyfield'=> 'template_id', - 'valuefield'=> 'template_name' - ), - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "hostname", - 'datatype' => "VARCHAR", - 'filters' => array( 0 => array( 'event' => 'SHOW', - 'type' => 'IDNTOUTF8') - ), - 'formtype' => "TEXT", - 'op' => "like", - 'prefix' => "%", - 'suffix' => "%", - 'width' => "", - 'value' => ""); - -$liste["item"][] = array( 'field' => "ip_address", - 'datatype' => "VARCHAR", - 'formtype' => "TEXT", - 'op' => "like", - 'prefix' => "", - 'suffix' => "%", - 'width' => "", - 'value' => ""); - - -?> diff --git a/interface/web/vm/openvz_action.php b/interface/web/vm/openvz_action.php deleted file mode 100644 index 4b429eb44d5cdd889a0f79f5b564e53eb89deb1a..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_action.php +++ /dev/null @@ -1,129 +0,0 @@ -auth->check_module_permissions('vm'); - -$action = (isset($_POST['action']) && $_POST['action'] != '')?$_POST['action']:'show'; -$vm_id = $app->functions->intval($_REQUEST['id']); -$error_msg = ''; -$notify_msg = ''; - -if($vm_id == 0) die('Invalid VM ID'); - -if(isset($_POST) && count($_POST) > 1) { - //* CSRF Check - $app->auth->csrf_token_check(); -} -$vm = $app->db->queryOneRecord("SELECT server_id, veid FROM openvz_vm WHERE vm_id = ?", $vm_id); -$veid = $app->functions->intval($vm['veid']); -$server_id = $app->functions->intval($vm['server_id']); - -//* Loading classes -$app->uses('tpl'); - -$app->tpl->newTemplate('form.tpl.htm'); -$app->tpl->setInclude('content_tpl', 'templates/openvz_action.htm'); - -//* load language file -$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng'; -include_once $lng_file; -$app->tpl->setVar($wb); - -$app->tpl->setVar('id', $vm_id); -$app->tpl->setVar('veid', $veid); - -$options = array('start_option_enabled'=>'', 'stop_option_enabled'=>'', 'restart_option_enabled'=>'', 'ostemplate_option_enabled'=>''); - - -//* Show the action select page -if($action == 'show') { - - $options['start_option_enabled'] = 'checked="checked"'; - -} elseif ($action == 'start') { - - //* Start the virtual machine - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, UNIX_TIMESTAMP(), 'openvz_start_vm', ?, 'pending', '')"; - $app->db->query($sql, $server_id, $veid); - - $app->tpl->setVar('msg', $wb['start_exec_txt']); - $options['start_option_enabled'] = 'checked="checked"'; - -} elseif ($action == 'stop') { - - //* Stop the virtual machine - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, UNIX_TIMESTAMP(), 'openvz_stop_vm', ?, 'pending', '')"; - $app->db->query($sql, $server_id, $veid); - - $app->tpl->setVar('msg', $wb['stop_exec_txt']); - $options['stop_option_enabled'] = 'checked="checked"'; - -} elseif ($action == 'restart') { - - //* Restart the virtual machine - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, UNIX_TIMESTAMP(), 'openvz_restart_vm', ?, 'pending', '')"; - $app->db->query($sql, $server_id, $veid); - - $app->tpl->setVar('msg', $wb['restart_exec_txt']); - $options['restart_option_enabled'] = 'checked="checked"'; - -} elseif ($action == 'ostemplate') { - - $ostemplate_name = $_POST['ostemplate_name']; - - if(!preg_match("/^[a-zA-Z0-9\.\-\_]{1,50}$/i", $ostemplate_name)) { - $error_msg .= $wb['ostemplate_name_error'].'
'; - $app->tpl->setVar('ostemplate_name', $ostemplate_name); - } - - //* Quote name - - //* Check for duplicates - $tmp = $app->db->queryOneRecord("SELECT count(ostemplate_id) as number FROM openvz_ostemplate WHERE template_file = ?", $ostemplate_name); - if($tmp['number'] > 0) $error_msg .= $wb['ostemplate_name_unique_error'].'
'; - unset($tmp); - - if($error_msg == '') { - //* Create ostemplate action - $sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " . - "VALUES (?, UNIX_TIMESTAMP(), 'openvz_create_ostpl', ?, 'pending', '')"; - $app->db->query($sql, $server_id, $veid.":".$ostemplate_name); - - //* Create a record in the openvz_ostemplate table - $sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) - VALUES(1, 1, 'riud', 'riud', '', ?, ?, ?, 'n', 'y', '')"; - $app->db->query($sql, $ostemplate_name, $ostemplate_name, $server_id); - - $app->tpl->setVar('msg', $wb['ostemplate_exec_txt']); - $options['ostemplate_option_enabled'] = 'checked="checked"'; - } - -} else { - $error_msg = $app->lng('Unknown action'); - $app->error($error_msg); -} - -$app->tpl->setVar($options); -$app->tpl->setVar('error', $error_msg); - -//* SET csrf token -$csrf_token = $app->auth->csrf_token_get('openvz_action'); -$app->tpl->setVar('_csrf_id',$csrf_token['csrf_id']); -$app->tpl->setVar('_csrf_key',$csrf_token['csrf_key']); - -$app->tpl_defaults(); -$app->tpl->pparse(); - - - -?> diff --git a/interface/web/vm/openvz_ip_del.php b/interface/web/vm/openvz_ip_del.php deleted file mode 100644 index 47d5d9a03205cbe59646038438066a74d72ae288..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ip_del.php +++ /dev/null @@ -1,59 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onDelete() - -?> diff --git a/interface/web/vm/openvz_ip_edit.php b/interface/web/vm/openvz_ip_edit.php deleted file mode 100644 index 20912eec00b462c854fa4e490f862e076704742e..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ip_edit.php +++ /dev/null @@ -1,59 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -// Loading classes -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onLoad(); - -?> diff --git a/interface/web/vm/openvz_ip_list.php b/interface/web/vm/openvz_ip_list.php deleted file mode 100644 index 229a792227c14032cc091709c19824dd2bc4992e..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ip_list.php +++ /dev/null @@ -1,55 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('listform_actions'); - -// $app->listform_actions->SQLExtWhere = "limit_client = 0"; -$app->listform_actions->SQLOrderBy = 'ORDER BY openvz_ip.server_id, openvz_ip.ip_address'; -$app->listform_actions->onLoad(); - - -?> diff --git a/interface/web/vm/openvz_ostemplate_del.php b/interface/web/vm/openvz_ostemplate_del.php deleted file mode 100644 index 467465751d6690be3fc120d34b52194e5a185dac..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ostemplate_del.php +++ /dev/null @@ -1,59 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onDelete() - -?> diff --git a/interface/web/vm/openvz_ostemplate_edit.php b/interface/web/vm/openvz_ostemplate_edit.php deleted file mode 100644 index e19083e2e824846a18dd1a0de38f9e824d8054fb..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ostemplate_edit.php +++ /dev/null @@ -1,59 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -// Loading classes -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onLoad(); - -?> diff --git a/interface/web/vm/openvz_ostemplate_list.php b/interface/web/vm/openvz_ostemplate_list.php deleted file mode 100644 index fbce99bf99edd002aeb73e5e9569095ae9d0297e..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_ostemplate_list.php +++ /dev/null @@ -1,55 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('listform_actions'); - -// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id'; -// $app->listform_actions->SQLExtWhere = "limit_client = 0"; -$app->listform_actions->onLoad(); - - -?> diff --git a/interface/web/vm/openvz_template_del.php b/interface/web/vm/openvz_template_del.php deleted file mode 100644 index cc5c1320b1ad1140de368f5bce2b38f27345acf6..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_template_del.php +++ /dev/null @@ -1,59 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onDelete() - -?> diff --git a/interface/web/vm/openvz_template_list.php b/interface/web/vm/openvz_template_list.php deleted file mode 100644 index 49d01fe6355fff8ecef23f5866a00ed0a10c525f..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_template_list.php +++ /dev/null @@ -1,55 +0,0 @@ -auth->check_module_permissions('vm'); -if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); - -$app->uses('listform_actions'); - -// $app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id'; -// $app->listform_actions->SQLExtWhere = "limit_client = 0"; -$app->listform_actions->onLoad(); - - -?> diff --git a/interface/web/vm/openvz_vm_del.php b/interface/web/vm/openvz_vm_del.php deleted file mode 100644 index bd9a9d414e28b9b1e24b828a7a8a90a7a25af797..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_vm_del.php +++ /dev/null @@ -1,58 +0,0 @@ -auth->check_module_permissions('vm'); - -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - -} - -$page = new page_action; -$page->onDelete() - -?> diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php deleted file mode 100644 index 4dd1a551deff4e8cb40c7f2cb23200acbc93627e..0000000000000000000000000000000000000000 --- a/interface/web/vm/openvz_vm_edit.php +++ /dev/null @@ -1,263 +0,0 @@ -auth->check_module_permissions('vm'); - -// Loading classes -$app->uses('tpl,tform'); -$app->load('tform_actions'); - -class page_action extends tform_actions { - - function onShowNew() { - global $app, $conf; - - // we will check only users, not admins - if($_SESSION["s"]["user"]["typ"] == 'user') { - if(!$app->tform->checkClientLimit('limit_openvz_vm')) { - $app->error($app->tform->wordbook["limit_openvz_vm_txt"]); - } - if(!$app->tform->checkResellerLimit('limit_openvz_vm')) { - $app->error('Reseller: '.$app->tform->wordbook["limit_openvz_vm_txt"]); - } - } - - parent::onShowNew(); - } - - function onShowEnd() { - global $app, $conf; - - //* Client: If the logged in user is not admin and has no sub clients (no rseller) - if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { - - //* Get the limits of the client - $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - - //* Fill the template_id field - if($client['limit_openvz_vm_template_id'] == 0) { - $sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name'; - } else { - $sql = 'SELECT template_id,template_name FROM openvz_template WHERE template_id = ? ORDER BY template_name'; - } - $records = $app->db->queryAllRecords($sql, $client['limit_openvz_vm_template_id']); - if(is_array($records)) { - foreach( $records as $rec) { - $selected = @($rec["template_id"] == $this->dataRecord["template_id"])?'SELECTED':''; - $template_id_select .= "\r\n"; - } - } - $app->tpl->setVar("template_id_select", $template_id_select); - - //* Reseller: If the logged in user is not admin and has sub clients (is a rseller) - } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { - - //* Get the limits of the client - $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - $client = $app->functions->htmlentities($client); - - //* Fill the client select field - $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name"; - $records = $app->db->queryAllRecords($sql, $client['client_id']); - $records = $app->functions->htmlentities($records); - $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']); - $client_select = ''; - //$tmp_data_record = $app->tform->getDataRecord($this->id); - if(is_array($records)) { - foreach( $records as $rec) { - $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; - $client_select .= "\r\n"; - } - } - $app->tpl->setVar("client_group_id", $client_select); - - //* Fill the template_id field - if($client['limit_openvz_vm_template_id'] == 0) { - $sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name'; - } else { - $sql = 'SELECT template_id,template_name FROM openvz_template WHERE template_id = ? ORDER BY template_name'; - } - $records = $app->db->queryAllRecords($sql, $client['limit_openvz_vm_template_id']); - if(is_array($records)) { - foreach( $records as $rec) { - $selected = @($rec["template_id"] == $this->dataRecord["template_id"])?'SELECTED':''; - $template_id_select .= "\r\n"; - } - } - $app->tpl->setVar("template_id_select", $template_id_select); - - //* Admin: If the logged in user is admin - } else { - - //* Fill the client select field - $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name"; - $clients = $app->db->queryAllRecords($sql); - $clients = $app->functions->htmlentities($clients); - $client_select = ""; - //$tmp_data_record = $app->tform->getDataRecord($this->id); - if(is_array($clients)) { - foreach( $clients as $client) { - $selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':''; - $client_select .= "\r\n"; - } - } - $app->tpl->setVar("client_group_id", $client_select); - - //* Fill the template_id field - $sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name'; - $records = $app->db->queryAllRecords($sql); - if(is_array($records)) { - $template_id_select=''; - foreach( $records as $rec) { - $selected = @($rec["template_id"] == $this->dataRecord["template_id"])?'SELECTED':''; - $template_id_select .= "\r\n"; - } - } - $app->tpl->setVar("template_id_select", $template_id_select); - - } - - //* Fill the IPv4 select field with the IP addresses that are allowed for this client - //$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; - if(isset($this->dataRecord["server_id"])) { -// $vm_server_id = $app->functions->intval($this->dataRecord["server_id"]); - $vm_server_id = $app->functions->intval($this->dataRecord["vm_id"]); - } else { - $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name LIMIT 0,1'); - $vm_server_id = $app->functions->intval($tmp['server_id']); - } - $sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = ?) AND server_id = ? ORDER BY ip_address"; - $ips = $app->db->queryAllRecords($sql, $this->id, $vm_server_id); - $ip_select = ""; - if(is_array($ips)) { - foreach( $ips as $ip) { - $selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':''; - $ip_select .= "\r\n"; - } - } - $app->tpl->setVar("ip_address", $ip_select); - unset($tmp); - unset($ips); - - //* Additional IPs - $sql="SELECT * FROM openvz_ip WHERE reserved = 'n' AND ((vm_id = ? AND additional='y') OR vm_id = 0) AND server_id = ?"; - $additional_ips = $app->db->queryAllRecords($sql, $this->id, $vm_server_id); - foreach ($additional_ips as $idx => $rec) { - $temp .= ""; - $used = @($rec['additional']=='y')?'CHECKED':''; - $temp .= " ".$app->functions->htmlentities($rec['ip_address'])."
"; - } - $app->tpl->setVar("additional_ip", $temp); - unset($used); - unset($temp); - unset($additional_ips); - - if($this->id > 0) { - //* we are editing a existing record - $app->tpl->setVar("edit_disabled", 1); - $app->tpl->setVar("server_id_value", $this->dataRecord["server_id"], true); - $app->tpl->setVar("ostemplate_id_value", $this->dataRecord["ostemplate_id"], true); - } else { - $app->tpl->setVar("edit_disabled", 0); - } - - // Datepicker - $date_format = $app->lng('conf_format_dateshort'); - $trans = array("d" => "dd", "m" => "mm", "Y" => "yy"); - $date_format = strtr($date_format, $trans); - $app->tpl->setVar("date_format", $date_format); - $app->tpl->setVar("conf_format_datetime_js", strtr($app->lng('conf_format_dateshort'), array('d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy', 'y' => 'yy', 'H' => 'hh', 'h' => 'HH', 'i' => 'ii'))); - - $app->tpl->setVar("daynamesmin_su", $app->lng('daynamesmin_su')); - $app->tpl->setVar("daynamesmin_mo", $app->lng('daynamesmin_mo')); - $app->tpl->setVar("daynamesmin_tu", $app->lng('daynamesmin_tu')); - $app->tpl->setVar("daynamesmin_we", $app->lng('daynamesmin_we')); - $app->tpl->setVar("daynamesmin_th", $app->lng('daynamesmin_th')); - $app->tpl->setVar("daynamesmin_fr", $app->lng('daynamesmin_fr')); - $app->tpl->setVar("daynamesmin_sa", $app->lng('daynamesmin_sa')); - - $app->tpl->setVar("daynames_sunday", $app->lng('daynames_sunday')); - $app->tpl->setVar("daynames_monday", $app->lng('daynames_monday')); - $app->tpl->setVar("daynames_tuesday", $app->lng('daynames_tuesday')); - $app->tpl->setVar("daynames_wednesday", $app->lng('daynames_wednesday')); - $app->tpl->setVar("daynames_thursday", $app->lng('daynames_thursday')); - $app->tpl->setVar("daynames_friday", $app->lng('daynames_friday')); - $app->tpl->setVar("daynames_saturday", $app->lng('daynames_saturday')); - - $app->tpl->setVar("monthnamesshort_jan", $app->lng('monthnamesshort_jan')); - $app->tpl->setVar("monthnamesshort_feb", $app->lng('monthnamesshort_feb')); - $app->tpl->setVar("monthnamesshort_mar", $app->lng('monthnamesshort_mar')); - $app->tpl->setVar("monthnamesshort_apr", $app->lng('monthnamesshort_apr')); - $app->tpl->setVar("monthnamesshort_may", $app->lng('monthnamesshort_may')); - $app->tpl->setVar("monthnamesshort_jun", $app->lng('monthnamesshort_jun')); - $app->tpl->setVar("monthnamesshort_jul", $app->lng('monthnamesshort_jul')); - $app->tpl->setVar("monthnamesshort_aug", $app->lng('monthnamesshort_aug')); - $app->tpl->setVar("monthnamesshort_sep", $app->lng('monthnamesshort_sep')); - $app->tpl->setVar("monthnamesshort_oct", $app->lng('monthnamesshort_oct')); - $app->tpl->setVar("monthnamesshort_nov", $app->lng('monthnamesshort_nov')); - $app->tpl->setVar("monthnamesshort_dec", $app->lng('monthnamesshort_dec')); - - $app->tpl->setVar("datepicker_nextText", $app->lng('datepicker_nextText')); - $app->tpl->setVar("datepicker_prevText", $app->lng('datepicker_prevText')); - - parent::onShowEnd(); - } - - function onSubmit() { - global $app, $conf; - - //* Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller - if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]); - - parent::onSubmit(); - } - -} - -$page = new page_action; -$page->onLoad(); - -?> diff --git a/interface/web/vm/templates/openvz.conf.tpl b/interface/web/vm/templates/openvz.conf.tpl deleted file mode 100644 index 7b099b1f9b45da7c4202df462e46299dee8a800c..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz.conf.tpl +++ /dev/null @@ -1,120 +0,0 @@ - -# Template version -VERSION="2" - -# Parameters -ONBOOT="{tmpl_var name='onboot'}" -BOOTORDER="{tmpl_var name='bootorder'}" - -# VSwap requires RAM and SWAP, all other memory parameters are optional. - -# RAM -PHYSPAGES="{tmpl_var name='physpages'}" - - -# SWAP -SWAPPAGES="{tmpl_var name='swappages'}" - - - -KMEMSIZE="{tmpl_var name='kmemsize'}" - - -LOCKEDPAGES="{tmpl_var name='lockedpages'}" - - -PRIVVMPAGES="{tmpl_var name='privvmpages'}" - - -SHMPAGES="{tmpl_var name='shmpages'}" - - -VMGUARPAGES="{tmpl_var name='vmguarpages'}" - - -OOMGUARPAGES="{tmpl_var name='oomguarpages'}" - -# alternative meminfo: "pages:256000" -MEMINFO="privvmpages:1" - - -NUMPROC="{tmpl_var name='numproc'}" - - -NUMTCPSOCK="{tmpl_var name='numtcpsock'}" - - -NUMFLOCK="{tmpl_var name='numflock'}" - - -NUMPTY="{tmpl_var name='numpty'}" - - -NUMSIGINFO="{tmpl_var name='numsiginfo'}" - - -TCPSNDBUF="{tmpl_var name='tcpsndbuf'}" - - -TCPRCVBUF="{tmpl_var name='tcprcvbuf'}" - - -OTHERSOCKBUF="{tmpl_var name='othersockbuf'}" - - -DGRAMRCVBUF="{tmpl_var name='dgramrcvbuf'}" - - -NUMOTHERSOCK="{tmpl_var name='numothersock'}" - - -DCACHESIZE="{tmpl_var name='dcachesize'}" - - -NUMFILE="{tmpl_var name='numfile'}" - - -AVNUMPROC="{tmpl_var name='avnumproc'}" - - -NUMIPTENT="{tmpl_var name='numiptent'}" - - -DISKSPACE="{tmpl_var name='diskspace'}" -DISKINODES="{tmpl_var name='diskinodes'}" -QUOTAUGIDLIMIT="10000" -QUOTATIME="0" - -IOPRIO="{tmpl_var name='io_priority'}" - - - -CPUS="{tmpl_var name='cpu_num'}" - - -CPUUNITS="{tmpl_var name='cpu_units'}" - - -CPULIMIT="{tmpl_var name='cpu_limit'}" - - -VE_ROOT="/vz/root/$VEID" -VE_PRIVATE="/vz/private/$VEID" -OSTEMPLATE="{tmpl_var name='ostemplate'}" -ORIGIN_SAMPLE="vps.basic" -HOSTNAME="{tmpl_var name='hostname'}" -IP_ADDRESS="{tmpl_var name='ip_address'}" -NAMESERVER="{tmpl_var name='nameserver'}" - - -CAPABILITY="{tmpl_var name='capability'}" - - -FEATURES="{tmpl_var name='features'}" - - -IPTABLES="{tmpl_var name='iptables'}" - - -{tmpl_var name='custom'} - diff --git a/interface/web/vm/templates/openvz_action.htm b/interface/web/vm/templates/openvz_action.htm deleted file mode 100644 index 2d95f9cb0f8bd421081117ba0365b6d6c1282d2f..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_action.htm +++ /dev/null @@ -1,42 +0,0 @@ - -

- - - {tmpl_var name="head_txt"} {tmpl_var name='veid'} - - -

-
- -

-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
 {tmpl_var name='ostemplate_desc_txt'} -
-
- - - -
- - -
\ No newline at end of file diff --git a/interface/web/vm/templates/openvz_ip_edit.htm b/interface/web/vm/templates/openvz_ip_edit.htm deleted file mode 100644 index 279066978411376ef1dd61ad9175aaa32f89be90..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_ip_edit.htm +++ /dev/null @@ -1,42 +0,0 @@ - -

- - - IP address -
- -
-
-
- -
-
- -
-
-
- -
- {tmpl_var name='reserved'} -
-
- - - - -
- - -
- \ No newline at end of file diff --git a/interface/web/vm/templates/openvz_ip_list.htm b/interface/web/vm/templates/openvz_ip_list.htm deleted file mode 100644 index fd12694c37c07ece5cec1f3ce46501ba50b6fb85..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_ip_list.htm +++ /dev/null @@ -1,60 +0,0 @@ - - - -

{tmpl_var name="toolsarea_head_txt"}

- - - - - - -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{tmpl_var name='search_limit'}
- -
{tmpl_var name="server_id"}{tmpl_var name="vm_id"}{tmpl_var name="ip_address"}{tmpl_var name="reserved"} - -
{tmpl_var name='globalsearch_noresults_text_txt'}
-
- - \ No newline at end of file diff --git a/interface/web/vm/templates/openvz_ostemplate_edit.htm b/interface/web/vm/templates/openvz_ostemplate_edit.htm deleted file mode 100644 index 642cf99126b8db4dace63ea44be2211543b3f58b..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_ostemplate_edit.htm +++ /dev/null @@ -1,43 +0,0 @@ - -

- - - Domain -
- -
-
- -
-
- -
-
-
- -
- {tmpl_var name='allservers'} -
-
-
- -
- {tmpl_var name='active'} -
-
-
- -
-
- - - - -
- - -
\ No newline at end of file diff --git a/interface/web/vm/templates/openvz_ostemplate_list.htm b/interface/web/vm/templates/openvz_ostemplate_list.htm deleted file mode 100644 index 85f46e6732c8a5f8234e7199af8c0f567ef4aa08..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_ostemplate_list.htm +++ /dev/null @@ -1,63 +0,0 @@ - - - -

{tmpl_var name="toolsarea_head_txt"}

- - - - - - -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{tmpl_var name='search_limit'}
- -
{tmpl_var name="active"}{tmpl_var name="ostemplate_id"}{tmpl_var name="template_name"}{tmpl_var name="server_id"}{tmpl_var name="allservers"} - -
{tmpl_var name='globalsearch_noresults_text_txt'}
-
- - \ No newline at end of file diff --git a/interface/web/vm/templates/openvz_template_advanced_edit.htm b/interface/web/vm/templates/openvz_template_advanced_edit.htm deleted file mode 100644 index 3712906ed0ce11b84e51b7d66f1a4a945109f19a..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_template_advanced_edit.htm +++ /dev/null @@ -1,92 +0,0 @@ - -

- - - Advanced -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - - -
- - -
diff --git a/interface/web/vm/templates/openvz_template_edit.htm b/interface/web/vm/templates/openvz_template_edit.htm deleted file mode 100644 index d60efa274dd7aa8daceb816e19af7dd87a53f374..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_template_edit.htm +++ /dev/null @@ -1,69 +0,0 @@ - -

- - - Template -
- -
-
- -
 GB -
-
- -
 MB -
-
- -
 MB -
-
- -
 (8 - 500000) -
-
- -
 (1 - 64) -
-
- -
 (10 - 6400) -
-
- -
 (0 - 7) -
-
- -
-
- -
- {tmpl_var name='create_dns'} -
-
-
- -
 {tmpl_var name='nameserver_desc_txt'} -
-
- -
- {tmpl_var name='active'} -
-
-
- -
-
- - - - -
- - -
\ No newline at end of file diff --git a/interface/web/vm/templates/openvz_template_list.htm b/interface/web/vm/templates/openvz_template_list.htm deleted file mode 100644 index 5ec0cb79139a5d0e80b3f61f92f17625e1ab5e52..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_template_list.htm +++ /dev/null @@ -1,54 +0,0 @@ - - - -

{tmpl_var name="toolsarea_head_txt"}

- - - - - - -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{tmpl_var name='search_limit'}
- -
{tmpl_var name="active"}{tmpl_var name="template_name"} - -
{tmpl_var name='globalsearch_noresults_text_txt'}
-
- - \ No newline at end of file diff --git a/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm b/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm deleted file mode 100644 index f19eb6ca9c0d94bab783c60715ebd913528cc4e2..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm +++ /dev/null @@ -1,19 +0,0 @@ - -

- -Additional IPs - -
-
- {tmpl_var name='additional_ip'} -
-
- - - -
- - -
- - diff --git a/interface/web/vm/templates/openvz_vm_advanced_edit.htm b/interface/web/vm/templates/openvz_vm_advanced_edit.htm deleted file mode 100644 index a25d715e575fdc7fd92117aea208fc0fe0c9a85a..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_vm_advanced_edit.htm +++ /dev/null @@ -1,72 +0,0 @@ - -

- - - Advanced -
- -
-
- -
- {tmpl_var name='create_dns'} -
-
-
- -
 GB -
-
- -
 MB -
-
- -
 MB -
-
- -
 (8 - 500000) -
-
- -
 (1 - 64) -
-
- -
 (10 - 6400) -
-
- -
 (0 - 7) -
-
- -
 {tmpl_var name='nameserver_desc_txt'} -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
- - - - -
- - -
diff --git a/interface/web/vm/templates/openvz_vm_edit.htm b/interface/web/vm/templates/openvz_vm_edit.htm deleted file mode 100644 index a045012d7c436b6db345b897eb034e609e05a109..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_vm_edit.htm +++ /dev/null @@ -1,101 +0,0 @@ - -

- - - Settings - -
- - -
- - - -
-
-
-
- -
-
-
- -
- -
-
-
- -
- -
-
- - -
- -
-
-
-
- -
-
-
- -
-
-
- -
-
- -
-
- -
- {tmpl_var name='start_boot'} -
-
-
- -
-
- -
- {tmpl_var name='active'} -
-
-
- -
-
- -
-
- - - - -
- - -
diff --git a/interface/web/vm/templates/openvz_vm_list.htm b/interface/web/vm/templates/openvz_vm_list.htm deleted file mode 100644 index 516b536bb39fb4077e22e25fb000f64b0a830749..0000000000000000000000000000000000000000 --- a/interface/web/vm/templates/openvz_vm_list.htm +++ /dev/null @@ -1,70 +0,0 @@ - - - -

{tmpl_var name="toolsarea_head_txt"}

- - - - - - -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{tmpl_var name='search_limit'}
- -
{tmpl_var name="veid"}{tmpl_var name="active"}{tmpl_var name="server_id"}{tmpl_var name="ostemplate_id"}{tmpl_var name="template_id"}{tmpl_var name="hostname"}{tmpl_var name="ip_address"} - - -
{tmpl_var name='globalsearch_noresults_text_txt'}
-
- - \ No newline at end of file diff --git a/remoting_client/API-docs/client_get_by_groupid.html b/remoting_client/API-docs/client_get_by_groupid.html new file mode 100644 index 0000000000000000000000000000000000000000..60fb58e474552acba2c6deebf6e5bac963956730 --- /dev/null +++ b/remoting_client/API-docs/client_get_by_groupid.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

client_get_by_groupid($session_id, $groupid);

+
+

Description:

+

Shows client information of user.


+

Input Variables:

+

$session_id, $groupid

+

Parameters (in $params):

+

None

+

Output:

+

Returns client information from client tyble by groupid of that client.

+ +
+ + diff --git a/remoting_client/API-docs/dns_slave_delete.html b/remoting_client/API-docs/dns_slave_delete.html new file mode 100644 index 0000000000000000000000000000000000000000..baaca8408e495c30d28c6305f9fe5c0b6392311e --- /dev/null +++ b/remoting_client/API-docs/dns_slave_delete.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

dns_slave_delete($session_id, $primary_id);

+
+

Description:

+

Deletes a dns slave zone.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns the number of deleted records.

+ +
+ + diff --git a/remoting_client/API-docs/dns_slave_get.html b/remoting_client/API-docs/dns_slave_get.html new file mode 100644 index 0000000000000000000000000000000000000000..8b66dd300617b05b13c511c93b4c4ed5ebefe65d --- /dev/null +++ b/remoting_client/API-docs/dns_slave_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

dns_slave_get($session_id, $primary_id);

+
+

Description:

+

Retrieves information about a dns slave zone.


+

Input Variables:

+

$session_id, $primary_id

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + diff --git a/remoting_client/API-docs/domains_domain_update.html b/remoting_client/API-docs/domains_domain_update.html new file mode 100644 index 0000000000000000000000000000000000000000..bf3dd9c4bdc6b9727d10f3d6e1a0c6c79cc4bcef --- /dev/null +++ b/remoting_client/API-docs/domains_domain_update.html @@ -0,0 +1,30 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

domains_domain_update($session_id, $client_id, $primary_id, $params);

+
+

Description:

+

Updates domain to move it to another client.


+

Input Variables:

+

$session_id, $client_id, $primary_id, $params

+

Parameters (in $params):

+

domain  (varchar(255))

+

client_id  (int(11))

+

Output:

+

Returns the number of affected rows.

+ +
+ + diff --git a/remoting_client/API-docs/sys_datalog_get.html b/remoting_client/API-docs/sys_datalog_get.html new file mode 100644 index 0000000000000000000000000000000000000000..9f1714609086cbf6f28c7dbb8d86c124232daa1a --- /dev/null +++ b/remoting_client/API-docs/sys_datalog_get.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

sys_datalog_get($session_id, $datalog_id, $newer);

+
+

Description:

+

Retrieves information from sys_datalog.


+

Input Variables:

+

$session_id, $datalog_id, $newer (true/false)

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + diff --git a/remoting_client/API-docs/sys_datalog_get_by_tstamp.html b/remoting_client/API-docs/sys_datalog_get_by_tstamp.html new file mode 100644 index 0000000000000000000000000000000000000000..fdc1008c2195f2530d63bf3f99b3df09b0f57f13 --- /dev/null +++ b/remoting_client/API-docs/sys_datalog_get_by_tstamp.html @@ -0,0 +1,29 @@ + +ISPCOnfig 3 remote API documentation + + + + + + + + + + +
+

sys_datalog_get_by_tstamp($session_id, $tstamp);

+
+

Description:

+

Retrieves information from sys_datalog by timestamp. All records that are newer or same than given timestamp are returned.


+

Input Variables:

+

$session_id, $tstamp

+

Parameters (in $params):

+

None

+

Output:

+

Returns all fields and values of the chosen dns slave zone.

+ +
+ + diff --git a/remoting_client/cli/ispconfig-cli b/remoting_client/cli/ispconfig-cli index e03aa29f3c02e6cde771f7a28c446135e2410041..83c95216e21b44eafbf3023e10ba2ce79d6d8e7b 100755 --- a/remoting_client/cli/ispconfig-cli +++ b/remoting_client/cli/ispconfig-cli @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Command line for ISPConfig remote user REST API using either smart functions or raw methods. # Author: Johan Ehnberg, johan@molnix.com diff --git a/remoting_client/examples/client_add.php b/remoting_client/examples/client_add.php index 6d5b5934d76cfc827e6c209b708ffe09106061ca..c4d993bb2e0ae785449a7bdd3c2a82c3690515a3 100644 --- a/remoting_client/examples/client_add.php +++ b/remoting_client/examples/client_add.php @@ -51,7 +51,7 @@ try { 'limit_web_ip' => '', 'limit_web_domain' => -1, 'limit_web_quota' => -1, - 'web_php_options' => 'no,fast-cgi,cgi,mod,suphp', + 'web_php_options' => 'no,fast-cgi,mod', 'limit_web_subdomain' => -1, 'limit_web_aliasdomain' => -1, 'limit_ftp_user' => -1, diff --git a/remoting_client/examples/openvz_ip_add.php b/remoting_client/examples/domains_domain_update.php similarity index 68% rename from remoting_client/examples/openvz_ip_add.php rename to remoting_client/examples/domains_domain_update.php index cda9fa4a7fdbe6524e181d4ba2121e3cdd89faa7..244222428c773097a4d6c98f9dafef48035d1e47 100644 --- a/remoting_client/examples/openvz_ip_add.php +++ b/remoting_client/examples/domains_domain_update.php @@ -16,18 +16,17 @@ try { //* Set the function parameters. $client_id = 1; + $primary_id = 42; // The domain_id $params = array( - 'server_id' => 1, - 'ip_address' => '192.168.0.111', - 'vm_id' => 1, - 'reserved' => 'n' + 'domain' => 'cellar.door' ); - $ip_id = $client->openvz_ip_add($session_id, $client_id, $params); + $result = $client->domains_domain_update($session_id, $client_id, $primary_id, $params); - echo "IP ID: ".$ip_id."
"; - - if($client->logout($session_id)) { + if ($result) { + echo 'Domain updated.
'; + } + if ($client->logout($session_id)) { echo 'Logged out.
'; } diff --git a/remoting_client/examples/mail_mailinglist_add.php b/remoting_client/examples/mail_mailinglist_add.php deleted file mode 100644 index 3d6cd568ab55644fe163f4d88d8d018190327ff3..0000000000000000000000000000000000000000 --- a/remoting_client/examples/mail_mailinglist_add.php +++ /dev/null @@ -1,41 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $client_id = 1; - $params = array( - 'server_id' => 1, - 'domain' => 'test.int', - 'listname' => 'work', - 'email' => 'hmmnoe@test.int', - 'password' => 'hmmyea' - ); - - $mailinglist_id = $client->mail_mailinglist_add($session_id, $client_id, $params); - - echo "Mailinglist ID: ".$mailinglist_id."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/mail_mailinglist_delete.php b/remoting_client/examples/mail_mailinglist_delete.php deleted file mode 100644 index cf76336f28d972efeb1733d8f8bf97e1fcac0f12..0000000000000000000000000000000000000000 --- a/remoting_client/examples/mail_mailinglist_delete.php +++ /dev/null @@ -1,36 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $mailinglist_id = 1; - - - //* Delete the email mailinglist record - $affected_rows = $client->mail_mailinglist_delete($session_id, $mailinglist_id); - - echo "Number of records that have been deleted: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/mail_mailinglist_get.php b/remoting_client/examples/mail_mailinglist_get.php deleted file mode 100644 index 7affe57a1e0ecaa883e8f890c9cbd402aab2ded7..0000000000000000000000000000000000000000 --- a/remoting_client/examples/mail_mailinglist_get.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $mailinglist_id = 1; - - $mailinglist_record = $client->mail_mailinglist_get($session_id, $mailinglist_id); - - print_r($mailinglist_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/mail_mailinglist_update.php b/remoting_client/examples/mail_mailinglist_update.php deleted file mode 100644 index c7d6216c11cf1332723a53439f8206491ad70782..0000000000000000000000000000000000000000 --- a/remoting_client/examples/mail_mailinglist_update.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $mailinglist_id = 1; - $client_id = 1; - - - //* Get the email mailinglist record - $mailinglist_record = $client->mail_mailinglist_get($session_id, $mailinglist_id); - - //* Change the listname to home - $mailinglist_record['listname'] = 'home'; - - $affected_rows = $client->mail_mailinglist_update($session_id, $client_id, $mailinglist_id, $mailinglist_record); - - echo "Number of records that have been changed in the database: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/mail_user_add.php b/remoting_client/examples/mail_user_add.php index 3b7d240eccea9805b43526959ed5298ed025cc86..26d942066b7dbb38ec2cd940b8cb521841284b34 100644 --- a/remoting_client/examples/mail_user_add.php +++ b/remoting_client/examples/mail_user_add.php @@ -42,9 +42,9 @@ try { 'disablesmtp' => 'n' ); - $affected_rows = $client->mail_user_add($session_id, $client_id, $params); + $mailuser_id = $client->mail_user_add($session_id, $client_id, $params); - echo "New user: ".$affected_rows."
"; + echo "New user: ".$mailuser_id."
"; if($client->logout($session_id)) { echo 'Logged out.
'; diff --git a/remoting_client/examples/openvz_get_free_ip.php b/remoting_client/examples/openvz_get_free_ip.php deleted file mode 100644 index d7ccc969742fb8f766c64a81f56f67632868d2fc..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_get_free_ip.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - - $record_record = $client->openvz_get_free_ip($session_id, $server_id = 0); - - print_r($record_record); - echo "
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ip_delete.php b/remoting_client/examples/openvz_ip_delete.php deleted file mode 100644 index c7b07f8aae812f82c5bfe995117a9b0fbaf52b83..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ip_delete.php +++ /dev/null @@ -1,36 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $ip_id = 2; - - - //* delete the ip record - $affected_rows = $client->openvz_ip_delete($session_id, $ip_id); - - echo "Number of records that have been deleted: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ip_get.php b/remoting_client/examples/openvz_ip_get.php deleted file mode 100644 index 9237ed4e1b848a12ab4d31ad278b75b46d5db606..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ip_get.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $ip_id = 2; - - $ip_record = $client->openvz_ip_get($session_id, $ip_id); - - print_r($ip_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ip_update.php b/remoting_client/examples/openvz_ip_update.php deleted file mode 100644 index 9867fe0a9cbff197df26bbbc8e61ddf14e0bd049..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ip_update.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $ip_id = 2; - $client_id = 1; - - - //* Get the openvz ip record - $ip_record = $client->openvz_ip_get($session_id, $ip_id); - - //* Change the reservation to yes - $ip_record['reserved'] = 'y'; - - $affected_rows = $client->openvz_ip_update($session_id, $client_id, $ip_id, $ip_record); - - echo "Number of records that have been changed in the database: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ostemplate_add.php b/remoting_client/examples/openvz_ostemplate_add.php deleted file mode 100644 index 3ad0c137286ce394e8a7c707003475fdfda96cba..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ostemplate_add.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $client_id = 1; - $params = array( - 'template_name' => 'tone', - 'template_file' => 'custom', - 'server_id' => 1, - 'allservers' => 'y', - 'active' => 'y', - 'description' => 'howto', - ); - - $ostemplate_id = $client->openvz_ostemplate_add($session_id, $client_id, $params); - - echo "Ostemplate ID: ".$ostemplate_id."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ostemplate_delete.php b/remoting_client/examples/openvz_ostemplate_delete.php deleted file mode 100644 index 659d8afa09be8a1adc5886e2fee81d3426b876ad..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ostemplate_delete.php +++ /dev/null @@ -1,36 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $ostemplate_id = 2; - - - //* delete the ostemplate record - $affected_rows = $client->openvz_ostemplate_delete($session_id, $ostemplate_id); - - echo "Number of records that have been deleted: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ostemplate_get.php b/remoting_client/examples/openvz_ostemplate_get.php deleted file mode 100644 index b2d940b4bb6f2f62c5111e3bef92a912c03e8a5d..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ostemplate_get.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $ostemplate_id = 2; - - $ostemplate_record = $client->openvz_ostemplate_get($session_id, $ostemplate_id); - - print_r($ostemplate_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_ostemplate_update.php b/remoting_client/examples/openvz_ostemplate_update.php deleted file mode 100644 index a95fc175ff38abc4821501437891c1c332705ae1..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_ostemplate_update.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $ostemplate_id = 2; - $client_id = 1; - - - //* Get the os template record - $ostemplate_record = $client->openvz_ostemplate_get($session_id, $ostemplate_id); - - //* Change the status to inactive - $ostemplate_record['active'] = 'n'; - - $affected_rows = $client->openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $ostemplate_record); - - echo "Number of records that have been changed in the database: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_template_add.php b/remoting_client/examples/openvz_template_add.php deleted file mode 100644 index b602000de4697f67ee0c4e2eb3e03640608a53fc..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_template_add.php +++ /dev/null @@ -1,74 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $client_id = 1; - $params = array( - 'template_name' => 'tone', - 'diskspace' => 10, - 'traffic' => -1, - 'bandwidth' => -1, - 'ram' => 256, - 'ram_burst' => 512, - 'cpu_units' => 1000, - 'cpu_num' => 4, - 'cpu_limit' => 400, - 'io_priority' => 4, - 'active' => 'y', - 'description' => 'howto', - 'numproc' => '999999:999999', - 'numtcpsock' => '7999992:7999992', - 'numothersock' => '7999992:7999992', - 'vmguarpages' => '65536:unlimited', - 'kmemsize' => '2147483646:2147483646', - 'tcpsndbuf' => '214748160:396774400', - 'tcprcvbuf' => '214748160:396774400', - 'othersockbuf' => '214748160:396774400', - 'dgramrcvbuf' => '214748160:396774400', - 'oomguarpages' => '65536:65536', - 'privvmpages' => '131072:139264', - 'lockedpages' => '999999:999999', - 'shmpages' => '65536:65536', - 'physpages' => '0:2147483647', - 'numfile' => '23999976:23999976', - 'avnumproc' => '180:180', - 'numflock' => '999999:999999', - 'numpty' => '500000:500000', - 'numsiginfo' => '999999:999999', - 'dcachesize' => '2147483646:2147483646', - 'numiptent' => '999999:999999', - 'swappages' => '256000:256000', - 'hostname' => 'host', - 'nameserver' => 'ns1', - 'create_dns' => 'n', - 'capability' => '' - ); - - $template_id = $client->openvz_template_add($session_id, $client_id, $params); - - echo "Template ID: ".$template_id."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_template_delete.php b/remoting_client/examples/openvz_template_delete.php deleted file mode 100644 index 128034e85694a332dad9921947f584d4b0c96354..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_template_delete.php +++ /dev/null @@ -1,36 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $template_id = 2; - - - //* delete the template record - $affected_rows = $client->openvz_template_delete($session_id, $template_id); - - echo "Number of records that have been deleted: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_template_get.php b/remoting_client/examples/openvz_template_get.php deleted file mode 100644 index dfe9c1113cc8830b13345429cc854e1eafb80d6c..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_template_get.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $template_id = 2; - - $template_record = $client->openvz_template_get($session_id, $template_id); - - print_r($template_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_template_update.php b/remoting_client/examples/openvz_template_update.php deleted file mode 100644 index 0425d9453035e8764afcc78e5394d25dbdae8068..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_template_update.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $template_id = 2; - $client_id = 1; - - - //* Get the openvz template record - $template_record = $client->openvz_template_get($session_id, $template_id); - - //* Change the status to inactive - $template_record['active'] = 'n'; - - $affected_rows = $client->openvz_template_update($session_id, $client_id, $template_id, $template_record); - - echo "Number of records that have been changed in the database: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_add.php b/remoting_client/examples/openvz_vm_add.php deleted file mode 100644 index 408c62695eaaeee537cdadda5da120b816b1b1d8..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_add.php +++ /dev/null @@ -1,60 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $client_id = 1; - $params = array( - 'server_id' => 1, - 'veid' => 1, - 'ostemplate_id' => 0, - 'template_id' => 0, - 'ip_address' => '192.168.0.111', - 'hostname' => 'host', - 'vm_password' => 'password', - 'start_boot' => 'y', - 'active' => 'y', - 'active_until_date' => '', - 'description' => '', - 'diskspace' => 10, - 'traffic' => -1, - 'bandwidth' => -1, - 'ram' => 256, - 'ram_burst' => 512, - 'cpu_units' => 1000, - 'cpu_num' => 4, - 'cpu_limit' => 400, - 'io_priority' => 4, - 'nameserver' => '8.8.8.8 8.8.4.4', - 'create_dns' => 'n', - 'capability' => '', - 'config' => '' - ); - - $vm_id = $client->openvz_vm_add($session_id, $client_id, $params); - - echo "VM ID: ".$vm_id."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_add_from_template.php b/remoting_client/examples/openvz_vm_add_from_template.php deleted file mode 100644 index ea7328d166252d50cd05a2a2a4966dd6d931ce94..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_add_from_template.php +++ /dev/null @@ -1,45 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Params are optional for this function. If params are set, - //* then they override the template settings. - $params = array(); - - //* Set the function parameters. - $client_id = 0; - $ostemplate_id = 3; - $template_id = 3; - - $vm_id = $client->openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $params); - - print_r($vm_id); - echo "
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_delete.php b/remoting_client/examples/openvz_vm_delete.php deleted file mode 100644 index be0737cd90012bb6b757792e32abe2d8cdec99dc..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_delete.php +++ /dev/null @@ -1,36 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $vm_id = 1; - - - //* delete the virtual machine record - $affected_rows = $client->openvz_vm_delete($session_id, $vm_id); - - echo "Number of records that have been deleted: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_get.php b/remoting_client/examples/openvz_vm_get.php deleted file mode 100644 index 78bd5712f6413bac04f95964e6ec4aa9d6def05b..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_get.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set the function parameters. - $vm_id = 1; - - $vm_record = $client->openvz_vm_get($session_id, $vm_id); - - print_r($vm_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_get_by_client.php b/remoting_client/examples/openvz_vm_get_by_client.php deleted file mode 100644 index 8497185971d7021da05696272905f7406ddf442e..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_get_by_client.php +++ /dev/null @@ -1,34 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Set function parameters - $client_id = 4; - - $vm_record = $client->openvz_vm_get_by_client($session_id, $client_id); - - print_r($vm_record); - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/openvz_vm_update.php b/remoting_client/examples/openvz_vm_update.php deleted file mode 100644 index f15386a64b4b763298cdb1839fbe4436907f8df8..0000000000000000000000000000000000000000 --- a/remoting_client/examples/openvz_vm_update.php +++ /dev/null @@ -1,42 +0,0 @@ - $soap_location, - 'uri' => $soap_uri, - 'trace' => 1, - 'exceptions' => 1)); - - -try { - if($session_id = $client->login($username, $password)) { - echo 'Logged successfull. Session ID:'.$session_id.'
'; - } - - //* Parameters - $vm_id = 1; - $client_id = 1; - - - //* Get the virtual machine record - $vm_record = $client->openvz_vm_get($session_id, $vm_id); - - //* Change active to no - $vm_record['active'] = 'n'; - - $affected_rows = $client->openvz_vm_update($session_id, $client_id, $vm_id, $vm_record); - - echo "Number of records that have been changed in the database: ".$affected_rows."
"; - - if($client->logout($session_id)) { - echo 'Logged out.
'; - } - - -} catch (SoapFault $e) { - echo $client->__getLastResponse(); - die('SOAP Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/examples/rest_example.sh b/remoting_client/examples/rest_example.sh index 5173f0fa3715ee32ac0f6702f9d4b34c65344894..61919927f1c5ab1a925da25fab0805fc91802472 100644 --- a/remoting_client/examples/rest_example.sh +++ b/remoting_client/examples/rest_example.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/remoting_client/examples/soap-database-add.php b/remoting_client/examples/soap-database-add.php deleted file mode 100644 index 5ff7e4b79df4af0c913c40a8956b930694edd1b5..0000000000000000000000000000000000000000 --- a/remoting_client/examples/soap-database-add.php +++ /dev/null @@ -1,47 +0,0 @@ - $soap_location, - 'uri' => $soap_uri)); -try { - if($session_id = $client->login($username, $password)) { - echo "Logged:".$session_id."
\n"; - } - - $database_type = 'mysql'; //Only mysql type avaliable more types coming soon. - $database_name = 'yourdbname'; - $database_username = 'yourusername'; - $database_password = 'yourpassword'; - $database_charset = ''; // blank = db default, latin1 or utf8 - $database_remoteips = ''; //remote ip´s separated by commas - - $params = array( - 'server_id' => 1, - 'type' => $database_type, - 'database_name' => $database_name, - 'database_user' => $database_username, - 'database_password' => $database_password, - 'database_charset' => $database_charset, - 'remote_access' => 'n', // n disabled - y enabled - 'active' => 'y', // n disabled - y enabled - 'remote_ips' => $database_remoteips - ); - - $client_id = 1; - $database_id = $client->sites_database_add($session_id, $client_id, $params); - - if($client->logout($session_id)) { - echo "Logout.
\n"; - } - - -} catch (SoapFault $e) { - die('Error: '.$e->getMessage()); -} - -?> diff --git a/remoting_client/readme b/remoting_client/readme index 1392888bc0e44213c4bde4a0a2cf13523fbfae2e..6e2ef10e6de7f57451712ffed331e5d3418f8adb 100644 --- a/remoting_client/readme +++ b/remoting_client/readme @@ -3,12 +3,12 @@ - Remote API example files -------------------------------------------------------- -The examples folder contains a example script for every -Remote api function. The login details and URL for the +The examples folder contains an example script for every +remote api function. The login details and URL for the remote connection are defined in the file soap_config.php -------------------------------------------------------- - Remote API documentation -------------------------------------------------------- -The startpage of the API documentation is main.html +The startpage of the API documentation is API-docs/index.html diff --git a/security/ids.whitelist b/security/ids.whitelist index 42c0559ecbd118bb94d5ae41de65b73a627789e2..a9b045e15f52b2bb8d4d6d6d0d09b92bd3319d73 100644 --- a/security/ids.whitelist +++ b/security/ids.whitelist @@ -41,6 +41,7 @@ admin:/capp.php:SESSION.s.module.nav.1.items.0.title admin:/sites/web_vhost_subdomain_edit.php:POST.php_open_basedir admin:/sites/web_domain_edit.php:POST.php_open_basedir admin:/sites/web_domain_edit.php:POST.apache_directives +admin:/sites/web_vhost_domain_edit.php:POST.nginx_directives user:/sites/shell_user_edit.php:POST.ssh_rsa user:/sites/cron_edit.php:POST.command admin:/admin/server_config_edit.php:POST.jailkit_chroot_app_programs diff --git a/interface/web/mail/mail_ml_membership_del.php b/server/addons.php old mode 100644 new mode 100755 similarity index 56% rename from interface/web/mail/mail_ml_membership_del.php rename to server/addons.php index d2dcaf542b7b1d1a4466613edabb94676f666a5f..40bf727e94ee07070c582636162e5336acaf1612 --- a/interface/web/mail/mail_ml_membership_del.php +++ b/server/addons.php @@ -1,7 +1,7 @@ auth->check_module_permissions('mail'); - -// Loading classes -$app->uses('tpl,tform,tform_actions'); -$app->load('tform_actions'); - -class page_action extends tform_actions { +if(!isset($_SERVER['argv'])) { + die('No package path given.'); +} - function onBeforeDelete() { - global $app; $conf; +$action = ''; +$package = ''; +$force = false; +$argv = $_SERVER['argv']; +for($a = 1; $a < count($argv); $a++) { + if($argv[$a] === '--install' || $argv[$a] === 'install' + || $argv[$a] === '--update' || $argv[$a] === 'update') { + $action = 'install'; + } elseif($argv[$a] === '--uninstall' || $argv[$a] === 'uninstall') { + $action = 'uninstall'; + } elseif($argv[$a] === '--force') { + $force = true; + } elseif(substr($argv[$a], -4) === '.pkg' && is_file($argv[$a])) { + $package = $argv[$a]; + } else { + die('Unknown argument ' . $argv[$a]); } } -$page = new page_action; -$page->onDelete(); - -?> +if($action == 'uninstall') { + die('Automatic uninstall not supported, yet.'); +} else { + try { + $app->addon_installer->installAddon($package, $force); + } catch(Exception $e) { + die('Error: ' . $e->getMessage() . "\n"); + } +} \ No newline at end of file diff --git a/server/conf/apache_apps.vhost.master b/server/conf/apache_apps.vhost.master index 7dc2fd9ddf679462b6bb71740edc7a08625f17cc..d77cde2e4208373d79f5480ef675b8ea63d3cb84 100644 --- a/server/conf/apache_apps.vhost.master +++ b/server/conf/apache_apps.vhost.master @@ -24,12 +24,7 @@ Options FollowSymLinks AllowOverride None - Require all granted - - Order allow,deny - Allow from all - @@ -39,12 +34,7 @@ Options FollowSymLinks AllowOverride None - Require all granted - - Order allow,deny - Allow from all - @@ -58,15 +48,20 @@ SetHandler fcgid-script FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php - Require all granted - - Order allow,deny - Allow from all - +{tmpl_if name="use_rspamd"} + + Order allow,deny + Allow from all + + RewriteEngine On + RewriteRule ^/rspamd$ /rspamd/ [R,L] + RewriteRule ^/rspamd/(.*) http://127.0.0.1:11334/$1 [P] +{/tmpl_if} + diff --git a/server/conf/apache_ispconfig.conf.master b/server/conf/apache_ispconfig.conf.master index 6165f0496b1624fef7f5aefdeb81717413359974..5fb618c13e5c023c92fb54773197367f48330a83 100644 --- a/server/conf/apache_ispconfig.conf.master +++ b/server/conf/apache_ispconfig.conf.master @@ -4,11 +4,9 @@ ServerTokens ProductOnly ServerSignature Off - SSLStaplingCache shmcb:/var/run/ocsp(128000) - ################################################ # ISPConfig Logfile configuration for vlogger @@ -18,6 +16,7 @@ SSLStaplingCache shmcb:/var/run/ocsp(128000) LogFormat '%v %h %l %u %t "%r" %>s %S "%{Referer}i" "%{User-Agent}i"' combined_ispconfig LogFormat "%v %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig + CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -p -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog @@ -27,131 +26,49 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - # Do not allow access to the root file system of the server for security reasons Options -Indexes AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - # Except of the following directories that contain website scripts - Require all granted - - Order allow,deny - Allow from all - - Require all granted - - Order allow,deny - Allow from all - - Require all granted - - Order allow,deny - Allow from all - - Require all granted - - Order allow,deny - Allow from all - - - -# Allow access to mailman on OpenSuSE - - - Require all granted - - Order allow,deny - Allow from all - - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - Options +FollowSymLinks - - Require all granted - - Order allow,deny - Allow from all - # allow path to awstats and alias for awstats icons - Require all granted - - Order allow,deny - Allow from all - Alias /awstats-icon "/usr/share/awstats/icon" Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge - Require all granted - - Order allow,deny - Allow from all - - AssignUserId www-data www-data - + AssignUserId www-data www-data + - - -NameVirtualHost *:80 -NameVirtualHost *:443 - -NameVirtualHost {tmpl_var name="ip_address"}:{tmpl_var name="port"} - - diff --git a/server/conf/autoresponder.master b/server/conf/autoresponder.master index 0126c998d49f8177d28e147c1642a6e9fe4532c4..3e84b802f227d7ec7f765bb86c30c23fb8467ccd 100644 --- a/server/conf/autoresponder.master +++ b/server/conf/autoresponder.master @@ -4,7 +4,7 @@ if ($RETURNCODE==1) { if (!/^List-Unsubscribe:.*/:h ) { - if (!/^X-Spam-Flag: YES/:h ) + if (!/^(X-Spam-Flag: YES|X-Spam: Yes|Subject: \*\*\*\s*SPAM\s*\*\*\*.*)/:h ) { NOW=time if ({start_date} lt $NOW && {end_date} gt $NOW) @@ -20,4 +20,4 @@ if ($RETURNCODE==1) } } } -} \ No newline at end of file +} diff --git a/server/conf/bind_pri.domain.master b/server/conf/bind_pri.domain.master index 897ece496ce2be29203845cc37607697ac04527e..fb867901dc2848506db0790c5ce076e92d2326ab 100644 --- a/server/conf/bind_pri.domain.master +++ b/server/conf/bind_pri.domain.master @@ -61,3 +61,4 @@ $TTL {tmpl_var name='ttl'} + diff --git a/server/conf/hhvm_monit.master b/server/conf/hhvm_monit.master deleted file mode 100644 index 79697eae5874d6fcac9d8143dfea1e11eece10de..0000000000000000000000000000000000000000 --- a/server/conf/hhvm_monit.master +++ /dev/null @@ -1,3 +0,0 @@ -check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid - start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart" - stop program = "/etc/init.d/hhvm_{SYSTEM_USER} stop" \ No newline at end of file diff --git a/server/conf/hhvm_starter.master b/server/conf/hhvm_starter.master deleted file mode 100644 index e530a405a3a33ef667995fea22e0beead0691923..0000000000000000000000000000000000000000 --- a/server/conf/hhvm_starter.master +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# /etc/init.d/hhvm_{SYSTEM_USER} -# -### BEGIN INIT INFO -# Provides: hhvm_{SYSTEM_USER} -# Required-Start: $remote_fs $network -# Required-Stop: $remote_fs $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: Starts The HHVM FastCGI Daemon -### END INIT INFO -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="HHVM FastCGI Daemon" -NAME=hhvm - -do_start() -{ - if [ ! -d /var/run/hhvm ]; then - mkdir -p -m1777 /var/run/hhvm - else - chmod 1777 /var/run/hhvm - fi - - if [[ -e "/var/run/hhvm/hhvm_{SYSTEM_USER}.pid" ]] ; then - kill -0 `cat /var/run/hhvm/hhvm_{SYSTEM_USER}.pid` >/dev/null 2>&1 ; - case "$?" in - 0) - return 1 - ;; - esac - fi - - if [[ -S /var/run/mysqld/mysqld.sock && ! -S /tmp/mysql.sock ]] ; then - ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock ; - fi - - umask 027 - sudo -u {SYSTEM_USER} touch /var/run/hhvm/hhvm_{SYSTEM_USER}.pid - - BASEINIFILE="" - if [[ -e "/etc/hhvm/php.ini" ]] ; then - BASEINIFILE="--config /etc/hhvm/php.ini" ; - fi - - INIFILE="" - if [[ -e "/var/www/conf/{SYSTEM_USER}/php.ini" ]] ; then - INIFILE="--config /var/www/conf/{SYSTEM_USER}/php.ini" ; - elif [[ -e "/etc/php5/hhvm/php.ini" ]] ; then - INIFILE="--config /etc/php5/hhvm/php.ini" ; - elif [[ -e "/etc/php5/fpm/php.ini" ]] ; then - INIFILE="--config /etc/php5/fpm/php.ini" ; - elif [[ -e "/etc/php5/cgi/php.ini" ]] ; then - INIFILE="--config /etc/php5/cgi/php.ini" ; - fi - - CUSTOMINIFILE="" - if [[ -e "/etc/hhvm/{SYSTEM_USER}.ini" ]] ; then - CUSTOMINIFILE="--config /etc/hhvm/{SYSTEM_USER}.ini" ; - fi - - /usr/bin/hhvm --mode daemon -vServer.Type=fastcgi -vEval.PerfPidMap=false --user {SYSTEM_USER} -vServer.FileSocket=/var/run/hhvm/hhvm.{SYSTEM_USER}.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc -vServer.FixPathInfo=true $BASEINIFILE $INIFILE $CUSTOMINIFILE -vPidFile=/var/run/hhvm/hhvm_{SYSTEM_USER}.pid & echo $! > /var/run/hhvm/hhvm_{SYSTEM_USER}.pid -} - -do_stop() -{ - if [[ -e "/var/run/hhvm/hhvm_{SYSTEM_USER}.pid" ]] ; then - kill -SIGTERM `cat /var/run/hhvm/hhvm_{SYSTEM_USER}.pid` >/dev/null 2>&1 ; - fi - rm -f /var/run/hhvm/hhvm.{SYSTEM_USER}.sock /var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc /var/run/hhvm/hhvm_{SYSTEM_USER}.pid -} - -case "$1" in - start) - do_start - ;; - stop) - do_stop - ;; - restart|force-reload) - do_stop - case "$?" in - 0|1) - do_start - ;; - *) - ;; - esac - ;; - *) - exit 3 - ;; -esac - -: diff --git a/server/conf/index/standard_index.html_bg b/server/conf/index/standard_index.html_bg new file mode 100644 index 0000000000000000000000000000000000000000..4e303d88b59b05901c20d37076b867d960c8bafe --- /dev/null +++ b/server/conf/index/standard_index.html_bg @@ -0,0 +1,60 @@ + + + + Привет! + + + + + + +
+ +
+

Това е страницата по подразбиране за вашият уеб сайт.

+

Този файл може да бъде изтрит или презаписан с друг без никакъв проблем. Виждате съдържанието на файла index.html в web директорията.

+

Ако имате въпроси или проблеми може да се свържете с поддръжката.

+
+ +
+ + diff --git a/server/conf/mailfilter_move_junk.master b/server/conf/mailfilter_move_junk.master deleted file mode 100644 index ef346c922c9c8bd59591785e161f916547c385f9..0000000000000000000000000000000000000000 --- a/server/conf/mailfilter_move_junk.master +++ /dev/null @@ -1,19 +0,0 @@ - -SPAMDIR="Junk" -SPAMDIRFULL="$DEFAULT/.Junk" - -if ( /^X-Spam-Flag: YES$/ ) -{ - exception { - - `test -e $SPAMDIRFULL` - if ( $RETURNCODE != 0 ) - { - `maildirmake -f $SPAMDIR $DEFAULT` - `chown vmail:vmail -R $SPAMDIRFULL` - `chmod 0700 $SPAMDIRFULL` - `echo INBOX.$SPAMDIR >> $DEFAULT/courierimapsubscribed` - } - to "$SPAMDIRFULL/" - } -} \ No newline at end of file diff --git a/server/conf/mm_cfg.py.master b/server/conf/mm_cfg.py.master deleted file mode 100644 index 3dcf5a6a6156f50ce3feba2a3518d0ab40853a5d..0000000000000000000000000000000000000000 --- a/server/conf/mm_cfg.py.master +++ /dev/null @@ -1,108 +0,0 @@ -# -*- python -*- - -# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301 USA - - -"""This is the module which takes your site-specific settings. - -From a raw distribution it should be copied to mm_cfg.py. If you -already have an mm_cfg.py, be careful to add in only the new settings -you want. The complete set of distributed defaults, with annotation, -are in ./Defaults. In mm_cfg, override only those you want to -change, after the - - from Defaults import * - -line (see below). - -Note that these are just default settings - many can be overridden via the -admin and user interfaces on a per-list or per-user basis. - -Note also that some of the settings are resolved against the active list -setting by using the value as a format string against the -list-instance-object's dictionary - see the distributed value of -DEFAULT_MSG_FOOTER for an example.""" - - -####################################################### -# Here's where we get the distributed defaults. # - -from Defaults import * - -############################################################## -# Put YOUR site-specific configuration below, in mm_cfg.py . # -# See Defaults.py for explanations of the values. # - -#------------------------------------------------------------- -# The name of the list Mailman uses to send password reminders -# and similar. Don't change if you want mailman-owner to be -# a valid local part. -MAILMAN_SITE_LIST = 'mailman' - -#------------------------------------------------------------- -# If you change these, you have to configure your http server -# accordingly (Alias and ScriptAlias directives in most httpds) -DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/' -PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private' -IMAGE_LOGOS = '/images/mailman/' - -#------------------------------------------------------------- -# Default domain for email addresses of newly created MLs -DEFAULT_EMAIL_HOST = '{hostname}' -#------------------------------------------------------------- -# Default host for web interface of newly created MLs -DEFAULT_URL_HOST = '{hostname}' -#------------------------------------------------------------- -# Required when setting any of its arguments. -add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) - -#------------------------------------------------------------- -# The default language for this server. -DEFAULT_SERVER_LANGUAGE = {default_language} - -#------------------------------------------------------------- -# Iirc this was used in pre 2.1, leave it for now -USE_ENVELOPE_SENDER = 0 # Still used? - -#------------------------------------------------------------- -# Unset send_reminders on newly created lists -DEFAULT_SEND_REMINDERS = 0 - -#------------------------------------------------------------- -# Uncomment this if you configured your MTA such that it -# automatically recognizes newly created lists. -# (see /usr/share/doc/mailman/README.Exim4.Debian or -# /usr/share/mailman/postfix-to-mailman.py) -# MTA=None # Misnomer, suppresses alias output on newlist - -#------------------------------------------------------------- -# Uncomment if you use Postfix virtual domains (but not -# postfix-to-mailman.py), but be sure to see -# /usr/share/doc/mailman/README.Debian first. -MTA='Postfix' -POSTFIX_STYLE_VIRTUAL_DOMAINS = [{virtual_domains}] -#------------------------------------------------------------- -# Uncomment if you want to filter mail with SpamAssassin. For -# more information please visit this website: -# http://www.jamesh.id.au/articles/mailman-spamassassin/ -# GLOBAL_PIPELINE.insert(1, 'SpamAssassin') - -POSTFIX_MAP_CMD = '/etc/mailman/virtual_to_transport.sh' - -# Note - if you're looking for something that is imported from mm_cfg, but you -# didn't find it above, it's probably in /usr/lib/mailman/Mailman/Defaults.py. \ No newline at end of file diff --git a/server/conf/nginx_apps.vhost.master b/server/conf/nginx_apps.vhost.master index 75daa4df8f1692f48eacca62c217583473d9cbbf..d89faeaa92938c87a60206b0ca781233873d3f27 100644 --- a/server/conf/nginx_apps.vhost.master +++ b/server/conf/nginx_apps.vhost.master @@ -1,5 +1,13 @@ server { listen {apps_vhost_ip}{apps_vhost_port}; + listen [::]:{apps_vhost_port} ipv6only=on; + ssl {ssl_on}; + {ssl_comment}ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; + {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; + + # redirect to https if accessed with http + {ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri; server_name {apps_vhost_servername}; @@ -12,7 +20,7 @@ server { } # serve static files directly - location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { + location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { access_log off; } @@ -157,46 +165,28 @@ server { rewrite ^/* /squirrelmail last; } - location /cgi-bin/mailman { - root /usr/lib/; - fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS $https; - - # PHP only, required if PHP was built with --enable-force-cgi-redirect - fastcgi_param REDIRECT_STATUS 200; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - fastcgi_intercept_errors on; - fastcgi_pass unix:{cgi_socket}; - } - - location /images/mailman { - alias /usr/share/images/mailman; - } + {use_rspamd}location /rspamd/ { + {use_rspamd}proxy_pass http://127.0.0.1:11334/; + {use_rspamd}rewrite ^//(.*) /$1; + {use_rspamd}proxy_set_header X-Forwarded-Proto $scheme; + {use_rspamd}proxy_set_header Host $host; + {use_rspamd}proxy_set_header X-Real-IP $remote_addr; + {use_rspamd}proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + {use_rspamd}proxy_pass_header Authorization; + {use_rspamd}client_max_body_size 0; + {use_rspamd}client_body_buffer_size 1m; + {use_rspamd}proxy_intercept_errors on; + {use_rspamd}proxy_buffering on; + {use_rspamd}proxy_buffer_size 128k; + {use_rspamd}proxy_buffers 256 16k; + {use_rspamd}proxy_busy_buffers_size 256k; + {use_rspamd}proxy_temp_file_write_size 256k; + {use_rspamd}proxy_max_temp_file_size 0; + {use_rspamd}proxy_read_timeout 300; + {use_rspamd} + {use_rspamd}location ~* ^/rspamd/(.+\.(jpg|jpeg|gif|css|png|js|ico|html?|xml|txt))$ { + {use_rspamd}alias /usr/share/rspamd/www/$1; + {use_rspamd}} + {use_rspamd}} - location /pipermail { - alias /var/lib/mailman/archives/public; - autoindex on; - } } diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master index 4f9178698b9b9529801361b17312e4a3f7577d46..bc09c4293751e3897d8c9e8188b0eb68d0884ed9 100644 --- a/server/conf/nginx_vhost.conf.master +++ b/server/conf/nginx_vhost.conf.master @@ -29,7 +29,7 @@ server { listen : ssl{tmpl_if name='enable_http2' op='==' value='y'} http2{/tmpl_if}{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - # ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; + # ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; # ssl_prefer_server_ciphers on; listen []: ssl{tmpl_if name='enable_http2' op='==' value='y'} http2{/tmpl_if}{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if}; @@ -201,44 +201,9 @@ server { fastcgi_intercept_errors on; }
- - location @php { - try_files $uri =404; - include /etc/nginx/fastcgi_params; - fastcgi_pass unix:/var/run/hhvm/hhvm..sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - #fastcgi_param PATH_INFO $fastcgi_script_name; - - fastcgi_param SERVER_NAME ; - - fastcgi_intercept_errors on; - error_page 500 501 502 503 = @phpfallback; - } - - location @phpfallback { - try_files $uri =404; - include /etc/nginx/fastcgi_params; - - fastcgi_pass 127.0.0.1:; - - - fastcgi_pass unix:; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - #fastcgi_param PATH_INFO $fastcgi_script_name; - - fastcgi_param SERVER_NAME ; - - fastcgi_intercept_errors on; - } - - location @php { deny all; } - diff --git a/server/conf/rspamd_users.inc.conf.master b/server/conf/rspamd_users.inc.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..1fe08439a7db24e6403302123d1a7d63b5592689 --- /dev/null +++ b/server/conf/rspamd_users.inc.conf.master @@ -0,0 +1,41 @@ +spamfilter_users- { + priority = ; + rcpt = ""; + + want_spam = yes; + + + apply "default" { + CLAM_VIRUS = 1999.0; + JUST_EICAR = 1999.0; + actions { + reject = 999.0; + } + } + + + apply "default" { + CLAM_VIRUS = -999.0; + JUST_EICAR = -999.0; + actions { + greylist = ; + + = ; + reject = ; + } + } + + + apply "default" { + CLAM_VIRUS = ; + JUST_EICAR = ; + actions { + greylist = ; + + = ; + reject = ; + } + } + + +} \ No newline at end of file diff --git a/server/conf/rspamd_worker-controller.inc.master b/server/conf/rspamd_worker-controller.inc.master new file mode 100644 index 0000000000000000000000000000000000000000..75b744c88380c3ce63394caaadf79653e0fa8815 --- /dev/null +++ b/server/conf/rspamd_worker-controller.inc.master @@ -0,0 +1,8 @@ +# Included from top-level .conf file + +type = "controller"; +count = 1; +password = ""; +secure_ip = "127.0.0.1"; +secure_ip = "::1"; +static_dir = "${WWWDIR}"; \ No newline at end of file diff --git a/server/conf/sieve_filter.master b/server/conf/sieve_filter.master index bfd75c4d43e6279ecba65701c7151ccade11fa79..13c08dd56b18987573c18fd1fe1aee432db17e44 100644 --- a/server/conf/sieve_filter.master +++ b/server/conf/sieve_filter.master @@ -1,4 +1,4 @@ -require ["fileinto", "regex", "vacation", "imap4flags", "envelope", "subaddress"]; +require ["fileinto", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress", "copy", "reject"]; # Send a copy of email to @@ -9,7 +9,7 @@ redirect ""; # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; @@ -26,7 +26,7 @@ keep; ################################################################# # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; diff --git a/server/conf/sieve_filter_1.2.master b/server/conf/sieve_filter_1.2.master index 8a1c80713fb7fafda8fbed675e2a7f1183aaff23..5244693102ce0778964ce2e25b61c377b1b2bf8a 100644 --- a/server/conf/sieve_filter_1.2.master +++ b/server/conf/sieve_filter_1.2.master @@ -1,8 +1,8 @@ -require ["fileinto", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress"]; +require ["fileinto", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress", "copy", "reject"]; # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; @@ -26,7 +26,7 @@ keep; ################################################################# # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { # Stop here so that we do not reply on spams stop; } diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master index b3ed93960fd8bea1402dcc2eec0397e030e80656..7d129e559627abf3e14cc3a86d9fb6ee814488a9 100644 --- a/server/conf/vhost.conf.master +++ b/server/conf/vhost.conf.master @@ -2,12 +2,7 @@ AllowOverride None - Require all denied - - Order Deny,Allow - Deny from all - @@ -19,22 +14,10 @@ - - DocumentRoot + +DocumentRoot - - DocumentRoot - - - DocumentRoot - - - DocumentRoot - - DocumentRoot - - - +DocumentRoot ServerName @@ -47,7 +30,7 @@ Protocols h2 http/1.1 SSLProtocol All -SSLv2 -SSLv3 - SSLCipherSuite 'EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS' + SSLCipherSuite 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS' @@ -74,7 +57,7 @@ SSLEngine on SSLProtocol All -SSLv2 -SSLv3 - # SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS + # SSLCipherSuite TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS SSLHonorCipherOrder on # # Header always add Strict-Transport-Security "max-age=15768000" @@ -101,12 +84,7 @@ Options +FollowSymLinks AllowOverride - Require all granted - - Order allow,deny - Allow from all - # ssi enabled @@ -116,13 +94,7 @@ - Require all denied - - Order allow,deny - Deny from all - Allow from none - @@ -133,12 +105,7 @@ Options +FollowSymLinks AllowOverride - Require all granted - - Order allow,deny - Allow from all - # ssi enabled @@ -148,13 +115,7 @@ - Require all denied - - Order allow,deny - Deny from all - Allow from none - @@ -221,12 +182,7 @@ # cgi enabled - Require all granted - - Order allow,deny - Allow from all - ScriptAlias /cgi-bin/ /cgi-bin/ @@ -253,50 +209,10 @@ php_admin_value open_basedir - - # suphp enabled - - - suPHP_Engine on - # suPHP_UserGroup - - suPHP_ConfigPath - - - SetHandler x-httpd-suphp - - suPHP_AddHandler x-httpd-suphp - - - - - # php as cgi enabled - ScriptAlias /php-cgi - Action php-cgi /php-cgi - - - SetHandler php-cgi - - - - - SetHandler php-cgi - - - - - Require all granted - - Order allow,deny - Allow from all - - - # php as fast-cgi enabled # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html - FcgidIdleTimeout 300 FcgidProcessLifeTime 3600 # FcgidMaxProcesses 1000 @@ -307,16 +223,6 @@ FcgidIOTimeout 600 FcgidBusyTimeout 3600 FcgidMaxRequestLen 1073741824 - - IdleTimeout 300 - ProcessLifeTime 3600 - # MaxProcessCount 1000 - DefaultMinClassProcessCount 0 - DefaultMaxClassProcessCount 10 - IPCConnectTimeout 3 - IPCCommTimeout 600 - BusyTimeout 3600 - @@ -328,12 +234,7 @@ FCGIWrapper .php5 Options +ExecCGI AllowOverride - Require all granted - - Order allow,deny - Allow from all - @@ -345,44 +246,26 @@ FCGIWrapper .php5 Options +ExecCGI AllowOverride - Require all granted - - Order allow,deny - Allow from all - - Require all granted - - Order allow,deny - Allow from all - - - - SetHandler php-fcgi - - - SetHandler php-fcgi - + + SetHandler php-fcgi + - - - SetHandler php-fcgi - - - SetHandler php-fcgi - + + SetHandler php-fcgi + Action php-fcgi /php-fcgi virtual @@ -399,13 +282,9 @@ #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:/$1 - - - SetHandler "proxy:fcgi://127.0.0.1:" - - - SetHandler "proxy:fcgi://127.0.0.1:" - + + SetHandler "proxy:fcgi://127.0.0.1:" + @@ -413,111 +292,36 @@ #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix://|fcgi://localhost//$1 - - - SetHandler "proxy:unix:|fcgi://localhost" - - - SetHandler "proxy:unix:|fcgi://localhost" - + + SetHandler "proxy:unix:|fcgi://localhost" + - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - SetHandler hhvm-fcgi - - - SetHandler hhvm-fcgi - - - - - SetHandler hhvm-fcgi - - - SetHandler hhvm-fcgi - - - Action hhvm-fcgi /hhvm-fcgi virtual - Alias /hhvm-fcgi {tmpl_var name='document_root'}/cgi-bin/hhvm-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} - FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/hhvm-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket /var/run/hhvm/hhvm..sock -pass-header Authorization -pass-header Content-Type - - - - - Require all granted - - Order allow,deny - Allow from all - - - - - SetHandler "proxy:unix:/var/run/hhvm/hhvm..sock|fcgi://localhost" - - - SetHandler "proxy:unix:/var/run/hhvm/hhvm..sock|fcgi://localhost" - - - - - SetHandler "proxy:unix:/var/run/hhvm/hhvm..sock|fcgi://localhost" - - - SetHandler "proxy:unix:/var/run/hhvm/hhvm..sock|fcgi://localhost" - - - - - RewriteEngine on - RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/ RewriteRule ^ - [END] - RewriteCond %{HTTPS} off - RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ - RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} ^$ [NC] - - RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ - RewriteRule ^ https://%{REQUEST_URI} [R=301,NE,L] RewriteCond %{HTTP_HOST} ^$ [NC] - - RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ - RewriteRule ^ https://%{REQUEST_URI} [R=301,NE,L] RewriteCond %{HTTP_HOST} $ [NC] - - RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ - RewriteCond %{REQUEST_URI} !^/webdav/ RewriteCond %{REQUEST_URI} !^/php-fcgi/ @@ -530,8 +334,6 @@ RewriteCond %{HTTPS} off - RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ - RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] diff --git a/server/conf/xmpp_conf_ssl.master b/server/conf/xmpp_conf_ssl.master deleted file mode 100644 index 73ab3a8a3580313f9879c5e50ccd6a01c6e71547..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_conf_ssl.master +++ /dev/null @@ -1,72 +0,0 @@ -oid_section = new_oids - -[ new_oids ] - -# RFC 3920 section 5.1.1 defines this OID -xmppAddr = 1.3.6.1.5.5.7.8.5 - -# RFC 4985 defines this OID -SRVName = 1.3.6.1.5.5.7.8.7 - -[ req ] - -default_bits = 4096 -default_keyfile = {tmpl_var name='domain'}.key -distinguished_name = distinguished_name -req_extensions = v3_extensions -x509_extensions = v3_extensions - -# ask about the DN? -prompt = no - -[ distinguished_name ] - -commonName = {tmpl_var name='domain'} -countryName = {tmpl_var name='ssl_country'} -localityName = {tmpl_var name='ssl_locality'} -organizationName = {tmpl_var name='ssl_organisation'} -organizationalUnitName = {tmpl_var name='ssl_organisation_unit'} -emailAddress = {tmpl_var name='ssl_email'} - -[ v3_extensions ] - -# for certificate requests (req_extensions) -# and self-signed certificates (x509_extensions) - -basicConstraints = CA:FALSE -keyUsage = digitalSignature,keyEncipherment -extendedKeyUsage = serverAuth,clientAuth -subjectAltName = @subject_alternative_name - -[ subject_alternative_name ] - -# See http://tools.ietf.org/html/draft-ietf-xmpp-3920bis#section-13.7.1.2 for more info. - -DNS.0 = {tmpl_var name='domain'} -otherName.0 = xmppAddr;FORMAT:UTF8,UTF8:{tmpl_var name='domain'} -otherName.1 = SRVName;IA5STRING:_xmpp-client.{tmpl_var name='domain'} -otherName.2 = SRVName;IA5STRING:_xmpp-server.{tmpl_var name='domain'} - -DNS.1 = muc.{tmpl_var name='domain'} -otherName.3 = xmppAddr;FORMAT:UTF8,UTF8:muc.{tmpl_var name='domain'} -otherName.4 = SRVName;IA5STRING:_xmpp-server.muc.{tmpl_var name='domain'} - -DNS.2 = pubsub.{tmpl_var name='domain'} -otherName.5 = xmppAddr;FORMAT:UTF8,UTF8:pubsub.{tmpl_var name='domain'} -otherName.6 = SRVName;IA5STRING:_xmpp-server.pubsub.{tmpl_var name='domain'} - -DNS.3 = anon.{tmpl_var name='domain'} -otherName.7 = xmppAddr;FORMAT:UTF8,UTF8:anon.{tmpl_var name='domain'} -otherName.8 = SRVName;IA5STRING:_xmpp-server.anon.{tmpl_var name='domain'} - -DNS.4 = xmpp.{tmpl_var name='domain'} -otherName.9 = xmppAddr;FORMAT:UTF8,UTF8:xmpp.{tmpl_var name='domain'} -otherName.10= SRVName;IA5STRING:_xmpp-server.xmpp.{tmpl_var name='domain'} - -DNS.5 = proxy.{tmpl_var name='domain'} -otherName.11= xmppAddr;FORMAT:UTF8,UTF8:proxy.{tmpl_var name='domain'} -otherName.12= SRVName;IA5STRING:_xmpp-server.proxy.{tmpl_var name='domain'} - -DNS.6 = vjud.{tmpl_var name='domain'} -otherName.13= xmppAddr;FORMAT:UTF8,UTF8:vjud.{tmpl_var name='domain'} -otherName.14= SRVName;IA5STRING:_xmpp-server.vjud.{tmpl_var name='domain'} \ No newline at end of file diff --git a/server/conf/xmpp_metronome_conf_global.master b/server/conf/xmpp_metronome_conf_global.master deleted file mode 100644 index 71920caea101408f7c1cf8f0e77f2bf5a7c89763..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_metronome_conf_global.master +++ /dev/null @@ -1,48 +0,0 @@ -pidfile = "/var/run/metronome/metronome.pid"; -metronome_max_files_soft = 200000; -metronome_max_files_hard = 300000; -plugin_paths = { - "/usr/lib/metronome/isp-modules", -}; -use_libevent = true; -log = { - debug = "/var/log/metronome/metronome.dbg", - info = "/var/log/metronome/metronome.log", - error = "/var/log/metronome/metronome.err", -}; -use_ipv6 = {tmpl_var name='ipv6'}; -http_ports = { - {tmpl_var name='port_http'}, -}; -https_ports = { - {tmpl_var name='port_https'}, -}; -pastebin_ports = { - {tmpl_var name='port_pastebin'}, -}; -bosh_ports = { - {tmpl_var name='port_bosh'}, -}; -admins = { -{tmpl_var name='server_admins'} -}; -modules_enabled = { -{tmpl_var name='modules_enabled'} -}; -modules_disabled = { -}; -bosh_max_inactivity = {tmpl_var name='bosh_timeout'}; -consider_bosh_secure = true; -cross_domain_bosh = true; -allow_registration = true; --- TODO generate ssl key during setup -ssl = { - key = "/etc/metronome/certs/localhost.key", - certificate = "/etc/metronome/certs/localhost.cert", -}; -c2s_require_encryption = false; -s2s_secure = true; -s2s_insecure_domains = { - "gmail.com", -}; -authentication = "internal_plain"; \ No newline at end of file diff --git a/server/conf/xmpp_metronome_conf_host.master b/server/conf/xmpp_metronome_conf_host.master deleted file mode 100644 index 3dea69257bc8cc2b637570196500ff64df24f1ea..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_metronome_conf_host.master +++ /dev/null @@ -1,135 +0,0 @@ -VirtualHost "{tmpl_var name='domain'}" - enabled = {tmpl_var name='active'}; - authentication = "external"; - external_auth_command = "/usr/lib/metronome/isp-modules/mod_auth_external/authenticate_isp.sh"; - allow_registration = {tmpl_var name='public_registration'}; - - registration_url = "{tmpl_var name='registration_url'}"; - registration_text = "{tmpl_var name='registration_message'}"; - - no_registration_whitelist = true; - - modules_enabled = { - "roster", - "private", - "vcard", - "privacy", - "pep", - - "register", - - "register_redirect", - - "admin_adhoc", - }; - disco_items = { - - { - "muc.{tmpl_var name='domain'}", - "{tmpl_var name='muc_name'}", - }, - - - { - "pubsub.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} Publish/Subscribe", - }, - - - { - "proxy.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} Bytestream Proxy", - }, - - - { - "vjud.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} User Directory", - }, - - }; - - admins = { -{tmpl_var name='domain_admins'} - }; - - ssl = { - key = "/etc/metronome/certs/{tmpl_var name='domain'}.key", - certificate = "/etc/metronome/certs/{tmpl_var name='domain'}.cert", - }; - - - -VirtualHost "anon.{tmpl_var name='domain'}" - enabled = true; - authentication = "anonymous"; - allow_anonymous_multiresourcing = true; - anonymous_jid_gentoken = "{tmpl_var name='domain'} Anonymous User"; - admins = { - }; - - - - -Component "muc.{tmpl_var name='domain'}" "muc" - modules_enabled = { - "muc_limits", - "muc_log", - - "muc_log_http", - - - "pastebin", - - }; - muc_event_rate = 0.7; - muc_burst_factor = 13; - muc_log_presences = false; - - muc_log_http_config = { - show_join = {tmpl_var name='archive_join'}, - show_status = {tmpl_var name='archive_status'}, - theme = "metronome", - url_base = "logs", - }; - - - pastebin_path = "/pastes/"; - pastebin_expire_after = {tmpl_var name='pastebin_expire'}; - pastebin_trigger = "{tmpl_var name='pastebin_trigger'}"; - - name = "{tmpl_var name='muc_name'}"; - restrict_room_creation = "{tmpl_var name='muc_restrict_room_creation'}"; - admins = { -{tmpl_var name='muc_admins'} - }; - - - - -Component "pubsub.{tmpl_var name='domain'}" "pubsub" - name = "{tmpl_var name='domain'} Publish/Subscribe"; - unrestricted_node_creation = false; - - - -Component "proxy.{tmpl_var name='domain'}" "proxy65" - proxy65_acl = { - "{tmpl_var name='domain'}", - }; - proxy65_interfaces = { - "*", - "::", - }; - proxy65_ports = { - 5000, - }; - - - - -Component "vjud.{tmpl_var name='domain'}" "vjud" - ud_disco_name = "{tmpl_var name='domain'} User Directory"; - synchronize_to_host_vcards = "{tmpl_var name='domain'}"; - vjud_mode = "{tmpl_var name='vjud_opt_mode'}"; - \ No newline at end of file diff --git a/server/conf/xmpp_metronome_conf_status.master b/server/conf/xmpp_metronome_conf_status.master deleted file mode 100644 index daa82054915da514e053059180ff4da34a5b929e..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_metronome_conf_status.master +++ /dev/null @@ -1,12 +0,0 @@ -Component "xmpp.{tmpl_var name='domain'}" "http" - modules_enabled = { - "server_status", - "webpresence" - }; - server_status_basepath = "/xmppd/"; - server_status_show_hosts = { -{tmpl_var name='status_hosts'} - }; - server_status_show_comps = { -{tmpl_var name='status_comps'} - }; \ No newline at end of file diff --git a/server/conf/xmpp_prosody_conf_global.master b/server/conf/xmpp_prosody_conf_global.master deleted file mode 100644 index ded6f753c6964f9c1056c190d785572dc157d596..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_prosody_conf_global.master +++ /dev/null @@ -1,60 +0,0 @@ -plugin_paths = { - "/usr/local/lib/prosody/modules", -}; -use_libevent = true; -log = { - -- optional: uncomment debug log here - -- debug = "/var/log/prosody/prosody.dbg", - info = "/var/log/prosody/prosody.log", - error = "/var/log/prosody/prosody.err", - "syslog", -}; -use_ipv6 = {tmpl_var name='ipv6'}; -http_ports = { - {tmpl_var name='port_http'}, -}; -https_ports = { - {tmpl_var name='port_https'}, -}; -pastebin_ports = { - {tmpl_var name='port_pastebin'}, -}; -bosh_ports = { - {tmpl_var name='port_bosh'}, -}; -admins = { -{tmpl_var name='server_admins'} -}; -modules_enabled = { -{tmpl_var name='modules_enabled'} -}; -modules_disabled = { -}; - -allow_registration = false; -c2s_require_encryption = false; -s2s_require_encryption = true; -s2s_secure_auth = false; -s2s_insecure_domains = { - "gmail.com", -}; - -pidfile = "/var/run/prosody/prosody.pid"; - -authentication = "external"; - -archive_expires_after = "2w"; - -statistics = "internal"; - -certificates = "certs"; -bosh_max_inactivity = {tmpl_var name='bosh_timeout'}; -consider_bosh_secure = true; -cross_domain_bosh = true; -consider_websocket_secure = true; - -ssl = { - key = "/etc/prosody/certs/localhost.key", - certificate = "/etc/prosody/certs/localhost.crt", -}; - diff --git a/server/conf/xmpp_prosody_conf_host.master b/server/conf/xmpp_prosody_conf_host.master deleted file mode 100644 index b45e955eb4a1e8f307787a2bb8e3f855f359ec81..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_prosody_conf_host.master +++ /dev/null @@ -1,166 +0,0 @@ -VirtualHost "{tmpl_var name='domain'}" - enabled = {tmpl_var name='active'}; - authentication = "external"; - external_auth_command = "/usr/local/lib/prosody/auth/authenticate_isp.sh"; - allow_registration = {tmpl_var name='public_registration'}; - - registration_url = "{tmpl_var name='registration_url'}"; - - - registration_text = "{tmpl_var name='registration_message'}"; - - no_registration_whitelist = true; - - modules_enabled = { - "roster", - "private", - "vcard", - "blocklist", - "pep", - - "register", - - "register_redirect", - - "admin_adhoc", - "http", - - "server_status", - - - "webpresence" - - }; - disco_items = { - { - "{tmpl_var main_host}", - "HTTP File Upload", - }, - - { - "muc.{tmpl_var name='domain'}", - "{tmpl_var name='muc_name'}", - }, - - - { - "pubsub.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} Publish/Subscribe", - }, - - - { - "proxy.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} Bytestream Proxy", - }, - - - { - "vjud.{tmpl_var name='domain'}", - "{tmpl_var name='domain'} User Directory", - }, - - }; - admins = { -{tmpl_var name='domain_admins'} - }; - - ssl = { - key = "/etc/prosody/certs/{tmpl_var name='domain'}.key", - certificate = "/etc/prosody/certs/{tmpl_var name='domain'}.crt", - }; - - - http_host = 'xmpp.{tmpl_var name='domain'}'; - - server_status_basepath = "/xmppd/"; - server_status_json = true; - server_status_shown_hosts = { - "{tmpl_var name='domain'}", - - "anon.fuermann.net", - - }; - server_status_shown_comps = { - - "pubsub.{tmpl_var name='domain'}", - - - "proxy.{tmpl_var name='domain'}", - - - "vjud.{tmpl_var name='domain'}", - - - "muc.{tmpl_var name='domain'}", - - } - - - -Component "muc.{tmpl_var name='domain'}" "muc" - modules_enabled = { - "muc_limits", - "muc_log", - - "muc_log_http", - - - "pastebin", - - }; - muc_event_rate = 0.5; - muc_burst_factor = 8; - muc_log_presences = false; - - muc_log_http = { - show_join = {tmpl_var name='archive_join'}, - show_presence = {tmpl_var name='archive_join'}, - show_status = {tmpl_var name='archive_status'}, - theme = "prosody", - url_base = "logs", - }; - - - pastebin_threshold = 500; - pastebin_line_threshold = 4; - pastebin_expire_after = {tmpl_var name='pastebin_expire'}; - pastebin_trigger = "{tmpl_var name='pastebin_trigger'}"; - - name = "{tmpl_var name='muc_name'}"; - restrict_room_creation = "{tmpl_var name='muc_restrict_room_creation'}"; - max_history_messages = 20; - admins = { -{tmpl_var name='muc_admins'} - }; - - - - -Component "pubsub.{tmpl_var name='domain'}" "pubsub" - name = "{tmpl_var name='domain'} Publish/Subscribe"; - - - -Component "proxy.{tmpl_var name='domain'}" "proxy65" - proxy65_acl = { - "{tmpl_var name='domain'}", - }; - - - - -Component "vjud.{tmpl_var name='domain'}" "vjud" - ud_disco_name = "{tmpl_var name='domain'} User Directory"; - vjud_mode = "{tmpl_var name='vjud_opt_mode'}"; - - - -VirtualHost "anon.{tmpl_var name='domain'}" - enabled = true; - authentication = "anonymous"; - allow_anonymous_multiresourcing = true; - anonymous_jid_gentoken = "{tmpl_var name='domain'} Anonymous User"; - admins = { - }; - diff --git a/server/conf/xmpp_prosody_conf_status.master b/server/conf/xmpp_prosody_conf_status.master deleted file mode 100644 index 298ec88e92722ad3e07df72a673cabea76e641b7..0000000000000000000000000000000000000000 --- a/server/conf/xmpp_prosody_conf_status.master +++ /dev/null @@ -1,20 +0,0 @@ -Component "xmpp.{tmpl_var name='domain'}" "http" - modules_enabled = { - - "server_status", - - - "webpresence", - - }; - - - server_status_basepath = "/xmppd/"; - server_status_json = true; - server_status_show_hosts = { -{tmpl_var name='status_hosts'} - }; - server_status_show_comps = { -{tmpl_var name='status_comps'} - }; - \ No newline at end of file diff --git a/server/cron.php b/server/cron.php index 261abd983bc290d7b5f0821876d9f2fb2ae72711..db9c29d650e830b84ad1af4e8767c5d1323ade50 100644 --- a/server/cron.php +++ b/server/cron.php @@ -32,12 +32,21 @@ define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"])); require SCRIPT_PATH."/lib/config.inc.php"; // Check whether another instance of this script is already running -if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock')) { +$lockFile = $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock'; +if (is_file($lockFile)) { clearstatcache(); - $pid = trim(file_get_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock')); + + // Maybe we hit a deadlock and the lock file is no longer relevant + if(filemtime($lockFile) > time() - 86400) { // 86400 seconds = 1 day + if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - The cron lock file is older than one day.' . "\n"; + exit; + } + + // Check if the process id we have in the lock file is still present + $pid = trim(file_get_contents($lockFile)); if(preg_match('/^[0-9]+$/', $pid)) { if(file_exists('/proc/' . $pid)) { - if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already an instance of server.php running with pid ' . $pid . '.' . "\n"; + if($conf['log_priority'] <= LOGLEVEL_WARN) print @date('d.m.Y-H:i').' - WARNING - There is already an instance of cron.php running with pid ' . $pid . '.' . "\n"; exit; } } @@ -45,7 +54,7 @@ if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock')) { } // Set Lockfile -@file_put_contents($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', getmypid()); +@file_put_contents($lockFile, getmypid()); if($conf['log_priority'] <= LOGLEVEL_DEBUG) print 'Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock' . "\n"; diff --git a/server/cron.sh b/server/cron.sh index 58ddc67ff253394e2ec0608248b15d9f6bd581ed..9af7369775e12d0a3e4d9c4f39a4673efdf8896f 100644 --- a/server/cron.sh +++ b/server/cron.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php index ce2a5484fcf5efc8671727a954d5897259b8fa2a..59bf8b9ebc10623512779d5d0e7eef47fd6f8664 100644 --- a/server/lib/app.inc.php +++ b/server/lib/app.inc.php @@ -43,7 +43,11 @@ class app { if($conf['start_db'] == true) { $this->load('db_'.$conf['db_type']); - $this->db = new db; + try { + $this->db = new db; + } catch (Exception $e) { + $this->db = false; + } /* Initialize the connection to the master DB, @@ -51,7 +55,11 @@ class app { */ if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) { - $this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database'], $conf['dbmaster_port'], $conf['dbmaster_client_flags']); + try { + $this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database'], $conf['dbmaster_port'], $conf['dbmaster_client_flags']); + } catch (Exception $e) { + $this->dbmaster = false; + } } else { $this->dbmaster = $this->db; } @@ -61,6 +69,14 @@ class app { } + public function __get($prop) { + if(property_exists($this, $prop)) return $this->{$prop}; + + $this->uses($prop); + if(property_exists($this, $prop)) return $this->{$prop}; + else return null; + } + function setCaller($caller) { $this->_calling_script = $caller; } diff --git a/server/lib/classes/addon_installer.inc.php b/server/lib/classes/addon_installer.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..3a108e8bbb2f128883ec03c97cbc54c5589bd760 --- /dev/null +++ b/server/lib/classes/addon_installer.inc.php @@ -0,0 +1,228 @@ +log('Extracting addon package ' . $package_file, 0, false); + + $cmd = 'which unzip'; + $tmp = explode("\n", exec($cmd, $ret, $retval)); + if($retval != 0) { + $app->log('The unzip command was not found on the server.', 2, false); + throw new AddonInstallerException('unzip tool not found.'); + } + $unzip = reset($tmp); + unset($tmp); + if(!$unzip) { + $app->log('Unzip tool was not found.', 2, false); + throw new AddonInstallerException('unzip tool not found.'); + } + + $temp_dir = $app->system->tempdir(sys_get_temp_dir(), 'addon_', 0700); + if(!$temp_dir) { + $app->log('Could not create the temp dir.', 2, false); + throw new AddonInstallerException('Could not create temp dir.'); + } + + $ret = null; + $retval = 0; + $cmd = $unzip . ' -d ' . escapeshellarg($temp_dir) . ' ' . escapeshellarg($package_file); + exec($cmd, $ret, $retval); + if($retval != 0) { + $app->log('Package extraction failed.', 2, false); + throw new AddonInstallerException('Package extraction failed.'); + } + + $app->log('Extracted to ' . $temp_dir, 0, false); + + return $temp_dir; + } + + /** + * @param string $path + * @return string + * @throws AddonInstallerValidationException + */ + private function validatePackage($path) { + global $app; + + $app->log('Validating extracted addon at ' . $path, 0, false); + + if(!is_dir($path)) { + $app->log('Invalid path.', 2, false); + throw new AddonInstallerValidationException('Invalid path.'); + } + + $ini_file = $path . '/addon.ini'; + if(!is_file($ini_file)) { + $app->log('Addon ini file missing.', 2, false); + throw new AddonInstallerValidationException('Addon ini file missing.'); + } + + $app->log('Parsing ini ' . $ini_file, 0, false); + $ini = parse_ini_file($ini_file, true); + if(!$ini || !isset($ini['addon'])) { + $app->log('Ini file could not be read.', 2, false); + throw new AddonInstallerValidationException('Ini file is missing addon section.'); + } + + $addon = $ini['addon']; + if(!isset($addon['ident']) || !isset($addon['name']) || !isset($addon['version'])) { + $app->log('Addon data in ini file missing or invalid.', 2, false); + throw new AddonInstallerValidationException('Ini file is missing addon ident/name/version.'); + } + + $class_file = $path . '/' . $addon['ident'] . '.addon.php'; + if(!is_file($class_file)) { + $app->log('Base class file in addon not found', 2, false); + throw new AddonInstallerValidationException('Package is missing main addon class.'); + } + + if(isset($ini['ispconfig']['version.min']) && $ini['ispconfig']['version.min'] && version_compare($ini['ispconfig']['version.min'], ISPC_APP_VERSION, '>')) { + $app->log('ISPConfig version too low for this addon.', 2, false); + throw new AddonInstallerValidationException('Addon requires at least ISPConfig version ' . $ini['ispconfig']['version.min'] . '.'); + } elseif(isset($ini['ispconfig']['version.max']) && $ini['ispconfig']['version.max'] && version_compare($ini['ispconfig']['version.min'], ISPC_APP_VERSION, '<')) { + $app->log('ISPConfig version too high for this addon.', 2, false); + throw new AddonInstallerValidationException('Addon allows at max ISPConfig version ' . $ini['ispconfig']['version.max'] . '.'); + } + + $app->log('Loaded addon installer ' . $class_file, 0, false); + + $addon['class_file'] = $class_file; + $addon['class_name'] = substr(basename($class_file), 0, -10) . '_addon_installer'; + + return $addon; + } + + private function getInstalledAddonVersion($ident) { + global $app, $conf; + + $file_version = false; + $db_version = false; + + $addon_path = realpath($conf['rootpath'] . '/..') . '/addons'; + // check for previous version + if(is_dir($addon_path . '/' . $ident) && is_file($addon_path . '/' . $ident . '/addon.ini')) { + $addon = parse_ini_file($addon_path . '/' . $ident . '/addon.ini', true); + if($addon && isset($addon['addon'])) { + $addon = $addon['addon']; // ini section + } else { + $addon = false; + } + if(!$addon || !isset($addon['version']) || !isset($addon['ident']) || $addon['ident'] != $ident) { + $app->log('Could not get version of installed addon.', 2, false); + throw new AddonInstallerException('Installed app ' . $ident . ' found but it is invalid.'); + } + + $file_version = $addon['version']; + $app->log('Installed version of addon ' . $ident . ' is ' . $file_version, 0, false); + } + + $check = $app->db->queryOneRecord('SELECT `addon_version` FROM `addons` WHERE `addon_ident` = ?', $ident); + if($check && $check['addon_version']) { + $db_version = $check['addon_version']; + $app->log('Installed version of addon ' . $ident . ' (in db) is ' . $db_version . '.', 0, false); + } + + if(!$file_version && !$db_version) { + return false; + } elseif($file_version != $db_version) { + $app->log('Version mismatch between ini file and database (' . $file_version . ' != ' . $db_version . ').', 0, false); + throw new AddonInstallerException('Addon version mismatch in database (' . $db_version . ') and file system (' . $file_version . ').'); + } + + return $file_version; + + } + + /** + * @param string $package_file Full path + * @param boolean $force true if previous addon with same or higher version should be overwritten + * @throws AddonInstallerException + * @throws AddonInstallerValidationException + */ + public function installAddon($package_file, $force = false) { + global $app; + + $app->load('ispconfig_addon_installer_base'); + + if(!is_file($package_file)) { + $app->log('Package file not found: ' . $package_file, 2, false); + throw new AddonInstallerException('Package file not found.'); + } elseif(substr($package_file, -4) !== '.pkg') { + $app->log('Invalid package file: ' . $package_file, 2, false); + throw new AddonInstallerException('Invalid package file.'); + } + + $tmp_dir = $this->extractPackage($package_file); + if(!$tmp_dir) { + // extracting failed + $app->log('Package extraction failed.', 2, false); + throw new AddonInstallerException('Package extraction failed.'); + } + + $addon = $this->validatePackage($tmp_dir); + if(!$addon) { + throw new AddonInstallerException('Package validation failed.'); + } + $app->log('Package validated.', 0, false); + + $is_update = false; + $previous = $this->getInstalledAddonVersion($addon['ident']); + if($previous !== false) { + // this is an update + if(version_compare($previous, $addon['version'], '>') && $force !== true) { + $app->log('Installed version is newer than the one to install and --force not used.', 2, false); + throw new AddonInstallerException('Installed version is newer than the one to install.'); + } elseif(version_compare($previous, $addon['version'], '=') && $force !== true) { + $app->log('Installed version is the same as the one to install and --force not used.', 2, false); + throw new AddonInstallerException('Installed version is the same as the one to install.'); + } + $is_update = true; + } + + $app->log('Including package class file ' . $addon['class_file'], 0, false); + + include $addon['class_file']; + $class_name = $addon['class_name']; + if(!class_exists($class_name)) { + $app->log('Class name ' . $class_name . ' not found in class file ' . $addon['class_file'], 2, false); + throw new AddonInstallerException('Could not find main class in addon file.'); + } + + /* @var $inst ispconfig_addon_installer_base */ + $app->log('Instanciating installer class ' . $class_name, 0, false); + + $inst = new $class_name(); + $inst->setAddonName($addon['name']); + $inst->setAddonIdent($addon['ident']); + $inst->setAddonVersion($addon['version']); + $inst->setAddonTempDir($tmp_dir); + + if($is_update === true) { + $inst->onBeforeUpdate(); + $inst->onUpdate(); + $inst->onAfterUpdate(); + } else { + $inst->onBeforeInstall(); + $inst->onInstall(); + $inst->onAfterInstall(); + } + + exec('rm -rf ' . escapeshellarg($tmp_dir)); + + $app->log('Installation completed.', 0, false); + return true; + } + +} diff --git a/server/lib/classes/cron.d/100-monitor_database_size.inc.php b/server/lib/classes/cron.d/100-monitor_database_size.inc.php index d2981dd31451de58df3816c5b71ce9128fc35f74..97f12253717980eb1bdbdded76b211d2b7a64777 100644 --- a/server/lib/classes/cron.d/100-monitor_database_size.inc.php +++ b/server/lib/classes/cron.d/100-monitor_database_size.inc.php @@ -95,12 +95,12 @@ class cronjob_monitor_database_size extends cronjob { if(!is_numeric($quota)) continue; if($quota < 1 || $quota > $data[$i]['size']) { - print $rec['database_name'] . ' does not exceed quota qize: ' . $quota . ' > ' . $data[$i]['size'] . "\n"; + print 'database ' . $rec['database_name'] . ' size does not exceed quota: ' . ($quota < 1 ? 'unlimited' : $quota) . ' (quota) > ' . $data[$i]['size'] . " (used)\n"; if($rec['quota_exceeded'] == 'y') { $app->dbmaster->datalogUpdate('web_database', array('quota_exceeded' => 'n'), 'database_id', $rec['database_id']); } } elseif($rec['quota_exceeded'] == 'n') { - print $rec['database_name'] . ' exceeds quota qize: ' . $quota . ' < ' . $data[$i]['size'] . "\n"; + print 'database ' . $rec['database_name'] . ' size exceeds quota: ' . $quota . ' (quota) < ' . $data[$i]['size'] . " (used)\n"; $app->dbmaster->datalogUpdate('web_database', array('quota_exceeded' => 'y'), 'database_id', $rec['database_id']); } } diff --git a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php index 1bae04cc521c4ebd069cb83536a8f5ed564a09a5..1d03949a8cf1c7457fd9b7e96a51be5fe73b57f9 100644 --- a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php +++ b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php @@ -74,7 +74,7 @@ class cronjob_monitor_disk_usage extends cronjob { $app->uses('getconf'); $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - $dfData = shell_exec('df -PhT -x simfs | awk \'!x[$1]++\' 2>/dev/null'); + $dfData = shell_exec('df -PhT -x simfs -x squashfs | awk \'!x[$1]++\' 2>/dev/null'); // split into array $df = explode("\n", $dfData); diff --git a/server/lib/classes/cron.d/100-monitor_email_quota.inc.php b/server/lib/classes/cron.d/100-monitor_email_quota.inc.php index 75014c347def49072f048b235c5afadaa976feb5..b9a78e9e7a59a225b1a6ba44ff1c6ff6f2f609e2 100644 --- a/server/lib/classes/cron.d/100-monitor_email_quota.inc.php +++ b/server/lib/classes/cron.d/100-monitor_email_quota.inc.php @@ -80,7 +80,7 @@ class cronjob_monitor_email_quota extends cronjob { //* with dovecot we can use doveadm instead of 'du -s' $dovecot = false; - if (isset($mail_config['pop3_imap_daemon']) && $mail_config ['pop3_imap_daemon'] = 'dovecot' && is_executable('doveadm')) { + if (is_executable('doveadm')) { exec('doveadm quota 2>&1', $tmp_output, $tmp_retval); // with dovecot 2.2.x 'doveadm quota' is unuseable if ($retval = 64) $dovecot = true; } @@ -110,20 +110,6 @@ class cronjob_monitor_email_quota extends cronjob { unset($mailboxes); - //* Dovecot quota check Courier in progress lathama@gmail.com - /* - if($dir = opendir("/var/vmail")){ - while (($quotafiles = readdir($dir)) !== false){ - if(preg_match('/.\_quota$/', $quotafiles)){ - $quotafile = (file("/var/vmail/" . $quotafiles)); - $emailaddress = preg_replace('/_quota/',"", $quotafiles); - $emailaddress = preg_replace('/_/',"@", $emailaddress); - $data[$emailaddress]['used'] = trim($quotafile['1']); - } - } - closedir($dir); - } - */ $res = array(); $res['server_id'] = $server_id; $res['type'] = $type; diff --git a/server/lib/classes/cron.d/100-monitor_kernel_version.php b/server/lib/classes/cron.d/100-monitor_kernel_version.inc.php similarity index 100% rename from server/lib/classes/cron.d/100-monitor_kernel_version.php rename to server/lib/classes/cron.d/100-monitor_kernel_version.inc.php diff --git a/server/lib/classes/cron.d/100-monitor_openvz.inc.php b/server/lib/classes/cron.d/100-monitor_openvz.inc.php deleted file mode 100644 index adc092ec95eb72d96b563202c5607f47c5f0ef64..0000000000000000000000000000000000000000 --- a/server/lib/classes/cron.d/100-monitor_openvz.inc.php +++ /dev/null @@ -1,173 +0,0 @@ -load('monitor_tools'); - $this->_tools = new monitor_tools(); - /* end global section for monitor cronjobs */ - - /* the id of the server as int */ - $server_id = intval($conf['server_id']); - - /** The type of the data */ - - - $type = 'openvz_veinfo'; - - /* - Fetch the data into a array - */ - $app->load('openvz_tools'); - $openVzTools = new openvz_tools(); - $data = $openVzTools->getOpenVzVeInfo(); - - /* the VE-Info has no state. It is, what it is */ - $state = 'no_state'; - - $res = array(); - $res['server_id'] = $server_id; - $res['type'] = $type; - $res['data'] = $data; - $res['state'] = $state; - - /* - * Insert the data into the database - */ - $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . - 'VALUES (?, ?, UNIX_TIMESTAMP(), ?, ?)'; - $app->dbmaster->query($sql, $res['server_id'], $res['type'], serialize($res['data']), $res['state']); - - /* The new data is written, now we can delete the old one */ - $this->_tools->delOldRecords($res['type'], $res['server_id']); - - /** The type of the data */ - $type = 'openvz_beancounter'; - - /* - Fetch the data into a array - */ - $app->load('openvz_tools'); - $openVzTools = new openvz_tools(); - $data = $openVzTools->getOpenVzVeBeanCounter(); - - /* calculate the state of the beancounter */ - if ($data == '') { - $state = 'no_state'; - } else { - $state = 'ok'; - - /* transfer this output-string into a array */ - $test = explode("\n", $data); - - /* the first list of the output is not needed */ - array_shift($test); - - /* now process all items of the rest */ - foreach ($test as $item) { - /* - * eliminate all doubled spaces and spaces at the beginning and end - */ - while (strpos($item, ' ') !== false) { - $item = str_replace(' ', ' ', $item); - } - $item = trim($item); - - /* - * The failcounter is the LAST - */ - if ($item != '') { - $tmp = explode(' ', $item); - $failCounter = $tmp[sizeof($tmp) - 1]; - if ($failCounter > 0) - $state = 'info'; - if ($failCounter > 50) - $state = 'warning'; - if ($failCounter > 200) - $state = 'critical'; - if ($failCounter > 10000) - $state = 'error'; - } - } - } - - $res = array(); - $res['server_id'] = $server_id; - $res['type'] = $type; - $res['data'] = $data; - $res['state'] = $state; - - /* - * Insert the data into the database - */ - $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . - 'VALUES (?, ?, UNIX_TIMESTAMP(), ?, ?)'; - $app->dbmaster->query($sql, $res['server_id'], $res['type'], serialize($res['data']), $res['state']); - - /* The new data is written, now we can delete the old one */ - $this->_tools->delOldRecords($res['type'], $res['server_id']); - - parent::onRunJob(); - } - - /* this function is optional if it contains no custom code */ - public function onAfterRun() { - global $app; - - parent::onAfterRun(); - } - -} - -?> diff --git a/server/lib/classes/cron.d/400-openvz.inc.php b/server/lib/classes/cron.d/100-send_sys_mailqueue.inc.php similarity index 69% rename from server/lib/classes/cron.d/400-openvz.inc.php rename to server/lib/classes/cron.d/100-send_sys_mailqueue.inc.php index c88e0e608f9fcd690937a8205a72abab845d9ece..2ab46dfc8157af227d4086b6fb1c5a6319ce2e52 100644 --- a/server/lib/classes/cron.d/400-openvz.inc.php +++ b/server/lib/classes/cron.d/100-send_sys_mailqueue.inc.php @@ -28,10 +28,11 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -class cronjob_openvz extends cronjob { +class cronjob_send_sys_mailqueue extends cronjob { // job schedule - protected $_schedule = '0 0 * * *'; + protected $_schedule = '* * * * *'; + protected $_run_at_new = true; /* this function is optional if it contains no custom code */ public function onPrepare() { @@ -50,20 +51,15 @@ class cronjob_openvz extends cronjob { public function onRunJob() { global $app, $conf; - //###################################################################################################### - // deactivate virtual servers (run only on the "master-server") - //###################################################################################################### - - if ($app->dbmaster == $app->db) { - //* Check which virtual machines have to be deactivated - $sql = "SELECT * FROM openvz_vm WHERE active = 'y' AND active_until_date IS NOT NULL AND active_until_date < CURDATE()"; - $records = $app->db->queryAllRecords($sql); - if(is_array($records)) { - foreach($records as $rec) { - $app->dbmaster->datalogUpdate('openvz_vm', array("active" => 'n'), 'vm_id', $rec['vm_id']); - $app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'], LOGLEVEL_DEBUG); - } - } + $app->uses('getconf,ispcmail'); + + $mail_config = $app->getconf->get_global_config('mail'); + if($mail_config['smtp_enabled'] == 'y') { + $mail_config['use_smtp'] = true; + $app->ispcmail->setOptions($mail_config); + + // Mail queue is supported only with SMTP... + $app->ispcmail->send_queue(); } parent::onRunJob(); diff --git a/server/lib/classes/cron.d/200-ftplogfiles.inc.php b/server/lib/classes/cron.d/200-ftplogfiles.inc.php index e471967555bf33dd6f3bcdf66244ea9a1bc2e5f7..36b43352404153dcde58ee8e857de9bd6830011d 100644 --- a/server/lib/classes/cron.d/200-ftplogfiles.inc.php +++ b/server/lib/classes/cron.d/200-ftplogfiles.inc.php @@ -71,24 +71,26 @@ class cronjob_ftplogfiles extends cronjob { } } - $fp = fopen('/var/log/pure-ftpd/transfer.log.1', 'r'); + $fp = @fopen('/var/log/pure-ftpd/transfer.log.1', 'r'); $ftp_traffic = array(); - // cumule des stats journalière dans un tableau - while($line = fgets($fp)) - { - $parsed_line = parse_ftp_log($line); - - $sql = "SELECT wd.domain FROM ftp_user AS fu INNER JOIN web_domain AS wd ON fu.parent_domain_id = wd.domain_id WHERE fu.username = ? "; - $temp = $app->db->queryOneRecord($sql, $parsed_line['username'] ); - - $parsed_line['domain'] = $temp['domain']; - - add_ftp_traffic($ftp_traffic, $parsed_line); + if ($fp) { + // cumule des stats journalière dans un tableau + while($line = fgets($fp)) + { + $parsed_line = parse_ftp_log($line); + + $sql = "SELECT wd.domain FROM ftp_user AS fu INNER JOIN web_domain AS wd ON fu.parent_domain_id = wd.domain_id WHERE fu.username = ? "; + $temp = $app->db->queryOneRecord($sql, $parsed_line['username'] ); + + $parsed_line['domain'] = $temp['domain']; + + add_ftp_traffic($ftp_traffic, $parsed_line); + } + + fclose($fp); } - - fclose($fp); - + // Save du tableau en BD foreach($ftp_traffic as $traffic_date => $all_traffic) { @@ -123,4 +125,4 @@ class cronjob_ftplogfiles extends cronjob { } } -?> \ No newline at end of file +?> diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php index 40778a8a13abcb96888b2eaf868bf97578fa9e15..6f38f0b403d66dee84f581dad70ed70e5bf21a5d 100644 --- a/server/lib/classes/cron.d/200-logfiles.inc.php +++ b/server/lib/classes/cron.d/200-logfiles.inc.php @@ -150,8 +150,8 @@ class cronjob_logfiles extends cronjob { $error_logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/error.log'); // rename older files (move up by one) $num = $log_retention; - while($num >= 1 && is_file($error_logfile . '.' . $num . '.gz')) { - rename($error_logfile . '.' . $num . '.gz', $error_logfile . '.' . ($num + 1) . '.gz'); + while($num >= 1) { + if(is_file($error_logfile . '.' . $num . '.gz')) rename($error_logfile . '.' . $num . '.gz', $error_logfile . '.' . ($num + 1) . '.gz'); $num--; } // compress current logfile diff --git a/server/lib/classes/cron.d/500-backup_mail.inc.php b/server/lib/classes/cron.d/500-backup_mail.inc.php index a6807021df866ab9f7d29986134e4bb3c7a0460f..b05caf70d70af4fc6c86c9c1c3243bf834b2242c 100644 --- a/server/lib/classes/cron.d/500-backup_mail.inc.php +++ b/server/lib/classes/cron.d/500-backup_mail.inc.php @@ -242,7 +242,7 @@ class cronjob_backup_mail extends cronjob { if(!is_file($mail_backup_dir.'/'.$backup['filename'])){ $sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?"; $app->db->query($sql, $conf['server_id'], $backup['parent_domain_id'], $backup['filename']); - if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql); + if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $backup['parent_domain_id'], $backup['filename']); } } } diff --git a/server/lib/classes/cron.d/500-jkupdate.inc.php b/server/lib/classes/cron.d/500-jkupdate.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..fcf07912dcb047de7b68667dc4a2ff4228aed860 --- /dev/null +++ b/server/lib/classes/cron.d/500-jkupdate.inc.php @@ -0,0 +1,221 @@ +uses('getconf'); + $jailkit_conf = $app->getconf->get_server_config($conf['server_id'], 'jailkit'); + //$jailkit_programs = explode(' ', $jailkit_conf['jailkit_chroot_app_programs']); + $jailkit_programs = preg_split("/[\s,]+/", $jailkit_conf['jailkit_chroot_app_programs']); + $jailkit_sections = trim($jailkit_conf['jailkit_chroot_app_sections']); + + $sites = $app->db->queryAllRecords("SELECT domain_id, document_root, fastcgi_php_version FROM web_domain WHERE jailkit_jkupdate_cron = 'y' AND type = 'vhost' AND parent_domain_id = 0 AND document_root != '' ORDER BY domain_id"); + + foreach($sites as $site) { + $set_php_symlink = false; + + $users = $app->db->queryOneRecord("SELECT COUNT(*) AS user_count FROM shell_user WHERE parent_domain_id = ? AND active='y' AND chroot='jailkit'", intval($site['domain_id'])); + $crons = $app->db->queryOneRecord("SELECT COUNT(*) AS cron_count FROM cron WHERE parent_domain_id = ? AND active='y' AND type='chrooted'", $site['domain_id']); + if ($users['user_count'] > 0 || $crons['cron_count'] > 0) { + + if (!is_dir($site['document_root'])) { + return; + } + + //* Protect web folders + $app->system->web_folder_protection($site['document_root'], false); + + $app->log('Running jailkit init for '.$site['document_root']); + if($jailkit_sections != '') $this->run_jk_init($site['document_root'], $jailkit_sections); + + $app->log('Running jailkit updates for '.$site['document_root']); + + $this->run_jk_update($site['document_root']); + if(preg_match('@(\d\d?\.\d\d?\.\d\d?)@', $site['fastcgi_php_version'], $matches)){ + if(!in_array('/opt/php-'.$matches[1].'/bin/php', $jailkit_programs)) $jailkit_programs[] = '/opt/php-'.$matches[1].'/bin/php'; + if(!in_array('/opt/php-'.$matches[1].'/include', $jailkit_programs)) $jailkit_programs[] = '/opt/php-'.$matches[1].'/include'; + if(!in_array('/opt/php-'.$matches[1].'/lib', $jailkit_programs)) $jailkit_programs[] = '/opt/php-'.$matches[1].'/lib'; + if(!in_array('/opt/th-php-libs', $jailkit_programs)) $jailkit_programs[] = '/opt/th-php-libs'; + + $set_php_symlink = true; + + } + if(is_array($jailkit_programs) && !empty($jailkit_programs)) $this->run_jk_cp($site['document_root'], $jailkit_programs); + $this->fix_broken_symlinks($site['document_root']); + + if($set_php_symlink){ + // create symlink from /usr/bin/php to current PHP version + if(preg_match('@(\d\d?\.\d\d?\.\d\d?)@', $site['fastcgi_php_version'], $matches) && (!file_exists($site['document_root'].'/usr/bin/php') || is_link($site['document_root'].'/usr/bin/php'))){ + @unlink($site['document_root'].'/usr/bin/php'); + @symlink('/opt/php-'.$matches[1].'/bin/php', $site['document_root'].'/usr/bin/php'); + } + } + + //* Protect web folders + $app->system->web_folder_protection($site['document_root'], true); + } + } + + if(file_exists('/dev/tty')){ + chmod('/dev/tty', 0666); + } + + parent::onRunJob(); + } + + private function run_jk_init($document_root, $sections){ + global $app; + + $return_var = $this->exec_log('/usr/sbin/jk_init -f -k -c /etc/jailkit/jk_init.ini -j '.escapeshellarg($document_root).' '.$sections); + + if ($return_var > 0) { + $app->log('jk_init failed with -j, trying again without -j', LOGLEVEL_DEBUG); + + $return_var = $this->exec_log('/usr/sbin/jk_init -f -k -c /etc/jailkit/jk_init.ini '.escapeshellarg($document_root).' '.$sections); + + if ($return_var > 0) { + $app->log('jk_init failed (with and without -j parameter)', LOGLEVEL_WARN); + } + } + } + + private function run_jk_update($document_root) { + global $app; + + $return_var = $this->exec_log('/usr/sbin/jk_update -j '.escapeshellarg($document_root)); + + if ($return_var > 0) { + $app->log('jk_update failed with -j, trying again without -j', LOGLEVEL_DEBUG); + $return_var = $this->exec_log('/usr/sbin/jk_update '.escapeshellarg($document_root)); + + if ($return_var > 0) { + $app->log('jk_update failed (with and without -j parameter)', LOGLEVEL_WARN); + } + } + } + + private function run_jk_cp($document_root, $programs) { + global $app; + + foreach($programs as $program) { + $program = trim($program); + if($program == ''){ + continue; + } + if (!file_exists($program)) { + continue; + } + + $return_var = $this->exec_log('/usr/sbin/jk_cp '.escapeshellarg($document_root).' '.escapeshellarg($program)); + + if ($return_var > 0) { + $app->log('jk_cp failed with -j, trying again with -j', LOGLEVEL_DEBUG); + $return_var = $this->exec_log('/usr/sbin/jk_cp '.escapeshellarg($document_root).' '.escapeshellarg($program)); + + if ($return_var > 0) { + $app->log('jk_cp failed (without and with -j parameter)', LOGLEVEL_WARN); + } + } + } + + if(file_exists($document_root.'/dev/tty')){ + chmod($document_root.'/dev/tty', 0666); + } + } + + private function fix_broken_symlinks($document_root){ + global $app; + + exec('cd '.escapeshellarg($document_root).' && find . -type l \( ! -name web \) -xtype l', $output, $retval); + + if(is_array($output) && !empty($output)){ + foreach($output as $link){ + $link = trim($link); + if(preg_match('@\.so(\.\d+)*$@',$link)){ + if(substr($link, 0, 1) == '.') $link = substr($link, 1); + //echo $link."\n"; + $path = $document_root.$link; + //if(is_link($path)) echo "Ist Link\n"; + //if(!file_exists($path)) echo "Aber Link ist kaputt!\n"; + if(is_link($path) && !file_exists($path)){ + //echo $path."\n"; + @unlink($path); + $this->run_jk_cp($document_root, array($link)); + } + } + } + } + } + + private function exec_log($cmd) { + global $app; + + $app->log("Running $cmd", LOGLEVEL_DEBUG); + + exec($cmd, $output, $return_var); + + if (count($output) > 0) { + $app->log("Output:\n" . implode("\n", $output), LOGLEVEL_DEBUG); + } + + return $return_var; + } + + /* this function is optional if it contains no custom code */ + public function onAfterRun() { + global $app; + + parent::onAfterRun(); + } + +} + +?> diff --git a/server/lib/classes/cron.d/900-letsencrypt.inc.php b/server/lib/classes/cron.d/900-letsencrypt.inc.php index d03d4a184a7c2626f7d05816c9aa628d80da14f4..1fc06f357162f491c1715443c4e6fb4745ab40ec 100644 --- a/server/lib/classes/cron.d/900-letsencrypt.inc.php +++ b/server/lib/classes/cron.d/900-letsencrypt.inc.php @@ -35,15 +35,11 @@ class cronjob_letsencrypt extends cronjob { /* this function is optional if it contains no custom code */ public function onPrepare() { - global $app; - parent::onPrepare(); } /* this function is optional if it contains no custom code */ public function onBeforeRun() { - global $app; - return parent::onBeforeRun(); } @@ -52,9 +48,19 @@ class cronjob_letsencrypt extends cronjob { $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); if(!isset($server_config['migration_mode']) || $server_config['migration_mode'] != 'y') { - $letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt /opt/eff.org/certbot/venv/bin/certbot')); - $letsencrypt = reset($letsencrypt); - if(is_executable($letsencrypt)) { + + $acme = $app->letsencrypt->get_acme_script(); + if($acme) { + // skip letsencrypt + parent::onRunJob(); + return; + } + + $letsencrypt = $app->letsencrypt->get_certbot_script(); + if($letsencrypt) { + $ret = null; + $val = 0; + $matches = array(); $version = exec($letsencrypt . ' --version 2>&1', $ret, $val); if(preg_match('/^(\S+|\w+)\s+(\d+(\.\d+)+)$/', $version, $matches)) { $type = strtolower($matches[1]); @@ -85,11 +91,7 @@ class cronjob_letsencrypt extends cronjob { /* this function is optional if it contains no custom code */ public function onAfterRun() { - global $app; - parent::onAfterRun(); } } - -?> diff --git a/server/lib/classes/cronjob.inc.php b/server/lib/classes/cronjob.inc.php index 23b3c766e8d12c1357c975d52fedd3bb5c5a221b..9fba5af3c5cc856d61276693d3dd406a9d261e40 100644 --- a/server/lib/classes/cronjob.inc.php +++ b/server/lib/classes/cronjob.inc.php @@ -86,8 +86,8 @@ class cronjob { if($run_it == true) { $this->onRunJob(); $this->onAfterRun(); + $this->onCompleted(); } - $this->onCompleted(); return; } diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index 4eb691ce4422dc6c3683957b3b73f6f0e5c7d4e1..b03ad55676ddb3c30cf01c4e12eed534865d8585 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -1,4 +1,12 @@ dbUser = $user ? $user : $conf['db_user']; $this->dbPass = $pass ? $pass : $conf['db_password']; $this->dbCharset = $conf['db_charset']; - $this->dbNewLink = $conf['db_new_link']; - $this->dbClientFlags = $flags ? $flags : $conf['db_client_flags']; + $this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags']; $this->_iConnId = mysqli_init(); mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags); - for($try=0;(!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5;++$try) { + for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) { sleep($try); - mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags); + if(!is_object($this->_iConnId)) { + $this->_iConnId = mysqli_init(); + } + if(!mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags)) { + $this->_sqlerror('Database connection failed'); + } } - if(!is_object($this->_iConnId) || mysqli_connect_error()) { + if(!is_object($this->_iConnId) || mysqli_connect_errno()) { $this->_iConnId = null; - $this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!', '', true); - return false; + $this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!', '', true); // sets errorMessage + throw new Exception($this->errorMessage); } if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) { $this->close(); - $this->_sqlerror('Datenbank nicht gefunden / Database not found', '', true); - return false; + $this->_sqlerror('Datenbank nicht gefunden / Database not found', '', true); // sets errorMessage + throw new Exception($this->errorMessage); } $this->_setCharset(); @@ -106,6 +116,18 @@ class db $this->_iConnId = null; } + /* + * Test mysql connection. + * + * @return boolean returns true if db connection is good. + */ + public function testConnection() { + if(mysqli_connect_errno()) { + return false; + } + return (boolean)(is_object($this->_iConnId) && mysqli_ping($this->_iConnId)); + } + /* This allows our private variables to be "read" out side of the class */ public function __get($var) { return isset($this->$var) ? $this->$var : NULL; @@ -134,6 +156,7 @@ class db if($iPos2 !== false && ($iPos === false || $iPos2 <= $iPos)) { $sTxt = $this->escape($sValue); + $sTxt = str_replace('`', '', $sTxt); if(strpos($sTxt, '.') !== false) { $sTxt = preg_replace('/^(.+)\.(.+)$/', '`$1`.`$2`', $sTxt); $sTxt = str_replace('.`*`', '.*', $sTxt); @@ -174,17 +197,68 @@ class db /**#@+ - * @access private - */ + * @access private + */ private function _setCharset() { - mysqli_query($this->_iConnId, 'SET NAMES '.$this->dbCharset); - mysqli_query($this->_iConnId, "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'"); + $this->query('SET NAMES '.$this->dbCharset); + $this->query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'"); + } + + private function securityScan($string) { + global $app, $conf; + + // get security config + if(isset($app)) { + $app->uses('getconf'); + $ids_config = $app->getconf->get_security_config('ids'); + + if($ids_config['sql_scan_enabled'] == 'yes') { + + // Remove whitespace + $string = trim($string); + if(substr($string,-1) == ';') $string = substr($string,0,-1); + + // Save original string + $string_orig = $string; + + //echo $string; + $chars = array(';', '#', '/*', '*/', '--', '\\\'', '\\"'); + + $string = str_replace('\\\\', '', $string); + $string = preg_replace('/(^|[^\\\])([\'"])\\2/is', '$1', $string); + $string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\])\\2/is', '$1', $string); + $ok = true; + + if(substr_count($string, "`") % 2 != 0 || substr_count($string, "'") % 2 != 0 || substr_count($string, '"') % 2 != 0) { + $app->log("SQL injection warning (" . $string_orig . ")",2); + $ok = false; + } else { + foreach($chars as $char) { + if(strpos($string, $char) !== false) { + $ok = false; + $app->log("SQL injection warning (" . $string_orig . ")",2); + break; + } + } + } + if($ok == true) { + return true; + } else { + if($ids_config['sql_scan_action'] == 'warn') { + // we return false in warning level. + return false; + } else { + // if sql action = 'block' or anything else then stop here. + $app->error('Possible SQL injection. All actions have been logged.'); + } + } + } + } } private function _query($sQuery = '') { global $app; - //if($this->isConnected == false) return false; if ($sQuery == '') { $this->_sqlerror('Keine Anfrage angegeben / No query given'); return false; @@ -193,10 +267,13 @@ class db $try = 0; do { $try++; - $ok = mysqli_ping($this->_iConnId); + $ok = (is_object($this->_iConnId)) ? mysqli_ping($this->_iConnId) : false; if(!$ok) { - if(!mysqli_real_connect(mysqli_init(), $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort, NULL, $this->dbClientFlags)) { - if($this->errorNumber == '111') { + if(!is_object($this->_iConnId)) { + $this->_iConnId = mysqli_init(); + } + if(!mysqli_real_connect($this->_isConnId, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName, (int)$this->dbPort, NULL, $this->dbClientFlags)) { + if(mysqli_connect_errno() == '111') { // server is not available if($try > 9) { if(isset($app) && isset($app->forceErrorExit)) { @@ -208,7 +285,7 @@ class db } if($try > 9) { - $this->_sqlerror('DB::query -> reconnect', '', true); + $this->_sqlerror('db::_query -> reconnect', '', true); return false; } else { sleep(($try > 7 ? 5 : 1)); @@ -222,7 +299,7 @@ class db $aArgs = func_get_args(); $sQuery = call_user_func_array(array(&$this, '_build_query_string'), $aArgs); - + $this->securityScan($sQuery); $this->_iQueryId = mysqli_query($this->_iConnId, $sQuery); if (!$this->_iQueryId) { $this->_sqlerror('Falsche Anfrage / Wrong Query', 'SQL-Query = ' . $sQuery); @@ -369,13 +446,14 @@ class db * @return int id of last inserted row or 0 if none */ public function insert_id() { - $iRes = mysqli_query($this->_iConnId, 'SELECT LAST_INSERT_ID() as `newid`'); - if(!is_object($iRes)) return false; - - $aReturn = mysqli_fetch_assoc($iRes); - mysqli_free_result($iRes); - - return $aReturn['newid']; + $oResult = $this->query('SELECT LAST_INSERT_ID() as `newid`'); + if(!$oResult) { + $this->_sqlerror('Unable to select last_insert_id()'); + return false; + } + $aReturn = $oResult->get(); + $oResult->free(); + return isset($aReturn['newid']) ? $aReturn['newid'] : 0; } @@ -465,8 +543,13 @@ class db private function _sqlerror($sErrormsg = 'Unbekannter Fehler', $sAddMsg = '', $bNoLog = false) { global $app, $conf; - $mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error()); - $mysql_errno = (is_object($this->_iConnId) ? mysqli_errno($this->_iConnId) : mysqli_connect_errno()); + $mysql_errno = mysqli_connect_errno(); + $mysql_error = mysqli_connect_error(); + if ($mysql_errno === 0 && is_object($this->_iConnId)) { + $mysql_errno = mysqli_errno($this->_iConnId); + $mysql_error = mysqli_error($this->_iConnId); + } + $this->errorNumber = $mysql_error; $this->errorMessage = $mysql_error; //$sAddMsg .= getDebugBacktrace(); @@ -510,6 +593,26 @@ class db return $out; } + public function insertFromArray($tablename, $data) { + if(!is_array($data)) return false; + + $k_query = ''; + $v_query = ''; + + $params = array($tablename); + $v_params = array(); + + foreach($data as $key => $value) { + $k_query .= ($k_query != '' ? ', ' : '') . '??'; + $v_query .= ($v_query != '' ? ', ' : '') . '?'; + $params[] = $key; + $v_params[] = $value; + } + + $query = 'INSERT INTO ?? (' . $k_query . ') VALUES (' . $v_query . ')'; + return $this->query($query, true, array_merge($params, $v_params)); + } + public function diffrec($record_old, $record_new) { $diffrec_full = array(); $diff_num = 0; @@ -550,34 +653,35 @@ class db * @param string $database_name * @return int - database-size in bytes */ + public function getDatabaseSize($database_name) { + global $app, $conf; + static $db=null; + if ( ! $db ) { + $clientdb_host = ($conf['db_host']) ? $conf['db_host'] : NULL; + $clientdb_user = ($conf['db_user']) ? $conf['db_user'] : NULL; + $clientdb_password = ($conf['db_password']) ? $conf['db_password'] : NULL; + $clientdb_port = ((int)$conf['db_port']) ? (int)$conf['db_port'] : NULL; + $clientdb_flags = ($conf['db_flags'] !== NULL) ? $conf['db_flags'] : NULL; - public function getDatabaseSize($database_name) { - global $app; - - include 'lib/mysql_clientdb.conf'; - - /* Connect to the database */ - $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); - if (!$link) { - $app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG); - return; + require_once 'lib/mysql_clientdb.conf'; + + $db = new db($clientdb_host, $clientdb_user, $clientdb_password, NULL, $clientdb_port, $clientdb_flags); } - - /* Get database-size from information_schema */ - $result = mysqli_query($link, "SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($link, $database_name)."'"); + + $result = $db->_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$db->escape($database_name)."'"); if(!$result) { - $app->log('Unable to get the database-size for ' . $database_name . ': '.mysqli_error($link), LOGLEVEL_DEBUG); + $db->_sqlerror('Unable to determine the size of database ' . $database_name); return; } - $database_size = mysqli_fetch_row($result); - mysqli_close($link); - return $database_size[0]; + $database_size = $result->getAsRow(); + $result->free(); + return $database_size[0] ? $database_size[0] : 0; } //** Function to fill the datalog with a full differential record. public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) { - global $app, $conf; + global $app; // Insert backticks only for incomplete table names. if(stristr($db_table, '.')) { @@ -626,6 +730,10 @@ class db public function datalogInsert($tablename, $insert_data, $index_field) { global $app; + // Check fields + if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); + if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); + if(is_array($insert_data)) { $key_str = ''; $val_str = ''; @@ -661,6 +769,10 @@ class db public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) { global $app; + // Check fields + if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); + if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); + $old_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); if(is_array($update_data)) { @@ -692,6 +804,10 @@ class db public function datalogDelete($tablename, $index_field, $index_value) { global $app; + // Check fields + if(!preg_match('/^[a-zA-Z0-9\-\_\.]{1,64}$/',$tablename)) $app->error('Invalid table name '.$tablename); + if(!preg_match('/^[a-zA-Z0-9\-\_]{1,64}$/',$index_field)) $app->error('Invalid index field '.$index_field.' in table '.$tablename); + $old_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $this->query("DELETE FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $new_rec = array(); @@ -709,6 +825,26 @@ class db return true; } + //* get the current datalog status for the specified login (or currently logged in user) + public function datalogStatus($login = '') { + global $app; + + $return = array('count' => 0, 'entries' => array()); + + if($login == '' && isset($_SESSION['s']['user'])) { + $login = $_SESSION['s']['user']['username']; + } + + $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = ? AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action", $login); + foreach($result as $row) { + if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come + $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable'])); $return['count'] += $row['cnt']; + } + unset($result); + + return $return; + } + public function freeResult($query) { @@ -839,10 +975,10 @@ class db function tableInfo($table_name) { - global $go_api, $go_info; + global $go_api, $go_info, $app; // Tabellenfelder einlesen - if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM ??', $table_name)){ + if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM ??', $table_name)){ foreach($rows as $row) { $name = $row['Field']; $default = $row['Default']; @@ -944,7 +1080,7 @@ class db return 'char'; break; case 'varchar': - if($typeValue < 1) die('Database failure: Lenght required for these data types.'); + if($typeValue < 1) die('Database failure: Length required for these data types.'); return 'varchar('.$typeValue.')'; break; case 'text': @@ -953,6 +1089,9 @@ class db case 'blob': return 'blob'; break; + case 'date': + return 'date'; + break; } } diff --git a/server/lib/classes/functions.inc.php b/server/lib/classes/functions.inc.php index e36ed5b04f5f4b8853a2f35bcec5358d7dc9f09e..0470f4746d560c5913b15d1c18d96b4729ac716f 100644 --- a/server/lib/classes/functions.inc.php +++ b/server/lib/classes/functions.inc.php @@ -244,12 +244,6 @@ class functions { if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; } } - $results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM openvz_ip"); - if(!empty($results) && is_array($results)){ - foreach($results as $result){ - if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; - } - } $results = $app->db->queryAllRecords("SELECT data AS ip FROM dns_rr WHERE type = 'A' OR type = 'AAAA'"); if(!empty($results) && is_array($results)){ foreach($results as $result){ @@ -303,6 +297,12 @@ class functions { } } } + + $tmp_ips = $app->plugins->raiseAction('get_server_ips', 0, true); + if(is_array($tmp_ips) && !empty($tmp_ips)) { + $ips = array_merge($ips, $tmp_ips); + } + $ips = array_unique($ips); sort($ips, SORT_NUMERIC); diff --git a/server/lib/classes/ispcmail.inc.php b/server/lib/classes/ispcmail.inc.php index 305b39f35ba47e235413cf4e364cdc4987cd6ce0..dfe27edca6296b0cd58074cfabfc3616ae6fb484 100644 --- a/server/lib/classes/ispcmail.inc.php +++ b/server/lib/classes/ispcmail.inc.php @@ -430,6 +430,9 @@ class ispcmail { if($text == true && $html == false && $attach == false) { // only text $content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"'; + if($this->mail_charset == 'UTF-8') { + $this->headers['Content-Transfer-Encoding'] = '8bit'; + } $textonly = true; } elseif($text == true && $html == false && $attach == true) { // text and attachment @@ -440,6 +443,9 @@ class ispcmail { } elseif($html == true && $text == false && $attach == false) { // html only (or text too) $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; + if($this->mail_charset == 'UTF-8') { + $this->headers['Content-Transfer-Encoding'] = '8bit'; + } $htmlonly = true; } elseif($html == true && $attach == true) { // html and attachments @@ -564,17 +570,14 @@ class ispcmail { * @access private */ private function _encodeSubject($input, $charset = 'ISO-8859-1') { - /* - if($charset == 'UTF-8' && function_exists('imap_8bit')) { - $input = "=?utf-8?Q?" . imap_8bit($input) . "?="; - } else { - preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches); - foreach ($matches[1] as $value) { - $replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value); - $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input); + if(preg_match('/(?:[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})/s', $input)) { + // needs encoding + if(function_exists('imap_8bit')) { + $input = "=?utf-8?Q?" . str_replace("?","=3F", imap_8bit($input)) . "?="; + } else { + $input = '=?utf-8?B?' . base64_encode($input) . '?='; } - }*/ - $input='=?UTF-8?B?'.base64_encode($input).'?='; + } return $input; } @@ -598,6 +601,10 @@ class ispcmail { if($this->smtp_crypt == 'tls') { fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf); fgets($this->_smtp_conn, 515); + + stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_host', false); + stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_peer', false); + stream_context_set_option($this->_smtp_conn, 'ssl', 'allow_self_signed', true); stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); } @@ -740,32 +747,22 @@ class ispcmail { } if($this->use_smtp == true) { - if(!$this->_logged_in || !$this->_smtp_conn) { - $result = $this->_smtp_login(); - if(!$result) return false; - } $bcc_cc_sent = false; foreach($recipients as $recipname => $recip) { - if($this->_sent_mails >= $this->smtp_max_mails) { - // close connection to smtp and reconnect - $this->_sent_mails = 0; - $this->_smtp_close(); - $result = $this->_smtp_login(); - if(!$result) return false; - } - $this->_sent_mails += 1; + // Build mail headers, content etc. + + $m_recipients = array(); + $m_mail_content = ''; $recipname = trim(str_replace('"', '', $recipname)); $recip = $this->_encodeHeader($recip, $this->mail_charset); $recipname = $this->_encodeHeader($recipname, $this->mail_charset); //Email From - fputs($this->_smtp_conn, 'MAIL FROM: <' . $this->_mail_sender . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_from = $this->_mail_sender; //Email To - fputs($this->_smtp_conn, 'RCPT TO: <' . $recip . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_recipients[] = $recip; if($bcc_cc_sent == false) { $add_recips = array(); @@ -773,17 +770,12 @@ class ispcmail { if($this->getHeader('Bcc') != '') $add_recips = array_merge($add_recips, $this->_extract_names($this->getHeader('Bcc'))); foreach($add_recips as $add_recip) { if(!$add_recip['mail']) continue; - fputs($this->_smtp_conn, 'RCPT TO: <' . $this->_encodeHeader($add_recip['mail'], $this->mail_charset) . '>' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_recipients[] = $this->_encodeHeader($add_recip['mail'], $this->mail_charset); } unset($add_recips); $bcc_cc_sent = true; } - //The Email - fputs($this->_smtp_conn, 'DATA' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); - //Construct Headers if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>'); else $this->setHeader('To', $recip); @@ -793,10 +785,32 @@ class ispcmail { if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf; $mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body; - fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf); - $response = fgets($this->_smtp_conn, 515); + $m_mail_content = $mail_content; + + // Attempt SMTP login: + + if(!$this->_logged_in || !$this->_smtp_conn) { + $result = $this->_smtp_login(); + } + + if($this->_sent_mails >= $this->smtp_max_mails) { + // close connection to smtp and reconnect + $this->_sent_mails = 0; + $this->_smtp_close(); + $result = $this->_smtp_login(); + } + $this->_sent_mails += 1; + + // Send mail or queue it + + if ($result) { + $this->send_smtp($m_from, $m_recipients, $m_mail_content); + } else { + $this->add_to_queue($m_from, $m_recipients, $m_mail_content); + } + + // hopefully message was correctly sent or queued now - // hopefully message was correctly sent now $result = true; } } else { @@ -824,7 +838,87 @@ class ispcmail { return $result; } + /** + * Send all mails in queue (usually called from cron) + */ + public function send_queue() { + global $app; + + $mails = $app->db->queryAllRecords('SELECT * FROM sys_mailqueue'); + if (is_array($mails)) { + foreach ($mails as $mail) { + // Open SMTP connections if not open: + + if(!$this->_logged_in || !$this->_smtp_conn) { + $result = $this->_smtp_login(); + } + + if($this->_sent_mails >= $this->smtp_max_mails) { + // close connection to smtp and reconnect + $this->_sent_mails = 0; + $this->_smtp_close(); + $result = $this->_smtp_login(); + } + $this->_sent_mails += 1; + + if (!$result) { + return false; + } + + // Send mail: + + $id = $mail['id']; + $from = $mail['from_address']; + $recipients = explode("\n", $mail['recipients']); + $mail_content = $mail['mail_content']; + + $this->send_smtp($from, $recipients, $mail_content); + + // Delete from queue: + + $app->db->query('DELETE FROM sys_mailqueue WHERE id = ?', $id); + } + } + } + + /** + * Send mail via SMTP + */ + private function send_smtp($from, $recipients, $mail_content) { + // from: + + fputs($this->_smtp_conn, 'MAIL FROM: <' . $from . '>' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + // recipients (To, Cc or Bcc): + + foreach ($recipients as $recipient) { + fputs($this->_smtp_conn, 'RCPT TO: <' . $recipient . '>' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + } + + // mail content: + + fputs($this->_smtp_conn, 'DATA' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); + + // hopefully message was correctly sent now + $result = true; + + return $result; + } + + /** + * Add mail to queue for sending later + */ + private function add_to_queue($from, $recipients, $mail_content) { + global $app; + $app->db->query('INSERT INTO `sys_mailqueue` (`from_address`, `recipients`, `mail_content`) VALUES (?,?,?)', $from, implode("\n", $recipients), $mail_content); + } /** * Close mail connections diff --git a/server/lib/classes/ispconfig_addon_installer_base.inc.php b/server/lib/classes/ispconfig_addon_installer_base.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..d5b02c65d37a6b786fb7c4e526a561bc7a694043 --- /dev/null +++ b/server/lib/classes/ispconfig_addon_installer_base.inc.php @@ -0,0 +1,213 @@ +addon_ident = preg_replace('/_addon_installer$/', '', get_called_class()); + } + + public function setAddonName($name) { + $this->addon_name = $name; + } + + public function setAddonIdent($ident) { + $this->addon_ident = $ident; + } + + public function setAddonVersion($version) { + $this->addon_version = $version; + } + + public function setAddonTempDir($path) { + $this->temp_dir = $path; + } + + protected function copyInterfaceFiles() { + global $app, $conf; + + $app->log('Copying interface files.', 0, false); + $install_dir = realpath($conf['rootpath'] . '/..'); + + if(is_dir($this->temp_dir . '/interface')) { + $ret = null; + $retval = 0; + $command = 'cp -rf ' . escapeshellarg($this->temp_dir . '/interface') . ' ' . escapeshellarg($install_dir . '/'); + exec($command, $ret, $retval); + if($retval != 0) { + $app->log('Copying interface files failed.', 2, false); + throw new AddonInstallerException('Command ' . $command . ' failed with code ' . $retval); + } + + return true; + } else { + return false; + } + } + + protected function copyServerFiles() { + global $app, $conf; + + $app->log('Copying server files.', 0, false); + + $install_dir = realpath($conf['rootpath'] . '/..'); + + if(is_dir($this->temp_dir . '/server')) { + $ret = null; + $retval = 0; + $command = 'cp -rf ' . escapeshellarg($this->temp_dir . '/server'). ' ' . escapeshellarg($install_dir . '/'); + exec($command, $ret, $retval); + if($retval != 0) { + $app->log('Copying interface files failed.', 2, false); + throw new AddonInstallerException('Command ' . $command . ' failed with code ' . $retval); + } + return true; + } else { + return false; + } + } + + protected function copyAddonFiles() { + global $app, $conf; + + $app->log('Copying addon files.', 0, false); + + $install_dir = realpath($conf['rootpath'] . '/..') . '/addons/' . $this->addon_ident; + if(!is_dir($install_dir)) { + if(!$app->system->mkdir($install_dir, false, 0750, true)) { + $app->log('Addons dir missing and could not be created.', 2, false); + throw new AddonInstallerException('Could not create addons dir ' . $install_dir); + } + } + + if(is_dir($this->temp_dir . '/install')) { + $ret = null; + $retval = 0; + $command = 'cp -rf ' . escapeshellarg($this->temp_dir . '/addon.ini') . ' ' . escapeshellarg($this->temp_dir . '/' . $this->addon_ident . '.addon.php') . ' ' . escapeshellarg($this->temp_dir . '/install'). ' ' . escapeshellarg($install_dir . '/'); + exec($command, $ret, $retval); + if($retval != 0) { + /* TODO: logging */ + $app->log('Warning or error on copying addon files. Returncode of command ' . $command . ' was: ' . $retval .'.', 0, false); + } + + return true; + } else { + return false; + } + } + + protected function executeSqlStatements() { + global $app, $conf; + + $incremental = false; + $check = $app->db->queryOneRecord('SELECT `db_version` FROM `addons` WHERE `addon_ident` = ?', $this->addon_ident); + if($check) { + $incremental = 0; + if($check['db_version']) { + $incremental = $check['db_version']; + $app->log('Current db version is ' . $incremental . '.', 0, false); + } + } + + include '/usr/local/ispconfig/server/lib/mysql_clientdb.conf'; + + $app->log('Adding addon entry to db.', 0, false); + // create addon entry if not existing + $qry = 'INSERT IGNORE INTO `addons` (`addon_ident`, `addon_version`, `addon_name`, `db_version`) VALUES (?, ?, ?, ?)'; + $app->db->query($qry, $this->addon_ident, $this->addon_version, $this->addon_name, 0); + + $mysql_command = 'mysql --default-character-set=' . escapeshellarg($conf['db_charset']) . ' --force -h ' . escapeshellarg($clientdb_host) . ' -u ' . escapeshellarg($clientdb_user) . ' -p' . escapeshellarg($clientdb_password) . ' -P ' . escapeshellarg($clientdb_port) . ' -D ' . escapeshellarg($conf['db_database']); + + if($incremental === false) { + $sql_file = $this->temp_dir . '/install/sql/' . $this->addon_ident . '.sql'; + if(is_file($sql_file)) { + $ret = null; + $retval = 0; + $app->log('Loading ' . $sql_file . ' into db.', 0, false); + exec($mysql_command . ' < ' . escapeshellarg($sql_file), $ret, $retval); + if($retval != 0) { + /* TODO: log error! */ + $app->log('Loading ' . $sql_file . ' into db failed.', 1, false); + } + } + } else { + $new_db_version = $incremental; + while(true) { + $sql_file = $this->temp_dir . '/install/sql/incremental/upd_' . str_pad($new_db_version + 1, '0', 5, STR_PAD_LEFT) . '.sql'; + if(!is_file($sql_file)) { + break; + } else { + $ret = null; + $retval = 0; + $app->log('Loading ' . $sql_file . ' into db.', 0, false); + exec($mysql_command . ' < ' . escapeshellarg($sql_file), $ret, $retval); + if($retval != 0) { + /* TODO: log error! */ + $app->log('Loading ' . $sql_file . ' into db failed.', 1, false); + } + } + + $new_db_version++; + } + + $app->db->query('UPDATE `addons` SET `addon_version` = ?, `db_version` = ? WHERE `addon_ident` = ?', $this->addon_version, $new_db_version, $this->addon_ident); + $app->log('Db version of addon is now ' . $new_db_version . '.', 0, false); + } + + return true; + } + + public function onBeforeInstall() { } + + public function onInstall() { + global $app; + + $app->log('Running onInstall()', 0, false); + $this->copyAddonFiles(); + $this->copyInterfaceFiles(); + $this->copyServerFiles(); + $this->executeSqlStatements(); + $app->log('Finished onInstall()', 0, false); + } + + public function onAfterInstall() { } + + public function onBeforeUpdate() { } + + public function onUpdate() { + global $app; + + $app->log('Running onUpdate()', 0, false); + $this->copyAddonFiles(); + $this->copyInterfaceFiles(); + $this->copyServerFiles(); + $this->executeSqlStatements(); + $app->log('Finished onUpdate()', 0, false); + } + + public function onAfterUpdate() { } + + + + public function onRaisedInstallerEvent($event_name, $data = false) { + + } +} + +class AddonInstallerException extends Exception { + public function __construct($message = "", $code = 0, $previous = null) { + parent::__construct($message, $code, $previous); + } +} + +class AddonInstallerValidationException extends AddonInstallerException { } \ No newline at end of file diff --git a/server/lib/classes/letsencrypt.inc.php b/server/lib/classes/letsencrypt.inc.php index c3285a1c2eb6b3dded0e7f58498e2c082eb2f60f..e38d4df6468186441afeb5276650dc85b62177de 100644 --- a/server/lib/classes/letsencrypt.inc.php +++ b/server/lib/classes/letsencrypt.inc.php @@ -42,10 +42,118 @@ class letsencrypt { public function __construct(){ } + + public function get_acme_script() { + $acme = explode("\n", shell_exec('which /usr/local/ispconfig/server/scripts/acme.sh /root/.acme.sh/acme.sh')); + $acme = reset($acme); + if(is_executable($acme)) { + return $acme; + } else { + return false; + } + } + + public function get_acme_command($domains, $key_file, $bundle_file, $cert_file) { + + $letsencrypt = $this->get_acme_script(); + + $cmd = ''; + // generate cli format + foreach($domains as $domain) { + $cmd .= (string) " -d " . $domain; + } + + if($cmd == '') { + return false; + } + + $cmd = 'R=0 ; C=0 ; ' . $letsencrypt . ' --issue ' . $cmd . ' -w /usr/local/ispconfig/interface/acme ; R=$? ; if [[ $R -eq 0 || $R -eq 2 ]] ; then ' . $letsencrypt . ' --install-cert ' . $cmd . ' --key-file ' . escapeshellarg($key_file) . ' --fullchain-file ' . escapeshellarg($bundle_file) . ' --cert-file ' . escapeshellarg($cert_file) . ' --reloadcmd ' . escapeshellarg($this->get_reload_command()) . '; C=$? ; fi ; if [[ $C -eq 0 ]] ; then exit $R ; else exit $C ; fi'; + + return $cmd; + } + + public function get_certbot_script() { + $letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt /opt/eff.org/certbot/venv/bin/certbot')); + $letsencrypt = reset($letsencrypt); + if(is_executable($letsencrypt)) { + return $letsencrypt; + } else { + return false; + } + } + + private function install_acme() { + $install_cmd = 'wget -O - https://get.acme.sh | sh'; + $ret = null; + $val = 0; + exec($install_cmd . ' 2>&1', $ret, $val); + + return ($val == 0 ? true : false); + } + + private function get_reload_command() { + global $app, $conf; + + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + $daemon = ''; + switch ($web_config['server_type']) { + case 'nginx': + $daemon = $web_config['server_type']; + break; + default: + if(is_file($conf['init_scripts'] . '/' . 'httpd24-httpd') || is_dir('/opt/rh/httpd24/root/etc/httpd')) { + $daemon = 'httpd24-httpd'; + } elseif(is_file($conf['init_scripts'] . '/' . 'httpd') || is_dir('/etc/httpd')) { + $daemon = 'httpd'; + } else { + $daemon = 'apache2'; + } + } + + $cmd = $app->system->getinitcommand($daemon, 'force-reload'); + return $cmd; + } + + public function get_certbot_command($domains) { + + $letsencrypt = $this->get_certbot_script(); + + $cmd = ''; + // generate cli format + foreach($domains as $domain) { + $cmd .= (string) " --domains " . $domain; + } + + if($cmd == '') { + return false; + } + + $matches = array(); + $ret = null; + $val = 0; + $letsencrypt_version = exec($letsencrypt . ' --version 2>&1', $ret, $val); + if(preg_match('/^(\S+|\w+)\s+(\d+(\.\d+)+)$/', $letsencrypt_version, $matches)) { + $letsencrypt_version = $matches[2]; + } + if (version_compare($letsencrypt_version, '0.22', '>=')) { + $acme_version = 'https://acme-v02.api.letsencrypt.org/directory'; + } else { + $acme_version = 'https://acme-v01.api.letsencrypt.org/directory'; + } + + $cmd = $letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server $acme_version --rsa-key-size 4096 --email postmaster@$domain $cmd --webroot-path /usr/local/ispconfig/interface/acme"; + + return $cmd; + } + public function get_letsencrypt_certificate_paths($domains = array()) { global $app; + if($this->get_acme_script()) { + return false; + } + if(empty($domains)) return false; if(!is_dir($this->renew_config_path)) return false; @@ -133,7 +241,10 @@ class letsencrypt { } private function get_ssl_domain($data) { + global $app; + $domain = $data['new']['ssl_domain']; + if(!$domain) $domain = $data['new']['domain']; if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y') { @@ -149,8 +260,6 @@ class letsencrypt { } public function get_website_certificate_paths($data) { - global $app; - $ssl_dir = $data['new']['document_root'].'/ssl'; $domain = $this->get_ssl_domain($data); @@ -183,11 +292,17 @@ class letsencrypt { $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); + $use_acme = false; + if($this->get_acme_script()) { + $use_acme = true; + } elseif(!$this->get_certbot_script()) { + // acme and le missing + $this->install_acme(); + } + $tmp = $app->letsencrypt->get_website_certificate_paths($data); $domain = $tmp['domain']; $key_file = $tmp['key']; - $key_file2 = $tmp['key2']; - $csr_file = $tmp['csr']; $crt_file = $tmp['crt']; $bundle_file = $tmp['bundle']; @@ -256,43 +371,42 @@ class letsencrypt { $app->log("There were " . $le_domain_count . " domains in the domain list. LE only supports 100, so we strip the rest.", LOGLEVEL_WARN); } - // generate cli format - foreach($temp_domains as $temp_domain) { - $cli_domain_arg .= (string) " --domains " . $temp_domain; - } - // unset useless data unset($subdomains); unset($aliasdomains); $letsencrypt_cmd = ''; + $allow_return_codes = null; + if($use_acme) { + $letsencrypt_cmd = $this->get_acme_command($temp_domains, $key_file, $bundle_file, $crt_file); + $allow_return_codes = array(2); + } else { + $letsencrypt_cmd = $this->get_certbot_command($temp_domains); + } + $success = false; - if(!empty($cli_domain_arg)) { + if($letsencrypt_cmd) { if(!isset($server_config['migration_mode']) || $server_config['migration_mode'] != 'y') { $app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG); $app->log("Let's Encrypt SSL Cert domains: $cli_domain_arg", LOGLEVEL_DEBUG); - $letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt /opt/eff.org/certbot/venv/bin/certbot')); - $letsencrypt = reset($letsencrypt); - if(is_executable($letsencrypt)) { - $letsencrypt_version = exec($letsencrypt . ' --version 2>&1', $ret, $val); - if(preg_match('/^(\S+|\w+)\s+(\d+(\.\d+)+)$/', $letsencrypt_version, $matches)) { - $letsencrypt_version = $matches[2]; - } - if ($letsencrypt_version >=0.22) { - $acme_version = 'https://acme-v02.api.letsencrypt.org/directory'; - } else { - $acme_version = 'https://acme-v01.api.letsencrypt.org/directory'; - } - $letsencrypt_cmd = $letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server $acme_version --rsa-key-size 4096 --email postmaster@$domain $cli_domain_arg --webroot-path /usr/local/ispconfig/interface/acme"; - $success = $app->system->_exec($letsencrypt_cmd); - } + $success = $app->system->_exec($letsencrypt_cmd, $allow_return_codes); } else { $app->log("Migration mode active, skipping Let's Encrypt SSL Cert creation for: $domain", LOGLEVEL_DEBUG); $success = true; } } + if($use_acme === true) { + if(!$success) { + $app->log('Let\'s Encrypt SSL Cert for: ' . $domain . ' could not be issued.', LOGLEVEL_WARN); + $app->log($letsencrypt_cmd, LOGLEVEL_WARN); + return false; + } else { + return true; + } + } + $le_files = $this->get_letsencrypt_certificate_paths($temp_domains); unset($temp_domains); @@ -369,4 +483,3 @@ class letsencrypt { } } -?> diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php index b70c64571dd5c4c49ba5588644e87d89fc1a5eed..49d2ebe6026574e38a440abb4b5ca2406c151588 100644 --- a/server/lib/classes/monitor_tools.inc.php +++ b/server/lib/classes/monitor_tools.inc.php @@ -37,314 +37,335 @@ class monitor_tools { // Please do not forget to remove the swriteln(); - lines here at this file function get_distname() { - $distname = ''; - $distver = ''; - $distid = ''; - $distbaseid = ''; - - //** Debian or Ubuntu - if(file_exists('/etc/debian_version')) { - - // Check if this is Ubuntu and not Debian - if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) { - - $issue = file_get_contents('/etc/issue'); - - // Use content of /etc/issue file - if(strstr($issue,'Ubuntu')) { - if (strstr(trim($issue), 'LTS')) { - $lts=" LTS"; + $distname = ''; + $distver = ''; + $distid = ''; + $distbaseid = ''; + $distsupported = false; + + //** Debian or Ubuntu + if(file_exists('/etc/debian_version')) { + + // Check if this is Ubuntu and not Debian + if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) { + + $issue = file_get_contents('/etc/issue'); + + // Use content of /etc/issue file + if(strstr($issue,'Ubuntu')) { + if (strstr(trim($issue), 'LTS')) { + $lts=" LTS"; + } else { + $lts=""; + } + + $distname = 'Ubuntu'; + $distid = 'debian40'; + $distbaseid = 'debian'; + $ver = explode(' ', $issue); + $ver = array_filter($ver); + $ver = next($ver); + $mainver = explode('.', $ver); + $mainver = array_filter($mainver); + $mainver = current($mainver).'.'.next($mainver); + // Use content of /etc/os-release file } else { - $lts=""; - } + $os_release = file_get_contents('/etc/os-release'); + if (strstr(trim($os_release), 'LTS')) { + $lts = " LTS"; + } else { + $lts = ""; + } - $distname = 'Ubuntu'; + $distname = 'Ubuntu'; + $distid = 'debian40'; + $distbaseid = 'debian'; + + preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver); + $ver = str_replace("LTS", "", $ver[1]); + $ver = explode(" ", $ver, 2); + $ver = reset($ver); + $mainver = $ver; + $mainver = explode('.', $ver); + $mainver = array_filter($mainver); + $mainver = current($mainver).'.'.next($mainver); + } + switch ($mainver){ + case "18.04": + $relname = "(Bionic Beaver)"; + $distconfid = 'ubuntu1804'; + $distsupported = true; + break; + case "17.10": + $relname = "(Artful Aardvark)"; + $distconfid = 'ubuntu1710'; + $distsupported = true; + break; + case "17.04": + $relname = "(Zesty Zapus)"; + $distconfid = 'ubuntu1604'; + $distsupported = true; + break; + case "16.10": + $relname = "(Yakkety Yak)"; + $distconfid = 'ubuntu1604'; + $distsupported = true; + break; + case "16.04": + $relname = "(Xenial Xerus)"; + $distconfid = 'ubuntu1604'; + $distsupported = true; + break; + case "15.10": + $relname = "(Wily Werewolf)"; + break; + case "15.04": + $relname = "(Vivid Vervet)"; + break; + case "14.10": + $relname = "(Utopic Unicorn)"; + break; + case "14.04": + $relname = "(Trusty Tahr)"; + break; + case "13.10": + $relname = "(Saucy Salamander)"; + break; + case "13.04": + $relname = "(Raring Ringtail)"; + break; + case "12.10": + $relname = "(Quantal Quetzal)"; + break; + case "12.04": + $relname = "(Precise Pangolin)"; + break; + case "11.10": + $relname = "(Oneiric Ocelot)"; + break; + case "11.14": + $relname = "(Natty Narwhal)"; + break; + case "10.10": + $relname = "(Maverick Meerkat)"; + break; + case "10.04": + $relname = "(Lucid Lynx)"; + break; + case "9.10": + $relname = "(Karmic Koala)"; + break; + case "9.04": + $relname = "(Jaunty Jackpole)"; + break; + case "8.10": + $relname = "(Intrepid Ibex)"; + break; + case "8.04": + $relname = "(Hardy Heron)"; + break; + case "7.10": + $relname = "(Gutsy Gibbon)"; + break; + case "7.04": + $relname = "(Feisty Fawn)"; + break; + case "6.10": + $relname = "(Edgy Eft)"; + break; + case "6.06": + $relname = "(Dapper Drake)"; + break; + case "5.10": + $relname = "(Breezy Badger)"; + break; + case "5.04": + $relname = "(Hoary Hedgehog)"; + break; + case "4.10": + $relname = "(Warty Warthog)"; + break; + default: + $relname = "UNKNOWN"; + $distconfid = 'ubuntu1604'; + } + $distver = $ver.$lts." ".$relname; + } elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') { + $distname = 'Debian'; + $distver = '4.0'; $distid = 'debian40'; $distbaseid = 'debian'; - $ver = explode(' ', $issue); - $ver = array_filter($ver); - $ver = next($ver); - $mainver = explode('.', $ver); - $mainver = array_filter($mainver); - $mainver = current($mainver).'.'.next($mainver); - // Use content of /etc/os-release file - } else { - $os_release = file_get_contents('/etc/os-release'); - if (strstr(trim($os_release), 'LTS')) { - $lts = " LTS"; - } else { - $lts = ""; - } - - $distname = 'Ubuntu'; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) { + $distname = 'Debian'; + $distver = 'Lenny'; $distid = 'debian40'; $distbaseid = 'debian'; - - preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver); - $ver = str_replace("LTS", "", $ver[1]); - $ver = explode(" ", $ver, 2); - $ver = reset($ver); - $mainver = $ver; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') { + $distname = 'Debian'; + $distver = 'Squeeze/Sid'; + $distid = 'debian60'; + $distbaseid = 'debian'; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') { + $distname = 'Debian'; + $distver = 'Wheezy/Sid'; + $distid = 'debian60'; + $distbaseid = 'debian'; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') { + $distname = 'Debian'; + $distver = 'Jessie'; + $distid = 'debian60'; + $distbaseid = 'debian'; + $distsupported = true; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '9') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '9') { + $distname = 'Debian'; + $distver = 'Stretch'; + $distconfid = 'debian90'; + $distid = 'debian60'; + $distbaseid = 'debian'; + $distsupported = true; + } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) { + $distname = 'Debian'; + $distver = 'Testing'; + $distid = 'debian60'; + $distconfid = 'debiantesting'; + $distbaseid = 'debian'; + $distsupported = true; + } else { + $distname = 'Debian'; + $distver = 'Unknown'; + $distid = 'debian60'; + $distconfid = 'debian90'; + $distbaseid = 'debian'; + $distsupported = true; } - switch ($mainver){ - case "18.04": - $relname = "(Bionic Beaver)"; - $distconfid = 'ubuntu1804'; - break; - case "17.10": - $relname = "(Artful Aardvark)"; - $distconfid = 'ubuntu1710'; - break; - case "17.04": - $relname = "(Zesty Zapus)"; - $distconfid = 'ubuntu1604'; - break; - case "16.10": - $relname = "(Yakkety Yak)"; - $distconfid = 'ubuntu1604'; - break; - case "16.04": - $relname = "(Xenial Xerus)"; - $distconfid = 'ubuntu1604'; - break; - case "15.10": - $relname = "(Wily Werewolf)"; - break; - case "15.04": - $relname = "(Vivid Vervet)"; - break; - case "14.10": - $relname = "(Utopic Unicorn)"; - break; - case "14.04": - $relname = "(Trusty Tahr)"; - break; - case "13.10": - $relname = "(Saucy Salamander)"; - break; - case "13.04": - $relname = "(Raring Ringtail)"; - break; - case "12.10": - $relname = "(Quantal Quetzal)"; - break; - case "12.04": - $relname = "(Precise Pangolin)"; - break; - case "11.10": - $relname = "(Oneiric Ocelot)"; - break; - case "11.14": - $relname = "(Natty Narwhal)"; - break; - case "10.10": - $relname = "(Maverick Meerkat)"; - break; - case "10.04": - $relname = "(Lucid Lynx)"; - break; - case "9.10": - $relname = "(Karmic Koala)"; - break; - case "9.04": - $relname = "(Jaunty Jackpole)"; - break; - case "8.10": - $relname = "(Intrepid Ibex)"; - break; - case "8.04": - $relname = "(Hardy Heron)"; - break; - case "7.10": - $relname = "(Gutsy Gibbon)"; - break; - case "7.04": - $relname = "(Feisty Fawn)"; - break; - case "6.10": - $relname = "(Edgy Eft)"; - break; - case "6.06": - $relname = "(Dapper Drake)"; - break; - case "5.10": - $relname = "(Breezy Badger)"; - break; - case "5.04": - $relname = "(Hoary Hedgehog)"; - break; - case "4.10": - $relname = "(Warty Warthog)"; - break; - default: - $relname = "UNKNOWN"; + } + + //** Devuan + elseif(file_exists('/etc/devuan_version')) { + if(false !== strpos(trim(file_get_contents('/etc/devuan_version')), 'jessie')) { + $distname = 'Devuan'; + $distver = 'Jessie'; + $distid = 'debian60'; + $distbaseid = 'debian'; + } elseif(false !== strpos(trim(file_get_contents('/etc/devuan_version')), 'ceres')) { + $distname = 'Devuan'; + $distver = 'Ceres'; + $distid = 'debiantesting'; + $distbaseid = 'debian'; + $distsupported = true; } - $distver = $ver.$lts." ".$relname; - } elseif(trim(file_get_contents('/etc/debian_version')) == '4.0') { - $distname = 'Debian'; - $distver = '4.0'; - $distid = 'debian40'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) { - $distname = 'Debian'; - $distver = 'Lenny'; - $distid = 'debian40'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') { - $distname = 'Debian'; - $distver = 'Squeeze/Sid'; - $distid = 'debian60'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') { - $distname = 'Debian'; - $distver = 'Wheezy/Sid'; - $distid = 'debian60'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') { - $distname = 'Debian'; - $distver = 'Jessie'; - $distid = 'debian60'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '9') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '9') { - $distname = 'Debian'; - $distver = 'Stretch'; - $distconfid = 'debian90'; - $distid = 'debian60'; - $distbaseid = 'debian'; - } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) { - $distname = 'Debian'; - $distver = 'Testing'; - $distid = 'debian60'; - $distconfid = 'debiantesting'; - $distbaseid = 'debian'; - } else { - $distname = 'Debian'; - $distver = 'Unknown'; - $distid = 'debian40'; - $distbaseid = 'debian'; } - } - //** Devuan - elseif(file_exists('/etc/devuan_version')) { - if(false !== strpos(trim(file_get_contents('/etc/devuan_version')), 'jessie')) { - $distname = 'Devuan'; - $distver = 'Jessie'; - $distid = 'debian60'; - $distbaseid = 'debian'; - } elseif(false !== strpos(trim(file_get_contents('/etc/devuan_version')), 'ceres')) { - $distname = 'Devuan'; - $distver = 'Testing'; - $distid = 'debiantesting'; - $distbaseid = 'debian'; - } - } - - //** OpenSuSE - elseif(file_exists('/etc/SuSE-release')) { - if(stristr(file_get_contents('/etc/SuSE-release'), '11.0')) { - $distname = 'openSUSE'; - $distver = '11.0'; - $distid = 'opensuse110'; - $distbaseid = 'opensuse'; - } elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.1')) { - $distname = 'openSUSE'; - $distver = '11.1'; - $distid = 'opensuse110'; - $distbaseid = 'opensuse'; - } elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.2')) { - $distname = 'openSUSE'; - $distver = '11.2'; - $distid = 'opensuse112'; - $distbaseid = 'opensuse'; - } else { - $distname = 'openSUSE'; - $distver = 'Unknown'; - $distid = 'opensuse112'; - $distbaseid = 'opensuse'; + //** OpenSuSE + elseif(file_exists('/etc/SuSE-release')) { + if(stristr(file_get_contents('/etc/SuSE-release'), '11.0')) { + $distname = 'openSUSE'; + $distver = '11.0'; + $distid = 'opensuse110'; + $distbaseid = 'opensuse'; + } elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.1')) { + $distname = 'openSUSE'; + $distver = '11.1'; + $distid = 'opensuse110'; + $distbaseid = 'opensuse'; + } elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.2')) { + $distname = 'openSUSE'; + $distver = '11.2'; + $distid = 'opensuse112'; + $distbaseid = 'opensuse'; + $distsupported = true; + } else { + $distname = 'openSUSE'; + $distver = 'Unknown'; + $distid = 'opensuse112'; + $distbaseid = 'opensuse'; + $distsupported = true; + } } - } - //** Redhat - elseif(file_exists('/etc/redhat-release')) { - - $content = file_get_contents('/etc/redhat-release'); - - if(stristr($content, 'Fedora release 9 (Sulphur)')) { - $distname = 'Fedora'; - $distver = '9'; - $distid = 'fedora9'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'Fedora release 10 (Cambridge)')) { - $distname = 'Fedora'; - $distver = '10'; - $distid = 'fedora9'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'Fedora release 10')) { - $distname = 'Fedora'; - $distver = '11'; - $distid = 'fedora9'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'CentOS release 5.2 (Final)')) { - $distname = 'CentOS'; - $distver = '5.2'; - $distid = 'centos52'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'CentOS release 5.3 (Final)')) { - $distname = 'CentOS'; - $distver = '5.3'; - $distid = 'centos53'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'CentOS release 5')) { - $distname = 'CentOS'; - $distver = '5'; - $distid = 'centos53'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'CentOS Linux release 6') || stristr($content, 'CentOS release 6')) { - $distname = 'CentOS'; - $distver = '6'; - $distid = 'centos53'; - $distbaseid = 'fedora'; - } elseif(stristr($content, 'CentOS Linux release 7')) { - $distname = 'CentOS'; - $distver = 'Unknown'; - $distbaseid = 'fedora'; - $var=explode(" ", $content); - $var=explode(".", $var[3]); - $var=$var[0].".".$var[1]; - if($var=='7.0' || $var=='7.1') { - $distid = 'centos70'; + //** Redhat + elseif(file_exists('/etc/redhat-release')) { + + $content = file_get_contents('/etc/redhat-release'); + + if(stristr($content, 'Fedora release 9 (Sulphur)')) { + $distname = 'Fedora'; + $distver = '9'; + $distid = 'fedora9'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'Fedora release 10 (Cambridge)')) { + $distname = 'Fedora'; + $distver = '10'; + $distid = 'fedora9'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'Fedora release 10')) { + $distname = 'Fedora'; + $distver = '11'; + $distid = 'fedora9'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'CentOS release 5.2 (Final)')) { + $distname = 'CentOS'; + $distver = '5.2'; + $distid = 'centos52'; + $distbaseid = 'fedora'; + $distsupported = true; + } elseif(stristr($content, 'CentOS release 5.3 (Final)')) { + $distname = 'CentOS'; + $distver = '5.3'; + $distid = 'centos53'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'CentOS release 5')) { + $distname = 'CentOS'; + $distver = 'Unknown'; + $distid = 'centos53'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'CentOS Linux release 6') || stristr($content, 'CentOS release 6')) { + $distname = 'CentOS'; + $distver = 'Unknown'; + $distid = 'centos53'; + $distbaseid = 'fedora'; + } elseif(stristr($content, 'CentOS Linux release 7')) { + $distname = 'CentOS'; + $distver = 'Unknown'; + $distbaseid = 'fedora'; + $var=explode(" ", $content); + $var=explode(".", $var[3]); + $var=$var[0].".".$var[1]; + $distver = $var; + $distsupported = true; + if($var=='7.0' || $var=='7.1') { + $distid = 'centos70'; + } else { + $distid = 'centos72'; + } } else { - $distid = 'centos72'; + $distname = 'Redhat'; + $distver = 'Unknown'; + $distid = 'fedora9'; + $distbaseid = 'fedora'; } - } else { - $distname = 'Redhat'; - $distver = 'Unknown'; - $distid = 'fedora9'; - $distbaseid = 'fedora'; } - } - //** Gentoo - elseif(file_exists('/etc/gentoo-release')) { + //** Gentoo + elseif(file_exists('/etc/gentoo-release')) { - $content = file_get_contents('/etc/gentoo-release'); + $content = file_get_contents('/etc/gentoo-release'); - preg_match_all('/([0-9]{1,2})/', $content, $version); - $distname = 'Gentoo'; - $distver = $version[0][0].$version[0][1]; - $distid = 'gentoo'; - $distbaseid = 'gentoo'; + preg_match_all('/([0-9]{1,2})/', $content, $version); + $distname = 'Gentoo'; + $distver = $version[0][0].$version[0][1]; + $distid = 'gentoo'; + $distbaseid = 'gentoo'; + $distsupported = true; + } else { + die('Unrecognized GNU/Linux distribution'); + } - } else { - die('Unrecognized GNU/Linux distribution'); - } - - // Set $distconfid to distid, if no different id for the config is defined - if(!isset($distconfid)) $distconfid = $distid; + // Set $distconfid to distid, if no different id for the config is defined + if(!isset($distconfid)) $distconfid = $distid; - return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid); + return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid, 'supported' => $distsupported); } // this function remains in the tools class, because it is used by cron AND rescue @@ -454,16 +475,6 @@ class monitor_tools { $state = 'error'; // because service is down } } -/* - $data['mongodbserver'] = -1; - if ($this->_checkTcp('localhost', 27017)) { - $data['mongodbserver'] = 1; - } else { - $data['mongodbserver'] = 0; -*/ - //$state = 'error'; // because service is down - /* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */ -// } /* * Return the Result @@ -598,9 +609,6 @@ class monitor_tools { $logfile = '/var/log/fail2ban.log'; } break; - case 'log_mongodb': - $logfile = '/var/log/mongodb/mongodb.log'; - break; case 'log_ispconfig': if ($dist == 'debian') { $logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log'; @@ -815,7 +823,7 @@ class monitor_tools { $mailSubject = ''; $inHeader = true; for($l = 0; $l < count($lines); $l++) { - /* Trim only in headers */ + /* Trim only in headers */ if($inHeader && trim($lines[$l]) == '') { $inHeader = false; continue; diff --git a/server/lib/classes/openvz_tools.inc.php b/server/lib/classes/openvz_tools.inc.php deleted file mode 100644 index 16dc601e252630f2966d69fa49d5721cee9c9e7d..0000000000000000000000000000000000000000 --- a/server/lib/classes/openvz_tools.inc.php +++ /dev/null @@ -1,153 +0,0 @@ -isOpenVzHost()) { - return array(); - } - /* - * if it is a OpenVz-Host, we first have to get the VE - List and then parse it to a array - */ - $output = shell_exec('vzlist -a'); - - /* transfer this output-string into a array */ - $outputArray = explode("\n", $output); - - /* the first list of the output is not needed */ - array_shift($outputArray); - - /* now process all items of the rest */ - $res = array(); - foreach ($outputArray as $item) { - /* - * eliminate all doubled spaces and spaces at the beginning and end - */ - while (strpos($item, ' ') !== false) { - $item = str_replace(' ', ' ', $item); - } - $item = trim($item); - - /* - * Now get every token and insert it to the array - */ - if ($item != '') { - $tmp = explode(' ', $item); - $tmpRes['veid'] = $tmp[0]; - $tmpRes['nproc'] = $tmp[1]; - $tmpRes['status'] = $tmp[2]; - $tmpRes['ip_addr'] = $tmp[3]; - $tmpRes['hostname'] = $tmp[4]; - $res[] = $tmpRes; - } - } - - /* ready */ - return $res; - } - - /** - * Return information about the user_beancounters of this VE - */ - public function getOpenVzVeBeanCounter() { - /* - * If it is not a OpenVz - VE, we need no beancounter, because we use the beancounter - * "inside" of each VE - */ - if (!$this->isOpenVzVe()) { - return ""; - } - /* - * if it is a OpenVz-VE, we get the output to a string - */ - $res = file_get_contents('/proc/user_beancounters'); - - /* ready */ - return $res; - } - -} - -?> diff --git a/server/lib/classes/plugin_webserver_apache.inc.php b/server/lib/classes/plugin_webserver_apache.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..027a8f18ab5723fd024700911b64e3ae52f75c14 --- /dev/null +++ b/server/lib/classes/plugin_webserver_apache.inc.php @@ -0,0 +1,500 @@ +getconf->get_server_config($conf['server_id'], 'web'); + + // Rewrite rules + $rewrite_rules = array(); + $rewrite_wildcard_rules = array(); + if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') { + if(substr($data['new']['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/'; + if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){ + $rewrite_target = 'http'.substr($data['new']['redirect_path'], 8); + $rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'], 8); + } else { + $rewrite_target = $data['new']['redirect_path']; + $rewrite_target_ssl = $data['new']['redirect_path']; + } + /* Disabled path extension + if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') { + $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/'; + } + */ + + switch($data['new']['subdomain']) { + case 'www': + $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + break; + case '*': + $rewrite_wildcard_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + break; + default: + $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + } + } + + $server_alias = array(); + $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); + $client_id = intval($client['client_id']); + unset($client); + + // get autoalias + $auto_alias = $web_config['website_autoalias']; + if($auto_alias != '') { + // get the client username + $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = ?", $client_id); + $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]'); + $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']); + $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias); + unset($client); + unset($aa_search); + unset($aa_replace); + $server_alias[] .= $auto_alias; + } + + // get alias domains (co-domains and subdomains) + $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ? AND active = 'y' AND (type != 'vhostsubdomain' AND type != 'vhostalias')", $data['new']['domain_id']); + $alias_seo_redirects = array(); + switch($data['new']['subdomain']) { + case 'www': + $server_alias[] = 'www.'.$data['new']['domain']; + break; + case '*': + $server_alias[] = '*.'.$data['new']['domain']; + break; + } + if(is_array($aliases)) { + foreach($aliases as $alias) { + switch($alias['subdomain']) { + case 'www': + $server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain']; + break; + case '*': + $server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain']; + break; + default: + $server_alias[] .= $alias['domain']; + break; + } + $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG); + + // Add SEO redirects for alias domains + if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', false, 'apache'); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects[] = $tmp_seo_redirects; + } + } + + // Rewriting + if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') { + if(substr($alias['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/'; + if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){ + $rewrite_target = 'http'.substr($alias['redirect_path'], 8); + $rewrite_target_ssl = 'https'.substr($alias['redirect_path'], 8); + } else { + $rewrite_target = $alias['redirect_path']; + $rewrite_target_ssl = $alias['redirect_path']; + } + + switch($alias['subdomain']) { + case 'www': + $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($alias['domain']), + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$alias['domain']), + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + break; + case '*': + $rewrite_wildcard_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($alias['domain']), + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + break; + default: + if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2)); + else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']); + $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule, + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', + 'rewrite_target' => $rewrite_target, + 'rewrite_target_ssl' => $rewrite_target_ssl, + 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), + 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); + } + } + } + } + + //* If we have some alias records + if($server_alias) { + //* begin a new ServerAlias line after 32 alias domains to avoid apache bugs + $server_alias_str = 'ServerAlias '.$server_alias[0]; + for($n=1;$nsetVar('alias', $server_alias_str); + unset($server_alias_str); + unset($n); + } else { + $tpl->setVar('alias', ''); + } + + if (count($rewrite_wildcard_rules) > 0) $rewrite_rules = array_merge($rewrite_rules, $rewrite_wildcard_rules); // Append wildcard rules to the end of rules + + if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0 || $data['new']['rewrite_to_https'] == 'y') { + $tpl->setVar('rewrite_enabled', 1); + } else { + $tpl->setVar('rewrite_enabled', 0); + } + + //$tpl->setLoop('redirects',$rewrite_rules); + $this->rewrite_rules = $rewrite_rules; + $this->alias_seo_redirects = $alias_seo_redirects; + + return; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + */ + public function processCustomDirectives(&$tpl, &$data, &$vhost_data) { + global $app; + + // Custom Apache directives + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", $data['new']['directive_snippets_id']); + if(isset($snippet['snippet'])){ + $vhost_data['apache_directives'] = $snippet['snippet']; + } + } + // Make sure we only have Unix linebreaks + $vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']); + $vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']); + $trans = array( + '{DOCROOT}' => $vhost_data['web_document_root_www'], + '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'] + ); + $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans); + + return; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + */ + public function processPhpStarters(&$tpl, &$data, &$vhost_data) { + global $app, $conf; + + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); + + /** + * install fast-cgi starter script and add script aliasd config + * first we create the script directory if not already created, then copy over the starter script + * settings are copied over from the server ini config for now + * TODO: Create form for fastcgi configs per site. + */ + + $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); + $client_id = intval($client['client_id']); + unset($client); + + if ($data['new']['php'] == 'fast-cgi') { + + $fastcgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $fastcgi_config['fastcgi_starter_path']); + $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path); + + if (!is_dir($fastcgi_starter_path)) { + $app->system->mkdirpath($fastcgi_starter_path); + $app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path, LOGLEVEL_DEBUG); + } + + $app->system->chown($fastcgi_starter_path, $data['new']['system_user']); + $app->system->chgrp($fastcgi_starter_path, $data['new']['system_group']); + if($web_config['security_level'] == 10) { + $app->system->chmod($fastcgi_starter_path, 0755); + } else { + $app->system->chmod($fastcgi_starter_path, 0550); + } + + $fcgi_tpl = new tpl(); + $fcgi_tpl->newTemplate('php-fcgi-starter.master'); + $fcgi_tpl->setVar('apache_version', $app->system->getapacheversion()); + $fcgi_tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); + + if(trim($data['new']['fastcgi_php_version']) != ''){ + // $custom_fastcgi_php_name + list(, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir); + if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1); + } + + if(trim($data['new']['custom_php_ini']) != '') { + $has_custom_php_ini = true; + } else { + $has_custom_php_ini = false; + } + + $web_folder = $app->plugin_webserver_base->getWebFolder($data, 'web', false); + + $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user']; + if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $custom_php_ini_dir .= '_' . $web_folder; + if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); + + // Support for multiple PHP versions (FastCGI) + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_fastcgi_php = false; + if(substr($custom_fastcgi_php_ini_dir, -1) != '/') $custom_fastcgi_php_ini_dir .= '/'; + } else { + $default_fastcgi_php = true; + } + + if($has_custom_php_ini) { + $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir)); + } else { + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); + } else { + $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_fastcgi_php_ini_dir)); + } + } + $fcgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root'])); + $fcgi_tpl->setVar('php_fcgi_children', escapeshellcmd($fastcgi_config['fastcgi_children'])); + $fcgi_tpl->setVar('php_fcgi_max_requests', escapeshellcmd($fastcgi_config['fastcgi_max_requests'])); + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($fastcgi_config['fastcgi_bin'])); + } else { + $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($custom_fastcgi_php_executable)); + } + $fcgi_tpl->setVar('security_level', intval($web_config['security_level'])); + $fcgi_tpl->setVar('domain', escapeshellcmd($data['new']['domain'])); + + $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; + $fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir)); + + $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); + $app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab()); + unset($fcgi_tpl); + + $app->log('Creating fastcgi starter script: '.$fcgi_starter_script, LOGLEVEL_DEBUG); + + if($web_config['security_level'] == 10) { + $app->system->chmod($fcgi_starter_script, 0755); + } else { + $app->system->chmod($fcgi_starter_script, 0550); + } + $app->system->chown($fcgi_starter_script, $data['new']['system_user']); + $app->system->chgrp($fcgi_starter_script, $data['new']['system_group']); + + $tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']); + $tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path); + $tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); + $tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']); + + } else { + //remove the php fastgi starter script if available + $fastcgi_starter_script = $fastcgi_config['fastcgi_starter_script'].($data['old']['type'] == 'vhostsubdomain' ? '_web' . $data['old']['domain_id'] : ''); + if ($data['old']['php'] == 'fast-cgi') { + $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']); + $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path); + if($data['old']['type'] == 'vhost') { + if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script); + if (is_dir($fastcgi_starter_path)) @rmdir($fastcgi_starter_path); + } else { + if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script); + } + } + } + + return; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + */ + public function processVhosts(&$tpl, &$data, &$vhost_data) { + global $app, $conf; + + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + //* create empty vhost array + $vhosts = array(); + + //* Add vhost for ipv4 IP + + //* use ip-mapping for web-mirror + if($data['new']['ip_address'] != '*' && $conf['mirror_server_id'] > 0) { + $sql = "SELECT destination_ip FROM server_ip_map WHERE server_id = ? AND source_ip = ?"; + $newip = $app->db->queryOneRecord($sql, $conf['server_id'], $data['new']['ip_address']); + $data['new']['ip_address'] = $newip['destination_ip']; + unset($newip); + } + + $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80); + if(count($this->rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $this->rewrite_rules); + if(count($this->alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $this->alias_seo_redirects); + $vhosts[] = $tmp_vhost_arr; + unset($tmp_vhost_arr); + + //* Add vhost for ipv4 IP with SSL + if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($vhost_data['ssl_crt_file']) && @is_file($vhost_data['ssl_key_file']) && (@filesize($vhost_data['ssl_crt_file'])>0) && (@filesize($vhost_data['ssl_key_file'])>0)) { + $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443'); + if(count($this->rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $this->rewrite_rules); + $ipv4_ssl_alias_seo_redirects = $this->alias_seo_redirects; + if(is_array($ipv4_ssl_alias_seo_redirects) && !empty($ipv4_ssl_alias_seo_redirects)){ + for($i=0;$i 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv4_ssl_alias_seo_redirects); + $vhosts[] = $tmp_vhost_arr; + unset($tmp_vhost_arr, $ipv4_ssl_alias_seo_redirects); + } + + //* Add vhost for IPv6 IP + if($data['new']['ipv6_address'] != '') { + //* rewrite ipv6 on mirrors + /* chang $conf to $web_config */ + if ($web_config['serverconfig']['web']['vhost_rewrite_v6'] == 'y') { + if (isset($web_config['serverconfig']['server']['v6_prefix']) && $web_config['serverconfig']['server']['v6_prefix'] <> '') { + $explode_v6prefix=explode(':', $web_config['serverconfig']['server']['v6_prefix']); + $explode_v6=explode(':', $data['new']['ipv6_address']); + + for ( $i = 0; $i <= count($explode_v6prefix)-1; $i++ ) { + $explode_v6[$i] = $explode_v6prefix[$i]; + } + $data['new']['ipv6_address'] = implode(':', $explode_v6); + } + } + if($data['new']['ipv6_address'] == '*') $data['new']['ipv6_address'] = '::'; + $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80); + if(count($this->rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $this->rewrite_rules); + if(count($this->alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $this->alias_seo_redirects); + $vhosts[] = $tmp_vhost_arr; + unset($tmp_vhost_arr); + + //* Add vhost for ipv6 IP with SSL + if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($vhost_data['ssl_crt_file']) && @is_file($vhost_data['ssl_key_file']) && (@filesize($vhost_data['ssl_crt_file'])>0) && (@filesize($vhost_data['ssl_key_file'])>0)) { + $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443'); + if(count($this->rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $this->rewrite_rules); + $ipv6_ssl_alias_seo_redirects = $this->alias_seo_redirects; + if(is_array($ipv6_ssl_alias_seo_redirects) && !empty($ipv6_ssl_alias_seo_redirects)){ + for($i=0;$i 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv6_ssl_alias_seo_redirects); + $vhosts[] = $tmp_vhost_arr; + unset($tmp_vhost_arr, $ipv6_ssl_alias_seo_redirects); + } + } + + //* Set the vhost loop + $tpl->setLoop('vhosts', $vhosts); + return; + } + + public function testWebserverConfig() { + global $app; + // if no output is given, check again + $webserver_binary = ''; + $webserver_check_output = null; + $webserver_check_retval = 0; + exec('which apache2ctl apache2 httpd2 httpd apache 2>/dev/null', $webserver_check_output, $webserver_check_retval); + if($webserver_check_retval == 0){ + $webserver_binary = reset($webserver_check_output); + } + if($webserver_binary != ''){ + $tmp_output = null; + $tmp_retval = 0; + exec($webserver_binary.' -t 2>&1', $tmp_output, $tmp_retval); + if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){ + $app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN); + $app->dbmaster->datalogError(implode("\n", $tmp_output)); + } + unset($tmp_output, $tmp_retval); + } + } +} diff --git a/server/lib/classes/plugin_webserver_base.inc.php b/server/lib/classes/plugin_webserver_base.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..0ce6cc5d911e44f1bf99c44510ed45b3a879ed40 --- /dev/null +++ b/server/lib/classes/plugin_webserver_base.inc.php @@ -0,0 +1,3009 @@ +plugins->registerEvent('web_domain_insert', $plugin_name, 'ssl'); + $app->plugins->registerEvent('web_domain_update', $plugin_name, 'ssl'); + $app->plugins->registerEvent('web_domain_delete', $plugin_name, 'ssl'); + + $app->plugins->registerEvent('web_domain_insert', $plugin_name, 'insert'); + $app->plugins->registerEvent('web_domain_update', $plugin_name, 'update'); + $app->plugins->registerEvent('web_domain_delete', $plugin_name, 'delete'); + + $app->plugins->registerEvent('server_ip_insert', $plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_update', $plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_delete', $plugin_name, 'server_ip'); + + $app->plugins->registerEvent('server_insert', $plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_update', $plugin_name, 'server_ip'); + + $app->plugins->registerEvent('client_delete', $plugin_name, 'client_delete'); + + $app->plugins->registerEvent('web_folder_user_insert', $plugin_name, 'web_folder_user'); + $app->plugins->registerEvent('web_folder_user_update', $plugin_name, 'web_folder_user'); + $app->plugins->registerEvent('web_folder_user_delete', $plugin_name, 'web_folder_user'); + + $app->plugins->registerEvent('web_folder_update', $plugin_name, 'web_folder_update'); + $app->plugins->registerEvent('web_folder_delete', $plugin_name, 'web_folder_delete'); + + $app->plugins->registerEvent('ftp_user_delete', $plugin_name, 'ftp_user_delete'); + + $app->plugins->registerAction('php_ini_changed', $plugin_name, 'php_ini_changed'); + + if($server_type === 'apache') { + $app->plugins->registerEvent('webdav_user_insert', $plugin_name, 'webdav'); + $app->plugins->registerEvent('webdav_user_update', $plugin_name, 'webdav'); + $app->plugins->registerEvent('webdav_user_delete', $plugin_name, 'webdav'); + } + } + + private function get_master_php_ini_content($web_data) { + global $app, $conf; + + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); + + $php_ini_content = ''; + $master_php_ini_path = ''; + + if($web_data['php'] == 'mod') { + $master_php_ini_path = $web_config['php_ini_path_apache']; + } else { + // check for custom php + if($web_data['fastcgi_php_version'] != '') { + $tmp = explode(':', $web_data['fastcgi_php_version']); + if(isset($tmp[2])) { + $tmppath = $tmp[2]; + if(substr($tmppath, -7) != 'php.ini') { + if(substr($tmppath, -1) != '/') $tmppath .= '/'; + $tmppath .= 'php.ini'; + } + if(file_exists($tmppath)) { + $master_php_ini_path = $tmppath; + } + unset($tmppath); + } + unset($tmp); + } + + if(!$master_php_ini_path) { + if($web_data['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) { + $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"]; + } elseif($web_data['php'] == 'php-fpm' && file_exists($web_config['php_fpm_ini_path'])) { + $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"]; + } else { + $master_php_ini_path = $web_config['php_ini_path_cgi']; + } + } + } + + // Resolve inconsistant path settings + if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) { + $master_php_ini_path .= '/php.ini'; + } + + // Load the custom php.ini content + if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) { + $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n"; + } + + return $php_ini_content; + } + + // Handle php.ini changes + /* TODO: change to be compatible to nginx, too */ + public function eventPhpIniChanged($event_name, $data, $server_type = 'apache') { + global $app, $conf; + + if($server_type === 'nginx') { + // not yet implemented + return; + } + + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + /* $data contains an array with these keys: + * file -> full path of changed php_ini + * mode -> web_domain php modes to change (mod, fast-cgi, php-fpm or '' for all except 'mod') + * php_version -> php ini path that changed (additional php versions) + */ + + $param = ''; + $qrystr = "SELECT * FROM web_domain WHERE custom_php_ini != ''"; + if($data['mode'] == 'mod') { + $qrystr .= " AND php = 'mod'"; + } elseif($data['mode'] == 'fast-cgi') { + $qrystr .= " AND php = 'fast-cgi'"; + if($data['php_version']) { + $qrystr .= " AND fastcgi_php_version LIKE ?"; + $param = '%:' . $data['php_version']; + } + } elseif($data['mode'] == 'php-fpm') { + $qrystr .= " AND php = 'php-fpm'"; + if($data['php_version']) { + $qrystr .= " AND fastcgi_php_version LIKE ?"; + $param = '%:' . $data['php_version'] . ':%'; + } + } else { + $qrystr .= " AND php != 'mod' AND php != 'fast-cgi'"; + } + + + //** Get all the webs + $web_domains = $app->db->queryAllRecords($qrystr, $param); + foreach($web_domains as $web_data) { + $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$web_data['system_user']; + $web_folder = 'web'; + if($web_data['type'] == 'vhostsubdomain' || $web_data['type'] == 'vhostalias') { + $web_folder = $web_data['web_folder']; + $custom_php_ini_dir .= '_' . $web_folder; + } + if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); + + if(!is_dir($custom_php_ini_dir)) $app->system->mkdir($custom_php_ini_dir); + + $php_ini_content = $this->get_master_php_ini_content($web_data); + + if(intval($web_data['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($web_data['directive_snippets_id'])); + if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ + $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); + if(is_array($required_php_snippets) && !empty($required_php_snippets)){ + foreach($required_php_snippets as $required_php_snippet){ + $required_php_snippet = intval($required_php_snippet); + if($required_php_snippet > 0){ + $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); + $php_snippet['snippet'] = trim($php_snippet['snippet']); + if($php_snippet['snippet'] != ''){ + $web_data['custom_php_ini'] .= "\n".$php_snippet['snippet']; + } + } + } + } + } + } + + $php_ini_content .= str_replace("\r", '', trim($web_data['custom_php_ini'])); + $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content); + $app->log('Info: rewrote custom php.ini for web ' . $web_data['domain_id'] . ' (' . $web_data['domain'] . ').', LOGLEVEL_DEBUG); + } + + if(count($web_domains) > 0) { + //* We do not check the apache config here - we only changed the php.ini + //* Check if this is a chrooted setup + if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { + $is_chrooted = true; + $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG); + } else { + $is_chrooted = false; + } + + $app->log('Info: rewrote all php.ini and reloading apache now.', LOGLEVEL_DEBUG); + if($is_chrooted) { + $app->services->restartServiceDelayed('httpd', 'restart'); + } else { + // request a httpd reload when all records have been processed + $app->services->restartServiceDelayed('httpd', 'reload'); + } + } else { + $app->log('Info: No webs affected by php.ini change.', LOGLEVEL_DEBUG); + } + } + + // Handle the creation of SSL certificates + public function eventSsl($event_name, $data, $server_type = 'apache') { + global $app, $conf; + + $app->uses('system'); + + // load the server configuration options + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf')) + $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR); + + //* Only vhosts can have a ssl cert + if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") return; + + // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl'); + if(!is_dir($data['new']['document_root'].'/ssl') && !is_dir($data['old']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); + + $ssl_dir = $data['new']['document_root'].'/ssl'; + $domain = ($data['new']['ssl_domain'] != '') ? $data['new']['ssl_domain'] : $data['new']['domain']; + $key_file = $ssl_dir.'/'.$domain.'.key'; + $key_file2 = $ssl_dir.'/'.$domain.'.key.org'; + $csr_file = $ssl_dir.'/'.$domain.'.csr'; + $crt_file = $ssl_dir.'/'.$domain.'.crt'; + $bundle_file = $ssl_dir.'/'.$domain.'.bundle'; + + //* Create a SSL Certificate, but only if this is not a mirror server. + if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) { + + $this->ssl_certificate_changed = true; + + //* Rename files if they exist + if(file_exists($key_file)){ + $app->system->rename($key_file, $key_file.'.bak'); + $app->system->chmod($key_file.'.bak', 0400); + } + if(file_exists($key_file2)){ + $app->system->rename($key_file2, $key_file2.'.bak'); + $app->system->chmod($key_file2.'.bak', 0400); + } + if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak'); + if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak'); + + $rand_file = $ssl_dir.'/random_file'; + $rand_data = md5(uniqid(microtime(), 1)); + for($i=0; $i<1000; $i++) { + $rand_data .= md5(uniqid(microtime(), 1)); + $rand_data .= md5(uniqid(microtime(), 1)); + $rand_data .= md5(uniqid(microtime(), 1)); + $rand_data .= md5(uniqid(microtime(), 1)); + } + $app->system->file_put_contents($rand_file, $rand_data); + + $ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15); + + $ssl_cnf = " RANDFILE = $rand_file + + [ req ] + default_bits = 2048 + default_md = sha256 + default_keyfile = keyfile.pem + distinguished_name = req_distinguished_name + attributes = req_attributes + prompt = no + output_password = $ssl_password + + [ req_distinguished_name ] + C = ".trim($data['new']['ssl_country'])." + " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " + " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." + " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." + " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." + CN = $domain + emailAddress = webmaster@".$data['new']['domain']." + + [ req_attributes ] + ";//challengePassword = A challenge password"; + + $ssl_cnf_file = $ssl_dir.'/openssl.conf'; + $app->system->file_put_contents($ssl_cnf_file, $ssl_cnf); + + $rand_file = escapeshellcmd($rand_file); + $key_file2 = escapeshellcmd($key_file2); + $openssl_cmd_key_file2 = $key_file2; + if(substr($domain, 0, 2) == '*.' && strpos($key_file2, '/ssl/\*.') !== false) $key_file2 = str_replace('/ssl/\*.', '/ssl/*.', $key_file2); // wildcard certificate + $key_file = escapeshellcmd($key_file); + $openssl_cmd_key_file = $key_file; + if(substr($domain, 0, 2) == '*.' && strpos($key_file, '/ssl/\*.') !== false) $key_file = str_replace('/ssl/\*.', '/ssl/*.', $key_file); // wildcard certificate + $ssl_days = 3650; + $csr_file = escapeshellcmd($csr_file); + $openssl_cmd_csr_file = $csr_file; + if(substr($domain, 0, 2) == '*.' && strpos($csr_file, '/ssl/\*.') !== false) $csr_file = str_replace('/ssl/\*.', '/ssl/*.', $csr_file); // wildcard certificate + $config_file = escapeshellcmd($ssl_cnf_file); + $crt_file = escapeshellcmd($crt_file); + $openssl_cmd_crt_file = $crt_file; + if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate + + if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) { + + exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $openssl_cmd_key_file2 2048"); + exec("openssl req -new -sha256 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -out $openssl_cmd_csr_file -days $ssl_days -config $config_file"); + exec("openssl rsa -passin pass:$ssl_password -in $openssl_cmd_key_file2 -out $openssl_cmd_key_file"); + + if(file_exists($web_config['CA_path'].'/openssl.cnf')) + { + exec("openssl ca -batch -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file"); + $app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); + if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed. openssl ca -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file", LOGLEVEL_ERROR); + } + if (@filesize($crt_file)==0 || !file_exists($crt_file)){ + exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -in $openssl_cmd_csr_file -out $openssl_cmd_crt_file -days $ssl_days -config $config_file "); + $app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); + } + + } + + $app->system->chmod($key_file2, 0400); + $app->system->chmod($key_file, 0400); + @$app->system->unlink($config_file); + @$app->system->unlink($rand_file); + $ssl_request = $app->system->file_get_contents($csr_file); + $ssl_cert = $app->system->file_get_contents($crt_file); + $ssl_key = $app->system->file_get_contents($key_file); + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + } + + //* Check that the SSL key is not password protected + if($data["new"]["ssl_action"] == 'save') { + if(stristr($data["new"]["ssl_key"],'Proc-Type: 4,ENCRYPTED')) { + $data["new"]["ssl_action"] = ''; + + $app->log('SSL Certificate not saved. The SSL key is encrypted.', LOGLEVEL_WARN); + $app->dbmaster->datalogError('SSL Certificate not saved. The SSL key is encrypted.'); + + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + } + } + + //* and check that SSL cert does not contain subdomain of domain acme.invalid + if($data["new"]["ssl_action"] == 'save') { + $tmp = array(); + $crt_data = ''; + exec('openssl x509 -noout -text -in '.escapeshellarg($crt_file),$tmp); + $crt_data = implode("\n",$tmp); + if(stristr($crt_data,'.acme.invalid')) { + $data["new"]["ssl_action"] = ''; + + $app->log('SSL Certificate not saved. The SSL cert contains domain acme.invalid.', LOGLEVEL_WARN); + $app->dbmaster->datalogError('SSL Certificate not saved. The SSL cert contains domain acme.invalid.'); + + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + } + } + + //* Save a SSL certificate to disk + if($data["new"]["ssl_action"] == 'save') { + $this->ssl_certificate_changed = true; + + //* Backup files + if(file_exists($key_file)){ + $app->system->copy($key_file, $key_file.'~'); + $app->system->chmod($key_file.'~', 0400); + } + if(file_exists($key_file2)){ + $app->system->copy($key_file2, $key_file2.'~'); + $app->system->chmod($key_file2.'~', 0400); + } + if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~'); + if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~'); + if(file_exists($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'~'); + + //* Write new ssl files + if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]); + + if($server_type === 'nginx' || ($server_type === 'apache' && version_compare($app->system->getapacheversion(true), '2.4.8', '>='))) { + // In nginx and apache 2.4.8 and newer, the ssl crt file contains the bundle, so we need no separate bundle file + $tmp_data = ''; + if(trim($data["new"]["ssl_cert"]) != '') $tmp_data .= $data["new"]["ssl_cert"] . "\n"; + if(trim($data["new"]["ssl_bundle"]) != '') $tmp_data .= $data["new"]["ssl_bundle"]; + if(trim($tmp_data) != '') $app->system->file_put_contents($crt_file, $app->file->unix_nl($tmp_data)); + } else { + // Write separate crt and bundle file + if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); + if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]); + } + + //* Write the key file, if field is empty then import the key into the db + if(trim($data["new"]["ssl_key"]) != '') { + $app->system->file_put_contents($key_file, $data["new"]["ssl_key"]); + $app->system->chmod($key_file, 0400); + } else { + $ssl_key = $app->system->file_get_contents($key_file); + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_key = ? WHERE domain = ?", $ssl_key, $data['new']['domain']); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_key = ? WHERE domain = ?", $ssl_key, $data['new']['domain']); + } + + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + $app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG); + } + + //* Delete a SSL certificate + if($data['new']['ssl_action'] == 'del') { + if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf')) + { + exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke ".escapeshellcmd($crt_file)); + $app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); + } + $app->system->unlink($csr_file); + $app->system->unlink($crt_file); + $app->system->unlink($bundle_file); + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); + $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG); + } + + } + + + //* Update the awstats configuration file + public function awstats_update($data, $web_config) { + global $app; + + $web_folder = $data['new']['web_folder']; + if($data['new']['type'] == 'vhost') $web_folder = 'web'; + $awstats_conf_dir = $web_config['awstats_conf_dir']; + + if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats"); + if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) { + if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { + $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); + } + + $content = ''; + if (is_file($awstats_conf_dir."/awstats.conf")) { + $include_file = $awstats_conf_dir."/awstats.conf"; + } elseif (is_file($awstats_conf_dir."/awstats.model.conf")) { + $include_file = $awstats_conf_dir."/awstats.model.conf"; + } + $content .= "Include \"".$include_file."\"\n"; + $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n"; + $content .= "SiteDomain=\"".$data['new']['domain']."\"\n"; + $content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n"; + + if (isset($include_file)) { + $app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content); + $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG); + } else { + $app->log("No awstats base config found. Either awstats.conf or awstats.model.conf must exist in ".$awstats_conf_dir.".", LOGLEVEL_WARN); + } + } + + if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html"); + if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) { + $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); + } else { + $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); + } + } + + //* Delete the awstats configuration file + public function awstats_delete ($data, $web_config) { + global $app; + + $awstats_conf_dir = $web_config['awstats_conf_dir']; + + if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { + $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); + $app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG); + } + } + + public function eventUpdate($event_name, $data, $action, $server_type = 'apache') { + global $app, $conf; + + $this->action = $action; + + if($server_type === 'nginx') { + //* Check if the apache plugin is enabled + if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) { + $app->log('The nginx plugin cannot be used together with the apache2 plugin.', LOGLEVEL_WARN); + return 0; + } + } + + if($this->action != 'insert') $this->action = 'update'; + + if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { + + $old_parent_domain_id = intval($data['old']['parent_domain_id']); + $new_parent_domain_id = intval($data['new']['parent_domain_id']); + + // If the parent_domain_id has been changed, we will have to update the old site as well. + if($this->action == 'update' && $data['new']['parent_domain_id'] != $data['old']['parent_domain_id']) { + $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $old_parent_domain_id, 'y'); + $data['new'] = $tmp; + $data['old'] = $tmp; + $this->action = 'update'; + $this->update($event_name, $data); + } + + // This is not a vhost, so we need to update the parent record instead. + $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $new_parent_domain_id, 'y'); + $data['new'] = $tmp; + $data['old'] = $tmp; + $this->action = 'update'; + $this->update_letsencrypt = true; + } + + // load the server configuration options + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + //* Check if this is a chrooted setup + if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { + $is_chrooted = true; + $app->log('Info: Webserver is chrooted.', LOGLEVEL_DEBUG); + } else { + $is_chrooted = false; + } + + if($data['new']['document_root'] == '') { + if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $app->log('document_root not set', LOGLEVEL_WARN); + return 0; + } + if($app->system->is_allowed_user($data['new']['system_user'], $app->system->is_user($data['new']['system_user']), true) == false + || $app->system->is_allowed_group($data['new']['system_group'], $app->system->is_group($data['new']['system_group']), true) == false) { + $app->log('Websites cannot be owned by the root user or group. User: '.$data['new']['system_user'].' Group: '.$data['new']['system_group'], LOGLEVEL_WARN); + return 0; + } + if(trim($data['new']['domain']) == '') { + $app->log('domain is empty', LOGLEVEL_WARN); + return 0; + } + + $web_folder = $this->getWebFolder($data, 'web', false); + $log_folder = $this->getWebFolder($data, 'log', false); + $old_web_folder = $this->getWebFolder($data, 'web', true); + $old_log_folder = $this->getWebFolder($data, 'log', true); + + // Create group and user, if not exist + $app->uses('system'); + + if($web_config['connect_userid_to_webid'] == 'y') { + //* Calculate the uid and gid + $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']); + $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']); + $fixed_uid_param = '--uid '.$fixed_uid_gid; + $fixed_gid_param = '--gid '.$fixed_uid_gid; + + //* Check if a ispconfigend user and group exists and create them + if(!$app->system->is_group('ispconfigend')) { + exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); + } + if(!$app->system->is_user('ispconfigend')) { + exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); + } + } else { + $fixed_uid_param = ''; + $fixed_gid_param = ''; + } + + $groupname = escapeshellcmd($data['new']['system_group']); + if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) { + exec('groupadd '.$fixed_gid_param.' '.$groupname); + if($is_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname); + $app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG); + } + + $username = escapeshellcmd($data['new']['system_user']); + if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) { + if($web_config['add_web_users_to_sshusers_group'] == 'y') { + exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); + if($is_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); + } else { + exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); + if($is_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); + } + $app->log('Adding the user: '.$username, LOGLEVEL_DEBUG); + } + + //* If the client of the site has been changed, we have a change of the document root + if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) { + + //* Get the old client ID + $old_client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); + $old_client_id = intval($old_client['client_id']); + unset($old_client); + + //* Remove the old symlinks + $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); + if(is_array($tmp_symlinks_array)) { + foreach($tmp_symlinks_array as $tmp_symlink) { + $tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink); + $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); + // Remove trailing slash + if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); + // create the symlinks, if not exist + if(is_link($tmp_symlink)) { + exec('rm -f '.escapeshellcmd($tmp_symlink)); + $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); + } + } + } + + //* Remove protection of old folders + $app->system->web_folder_protection($data['old']['document_root'], false); + + if($data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") { + //* Move the site data + $tmp_docroot = explode('/', $data['new']['document_root']); + unset($tmp_docroot[count($tmp_docroot)-1]); + $new_dir = implode('/', $tmp_docroot); + + $tmp_docroot = explode('/', $data['old']['document_root']); + unset($tmp_docroot[count($tmp_docroot)-1]); + $old_dir = implode('/', $tmp_docroot); + + //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path + if(@is_dir($data['new']['document_root'])) { + $app->system->web_folder_protection($data['new']['document_root'], false); + $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s')); + $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG); + } + + //* Unmount the old log directory bfore we move the log dir + exec('umount -l '.escapeshellcmd($old_dir.'/log')); + + //* Create new base directory, if it does not exist yet + if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); + $app->system->web_folder_protection($data['old']['document_root'], false); + exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir)); + //$app->system->rename($data['old']['document_root'],$new_dir); + $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG); + + // Handle the change in php_open_basedir + $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']); + + //* Change the owner of the website files to the new website owner + exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir); + + //* Change the home directory and group of the website user + $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod'; + $command .= ' --home '.escapeshellcmd($data['new']['document_root']); + $command .= ' --gid '.escapeshellcmd($data['new']['system_group']); + $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; + exec($command); + } + + if($is_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); + + //* Change the log mount + /* + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; + $app->system->removeLine('/etc/fstab', $fstab_line); + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; + $app->system->removeLine('/etc/fstab', $fstab_line); + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; + $app->system->removeLine('/etc/fstab', $fstab_line); + */ + + $fstab_line_old = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; + + if($web_config['network_filesystem'] == 'y') { + $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail,_netdev 0 0'; + $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); + } else { + $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail 0 0'; + $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); + } + + exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); + + } + + //print_r($data); + + // Check if the directories are there and create them if necessary. + $app->system->web_folder_protection($data['new']['document_root'], false); + + if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder); + if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error'); + if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); + //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder); + if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); + if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin'); + if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp'); + if($server_type === 'apache') { + if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav'); + } + + if(!is_dir($data['new']['document_root'].'/.ssh')) { + $app->system->mkdirpath($data['new']['document_root'].'/.ssh'); + $app->system->chmod($data['new']['document_root'].'/.ssh', 0700); + $app->system->chown($data['new']['document_root'].'/.ssh', $username); + $app->system->chgrp($data['new']['document_root'].'/.ssh', $groupname); + } + + //* Create the new private directory + if(!is_dir($data['new']['document_root'].'/private')) { + $app->system->mkdirpath($data['new']['document_root'].'/private'); + $app->system->chmod($data['new']['document_root'].'/private', 0710); + $app->system->chown($data['new']['document_root'].'/private', $username); + $app->system->chgrp($data['new']['document_root'].'/private', $groupname); + } + + + // Remove the symlink for the site, if site is renamed + if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { + if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']); + if(is_link($data['old']['document_root'].'/'.$old_log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$old_log_folder); + + //* remove old log mount + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; + $app->system->removeLine('/etc/fstab', $fstab_line); + + //* Unmount log directory + //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); + exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); + } + + //* Create the log dir if nescessary and mount it + if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) { + if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder); + if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']); + $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder); + $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root'); + $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root'); + $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); + exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); + //* add mountpoint to fstab + $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait'; + $fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev 0 0':' 0 0'; + $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); + } + + $app->system->web_folder_protection($data['new']['document_root'], true); + + // Get the client ID + $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); + $client_id = intval($client['client_id']); + unset($client); + + // Remove old symlinks, if site is renamed + if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { + $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); + if(is_array($tmp_symlinks_array)) { + foreach($tmp_symlinks_array as $tmp_symlink) { + $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); + $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); + // Remove trailing slash + if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); + // remove the symlinks, if not exist + if(is_link($tmp_symlink)) { + exec('rm -f '.escapeshellcmd($tmp_symlink)); + $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); + } + } + } + } + + // Create the symlinks for the sites + $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); + if(is_array($tmp_symlinks_array)) { + foreach($tmp_symlinks_array as $tmp_symlink) { + $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); + $tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink); + // Remove trailing slash + if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); + //* Remove symlink if target folder has been changed. + if($data['old']['document_root'] != '' && $data['old']['document_root'] != $data['new']['document_root'] && is_link($tmp_symlink)) { + $app->system->unlink($tmp_symlink); + } + // create the symlinks, if not exist + if(!is_link($tmp_symlink)) { + // exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); + if ($web_config["website_symlinks_rel"] == 'y') { + $app->system->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink)); + } else { + exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); + } + + $app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG); + } + } + } + + + + // Install the Standard or Custom Error, Index and other related files + // /usr/local/ispconfig/server/conf is for the standard files + // /usr/local/ispconfig/server/conf-custom is for the custom files + // setting a local var here + + // normally $conf['templates'] = "/usr/local/ispconfig/server/conf"; + if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { + + // Copy the error pages + if($data['new']['errordocs']) { + $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; + if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); + } + else { + if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { + exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); + } + else { + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); + } + } + exec('chmod -R a+r '.$error_page_path); + } + + //* Copy the web skeleton files only when there is no index.ph or index.html file yet + if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php')) { + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) { + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); + + if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + } + if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) { + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + } + //if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) { + // exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + //} + } else { + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); + } else { + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); + if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')){ + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + } + if(is_file($conf['rootpath'] . '/conf/index/robots.txt')){ + if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + } + //if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + } + } + } + exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); + + //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before + } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { + + $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; + if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); + } + else { + if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); + } + else { + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); + } + } + exec('chmod -R a+r '.$error_page_path); + exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path); + } // end copy error docs + + // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias + if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { + if($data['new']['hd_quota'] > 0) { + $blocks_soft = $data['new']['hd_quota'] * 1024; + $blocks_hard = $blocks_soft + 1024; + $mb_soft = $data['new']['hd_quota']; + $mb_hard = $mb_soft + 1; + } else { + $mb_soft = $mb_hard = $blocks_soft = $blocks_hard = 0; + } + + // get the primitive folder for document_root and the filesystem, will need it later. + $df_output=explode(" ", exec("df -T " . escapeshellarg($data['new']['document_root']) . "|awk 'END{print \$2,\$NF}'")); + $file_system = $df_output[0]; + $primitive_root = $df_output[1]; + + if($file_system == 'xfs') { + exec("xfs_quota -x -c " . escapeshellarg("limit -u bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " " . $username) . " " . escapeshellarg($primitive_root)); + + // xfs only supports timers globally, not per user. + exec("xfs_quota -x -c 'timer -bir -i 604800' " . escapeshellarg($primitive_root)); + + unset($primitive_root, $df_output, $mb_hard, $mb_soft); + } else { + if($app->system->is_installed('setquota')) { + exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null'); + exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null'); + } + } + } + + if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) { + // Chown and chmod the directories below the document root + $app->system->_exec('chown -R '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); + // The document root itself has to be owned by root in normal level and by the web owner in security level 20 + if($web_config['security_level'] == 20) { + $app->system->_exec('chown '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); + } else { + $app->system->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); + } + } + + //* add the user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update + $user_config_key = 'user'; + if($server_type === 'nginx') { + $user_config_key = 'nginx_user'; + } + if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config[$user_config_key])); + + //* If the security level is set to high + if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost') or ($web_folder != $old_web_folder && $data['new']['type'] == 'vhost')) { + + $app->system->web_folder_protection($data['new']['document_root'], false); + + //* Check if we have the new private folder and create it if nescessary + if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private'); + + if($web_config['security_level'] == 20) { + + $app->system->chmod($data['new']['document_root'], 0755); + $app->system->chmod($data['new']['document_root'].'/web', 0711); + if($server_type === 'apache') { + $app->system->chmod($data['new']['document_root'].'/webdav', 0710); + } + $app->system->chmod($data['new']['document_root'].'/private', 0710); + $app->system->chmod($data['new']['document_root'].'/ssl', 0755); + if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0751); + + // make tmp directory writable for webserver and the website users + $app->system->chmod($data['new']['document_root'].'/tmp', 0770); + + // Set Log directory to 755 to make the logs accessible by the FTP user + if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { + $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); + } + + if($web_config['add_web_users_to_sshusers_group'] == 'y') { + $command = 'usermod'; + $command .= ' --groups sshusers'; + $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; + $app->system->_exec($command); + } + + //* if we have a chrooted environment + if($is_chrooted) { + $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); + + //* add the user to the client group in the chroot environment + $tmp_groupfile = $app->system->server_conf['group_datei']; + $app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group'; + $app->system->add_user_to_group($groupname, escapeshellcmd($web_config[$user_config_key])); + $app->system->server_conf['group_datei'] = $tmp_groupfile; + unset($tmp_groupfile); + } + + //* Chown all default directories + $app->system->chown($data['new']['document_root'], 'root'); + $app->system->chgrp($data['new']['document_root'], 'root'); + $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); + $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); + if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { + $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); + $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); + } + $app->system->chown($data['new']['document_root'].'/ssl', 'root'); + $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); + $app->system->chown($data['new']['document_root'].'/tmp', $username); + $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); + $app->system->chown($data['new']['document_root'].'/web', $username); + $app->system->chgrp($data['new']['document_root'].'/web', $groupname); + $app->system->chown($data['new']['document_root'].'/web/error', $username); + $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } + if($server_type === 'apache') { + $app->system->chown($data['new']['document_root'].'/webdav', $username); + $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); + } + $app->system->chown($data['new']['document_root'].'/private', $username); + $app->system->chgrp($data['new']['document_root'].'/private', $groupname); + + if($web_folder != 'web'){ + $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); + $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); + } + + // If the security Level is set to medium + } else { + + $app->system->chmod($data['new']['document_root'], 0755); + $app->system->chmod($data['new']['document_root'].'/web', 0755); + if($server_type === 'apache') { + $app->system->chmod($data['new']['document_root'].'/webdav', 0755); + } + $app->system->chmod($data['new']['document_root'].'/ssl', 0755); + $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755); + if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0755); + + // make temp directory writable for webserver and the website users + $app->system->chmod($data['new']['document_root'].'/tmp', 0770); + + // Set Log directory to 755 to make the logs accessible by the FTP user + if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { + $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); + } + + $app->system->chown($data['new']['document_root'], 'root'); + $app->system->chgrp($data['new']['document_root'], 'root'); + $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); + $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); + if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { + $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); + $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); + } + + $app->system->chown($data['new']['document_root'].'/ssl', 'root'); + $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); + $app->system->chown($data['new']['document_root'].'/tmp', $username); + $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); + $app->system->chown($data['new']['document_root'].'/web', $username); + $app->system->chgrp($data['new']['document_root'].'/web', $groupname); + $app->system->chown($data['new']['document_root'].'/web/error', $username); + $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/web/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); + } + if($server_type === 'apache') { + $app->system->chown($data['new']['document_root'].'/webdav', $username); + $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); + } + if($web_folder != 'web'){ + $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); + $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); + } + } + } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && + (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { + + if($web_config['security_level'] == 20) { + $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710); + $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } + } else { + $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755); + $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); + if($data['new']['stats_type'] != '') { + $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); + } + } + } + + //* Protect web folders + $app->system->web_folder_protection($data['new']['document_root'], true); + + if($data['new']['type'] == 'vhost') { + // Change the ownership of the error log to the root user + if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')); + $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); + $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); + } + + //* Write the custom php.ini file, if custom_php_ini field is not empty + $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user']; + if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $custom_php_ini_dir .= '_' . $web_folder; + if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); + + if(trim($data['new']['fastcgi_php_version']) != ''){ + // $custom_fastcgi_php_name, $custom_fastcgi_php_executable + list(,, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir); + if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1); + } + + //* Create custom php.ini + if(trim($data['new']['custom_php_ini']) != '') { + $has_custom_php_ini = true; + if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir); + + $php_ini_content = $this->get_master_php_ini_content($data['new']); + $php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini'])); + + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); + if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ + $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); + if(is_array($required_php_snippets) && !empty($required_php_snippets)){ + foreach($required_php_snippets as $required_php_snippet){ + $required_php_snippet = intval($required_php_snippet); + if($required_php_snippet > 0){ + $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); + $php_snippet['snippet'] = trim($php_snippet['snippet']); + if($php_snippet['snippet'] != ''){ + $php_ini_content .= "\n".$php_snippet['snippet']; + } + } + } + } + } + } + + $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content); + } else { + $has_custom_php_ini = false; + if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini'); + } + + $vhost_template_name = 'vhost.conf.master'; + if($server_type === 'nginx') { + $vhost_template_name = 'nginx_vhost.conf.master'; + } + + //* Create the vhost config file + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate($vhost_template_name); + + $vhost_data = $data['new']; + //unset($vhost_data['ip_address']); + $vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder; + $vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder; + $vhost_data['web_basedir'] = $web_config['website_basedir']; + $vhost_data['security_level'] = $web_config['security_level']; + $vhost_data['allow_override'] = ($data['new']['allow_override'] == '')?'All':$data['new']['allow_override']; + $vhost_data['php_open_basedir'] = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; + $vhost_data['ssl_domain'] = $data['new']['ssl_domain']; + $vhost_data['has_custom_php_ini'] = $has_custom_php_ini; + $vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir); + $vhost_data['logging'] = $web_config['logging']; + + // IPv6 + if($data['new']['ipv6_address'] != ''){ + $tpl->setVar('ipv6_enabled', 1); + if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') { + if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') { + $explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']); + $explode_v6=explode(':', $data['new']['ipv6_address']); + + for ( $i = 0; $i <= count($explode_v6prefix)-1; $i++ ) { + $explode_v6[$i] = $explode_v6prefix[$i]; + } + $data['new']['ipv6_address'] = implode(':', $explode_v6); + $vhost_data['ipv6_address'] = $data['new']['ipv6_address']; + } + } + } + + if($server_type === 'nginx') { + $app->plugin_webserver_nginx->processPhpFpm($tpl, $data, $vhost_data); + $app->plugin_webserver_nginx->processRewriteRules($tpl, $data, $vhost_data); + } else { + $app->plugin_webserver_apache->processCustomDirectives($tpl, $data, $vhost_data); + } + + // Custom Apache directives + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", $data['new']['directive_snippets_id']); + if(isset($snippet['snippet'])){ + $vhost_data['apache_directives'] = $snippet['snippet']; + } + } + // Make sure we only have Unix linebreaks + $vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']); + $vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']); + $trans = array( + '{DOCROOT}' => $vhost_data['web_document_root_www'], + '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'] + ); + $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans); + + $app->uses('letsencrypt'); + // Check if a SSL cert exists + $tmp = $app->letsencrypt->get_website_certificate_paths($data); + $domain = $tmp['domain']; + $key_file = $tmp['key']; + $key_file2 = $tmp['key2']; + $csr_file = $tmp['csr']; + $crt_file = $tmp['crt']; + $bundle_file = $tmp['bundle']; + unset($tmp); + + $data['new']['ssl_domain'] = $domain; + $vhost_data['ssl_domain'] = $domain; + $vhost_data['ssl_crt_file'] = $crt_file; + $vhost_data['ssl_key_file'] = $key_file; + $vhost_data['ssl_bundle_file'] = $bundle_file; + + //* Generate Let's Encrypt SSL certificat + if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y' && $conf['mirror_server_id'] == 0 && ( // ssl and let's encrypt is active and no mirror server + ($data['old']['ssl'] == 'n' || $data['old']['ssl_letsencrypt'] == 'n') // we have new let's encrypt configuration + || ($data['old']['domain'] != $data['new']['domain']) // we have domain update + || ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain + || $this->update_letsencrypt == true + )) { + + $success = $app->letsencrypt->request_certificates($data, $server_type); + if($success) { + /* we don't need to store it. + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + } else { + $data['new']['ssl_letsencrypt'] = 'n'; + if($data['old']['ssl'] == 'n') $data['new']['ssl'] = 'n'; + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']); + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ? AND `server_id` = ?", $data['new']['ssl'], 'n', $data['new']['domain'], $conf['server_id']); + } + } + + if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1; + + // HTTP/2.0 ? + $vhost_data['enable_http2'] = 'n'; + if($vhost_data['enable_spdy'] == 'y'){ + $tmp_output = null; + $tmp_retval = 0; + if($server_type === 'apache') { + // check if apache supports http_v2 + exec("2>&1 apachectl -M | grep http2_module", $tmp_output, $tmp_retval); + } else { + // check if nginx support http_v2; if so, use that instead of spdy + exec("2>&1 nginx -V | tr -- - '\n' | grep http_v2_module", $tmp_output, $tmp_retval); + } + if($tmp_retval == 0){ + $vhost_data['enable_http2'] = 'y'; + $vhost_data['enable_spdy'] = 'n'; + } + unset($tmp_output, $tmp_retval); + } + + // Set SEO Redirect + if($data['new']['seo_redirect'] != ''){ + $vhost_data['seo_redirect_enabled'] = 1; + $tmp_seo_redirects = $this->get_seo_redirects($data['new'], '', false, $server_type); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + foreach($tmp_seo_redirects as $key => $val){ + $vhost_data[$key] = $val; + } + } else { + $vhost_data['seo_redirect_enabled'] = 0; + } + } else { + $vhost_data['seo_redirect_enabled'] = 0; + } + + if($server_type === 'nginx') { + if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) { + $vhost_data['ssl_enabled'] = 1; + $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG); + } else { + $vhost_data['ssl_enabled'] = 0; + $app->log('SSL Disabled. '.$domain, LOGLEVEL_DEBUG); + } + } + + // set logging variable + $vhost_data['logging'] = $web_config['logging']; + + $tpl->setVar($vhost_data); + + $config_prefix = ''; + if($server_type === 'apache') { + $tpl->setVar('apache_version', $app->system->getapacheversion()); + $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); + $app->plugin_webserver_apache->processRewriteRules($tpl, $data, $vhost_data); + $app->plugin_webserver_apache->processPhpStarters($tpl, $data, $vhost_data); + $app->plugin_webserver_apache->processVhosts($tpl, $data, $vhost_data); + } elseif($server_type === 'nginx') { + $app->plugin_webserver_nginx->processStatsAuth($tpl, $data, $vhost_data); + $config_prefix = 'nginx_'; + } + + /** + * PHP-FPM + */ + // Support for multiple PHP versions + if($data['new']['php'] == 'php-fpm'){ + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } else { + if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } + + if($default_php_fpm){ + $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); + } else { + $pool_dir = $custom_php_fpm_pool_dir; + } + $pool_dir = trim($pool_dir); + if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; + $pool_name = 'web'.$data['new']['domain_id']; + $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']); + if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; + + if($data['new']['php_fpm_use_socket'] == 'y'){ + $use_tcp = 0; + $use_socket = 1; + if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir); + } else { + $use_tcp = 1; + $use_socket = 0; + } + $tpl->setVar('use_tcp', $use_tcp); + $tpl->setVar('use_socket', $use_socket); + $fpm_socket = $socket_dir.$pool_name.'.sock'; + $tpl->setVar('fpm_socket', $fpm_socket); + $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); + + $this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $server_type); + if($server_type === 'nginx') { + $fpm_data = array( + 'use_tcp' => $use_tcp, + 'use_socket' => $use_socket, + 'socket_dir' => $socket_dir, + 'fpm_socket' => $fpm_socket, + 'fpm_port' => $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1 + ); + $app->plugin_webserver_nginx->processCustomDirectives($tpl, $data, $vhost_data, $fpm_data); + } + + $vhost_file = escapeshellcmd($web_config[$config_prefix.'vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost'); + //* Make a backup copy of vhost file + if(file_exists($vhost_file)) $app->system->copy($vhost_file, $vhost_file.'~'); + + //* Write vhost file + if($server_type === 'apache') { + $app->system->file_put_contents($vhost_file, $tpl->grab()); + } else { + $app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab())); + } + $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG); + + if($server_type === 'apache') { + /* + * maybe we have some webdav - user. If so, add them... + */ + $this->_patchVhostWebdav($vhost_file, $data['new']['document_root'] . '/webdav'); + } + + //* Set the symlink to enable the vhost + //* First we check if there is a old type of symlink and remove it + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost'); + if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink); + + //* Remove old or changed symlinks + if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') { + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); + if(is_link($vhost_symlink)) { + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); + if(is_link($vhost_symlink)) { + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + } + + //* New symlink + if($data['new']['subdomain'] == '*') { + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); + } else { + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); + } + if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) { + symlink($vhost_file, $vhost_symlink); + $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + + // remove old symlink and vhost file, if domain name of the site has changed + if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)) { + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)) { + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_symlink = escapeshellcmd($web_config[$config_prefix.'vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)) { + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_file = escapeshellcmd($web_config[$config_prefix.'vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); + $app->system->unlink($vhost_file); + $app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG); + } + + if($server_type === 'apache') { + //* Create .htaccess and .htpasswd file for website statistics + if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats'); + $ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user"; + $app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file); + $app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755); + unset($ht_file); + + if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { + if(trim($data['new']['stats_password']) != '') { + $htp_file = 'admin:'.trim($data['new']['stats_password']); + $app->system->web_folder_protection($data['new']['document_root'], false); + $app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file); + $app->system->web_folder_protection($data['new']['document_root'], true); + $app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755); + unset($htp_file); + } + } + } else { + // create password file for stats directory + $stats_web_folder = $app->plugin_webserver_nginx->getStatsFolder($data); + + if(!is_file($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { + if(trim($data['new']['stats_password']) != '') { + $htp_file = 'admin:'.trim($data['new']['stats_password']); + $app->system->file_put_contents($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats', $htp_file); + $app->system->chmod($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats', 0755); + unset($htp_file); + } + } + } + + //* Create awstats configuration + if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { + $app->plugin_webserver_base->awstats_update($data, $web_config); + } + + if($web_config['check_apache_config'] == 'y') { + //* Test if server starts with the new configuration file + $online_status_before_restart = $this->_checkTcp('localhost', 80); + $app->log('web server status is: '.($online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); + + $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure + $app->log('web server restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG); + + // wait a few seconds, before we test the status again + $online_status_after_restart = false; + sleep(2); + for($i = 0; $i < 5; $i++) { + $online_status_after_restart = $this->_checkTcp('localhost', 80); + if($online_status_after_restart) break; + sleep(1); + } + //* Check if server restarted successfully if it was online before + $app->log('web server online status after restart is: '.($online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); + if($online_status_before_restart && !$online_status_after_restart || $retval['retval'] > 0) { + $app->log('web server did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN); + if(is_array($retval['output']) && !empty($retval['output'])){ + $app->log('Reason for web server restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN); + $app->dbmaster->datalogError(implode("\n", $retval['output'])); + } else { + $app->plugin_webserver_apache->testWebserverConfig(); + } + $app->system->copy($vhost_file, $vhost_file.'.err'); + + if(is_file($vhost_file.'~')) { + //* Copy back the last backup file + $app->system->copy($vhost_file.'~', $vhost_file); + } else { + //* There is no backup file, so we create a empty vhost file with a warning message inside + $app->system->file_put_contents($vhost_file, "# web server did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors."); + } + + if($this->ssl_certificate_changed === true) { + if($server_type === 'nginx') { + /* TODO: check if needed! */ + $ssl_dir = $data['new']['document_root'].'/ssl'; + $domain = $data['new']['ssl_domain']; + $key_file = $ssl_dir.'/'.$domain.'.key.org'; + $key_file2 = $ssl_dir.'/'.$domain.'.key'; + $csr_file = $ssl_dir.'/'.$domain.'.csr'; + $crt_file = $ssl_dir.'/'.$domain.'.crt'; + } + + //* Backup the files that might have caused the error + if(is_file($key_file)){ + $app->system->copy($key_file, $key_file.'.err'); + $app->system->chmod($key_file.'.err', 0400); + } + if(is_file($key_file2)){ + $app->system->copy($key_file2, $key_file2.'.err'); + $app->system->chmod($key_file2.'.err', 0400); + } + if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err'); + if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err'); + if(is_file($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'.err'); + + //* Restore the ~ backup files + if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file); + if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2); + if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file); + if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file); + if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~', $bundle_file); + + $app->log('web server did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN); + } + + $app->services->restartService('httpd', 'restart'); + } + } else { + //* We do not check the web server config after changes (is faster) + if($is_chrooted) { + $app->services->restartServiceDelayed('httpd', 'restart'); + } else { + // request a httpd reload when all records have been processed + $app->services->restartServiceDelayed('httpd', 'reload'); + } + } + + //* The vhost is written and apache has been restarted, so we + // can reset the ssl changed var to false and cleanup some files + $this->ssl_certificate_changed = false; + + if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~'); + if(@is_file($key_file2.'~')) $app->system->unlink($key_file2.'~'); + if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~'); + if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~'); + if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~'); + + // Remove the backup copy of the config file. + if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~'); + + //* Unset action to clean it for next processed vhost. + $this->action = ''; + } + + public function eventDelete($event_name, $data, $server_type = 'apache') { + global $app, $conf; + + // load the server configuration options + $app->uses('getconf'); + $app->uses('system'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); + + if($data['old']['type'] == 'vhost') { + $app->system->web_folder_protection($data['old']['document_root'], false); + } elseif($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { + + $parent_domain_id = intval($data['old']['parent_domain_id']); + $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $parent_domain_id); + $app->system->web_folder_protection($tmp['document_root'], false); + } + + //* Check if this is a chrooted setup + if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { + $is_chrooted = true; + } else { + $is_chrooted = false; + } + + //* Remove the mounts + $log_folder = 'log'; + $web_folder = ''; + if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { + $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); + if($tmp['domain'] != ''){ + $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); + } else { + // we are deleting the parent domain, so we can delete everything in the log directory + $subdomain_hosts = array(); + $files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..')); + if(is_array($files) && !empty($files)){ + foreach($files as $file){ + if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){ + $subdomain_hosts[] = $file; + } + } + } + } + if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){ + $log_folders = array(); + foreach($subdomain_hosts as $subdomain_host){ + $log_folders[] = $log_folder.'/'.$subdomain_host; + } + } else { + if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; + $log_folder .= '/' . $subdomain_host; + } + $web_folder = $data['old']['web_folder']; + unset($tmp); + unset($subdomain_hosts); + } + + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias'){ + if(is_array($log_folders) && !empty($log_folders)){ + foreach($log_folders as $log_folder){ + exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$log_folder) . ' 2>/dev/null'); + } + } else { + exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$log_folder) . ' 2>/dev/null'); + } + + //try umount mysql + if(file_exists($data['old']['document_root'].'/var/run/mysqld')) { + $fstab_line = '/var/run/mysqld ' . $data['old']['document_root'] . '/var/run/mysqld none bind,nobootwait 0 0'; + $app->system->removeLine('/etc/fstab', $fstab_line); + $command = 'umount ' . escapeshellarg($data['old']['document_root']) . '/var/run/mysqld/'; + exec($command); + } + + // remove letsencrypt if it exists (renew will always fail otherwise) + + $old_domain = $data['old']['domain']; + if(substr($old_domain, 0, 2) === '*.') { + // wildcard domain not yet supported by letsencrypt! + $old_domain = substr($old_domain, 2); + } + @rename('/etc/letsencrypt/renewal/' . $old_domain . '.conf', '/etc/letsencrypt/renewal/' . $old_domain . '.conf~backup'); + } + + //* remove mountpoint from fstab + if(is_array($log_folders) && !empty($log_folders)){ + foreach($log_folders as $log_folder){ + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; + $app->system->removeLine('/etc/fstab', $fstab_line); + } + } else { + $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; + $app->system->removeLine('/etc/fstab', $fstab_line); + } + unset($log_folders); + + if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['type'] != 'vhostalias' && $data['old']['parent_domain_id'] > 0) { + //* This is a alias domain or subdomain, so we have to update the website instead + $parent_domain_id = intval($data['old']['parent_domain_id']); + $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $parent_domain_id); + $data['new'] = $tmp; + $data['old'] = $tmp; + $this->action = 'update'; + $this->update_letsencrypt = true; + // just run the update function + $this->eventUpdate($event_name, $data, 'update', $server_type); + + } else { + $conf_prefix = ''; + if($server_type === 'nginx') { + $conf_prefix = 'nginx_'; + } + + //* This is a website + // Deleting the vhost file, symlink and the data directory + $vhost_file = escapeshellcmd($web_config[$conf_prefix.'vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); + + $vhost_symlink = escapeshellcmd($web_config[$conf_prefix.'vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)){ + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_symlink = escapeshellcmd($web_config[$conf_prefix.'vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)){ + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + $vhost_symlink = escapeshellcmd($web_config[$conf_prefix.'vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); + if(is_link($vhost_symlink)){ + $app->system->unlink($vhost_symlink); + $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); + } + + $app->system->unlink($vhost_file); + $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG); + + if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { + $docroot = escapeshellcmd($data['old']['document_root']); + if($docroot != '' && !stristr($docroot, '..')) { + if($data['old']['type'] == 'vhost') { + // this is a vhost - we delete everything in here. + exec('rm -rf '.$docroot); + } elseif(!stristr($data['old']['web_folder'], '..')) { + // this is a vhost subdomain + // IMPORTANT: do some folder checks before we delete this! + $do_delete = true; + $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times + if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1); + if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1); + + $path_elements = explode('/', $delete_folder); + + if($path_elements[0] == 'web' || $path_elements[0] === '') { + // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here! + // we use strict check as otherwise directories named '0' may not be deleted + $do_delete = false; + } else { + // read all vhost subdomains and alias with same parent domain + $used_paths = array(); + $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ? AND domain_id != ?", $data['old']['parent_domain_id'], $data['old']['domain_id']); + foreach($tmp as $tmprec) { + // we normalize the folder entries because we need to compare them + $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times + if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1); + if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1); + + // add this path and it's parent paths to used_paths array + while(strpos($tmp_folder, '/') !== false) { + if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; + $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/')); + } + if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; + } + unset($tmp); + + // loop and check if the path is still used and stop at first used one + // set do_delete to false so nothing gets deleted if the web_folder itself is still used + $do_delete = false; + while(count($path_elements) > 0) { + $tmp_folder = implode('/', $path_elements); + if(in_array($tmp_folder, $used_paths) == true) break; + + // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true + $delete_folder = $tmp_folder; + $do_delete = true; + array_pop($path_elements); + } + unset($tmp_folder); + unset($used_paths); + } + + if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder); + + unset($delete_folder); + unset($path_elements); + } + } + + //remove the php fastgi starter script if available + if ($data['old']['php'] == 'fast-cgi') { + $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']); + if($data['old']['type'] == 'vhost') { + if (is_dir($fastcgi_starter_path)) { + exec('rm -rf '.$fastcgi_starter_path); + } + } else { + $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id']; + if (file_exists($fcgi_starter_script)) { + exec('rm -f '.$fcgi_starter_script); + } + } + } + + // remove PHP-FPM pool + if ($data['old']['php'] == 'php-fpm') { + $this->php_fpm_pool_delete($data, $web_config, $server_type); + } + + $app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG); + + // Delete the symlinks for the sites + $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); + $client_id = intval($client['client_id']); + unset($client); + $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); + if(is_array($tmp_symlinks_array)) { + foreach($tmp_symlinks_array as $tmp_symlink) { + $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); + $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); + // Remove trailing slash + if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); + // delete the symlink + if(is_link($tmp_symlink)) { + $app->system->unlink($tmp_symlink); + $app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG); + } + } + } + // end removing symlinks + } + + // Delete the log file directory + $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']); + if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir); + $app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG); + + if($data['old']['type'] == 'vhost') { + //delete the web user + $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel'; + $command .= ' '.escapeshellcmd($data['old']['system_user']); + exec($command); + if($is_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); + + } + + //* Remove the awstats configuration file + if($data['old']['stats_type'] == 'awstats') { + $this->awstats_delete($data, $web_config); + } + + if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { + $parent_domain_id = intval($data['old']['parent_domain_id']); + $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $parent_domain_id); $app->system->web_folder_protection($tmp['document_root'], true); + } + + if($is_chrooted) { + $app->services->restartServiceDelayed('httpd', 'restart'); + } else { + // request a httpd reload when all records have been processed + $app->services->restartServiceDelayed('httpd', 'reload'); + } + + //* Delete the web-backups + if($data['old']['type'] == 'vhost') { + $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); + $backup_dir = $server_config['backup_dir']; + $mount_backup = true; + if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') { + //* mount backup directory, if necessary + if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $mount_backup = false; + + if($mount_backup){ + $web_backup_dir = $backup_dir.'/web'.$data['old']['domain_id']; + //** do not use rm -rf $web_backup_dir because database(s) may exits + exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data['old']['domain_id'].'_').'*'); + //* cleanup database + $sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename LIKE ?"; + $app->db->query($sql, $conf['server_id'], $data['old']['domain_id'], "web".$data['old']['domain_id']."_%"); + if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $data['old']['domain_id'], "web".$data['old']['domain_id']."_%"); + + $app->log('Deleted the web backup files', LOGLEVEL_DEBUG); + } + } + } + } + if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true); + } + + //* This function is called when a IP on the server is inserted, updated or deleted or when anon_ip setting is altered + function eventServerIp($event_name, $data, $server_type = 'apache') { + global $app, $conf; + + if($server_type === 'nginx') { + // not yet implemented + return; + } + + // load the server configuration options + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate('apache_ispconfig.conf.master'); + $tpl->setVar('apache_version', $app->system->getapacheversion()); + $tpl->setVar('logging', $web_config['logging']); + $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); + $records = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ? AND virtualhost = 'y'", $conf['server_id']); + + $records_out= array(); + if(is_array($records)) { + foreach($records as $rec) { + if($rec['ip_type'] == 'IPv6') { + $ip_address = '['.$rec['ip_address'].']'; + } else { + $ip_address = $rec['ip_address']; + } + $ports = explode(',', $rec['virtualhost_port']); + if(is_array($ports)) { + foreach($ports as $port) { + $port = intval($port); + if($port > 0 && $port < 65536 && $ip_address != '') { + $records_out[] = array('ip_address' => $ip_address, 'port' => $port); + } + } + } + } + } + + + if(count($records_out) > 0) { + $tpl->setLoop('ip_adresses', $records_out); + } + + $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf'); + $app->system->file_put_contents($vhost_file, $tpl->grab()); + $app->log('Writing the conf file: '.$vhost_file, LOGLEVEL_DEBUG); + unset($tpl); + + } + + //* Create or update the .htaccess folder protection + public function eventWebFolderUser($event_name, $data, $server_type = 'apache') { + global $app; + + $app->uses('system'); + + if($event_name == 'web_folder_user_delete') { + $folder_id = $data['old']['web_folder_id']; + } else { + $folder_id = $data['new']['web_folder_id']; + } + + $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ?", $folder_id); + $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); + + if(!is_array($folder) or !is_array($website)) { + $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); + return false; + } + + $web_folder = 'web'; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; + + //* Get the folder path. + if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); + if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); + $folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']); + if(substr($folder_path, -1) != '/') $folder_path .= '/'; + + //* Check if the resulting path is inside the docroot + if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) { + $app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); + return false; + } + + //* Create the folder path, if it does not exist + if(!is_dir($folder_path)) { + $app->system->mkdirpath($folder_path, 0755, $website['system_user'], $website['system_group']); + } + + //* Create empty .htpasswd file, if it does not exist + if(!is_file($folder_path.'.htpasswd')) { + $app->system->touch($folder_path.'.htpasswd'); + $app->system->chmod($folder_path.'.htpasswd', 0751); + $app->system->chown($folder_path.'.htpasswd', $website['system_user']); + $app->system->chgrp($folder_path.'.htpasswd', $website['system_group']); + $app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); + } + + if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') { + $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); + $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); + } + + //* Add or remove the user from .htpasswd file + if($event_name == 'web_folder_user_delete') { + $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); + $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); + } else { + if($data['new']['active'] == 'y') { + $app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1); + $app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG); + } + } + + if($server_type === 'apache') { + //* Create the .htaccess file + //if(!is_file($folder_path.'.htaccess')) { + $begin_marker = '### ISPConfig folder protection begin ###'; + $end_marker = "### ISPConfig folder protection end ###\n\n"; + $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker; + + if(file_exists($folder_path.'.htaccess')) { + $old_content = $app->system->file_get_contents($folder_path.'.htaccess'); + + $matches = array(); + if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) { + $ht_file = str_replace($matches[0], $ht_file, $old_content); + } else { + $ht_file .= $old_content; + } + } + unset($old_content); + + $app->system->file_put_contents($folder_path.'.htaccess', $ht_file); + $app->system->chmod($folder_path.'.htaccess', 0751); + $app->system->chown($folder_path.'.htaccess', $website['system_user']); + $app->system->chgrp($folder_path.'.htaccess', $website['system_group']); + $app->log('Created/modified file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); + } else { + // write basic auth configuration to vhost file because nginx does not support .htaccess + $webdata['new'] = $webdata['old'] = $website; + $this->update('web_domain_update', $webdata); + } + + } + + //* Remove .htaccess and .htpasswd file, when folder protection is removed + public function eventWebFolderDelete($event_name, $data, $server_type = 'apache') { + global $app; + + $folder = $data['old']; + $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); + + if(!is_array($folder) or !is_array($website)) { + $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); + return false; + } + + $web_folder = 'web'; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; + + //* Get the folder path. + if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); + if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); + $folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']); + if(substr($folder_path, -1) != '/') $folder_path .= '/'; + + //* Check if the resulting path is inside the docroot + if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { + $app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG); + return false; + } + + //* Remove .htpasswd file + if(is_file($folder_path.'.htpasswd')) { + $app->system->unlink($folder_path.'.htpasswd'); + $app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); + } + + if($server_type === 'apache') { + //* Remove .htaccess file + if(is_file($folder_path.'.htaccess')) { + $begin_marker = '### ISPConfig folder protection begin ###'; + $end_marker = "### ISPConfig folder protection end ###\n\n"; + + $ht_file = $app->system->file_get_contents($folder_path.'.htaccess'); + + $matches = array(); + if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { + $ht_file = str_replace($matches[0], '', $ht_file); + } else { + $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file); + } + + if(trim($ht_file) == '') { + $app->system->unlink($folder_path.'.htaccess'); + $app->log('Removed file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); + } else { + $app->system->file_put_contents($folder_path.'.htaccess', $ht_file); + $app->log('Removed protection content from file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); + } + } + } else { + // write basic auth configuration to vhost file because nginx does not support .htaccess + $webdata['new'] = $webdata['old'] = $website; + $this->update('web_domain_update', $webdata); + } + } + + //* Update folder protection, when path has been changed + public function eventWebFolderUpdate($event_name, $data, $server_type = 'apache') { + global $app; + + $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + + if(!is_array($website)) { + $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); + return false; + } + + $web_folder = 'web'; + if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; + + //* Get the folder path. + if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1); + if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1); + $old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']); + if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/'; + + if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1); + if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1); + $new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']); + if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/'; + + //* Check if the resulting path is inside the docroot + if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) { + $app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); + return false; + } + if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) { + $app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); + return false; + } + + //* Check if the resulting path is inside the docroot + if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { + $app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); + return false; + } + if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { + $app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); + return false; + } + + //* Create the folder path, if it does not exist + if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path); + + $begin_marker = '### ISPConfig folder protection begin ###'; + $end_marker = "### ISPConfig folder protection end ###\n\n"; + + if($data['old']['path'] != $data['new']['path']) { + + + //* move .htpasswd file + if(is_file($old_folder_path.'.htpasswd')) { + $app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd'); + $app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG); + } + + if($server_type === 'apache') { + //* delete old .htaccess file + if(is_file($old_folder_path.'.htaccess')) { + $ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess'); + + $matches = array(); + if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { + $ht_file = str_replace($matches[0], '', $ht_file); + } else { + $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file); + } + + if(trim($ht_file) == '') { + $app->system->unlink($old_folder_path.'.htaccess'); + $app->log('Removed file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG); + } else { + $app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file); + $app->log('Removed protection content from file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG); + } + } + } + + } + + if($server_type === 'apache') { + //* Create the .htaccess file + if($data['new']['active'] == 'y') { + $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker; + + if(file_exists($new_folder_path.'.htaccess')) { + $old_content = $app->system->file_get_contents($new_folder_path.'.htaccess'); + + if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) { + $ht_file = str_replace($matches[0], $ht_file, $old_content); + } else { + $ht_file .= $old_content; + } + } + + $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file); + $app->system->chmod($new_folder_path.'.htaccess', 0751); + $app->system->chown($new_folder_path.'.htaccess', $website['system_user']); + $app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']); + $app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); + + //* Create empty .htpasswd file, if it does not exist + if(!is_file($new_folder_path.'.htpasswd')) { + $app->system->touch($new_folder_path.'.htpasswd'); + $app->system->chmod($new_folder_path.'.htpasswd', 0751); + $app->system->chown($new_folder_path.'.htpasswd', $website['system_user']); + $app->system->chgrp($new_folder_path.'.htpasswd', $website['system_group']); + $app->log('Created file '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG); + } + } + + //* Remove .htaccess file + if($data['new']['active'] == 'n' && is_file($new_folder_path.'.htaccess')) { + $ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess'); + + if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { + $ht_file = str_replace($matches[0], '', $ht_file); + } else { + $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file); + } + + if(trim($ht_file) == '') { + $app->system->unlink($new_folder_path.'.htaccess'); + $app->log('Removed file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); + } else { + $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file); + $app->log('Removed protection content from file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); + } + } + } else { + // write basic auth configuration to vhost file because nginx does not support .htaccess + $webdata['new'] = $webdata['old'] = $website; + $this->update('web_domain_update', $webdata); + } + } + + + //* Update the PHP-FPM pool configuration file + private function php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $server_type = 'apache') { + global $app, $conf; + $pool_dir = trim($pool_dir); + $rh_releasefiles = array('/etc/centos-release', '/etc/redhat-release'); + + if($data['new']['php'] == 'php-fpm'){ + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } else { + if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } + + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); + + if($data['new']['php'] != 'php-fpm'){ + if(@is_file($pool_dir.$pool_name.'.conf')){ + $app->system->unlink($pool_dir.$pool_name.'.conf'); + //$reload = true; + } + if($data['old']['php'] == 'php-fpm'){ + if(!$default_php_fpm){ + $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); + } else { + $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); + } + } + return; + } + + $app->load('tpl'); + $tpl = new tpl(); + $tpl->newTemplate('php_fpm_pool.conf.master'); + + if($data['new']['php_fpm_chroot'] == 'y'){ + $php_fpm_chroot = 1; + } else { + $php_fpm_chroot = 0; + } + if($server_type === 'apache') { + $tpl->setVar('apache_version', $app->system->getapacheversion()); + $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); + } + if($data['new']['php_fpm_use_socket'] == 'y'){ + $use_tcp = 0; + $use_socket = 1; + if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir); + } else { + $use_tcp = 1; + $use_socket = 0; + } + $tpl->setVar('use_tcp', $use_tcp); + $tpl->setVar('use_socket', $use_socket); + $fpm_socket = $socket_dir.$pool_name.'.sock'; + + $tpl->setVar('php_fpm_chroot', $php_fpm_chroot); + + $tpl->setVar('fpm_socket', $fpm_socket); + $tpl->setVar('fpm_listen_mode', '0660'); + + $tpl->setVar('fpm_pool', $pool_name); + $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); + $tpl->setVar('fpm_user', $data['new']['system_user']); + + //Red Hat workaround for group ownership of socket files + foreach($rh_releasefiles as $rh_file) { + if(file_exists($rh_file) && (filesize($rh_file) > 0)) { + $tmp = file_get_contents($rh_file); + if(preg_match('/[67]+\.[0-9]+/m', $tmp)) { + $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('fpm_listen_group', $data['new']['system_group']); + } + unset($tmp); + } elseif(!file_exists($rh_file)) { + //OS seems to be not Red Hat'ish + $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('fpm_listen_group', $web_config['group']); + } + break; + } + + $tpl->setVar('fpm_listen_user', $data['new']['system_user']); + $tpl->setVar('fpm_domain', $data['new']['domain']); + $tpl->setVar('pm', $data['new']['pm']); + $tpl->setVar('pm_max_children', $data['new']['pm_max_children']); + $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']); + $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']); + $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']); + $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']); + $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']); + $tpl->setVar('document_root', $data['new']['document_root']); + $tpl->setVar('security_level', $web_config['security_level']); + $tpl->setVar('domain', $data['new']['domain']); + $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']); + if($php_fpm_chroot){ + $document_root = $data['new']['document_root']; + $domain = $data['new']['domain']; + $php_open_basedir = str_replace(":/srv/www/$domain/web",'',$php_open_basedir); + $php_open_basedir = str_replace(":/var/www/$domain/web",'',$php_open_basedir); + $php_open_basedir = str_replace("$document_root",'',$php_open_basedir); + } + $tpl->setVar('php_open_basedir', $php_open_basedir); + if($php_open_basedir != ''){ + $tpl->setVar('enable_php_open_basedir', ''); + } else { + $tpl->setVar('enable_php_open_basedir', ';'); + } + + // Custom php.ini settings + $final_php_ini_settings = array(); + $custom_php_ini_settings = trim($data['new']['custom_php_ini']); + + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = ? AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id']), $server_type); + if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ + $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); + if(is_array($required_php_snippets) && !empty($required_php_snippets)){ + foreach($required_php_snippets as $required_php_snippet){ + $required_php_snippet = intval($required_php_snippet); + if($required_php_snippet > 0){ + $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); + $php_snippet['snippet'] = trim($php_snippet['snippet']); + if($php_snippet['snippet'] != ''){ + $custom_php_ini_settings .= "\n".$php_snippet['snippet']; + } + } + } + } + } + } + + $custom_session_save_path = false; + if($custom_php_ini_settings != ''){ + // Make sure we only have Unix linebreaks + $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); + $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); + $ini_settings = explode("\n", $custom_php_ini_settings); + if(is_array($ini_settings) && !empty($ini_settings)){ + foreach($ini_settings as $ini_setting){ + $ini_setting = trim($ini_setting); + if(substr($ini_setting, 0, 1) == ';') continue; + if(substr($ini_setting, 0, 1) == '#') continue; + if(substr($ini_setting, 0, 2) == '//') continue; + list($key, $value) = explode('=', $ini_setting, 2); + $value = trim($value); + if($value != ''){ + $key = trim($key); + if($key == 'session.save_path') $custom_session_save_path = true; + switch (strtolower($value)) { + case '0': + // PHP-FPM might complain about invalid boolean value if you use 0 + $value = 'off'; + case '1': + case 'on': + case 'off': + case 'true': + case 'false': + case 'yes': + case 'no': + $final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value); + break; + default: + $final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value); + } + } + } + } + } + + $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); + + $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); + + $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab()); + $app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); + unset($tpl); + + // delete pool in all other PHP versions + $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); + if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; + if($default_pool_dir != $pool_dir){ + if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { + $app->system->unlink($default_pool_dir.$pool_name.'.conf'); + $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); + $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); + } + } + $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $conf["server_id"]); + if(is_array($php_versions) && !empty($php_versions)){ + foreach($php_versions as $php_version){ + $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); + if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; + if($php_version['php_fpm_pool_dir'] != $pool_dir){ + if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { + $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); + $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); + $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); + } + } + } + } + // Reload current PHP-FPM after all others + sleep(1); + if(!$default_php_fpm){ + $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); + } else { + $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); + } + } + + //* Delete the PHP-FPM pool configuration file + private function php_fpm_pool_delete ($data, $web_config, $server_type = 'apache') { + global $app, $conf; + + if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){ + $default_php_fpm = false; + // $custom_php_fpm_name + list(, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + + if($default_php_fpm){ + $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); + } else { + $pool_dir = $custom_php_fpm_pool_dir; + } + $pool_dir = trim($pool_dir); + + if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; + $pool_name = 'web'.$data['old']['domain_id']; + + if ( @is_file($pool_dir.$pool_name.'.conf') ) { + $app->system->unlink($pool_dir.$pool_name.'.conf'); + $app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); + } + + // delete pool in all other PHP versions + $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); + if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; + if($default_pool_dir != $pool_dir){ + if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { + $app->system->unlink($default_pool_dir.$pool_name.'.conf'); + $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); + $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); + } + } + $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $data['old']['server_id']); + if(is_array($php_versions) && !empty($php_versions)){ + foreach($php_versions as $php_version){ + $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); + if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; + if($php_version['php_fpm_pool_dir'] != $pool_dir){ + if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { + $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); + $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); + $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); + } + } + } + } + + // Reload current PHP-FPM after all others + sleep(1); + if(!$default_php_fpm){ + $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); + } else { + $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); + } + } + + public function eventClientDelete($event_name, $data, $server_type = 'apache') { + global $app, $conf; + + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); + + $client_id = intval($data['old']['client_id']); + if($client_id > 0) { + + $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id; + if(is_dir($client_dir) && !stristr($client_dir, '..')) { + // remove symlinks from $client_dir + $files = array_diff(scandir($client_dir), array('.', '..')); + if(is_array($files) && !empty($files)){ + foreach($files as $file){ + if(is_link($client_dir.'/'.$file)){ + unlink($client_dir.'/'.$file); + $app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG); + } + } + } + + @rmdir($client_dir); + $app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG); + } + + if($app->system->is_group('client'.$client_id)){ + $app->system->_exec('groupdel client'.$client_id); + $app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG); + } + } + + } + + private function get_seo_redirects($web, $prefix = '', $force_subdomain = false, $server_type = 'apache'){ + $seo_redirects = array(); + + if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*'; + + if($server_type === 'apache') { + if($web['subdomain'] == 'www' || $web['subdomain'] == '*'){ + $domain = str_replace('.', '\.', $web['domain']); + if($web['seo_redirect'] == 'non_www_to_www'){ + $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $domain; + $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain']; + $seo_redirects[$prefix.'seo_redirect_operator'] = ''; + } + if($web['seo_redirect'] == '*_domain_tld_to_www_domain_tld'){ + $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $domain.'|.*\.'.$domain.'(?db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' ORDER BY subdomain ASC"); + if(is_array($webs) && !empty($webs)){ + foreach($webs as $web){ + // web domain doesn't match hostname + if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue; + // own vhost and therefore server {} container of its own + //if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') continue; + // alias domains/subdomains using rewrites and therefore a server {} container of their own + //if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue; + + if($web['subdomain'] == '*'){ + $pattern = '/\.?'.str_replace('.', '\.', $web['domain']).'$/i'; + } + if($web['subdomain'] == 'none'){ + if($web['domain'] == $hostname){ + if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ + // own vhost and therefore server {} container of its own + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; + // alias domains/subdomains using rewrites and therefore a server {} container of their own + if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; + return true; + } else { + return false; + } + } + $pattern = '/^'.str_replace('.', '\.', $web['domain']).'$/i'; + } + if($web['subdomain'] == 'www'){ + if($web['domain'] == $hostname || $web['subdomain'].'.'.$web['domain'] == $hostname){ + if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ + // own vhost and therefore server {} container of its own + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; + // alias domains/subdomains using rewrites and therefore a server {} container of their own + if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; + return true; + } else { + return false; + } + } + $pattern = '/^(www\.)?'.str_replace('.', '\.', $web['domain']).'$/i'; + } + if(preg_match($pattern, $hostname)){ + if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ + // own vhost and therefore server {} container of its own + if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; + // alias domains/subdomains using rewrites and therefore a server {} container of their own + if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; + return true; + } else { + return false; + } + } + } + } + + return false; + } + + private function nginx_replace($matches){ + $location = 'location'.($matches[1] != '' ? ' '.$matches[1] : '').' '.$matches[2].' '.$matches[3]; + if($matches[4] == '##merge##' || $matches[7] == '##merge##') $location .= ' ##merge##'; + if($matches[4] == '##delete##' || $matches[7] == '##delete##') $location .= ' ##delete##'; + $location .= "\n"; + $location .= $matches[5]."\n"; + $location .= $matches[6]; + return $location; + } + + private function nginx_merge_locations($vhost_conf) { + global $app, $conf; + + $subroot = array(); + if(preg_match('/##subroot (.+?)\s*##/', $vhost_conf, $subroot)) { + if(!preg_match('/^(?:[a-z0-9\/_-]|\.(?!\.))+$/iD', $subroot[1])) { + $app->log('Token ##subroot is unsecure (server ID: '.$conf['server_id'].').', LOGLEVEL_WARN); + } else { + $insert_pos = strpos($vhost_conf, ';', strpos($vhost_conf, 'root ')); + $vhost_conf = substr_replace($vhost_conf, ltrim($subroot[1], '/'), $insert_pos, 0); + } + } + + $lines = explode("\n", $vhost_conf); + + // if whole location block is in one line, split it up into multiple lines + if(is_array($lines) && !empty($lines)){ + $linecount = sizeof($lines); + for($h=0;$h<$linecount;$h++){ + // remove comments + if(substr(trim($lines[$h]), 0, 1) == '#'){ + unset($lines[$h]); + continue; + } + + $lines[$h] = rtrim($lines[$h]); + /* + if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], ';') !== false){ + $lines[$h] = str_replace("{", "{\n", $lines[$h]); + $lines[$h] = str_replace(";", ";\n", $lines[$h]); + if(strpos($lines[$h], '##merge##') !== false){ + $lines[$h] = str_replace('##merge##', '', $lines[$h]); + $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1); + } + } + if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], '}') !== false && strpos($lines[$h], ';') === false){ + $lines[$h] = str_replace("{", "{\n", $lines[$h]); + if(strpos($lines[$h], '##merge##') !== false){ + $lines[$h] = str_replace('##merge##', '', $lines[$h]); + $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1); + } + } + */ + $pattern = '/^[^\S\n]*location[^\S\n]+(?:(.+)[^\S\n]+)?(.+)[^\S\n]*(\{)[^\S\n]*(##merge##|##delete##)?[^\S\n]*(.+)[^\S\n]*(\})[^\S\n]*(##merge##|##delete##)?[^\S\n]*$/'; + $lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') , $lines[$h]); + } + } + $vhost_conf = implode("\n", $lines); + unset($lines); + unset($linecount); + + $lines = explode("\n", $vhost_conf); + + if(is_array($lines) && !empty($lines)){ + $locations = array(); + $locations_to_delete = array(); + $islocation = false; + $linecount = sizeof($lines); + $server_count = 0; + + for($i=0;$i<$linecount;$i++){ + $l = trim($lines[$i]); + if(substr($l, 0, 8) == 'server {') $server_count += 1; + if($server_count > 1) break; + if(substr($l, 0, 8) == 'location' && !$islocation){ + + $islocation = true; + $level = 0; + + // Remove unnecessary whitespace + $l = preg_replace('/\s\s+/', ' ', $l); + + $loc_parts = explode(' ', $l); + // see http://wiki.nginx.org/HttpCoreModule#location + if($loc_parts[1] == '=' || $loc_parts[1] == '~' || $loc_parts[1] == '~*' || $loc_parts[1] == '^~'){ + $location = $loc_parts[1].' '.$loc_parts[2]; + } else { + $location = $loc_parts[1]; + } + unset($loc_parts); + + if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace'; + if(substr($l, -9) == '##merge##') $locations[$location]['action'] = 'merge'; + if(substr($l, -10) == '##delete##') $locations[$location]['action'] = 'delete'; + + if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = ' location '.$location.' {'; + if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = ''; + if($locations[$location]['action'] == 'delete') $locations_to_delete[] = $location; + if(!isset($locations[$location]['end_tag'])) $locations[$location]['end_tag'] = ' }'; + if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i; + + unset($lines[$i]); + + } else { + + if($islocation){ + $openingbracketpos = strrpos($l, '{'); + if($openingbracketpos !== false){ + $level += 1; + } + $closingbracketpos = strrpos($l, '}'); + if($closingbracketpos !== false && $level > 0 && $closingbracketpos >= intval($openingbracketpos)){ + $level -= 1; + $locations[$location]['location'] .= $lines[$i]."\n"; + } elseif($closingbracketpos !== false && $level == 0 && $closingbracketpos >= intval($openingbracketpos)){ + $islocation = false; + } else { + $locations[$location]['location'] .= $lines[$i]."\n"; + } + unset($lines[$i]); + } + + } + } + + if(is_array($locations) && !empty($locations)){ + if(is_array($locations_to_delete) && !empty($locations_to_delete)){ + foreach($locations_to_delete as $location_to_delete){ + if(isset($locations[$location_to_delete])) unset($locations[$location_to_delete]); + } + } + + foreach($locations as $val){ + $new_location = $val['open_tag']."\n".$val['location'].$val['end_tag']; + $lines[$val['start_line']] = $new_location; + } + } + ksort($lines); + $vhost_conf = implode("\n", $lines); + } + + return trim($vhost_conf); + } + + + /** + * This function patches the vhost-file and adds all webdav - user. + * This function is written, because the creation of the vhost - file is sophisticated and + * i don't want to make it more "heavy" by also adding this code too... + * @author Oliver Vogel + * @param string $fileName The Name of the .vhost-File (path included) + * @param string $webdavRoot The root of the webdav-folder + */ + private function _patchVhostWebdav($fileName, $webdavRoot) { + global $app; + $in = fopen($fileName, 'r'); + $output = ''; + $inWebdavSection = false; + //* read line by line and search for the username and authname + while ($line = fgets($in)) { + //* is the "replace-comment" found... + if (trim($line) == '# WEBDAV BEGIN') { + //* The begin of the webdav - section is found, so ignore all lines til the end is found + $inWebdavSection = true; + $output .= "# WEBDAV BEGIN\n"; + //* add all the webdav-dirs to the webdav-section + $files = @scandir($webdavRoot); + if(is_array($files)) { + foreach($files as $file) { + if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/", $file)) { + //* found a htdigest - file, so add it to webdav + $fn = substr($file, 0, strlen($file) - strlen('.htdigest')); + $output .= "\n"; + $output .= "Alias /webdav/$fn $webdavRoot/$fn\n"; + $output .= "\n"; + $output .= "DAV On\n"; + $output .= "BrowserMatch MSIE AuthDigestEnableQueryStringHack=On\n"; + $output .= "AuthType Digest\n"; + if($fn != '' && $fn != '/') { + $output .= "AuthName \"" . $fn . "\"\n"; + } else { + $output .= "AuthName \"Restricted Area\"\n"; + } + $output .= "AuthUserFile $webdavRoot/$file\n"; + $output .= "Require valid-user\n"; + $output .= "Options +Indexes\n"; + $output .= "\n"; + } + } + } + } + //* is the "replace-comment-end" found... + if (trim($line) == '# WEBDAV END') { + //* The end of the webdav - section is found, so stop ignoring + $inWebdavSection = false; + } + //* Write the line to the output, if it is not in the section + if (!$inWebdavSection) { + $output .= $line; + } + } + fclose($in); + //* Now lets write the new file + $app->system->file_put_contents($fileName, $output); + } + + public function getWebFolder(&$data, $type, $use_old = false) { + global $app; + + $folder = $type; + + if($type === 'web' && $data['new']['type'] == 'vhost'){ + if($use_old === true) { + if($data['old']['web_folder'] != ''){ + if(substr($data['old']['web_folder'],0,1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],1); + if(substr($data['old']['web_folder'],-1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],0,-1); + } + $folder .= '/'.$data['old']['web_folder']; + } else { + if($data['new']['web_folder'] != ''){ + if(substr($data['new']['web_folder'],0,1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],1); + if(substr($data['new']['web_folder'],-1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],0,-1); + } + $folder .= '/'.$data['new']['web_folder']; + } + } elseif($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { + if($use_old === true) { + if(isset($data['old']['parent_domain_id'])) { + // old one + $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); + $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); + if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; + if($type === 'web') { + $folder = $data['old']['web_folder']; + } else { + $folder .= '/' . $subdomain_host; + } + unset($tmp); + } + } else { + // new one + $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['new']['parent_domain_id']); + $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); + if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; + if($type === 'web') { + $folder = $data['new']['web_folder']; + } else { + $folder .= '/' . $subdomain_host; + } + unset($tmp); + } + } + + return $folder; + } +} diff --git a/server/lib/classes/plugin_webserver_nginx.inc.php b/server/lib/classes/plugin_webserver_nginx.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..377c05fd455a22335d2b81259886246df9a939b1 --- /dev/null +++ b/server/lib/classes/plugin_webserver_nginx.inc.php @@ -0,0 +1,840 @@ +getconf->get_server_config($conf['server_id'], 'web'); + + // PHP-FPM + // Support for multiple PHP versions + if($data['new']['php'] == 'php-fpm'){ + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } else { + if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){ + $default_php_fpm = false; + list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); + if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; + } else { + $default_php_fpm = true; + } + } + + if($default_php_fpm){ + $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); + } else { + $pool_dir = $custom_php_fpm_pool_dir; + } + $pool_dir = trim($pool_dir); + if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; + $pool_name = 'web'.$data['new']['domain_id']; + $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']); + if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; + + if($data['new']['php_fpm_chroot'] == 'y'){ + $php_fpm_chroot = 1; + $php_fpm_nochroot = 0; + } else { + $php_fpm_chroot = 0; + $php_fpm_nochroot = 1; + } + if($data['new']['php_fpm_use_socket'] == 'y'){ + $use_tcp = 0; + $use_socket = 1; + } else { + $use_tcp = 1; + $use_socket = 0; + } + $tpl->setVar('use_tcp', $use_tcp); + $tpl->setVar('use_socket', $use_socket); + $tpl->setVar('php_fpm_chroot', $php_fpm_chroot); + $tpl->setVar('php_fpm_nochroot', $php_fpm_nochroot); + $fpm_socket = $socket_dir.$pool_name.'.sock'; + $tpl->setVar('fpm_socket', $fpm_socket); + $tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(), 1)).'.htm'); + $vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1; + + // backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support. + if($vhost_data['php'] == 'fast-cgi') $vhost_data['php'] = 'php-fpm'; + + return; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + */ + public function processRewriteRules(&$tpl, &$data, &$vhost_data) { + global $app, $conf; + + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + // Custom rewrite rules + $final_rewrite_rules = array(); + + if(isset($data['new']['rewrite_rules']) && trim($data['new']['rewrite_rules']) != '') { + $custom_rewrite_rules = trim($data['new']['rewrite_rules']); + $custom_rewrites_are_valid = true; + // use this counter to make sure all curly brackets are properly closed + $if_level = 0; + // Make sure we only have Unix linebreaks + $custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules); + $custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules); + $custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules); + if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){ + foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){ + // ignore comments + if(substr(ltrim($custom_rewrite_rule_line), 0, 1) == '#'){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // empty lines + if(trim($custom_rewrite_rule_line) == ''){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // rewrite + if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // if + if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + $if_level += 1; + continue; + } + // if - check for files, directories, etc. + if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + $if_level += 1; + continue; + } + // break + if(preg_match('@^\s*break\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // return code [ text ] + if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // return code URL + // return URL + if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // set + if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $custom_rewrite_rule_line)){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + continue; + } + // closing curly bracket + if(trim($custom_rewrite_rule_line) == '}'){ + $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); + $if_level -= 1; + continue; + } + $custom_rewrites_are_valid = false; + break; + } + } + if(!$custom_rewrites_are_valid || $if_level != 0){ + $final_rewrite_rules = array(); + } + } + $tpl->setLoop('rewrite_rules', $final_rewrite_rules); + + // Rewrite rules + $own_rewrite_rules = array(); + $rewrite_rules = array(); + $local_rewrite_rules = array(); + if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') { + if(substr($data['new']['redirect_path'], -1) != '/') $data['new']['redirect_path'] .= '/'; + if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){ + if($data['new']['redirect_type'] != 'proxy'){ + $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'], 8); + } else { + $data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'], 8); + } + } + + // Custom proxy directives + if($data['new']['redirect_type'] == 'proxy' && trim($data['new']['proxy_directives'] != '')){ + $final_proxy_directives = array(); + $proxy_directives = $data['new']['proxy_directives']; + // Make sure we only have Unix linebreaks + $proxy_directives = str_replace("\r\n", "\n", $proxy_directives); + $proxy_directives = str_replace("\r", "\n", $proxy_directives); + $proxy_directive_lines = explode("\n", $proxy_directives); + if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){ + foreach($proxy_directive_lines as $proxy_directive_line){ + $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line); + } + } + } else { + $final_proxy_directives = false; + } + + switch($data['new']['subdomain']) { + case 'www': + $exclude_own_hostname = ''; + if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); + break; + } + $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + } else { // URL - check if URL is local + $tmp_redirect_path = $data['new']['redirect_path']; + if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ + // URL is local + if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); + if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; + //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; + break; + } else { + $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + $exclude_own_hostname = $tmp_redirect_path_parts['host']; + } + } else { + // external URL + $rewrite_exclude = '(.?)/'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['use_proxy'] = 'y'; + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + } + unset($tmp_redirect_path); + unset($tmp_redirect_path_parts); + } + $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], + 'rewrite_target' => $data['new']['redirect_path'], + 'rewrite_exclude' => $rewrite_exclude, + 'rewrite_subdir' => $rewrite_subdir, + 'exclude_own_hostname' => $exclude_own_hostname, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); + break; + case '*': + $exclude_own_hostname = ''; + if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); + break; + } + $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + } else { // URL - check if URL is local + $tmp_redirect_path = $data['new']['redirect_path']; + if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + + //if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ + if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ + // URL is local + if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); + if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; + //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; + break; + } else { + $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + $exclude_own_hostname = $tmp_redirect_path_parts['host']; + } + } else { + // external URL + $rewrite_exclude = '(.?)/'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['use_proxy'] = 'y'; + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + } + unset($tmp_redirect_path); + unset($tmp_redirect_path_parts); + } + $own_rewrite_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], + 'rewrite_target' => $data['new']['redirect_path'], + 'rewrite_exclude' => $rewrite_exclude, + 'rewrite_subdir' => $rewrite_subdir, + 'exclude_own_hostname' => $exclude_own_hostname, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); + break; + default: + if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path + $exclude_own_hostname = ''; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); + break; + } + $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + } else { // URL - check if URL is local + $tmp_redirect_path = $data['new']['redirect_path']; + if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ + // URL is local + if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); + if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; + //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; + $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; + break; + } else { + $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + $exclude_own_hostname = $tmp_redirect_path_parts['host']; + } + } else { + // external URL + $rewrite_exclude = '(.?)/'; + if($data['new']['redirect_type'] == 'proxy'){ + $vhost_data['use_proxy'] = 'y'; + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + } + unset($tmp_redirect_path); + unset($tmp_redirect_path_parts); + } + $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), + 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], + 'rewrite_target' => $data['new']['redirect_path'], + 'rewrite_exclude' => $rewrite_exclude, + 'rewrite_subdir' => $rewrite_subdir, + 'exclude_own_hostname' => $exclude_own_hostname, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); + } + } + + $server_alias = array(); + $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); + $client_id = intval($client['client_id']); + unset($client); + + // get autoalias + $auto_alias = $web_config['website_autoalias']; + if($auto_alias != '') { + // get the client username + $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = ?", $client_id); + $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]'); + $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']); + $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias); + unset($client); + unset($aa_search); + unset($aa_replace); + $server_alias[] .= $auto_alias; + } + + // get alias domains (co-domains and subdomains) + $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ? AND active = 'y' AND (type != 'vhostsubdomain' AND type != 'vhostalias')", $data['new']['domain_id']); + $alias_seo_redirects = array(); + switch($data['new']['subdomain']) { + case 'www': + $server_alias[] = 'www.'.$data['new']['domain']; + break; + case '*': + $server_alias[] = '*.'.$data['new']['domain']; + break; + } + if(is_array($aliases)) { + foreach($aliases as $alias) { + switch($alias['subdomain']) { + case 'www': + $server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain']; + break; + case '*': + $server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain']; + break; + default: + $server_alias[] .= $alias['domain']; + break; + } + $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG); + + if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'], 0, 1) == '/') { + // Add SEO redirects for alias domains + if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', false, 'nginx'); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects[] = $tmp_seo_redirects; + } + } + } + + // Custom proxy directives + if($alias['redirect_type'] == 'proxy' && trim($alias['proxy_directives'] != '')){ + $final_proxy_directives = array(); + $proxy_directives = $alias['proxy_directives']; + // Make sure we only have Unix linebreaks + $proxy_directives = str_replace("\r\n", "\n", $proxy_directives); + $proxy_directives = str_replace("\r", "\n", $proxy_directives); + $proxy_directive_lines = explode("\n", $proxy_directives); + if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){ + foreach($proxy_directive_lines as $proxy_directive_line){ + $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line); + } + } + } else { + $final_proxy_directives = false; + } + + + // Local Rewriting (inside vhost server {} container) + if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') { // proxy makes no sense with local path + if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/'; + $rewrite_exclude = '(?!/('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; + switch($alias['subdomain']) { + case 'www': + // example.com + $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'], + 'local_redirect_operator' => '=', + 'local_redirect_exclude' => $rewrite_exclude, + 'local_redirect_target' => $alias['redirect_path'], + 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); + + // www.example.com + $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => 'www.'.$alias['domain'], + 'local_redirect_operator' => '=', + 'local_redirect_exclude' => $rewrite_exclude, + 'local_redirect_target' => $alias['redirect_path'], + 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); + break; + case '*': + $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$', + 'local_redirect_operator' => '~*', + 'local_redirect_exclude' => $rewrite_exclude, + 'local_redirect_target' => $alias['redirect_path'], + 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); + break; + default: + $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'], + 'local_redirect_operator' => '=', + 'local_redirect_exclude' => $rewrite_exclude, + 'local_redirect_target' => $alias['redirect_path'], + 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); + } + } + + // External Rewriting (extra server {} containers) + if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'], 0, 1) != '/') { + if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/'; + if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){ + if($alias['redirect_type'] != 'proxy'){ + $alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'], 8); + } else { + $alias['redirect_path'] = 'http'.substr($alias['redirect_path'], 8); + } + } + + switch($alias['subdomain']) { + case 'www': + if($alias['redirect_type'] == 'proxy'){ + $tmp_redirect_path = $alias['redirect_path']; + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + + if($alias['redirect_type'] != 'proxy'){ + if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); + } + // Add SEO redirects for alias domains + $alias_seo_redirects2 = array(); + if($alias['seo_redirect'] != ''){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none', 'nginx'); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects2[] = $tmp_seo_redirects; + } + } + $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'], + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], + 'rewrite_target' => $alias['redirect_path'], + 'rewrite_subdir' => $rewrite_subdir, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), + 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); + + // Add SEO redirects for alias domains + $alias_seo_redirects2 = array(); + if($alias['seo_redirect'] != ''){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www', 'nginx'); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects2[] = $tmp_seo_redirects; + } + } + $rewrite_rules[] = array( 'rewrite_domain' => 'www.'.$alias['domain'], + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], + 'rewrite_target' => $alias['redirect_path'], + 'rewrite_subdir' => $rewrite_subdir, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), + 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); + break; + case '*': + if($alias['redirect_type'] == 'proxy'){ + $tmp_redirect_path = $alias['redirect_path']; + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + + if($alias['redirect_type'] != 'proxy'){ + if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); + } + // Add SEO redirects for alias domains + $alias_seo_redirects2 = array(); + if($alias['seo_redirect'] != ''){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', false, 'nginx'); + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects2[] = $tmp_seo_redirects; + } + } + $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'].' *.'.$alias['domain'], + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], + 'rewrite_target' => $alias['redirect_path'], + 'rewrite_subdir' => $rewrite_subdir, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), + 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); + break; + default: + if($alias['redirect_type'] == 'proxy'){ + $tmp_redirect_path = $alias['redirect_path']; + $tmp_redirect_path_parts = parse_url($tmp_redirect_path); + $rewrite_subdir = $tmp_redirect_path_parts['path']; + if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); + if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; + if($rewrite_subdir == '/') $rewrite_subdir = ''; + } + + if($alias['redirect_type'] != 'proxy'){ + if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); + } + if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2); + else $domain_rule = $alias['domain']; + // Add SEO redirects for alias domains + $alias_seo_redirects2 = array(); + if($alias['seo_redirect'] != ''){ + if(substr($alias['domain'], 0, 2) === '*.'){ + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', false, 'nginx'); + } else { + $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none', 'nginx'); + } + if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ + $alias_seo_redirects2[] = $tmp_seo_redirects; + } + } + $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule, + 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], + 'rewrite_target' => $alias['redirect_path'], + 'rewrite_subdir' => $rewrite_subdir, + 'proxy_directives' => $final_proxy_directives, + 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), + 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), + 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); + } + } + } + } + + //* If we have some alias records + if(count($server_alias) > 0) { + $server_alias_str = ''; + foreach($server_alias as $tmp_alias) { + $server_alias_str .= ' ' . $tmp_alias; + } + unset($tmp_alias); + + $tpl->setVar('alias', trim($server_alias_str)); + } else { + $tpl->setVar('alias', ''); + } + + if(count($rewrite_rules) > 0) { + $tpl->setLoop('redirects', $rewrite_rules); + } + if(count($own_rewrite_rules) > 0) { + $tpl->setLoop('own_redirects', $own_rewrite_rules); + } + if(count($local_rewrite_rules) > 0) { + $tpl->setLoop('local_redirects', $local_rewrite_rules); + } + if(count($alias_seo_redirects) > 0) { + $tpl->setLoop('alias_seo_redirects', $alias_seo_redirects); + } + return; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + * @param array $fpm_data + */ + public function processCustomDirectives(&$tpl, &$data, &$vhost_data, $fpm_data) { + global $app, $conf; + + // Custom nginx directives + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", $data['new']['directive_snippets_id']); + if(isset($snippet['snippet'])){ + $nginx_directives = $snippet['snippet']; + } else { + $nginx_directives = $data['new']['nginx_directives']; + } + } else { + $nginx_directives = $data['new']['nginx_directives']; + } + + $final_nginx_directives = array(); + if($data['new']['enable_pagespeed'] == 'y'){ + // if PageSpeed is already enabled, don't add configuration again + if(stripos($nginx_directives, 'pagespeed') !== false){ + $vhost_data['enable_pagespeed'] = false; + } else { + $vhost_data['enable_pagespeed'] = true; + } + } else { + $vhost_data['enable_pagespeed'] = false; + } + + $web_folder = $app->plugin_webserver_base->getWebFolder($data, 'web'); + $username = escapeshellcmd($data['new']['system_user']); + $groupname = escapeshellcmd($data['new']['system_group']); + + // folder_directive_snippets + if(trim($data['new']['folder_directive_snippets']) != ''){ + $data['new']['folder_directive_snippets'] = trim($data['new']['folder_directive_snippets']); + $data['new']['folder_directive_snippets'] = str_replace("\r\n", "\n", $data['new']['folder_directive_snippets']); + $data['new']['folder_directive_snippets'] = str_replace("\r", "\n", $data['new']['folder_directive_snippets']); + $folder_directive_snippets_lines = explode("\n", $data['new']['folder_directive_snippets']); + + if(is_array($folder_directive_snippets_lines) && !empty($folder_directive_snippets_lines)){ + foreach($folder_directive_snippets_lines as $folder_directive_snippets_line){ + list($folder_directive_snippets_folder, $folder_directive_snippets_snippets_id) = explode(':', $folder_directive_snippets_line); + + $folder_directive_snippets_folder = trim($folder_directive_snippets_folder); + $folder_directive_snippets_snippets_id = trim($folder_directive_snippets_snippets_id); + + if($folder_directive_snippets_folder != '' && intval($folder_directive_snippets_snippets_id) > 0 && preg_match('@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', $folder_directive_snippets_folder)){ + if(substr($folder_directive_snippets_folder, -1) != '/') $folder_directive_snippets_folder .= '/'; + if(substr($folder_directive_snippets_folder, 0, 1) == '/') $folder_directive_snippets_folder = substr($folder_directive_snippets_folder, 1); + + $master_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($folder_directive_snippets_snippets_id)); + if(isset($master_snippet['snippet'])){ + $folder_directive_snippets_trans = array('{FOLDER}' => $folder_directive_snippets_folder, '{FOLDERMD5}' => md5($folder_directive_snippets_folder)); + $master_snippet['snippet'] = strtr($master_snippet['snippet'], $folder_directive_snippets_trans); + $nginx_directives .= "\n\n".$master_snippet['snippet']; + + // create folder it it does not exist + if(!is_dir($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder)){ + $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder); + $app->system->chown($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $username); + $app->system->chgrp($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $groupname); + } + } + } + } + } + } + + // use vLib for template logic + if(trim($nginx_directives) != '') { + $nginx_directives_new = ''; + $ngx_conf_tpl = new tpl(); + $ngx_conf_tpl_tmp_file = tempnam($conf['temppath'], "ngx"); + file_put_contents($ngx_conf_tpl_tmp_file, $nginx_directives); + $ngx_conf_tpl->newTemplate($ngx_conf_tpl_tmp_file); + $ngx_conf_tpl->setVar('use_tcp', $fpm_data['use_tcp']); + $ngx_conf_tpl->setVar('use_socket', $fpm_data['use_socket']); + $ngx_conf_tpl->setVar('fpm_socket', $fpm_data['fpm_socket']); + $ngx_conf_tpl->setVar($vhost_data); + $nginx_directives_new = $ngx_conf_tpl->grab(); + if(is_file($ngx_conf_tpl_tmp_file)) unlink($ngx_conf_tpl_tmp_file); + if($nginx_directives_new != '') $nginx_directives = $nginx_directives_new; + unset($nginx_directives_new); + } + + // Make sure we only have Unix linebreaks + $nginx_directives = str_replace("\r\n", "\n", $nginx_directives); + $nginx_directives = str_replace("\r", "\n", $nginx_directives); + $nginx_directive_lines = explode("\n", $nginx_directives); + if(is_array($nginx_directive_lines) && !empty($nginx_directive_lines)){ + $trans = array( + '{DOCROOT}' => $vhost_data['web_document_root_www'], + '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'], + '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_data['fpm_socket'] : '127.0.0.1:'.$fpm_data['fpm_port']).';' + ); + foreach($nginx_directive_lines as $nginx_directive_line){ + $final_nginx_directives[] = array('nginx_directive' => strtr($nginx_directive_line, $trans)); + } + } + $tpl->setLoop('nginx_directives', $final_nginx_directives); + + return; + } + + + public function getStatsFolder($data) { + $stats_web_folder = 'web'; + if($data['new']['type'] == 'vhost'){ + if($data['new']['web_folder'] != ''){ + if(substr($data['new']['web_folder'], 0, 1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],1); + if(substr($data['new']['web_folder'], -1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],0,-1); + } + $stats_web_folder .= '/'.$data['new']['web_folder']; + } elseif($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { + $stats_web_folder = $data['new']['web_folder']; + } + return $stats_web_folder; + } + + /** + * This method may alter the $tpl template as well as $data and/or $vhost_data array! + * + * @param tpl $tpl + * @param array $data + * @param array $vhost_data + */ + public function processStatsAuth(&$tpl, &$data, &$vhost_data) { + + $stats_web_folder = $this->getStatsFolder($data); + + //* Create basic http auth for website statistics + $tpl->setVar('stats_auth_passwd_file', $data['new']['document_root']."/" . $stats_web_folder . "/stats/.htpasswd_stats"); + + // Create basic http auth for other directories + $basic_auth_locations = $this->_create_web_folder_auth_configuration($data['new']); + if(is_array($basic_auth_locations) && !empty($basic_auth_locations)) $tpl->setLoop('basic_auth_locations', $basic_auth_locations); + + return; + } + + private function _create_web_folder_auth_configuration($website){ + global $app; + + //* Create the domain.auth file which is included in the vhost configuration file + + $website_auth_locations = $app->db->queryAllRecords("SELECT * FROM web_folder WHERE active = 'y' AND parent_domain_id = ?", $website['domain_id']); + $basic_auth_locations = array(); + if(is_array($website_auth_locations) && !empty($website_auth_locations)){ + foreach($website_auth_locations as $website_auth_location){ + if(substr($website_auth_location['path'], 0, 1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 1); + if(substr($website_auth_location['path'], -1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 0, -1); + if($website_auth_location['path'] != ''){ + $website_auth_location['path'] .= '/'; + } + $basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'], + 'htpasswd_path' => $website['document_root'].'/' . (($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']); + } + } + return $basic_auth_locations; + } + + public function testWebserverConfig() { + global $app; + + // if no output is given, check again + $tmp_output = null; + $tmp_retval = 0; + exec('nginx -t 2>&1', $tmp_output, $tmp_retval); + if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){ + $app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN); + $app->dbmaster->datalogError(implode("\n", $tmp_output)); + } + unset($tmp_output, $tmp_retval); + } +} diff --git a/server/lib/classes/plugins.inc.php b/server/lib/classes/plugins.inc.php index 9b9b143776d3e4ffe390cc73406c96fef4ae0b6c..b56f69608e7bc03ad4b92c18975f9382ac275a87 100644 --- a/server/lib/classes/plugins.inc.php +++ b/server/lib/classes/plugins.inc.php @@ -156,7 +156,13 @@ class plugins { $state = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $action_name, $data); //* ensure that we return the highest warning / error level if a error occured in one of the functions if($return_data) { - if($state) $result .= $state; + if($state) { + if(is_array($state) && (!$result || is_array($result))) { + $result = array_merge($result, $state); + } elseif(!is_array($state)) { + $result .= $state; + } + } } else { if($state == 'warning' && $state_out != 'error') $state_out = 'warning'; elseif($state == 'error') $state_out = 'error'; diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index f4d94743a16c82903215378d2aac5993a4a05af9..dc5a8dde8aa7e03822c2891c2a25243a08fe8a6a 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -1639,29 +1639,15 @@ class system{ //* Add the subfolder to the subscriptions and courierimapsubscribed files if($subfolder != '') { - // Courier - if($mail_config['pop3_imap_daemon'] == 'courier') { - if(!is_file($maildir_path.'/courierimapsubscribed')) { - $tmp_file = escapeshellcmd($maildir_path.'/courierimapsubscribed'); - touch($tmp_file); - chmod($tmp_file, 0744); - chown($tmp_file, 'vmail'); - chgrp($tmp_file, 'vmail'); - } - $this->replaceLine($maildir_path.'/courierimapsubscribed', 'INBOX.'.$subfolder, 'INBOX.'.$subfolder, 1, 1); - } - // Dovecot - if($mail_config['pop3_imap_daemon'] == 'dovecot') { - if(!is_file($maildir_path.'/subscriptions')) { - $tmp_file = escapeshellcmd($maildir_path.'/subscriptions'); - touch($tmp_file); - chmod($tmp_file, 0744); - chown($tmp_file, 'vmail'); - chgrp($tmp_file, 'vmail'); - } - $this->replaceLine($maildir_path.'/subscriptions', $subfolder, $subfolder, 1, 1); + if(!is_file($maildir_path.'/subscriptions')) { + $tmp_file = escapeshellcmd($maildir_path.'/subscriptions'); + touch($tmp_file); + chmod($tmp_file, 0744); + chown($tmp_file, 'vmail'); + chgrp($tmp_file, 'vmail'); } + $this->replaceLine($maildir_path.'/subscriptions', $subfolder, $subfolder, 1, 1); } $app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder, LOGLEVEL_DEBUG); @@ -1686,14 +1672,24 @@ class system{ } - function _exec($command) { + function _exec($command, $return_codes_ok = null) { global $app; + + if(!is_null($return_codes_ok) && !is_array($return_codes_ok)) { + $return_codes_ok = array($return_codes_ok); + } + $out = array(); $ret = 0; $app->log('exec: '.$command, LOGLEVEL_DEBUG); exec($command, $out, $ret); - if($ret != 0) return false; - else return true; + if($ret == 0) { + return true; + } elseif(is_array($return_codes_ok) && !empty($return_codes_ok) && in_array($ret, $return_codes_ok)) { + return true; + } else { + return false; + } } //* Check if a application is installed @@ -1945,20 +1941,20 @@ class system{ elseif($this->is_installed('apachectl')) $cmd = 'apachectl -v'; else { $app->log("Could not check apache version, apachectl not found.", LOGLEVEL_DEBUG); - return '2.2'; + return '2.4'; } exec($cmd, $output, $return_var); if($return_var != 0 || !$output[0]) { $app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN); - return '2.2'; + return '2.4'; } if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) { return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : ''); } else { $app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN); - return '2.2'; + return '2.4'; } } @@ -2048,7 +2044,32 @@ class system{ return true; } + + public function tempdir($parent_path = null, $prefix = 'tmp_', $mode = 0700) { + if(is_null($parent_path)) { + $parent_path = sys_get_temp_dir(); + } + + $parent_path = rtrim($parent_path, '/'); + if(!is_dir($parent_path) || !is_writable($parent_path)) { + return false; + } + + if(strpbrk($prefix, '\\/:*?"<>|') !== false) { + return false; + } + + $path = false; + $tries = 0; + while($tries < 1000) { + $tries++; + $path = $parent_path . FS_DIV . uniqid($prefix, true); + if(mkdir($path, $mode)) { + break; + } + } + + return $path; + } } - -?> diff --git a/server/mods-available/mail_module.inc.php b/server/mods-available/mail_module.inc.php index 8460d5d96a6f1a7b58cdee2837840f72378e5038..ded0900752d9049a6c3ac2e6d4ec77fb87b88499 100644 --- a/server/mods-available/mail_module.inc.php +++ b/server/mods-available/mail_module.inc.php @@ -53,12 +53,12 @@ class mail_module { 'mail_content_filter_insert', 'mail_content_filter_update', 'mail_content_filter_delete', - 'mail_mailinglist_insert', - 'mail_mailinglist_update', - 'mail_mailinglist_delete', - 'mail_ml_member_insert', - 'mail_ml_member_update', - 'mail_ml_member_delete'); + 'spamfilter_users_insert', + 'spamfilter_users_update', + 'spamfilter_users_delete', + 'spamfilter_wblist_insert', + 'spamfilter_wblist_update', + 'spamfilter_wblist_delete'); //* This function is called during ispconfig installation to determine // if a symlink shall be created for this plugin. @@ -104,9 +104,11 @@ class mail_module { $app->modules->registerTableHook('mail_user', 'mail_module', 'process'); $app->modules->registerTableHook('mail_get', 'mail_module', 'process'); $app->modules->registerTableHook('mail_content_filter', 'mail_module', 'process'); - $app->modules->registerTableHook('mail_mailinglist', 'mail_module', 'process'); - $app->modules->registerTableHook('mail_ml_membership', 'mail_module', 'process'); + $app->modules->registerTableHook('spamfilter_users', 'mail_module', 'process'); + $app->modules->registerTableHook('spamfilter_wblist', 'mail_module', 'process'); + + $app->services->registerService('rspamd', 'mail_module', 'restartRspamd'); } /* @@ -153,19 +155,36 @@ class mail_module { if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete', $data); break; - case 'mail_mailinglist': - if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update', $data); - if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete', $data); + case 'spamfilter_users': + if($action == 'i') $app->plugins->raiseEvent('spamfilter_users_insert', $data); + if($action == 'u') $app->plugins->raiseEvent('spamfilter_users_update', $data); + if($action == 'd') $app->plugins->raiseEvent('spamfilter_users_delete', $data); break; - case 'mail_ml_membership': - if($action == 'i') $app->plugins->raiseEvent('mail_ml_member_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('mail_ml_member_update', $data); - if($action == 'd') $app->plugins->raiseEvent('mail_ml_member_delete', $data); + case 'spamfilter_wblist': + if($action == 'i') $app->plugins->raiseEvent('spamfilter_wblist_insert', $data); + if($action == 'u') $app->plugins->raiseEvent('spamfilter_wblist_update', $data); + if($action == 'd') $app->plugins->raiseEvent('spamfilter_wblist_delete', $data); break; } // end switch } // end function + function restartRspamd($action = 'reload') { + global $app; + + $app->uses('system'); + + $daemon = 'rspamd'; + + $retval = array('output' => '', 'retval' => 0); + if($action == 'restart') { + exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']); + } else { + exec($app->system->getinitcommand($daemon, 'reload').' 2>&1', $retval['output'], $retval['retval']); + } + return $retval; + } + + } // end class ?> diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php deleted file mode 100644 index 15e9d279e9e4952a405e937859a60add020afe3e..0000000000000000000000000000000000000000 --- a/server/mods-available/remoteaction_core_module.inc.php +++ /dev/null @@ -1,248 +0,0 @@ -_execActions(); - } - - /* - This function is called when a change in one of the registered tables is detected. - The function then raises the events for the plugins. - */ - function process($tablename, $action, $data) { - // not needed - } // end function - - private function _actionDone($id, $state) { - /* - * First set the state - */ - global $app; - $sql = "UPDATE sys_remoteaction SET action_state = ? WHERE action_id = ?"; - $app->dbmaster->query($sql, $state, $id); - - /* - * Then save the maxid for the next time... - */ - $fp = fopen(dirname(__FILE__) . "/../lib/remote_action.inc.php", 'wb'); - $content = '"; - fwrite($fp, $content); - fclose($fp); - } - - - /** - * This method searches for scheduled actions and exec then - */ - - - private function _execActions() { - global $app; - global $conf; - - /* the id of the server as int */ - $server_id = intval($conf["server_id"]); - - /* - * First we (till and i, oliver) thought, it was enough to write - * "select from where action_status = 'pending'" and then execute this actions. - * But it is not! - * If a hacker can hack into a server, she can change the valus of action_status - * and so re-exec a action, executed some days bevore. So she can (for example) - * stop a service, a admin stopped some days before! To avoid this, we ignore - * the status (it is only for the interface to show) and use our own maxid - */ - include_once SCRIPT_PATH."/lib/remote_action.inc.php"; - - /* - * Get all actions this server should execute - */ - $sql = "SELECT action_id, action_type, action_param FROM sys_remoteaction WHERE server_id = ? AND action_id > ? ORDER BY action_id"; - $actions = $app->dbmaster->queryAllRecords($sql, $server_id, $maxid_remote_action); - - /* - * process all actions - */ - if(is_array($actions)) { - foreach ($actions as $action) { - if ($action['action_type'] == 'os_update') { - /* do the update */ - $this->_doOsUpdate($action); - /* this action takes so much time, - * we stop executing the actions not to waste more time */ - return; - } - - if ($action['action_type'] == 'ispc_update') { - /* do the update */ - // Update function has been removed - // $this->_doIspCUpdate($action); - /* this action takes so much time, - * we stop executing the actions not to waste more time */ - $this->_actionDone($action['action_id'], 'ok'); - } - if ($action['action_type'] == 'openvz_start_vm') { - $veid = intval($action['action_param']); - if($veid > 0) { - exec("vzctl start $veid"); - } - $this->_actionDone($action['action_id'], 'ok'); - } - if ($action['action_type'] == 'openvz_stop_vm') { - $veid = intval($action['action_param']); - if($veid > 0) { - exec("vzctl stop $veid"); - } - $this->_actionDone($action['action_id'], 'ok'); - } - if ($action['action_type'] == 'openvz_restart_vm') { - $veid = intval($action['action_param']); - if($veid > 0) { - exec("vzctl restart $veid"); - } - $this->_actionDone($action['action_id'], 'ok'); - } - if ($action['action_type'] == 'openvz_create_ostpl') { - $parts = explode(':', $action['action_param']); - $veid = intval($parts[0]); - $template_cache_dir = '/vz/template/cache/'; - $template_name = escapeshellcmd($parts[1]); - if($veid > 0 && $template_name != '' && is_dir($template_cache_dir)) { - $command = "vzdump --suspend --compress --stdexcludes --dumpdir $template_cache_dir $veid"; - exec($command); - exec("mv ".$template_cache_dir."vzdump-openvz-".$veid."*.tgz ".$template_cache_dir.$template_name.".tar.gz"); - exec("rm -f ".$template_cache_dir."vzdump-openvz-".$veid."*.log"); - } - $this->_actionDone($action['action_id'], 'ok'); - /* this action takes so much time, - * we stop executing the actions not to waste more time */ - return; - } - - - } - } - } - - private function _doOsUpdate($action) { - /* - * Do the update - */ - //Guess this is not wanted here? - //exec("aptitude update"); - //exec("aptitude safe-upgrade -y"); - - //TODO : change this when distribution information has been integrated into server record - if(file_exists('/etc/gentoo-release')) { - exec("glsa-check -f --nocolor affected"); - } - else { - exec("apt-get update"); - exec("apt-get -y upgrade"); - } - - /* - * All well done! - */ - $this->_actionDone($action['action_id'], 'ok'); - } - - private function _doIspCUpdate($action) { - - // Ensure that this code is not executed twice as this would cause a loop in case of a failure - $this->_actionDone($action['action_id'], 'ok'); - - /* - * Get the version-number of the newest version - */ - $new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt'); - $new_version = trim($new_version); - - /* - * Do the update - */ - - /* jump into the temporary dir */ - $oldDir = getcwd(); - chdir("/tmp"); - - /* delete the old files (if there are any...) */ - exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz"); - exec("rm /tmp/ispconfig3_install -R"); - - /* get the newest version */ - exec("wget http://www.ispconfig.org/downloads/ISPConfig-" . $new_version . ".tar.gz"); - - /* extract the files */ - exec("tar xvfz ISPConfig-" . $new_version . ".tar.gz"); - - /* - * Initialize the automated update - * (the update is then done next start of server.sh - */ - chdir("/tmp/ispconfig3_install/install"); - exec("touch autoupdate"); - - /* - * do some clean-up - */ - exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz"); - - /* - * go back to the "old path" - */ - chdir($oldDir); - - /* - * All well done! - */ - //$this->_actionDone($action['action_id'], 'ok'); - } - -} - -?> diff --git a/server/mods-available/rescue_core_module.inc.php b/server/mods-available/rescue_core_module.inc.php index 5e8f3db9ce5aef12d38a956b2668f691ac797e6d..a434a63a62d8b9202554238bf32b2d0aeb77527f 100644 --- a/server/mods-available/rescue_core_module.inc.php +++ b/server/mods-available/rescue_core_module.inc.php @@ -94,11 +94,6 @@ class rescue_core_module { */ $this->_rescueData = $this->_getRescueData(); - /* - * rescue MongoDB if needed - */ -// $this->_rescueMongoDB(); - /* * rescue mysql if needed (maybe httpd depends on mysql, so try this first!) */ @@ -311,73 +306,6 @@ class rescue_core_module { $this->_rescueDaemon($daemon); } - - /** - * restarts MongoDB, if needed - */ -// private function _rescueMongoDB(){ -// global $app, $conf; - - /* - * do nothing, if it is not allowed to rescue mysql - */ -// if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){ -// return; -// } - - /* - * if the service is up and running, or the service is not installed there is nothing to do... - */ -// if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){ -// /* Clear the try counter, because we do not have to try to rescue the service */ -// $this->_rescueData['mongodbserver']['try_counter'] = 0; -// return; -// } - - /* - * OK, the service is installed and down. - * Maybe this is because of a restart of the service by the admin. - * This means, we check the data 1 minute ago - */ -// if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) || -// ((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){ - /* - * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago. - * This means, it could be, that the admin is restarting the server. - * We wait one more minute... - */ -// return; -// } - - /*##### - * The service is down and it was down 1 minute ago. - * We try to rescue it - *#####*/ - - /* Get the try counter */ -// $tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1; - - /* Set the new try counter */ -// $this->_rescueData['mongodbserver']['try_counter'] = $tryCount; - - /* if 5 times will not work, we have to give up... */ -// if ($tryCount > 5){ -// $app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR); -// return; -// } - - -// $app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN); - -// if(is_file($conf['init_scripts'] . '/' . 'mongodb')) { -// $daemon = 'mongodb'; -// } else { -// $daemon = 'mongodb'; -// } - -// $this->_rescueDaemon($daemon); -// } - /** * restarts mysql, if needed */ diff --git a/server/mods-available/vm_module.inc.php b/server/mods-available/vm_module.inc.php deleted file mode 100644 index b3c636d6526c65ab212fd02c5a58525863c9fba5..0000000000000000000000000000000000000000 --- a/server/mods-available/vm_module.inc.php +++ /dev/null @@ -1,118 +0,0 @@ -plugins->announceEvents($this->module_name, $this->actions_available); - - /* - As we want to get notified of any changes on several database tables, - we register for them. - - The following function registers the function "functionname" - to be executed when a record for the table "dbtable" is - processed in the sys_datalog. "classname" is the name of the - class that contains the function functionname. - */ - - $app->modules->registerTableHook('openvz_vm', $this->module_name, 'process'); - $app->modules->registerTableHook('openvz_ip', $this->module_name, 'process'); - $app->modules->registerTableHook('openvz_ostemplate', $this->module_name, 'process'); - - } - - /* - This function is called when a change in one of the registered tables is detected. - The function then raises the events for the plugins. - */ - - function process($tablename, $action, $data) { - global $app; - - switch ($tablename) { - case 'openvz_vm': - if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update', $data); - if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete', $data); - break; - case 'openvz_ip': - if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update', $data); - if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete', $data); - break; - case 'openvz_ostemplate': - if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update', $data); - if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete', $data); - break; - } // end switch - } // end function - - -} // end class - -?> diff --git a/server/mods-available/xmpp_module.inc.php b/server/mods-available/xmpp_module.inc.php deleted file mode 100644 index f24f349aed37ee1e4596c637d4d064236f320ef9..0000000000000000000000000000000000000000 --- a/server/mods-available/xmpp_module.inc.php +++ /dev/null @@ -1,132 +0,0 @@ -plugins->announceEvents($this->module_name, $this->actions_available); - - /* - As we want to get notified of any changes on several database tables, - we register for them. - - The following function registers the function "functionname" - to be executed when a record for the table "dbtable" is - processed in the sys_datalog. "classname" is the name of the - class that contains the function functionname. - */ - - $app->modules->registerTableHook('xmpp_domain', 'xmpp_module', 'process'); - $app->modules->registerTableHook('xmpp_user', 'xmpp_module', 'process'); - $app->services->registerService('xmpp', 'xmpp_module', 'reloadXMPP'); - $app->services->registerService('xmpp', 'xmpp_module', 'restartXMPP'); - - } - - /* - This function is called when a change in one of the registered tables is detected. - The function then raises the events for the plugins. - */ - - function process($tablename, $action, $data) { - global $app; - - switch ($tablename) { - case 'xmpp_domain': - if($action == 'i') $app->plugins->raiseEvent('xmpp_domain_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('xmpp_domain_update', $data); - if($action == 'd') $app->plugins->raiseEvent('xmpp_domain_delete', $data); - break; - case 'xmpp_user': - if($action == 'i') $app->plugins->raiseEvent('xmpp_user_insert', $data); - if($action == 'u') $app->plugins->raiseEvent('xmpp_user_update', $data); - if($action == 'd') $app->plugins->raiseEvent('xmpp_user_delete', $data); - break; - } // end switch - } // end function - - - function restartXMPP($action = 'restart') { - global $app, $conf; - - // load the server configuration options - $app->uses('getconf,system'); - - $xmpp_config = $app->getconf->get_server_config($conf['server_id'], 'xmpp'); - $daemon = $xmpp_config['xmpp_daemon']; - - $retval = array('output' => '', 'retval' => 0); - if($action == 'restart') { - $cmd = $app->system->getinitcommand($daemon, 'restart'); - } else { - $cmd = $app->system->getinitcommand($daemon, 'reload'); - } - exec($cmd.' 2>&1', $retval['output'], $retval['retval']); - $app->log("Restarting xmpp: $cmd", LOGLEVEL_DEBUG); - return $retval; - } -} // end class - -?> diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index cbf9f209683980fe2a04682e6222abf91a368883..ccb7a81e0137245ee00e8822ed8413ddb8a88025 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -30,2546 +30,123 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class apache2_plugin { - var $plugin_name = 'apache2_plugin'; - var $class_name = 'apache2_plugin'; + var $plugin_name; + var $class_name; // private variables var $action = ''; var $ssl_certificate_changed = false; var $update_letsencrypt = false; - //* This function is called during ispconfig installation to determine - // if a symlink shall be created for this plugin. - function onInstall() { - global $conf; - - if($conf['services']['web'] == true) { - return true; - } else { - return false; - } - - } - - - /* - This function is called when the plugin is loaded - */ - - function onLoad() { - global $app; - - /* - Register for the events - */ - $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl'); - $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl'); - $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl'); - - $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert'); - $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update'); - $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete'); - - $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip'); - $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip'); - $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip'); - - $app->plugins->registerEvent('server_insert', $this->plugin_name, 'server_ip'); - $app->plugins->registerEvent('server_update', $this->plugin_name, 'server_ip'); - - $app->plugins->registerEvent('webdav_user_insert', $this->plugin_name, 'webdav'); - $app->plugins->registerEvent('webdav_user_update', $this->plugin_name, 'webdav'); - $app->plugins->registerEvent('webdav_user_delete', $this->plugin_name, 'webdav'); - - $app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete'); - - $app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user'); - $app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user'); - $app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user'); - - $app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update'); - $app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete'); - - $app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete'); - - $app->plugins->registerAction('php_ini_changed', $this->plugin_name, 'php_ini_changed'); - } - - private function get_master_php_ini_content($web_data) { - global $app, $conf; - - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); - - $php_ini_content = ''; - $master_php_ini_path = ''; - - if($web_data['php'] == 'mod') { - $master_php_ini_path = $web_config['php_ini_path_apache']; - } else { - // check for custom php - if($web_data['fastcgi_php_version'] != '') { - $tmp = explode(':', $web_data['fastcgi_php_version']); - if(isset($tmp[2])) { - $tmppath = $tmp[2]; - if(substr($tmppath, -7) != 'php.ini') { - if(substr($tmppath, -1) != '/') $tmppath .= '/'; - $tmppath .= 'php.ini'; - } - if(file_exists($tmppath)) { - $master_php_ini_path = $tmppath; - } - unset($tmppath); - } - unset($tmp); - } - - if(!$master_php_ini_path) { - if($web_data['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) { - $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"]; - } elseif($web_data['php'] == 'php-fpm' && file_exists($web_config['php_fpm_ini_path'])) { - $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"]; - } else { - $master_php_ini_path = $web_config['php_ini_path_cgi']; - } - } - } - - // Resolve inconsistant path settings - if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) { - $master_php_ini_path .= '/php.ini'; - } - - // Load the custom php.ini content - if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) { - $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n"; - } - - return $php_ini_content; - } - - // Handle php.ini changes - function php_ini_changed($event_name, $data) { - global $app, $conf; - - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); - - /* $data contains an array with these keys: - * file -> full path of changed php_ini - * mode -> web_domain php modes to change (mod, fast-cgi, php-fpm, hhvm or '' for all except 'mod') - * php_version -> php ini path that changed (additional php versions) - */ - - $param = ''; - $qrystr = "SELECT * FROM web_domain WHERE custom_php_ini != ''"; - if($data['mode'] == 'mod') { - $qrystr .= " AND php = 'mod'"; - } elseif($data['mode'] == 'fast-cgi') { - $qrystr .= " AND php = 'fast-cgi'"; - if($data['php_version']) { - $qrystr .= " AND fastcgi_php_version LIKE ?"; - $param = '%:' . $data['php_version']; - } - } elseif($data['mode'] == 'php-fpm') { - $qrystr .= " AND php = 'php-fpm'"; - if($data['php_version']) { - $qrystr .= " AND fastcgi_php_version LIKE ?"; - $param = '%:' . $data['php_version'] . ':%'; - } - } elseif($data['mode'] == 'hhvm') { - $qrystr .= " AND php = 'hhvm'"; - if($data['php_version']) { - $qrystr .= " AND fastcgi_php_version LIKE ?"; - $param = '%:' . $data['php_version'] . ':%'; - } - } else { - $qrystr .= " AND php != 'mod' AND php != 'fast-cgi'"; - } - - - //** Get all the webs - $web_domains = $app->db->queryAllRecords($qrystr, $param); - foreach($web_domains as $web_data) { - $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$web_data['system_user']; - $web_folder = 'web'; - if($web_data['type'] == 'vhostsubdomain' || $web_data['type'] == 'vhostalias') { - $web_folder = $web_data['web_folder']; - $custom_php_ini_dir .= '_' . $web_folder; - } - if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); - - if(!is_dir($custom_php_ini_dir)) $app->system->mkdir($custom_php_ini_dir); - - $php_ini_content = $this->get_master_php_ini_content($web_data); - - if(intval($web_data['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($web_data['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $web_data['custom_php_ini'] .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - - $php_ini_content .= str_replace("\r", '', trim($web_data['custom_php_ini'])); - $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content); - $app->log('Info: rewrote custom php.ini for web ' . $web_data['domain_id'] . ' (' . $web_data['domain'] . ').', LOGLEVEL_DEBUG); - } - - if(count($web_domains) > 0) { - //* We do not check the apache config here - we only changed the php.ini - //* Check if this is a chrooted setup - if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $apache_chrooted = true; - $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG); - } else { - $apache_chrooted = false; - } - - $app->log('Info: rewrote all php.ini and reloading apache now.', LOGLEVEL_DEBUG); - if($apache_chrooted) { - $app->services->restartServiceDelayed('httpd', 'restart'); - } else { - // request a httpd reload when all records have been processed - $app->services->restartServiceDelayed('httpd', 'reload'); - } - } else { - $app->log('Info: No webs affected by php.ini change.', LOGLEVEL_DEBUG); - } - } - - // Handle the creation of SSL certificates - function ssl($event_name, $data) { - global $app, $conf; - - $app->uses('system'); - - // load the server configuration options - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf')) - $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR); - - //* Only vhosts can have a ssl cert - if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") return; - - // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl'); - if(!is_dir($data['new']['document_root'].'/ssl') && !is_dir($data['old']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); - - $ssl_dir = $data['new']['document_root'].'/ssl'; - $domain = ($data['new']['ssl_domain'] != '') ? $data['new']['ssl_domain'] : $data['new']['domain']; - $key_file = $ssl_dir.'/'.$domain.'.key'; - $key_file2 = $ssl_dir.'/'.$domain.'.key.org'; - $csr_file = $ssl_dir.'/'.$domain.'.csr'; - $crt_file = $ssl_dir.'/'.$domain.'.crt'; - $bundle_file = $ssl_dir.'/'.$domain.'.bundle'; - - //* Create a SSL Certificate, but only if this is not a mirror server. - if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) { - - $this->ssl_certificate_changed = true; - - //* Rename files if they exist - if(file_exists($key_file)){ - $app->system->rename($key_file, $key_file.'.bak'); - $app->system->chmod($key_file.'.bak', 0400); - } - if(file_exists($key_file2)){ - $app->system->rename($key_file2, $key_file2.'.bak'); - $app->system->chmod($key_file2.'.bak', 0400); - } - if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak'); - if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak'); - - $rand_file = $ssl_dir.'/random_file'; - $rand_data = md5(uniqid(microtime(), 1)); - for($i=0; $i<1000; $i++) { - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - } - $app->system->file_put_contents($rand_file, $rand_data); - - $ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15); - - $ssl_cnf = " RANDFILE = $rand_file - - [ req ] - default_bits = 2048 - default_md = sha256 - default_keyfile = keyfile.pem - distinguished_name = req_distinguished_name - attributes = req_attributes - prompt = no - output_password = $ssl_password - - [ req_distinguished_name ] - C = ".trim($data['new']['ssl_country'])." - " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " - " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." - " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." - " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." - CN = $domain - emailAddress = webmaster@".$data['new']['domain']." - - [ req_attributes ] - ";//challengePassword = A challenge password"; - - $ssl_cnf_file = $ssl_dir.'/openssl.conf'; - $app->system->file_put_contents($ssl_cnf_file, $ssl_cnf); - - $rand_file = escapeshellcmd($rand_file); - $key_file2 = escapeshellcmd($key_file2); - $openssl_cmd_key_file2 = $key_file2; - if(substr($domain, 0, 2) == '*.' && strpos($key_file2, '/ssl/\*.') !== false) $key_file2 = str_replace('/ssl/\*.', '/ssl/*.', $key_file2); // wildcard certificate - $key_file = escapeshellcmd($key_file); - $openssl_cmd_key_file = $key_file; - if(substr($domain, 0, 2) == '*.' && strpos($key_file, '/ssl/\*.') !== false) $key_file = str_replace('/ssl/\*.', '/ssl/*.', $key_file); // wildcard certificate - $ssl_days = 3650; - $csr_file = escapeshellcmd($csr_file); - $openssl_cmd_csr_file = $csr_file; - if(substr($domain, 0, 2) == '*.' && strpos($csr_file, '/ssl/\*.') !== false) $csr_file = str_replace('/ssl/\*.', '/ssl/*.', $csr_file); // wildcard certificate - $config_file = escapeshellcmd($ssl_cnf_file); - $crt_file = escapeshellcmd($crt_file); - $openssl_cmd_crt_file = $crt_file; - if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate - - if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) { - - exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $openssl_cmd_key_file2 2048"); - exec("openssl req -new -sha256 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -out $openssl_cmd_csr_file -days $ssl_days -config $config_file"); - exec("openssl rsa -passin pass:$ssl_password -in $openssl_cmd_key_file2 -out $openssl_cmd_key_file"); - - if(file_exists($web_config['CA_path'].'/openssl.cnf')) - { - exec("openssl ca -batch -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file"); - $app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed. openssl ca -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file", LOGLEVEL_ERROR); - }; - if (@filesize($crt_file)==0 || !file_exists($crt_file)){ - exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -in $openssl_cmd_csr_file -out $openssl_cmd_crt_file -days $ssl_days -config $config_file "); - $app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - }; - - } - - $app->system->chmod($key_file2, 0400); - $app->system->chmod($key_file, 0400); - @$app->system->unlink($config_file); - @$app->system->unlink($rand_file); - $ssl_request = $app->system->file_get_contents($csr_file); - $ssl_cert = $app->system->file_get_contents($crt_file); - $ssl_key = $app->system->file_get_contents($key_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - - //* Check that the SSL key is not password protected - if($data["new"]["ssl_action"] == 'save') { - if(stristr($data["new"]["ssl_key"],'Proc-Type: 4,ENCRYPTED')) { - $data["new"]["ssl_action"] = ''; - - $app->log('SSL Certificate not saved. The SSL key is encrypted.', LOGLEVEL_WARN); - $app->dbmaster->datalogError('SSL Certificate not saved. The SSL key is encrypted.'); - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - } - - //* and check that SSL cert does not contain subdomain of domain acme.invalid - if($data["new"]["ssl_action"] == 'save') { - $tmp = array(); - $crt_data = ''; - exec('openssl x509 -noout -text -in '.escapeshellarg($crt_file),$tmp); - $crt_data = implode("\n",$tmp); - if(stristr($crt_data,'.acme.invalid')) { - $data["new"]["ssl_action"] = ''; - - $app->log('SSL Certificate not saved. The SSL cert contains domain acme.invalid.', LOGLEVEL_WARN); - $app->dbmaster->datalogError('SSL Certificate not saved. The SSL cert contains domain acme.invalid.'); - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - } - - //* Save a SSL certificate to disk - if($data["new"]["ssl_action"] == 'save') { - $this->ssl_certificate_changed = true; - - //* Backup files - if(file_exists($key_file)){ - $app->system->copy($key_file, $key_file.'~'); - $app->system->chmod($key_file.'~', 0400); - } - if(file_exists($key_file2)){ - $app->system->copy($key_file2, $key_file2.'~'); - $app->system->chmod($key_file2.'~', 0400); - } - if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~'); - if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~'); - if(file_exists($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'~'); - - //* Write new ssl files - if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]); - if(version_compare($app->system->getapacheversion(true), '2.4.8', '>=')) { - // In apache 2.4.8 and newer, the ssl crt file contains the bundle, so we need no separate bundle file - $tmp_data = ''; - if(trim($data["new"]["ssl_cert"]) != '') $tmp_data .= $data["new"]["ssl_cert"] . "\n"; - if(trim($data["new"]["ssl_bundle"]) != '') $tmp_data .= $data["new"]["ssl_bundle"]; - if(trim($tmp_data) != '') $app->system->file_put_contents($crt_file, $tmp_data); - } else { - // Write separate crt and bundle file - if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); - if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]); - } - - //* Write the key file, if field is empty then import the key into the db - if(trim($data["new"]["ssl_key"]) != '') { - $app->system->file_put_contents($key_file, $data["new"]["ssl_key"]); - $app->system->chmod($key_file, 0400); - } else { - $ssl_key = $app->system->file_get_contents($key_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_key = ? WHERE domain = ?", $ssl_key, $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_key = ? WHERE domain = ?", $ssl_key, $data['new']['domain']); - } - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - $app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - //* Delete a SSL certificate - if($data['new']['ssl_action'] == 'del') { - if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf')) - { - exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke ".escapeshellcmd($crt_file)); - $app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - }; - $app->system->unlink($csr_file); - $app->system->unlink($crt_file); - $app->system->unlink($bundle_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - } - - - function insert($event_name, $data) { - global $app, $conf; - - $this->action = 'insert'; - // just run the update function - $this->update($event_name, $data); - - - } - - - function update($event_name, $data) { - global $app, $conf; - - if($this->action != 'insert') $this->action = 'update'; - - if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { - - $old_parent_domain_id = intval($data['old']['parent_domain_id']); - $new_parent_domain_id = intval($data['new']['parent_domain_id']); - - // If the parent_domain_id has been changed, we will have to update the old site as well. - if($this->action == 'update' && $data['new']['parent_domain_id'] != $data['old']['parent_domain_id']) { - $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $old_parent_domain_id, 'y'); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update($event_name, $data); - } - - // This is not a vhost, so we need to update the parent record instead. - $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $new_parent_domain_id, 'y'); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update_letsencrypt = true; - } - - // load the server configuration options - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - - //* Check if this is a chrooted setup - if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $apache_chrooted = true; - $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG); - } else { - $apache_chrooted = false; - } - - if($data['new']['document_root'] == '') { - if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $app->log('document_root not set', LOGLEVEL_WARN); - return 0; - } - if($app->system->is_allowed_user($data['new']['system_user'], $app->system->is_user($data['new']['system_user']), true) == false - || $app->system->is_allowed_group($data['new']['system_group'], $app->system->is_group($data['new']['system_group']), true) == false) { - $app->log('Websites cannot be owned by the root user or group. User: '.$data['new']['system_user'].' Group: '.$data['new']['system_group'], LOGLEVEL_WARN); - return 0; - } - if(trim($data['new']['domain']) == '') { - $app->log('domain is empty', LOGLEVEL_WARN); - return 0; - } - - $web_folder = 'web'; - $log_folder = 'log'; - $old_web_folder = 'web'; - $old_log_folder = 'log'; - if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { - // new one - $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['new']['parent_domain_id']); - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); - if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; - $web_folder = $data['new']['web_folder']; - $log_folder .= '/' . $subdomain_host; - unset($tmp); - - if(isset($data['old']['parent_domain_id'])) { - // old one - $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); - if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; - $old_web_folder = $data['old']['web_folder']; - $old_log_folder .= '/' . $subdomain_host; - unset($tmp); - } - } - - // Create group and user, if not exist - $app->uses('system'); - - if($web_config['connect_userid_to_webid'] == 'y') { - //* Calculate the uid and gid - $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']); - $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']); - $fixed_uid_param = '--uid '.$fixed_uid_gid; - $fixed_gid_param = '--gid '.$fixed_uid_gid; - - //* Check if a ispconfigend user and group exists and create them - if(!$app->system->is_group('ispconfigend')) { - exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); - } - if(!$app->system->is_user('ispconfigend')) { - exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); - } - } else { - $fixed_uid_param = ''; - $fixed_gid_param = ''; - } - - $groupname = escapeshellcmd($data['new']['system_group']); - if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) { - exec('groupadd '.$fixed_gid_param.' '.$groupname); - if($apache_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname); - $app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG); - } - - $username = escapeshellcmd($data['new']['system_user']); - if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) { - if($web_config['add_web_users_to_sshusers_group'] == 'y') { - exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); - if($apache_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); - } else { - exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); - if($apache_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); - } - $app->log('Adding the user: '.$username, LOGLEVEL_DEBUG); - } - - //* If the client of the site has been changed, we have a change of the document root - if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) { - - //* Get the old client ID - $old_client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); - $old_client_id = intval($old_client['client_id']); - unset($old_client); - - //* Remove the old symlinks - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // create the symlinks, if not exist - if(is_link($tmp_symlink)) { - exec('rm -f '.escapeshellcmd($tmp_symlink)); - $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - - //* Remove protection of old folders - $app->system->web_folder_protection($data['old']['document_root'], false); - - if($data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") { - //* Move the site data - $tmp_docroot = explode('/', $data['new']['document_root']); - unset($tmp_docroot[count($tmp_docroot)-1]); - $new_dir = implode('/', $tmp_docroot); - - $tmp_docroot = explode('/', $data['old']['document_root']); - unset($tmp_docroot[count($tmp_docroot)-1]); - $old_dir = implode('/', $tmp_docroot); - - //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path - if(@is_dir($data['new']['document_root'])) { - $app->system->web_folder_protection($data['new']['document_root'], false); - $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s')); - $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG); - } - - //* Unmount the old log directory bfore we move the log dir - //exec('fuser -km '.escapeshellcmd($old_dir.'/log')); - exec('umount -l '.escapeshellcmd($data['old']['document_root'].'/log')); - - //* Create new base directory, if it does not exist yet - if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); - $app->system->web_folder_protection($data['old']['document_root'], false); - exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir)); - //$app->system->rename($data['old']['document_root'],$new_dir); - $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG); - - // Handle the change in php_open_basedir - $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']); - - //* Change the owner of the website files to the new website owner - exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir); - - //* Change the home directory and group of the website user - $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod'; - $command .= ' --home '.escapeshellcmd($data['new']['document_root']); - $command .= ' --gid '.escapeshellcmd($data['new']['system_group']); - $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; - exec($command); - } - - if($apache_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - //* Change the log mount - /* - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; - $app->system->removeLine('/etc/fstab', $fstab_line); - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; - $app->system->removeLine('/etc/fstab', $fstab_line); - */ - - $fstab_line_old = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - - if($web_config['network_filesystem'] == 'y') { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail,_netdev 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); - } else { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); - } - - exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); - - } - - //print_r($data); - - // Check if the directories are there and create them if necessary. - $app->system->web_folder_protection($data['new']['document_root'], false); - - if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder); - if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error'); - if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); - //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder); - if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); - if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin'); - if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp'); - if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav'); - - if(!is_dir($data['new']['document_root'].'/.ssh')) { - $app->system->mkdirpath($data['new']['document_root'].'/.ssh'); - $app->system->chmod($data['new']['document_root'].'/.ssh', 0700); - $app->system->chown($data['new']['document_root'].'/.ssh', $username); - $app->system->chgrp($data['new']['document_root'].'/.ssh', $groupname); - } - - //* Create the new private directory - if(!is_dir($data['new']['document_root'].'/private')) { - $app->system->mkdirpath($data['new']['document_root'].'/private'); - $app->system->chmod($data['new']['document_root'].'/private', 0710); - $app->system->chown($data['new']['document_root'].'/private', $username); - $app->system->chgrp($data['new']['document_root'].'/private', $groupname); - } - - - // Remove the symlink for the site, if site is renamed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']); - if(is_link($data['old']['document_root'].'/'.$old_log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$old_log_folder); - - //* remove old log mount - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - - //* Unmount log directory - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); - exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); - } - - //* Create the log dir if nescessary and mount it - if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) { - if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder); - if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']); - $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder); - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root'); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root'); - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); - //* add mountpoint to fstab - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait'; - $fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev 0 0':' 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); - } - - $app->system->web_folder_protection($data['new']['document_root'], true); - - // Get the client ID - $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); - $client_id = intval($client['client_id']); - unset($client); - - // Remove old symlinks, if site is renamed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // remove the symlinks, if not exist - if(is_link($tmp_symlink)) { - exec('rm -f '.escapeshellcmd($tmp_symlink)); - $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - } - - // Create the symlinks for the sites - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - //* Remove symlink if target folder has been changed. - if($data['old']['document_root'] != '' && $data['old']['document_root'] != $data['new']['document_root'] && is_link($tmp_symlink)) { - $app->system->unlink($tmp_symlink); - } - // create the symlinks, if not exist - if(!is_link($tmp_symlink)) { - // exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); - if ($web_config["website_symlinks_rel"] == 'y') { - $app->system->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink)); - } else { - exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); - } - - $app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - - - - // Install the Standard or Custom Error, Index and other related files - // /usr/local/ispconfig/server/conf is for the standard files - // /usr/local/ispconfig/server/conf-custom is for the custom files - // setting a local var here - - // normally $conf['templates'] = "/usr/local/ispconfig/server/conf"; - if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { - - // Copy the error pages - if($data['new']['errordocs']) { - $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; - if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - else { - if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { - exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); - } - else { - exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - } - exec('chmod -R a+r '.$error_page_path); - } - - //* Copy the web skeleton files only when there is no index.ph or index.html file yet - if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php')) { - if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - - if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - //if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) { - // exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - //} - } else { - if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - } else { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')){ - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - if(is_file($conf['rootpath'] . '/conf/index/robots.txt')){ - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - //if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - } - } - exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - - //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before - } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { - - $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; - if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - else { - if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); - } - else { - exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - } - exec('chmod -R a+r '.$error_page_path); - exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path); - } // end copy error docs - - // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias - if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { - if($data['new']['hd_quota'] > 0) { - $blocks_soft = $data['new']['hd_quota'] * 1024; - $blocks_hard = $blocks_soft + 1024; - $mb_soft = $data['new']['hd_quota']; - $mb_hard = $mb_soft + 1; - } else { - $mb_soft = $mb_hard = $blocks_soft = $blocks_hard = 0; - } - - // get the primitive folder for document_root and the filesystem, will need it later. - $df_output=explode(" ", exec("df -T " . escapeshellarg($data['new']['document_root']) . "|awk 'END{print \$2,\$NF}'")); - $file_system = $df_output[0]; - $primitive_root = $df_output[1]; - - if($file_system == 'xfs') { - exec("xfs_quota -x -c " . escapeshellarg("limit -u bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " " . $username) . " " . escapeshellarg($primitive_root)); - - // xfs only supports timers globally, not per user. - exec("xfs_quota -x -c 'timer -bir -i 604800' " . escapeshellarg($primitive_root)); - - unset($project_uid, $username_position, $xfs_projects); - unset($primitive_root, $df_output, $mb_hard, $mb_soft); - } else { - if($app->system->is_installed('setquota')) { - exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null'); - exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null'); - } - } - } - - if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) { - // Chown and chmod the directories below the document root - $app->system->_exec('chown -R '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - // The document root itself has to be owned by root in normal level and by the web owner in security level 20 - if($web_config['security_level'] == 20) { - $app->system->_exec('chown '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - } else { - $app->system->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - } - } - - //* add the Apache user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update - if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user'])); - - //* If the security level is set to high - if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) { - - $app->system->web_folder_protection($data['new']['document_root'], false); - - //* Check if we have the new private folder and create it if nescessary - if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private'); - - if($web_config['security_level'] == 20) { - - $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0711); - $app->system->chmod($data['new']['document_root'].'/webdav', 0710); - $app->system->chmod($data['new']['document_root'].'/private', 0710); - $app->system->chmod($data['new']['document_root'].'/ssl', 0755); - - // make tmp directory writable for Apache and the website users - $app->system->chmod($data['new']['document_root'].'/tmp', 0770); - - // Set Log directory to 755 to make the logs accessible by the FTP user - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - } - - if($web_config['add_web_users_to_sshusers_group'] == 'y') { - $command = 'usermod'; - $command .= ' --groups sshusers'; - $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; - $app->system->_exec($command); - } - - //* if we have a chrooted Apache environment - if($apache_chrooted) { - $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - //* add the apache user to the client group in the chroot environment - $tmp_groupfile = $app->system->server_conf['group_datei']; - $app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group'; - $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user'])); - $app->system->server_conf['group_datei'] = $tmp_groupfile; - unset($tmp_groupfile); - } - - //* Chown all default directories - $app->system->chown($data['new']['document_root'], 'root'); - $app->system->chgrp($data['new']['document_root'], 'root'); - $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); - $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); - } - $app->system->chown($data['new']['document_root'].'/ssl', 'root'); - $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); - $app->system->chown($data['new']['document_root'].'/tmp', $username); - $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); - $app->system->chown($data['new']['document_root'].'/web', $username); - $app->system->chgrp($data['new']['document_root'].'/web', $groupname); - $app->system->chown($data['new']['document_root'].'/web/error', $username); - $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); - } - $app->system->chown($data['new']['document_root'].'/webdav', $username); - $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); - $app->system->chown($data['new']['document_root'].'/private', $username); - $app->system->chgrp($data['new']['document_root'].'/private', $groupname); - - // If the security Level is set to medium - } else { - - $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0755); - $app->system->chmod($data['new']['document_root'].'/webdav', 0755); - $app->system->chmod($data['new']['document_root'].'/ssl', 0755); - $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755); - - // make temp directory writable for Apache and the website users - $app->system->chmod($data['new']['document_root'].'/tmp', 0770); - - // Set Log directory to 755 to make the logs accessible by the FTP user - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - } - - $app->system->chown($data['new']['document_root'], 'root'); - $app->system->chgrp($data['new']['document_root'], 'root'); - $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); - $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); - } - - $app->system->chown($data['new']['document_root'].'/ssl', 'root'); - $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); - $app->system->chown($data['new']['document_root'].'/tmp', $username); - $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); - $app->system->chown($data['new']['document_root'].'/web', $username); - $app->system->chgrp($data['new']['document_root'].'/web', $groupname); - $app->system->chown($data['new']['document_root'].'/web/error', $username); - $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); - } - $app->system->chown($data['new']['document_root'].'/webdav', $username); - $app->system->chgrp($data['new']['document_root'].'/webdav', $groupname); - } - } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && - (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { - - if($web_config['security_level'] == 20) { - $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710); - $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); - } - } else { - $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755); - $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); - } - } - } - - //* Protect web folders - $app->system->web_folder_protection($data['new']['document_root'], true); - - if($data['new']['type'] == 'vhost') { - // Change the ownership of the error log to the root user - if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')); - $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); - $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); - } - - //* Write the custom php.ini file, if custom_php_ini fieled is not empty - $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user']; - if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $custom_php_ini_dir .= '_' . $web_folder; - if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf'); - - //* add open_basedir restriction to custom php.ini content, required for suphp only - if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') { - $data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n"; - } - - $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); - - if(trim($data['new']['fastcgi_php_version']) != ''){ - list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir); - if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1); - } - - //* Create custom php.ini - if(trim($data['new']['custom_php_ini']) != '') { - $has_custom_php_ini = true; - if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir); - - $php_ini_content = $this->get_master_php_ini_content($data['new']); - $php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini'])); - - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $php_ini_content .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - - $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content); - } else { - $has_custom_php_ini = false; - if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini'); - } - - - //* Create the vhost config file - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate('vhost.conf.master'); - - $vhost_data = $data['new']; - //unset($vhost_data['ip_address']); - $vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder; - $vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder; - $vhost_data['web_basedir'] = $web_config['website_basedir']; - $vhost_data['security_level'] = $web_config['security_level']; - $vhost_data['allow_override'] = ($data['new']['allow_override'] == '')?'All':$data['new']['allow_override']; - $vhost_data['php_open_basedir'] = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; - $vhost_data['ssl_domain'] = $data['new']['ssl_domain']; - $vhost_data['has_custom_php_ini'] = $has_custom_php_ini; - $vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir); - $vhost_data['logging'] = $web_config['logging']; - - // Custom Apache directives - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", $data['new']['directive_snippets_id']); - if(isset($snippet['snippet'])){ - $vhost_data['apache_directives'] = $snippet['snippet']; - } - } - // Make sure we only have Unix linebreaks - $vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']); - $vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']); - $trans = array( - '{DOCROOT}' => $vhost_data['web_document_root_www'], - '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'] - ); - $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans); - - $app->uses('letsencrypt'); - // Check if a SSL cert exists - $tmp = $app->letsencrypt->get_website_certificate_paths($data); - $domain = $tmp['domain']; - $key_file = $tmp['key']; - $key_file2 = $tmp['key2']; - $csr_file = $tmp['csr']; - $crt_file = $tmp['crt']; - $bundle_file = $tmp['bundle']; - unset($tmp); - - $data['new']['ssl_domain'] = $domain; - $vhost_data['ssl_domain'] = $domain; - $vhost_data['ssl_crt_file'] = $crt_file; - $vhost_data['ssl_key_file'] = $key_file; - $vhost_data['ssl_bundle_file'] = $bundle_file; - - //* Generate Let's Encrypt SSL certificat - if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y' && $conf['mirror_server_id'] == 0 && ( // ssl and let's encrypt is active and no mirror server - ($data['old']['ssl'] == 'n' || $data['old']['ssl_letsencrypt'] == 'n') // we have new let's encrypt configuration - || ($data['old']['domain'] != $data['new']['domain']) // we have domain update - || ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain - || $this->update_letsencrypt == true - )) { - - $success = $app->letsencrypt->request_certificates($data); - if($success) { - /* we don't need to store it. - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } else { - $data['new']['ssl_letsencrypt'] = 'n'; - if($data['old']['ssl'] == 'n') $data['new']['ssl'] = 'n'; - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']); - } - } - - if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1; - - // HTTP/2.0 ? - $vhost_data['enable_http2'] = 'n'; - if($vhost_data['enable_spdy'] == 'y'){ - // check if apache supports http_v2 - exec("2>&1 apachectl -M | grep http2_module", $tmp_output, $tmp_retval); - if($tmp_retval == 0){ - $vhost_data['enable_http2'] = 'y'; - } - unset($tmp_output, $tmp_retval); - } - - // Set SEO Redirect - if($data['new']['seo_redirect'] != ''){ - $vhost_data['seo_redirect_enabled'] = 1; - $tmp_seo_redirects = $this->get_seo_redirects($data['new']); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - foreach($tmp_seo_redirects as $key => $val){ - $vhost_data[$key] = $val; - } - } else { - $vhost_data['seo_redirect_enabled'] = 0; - } - } else { - $vhost_data['seo_redirect_enabled'] = 0; - } - - $tpl->setVar($vhost_data); - $tpl->setVar('apache_version', $app->system->getapacheversion()); - $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); - - // Rewrite rules - $rewrite_rules = array(); - $rewrite_wildcard_rules = array(); - if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') { - if(substr($data['new']['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/'; - if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){ - $rewrite_target = 'http'.substr($data['new']['redirect_path'], 8); - $rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'], 8); - } else { - $rewrite_target = $data['new']['redirect_path']; - $rewrite_target_ssl = $data['new']['redirect_path']; - } - /* Disabled path extension - if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') { - $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/'; - } - */ - - switch($data['new']['subdomain']) { - case 'www': - $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - break; - case '*': - $rewrite_wildcard_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - break; - default: - $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - } - } - - $server_alias = array(); - - // get autoalias - $auto_alias = $web_config['website_autoalias']; - if($auto_alias != '') { - // get the client username - $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = ?", $client_id); - $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]'); - $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']); - $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias); - unset($client); - unset($aa_search); - unset($aa_replace); - $server_alias[] .= $auto_alias; - } - - // get alias domains (co-domains and subdomains) - $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ? AND active = 'y' AND (type != 'vhostsubdomain' AND type != 'vhostalias')", $data['new']['domain_id']); - $alias_seo_redirects = array(); - switch($data['new']['subdomain']) { - case 'www': - $server_alias[] = 'www.'.$data['new']['domain']; - break; - case '*': - $server_alias[] = '*.'.$data['new']['domain']; - break; - } - if(is_array($aliases)) { - foreach($aliases as $alias) { - switch($alias['subdomain']) { - case 'www': - $server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain']; - break; - case '*': - $server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain']; - break; - default: - $server_alias[] .= $alias['domain']; - break; - } - $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG); - - // Add SEO redirects for alias domains - if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_'); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects[] = $tmp_seo_redirects; - } - } - - // Rewriting - if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') { - if(substr($alias['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/'; - if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){ - $rewrite_target = 'http'.substr($alias['redirect_path'], 8); - $rewrite_target_ssl = 'https'.substr($alias['redirect_path'], 8); - } else { - $rewrite_target = $alias['redirect_path']; - $rewrite_target_ssl = $alias['redirect_path']; - } - /* Disabled the path extension - if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') { - $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/'; - } - */ - - switch($alias['subdomain']) { - case 'www': - $rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($alias['domain']), - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - $rewrite_rules[] = array( 'rewrite_domain' => '^' . $this->_rewrite_quote('www.'.$alias['domain']), - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - break; - case '*': - $rewrite_wildcard_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($alias['domain']), - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - break; - default: - if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2)); - else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']); - $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule, - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']', - 'rewrite_target' => $rewrite_target, - 'rewrite_target_ssl' => $rewrite_target_ssl, - 'rewrite_is_url' => ($this->_is_url($rewrite_target) ? 'y' : 'n'), - 'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n')); - } - } - } - } - - //* If we have some alias records - if($server_alias) { - //* begin a new ServerAlias line after 32 alias domains to avoid apache bugs - $server_alias_str = 'ServerAlias '.$server_alias[0]; - for($n=1;$nsetVar('alias', $server_alias_str); - unset($server_alias_str); - unset($n); - } else { - $tpl->setVar('alias', ''); - } - - if (count($rewrite_wildcard_rules) > 0) $rewrite_rules = array_merge($rewrite_rules, $rewrite_wildcard_rules); // Append wildcard rules to the end of rules - - if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0 || $data['new']['rewrite_to_https'] == 'y') { - $tpl->setVar('rewrite_enabled', 1); - } else { - $tpl->setVar('rewrite_enabled', 0); - } - - //$tpl->setLoop('redirects',$rewrite_rules); - - /** - * install fast-cgi starter script and add script aliasd config - * first we create the script directory if not already created, then copy over the starter script - * settings are copied over from the server ini config for now - * TODO: Create form for fastcgi configs per site. - */ - - - if ($data['new']['php'] == 'fast-cgi') { - - $fastcgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $fastcgi_config['fastcgi_starter_path']); - $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path); - - if (!is_dir($fastcgi_starter_path)) { - $app->system->mkdirpath($fastcgi_starter_path); - //exec('chown '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path)); - - - $app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path, LOGLEVEL_DEBUG); - } - - //exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path)); - $app->system->chown($fastcgi_starter_path, $data['new']['system_user']); - $app->system->chgrp($fastcgi_starter_path, $data['new']['system_group']); - $app->system->chmod($fastcgi_starter_path, 0550); - - $fcgi_tpl = new tpl(); - $fcgi_tpl->newTemplate('php-fcgi-starter.master'); - $fcgi_tpl->setVar('apache_version', $app->system->getapacheversion()); - $fcgi_tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); - - // Support for multiple PHP versions (FastCGI) - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_fastcgi_php = false; - if(substr($custom_fastcgi_php_ini_dir, -1) != '/') $custom_fastcgi_php_ini_dir .= '/'; - } else { - $default_fastcgi_php = true; - } - - if($has_custom_php_ini) { - $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir)); - } else { - if($default_fastcgi_php){ - $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); - } else { - $fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_fastcgi_php_ini_dir)); - } - } - $fcgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root'])); - $fcgi_tpl->setVar('php_fcgi_children', escapeshellcmd($fastcgi_config['fastcgi_children'])); - $fcgi_tpl->setVar('php_fcgi_max_requests', escapeshellcmd($fastcgi_config['fastcgi_max_requests'])); - if($default_fastcgi_php){ - $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($fastcgi_config['fastcgi_bin'])); - } else { - $fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($custom_fastcgi_php_executable)); - } - $fcgi_tpl->setVar('security_level', intval($web_config['security_level'])); - $fcgi_tpl->setVar('domain', escapeshellcmd($data['new']['domain'])); - - $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; - $fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir)); - - $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); - $app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab()); - unset($fcgi_tpl); - - $app->log('Creating fastcgi starter script: '.$fcgi_starter_script, LOGLEVEL_DEBUG); - - $app->system->chmod($fcgi_starter_script, 0550); - $app->system->chown($fcgi_starter_script, $data['new']['system_user']); - $app->system->chgrp($fcgi_starter_script, $data['new']['system_group']); - - $tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']); - $tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path); - $tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); - $tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']); - $tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']); - - } else { - //remove the php fastgi starter script if available - $fastcgi_starter_script = $fastcgi_config['fastcgi_starter_script'].($data['old']['type'] == 'vhostsubdomain' ? '_web' . $data['old']['domain_id'] : ''); - if ($data['old']['php'] == 'fast-cgi') { - $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']); - $fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path); - if($data['old']['type'] == 'vhost') { - if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script); - if (is_dir($fastcgi_starter_path)) @rmdir($fastcgi_starter_path); - } else { - if(is_file($fastcgi_starter_script)) @unlink($fastcgi_starter_script); - } - } - } - - - - /** - * PHP-FPM - */ - // Support for multiple PHP versions - if($data['new']['php'] == 'php-fpm'){ - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } else { - if(trim($data['old']['fastcgi_php_version']) != '' && ($data['old']['php'] == 'php-fpm' || $data['old']['php'] == 'hhvm')){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } - - if($default_php_fpm){ - $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); - } else { - $pool_dir = $custom_php_fpm_pool_dir; - } - $pool_dir = trim($pool_dir); - if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; - $pool_name = 'web'.$data['new']['domain_id']; - $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']); - if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; - - if($data['new']['php_fpm_use_socket'] == 'y'){ - $use_tcp = 0; - $use_socket = 1; - } else { - $use_tcp = 1; - $use_socket = 0; - } - $tpl->setVar('use_tcp', $use_tcp); - $tpl->setVar('use_socket', $use_socket); - $fpm_socket = $socket_dir.$pool_name.'.sock'; - $tpl->setVar('fpm_socket', $fpm_socket); - $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); - - /** - * install cgi starter script and add script alias to config. - * This is needed to allow cgi with suexec (to do so, we need a bin in the document-path!) - * first we create the script directory if not already created, then copy over the starter script. - * TODO: we have to fetch the data from the server-settings. - */ - if ($data['new']['php'] == 'cgi') { - //$cgi_config = $app->getconf->get_server_config($conf['server_id'], 'cgi'); - - $cgi_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/'; - $cgi_config['cgi_starter_script'] = 'php-cgi-starter'.(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : ''); - $cgi_config['cgi_bin'] = '/usr/bin/php-cgi'; - - $cgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $cgi_config['cgi_starter_path']); - $cgi_starter_path = str_replace('[client_id]', $client_id, $cgi_starter_path); - - if (!is_dir($cgi_starter_path)) { - $app->system->mkdirpath($cgi_starter_path); - $app->system->chown($cgi_starter_path, $data['new']['system_user']); - $app->system->chgrp($cgi_starter_path, $data['new']['system_group']); - $app->system->chmod($cgi_starter_path, 0550); - - $app->log('Creating cgi starter script directory: '.$cgi_starter_path, LOGLEVEL_DEBUG); - } - - $cgi_tpl = new tpl(); - $cgi_tpl->newTemplate('php-cgi-starter.master'); - $cgi_tpl->setVar('apache_version', $app->system->getapacheversion()); - $cgi_tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); - - // This works because PHP "rewrites" a symlink to the physical path - $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; - $cgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir)); - $cgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root'])); - - // This will NOT work! - //$cgi_tpl->setVar('open_basedir', '/var/www/' . $data['new']['domain']); - $cgi_tpl->setVar('php_cgi_bin', $cgi_config['cgi_bin']); - $cgi_tpl->setVar('security_level', $web_config['security_level']); - - $cgi_tpl->setVar('has_custom_php_ini', $has_custom_php_ini); - if($has_custom_php_ini) { - $cgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir)); - } else { - $cgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); - } - - $cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); - $app->system->file_put_contents($cgi_starter_script, $cgi_tpl->grab()); - unset($cgi_tpl); - - $app->log('Creating cgi starter script: '.$cgi_starter_script, LOGLEVEL_DEBUG); - - - $app->system->chmod($cgi_starter_script, 0550); - $app->system->chown($cgi_starter_script, $data['new']['system_user']); - $app->system->chgrp($cgi_starter_script, $data['new']['system_group']); - - $tpl->setVar('cgi_starter_path', $cgi_starter_path); - $tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : '')); - - } - - $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost'); - //* Make a backup copy of vhost file - if(file_exists($vhost_file)) $app->system->copy($vhost_file, $vhost_file.'~'); - - //* create empty vhost array - $vhosts = array(); - - //* Add vhost for ipv4 IP - - //* use ip-mapping for web-mirror - if($data['new']['ip_address'] != '*' && $conf['mirror_server_id'] > 0) { - $sql = "SELECT destination_ip FROM server_ip_map WHERE server_id = ? AND source_ip = ?"; - $newip = $app->db->queryOneRecord($sql, $conf['server_id'], $data['new']['ip_address']); - $data['new']['ip_address'] = $newip['destination_ip']; - unset($newip); - } - - $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80); - if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules); - if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects); - $vhosts[] = $tmp_vhost_arr; - unset($tmp_vhost_arr); - - //* Add vhost for ipv4 IP with SSL - if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) { - $tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443'); - if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules); - $ipv4_ssl_alias_seo_redirects = $alias_seo_redirects; - if(is_array($ipv4_ssl_alias_seo_redirects) && !empty($ipv4_ssl_alias_seo_redirects)){ - for($i=0;$i 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv4_ssl_alias_seo_redirects); - $vhosts[] = $tmp_vhost_arr; - unset($tmp_vhost_arr, $ipv4_ssl_alias_seo_redirects); - $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG); - } - - //* Add vhost for IPv6 IP - if($data['new']['ipv6_address'] != '') { - //* rewrite ipv6 on mirrors - /* chang $conf to $web_config */ - if ($web_config['serverconfig']['web']['vhost_rewrite_v6'] == 'y') { - if (isset($web_config['serverconfig']['server']['v6_prefix']) && $web_config['serverconfig']['server']['v6_prefix'] <> '') { - $explode_v6prefix=explode(':', $web_config['serverconfig']['server']['v6_prefix']); - $explode_v6=explode(':', $data['new']['ipv6_address']); - - for ( $i = 0; $i <= count($explode_v6prefix)-1; $i++ ) { - $explode_v6[$i] = $explode_v6prefix[$i]; - } - $data['new']['ipv6_address'] = implode(':', $explode_v6); - } - } - if($data['new']['ipv6_address'] == '*') $data['new']['ipv6_address'] = '::'; - $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80); - if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules); - if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects); - $vhosts[] = $tmp_vhost_arr; - unset($tmp_vhost_arr); - - //* Add vhost for ipv6 IP with SSL - if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) { - $tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443'); - if(count($rewrite_rules) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules); - $ipv6_ssl_alias_seo_redirects = $alias_seo_redirects; - if(is_array($ipv6_ssl_alias_seo_redirects) && !empty($ipv6_ssl_alias_seo_redirects)){ - for($i=0;$i 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv6_ssl_alias_seo_redirects); - $vhosts[] = $tmp_vhost_arr; - unset($tmp_vhost_arr, $ipv6_ssl_alias_seo_redirects); - $app->log('Enable SSL for IPv6: '.$domain, LOGLEVEL_DEBUG); - } - } - - //* Set the vhost loop - $tpl->setLoop('vhosts', $vhosts); - - //* Write vhost file - $app->system->file_put_contents($vhost_file, $tpl->grab()); - $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - unset($tpl); - - /* - * maybe we have some webdav - user. If so, add them... - */ - $this->_patchVhostWebdav($vhost_file, $data['new']['document_root'] . '/webdav'); - - //* Set the symlink to enable the vhost - //* First we check if there is a old type of symlink and remove it - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink); - - //* Remove old or changed symlinks - if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') { - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - } - - //* New symlink - if($data['new']['subdomain'] == '*') { - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); - } else { - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); - } - if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) { - symlink($vhost_file, $vhost_symlink); - $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - - // remove old symlink and vhost file, if domain name of the site has changed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); - $app->system->unlink($vhost_file); - $app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG); - } - - //* Create .htaccess and .htpasswd file for website statistics - //if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) { - if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats'); - $ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user"; - $app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file); - $app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755); - unset($ht_file); - //} - - if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { - if(trim($data['new']['stats_password']) != '') { - $htp_file = 'admin:'.trim($data['new']['stats_password']); - $app->system->web_folder_protection($data['new']['document_root'], false); - $app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file); - $app->system->web_folder_protection($data['new']['document_root'], true); - $app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755); - unset($htp_file); - } - } - - //* Create awstats configuration - if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { - $this->awstats_update($data, $web_config); - } - - $this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir); - $this->hhvm_update($data, $web_config); - - if($web_config['check_apache_config'] == 'y') { - //* Test if apache starts with the new configuration file - $apache_online_status_before_restart = $this->_checkTcp('localhost', 80); - $app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); - - $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure - $app->log('Apache restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG); - - // wait a few seconds, before we test the apache status again - $apache_online_status_after_restart = false; - sleep(2); - for($i = 0; $i < 5; $i++) { - $apache_online_status_after_restart = $this->_checkTcp('localhost', 80); - if($apache_online_status_after_restart) break; - sleep(1); - } - //* Check if apache restarted successfully if it was online before - $app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); - if($apache_online_status_before_restart && !$apache_online_status_after_restart || $retval['retval'] > 0) { - $app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN); - if(is_array($retval['output']) && !empty($retval['output'])){ - $app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN); - $app->dbmaster->datalogError(implode("\n", $retval['output'])); - } else { - // if no output is given, check again - $webserver_binary = ''; - exec('which apache2ctl apache2 httpd2 httpd apache 2>/dev/null', $webserver_check_output, $webserver_check_retval); - if($webserver_check_retval == 0){ - $webserver_binary = reset($webserver_check_output); - } - if($webserver_binary != ''){ - exec($webserver_binary.' -t 2>&1', $tmp_output, $tmp_retval); - if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){ - $app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN); - $app->dbmaster->datalogError(implode("\n", $tmp_output)); - } - unset($tmp_output, $tmp_retval); - } - } - $app->system->copy($vhost_file, $vhost_file.'.err'); - if(is_file($vhost_file.'~')) { - //* Copy back the last backup file - $app->system->copy($vhost_file.'~', $vhost_file); - } else { - //* There is no backup file, so we create a empty vhost file with a warning message inside - $app->system->file_put_contents($vhost_file, "# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors."); - } - if($this->ssl_certificate_changed === true) { - //* Backup the files that might have caused the error - if(is_file($key_file)){ - $app->system->copy($key_file, $key_file.'.err'); - $app->system->chmod($key_file.'.err', 0400); - } - if(is_file($key_file2)){ - $app->system->copy($key_file2, $key_file2.'.err'); - $app->system->chmod($key_file2.'.err', 0400); - } - if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err'); - if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err'); - if(is_file($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'.err'); - - //* Restore the ~ backup files - if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file); - if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2); - if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file); - if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file); - if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~', $bundle_file); - - $app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN); - } - - $app->services->restartService('httpd', 'restart'); - } - } else { - //* We do not check the apache config after changes (is faster) - if($apache_chrooted) { - $app->services->restartServiceDelayed('httpd', 'restart'); - } else { - // request a httpd reload when all records have been processed - $app->services->restartServiceDelayed('httpd', 'reload'); - } - } - - //* The vhost is written and apache has been restarted, so we - // can reset the ssl changed var to false and cleanup some files - $this->ssl_certificate_changed = false; - - if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~'); - if(@is_file($key_file2.'~')) $app->system->unlink($key_file2.'~'); - if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~'); - if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~'); - if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~'); - - // Remove the backup copy of the config file. - if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~'); - - //* Unset action to clean it for next processed vhost. - $this->action = ''; - } - - function delete($event_name, $data) { - global $app, $conf; - - // load the server configuration options - $app->uses('getconf'); - $app->uses('system'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi'); - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') $app->system->web_folder_protection($data['old']['document_root'], false); - - //* Check if this is a chrooted setup - if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $apache_chrooted = true; - } else { - $apache_chrooted = false; - } - - //* Remove the mounts - $log_folder = 'log'; - $web_folder = ''; - if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { - $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); - if($tmp['domain'] != ''){ - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); - } else { - // get log folder from /etc/fstab - /* - $bind_mounts = $app->system->file_get_contents('/etc/fstab'); - $bind_mount_lines = explode("\n", $bind_mounts); - if(is_array($bind_mount_lines) && !empty($bind_mount_lines)){ - foreach($bind_mount_lines as $bind_mount_line){ - $bind_mount_line = preg_replace('/\s+/', ' ', $bind_mount_line); - $bind_mount_parts = explode(' ', $bind_mount_line); - if(is_array($bind_mount_parts) && !empty($bind_mount_parts)){ - if($bind_mount_parts[0] == '/var/log/ispconfig/httpd/'.$data['old']['domain'] && $bind_mount_parts[2] == 'none' && strpos($bind_mount_parts[3], 'bind') !== false){ - $subdomain_host = str_replace($data['old']['document_root'].'/log/', '', $bind_mount_parts[1]); - } - } - } - } - */ - // we are deleting the parent domain, so we can delete everything in the log directory - $subdomain_hosts = array(); - $files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..')); - if(is_array($files) && !empty($files)){ - foreach($files as $file){ - if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){ - $subdomain_hosts[] = $file; - } - } - } - } - if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){ - $log_folders = array(); - foreach($subdomain_hosts as $subdomain_host){ - $log_folders[] = $log_folder.'/'.$subdomain_host; - } - } else { - if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; - $log_folder .= '/' . $subdomain_host; - } - $web_folder = $data['old']['web_folder']; - unset($tmp); - unset($subdomain_hosts); - } - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias'){ - if(is_array($log_folders) && !empty($log_folders)){ - foreach($log_folders as $log_folder){ - //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - } - } else { - //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - exec('umount -l '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - } - - // remove letsencrypt if it exists (renew will always fail otherwise) - - $old_domain = $data['old']['domain']; - if(substr($old_domain, 0, 2) === '*.') { - // wildcard domain not yet supported by letsencrypt! - $old_domain = substr($old_domain, 2); - } - $le_conf_file = '/etc/letsencrypt/renewal/' . $old_domain . '.conf'; - @rename('/etc/letsencrypt/renewal/' . $old_domain . '.conf', '/etc/letsencrypt/renewal/' . $old_domain . '.conf~backup'); - } - - //* remove mountpoint from fstab - if(is_array($log_folders) && !empty($log_folders)){ - foreach($log_folders as $log_folder){ - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - } - } else { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - } - unset($log_folders); - - if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['type'] != 'vhostalias' && $data['old']['parent_domain_id'] > 0) { - //* This is a alias domain or subdomain, so we have to update the website instead - $parent_domain_id = intval($data['old']['parent_domain_id']); - $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $parent_domain_id); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update_letsencrypt = true; - // just run the update function - $this->update($event_name, $data); - - } else { - //* This is a website - // Deleting the vhost file, symlink and the data directory - $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); - - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - - $app->system->unlink($vhost_file); - $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { - $docroot = escapeshellcmd($data['old']['document_root']); - if($docroot != '' && !stristr($docroot, '..')) { - if($data['old']['type'] == 'vhost') { - // this is a vhost - we delete everything in here. - exec('rm -rf '.$docroot); - } elseif(!stristr($data['old']['web_folder'], '..')) { - // this is a vhost subdomain - // IMPORTANT: do some folder checks before we delete this! - $do_delete = true; - $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times - if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1); - if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1); - - $path_elements = explode('/', $delete_folder); - - if($path_elements[0] == 'web' || $path_elements[0] === '') { - // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here! - // we use strict check as otherwise directories named '0' may not be deleted - $do_delete = false; - } else { - // read all vhost subdomains and alias with same parent domain - $used_paths = array(); - $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ? AND domain_id != ?", $data['old']['parent_domain_id'], $data['old']['domain_id']); - foreach($tmp as $tmprec) { - // we normalize the folder entries because we need to compare them - $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times - if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1); - if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1); - - // add this path and it's parent paths to used_paths array - while(strpos($tmp_folder, '/') !== false) { - if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; - $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/')); - } - if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; - } - unset($tmp); - - // loop and check if the path is still used and stop at first used one - // set do_delete to false so nothing gets deleted if the web_folder itself is still used - $do_delete = false; - while(count($path_elements) > 0) { - $tmp_folder = implode('/', $path_elements); - if(in_array($tmp_folder, $used_paths) == true) break; - - // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true - $delete_folder = $tmp_folder; - $do_delete = true; - array_pop($path_elements); - } - unset($tmp_folder); - unset($used_paths); - } - - if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder); - - unset($delete_folder); - unset($path_elements); - } - } - - //remove the php fastgi starter script if available - if ($data['old']['php'] == 'fast-cgi') { - $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']); - if($data['old']['type'] == 'vhost') { - if (is_dir($fastcgi_starter_path)) { - exec('rm -rf '.$fastcgi_starter_path); - } - } else { - $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id']; - if (file_exists($fcgi_starter_script)) { - exec('rm -f '.$fcgi_starter_script); - } - } - } - - // remove PHP-FPM pool - if ($data['old']['php'] == 'php-fpm') { - $this->php_fpm_pool_delete($data, $web_config); - } elseif($data['old']['php'] == 'hhvm') { - $this->hhvm_update($data, $web_config); - } - - //remove the php cgi starter script if available - if ($data['old']['php'] == 'cgi') { - // TODO: fetch the date from the server-settings - $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/'; - - $cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']); - if($data['old']['type'] == 'vhost') { - if (is_dir($cgi_starter_path)) { - exec('rm -rf '.$cgi_starter_path); - } - } else { - $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id']; - if (file_exists($cgi_starter_script)) { - exec('rm -f '.$cgi_starter_script); - } - } - } - - $app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG); - - // Delete the symlinks for the sites - $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); - $client_id = intval($client['client_id']); - unset($client); - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // delete the symlink - if(is_link($tmp_symlink)) { - $app->system->unlink($tmp_symlink); - $app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - // end removing symlinks - } - - // Delete the log file directory - $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']); - if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir); - $app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG); - - if($data['old']['type'] == 'vhost') { - //delete the web user - $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel'; - $command .= ' '.escapeshellcmd($data['old']['system_user']); - exec($command); - if($apache_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - } - - //* Remove the awstats configuration file - if($data['old']['stats_type'] == 'awstats') { - $this->awstats_delete($data, $web_config); - } - - if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { - $app->system->web_folder_protection($parent_web_document_root, true); - } - - if($apache_chrooted) { - $app->services->restartServiceDelayed('httpd', 'restart'); - } else { - // request a httpd reload when all records have been processed - $app->services->restartServiceDelayed('httpd', 'reload'); - } - - //* Delete the web-backups - if($data['old']['type'] == 'vhost') { - $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); - $backup_dir = $server_config['backup_dir']; - $mount_backup = true; - if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') { - //* mount backup directory, if necessary - if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $mount_backup = false; - - if($mount_backup){ - $web_backup_dir = $backup_dir.'/web'.$data_old['domain_id']; - //** do not use rm -rf $web_backup_dir because database(s) may exits - exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data_old['domain_id'].'_').'*'); - //* cleanup database - $sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename LIKE ?"; - $app->db->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); - if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); - - $app->log('Deleted the web backup files', LOGLEVEL_DEBUG); - } - } - } - } - if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true); - } - - //* This function is called when a IP on the server is inserted, updated or deleted or when anon_ip setting is altered - function server_ip($event_name, $data) { - global $app, $conf; - - // load the server configuration options - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate('apache_ispconfig.conf.master'); - $tpl->setVar('apache_version', $app->system->getapacheversion()); - $tpl->setVar('logging', $web_config['logging']); - $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); - $records = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ? AND virtualhost = 'y'", $conf['server_id']); - - $records_out= array(); - if(is_array($records)) { - foreach($records as $rec) { - if($rec['ip_type'] == 'IPv6') { - $ip_address = '['.$rec['ip_address'].']'; - } else { - $ip_address = $rec['ip_address']; - } - $ports = explode(',', $rec['virtualhost_port']); - if(is_array($ports)) { - foreach($ports as $port) { - $port = intval($port); - if($port > 0 && $port < 65536 && $ip_address != '') { - $records_out[] = array('ip_address' => $ip_address, 'port' => $port); - } - } - } - } - } - - - if(count($records_out) > 0) { - $tpl->setLoop('ip_adresses', $records_out); - } - - $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf'); - $app->system->file_put_contents($vhost_file, $tpl->grab()); - $app->log('Writing the conf file: '.$vhost_file, LOGLEVEL_DEBUG); - unset($tpl); - - } - - //* Create or update the .htaccess folder protection - function web_folder_user($event_name, $data) { - global $app, $conf; - - $app->uses('system'); - - if($event_name == 'web_folder_user_delete') { - $folder_id = $data['old']['web_folder_id']; - } else { - $folder_id = $data['new']['web_folder_id']; - } - - $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ?", $folder_id); - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); - - if(!is_array($folder) or !is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } - - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; - - //* Get the folder path. - if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); - if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); - $folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']); - if(substr($folder_path, -1) != '/') $folder_path .= '/'; - - //* Check if the resulting path is inside the docroot - if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) { - $app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } - - //* Create the folder path, if it does not exist - if(!is_dir($folder_path)) { - $app->system->mkdirpath($folder_path, 0755, $website['system_user'], $website['system_group']); - } - - //* Create empty .htpasswd file, if it does not exist - if(!is_file($folder_path.'.htpasswd')) { - $app->system->touch($folder_path.'.htpasswd'); - $app->system->chmod($folder_path.'.htpasswd', 0751); - $app->system->chown($folder_path.'.htpasswd', $website['system_user']); - $app->system->chgrp($folder_path.'.htpasswd', $website['system_group']); - $app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } - - if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') { - $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); - $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); - } - - //* Add or remove the user from .htpasswd file - if($event_name == 'web_folder_user_delete') { - $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); - $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); - } else { - if($data['new']['active'] == 'y') { - $app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1); - $app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG); - } - } - - - //* Create the .htaccess file - //if(!is_file($folder_path.'.htaccess')) { - $begin_marker = '### ISPConfig folder protection begin ###'; - $end_marker = "### ISPConfig folder protection end ###\n\n"; - $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker; - - if(file_exists($folder_path.'.htaccess')) { - $old_content = $app->system->file_get_contents($folder_path.'.htaccess'); - - if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) { - $ht_file = str_replace($matches[0], $ht_file, $old_content); - } else { - $ht_file .= $old_content; - } - } - unset($old_content); - - $app->system->file_put_contents($folder_path.'.htaccess', $ht_file); - $app->system->chmod($folder_path.'.htaccess', 0751); - $app->system->chown($folder_path.'.htaccess', $website['system_user']); - $app->system->chgrp($folder_path.'.htaccess', $website['system_group']); - $app->log('Created/modified file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); - //} - + public function __construct() { + $this->plugin_name = get_class($this); + $this->class_name = get_class($this); } - //* Remove .htaccess and .htpasswd file, when folder protection is removed - function web_folder_delete($event_name, $data) { - global $app, $conf; - - $folder_id = $data['old']['web_folder_id']; - - $folder = $data['old']; - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); - - if(!is_array($folder) or !is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } - - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; - - //* Get the folder path. - if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); - if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); - $folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']); - if(substr($folder_path, -1) != '/') $folder_path .= '/'; + //* This function is called during ispconfig installation to determine + // if a symlink shall be created for this plugin. + function onInstall() { + global $conf; - //* Check if the resulting path is inside the docroot - if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG); + if($conf['services']['web'] == true) { + return true; + } else { return false; } - //* Remove .htpasswd file - if(is_file($folder_path.'.htpasswd')) { - $app->system->unlink($folder_path.'.htpasswd'); - $app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } + } - //* Remove .htaccess file - if(is_file($folder_path.'.htaccess')) { - $begin_marker = '### ISPConfig folder protection begin ###'; - $end_marker = "### ISPConfig folder protection end ###\n\n"; - $ht_file = $app->system->file_get_contents($folder_path.'.htaccess'); + /* + This function is called when the plugin is loaded + */ - if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { - $ht_file = str_replace($matches[0], '', $ht_file); - } else { - $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file); - } + function onLoad() { + global $app; - if(trim($ht_file) == '') { - $app->system->unlink($folder_path.'.htaccess'); - $app->log('Removed file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); - } else { - $app->system->file_put_contents($folder_path.'.htaccess', $ht_file); - $app->log('Removed protection content from file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG); - } - } + /* + Register for the events + */ + $app->plugin_webserver_base->registerEvents('apache'); } - //* Update folder protection, when path has been changed - function web_folder_update($event_name, $data) { - global $app, $conf; - - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); - - if(!is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } + // Handle php.ini changes + function php_ini_changed($event_name, $data) { + global $app; - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; + $app->plugin_webserver_base->eventPhpIniChanged($event_name, $data, 'apache'); - //* Get the folder path. - if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1); - if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1); - $old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']); - if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/'; + } - if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1); - if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1); - $new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']); - if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/'; + // Handle the creation of SSL certificates + function ssl($event_name, $data) { + global $app; - //* Check if the resulting path is inside the docroot - if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) { - $app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } - if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) { - $app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } + $app->plugin_webserver_base->eventSsl($event_name, $data, 'apache'); + } - //* Check if the resulting path is inside the docroot - if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); - return false; - } - if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); - return false; - } - //* Create the folder path, if it does not exist - if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path); + function insert($event_name, $data) { + $this->action = 'insert'; + // just run the update function + $this->update($event_name, $data); + } - $begin_marker = '### ISPConfig folder protection begin ###'; - $end_marker = "### ISPConfig folder protection end ###\n\n"; - if($data['old']['path'] != $data['new']['path']) { + function update($event_name, $data) { + global $app; + if($this->action != 'insert') $this->action = 'update'; - //* move .htpasswd file - if(is_file($old_folder_path.'.htpasswd')) { - $app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd'); - $app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } + $app->plugin_webserver_base->eventUpdate($event_name, $data, $this->action, 'apache'); - //* delete old .htaccess file - if(is_file($old_folder_path.'.htaccess')) { - $ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess'); + //* Unset action to clean it for next processed vhost. + $this->action = ''; + } - if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { - $ht_file = str_replace($matches[0], '', $ht_file); - } else { - $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file); - } + function delete($event_name, $data) { + global $app; - if(trim($ht_file) == '') { - $app->system->unlink($old_folder_path.'.htaccess'); - $app->log('Removed file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG); - } else { - $app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file); - $app->log('Removed protection content from file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG); - } - } + $app->plugin_webserver_base->eventDelete($event_name, $data, 'apache'); + } - } + //* This function is called when a IP on the server is inserted, updated or deleted or when anon_ip setting is altered + function server_ip($event_name, $data) { + global $app; - //* Create the .htaccess file - if($data['new']['active'] == 'y') { - $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker; + $app->plugin_webserver_base->eventServerIp($event_name, $data, 'apache'); - if(file_exists($new_folder_path.'.htaccess')) { - $old_content = $app->system->file_get_contents($new_folder_path.'.htaccess'); + } - if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) { - $ht_file = str_replace($matches[0], $ht_file, $old_content); - } else { - $ht_file .= $old_content; - } - } + //* Create or update the .htaccess folder protection + function web_folder_user($event_name, $data) { + global $app; - $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file); - $app->system->chmod($new_folder_path.'.htaccess', 0751); - $app->system->chown($new_folder_path.'.htaccess', $website['system_user']); - $app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']); - $app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); - - //* Create empty .htpasswd file, if it does not exist - if(!is_file($folder_path.'.htpasswd')) { - $app->system->touch($new_folder_path.'.htpasswd'); - $app->system->chmod($new_folder_path.'.htpasswd', 0751); - $app->system->chown($new_folder_path.'.htpasswd', $website['system_user']); - $app->system->chgrp($new_folder_path.'.htpasswd', $website['system_group']); - $app->log('Created file '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } - } + $app->plugin_webserver_base->eventWebFolderUser($event_name, $data, 'apache'); - //* Remove .htaccess file - if($data['new']['active'] == 'n' && is_file($new_folder_path.'.htaccess')) { - $ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess'); + } - if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) { - $ht_file = str_replace($matches[0], '', $ht_file); - } else { - $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file); - } + //* Remove .htaccess and .htpasswd file, when folder protection is removed + function web_folder_delete($event_name, $data) { + global $app; - if(trim($ht_file) == '') { - $app->system->unlink($new_folder_path.'.htaccess'); - $app->log('Removed file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); - } else { - $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file); - $app->log('Removed protection content from file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG); - } - } + $app->plugin_webserver_base->eventWebFolderDelete($event_name, $data, 'apache'); + } + //* Update folder protection, when path has been changed + function web_folder_update($event_name, $data) { + global $app; + $app->plugin_webserver_base->eventWebFolderUpdate($event_name, $data, 'apache'); } public function ftp_user_delete($event_name, $data) { - global $app, $conf; + global $app; $ftpquota_file = $data['old']['dir'].'/.ftpquota'; if(file_exists($ftpquota_file)) $app->system->unlink($ftpquota_file); - } - - /** * This function is called when a Webdav-User is inserted, updated or deleted. * @@ -2600,10 +177,10 @@ class apache2_plugin { /* Check if this is a chrooted setup */ if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $apache_chrooted = true; + $is_chrooted = true; $app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG); } else { - $apache_chrooted = false; + $is_chrooted = false; } //* We dont want to have relative paths here @@ -2661,12 +238,12 @@ class apache2_plugin { * Next step, patch the vhost - file */ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost'); - $this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav'); + $app->plugin_webserver_base->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav'); /* * Last, restart apache */ - if($apache_chrooted) { + if($is_chrooted) { $app->services->restartServiceDelayed('httpd', 'restart'); } else { // request a httpd reload when all records have been processed @@ -2693,12 +270,12 @@ class apache2_plugin { * Next step, patch the vhost - file */ $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost'); - $this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav'); + $app->plugin_webserver_base->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav'); /* * Last, restart apache */ - if($apache_chrooted) { + if($is_chrooted) { $app->services->restartServiceDelayed('httpd', 'restart'); } else { // request a httpd reload when all records have been processed @@ -2715,7 +292,7 @@ class apache2_plugin { * @param string $filename The name of the digest-file * @param string $username The name of the webdav-user * @param string $authname The name of the realm - * @param string $pwd The password-hash of the user + * @param string $pwdhash The password-hash of the user */ private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) { global $app; @@ -2763,553 +340,11 @@ class apache2_plugin { } } - /** - * This function patches the vhost-file and adds all webdav - user. - * This function is written, because the creation of the vhost - file is sophisticated and - * i don't want to make it more "heavy" by also adding this code too... - * @author Oliver Vogel - * @param string $fileName The Name of the .vhost-File (path included) - * @param string $webdavRoot The root of the webdav-folder - */ - private function _patchVhostWebdav($fileName, $webdavRoot) { - global $app; - $in = fopen($fileName, 'r'); - $output = ''; - $inWebdavSection = false; - //* read line by line and search for the username and authname - while ($line = fgets($in)) { - //* is the "replace-comment" found... - if (trim($line) == '# WEBDAV BEGIN') { - //* The begin of the webdav - section is found, so ignore all lines til the end is found - $inWebdavSection = true; - $output .= "# WEBDAV BEGIN\n"; - //* add all the webdav-dirs to the webdav-section - $files = @scandir($webdavRoot); - if(is_array($files)) { - foreach($files as $file) { - if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/", $file)) { - //* found a htdigest - file, so add it to webdav - $fn = substr($file, 0, strlen($file) - strlen('.htdigest')); - $output .= "\n"; - $output .= "Alias /webdav/$fn $webdavRoot/$fn\n"; - $output .= "\n"; - $output .= "DAV On\n"; - $output .= "BrowserMatch MSIE AuthDigestEnableQueryStringHack=On\n"; - $output .= "AuthType Digest\n"; - if($fn != '' && $fn != '/') { - $output .= "AuthName \"" . $fn . "\"\n"; - } else { - $output .= "AuthName \"Restricted Area\"\n"; - } - $output .= "AuthUserFile $webdavRoot/$file\n"; - $output .= "Require valid-user\n"; - $output .= "Options +Indexes\n"; - if($app->system->getapacheversion()<=2.2) - $output .= "Order allow,deny\nAllow from all\n"; - $output .= "\n"; - } - } - } - } - //* is the "replace-comment-end" found... - if (trim($line) == '# WEBDAV END') { - //* The end of the webdav - section is found, so stop ignoring - $inWebdavSection = false; - } - //* Write the line to the output, if it is not in the section - if (!$inWebdavSection) { - $output .= $line; - } - } - fclose($in); - //* Now lets write the new file - $app->system->file_put_contents($fileName, $output); - } - - //* Update the awstats configuration file - private function awstats_update ($data, $web_config) { - global $app; - - $web_folder = $data['new']['web_folder']; - if($data['new']['type'] == 'vhost') $web_folder = 'web'; - $awstats_conf_dir = $web_config['awstats_conf_dir']; - - if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats"); - if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) { - if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { - $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); - } - - $content = ''; - if (is_file($awstats_conf_dir."/awstats.conf")) { - $include_file = $awstats_conf_dir."/awstats.conf"; - } elseif (is_file($awstats_conf_dir."/awstats.model.conf")) { - $include_file = $awstats_conf_dir."/awstats.model.conf"; - } - $content .= "Include \"".$include_file."\"\n"; - $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n"; - $content .= "SiteDomain=\"".$data['new']['domain']."\"\n"; - $content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n"; - - if (isset($include_file)) { - $app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content); - $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG); - } else { - $app->log("No awstats base config found. Either awstats.conf or awstats.model.conf must exist in ".$awstats_conf_dir.".", LOGLEVEL_WARN); - } - } - - if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html"); - if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) { - $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); - } else { - $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); - } - } - - //* Delete the awstats configuration file - private function awstats_delete ($data, $web_config) { - global $app; - - $awstats_conf_dir = $web_config['awstats_conf_dir']; - - if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { - $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); - $app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG); - } - } - - private function hhvm_update($data, $web_config) { - global $app, $conf; - - if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_starter.master')) { - $content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_starter.master'); - } else { - $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master'); - } - if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) { - $monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master'); - } else { - $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master'); - } - - if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || ($data['new']['php'] == 'hhvm' && isset($data['old']['custom_php_ini']) && $data['new']['custom_php_ini'] != $data['old']['custom_php_ini'])) { - - // Custom php.ini settings - $custom_php_ini_settings = trim($data['new']['custom_php_ini']); - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $custom_php_ini_settings .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - if($custom_php_ini_settings != ''){ - // Make sure we only have Unix linebreaks - $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); - $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); - if(@is_dir('/etc/hhvm')) file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); - } else { - if($data['old']['system_user'] != '' && is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - } - - $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); - file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); - exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); - exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); - exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); - - if(is_dir('/etc/monit/conf.d')){ - $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); - file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); - if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); - exec('/etc/init.d/monit restart >/dev/null 2>&1'); - } - - } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { - if($data['old']['system_user'] != ''){ - exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); - exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); - unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); - if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - } - - if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ - if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user'])){ - unlink('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']); - } - if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ - unlink('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user']); - } - exec('/etc/init.d/monit restart >/dev/null 2>&1'); - } - } - } - - //* Update the PHP-FPM pool configuration file - private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) { - global $app, $conf; - $pool_dir = trim($pool_dir); - //$reload = false; - - if($data['new']['php'] == 'php-fpm'){ - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } else { - if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } - - $app->uses("getconf"); - $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - - if($data['new']['php'] != 'php-fpm'){ - if(@is_file($pool_dir.$pool_name.'.conf')){ - $app->system->unlink($pool_dir.$pool_name.'.conf'); - //$reload = true; - } - if($data['old']['php'] == 'php-fpm'){ - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - //if($reload == true) $app->services->restartService('php-fpm','reload'); - return; - } - - $app->load('tpl'); - $tpl = new tpl(); - $tpl->newTemplate('php_fpm_pool.conf.master'); - $tpl->setVar('apache_version', $app->system->getapacheversion()); - $tpl->setVar('apache_full_version', $app->system->getapacheversion(true)); - - if($data['new']['php_fpm_use_socket'] == 'y'){ - $use_tcp = 0; - $use_socket = 1; - if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir); - } else { - $use_tcp = 1; - $use_socket = 0; - } - $tpl->setVar('use_tcp', $use_tcp); - $tpl->setVar('use_socket', $use_socket); - - $fpm_socket = $socket_dir.$pool_name.'.sock'; - $tpl->setVar('fpm_socket', $fpm_socket); - $tpl->setVar('fpm_listen_mode', '0660'); - - $tpl->setVar('fpm_pool', $pool_name); - $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); - $tpl->setVar('fpm_user', $data['new']['system_user']); - $tpl->setVar('fpm_group', $data['new']['system_group']); - $tpl->setVar('fpm_listen_user', $data['new']['system_user']); - $tpl->setVar('fpm_listen_group', $web_config['group']); - $tpl->setVar('fpm_domain', $data['new']['domain']); - $tpl->setVar('pm', $data['new']['pm']); - $tpl->setVar('pm_max_children', $data['new']['pm_max_children']); - $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']); - $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']); - $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']); - $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']); - $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']); - $tpl->setVar('document_root', $data['new']['document_root']); - $tpl->setVar('security_level', $web_config['security_level']); - $tpl->setVar('domain', $data['new']['domain']); - $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']); - $tpl->setVar('php_open_basedir', $php_open_basedir); - if($php_open_basedir != ''){ - $tpl->setVar('enable_php_open_basedir', ''); - } else { - $tpl->setVar('enable_php_open_basedir', ';'); - } - - // Custom php.ini settings - $final_php_ini_settings = array(); - $custom_php_ini_settings = trim($data['new']['custom_php_ini']); - - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'apache' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $custom_php_ini_settings .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - - $custom_session_save_path = false; - if($custom_php_ini_settings != ''){ - // Make sure we only have Unix linebreaks - $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); - $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); - $ini_settings = explode("\n", $custom_php_ini_settings); - if(is_array($ini_settings) && !empty($ini_settings)){ - foreach($ini_settings as $ini_setting){ - $ini_setting = trim($ini_setting); - if(substr($ini_setting, 0, 1) == ';') continue; - if(substr($ini_setting, 0, 1) == '#') continue; - if(substr($ini_setting, 0, 2) == '//') continue; - list($key, $value) = explode('=', $ini_setting, 2); - $value = trim($value); - if($value != ''){ - $key = trim($key); - if($key == 'session.save_path') $custom_session_save_path = true; - switch (strtolower($value)) { - case '0': - // PHP-FPM might complain about invalid boolean value if you use 0 - $value = 'off'; - case '1': - case 'on': - case 'off': - case 'true': - case 'false': - case 'yes': - case 'no': - $final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value); - break; - default: - $final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value); - } - } - } - } - } - - $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); - - $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); - - $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab()); - $app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - unset($tpl); - - // delete pool in all other PHP versions - $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); - if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; - if($default_pool_dir != $pool_dir){ - if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($default_pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $conf["server_id"]); - if(is_array($php_versions) && !empty($php_versions)){ - foreach($php_versions as $php_version){ - $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); - if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; - if($php_version['php_fpm_pool_dir'] != $pool_dir){ - if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { - $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); - } - } - } - } - // Reload current PHP-FPM after all others - sleep(1); - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - - //$reload = true; - - //if($reload == true) $app->services->restartService('php-fpm','reload'); - } - - //* Delete the PHP-FPM pool configuration file - private function php_fpm_pool_delete ($data, $web_config) { - global $app, $conf; - - if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - - if($default_php_fpm){ - $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); - } else { - $pool_dir = $custom_php_fpm_pool_dir; - } - $pool_dir = trim($pool_dir); - - if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; - $pool_name = 'web'.$data['old']['domain_id']; - - if ( @is_file($pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - - //$app->services->restartService('php-fpm','reload'); - } - - // delete pool in all other PHP versions - $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); - if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; - if($default_pool_dir != $pool_dir){ - if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($default_pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $data['old']['server_id']); - if(is_array($php_versions) && !empty($php_versions)){ - foreach($php_versions as $php_version){ - $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); - if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; - if($php_version['php_fpm_pool_dir'] != $pool_dir){ - if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { - $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); - } - } - } - } - - // Reload current PHP-FPM after all others - sleep(1); - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - function client_delete($event_name, $data) { - global $app, $conf; - - $app->uses("getconf"); - $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - - $client_id = intval($data['old']['client_id']); - if($client_id > 0) { - - $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id; - if(is_dir($client_dir) && !stristr($client_dir, '..')) { - // remove symlinks from $client_dir - $files = array_diff(scandir($client_dir), array('.', '..')); - if(is_array($files) && !empty($files)){ - foreach($files as $file){ - if(is_link($client_dir.'/'.$file)){ - unlink($client_dir.'/'.$file); - $app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG); - } - } - } - - @rmdir($client_dir); - $app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG); - } - - if($app->system->is_group('client'.$client_id)){ - $app->system->_exec('groupdel client'.$client_id); - $app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG); - } - } - - } - - private function _checkTcp ($host, $port) { - - $fp = @fsockopen($host, $port, $errno, $errstr, 2); - - if ($fp) { - fclose($fp); - return true; - } else { - return false; - } - } - - private function _rewrite_quote($string) { - return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string); - } + global $app; - private function _is_url($string) { - return preg_match('/^(f|ht)tp(s)?:\/\//i', $string); + $app->plugin_webserver_base->eventClientDelete($event_name, $data, 'apache'); } - private function get_seo_redirects($web, $prefix = ''){ - $seo_redirects = array(); - - if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*'; - - if($web['subdomain'] == 'www' || $web['subdomain'] == '*'){ - $domain = str_replace('.', '\.', $web['domain']); - if($web['seo_redirect'] == 'non_www_to_www'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $domain; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = ''; - } - if($web['seo_redirect'] == '*_domain_tld_to_www_domain_tld'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $domain.'|.*\.'.$domain.'(? diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index 88b5aa290cabb3c953b5a2e5ea10ceda14ecdcdc..32a62174ffc15681633fcb9c39f30f1639f06d01 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -106,6 +106,16 @@ class apps_vhost_plugin { $vhost_port_listen = '#'; } $tpl->setVar('vhost_port_listen', $vhost_port_listen); + + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['content_filter'] == 'rspamd'){ + $use_rspamd = true; + exec('/usr/sbin/a2enmod proxy'); + exec('/usr/sbin/a2enmod proxy_http'); + } else { + $use_rspamd = false; + } + $tpl->setVar('use_rspamd', $use_rspamd); $content = $tpl->grab(); @@ -183,6 +193,19 @@ class apps_vhost_plugin { } $content = str_replace('{use_tcp}', $use_tcp, $content); $content = str_replace('{use_socket}', $use_socket, $content); + + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['content_filter'] == 'rspamd'){ + $use_rspamd = ''; + } else { + $use_rspamd = '#'; + } + $content = str_replace('{use_rspamd}', $use_rspamd, $content); + + // Fix socket path on PHP 7 systems + if(file_exists('/var/run/php/php7.0-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); + if(file_exists('/var/run/php/php7.1-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.1-fpm.sock', $content); + if(file_exists('/var/run/php/php7.2-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.2-fpm.sock', $content); // PHP-FPM // Dont just copy over the php-fpm pool template but add some custom settings @@ -216,7 +239,3 @@ class apps_vhost_plugin { } // end class - - - -?> diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php index 935196eb52a46fc0c7d4184ecd55510ec5426bd1..cba46b85784606e4e3e5ed084f5dff028412cc84 100644 --- a/server/plugins-available/backup_plugin.inc.php +++ b/server/plugins-available/backup_plugin.inc.php @@ -93,32 +93,6 @@ class backup_plugin { } } - //* Restore a MongoDB backup - if($action_name == 'backup_restore' && $backup['backup_type'] == 'mongodb') { - if(file_exists($backup_dir.'/'.$backup['filename'])) { - //$parts = explode('_',$backup['filename']); - //$db_name = $parts[1]; - preg_match('@^db_(.+)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.tar\.gz$@', $backup['filename'], $matches); - $db_name = $matches[1]; - - // extract tar.gz archive - $dump_directory = str_replace(".tar.gz", "", $backup['filename']); - $extracted = "/usr/local/ispconfig/server/temp"; - exec("tar -xzvf ".escapeshellarg($backup_dir.'/'.$backup['filename'])." --directory=".escapeshellarg($extracted)); - $restore_directory = $extracted."/".$dump_directory."/".$db_name; - - // mongorestore -h 127.0.0.1 -u root -p 123456 --authenticationDatabase admin -d c1debug --drop ./toRestore - $command = "mongorestore -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d ".$db_name." --drop ".escapeshellarg($restore_directory); - exec($command); - exec("rm -rf ".escapeshellarg($extracted."/".$dump_directory)); - } - - unset($clientdb_host); - unset($clientdb_user); - unset($clientdb_password); - $app->log('Restored MongoDB backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG); - } - //* Restore a mysql backup if($action_name == 'backup_restore' && $backup['backup_type'] == 'mysql') { //* Load sql dump into db @@ -296,7 +270,7 @@ class backup_plugin { unlink($mail_backup_file); $sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?"; $app->db->query($sql, $conf['server_id'], $mail_backup['parent_domain_id'], $mail_backup['filename']); - if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql); + if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $mail_backup['parent_domain_id'], $mail_backup['filename']); $app->log('unlink '.$backup_dir.'/'.$mail_backup['filename'], LOGLEVEL_DEBUG); } } diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php index edf7b93d9f1ea62f8b314a62b73c77f15e5ca678..25ac0bb8ebb12f6e9a3159b421818aed45e29cb9 100644 --- a/server/plugins-available/bind_plugin.inc.php +++ b/server/plugins-available/bind_plugin.inc.php @@ -296,9 +296,14 @@ class bind_plugin { //* Check the zonefile if(is_file($filename.'.err')) unlink($filename.'.err'); - exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename), $out, $return_status); + $out=array(); + exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename).' 2>&1', $out, $return_status); + $statustext=''; + foreach ($out as $line) $statustext .= $line."\n"; if($return_status === 0) { $app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG); + $app->db->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']); + $app->dbmaster->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']); } else { $loglevel = @($dns_config['disable_bind_log'] === 'y')?'LOGLEVEL_DEBUG':'LOGLEVEL_WARN'; $app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel); @@ -314,6 +319,8 @@ class bind_plugin { } else { rename($filename, $filename.'.err'); } + $app->db->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']); + $app->dbmaster->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']); } unset($tpl); unset($records); @@ -357,8 +364,8 @@ class bind_plugin { if(is_file($filename)) unlink($filename); if(is_file($filename.'.err')) unlink($filename.'.err'); if(is_file($filename.'.signed')) unlink($filename.'.signed'); - } - + } + //* Restart bind nameserver if update_acl is not empty, otherwise reload it if($data['new']['update_acl'] != '') { $app->services->restartServiceDelayed('bind', 'restart'); @@ -610,4 +617,5 @@ class bind_plugin { } // end class + ?> diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php index 17f48efe26cfc1d16cd27082f352289b8e5b4182..2b9384826a3b83ed1caccbbcb6a3e7a02e9aca7e 100644 --- a/server/plugins-available/mail_plugin.inc.php +++ b/server/plugins-available/mail_plugin.inc.php @@ -145,11 +145,9 @@ class mail_plugin { } else { // Dovecot uses a different mail layout with a separate 'Maildir' subdirectory. - if($mail_config['pop3_imap_daemon'] == 'dovecot') { - $app->system->mkdirpath($maildomain_path, 0700, $user, $group); - $app->log('Created Directory: '.$maildomain_path, LOGLEVEL_DEBUG); - $maildomain_path .= '/Maildir'; - } + $app->system->mkdirpath($maildomain_path, 0700, $user, $group); + $app->log('Created Directory: '.$maildomain_path, LOGLEVEL_DEBUG); + $maildomain_path .= '/Maildir'; //* When the mail user dir exists but it is not a valid maildir, move it to corrupted maildir folder if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) { @@ -163,12 +161,6 @@ class mail_plugin { //exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); $app->system->maildirmake($maildomain_path, $user, '', $group); - - //* This is to fix the maildrop quota not being rebuilt after the quota is changed. - if($mail_config['pop3_imap_daemon'] != 'dovecot') { - if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$user); // Avoid maildirmake quota bug, see debian bug #214911 - $app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$user, LOGLEVEL_DEBUG); - } } if(!is_dir($data['new']['maildir'].'/.Sent')) { @@ -196,13 +188,6 @@ class mail_plugin { exec('chown -R '.$user.':'.$group.' '.escapeshellcmd($data['new']['maildir'])); $app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_DEBUG); - //* Set the maildir quota - if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') { - if($data['new']['quota'] > 0) { - if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$user); - $app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$user, LOGLEVEL_DEBUG); - } - } } //* Send the welcome email message @@ -360,11 +345,9 @@ class mail_plugin { } else { // Dovecot uses a different mail layout with a separate 'Maildir' subdirectory. - if($mail_config['pop3_imap_daemon'] == 'dovecot') { - $app->system->mkdirpath($maildomain_path, 0700, $user, $group); - $app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG); - $maildomain_path .= '/Maildir'; - } + $app->system->mkdirpath($maildomain_path, 0700, $user, $group); + $app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG); + $maildomain_path .= '/Maildir'; //* When the mail user dir exists but it is not a valid maildir, move it to corrupted maildir folder if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) { @@ -378,17 +361,6 @@ class mail_plugin { //exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); //$app->log("Created Maildir "."su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); $app->system->maildirmake($maildomain_path, $user, '', $group); - - //* This is to fix the maildrop quota not being rebuilt after the quota is changed. - if($mail_config['pop3_imap_daemon'] != 'dovecot') { - if($data['new']['quota'] > 0) { - if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$user); // Avoid maildirmake quota bug, see debian bug #214911 - $app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$user, LOGLEVEL_DEBUG); - } else { - if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize'); - $app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG); - } - } } if(!is_dir($data['new']['maildir'].'/.Sent')) { @@ -429,16 +401,6 @@ class mail_plugin { $app->log('Moved Maildir from: '.$data['old']['maildir'].' to '.$data['new']['maildir'], LOGLEVEL_DEBUG); } //This is to fix the maildrop quota not being rebuilt after the quota is changed. - // Courier Layout - if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') { - if($data['new']['quota'] > 0) { - if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$user); - $app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$user, LOGLEVEL_DEBUG); - } else { - if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize'); - $app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG); - } - } } } diff --git a/server/plugins-available/mail_plugin_dkim.inc.php b/server/plugins-available/mail_plugin_dkim.inc.php index 26de6ca4af3b8aebc832d9ee8476b7fd363a1be5..699fac3ea589bc6e897e91922d65de377a85985d 100755 --- a/server/plugins-available/mail_plugin_dkim.inc.php +++ b/server/plugins-available/mail_plugin_dkim.inc.php @@ -104,6 +104,9 @@ class mail_plugin_dkim { function check_system($data) { global $app, $mail_config; + /** TODO: FIX IF ONLY RSPAMD IS INSTALLED AND NO AMAVIS! **/ + /** TODO: FIX DKIM FOR RSPAMD, RSPAMD CANNOT READ FILES OF amavis:root **/ + $app->uses('getconf'); $check=true; diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php deleted file mode 100644 index 2fefa26cfc95cfc697dc456278f136258543628b..0000000000000000000000000000000000000000 --- a/server/plugins-available/maildrop_plugin.inc.php +++ /dev/null @@ -1,270 +0,0 @@ -plugins->registerEvent('mail_user_insert', 'maildrop_plugin', 'update'); - $app->plugins->registerEvent('mail_user_update', 'maildrop_plugin', 'update'); - $app->plugins->registerEvent('mail_user_delete', 'maildrop_plugin', 'delete'); - - } - - - function update($event_name, $data) { - global $app, $conf; - - // load the server configuration options - $app->uses("getconf"); - $mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail'); - if(substr($mail_config["homedir_path"], -1) == '/') { - $mail_config["homedir_path"] = substr($mail_config["homedir_path"], 0, -1); - } - $this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters'; - - - // Check if the config directory exists. - if(!is_dir($this->mailfilter_config_dir)) { - $app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.", LOGLEVEL_WARN); - mkdir($this->mailfilter_config_dir); - chown($this->mailfilter_config_dir, 'vmail'); - chmod($this->mailfilter_config_dir, 0770); - } - - if(isset($data["new"]["email"])) { - $email_parts = explode("@", $data["new"]["email"]); - } else { - $email_parts = explode("@", $data["old"]["email"]); - } - - // make sure that the config directories exist - if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1])) { - mkdir($this->mailfilter_config_dir.'/'.$email_parts[1]); - chown($this->mailfilter_config_dir.'/'.$email_parts[1], 'vmail'); - chmod($this->mailfilter_config_dir.'/'.$email_parts[1], 0770); - } - if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0])) { - mkdir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); - chown($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 'vmail'); - chmod($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 0770); - } - - // Check if something has been changed regarding the autoresponders - if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] - or $data["old"]["autoresponder"] != $data["new"]["autoresponder"] - or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"]) - or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"] - or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) { - - // We delete the old autoresponder, if it exists - $email_parts = explode("@", $data["old"]["email"]); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - - - //Now we create the new autoresponder, if it is enabled - if($data["new"]["autoresponder"] == 'y') { - if(isset($data["new"]["email"])) { - $email_parts = explode("@", $data["new"]["email"]); - } else { - $email_parts = explode("@", $data["old"]["email"]); - } - - // Load the master template - if(file_exists($conf["rootpath"].'/conf-custom/autoresponder.master')) { - $tpl = file_get_contents($conf["rootpath"].'/conf-custom/autoresponder.master'); - } else { - $tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master'); - } - $tpl = str_replace('{vmail_mailbox_base}', $mail_config["homedir_path"], $tpl); - - if ($data['new']['autoresponder_start_date'] && $data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set - $tpl = str_replace('{start_date}', strtotime($data["new"]["autoresponder_start_date"]), $tpl); - $tpl = str_replace('{end_date}', strtotime($data["new"]["autoresponder_end_date"]), $tpl); - } else { - $tpl = str_replace('{start_date}', -7200, $tpl); - $tpl = str_replace('{end_date}', 2147464800, $tpl); - } - - // Write the config file. - $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; - file_put_contents($config_file_path, $tpl); - $app->log("Writing Autoresponder mailfilter file: $config_file_path", LOGLEVEL_DEBUG); - chmod($config_file_path, 0770); - chown($config_file_path, 'vmail'); - unset($tpl); - unset($config_file_path); - - // Write the autoresponder message file - $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; - file_put_contents($config_file_path, $data["new"]["autoresponder_text"]); - chmod($config_file_path, 0770); - chown($config_file_path, 'vmail'); - $app->log("Writing Autoresponder message file: $config_file_path", LOGLEVEL_DEBUG); - } - } - - // Write the custom mailfilter script, if mailfilter recipe has changed - if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"] - or $data["old"]["move_junk"] != $data["new"]["move_junk"] - or $data["old"]["cc"] != $data["new"]["cc"]) { - - $app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG); - if(trim($data["new"]["custom_mailfilter"]) != '' - or $data["new"]["move_junk"] != 'n' - or $data["new"]["cc"] != '') { - - // Delete the old filter recipe - $email_parts = explode("@", $data["old"]["email"]); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - - // write the new recipe - if(isset($data["new"]["email"])) { - $email_parts = explode("@", $data["new"]["email"]); - } else { - $email_parts = explode("@", $data["old"]["email"]); - } - $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; - - $mailfilter_content = ''; - - if($data["new"]["cc"] != '') { - $tmp_mails_arr = explode(',',$data["new"]["cc"]); - foreach($tmp_mails_arr as $address) { - if(trim($address) != '') $mailfilter_content .= "cc \"!".trim($address)."\"\n"; - } - //$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n"; - $app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.', LOGLEVEL_DEBUG); - } - - if($data["new"]["move_junk"] == 'y') { - if(file_exists($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')) { - $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')."\n"; - } else { - $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n"; - } - } - $mailfilter_content .= str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]); - - // Replace windows linebreaks in mailfilter file - $mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content); - - file_put_contents($config_file_path, $mailfilter_content); - $app->log("Writing new custom Mailfiter".$config_file_path, LOGLEVEL_DEBUG); - chmod($config_file_path, 0770); - chown($config_file_path, 'vmail'); - unset($config_file_path); - } else { - // Delete the mailfilter recipe - if(isset($data["old"]["email"])) { - $email_parts = explode("@", $data["old"]["email"]); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; - if(is_file($file)) { - unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $app->log("Deleting custom Mailfiter".$file, LOGLEVEL_DEBUG); - } - } - } - } - } - - function delete($event_name, $data) { - global $app, $conf; - - // load the server configuration options - $app->uses("getconf"); - $mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail'); - $this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters'; - - $email_parts = explode("@", $data["old"]["email"]); - $dir = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]; - if(is_dir($dir)) { - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN); - rmdir($dir) or $app->log("Unable to delete directory: $dir", LOGLEVEL_WARN); - } - } - - -} // end class - -?> diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php deleted file mode 100644 index 99ac9db7d23d8add4c1a0f5d94f447c265e282b9..0000000000000000000000000000000000000000 --- a/server/plugins-available/mailman_plugin.inc.php +++ /dev/null @@ -1,182 +0,0 @@ -plugins->registerEvent('mail_mailinglist_insert', 'mailman_plugin', 'insert'); - $app->plugins->registerEvent('mail_mailinglist_update', 'mailman_plugin', 'update'); - $app->plugins->registerEvent('mail_mailinglist_delete', 'mailman_plugin', 'delete'); - - - - } - - function insert($event_name, $data) { - global $app, $conf; - - $this->update_config(); - - $pid = exec("nohup /usr/lib/mailman/bin/newlist -u ".escapeshellcmd($data["new"]["domain"])." -e ".escapeshellcmd($data["new"]["domain"])." ".escapeshellcmd($data["new"]["listname"])." ".escapeshellcmd($data["new"]["email"])." ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 & echo $!;"); - // wait for /usr/lib/mailman/bin/newlist-call - $running = true; - do { - exec('ps -p '.intval($pid), $out); - if (count($out) ==1) $running=false; else sleep(1); - unset($out); - } while ($running); - unset($out); - if(is_file('/etc/mailman/virtual-mailman') && !is_link('/var/lib/mailman/data/virtual-mailman')) { - symlink('/etc/mailman/virtual-mailman','/var/lib/mailman/data/virtual-mailman'); - } - if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman'); - if(is_file('/var/lib/mailman/data/transport-mailman')) exec('postmap /var/lib/mailman/data/transport-mailman'); - - exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &'); - - // Fix list URL - exec('/usr/sbin/withlist -l -r fix_url '.escapeshellcmd($data["new"]["listname"])); - - $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ?", $data["new"]['mailinglist_id']); - - } - - // The purpose of this plugin is to rewrite the main.cf file - function update($event_name, $data) { - global $app, $conf; - - $this->update_config(); - - if($data["new"]["password"] != $data["old"]["password"] && $data["new"]["password"] != '') { - exec("nohup /usr/lib/mailman/bin/change_pw -l ".escapeshellcmd($data["new"]["listname"])." -p ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &"); - exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &'); - $app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ?", $data["new"]['mailinglist_id']); - } - - if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman'); - if(is_file('/var/lib/mailman/data/transport-mailman')) exec('postmap /var/lib/mailman/data/transport-mailman'); - } - - function delete($event_name, $data) { - global $app, $conf; - - $this->update_config(); - - exec("nohup /usr/lib/mailman/bin/rmlist -a ".escapeshellcmd($data["old"]["listname"])." >/dev/null 2>&1 &"); - - exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &'); - - if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman'); - if(is_file('/var/lib/mailman/data/transport-mailman')) exec('postmap /var/lib/mailman/data/transport-mailman'); - - } - - function update_config() { - global $app, $conf; - - copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py~'); - - // load the server configuration options - $app->uses('getconf'); - $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); - - // load files - if(file_exists($conf["rootpath"]."/conf-custom/mm_cfg.py.master")) { - $content = file_get_contents($conf["rootpath"]."/conf-custom/mm_cfg.py.master"); - } else { - $content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master"); - } - $old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py"); - - $old_options = array(); - $lines = explode("\n", $old_file); - foreach ($lines as $line) - { - if (strlen($line) && substr($line, 0, 1) != '#') - { - list($key, $value) = explode("=", $line); - if ($value && $value !== '') - { - $key = rtrim($key); - $old_options[$key] = trim($value); - } - } - } - - // create virtual_domains list - $domainAll = $app->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain"); - $virtual_domains = ''; - foreach($domainAll as $domain) - { - if ($domainAll[0]['domain'] == $domain['domain']) - $virtual_domains .= "'".$domain['domain']."'"; - else - $virtual_domains .= ", '".$domain['domain']."'"; - } - - $content = str_replace('{hostname}', $server_config['hostname'], $content); - $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content); - $content = str_replace('{virtual_domains}', $virtual_domains, $content); - - file_put_contents($this->mailman_config_dir."/mm_cfg.py", $content); - } - -} // end class - -?> diff --git a/server/plugins-available/mlmmj_plugin.inc.php b/server/plugins-available/mlmmj_plugin.inc.php deleted file mode 100644 index 7f1130e01c7455cbf9957ed68060109f2550326d..0000000000000000000000000000000000000000 --- a/server/plugins-available/mlmmj_plugin.inc.php +++ /dev/null @@ -1,406 +0,0 @@ - 10100 Srl -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of ISPConfig nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* -templates/mail_mailinglist_list.htm -templates/mail_mailinglist_edit.htm - -list/mail_mailinglist.list.php - -form/mail_mailinglist.tform.php - -mailinglist.php -mail_mailinglist_list.php -mail_mailinglist_edit.php -mail_mailinglist_del.php -*/ - -class mlmmj_plugin { - const ML_ALIAS = 0; - const ML_TRANSPORT = 1; - const ML_VIRTUAL = 2; - const SECONDS_IN_DAY = 86400; - - private $plugin_name = 'mlmmj_plugin'; - private $class_name = 'mlmmj_plugin'; - private $mlmmj_config_dir = '/etc/mlmmj/'; - - /* - This function is called during ispconfig installation to determine - if a symlink shall be created for this plugin. - */ - function onInstall() { - global $conf; - - if($conf['services']['mail'] == true) return true; - else return false; - } - - //This function is called when the plugin is loaded - function onLoad() { - global $app; - - // Register for the events - $app->plugins->registerEvent('mail_mailinglist_insert', $this->plugin_name, 'list_insert'); - $app->plugins->registerEvent('mail_mailinglist_update', $this->plugin_name, 'list_update'); - $app->plugins->registerEvent('mail_mailinglist_delete', $this->plugin_name, 'list_delete'); - - $app->plugins->registerEvent('mail_ml_member_insert', $this->plugin_name, 'member_insert'); - $app->plugins->registerEvent('mail_ml_member_update', $this->plugin_name, 'member_update'); - $app->plugins->registerEvent('mail_ml_member_delete', $this->plugin_name, 'member_delete'); - - } - - function list_insert($event_name, $data) { - global $app, $conf; - - $mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager']; - - if($mlManager == 'mlmmj') { - $mlConf = $this->getMlConfig(); - $rec = $data['new']; - $listDomain = $rec['domain']; - $listName = $rec['listname']; - $listDir = $mlConf['spool_dir']."/$listDomain/$listName"; - $lang = 'en'; - $owner = $rec['email']; - - // Creating ML directories structure - mkdir("$listDir/incoming", 0755, true); - mkdir("$listDir/queue/discarded", 0755, true); - mkdir("$listDir/archive", 0755, true); - mkdir("$listDir/text", 0755, true); - mkdir("$listDir/subconf", 0755, true); - mkdir("$listDir/unsubconf", 0755, true); - mkdir("$listDir/bounce", 0755, true); - mkdir("$listDir/control", 0755, true); - mkdir("$listDir/moderation", 0755, true); - mkdir("$listDir/subscribers.d", 0755, true); - mkdir("$listDir/digesters.d", 0755, true); - mkdir("$listDir/requeue", 0755, true); - mkdir("$listDir/nomailsubs.d", 0755, true); - - // Creating ML index file - touch("$listDir/index"); - - // Creating default control files - // WARNING: Edit this section if default DB values will be modified! - touch("$listDir/control/nodigestsub"); - touch("$listDir/control/noarchive"); - file_put_contents("$listDir/control/owner", $owner); - file_put_contents("$listDir/control/listaddress", "$listName@$listDomain"); - file_put_contents("$listDir/control/prefix", "[$listName]"); - - // Copying language translations - if(!is_dir("/usr/share/mlmmj/text.skel/$lang")) $lang = 'en'; - foreach (glob("/usr/share/mlmmj/text.skel/$lang/*") as $filename) - copy($filename, "$listDir/text/".basename($filename)); - - // The mailinglist directory have to be owned by the user running the mailserver - $this->changeOwnership($listDir); - - // Creating alias entry - $this->addMapEntry("$listName: \"|/usr/bin/mlmmj-recieve -L $listDir/\"", self::ML_ALIAS); - - // Creating transport entry - $this->addMapEntry("$listDomain--$listName@localhost.mlmmj mlmmj:$listDomain/$listName", self::ML_TRANSPORT); - - // Creating virtual entry - $this->addMapEntry("$listName@$listDomain $listDomain--$listName@localhost.mlmmj", self::ML_VIRTUAL); - } - } - - // The purpose of this plugin is to rewrite the main.cf file - function list_update($event_name, $data) { - global $app, $conf; - - $mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager']; - - if($mlManager == 'mlmmj') { - $rec = $data['new']; - $mlConf = $this->getMlConfig(); - - $controlDir = "{$mlConf['spool_dir']}/{$rec['domain']}/{$rec['listname']}/control"; - - // Doesn't matter if the list is open or close, members can ALWAYS unsubscribe - if($rec['list_type'] == 'open') { - switch($rec['subscribe_policy']) { - case 'disabled': - touch("$controlDir/closedlistsub"); - @unlink("$controlDir/submod"); - @unlink("$controlDir/nosubconfirm"); - break; - case 'both': - touch("$controlDir/submod"); - case 'approval': - touch("$controlDir/nosubconfirm"); - @unlink("$controlDir/closedlistsub"); - break; - case 'none': - touch("$controlDir/nosubconfirm"); - @unlink("$controlDir/closedlistsub"); - break; - case 'confirm': - @unlink("$controlDir/nosubconfirm"); - @unlink("$controlDir/closedlistsub"); - @unlink("$controlDir/submod"); - break; - } - - switch($rec['posting_policy']) { - case 'closed': - touch("$controlDir/subonlypost"); - break; - case 'moderated': - touch("$controlDir/modnonsubposts"); - break; - case 'free': - @unlink("$controlDir/modnonsubposts"); - @unlink("$controlDir/subonlypost"); - break; - } - } elseif($rec['list_type'] == 'closed') { - touch("$controlDir/closedlistsub"); - touch("$controlDir/subonlypost"); - @unlink("$controlDir/modnonsubposts"); - @unlink("$controlDir/submod"); - @unlink("$controlDir/nosubconfirm"); - } - - if($rec['digestsub'] == 'y') { - @unlink("$controlDir/nodigestsub"); - if($rec['digesttext'] == 'y') @unlink("$controlDir/nodigesttext"); - else touch("$controlDir/nodigesttext"); - file_put_contents("$controlDir/digestinterval", $rec['digestinterval']*self::SECONDS_IN_DAY); - file_put_contents("$controlDir/digestmaxmails", $rec['digestmaxmails']); - } else { - touch("$controlDir/nodigestsub"); - @unlink("$controlDir/nodigesttext"); - @unlink("$controlDir/digestinterval"); - @unlink("$controlDir/digestmaxmails"); - } - - if($rec['subject_prefix']) - file_put_contents("$controlDir/prefix", $rec['subject_prefix']); - else @unlink("$controlDir/prefix"); - - if($rec['mail_footer']) - file_put_contents("$controlDir/footer", $rec['mail_footer']); - else @unlink("$controlDir/footer"); - - if($rec['archive'] == 'y') - @unlink("$controlDir/noarchive"); - else - touch("$controlDir/noarchive"); - - $this->changeOwnership("$controlDir/*"); - } - } - - function list_delete($event_name, $data) { - global $app, $conf; - - $mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager']; - - if($mlManager == 'mlmmj') { - $mlConf = $this->getMlConfig(); - $rec = $data['old']; - $listDomain = $rec['domain']; - $listName = $rec['listname']; - $listDir = $mlConf['spool_dir']."/$listDomain/$listName"; - - // Remove ML directory structure - $this->rmdirR($listDir); - @rmdir($mlConf['spool_dir']."/$listDomain"); - - // Removing alias entry - $this->delMapEntry("$listName: \"|/usr/bin/mlmmj-recieve -L $listDir/\"", self::ML_ALIAS); - - // Removing transport entry - $this->delMapEntry("$listDomain--$listName@localhost.mlmmj mlmmj:$listDomain/$listName", self::ML_TRANSPORT); - - // Removing virtual entry - $this->delMapEntry("$listName@$listDomain $listDomain--$listName@localhost.mlmmj", self::ML_VIRTUAL); - } - } - - function member_insert($event_name, $data) { - global $app, $conf; - - $mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager']; - - if($mlManager == 'mlmmj') { - $mlConf = $this->getMlConfig(); - - $rec = $data['new']; - - $sql = "SELECT * FROM mail_mailinglist WHERE mailinglist_id = ?"; - $ml = $app->db->queryOneRecord($sql, $rec['mailinglist_id']); - if($ml['mailinglist_id']) { - $listDomain = $ml['domain']; - $listName = $ml['listname']; - $listDir = $mlConf['spool_dir']."/$listDomain/$listName"; - } - - $welcome = ($rec['welcome_msg'] == 'y')?'-c':''; - $command = "/usr/bin/mlmmj-sub -q -s -L $listDir $welcome -a ".$rec['email']; - exec("nohup $command>/dev/null 2>&1"); - } - } - - function member_update($event_name, $data) { - //TODO: Implement something usefull on update event (e.g. change to digest subscription) - } - - function member_delete($event_name, $data) { - global $app, $conf; - - $mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager']; - - if($mlManager == 'mlmmj') { - $mlConf = $this->getMlConfig(); - - $rec = $data['old']; - - $sql = "SELECT * FROM mail_mailinglist WHERE mailinglist_id = ?"; - $ml = $app->db->queryOneRecord($sql, $rec['mailinglist_id']); - if($ml['mailinglist_id']) { - $listDomain = $ml['domain']; - $listName = $ml['listname']; - $listDir = $mlConf['spool_dir']."/$listDomain/$listName"; - } - - $goodbye = ($rec['goodbye_msg'] == 'y')?'-c':''; - $command = "/usr/bin/mlmmj-unsub -q -s -L $listDir $goodbye -a ".$rec['email']; - exec("nohup $command>/dev/null 2>&1"); - } - } - - private function getMlConfig() { - $mlConfig = @parse_ini_file($this->mlmmj_config_dir.'mlmmj.conf'); - - // Force PHP7 to use # to mark comments - if(PHP_MAJOR_VERSION >= 7 && is_array($mlConfig)) - $mlConfig = array_filter($mlConfig, function($v){return(substr($v,0,1)!=='#');}, ARRAY_FILTER_USE_KEY); - - return $mlConfig; - } - - private function changeOwnership($path, $recursive=true) { - if(basename($path) == '*') $path = dirname($path); - - if(is_dir($path)) { - if($objs = glob($path."/*")) { - foreach($objs as $obj) { - chown($obj, 'mlmmj'); - chgrp($obj, 'mlmmj'); - if(is_dir($obj) && $recursive) $this->changeOwnership($obj); - } - } - } - - return chown($path, 'mlmmj') && chgrp($path, 'mlmmj'); - } - - private function rmdirR($path) { - if(is_dir($path) === true) { - $files = array_diff(scandir($path), array('.', '..')); - foreach($files as $file) $this->rmdirR(realpath($path) . '/' . $file); - - return rmdir($path); - } elseif(is_file($path) === true) return unlink($path); - - return false; - } - - private function addMapEntry($directive, $type) { - - $destFile = $this->mlmmj_config_dir; - switch($type) { - case self::ML_ALIAS: - $destFile .= 'aliases'; - $command = 'postalias'; - break; - case self::ML_TRANSPORT: - $destFile .= 'transport'; - $command = 'postmap'; - break; - case self::ML_VIRTUAL: - $destFile .= 'virtual'; - $command = 'postmap'; - break; - } - - $lines = file($destFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); - $lines[] = $directive; - - file_put_contents($destFile, implode("\n", array_unique($lines))); - exec("nohup /usr/sbin/$command $destFile >/dev/null 2>&1 &"); - } - - private function delMapEntry($directive, $type) { - - $destFile = $this->mlmmj_config_dir; - switch($type) { - case self::ML_ALIAS: - $destFile .= 'aliases'; - $command = 'postalias'; - break; - case self::ML_TRANSPORT: - $destFile .= 'transport'; - $command = 'postmap'; - break; - case self::ML_VIRTUAL: - $destFile .= 'virtual'; - $command = 'postmap'; - break; - } - - $lines = file($destFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); - - foreach(array_keys($lines, $directive) as $key) unset($lines[$key]); - - file_put_contents($destFile, implode("\n", array_unique($lines))); - exec("nohup /usr/sbin/$command $destFile >/dev/null 2>&1 &"); - } - - private function checkSys() { - if(!is_dir($this->mlmmj_config_dir)) mkdir($this->mlmmj_config_dir, 0755); - if(!file_exists($this->mlmmj_config_dir.'mlmmj.conf')) { - file_put_contents($this->mlmmj_config_dir.'mlmmj.conf', 'skel_dir = /usr/share/mlmmj/text.skel'); - file_put_contents($this->mlmmj_config_dir.'mlmmj.conf', 'spool_dir = /var/spool/mlmmj', FILE_APPEND); - } - if(!file_exists($this->mlmmj_config_dir.'aliases')) touch($this->mlmmj_config_dir.'aliases'); - if(!file_exists($this->mlmmj_config_dir.'transport')) touch($this->mlmmj_config_dir.'transport'); - if(!file_exists($this->mlmmj_config_dir.'virtual')) touch($this->mlmmj_config_dir.'virtual'); - } -} // end class - -?> diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php index 14052e5b7078747e415ff2568d7c3c5662c72340..efe7142c8d68e953942839652b98cb90d5665a92 100644 --- a/server/plugins-available/mysql_clientdb_plugin.inc.php +++ b/server/plugins-available/mysql_clientdb_plugin.inc.php @@ -331,6 +331,7 @@ class mysql_clientdb_plugin { $timestamp = time(); $tables = $link->query("SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema='".$old_name."' AND TABLE_TYPE='BASE TABLE'"); + $tables_all = $link->query("SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema='".$old_name."'"); if ($tables->num_rows > 0) { while ($row = $tables->fetch_assoc()) { $tables_array[] = $row['TABLE_NAME']; @@ -436,6 +437,11 @@ class mysql_clientdb_plugin { } } + } elseif ($tables->num_rows == 0 && $tables_all->num_rows == 0) { + //* Rename empty database by creating a new one and dropping the old database + $this->db_insert($event_name, $data); + $this->db_delete($event_name, $data); + } else { //* SELECT TABLE_NAME error $app->log('Unable to rename database '.$old_name.' to '.$new_name, LOGLEVEL_ERROR); } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index aad984aac0d058eef67d88b8a7e8321a05cb76d3..614437852ab0887d1236e9f83039174690659175 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -30,14 +30,19 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class nginx_plugin { - var $plugin_name = 'nginx_plugin'; - var $class_name = 'nginx_plugin'; + var $plugin_name; + var $class_name; // private variables var $action = ''; var $ssl_certificate_changed = false; var $update_letsencrypt = false; + public function __construct() { + $this->plugin_name = get_class($this); + $this->class_name = get_class($this); + } + //* This function is called during ispconfig installation to determine // if a symlink shall be created for this plugin. function onInstall() { @@ -62,3180 +67,93 @@ class nginx_plugin { /* Register for the events */ - $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl'); - $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl'); - $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl'); - - $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert'); - $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update'); - $app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete'); - - $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip'); - $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip'); - $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip'); - - /* - $app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav'); - $app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav'); - $app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav'); - */ + $app->plugin_webserver_base->registerEvents('nginx'); + } - $app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete'); + // Handle php.ini changes + function php_ini_changed($event_name, $data) { + global $app; - $app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user'); - $app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user'); - $app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user'); + $app->plugin_webserver_base->eventPhpIniChanged($event_name, $data, 'nginx'); - $app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update'); - $app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete'); } // Handle the creation of SSL certificates function ssl($event_name, $data) { - global $app, $conf; - - $app->uses('system'); - - // load the server configuration options - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf')) - $app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR); - - //* Only vhosts can have a ssl cert - if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") return; - - // if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl'); - if(!is_dir($data['new']['document_root'].'/ssl') && !is_dir($data['old']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); - - $ssl_dir = $data['new']['document_root'].'/ssl'; - $domain = ($data['new']['ssl_domain'] != '') ? $data['new']['ssl_domain'] : $data['new']['domain']; - $key_file = $ssl_dir.'/'.$domain.'.key'; - $key_file2 = $ssl_dir.'/'.$domain.'.key.org'; - $csr_file = $ssl_dir.'/'.$domain.'.csr'; - $crt_file = $ssl_dir.'/'.$domain.'.crt'; - - //* Create a SSL Certificate, but only if this is not a mirror server. - if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) { - - $this->ssl_certificate_changed = true; - - //* Rename files if they exist - if(file_exists($key_file)){ - $app->system->rename($key_file, $key_file.'.bak'); - $app->system->chmod($key_file.'.bak', 0400); - } - if(file_exists($key_file2)){ - $app->system->rename($key_file2, $key_file2.'.bak'); - $app->system->chmod($key_file2.'.bak', 0400); - } - if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak'); - if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak'); - - $rand_file = $ssl_dir.'/random_file'; - $rand_data = md5(uniqid(microtime(), 1)); - for($i=0; $i<1000; $i++) { - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - $rand_data .= md5(uniqid(microtime(), 1)); - } - $app->system->file_put_contents($rand_file, $rand_data); - - $ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15); - - $ssl_cnf = " RANDFILE = $rand_file - - [ req ] - default_bits = 2048 - default_md = sha256 - default_keyfile = keyfile.pem - distinguished_name = req_distinguished_name - attributes = req_attributes - prompt = no - output_password = $ssl_password - - [ req_distinguished_name ] - C = ".trim($data['new']['ssl_country'])." - " . (trim($data['new']['ssl_state']) == '' ? '' : "ST = ".trim($data['new']['ssl_state'])) . " - " . (trim($data['new']['ssl_locality']) == '' ? '' : "L = ".trim($data['new']['ssl_locality']))." - " . (trim($data['new']['ssl_organisation']) == '' ? '' : "O = ".trim($data['new']['ssl_organisation']))." - " . (trim($data['new']['ssl_organisation_unit']) == '' ? '' : "OU = ".trim($data['new']['ssl_organisation_unit']))." - CN = $domain - emailAddress = webmaster@".$data['new']['domain']." - - [ req_attributes ] - ";//challengePassword = A challenge password"; - - $ssl_cnf_file = $ssl_dir.'/openssl.conf'; - $app->system->file_put_contents($ssl_cnf_file, $ssl_cnf); - - $rand_file = escapeshellcmd($rand_file); - $key_file2 = escapeshellcmd($key_file2); - $openssl_cmd_key_file2 = $key_file2; - if(substr($domain, 0, 2) == '*.' && strpos($key_file2, '/ssl/\*.') !== false) $key_file2 = str_replace('/ssl/\*.', '/ssl/*.', $key_file2); // wildcard certificate - $key_file = escapeshellcmd($key_file); - $openssl_cmd_key_file = $key_file; - if(substr($domain, 0, 2) == '*.' && strpos($key_file, '/ssl/\*.') !== false) $key_file = str_replace('/ssl/\*.', '/ssl/*.', $key_file); // wildcard certificate - $ssl_days = 3650; - $csr_file = escapeshellcmd($csr_file); - $openssl_cmd_csr_file = $csr_file; - if(substr($domain, 0, 2) == '*.' && strpos($csr_file, '/ssl/\*.') !== false) $csr_file = str_replace('/ssl/\*.', '/ssl/*.', $csr_file); // wildcard certificate - $config_file = escapeshellcmd($ssl_cnf_file); - $crt_file = escapeshellcmd($crt_file); - $openssl_cmd_crt_file = $crt_file; - if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate - - if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) { - - exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $openssl_cmd_key_file2 2048"); - exec("openssl req -new -sha256 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -out $openssl_cmd_csr_file -days $ssl_days -config $config_file"); - exec("openssl rsa -passin pass:$ssl_password -in $openssl_cmd_key_file2 -out $openssl_cmd_key_file"); - - if(file_exists($web_config['CA_path'].'/openssl.cnf')) - { - exec("openssl ca -batch -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file"); - $app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed. openssl ca -out $openssl_cmd_crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $openssl_cmd_csr_file", LOGLEVEL_ERROR); - }; - if (@filesize($crt_file)==0 || !file_exists($crt_file)){ - exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $openssl_cmd_key_file2 -in $openssl_cmd_csr_file -out $openssl_cmd_crt_file -days $ssl_days -config $config_file "); - $app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - }; - - } - - $app->system->chmod($key_file2, 0400); - $app->system->chmod($key_file, 0400); - @$app->system->unlink($config_file); - @$app->system->unlink($rand_file); - $ssl_request = $app->system->file_get_contents($csr_file); - $ssl_cert = $app->system->file_get_contents($crt_file); - $ssl_key = $app->system->file_get_contents($key_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - - //* Check that the SSL key is not password protected - if($data["new"]["ssl_action"] == 'save') { - if(stristr($data["new"]["ssl_key"],'Proc-Type: 4,ENCRYPTED')) { - $data["new"]["ssl_action"] = ''; - - $app->log('SSL Certificate not saved. The SSL key is encrypted.', LOGLEVEL_WARN); - $app->dbmaster->datalogError('SSL Certificate not saved. The SSL key is encrypted.'); - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - } - - //* and check that SSL cert does not contain subdomain of domain acme.invalid - if($data["new"]["ssl_action"] == 'save') { - $tmp = array(); - $crt_data = ''; - exec('openssl x509 -noout -text -in '.escapeshellarg($crt_file),$tmp); - $crt_data = implode("\n",$tmp); - if(stristr($crt_data,'.acme.invalid')) { - $data["new"]["ssl_action"] = ''; - - $app->log('SSL Certificate not saved. The SSL cert contains domain acme.invalid.', LOGLEVEL_WARN); - $app->dbmaster->datalogError('SSL Certificate not saved. The SSL cert contains domain acme.invalid.'); - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } - } - - //* Save a SSL certificate to disk - if($data["new"]["ssl_action"] == 'save') { - $this->ssl_certificate_changed = true; - - //* Backup files - if(file_exists($key_file)){ - $app->system->copy($key_file, $key_file.'~'); - $app->system->chmod($key_file.'~', 0400); - } - if(file_exists($key_file2)){ - $app->system->copy($key_file2, $key_file2.'~'); - $app->system->chmod($key_file2.'~', 0400); - } - if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~'); - if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~'); - - //* Write new ssl files - if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]); - if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); - if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file, $data["new"]["ssl_key"]); - $app->system->chmod($key_file, 0400); - - // for nginx, bundle files have to be appended to the certificate file - if(trim($data["new"]["ssl_bundle"]) != ''){ - if(file_exists($crt_file)){ - $crt_file_contents = trim($app->system->file_get_contents($crt_file)); - } else { - $crt_file_contents = ''; - } - if($crt_file_contents != '') $crt_file_contents .= "\n"; - $crt_file_contents .= $data["new"]["ssl_bundle"]; - $app->system->file_put_contents($crt_file, $app->file->unix_nl($crt_file_contents)); - unset($crt_file_contents); - } - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - $app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - //* Delete a SSL certificate - if($data['new']['ssl_action'] == 'del') { - if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf')) - { - exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke ".escapeshellcmd($crt_file)); - $app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG); - }; - $app->system->unlink($csr_file); - $app->system->unlink($crt_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ? AND server_id = ?", $data['new']['domain'], $data['new']['server_id']); - $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } + global $app; + $app->plugin_webserver_base->eventSsl($event_name, $data, 'nginx'); } function insert($event_name, $data) { - global $app, $conf; - $this->action = 'insert'; // just run the update function $this->update($event_name, $data); - - } function update($event_name, $data) { - global $app, $conf; - - //* Check if the apache plugin is enabled - if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) { - $app->log('The nginx plugin cannot be used together with the apache2 plugin.', LOGLEVEL_WARN); - return 0; - } + global $app; if($this->action != 'insert') $this->action = 'update'; - if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['type'] != 'vhostalias' && $data['new']['parent_domain_id'] > 0) { - - $old_parent_domain_id = intval($data['old']['parent_domain_id']); - $new_parent_domain_id = intval($data['new']['parent_domain_id']); - - // If the parent_domain_id has been changed, we will have to update the old site as well. - if($this->action == 'update' && $data['new']['parent_domain_id'] != $data['old']['parent_domain_id']) { - $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $old_parent_domain_id, 'y'); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update($event_name, $data); - } - - // This is not a vhost, so we need to update the parent record instead. - $tmp = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ? AND active = ?', $new_parent_domain_id, 'y'); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update_letsencrypt = true; - } - - // load the server configuration options - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - - //* Check if this is a chrooted setup - if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $nginx_chrooted = true; - $app->log('Info: nginx is chrooted.', LOGLEVEL_DEBUG); - } else { - $nginx_chrooted = false; - } - - if($data['new']['document_root'] == '') { - if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $app->log('document_root not set', LOGLEVEL_WARN); - return 0; - } - if($app->system->is_allowed_user($data['new']['system_user'], $app->system->is_user($data['new']['system_user']), true) == false - || $app->system->is_allowed_group($data['new']['system_group'], $app->system->is_group($data['new']['system_group']), true) == false) { - $app->log('Websites cannot be owned by the root user or group. User: '.$data['new']['system_user'].' Group: '.$data['new']['system_group'], LOGLEVEL_WARN); - return 0; - } - if(trim($data['new']['domain']) == '') { - $app->log('domain is empty', LOGLEVEL_WARN); - return 0; - } - - $web_folder = 'web'; - $log_folder = 'log'; - $old_web_folder = 'web'; - $old_log_folder = 'log'; - if($data['new']['type'] == 'vhost'){ - if($data['new']['web_folder'] != ''){ - if(substr($data['new']['web_folder'],0,1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],1); - if(substr($data['new']['web_folder'],-1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],0,-1); - } - $web_folder .= '/'.$data['new']['web_folder']; - - if($data['old']['web_folder'] != ''){ - if(substr($data['old']['web_folder'],0,1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],1); - if(substr($data['old']['web_folder'],-1) == '/') $data['old']['web_folder'] = substr($data['old']['web_folder'],0,-1); - } - $old_web_folder .= '/'.$data['old']['web_folder']; - } - if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { - // new one - $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['new']['parent_domain_id']); - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); - if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; - $web_folder = $data['new']['web_folder']; - $log_folder .= '/' . $subdomain_host; - unset($tmp); - - if(isset($data['old']['parent_domain_id'])) { - // old one - $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); - if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; - $old_web_folder = $data['old']['web_folder']; - $old_log_folder .= '/' . $subdomain_host; - unset($tmp); - } - } - - // Create group and user, if not exist - $app->uses('system'); - - if($web_config['connect_userid_to_webid'] == 'y') { - //* Calculate the uid and gid - $connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']); - $fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']); - $fixed_uid_param = '--uid '.$fixed_uid_gid; - $fixed_gid_param = '--gid '.$fixed_uid_gid; - - //* Check if a ispconfigend user and group exists and create them - if(!$app->system->is_group('ispconfigend')) { - exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); - } - if(!$app->system->is_user('ispconfigend')) { - exec('useradd -g ispconfigend -d /usr/local/ispconfig --uid '.($connect_userid_to_webid_start + 10000).' ispconfigend'); - } - } else { - $fixed_uid_param = ''; - $fixed_gid_param = ''; - } - - $groupname = escapeshellcmd($data['new']['system_group']); - if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) { - exec('groupadd '.$fixed_gid_param.' '.$groupname); - if($nginx_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname); - $app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG); - } - - $username = escapeshellcmd($data['new']['system_user']); - if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) { - if($web_config['add_web_users_to_sshusers_group'] == 'y') { - exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); - if($nginx_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param -G sshusers $username -s /bin/false"); - } else { - exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); - if($nginx_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false"); - } - $app->log('Adding the user: '.$username, LOGLEVEL_DEBUG); - } - - //* If the client of the site has been changed, we have a change of the document root - if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) { - - //* Get the old client ID - $old_client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); - $old_client_id = intval($old_client['client_id']); - unset($old_client); - - //* Remove the old symlinks - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // create the symlinks, if not exist - if(is_link($tmp_symlink)) { - exec('rm -f '.escapeshellcmd($tmp_symlink)); - $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - - if($data["new"]["type"] != "vhostsubdomain" && $data["new"]["type"] != "vhostalias") { - //* Move the site data - $tmp_docroot = explode('/', $data['new']['document_root']); - unset($tmp_docroot[count($tmp_docroot)-1]); - $new_dir = implode('/', $tmp_docroot); - - $tmp_docroot = explode('/', $data['old']['document_root']); - unset($tmp_docroot[count($tmp_docroot)-1]); - $old_dir = implode('/', $tmp_docroot); - - //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path - if(@is_dir($data['new']['document_root'])) { - $app->system->web_folder_protection($data['new']['document_root'], false); - $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s')); - $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG); - } - - //* Unmount the old log directory bfore we move the log dir - exec('umount '.escapeshellcmd($old_dir.'/log')); - - //* Create new base directory, if it does not exist yet - if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); - $app->system->web_folder_protection($data['old']['document_root'], false); - exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir)); - //$app->system->rename($data['old']['document_root'],$new_dir); - $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG); - - // Handle the change in php_open_basedir - $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']); - - //* Change the owner of the website files to the new website owner - exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir); - - //* Change the home directory and group of the website user - $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod'; - $command .= ' --home '.escapeshellcmd($data['new']['document_root']); - $command .= ' --gid '.escapeshellcmd($data['new']['system_group']); - $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; - exec($command); - } - - if($nginx_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - //* Change the log mount - /* - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; - $app->system->removeLine('/etc/fstab', $fstab_line); - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind,nobootwait'; - $app->system->removeLine('/etc/fstab', $fstab_line); - */ - - $fstab_line_old = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - - if($web_config['network_filesystem'] == 'y') { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail,_netdev 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); - } else { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nofail 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line_old, $fstab_line, 0, 1); - } - - exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); - - } - - //print_r($data); - - // Check if the directories are there and create them if necessary. - $app->system->web_folder_protection($data['new']['document_root'], false); - - if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder); - if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error'); - if($data['new']['stats_type'] != '' && !is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/stats'); - //if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder); - if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl'); - if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin'); - if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp'); - //if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav'); - - if(!is_dir($data['new']['document_root'].'/.ssh')) { - $app->system->mkdirpath($data['new']['document_root'].'/.ssh'); - $app->system->chmod($data['new']['document_root'].'/.ssh', 0700); - $app->system->chown($data['new']['document_root'].'/.ssh', $username); - $app->system->chgrp($data['new']['document_root'].'/.ssh', $groupname); - } - - //* Create the new private directory - if(!is_dir($data['new']['document_root'].'/private')) { - $app->system->mkdirpath($data['new']['document_root'].'/private'); - $app->system->chmod($data['new']['document_root'].'/private', 0710); - $app->system->chown($data['new']['document_root'].'/private', $username); - $app->system->chgrp($data['new']['document_root'].'/private', $groupname); - } - - - // Remove the symlink for the site, if site is renamed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']); - if(is_link($data['old']['document_root'].'/'.$old_log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$old_log_folder); - - //* remove old log mount - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$old_log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - - //* Unmount log directory - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); - exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); - } - - //* Create the log dir if nescessary and mount it - if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) { - if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder); - if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']); - $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder); - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root'); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root'); - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); - //* add mountpoint to fstab - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait'; - $fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev 0 0':' 0 0'; - $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); - } - - $app->system->web_folder_protection($data['new']['document_root'], true); - - // Get the client ID - $client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['new']['sys_groupid']); - $client_id = intval($client['client_id']); - unset($client); - - // Remove old symlinks, if site is renamed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // remove the symlinks, if not exist - if(is_link($tmp_symlink)) { - exec('rm -f '.escapeshellcmd($tmp_symlink)); - $app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - } - - // Create the symlinks for the sites - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - //* Remove symlink if target folder has been changed. - if($data['old']['document_root'] != '' && $data['old']['document_root'] != $data['new']['document_root'] && is_link($tmp_symlink)) { - $app->system->unlink($tmp_symlink); - } - // create the symlinks, if not exist - if(!is_link($tmp_symlink)) { - // exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); - if ($web_config["website_symlinks_rel"] == 'y') { - $app->system->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink)); - } else { - exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink)); - } - - $app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - - - - // Install the Standard or Custom Error, Index and other related files - // /usr/local/ispconfig/server/conf is for the standard files - // /usr/local/ispconfig/server/conf-custom is for the custom files - // setting a local var here - - // normally $conf['templates'] = "/usr/local/ispconfig/server/conf"; - if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { - - // Copy the error pages - if($data['new']['errordocs']) { - $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; - if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - else { - if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { - exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); - } - else { - exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - } - exec('chmod -R a+r '.$error_page_path); - } - - //* Copy the web skeleton files only when there is no index.ph or index.html file yet - if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php')) { - if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - - if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - //if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) { - // exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - //} - } else { - if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - } else { - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html')) exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html'); - if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')){ - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - if(is_file($conf['rootpath'] . '/conf/index/robots.txt')){ - if(!file_exists(escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - //if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - } - } - } - exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/'); - - //** Copy the error documents on update when the error document checkbox has been activated and was deactivated before - } elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { - - $error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/'; - if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - else { - if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { - exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); - } - else { - exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path); - } - } - exec('chmod -R a+r '.$error_page_path); - exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path); - } // end copy error docs - - // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias - if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { - if($data['new']['hd_quota'] > 0) { - $blocks_soft = $data['new']['hd_quota'] * 1024; - $blocks_hard = $blocks_soft + 1024; - $mb_soft = $data['new']['hd_quota']; - $mb_hard = $mb_soft + 1; - } else { - $mb_soft = $mb_hard = $blocks_soft = $blocks_hard = 0; - } - - // get the primitive folder for document_root and the filesystem, will need it later. - $df_output=explode(" ", exec("df -T " . escapeshellarg($data['new']['document_root']) . "|awk 'END{print \$2,\$NF}'")); - $file_system = $df_output[0]; - $primitive_root = $df_output[1]; - - if($file_system == 'xfs') { - exec("xfs_quota -x -c " . escapeshellarg("limit -u bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " " . $username) . " " . escapeshellarg($primitive_root)); - - // xfs only supports timers globally, not per user. - exec("xfs_quota -x -c 'timer -bir -i 604800' " . escapeshellarg($primitive_root)); - - unset($project_uid, $username_position, $xfs_projects); - unset($primitive_root, $df_output, $mb_hard, $mb_soft); - } else { - if($app->system->is_installed('setquota')) { - exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null'); - exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null'); - } - } - } - - if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) { - // Chown and chmod the directories below the document root - $app->system->_exec('chown -R '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - // The document root itself has to be owned by root in normal level and by the web owner in security level 20 - if($web_config['security_level'] == 20) { - $app->system->_exec('chown '.$username.':'.$groupname.' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - } else { - $app->system->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder); - } - } - - //* add the nginx user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update - if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user'])); - - //* If the security level is set to high - if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost') or ($web_folder != $old_web_folder && $data['new']['type'] == 'vhost')) { - - $app->system->web_folder_protection($data['new']['document_root'], false); - - //* Check if we have the new private folder and create it if nescessary - if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private'); - - if($web_config['security_level'] == 20) { - - $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0751); - //$app->system->chmod($data['new']['document_root'].'/webdav',0710); - $app->system->chmod($data['new']['document_root'].'/private', 0710); - $app->system->chmod($data['new']['document_root'].'/ssl', 0755); - if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0751); - - // make tmp directory writable for nginx and the website users - $app->system->chmod($data['new']['document_root'].'/tmp', 0770); - - // Set Log directory to 755 to make the logs accessible by the FTP user - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - } - - if($web_config['add_web_users_to_sshusers_group'] == 'y') { - $command = 'usermod'; - $command .= ' --groups sshusers'; - $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null'; - $app->system->_exec($command); - } - - //* if we have a chrooted nginx environment - if($nginx_chrooted) { - $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - //* add the nginx user to the client group in the chroot environment - $tmp_groupfile = $app->system->server_conf['group_datei']; - $app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group'; - $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user'])); - $app->system->server_conf['group_datei'] = $tmp_groupfile; - unset($tmp_groupfile); - } - - //* Chown all default directories - $app->system->chown($data['new']['document_root'], 'root'); - $app->system->chgrp($data['new']['document_root'], 'root'); - $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); - $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); - } - $app->system->chown($data['new']['document_root'].'/ssl', 'root'); - $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); - $app->system->chown($data['new']['document_root'].'/tmp', $username); - $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); - $app->system->chown($data['new']['document_root'].'/web', $username); - $app->system->chgrp($data['new']['document_root'].'/web', $groupname); - $app->system->chown($data['new']['document_root'].'/web/error', $username); - $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); - } - //$app->system->chown($data['new']['document_root'].'/webdav',$username); - //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); - $app->system->chown($data['new']['document_root'].'/private', $username); - $app->system->chgrp($data['new']['document_root'].'/private', $groupname); - - if($web_folder != 'web'){ - $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); - } - - // If the security Level is set to medium - } else { - - $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0755); - //$app->system->chmod($data['new']['document_root'].'/webdav',0755); - $app->system->chmod($data['new']['document_root'].'/ssl', 0755); - $app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755); - if($web_folder != 'web') $app->system->chmod($data['new']['document_root'].'/'.$web_folder, 0755); - - // make temp directory writable for nginx and the website users - $app->system->chmod($data['new']['document_root'].'/tmp', 0770); - - // Set Log directory to 755 to make the logs accessible by the FTP user - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); - } - - $app->system->chown($data['new']['document_root'], 'root'); - $app->system->chgrp($data['new']['document_root'], 'root'); - $app->system->chown($data['new']['document_root'].'/cgi-bin', $username); - $app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname); - if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { - $app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false); - $app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false); - } - - $app->system->chown($data['new']['document_root'].'/ssl', 'root'); - $app->system->chgrp($data['new']['document_root'].'/ssl', 'root'); - $app->system->chown($data['new']['document_root'].'/tmp', $username); - $app->system->chgrp($data['new']['document_root'].'/tmp', $groupname); - $app->system->chown($data['new']['document_root'].'/web', $username); - $app->system->chgrp($data['new']['document_root'].'/web', $groupname); - $app->system->chown($data['new']['document_root'].'/web/error', $username); - $app->system->chgrp($data['new']['document_root'].'/web/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/web/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname); - } - //$app->system->chown($data['new']['document_root'].'/webdav',$username); - //$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname); - - if($web_folder != 'web'){ - $app->system->chown($data['new']['document_root'].'/'.$web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/'.$web_folder, $groupname); - } - } - } elseif((($data['new']['type'] == 'vhostsubdomain') || ($data['new']['type'] == 'vhostalias')) && - (($this->action == 'insert') || ($web_config['set_folder_permissions_on_update'] == 'y'))) { - - if($web_config['security_level'] == 20) { - $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710); - $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); - } - } else { - $app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755); - $app->system->chown($data['new']['document_root'].'/' . $web_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname); - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname); - if($data['new']['stats_type'] != '') { - $app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname); - } - } - } - - //* Protect web folders - $app->system->web_folder_protection($data['new']['document_root'], true); - - if($data['new']['type'] == 'vhost') { - // Change the ownership of the error log to the root user - if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')); - $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); - $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root'); - } - - - //* Create the vhost config file - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate('nginx_vhost.conf.master'); - - // IPv4 - if($data['new']['ip_address'] == '') $data['new']['ip_address'] = '*'; - - //* use ip-mapping for web-mirror - if($data['new']['ip_address'] != '*' && $conf['mirror_server_id'] > 0) { - $sql = "SELECT destination_ip FROM server_ip_map WHERE server_id = ? AND source_ip = ?"; - $newip = $app->db->queryOneRecord($sql, $conf['server_id'], $data['new']['ip_address']); - $data['new']['ip_address'] = $newip['destination_ip']; - unset($newip); - } - - $vhost_data = $data['new']; - - //unset($vhost_data['ip_address']); - $vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder; - $vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder; - $vhost_data['web_basedir'] = $web_config['website_basedir']; - - // IPv6 - if($data['new']['ipv6_address'] != ''){ - $tpl->setVar('ipv6_enabled', 1); - if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') { - if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') { - $explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']); - $explode_v6=explode(':', $data['new']['ipv6_address']); - - for ( $i = 0; $i <= count($explode_v6prefix)-1; $i++ ) { - $explode_v6[$i] = $explode_v6prefix[$i]; - } - $data['new']['ipv6_address'] = implode(':', $explode_v6); - $vhost_data['ipv6_address'] = $data['new']['ipv6_address']; - } - } - } - - // PHP-FPM - // Support for multiple PHP versions - /* - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - */ - if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } else { - if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } - - if($default_php_fpm){ - $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); - } else { - $pool_dir = $custom_php_fpm_pool_dir; - } - $pool_dir = trim($pool_dir); - if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; - $pool_name = 'web'.$data['new']['domain_id']; - $socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']); - if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; - - if($data['new']['php_fpm_chroot'] == 'y'){ - $php_fpm_chroot = 1; - $php_fpm_nochroot = 0; - } else { - $php_fpm_chroot = 0; - $php_fpm_nochroot = 1; - } - if($data['new']['php_fpm_use_socket'] == 'y'){ - $use_tcp = 0; - $use_socket = 1; - } else { - $use_tcp = 1; - $use_socket = 0; - } - $tpl->setVar('use_tcp', $use_tcp); - $tpl->setVar('use_socket', $use_socket); - $tpl->setVar('php_fpm_chroot', $php_fpm_chroot); - $tpl->setVar('php_fpm_nochroot', $php_fpm_nochroot); - $fpm_socket = $socket_dir.$pool_name.'.sock'; - $tpl->setVar('fpm_socket', $fpm_socket); - $tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(), 1)).'.htm'); - $vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1; - - // backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support. - if($vhost_data['php'] == 'fast-cgi') $vhost_data['php'] = 'php-fpm'; - - // Custom rewrite rules - /* - $final_rewrite_rules = array(); - $custom_rewrite_rules = $data['new']['rewrite_rules']; - // Make sure we only have Unix linebreaks - $custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules); - $custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules); - $custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules); - if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){ - foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - } - } - $tpl->setLoop('rewrite_rules', $final_rewrite_rules); - */ - - // Custom rewrite rules - $final_rewrite_rules = array(); - - if(isset($data['new']['rewrite_rules']) && trim($data['new']['rewrite_rules']) != '') { - $custom_rewrite_rules = trim($data['new']['rewrite_rules']); - $custom_rewrites_are_valid = true; - // use this counter to make sure all curly brackets are properly closed - $if_level = 0; - // Make sure we only have Unix linebreaks - $custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules); - $custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules); - $custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules); - if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){ - foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){ - // ignore comments - if(substr(ltrim($custom_rewrite_rule_line), 0, 1) == '#'){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // empty lines - if(trim($custom_rewrite_rule_line) == ''){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // rewrite - if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - if(preg_match('@^\s*rewrite\s+(^/)?(\'[^\']+\'|"[^"]+")+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+(\'[^\']+\'|"[^"]+")+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // if - if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - $if_level += 1; - continue; - } - // if - check for files, directories, etc. - if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - $if_level += 1; - continue; - } - // break - if(preg_match('@^\s*break\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // return code [ text ] - if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // return code URL - // return URL - if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // set - if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $custom_rewrite_rule_line)){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - continue; - } - // closing curly bracket - if(trim($custom_rewrite_rule_line) == '}'){ - $final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line); - $if_level -= 1; - continue; - } - $custom_rewrites_are_valid = false; - break; - } - } - if(!$custom_rewrites_are_valid || $if_level != 0){ - $final_rewrite_rules = array(); - } - } - $tpl->setLoop('rewrite_rules', $final_rewrite_rules); - - // Custom nginx directives - $final_nginx_directives = array(); - if($data['new']['enable_pagespeed'] == 'y'){ - // if PageSpeed is already enabled, don't add configuration again - if(stripos($nginx_directives, 'pagespeed') !== false){ - $vhost_data['enable_pagespeed'] = false; - } else { - $vhost_data['enable_pagespeed'] = true; - } - } else { - $vhost_data['enable_pagespeed'] = false; - } - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", $data['new']['directive_snippets_id']); - if(isset($snippet['snippet'])){ - $nginx_directives = $snippet['snippet']; - } else { - $nginx_directives = $data['new']['nginx_directives']; - } -/* - if($data['new']['enable_pagespeed'] == 'y'){ - // if PageSpeed is already enabled, don't add configuration again - if(stripos($nginx_directives, 'pagespeed') !== false){ - $vhost_data['enable_pagespeed'] = false; - } else { - $vhost_data['enable_pagespeed'] = true; - } - } else { - $vhost_data['enable_pagespeed'] = false; - } -*/ - } else { - $nginx_directives = $data['new']['nginx_directives']; -// $vhost_data['enable_pagespeed'] = false; - } - - // folder_directive_snippets - if(trim($data['new']['folder_directive_snippets']) != ''){ - $data['new']['folder_directive_snippets'] = trim($data['new']['folder_directive_snippets']); - $data['new']['folder_directive_snippets'] = str_replace("\r\n", "\n", $data['new']['folder_directive_snippets']); - $data['new']['folder_directive_snippets'] = str_replace("\r", "\n", $data['new']['folder_directive_snippets']); - $folder_directive_snippets_lines = explode("\n", $data['new']['folder_directive_snippets']); - - if(is_array($folder_directive_snippets_lines) && !empty($folder_directive_snippets_lines)){ - foreach($folder_directive_snippets_lines as $folder_directive_snippets_line){ - list($folder_directive_snippets_folder, $folder_directive_snippets_snippets_id) = explode(':', $folder_directive_snippets_line); - - $folder_directive_snippets_folder = trim($folder_directive_snippets_folder); - $folder_directive_snippets_snippets_id = trim($folder_directive_snippets_snippets_id); - - if($folder_directive_snippets_folder != '' && intval($folder_directive_snippets_snippets_id) > 0 && preg_match('@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@', $folder_directive_snippets_folder)){ - if(substr($folder_directive_snippets_folder, -1) != '/') $folder_directive_snippets_folder .= '/'; - if(substr($folder_directive_snippets_folder, 0, 1) == '/') $folder_directive_snippets_folder = substr($folder_directive_snippets_folder, 1); - - $master_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($folder_directive_snippets_snippets_id)); - if(isset($master_snippet['snippet'])){ - $folder_directive_snippets_trans = array('{FOLDER}' => $folder_directive_snippets_folder, '{FOLDERMD5}' => md5($folder_directive_snippets_folder)); - $master_snippet['snippet'] = strtr($master_snippet['snippet'], $folder_directive_snippets_trans); - $nginx_directives .= "\n\n".$master_snippet['snippet']; - - // create folder it it does not exist - if(!is_dir($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder)){ - $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder); - $app->system->chown($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $username); - $app->system->chgrp($data['new']['document_root'].'/' . $web_folder.$folder_directive_snippets_folder, $groupname); - } - } - } - } - } - } - - // use vLib for template logic - if(trim($nginx_directives) != '') { - $nginx_directives_new = ''; - $ngx_conf_tpl = new tpl(); - $ngx_conf_tpl_tmp_file = tempnam($conf['temppath'], "ngx"); - file_put_contents($ngx_conf_tpl_tmp_file, $nginx_directives); - $ngx_conf_tpl->newTemplate($ngx_conf_tpl_tmp_file); - $ngx_conf_tpl->setVar('use_tcp', $use_tcp); - $ngx_conf_tpl->setVar('use_socket', $use_socket); - $ngx_conf_tpl->setVar('fpm_socket', $fpm_socket); - $ngx_conf_tpl->setVar($vhost_data); - $nginx_directives_new = $ngx_conf_tpl->grab(); - if(is_file($ngx_conf_tpl_tmp_file)) unlink($ngx_conf_tpl_tmp_file); - if($nginx_directives_new != '') $nginx_directives = $nginx_directives_new; - unset($nginx_directives_new); - } - - // Make sure we only have Unix linebreaks - $nginx_directives = str_replace("\r\n", "\n", $nginx_directives); - $nginx_directives = str_replace("\r", "\n", $nginx_directives); - $nginx_directive_lines = explode("\n", $nginx_directives); - if(is_array($nginx_directive_lines) && !empty($nginx_directive_lines)){ - $trans = array( - '{DOCROOT}' => $vhost_data['web_document_root_www'], - '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'], - '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';' - ); - foreach($nginx_directive_lines as $nginx_directive_line){ - $final_nginx_directives[] = array('nginx_directive' => strtr($nginx_directive_line, $trans)); - } - } - $tpl->setLoop('nginx_directives', $final_nginx_directives); - - $app->uses('letsencrypt'); - // Check if a SSL cert exists - $tmp = $app->letsencrypt->get_website_certificate_paths($data); - $domain = $tmp['domain']; - $key_file = $tmp['key']; - $key_file2 = $tmp['key2']; - $csr_file = $tmp['csr']; - $crt_file = $tmp['crt']; - $bundle_file = $tmp['bundle']; - unset($tmp); - - $data['new']['ssl_domain'] = $domain; - $vhost_data['ssl_domain'] = $domain; - $vhost_data['ssl_crt_file'] = $crt_file; - $vhost_data['ssl_key_file'] = $key_file; - $vhost_data['ssl_bundle_file'] = $bundle_file; - - //* Generate Let's Encrypt SSL certificat - if($data['new']['ssl'] == 'y' && $data['new']['ssl_letsencrypt'] == 'y' && $conf['mirror_server_id'] == 0 && ( // ssl and let's encrypt is active and no mirror server - ($data['old']['ssl'] == 'n' || $data['old']['ssl_letsencrypt'] == 'n') // we have new let's encrypt configuration - || ($data['old']['domain'] != $data['new']['domain']) // we have domain update - || ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain - || $this->update_letsencrypt == true - )) { - - $success = $app->letsencrypt->request_certificates($data, 'nginx'); - if($success) { - /* we don't need to store it. - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain_id = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - } else { - $data['new']['ssl_letsencrypt'] = 'n'; - if($data['old']['ssl'] == 'n') $data['new']['ssl'] = 'n'; - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE web_domain SET `ssl` = ?, `ssl_letsencrypt` = ? WHERE `domain` = ?", $data['new']['ssl'], 'n', $data['new']['domain']); - } - } - - if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0) && (@filesize($key_file)>0)) { - $vhost_data['ssl_enabled'] = 1; - $app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG); - } else { - $vhost_data['ssl_enabled'] = 0; - $app->log('SSL Disabled. '.$domain, LOGLEVEL_DEBUG); - } - - // Set SEO Redirect - if($data['new']['seo_redirect'] != ''){ - $vhost_data['seo_redirect_enabled'] = 1; - $tmp_seo_redirects = $this->get_seo_redirects($data['new']); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - foreach($tmp_seo_redirects as $key => $val){ - $vhost_data[$key] = $val; - } - } else { - $vhost_data['seo_redirect_enabled'] = 0; - } - } else { - $vhost_data['seo_redirect_enabled'] = 0; - } - - // Rewrite rules - $own_rewrite_rules = array(); - $rewrite_rules = array(); - $local_rewrite_rules = array(); - if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') { - if(substr($data['new']['redirect_path'], -1) != '/') $data['new']['redirect_path'] .= '/'; - if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){ - if($data['new']['redirect_type'] != 'proxy'){ - $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'], 8); - } else { - $data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'], 8); - } - } - - // Custom proxy directives - if($data['new']['redirect_type'] == 'proxy' && trim($data['new']['proxy_directives'] != '')){ - $final_proxy_directives = array(); - $proxy_directives = $data['new']['proxy_directives']; - // Make sure we only have Unix linebreaks - $proxy_directives = str_replace("\r\n", "\n", $proxy_directives); - $proxy_directives = str_replace("\r", "\n", $proxy_directives); - $proxy_directive_lines = explode("\n", $proxy_directives); - if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){ - foreach($proxy_directive_lines as $proxy_directive_line){ - $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line); - } - } - } else { - $final_proxy_directives = false; - } - - switch($data['new']['subdomain']) { - case 'www': - $exclude_own_hostname = ''; - if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); - break; - } - $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - } else { // URL - check if URL is local - $tmp_redirect_path = $data['new']['redirect_path']; - if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ - // URL is local - if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); - if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; - break; - } else { - $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - $exclude_own_hostname = $tmp_redirect_path_parts['host']; - } - } else { - // external URL - $rewrite_exclude = '(.?)/'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['use_proxy'] = 'y'; - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - } - unset($tmp_redirect_path); - unset($tmp_redirect_path_parts); - } - $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], - 'rewrite_target' => $data['new']['redirect_path'], - 'rewrite_exclude' => $rewrite_exclude, - 'rewrite_subdir' => $rewrite_subdir, - 'exclude_own_hostname' => $exclude_own_hostname, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); - break; - case '*': - $exclude_own_hostname = ''; - if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); - break; - } - $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - } else { // URL - check if URL is local - $tmp_redirect_path = $data['new']['redirect_path']; - if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - - //if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ - if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ - // URL is local - if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); - if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; - break; - } else { - $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - $exclude_own_hostname = $tmp_redirect_path_parts['host']; - } - } else { - // external URL - $rewrite_exclude = '(.?)/'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['use_proxy'] = 'y'; - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - } - unset($tmp_redirect_path); - unset($tmp_redirect_path_parts); - } - $own_rewrite_rules[] = array( 'rewrite_domain' => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], - 'rewrite_target' => $data['new']['redirect_path'], - 'rewrite_exclude' => $rewrite_exclude, - 'rewrite_subdir' => $rewrite_subdir, - 'exclude_own_hostname' => $exclude_own_hostname, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); - break; - default: - if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path - $exclude_own_hostname = ''; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1); - break; - } - $rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - } else { // URL - check if URL is local - $tmp_redirect_path = $data['new']['redirect_path']; - if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7); - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ - // URL is local - if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1); - if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - //$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';'; - $vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path']; - break; - } else { - $rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - $exclude_own_hostname = $tmp_redirect_path_parts['host']; - } - } else { - // external URL - $rewrite_exclude = '(.?)/'; - if($data['new']['redirect_type'] == 'proxy'){ - $vhost_data['use_proxy'] = 'y'; - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - } - unset($tmp_redirect_path); - unset($tmp_redirect_path_parts); - } - $own_rewrite_rules[] = array( 'rewrite_domain' => '^'.$this->_rewrite_quote($data['new']['domain']), - 'rewrite_type' => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'], - 'rewrite_target' => $data['new']['redirect_path'], - 'rewrite_exclude' => $rewrite_exclude, - 'rewrite_subdir' => $rewrite_subdir, - 'exclude_own_hostname' => $exclude_own_hostname, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false)); - } - } - - // http2 or spdy? - $vhost_data['enable_http2'] = 'n'; - if($vhost_data['enable_spdy'] == 'y'){ - // check if nginx support http_v2; if so, use that instead of spdy - exec("2>&1 nginx -V | tr -- - '\n' | grep http_v2_module", $tmp_output, $tmp_retval); - if($tmp_retval == 0){ - $vhost_data['enable_http2'] = 'y'; - $vhost_data['enable_spdy'] = 'n'; - } - unset($tmp_output, $tmp_retval); - } - - // set logging variable - $vhost_data['logging'] = $web_config['logging']; - - $tpl->setVar($vhost_data); - - $server_alias = array(); - - // get autoalias - $auto_alias = $web_config['website_autoalias']; - if($auto_alias != '') { - // get the client username - $client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = ?", $client_id); - $aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]'); - $aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']); - $auto_alias = str_replace($aa_search, $aa_replace, $auto_alias); - unset($client); - unset($aa_search); - unset($aa_replace); - $server_alias[] .= $auto_alias.' '; - } - - // get alias domains (co-domains and subdomains) - $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ? AND active = 'y' AND (type != 'vhostsubdomain' AND type != 'vhostalias')", $data['new']['domain_id']); - $alias_seo_redirects = array(); - switch($data['new']['subdomain']) { - case 'www': - $server_alias[] = 'www.'.$data['new']['domain'].' '; - break; - case '*': - $server_alias[] = '*.'.$data['new']['domain'].' '; - break; - } - if(is_array($aliases)) { - foreach($aliases as $alias) { - - // Custom proxy directives - if($alias['redirect_type'] == 'proxy' && trim($alias['proxy_directives'] != '')){ - $final_proxy_directives = array(); - $proxy_directives = $alias['proxy_directives']; - // Make sure we only have Unix linebreaks - $proxy_directives = str_replace("\r\n", "\n", $proxy_directives); - $proxy_directives = str_replace("\r", "\n", $proxy_directives); - $proxy_directive_lines = explode("\n", $proxy_directives); - if(is_array($proxy_directive_lines) && !empty($proxy_directive_lines)){ - foreach($proxy_directive_lines as $proxy_directive_line){ - $final_proxy_directives[] = array('proxy_directive' => $proxy_directive_line); - } - } - } else { - $final_proxy_directives = false; - } - - if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'], 0, 1) == '/') { - switch($alias['subdomain']) { - case 'www': - $server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' '; - break; - case '*': - $server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' '; - break; - default: - $server_alias[] = $alias['domain'].' '; - break; - } - $app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG); - - // Add SEO redirects for alias domains - if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_'); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects[] = $tmp_seo_redirects; - } - } - } - - // Local Rewriting (inside vhost server {} container) - if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') { // proxy makes no sense with local path - if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/'; - $rewrite_exclude = '(?!/('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/'; - switch($alias['subdomain']) { - case 'www': - // example.com - $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'], - 'local_redirect_operator' => '=', - 'local_redirect_exclude' => $rewrite_exclude, - 'local_redirect_target' => $alias['redirect_path'], - 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); - - // www.example.com - $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => 'www.'.$alias['domain'], - 'local_redirect_operator' => '=', - 'local_redirect_exclude' => $rewrite_exclude, - 'local_redirect_target' => $alias['redirect_path'], - 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); - break; - case '*': - $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$', - 'local_redirect_operator' => '~*', - 'local_redirect_exclude' => $rewrite_exclude, - 'local_redirect_target' => $alias['redirect_path'], - 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); - break; - default: - $local_rewrite_rules[] = array( 'local_redirect_origin_domain' => $alias['domain'], - 'local_redirect_operator' => '=', - 'local_redirect_exclude' => $rewrite_exclude, - 'local_redirect_target' => $alias['redirect_path'], - 'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']); - } - } - - // External Rewriting (extra server {} containers) - if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'], 0, 1) != '/') { - if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/'; - if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){ - if($alias['redirect_type'] != 'proxy'){ - $alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'], 8); - } else { - $alias['redirect_path'] = 'http'.substr($alias['redirect_path'], 8); - } - } - - switch($alias['subdomain']) { - case 'www': - if($alias['redirect_type'] == 'proxy'){ - $tmp_redirect_path = $alias['redirect_path']; - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - - if($alias['redirect_type'] != 'proxy'){ - if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); - } - // Add SEO redirects for alias domains - $alias_seo_redirects2 = array(); - if($alias['seo_redirect'] != ''){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none'); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects2[] = $tmp_seo_redirects; - } - } - $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'], - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], - 'rewrite_target' => $alias['redirect_path'], - 'rewrite_subdir' => $rewrite_subdir, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), - 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); - - // Add SEO redirects for alias domains - $alias_seo_redirects2 = array(); - if($alias['seo_redirect'] != ''){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www'); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects2[] = $tmp_seo_redirects; - } - } - $rewrite_rules[] = array( 'rewrite_domain' => 'www.'.$alias['domain'], - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], - 'rewrite_target' => $alias['redirect_path'], - 'rewrite_subdir' => $rewrite_subdir, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), - 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); - break; - case '*': - if($alias['redirect_type'] == 'proxy'){ - $tmp_redirect_path = $alias['redirect_path']; - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - - if($alias['redirect_type'] != 'proxy'){ - if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); - } - // Add SEO redirects for alias domains - $alias_seo_redirects2 = array(); - if($alias['seo_redirect'] != ''){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_'); - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects2[] = $tmp_seo_redirects; - } - } - $rewrite_rules[] = array( 'rewrite_domain' => $alias['domain'].' *.'.$alias['domain'], - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], - 'rewrite_target' => $alias['redirect_path'], - 'rewrite_subdir' => $rewrite_subdir, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), - 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); - break; - default: - if($alias['redirect_type'] == 'proxy'){ - $tmp_redirect_path = $alias['redirect_path']; - $tmp_redirect_path_parts = parse_url($tmp_redirect_path); - $rewrite_subdir = $tmp_redirect_path_parts['path']; - if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1); - if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/'; - if($rewrite_subdir == '/') $rewrite_subdir = ''; - } - - if($alias['redirect_type'] != 'proxy'){ - if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1); - } - if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2); - else $domain_rule = $alias['domain']; - // Add SEO redirects for alias domains - $alias_seo_redirects2 = array(); - if($alias['seo_redirect'] != ''){ - if(substr($alias['domain'], 0, 2) === '*.'){ - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_'); - } else { - $tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none'); - } - if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){ - $alias_seo_redirects2[] = $tmp_seo_redirects; - } - } - $rewrite_rules[] = array( 'rewrite_domain' => $domain_rule, - 'rewrite_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'], - 'rewrite_target' => $alias['redirect_path'], - 'rewrite_subdir' => $rewrite_subdir, - 'proxy_directives' => $final_proxy_directives, - 'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true), - 'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false), - 'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false)); - } - } - } - } - - //* If we have some alias records - if(count($server_alias) > 0) { - $server_alias_str = ''; - $n = 0; - - foreach($server_alias as $tmp_alias) { - $server_alias_str .= $tmp_alias; - } - unset($tmp_alias); - - $tpl->setVar('alias', trim($server_alias_str)); - } else { - $tpl->setVar('alias', ''); - } - - if(count($rewrite_rules) > 0) { - $tpl->setLoop('redirects', $rewrite_rules); - } - if(count($own_rewrite_rules) > 0) { - $tpl->setLoop('own_redirects', $own_rewrite_rules); - } - if(count($local_rewrite_rules) > 0) { - $tpl->setLoop('local_redirects', $local_rewrite_rules); - } - if(count($alias_seo_redirects) > 0) { - $tpl->setLoop('alias_seo_redirects', $alias_seo_redirects); - } - - $stats_web_folder = 'web'; - if($data['new']['type'] == 'vhost'){ - if($data['new']['web_folder'] != ''){ - if(substr($data['new']['web_folder'], 0, 1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],1); - if(substr($data['new']['web_folder'], -1) == '/') $data['new']['web_folder'] = substr($data['new']['web_folder'],0,-1); - } - $stats_web_folder .= '/'.$data['new']['web_folder']; - } elseif($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') { - $stats_web_folder = $data['new']['web_folder']; - } - - //* Create basic http auth for website statistics - $tpl->setVar('stats_auth_passwd_file', $data['new']['document_root']."/" . $stats_web_folder . "/stats/.htpasswd_stats"); - - // Create basic http auth for other directories - $basic_auth_locations = $this->_create_web_folder_auth_configuration($data['new']); - if(is_array($basic_auth_locations) && !empty($basic_auth_locations)) $tpl->setLoop('basic_auth_locations', $basic_auth_locations); - - $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost'); - //* Make a backup copy of vhost file - if(file_exists($vhost_file)) copy($vhost_file, $vhost_file.'~'); - - //* Write vhost file - $app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab())); - $app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - unset($tpl); - - //* Set the symlink to enable the vhost - //* First we check if there is a old type of symlink and remove it - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink); - - //* Remove old or changed symlinks - if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') { - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - } - - //* New symlink - if($data['new']['subdomain'] == '*') { - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost'); - } else { - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost'); - } - if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) { - symlink($vhost_file, $vhost_symlink); - $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - - // remove old symlink and vhost file, if domain name of the site has changed - if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)) { - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); - $app->system->unlink($vhost_file); - $app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG); - } - - // create password file for stats directory - if(!is_file($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) { - if(trim($data['new']['stats_password']) != '') { - $htp_file = 'admin:'.trim($data['new']['stats_password']); - $app->system->file_put_contents($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats', $htp_file); - $app->system->chmod($data['new']['document_root'].'/' . $stats_web_folder . '/stats/.htpasswd_stats', 0755); - unset($htp_file); - } - } - - //* Create awstats configuration - if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) { - $this->awstats_update($data, $web_config); - } - - $this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir); - $this->hhvm_update($data, $web_config); - - if($web_config['check_apache_config'] == 'y') { - //* Test if nginx starts with the new configuration file - $nginx_online_status_before_restart = $this->_checkTcp('localhost', 80); - $app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); - - $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure - $app->log('nginx restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG); - - // wait a few seconds, before we test the apache status again - sleep(2); - - //* Check if nginx restarted successfully if it was online before - $nginx_online_status_after_restart = $this->_checkTcp('localhost', 80); - $app->log('nginx online status after restart is: '.($nginx_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG); - if($nginx_online_status_before_restart && !$nginx_online_status_after_restart || $retval['retval'] > 0) { - $app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err', LOGLEVEL_WARN); - if(is_array($retval['output']) && !empty($retval['output'])){ - $app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN); - $app->dbmaster->datalogError(implode("\n", $retval['output'])); - } else { - // if no output is given, check again - exec('nginx -t 2>&1', $tmp_output, $tmp_retval); - if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)){ - $app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN); - $app->dbmaster->datalogError(implode("\n", $tmp_output)); - } - unset($tmp_output, $tmp_retval); - } - $app->system->copy($vhost_file, $vhost_file.'.err'); - - if(is_file($vhost_file.'~')) { - //* Copy back the last backup file - $app->system->copy($vhost_file.'~', $vhost_file); - } else { - //* There is no backup file, so we create a empty vhost file with a warning message inside - $app->system->file_put_contents($vhost_file, "# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors."); - } - - if($this->ssl_certificate_changed === true) { - - $ssl_dir = $data['new']['document_root'].'/ssl'; - $domain = $data['new']['ssl_domain']; - $key_file = $ssl_dir.'/'.$domain.'.key.org'; - $key_file2 = $ssl_dir.'/'.$domain.'.key'; - $csr_file = $ssl_dir.'/'.$domain.'.csr'; - $crt_file = $ssl_dir.'/'.$domain.'.crt'; - //$bundle_file = $ssl_dir.'/'.$domain.'.bundle'; - - //* Backup the files that might have caused the error - if(is_file($key_file)){ - $app->system->copy($key_file, $key_file.'.err'); - $app->system->chmod($key_file.'.err', 0400); - } - if(is_file($key_file2)){ - $app->system->copy($key_file2, $key_file2.'.err'); - $app->system->chmod($key_file2.'.err', 0400); - } - if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err'); - if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err'); - //if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err'); - - //* Restore the ~ backup files - if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file); - if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2); - if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file); - if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file); - //if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file); - - $app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN); - } - - $app->services->restartService('httpd', 'restart'); - } - } else { - //* We do not check the nginx config after changes (is faster) - $app->services->restartServiceDelayed('httpd', 'reload'); - } - - //* The vhost is written and apache has been restarted, so we - // can reset the ssl changed var to false and cleanup some files - $this->ssl_certificate_changed = false; - - if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~'); - if(@is_file($key_file2.'~')) $app->system->unlink($key_file2.'~'); - if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~'); - if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~'); - //if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~'); - - // Remove the backup copy of the config file. - if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~'); + $app->plugin_webserver_base->eventUpdate($event_name, $data, $this->action, 'nginx'); //* Unset action to clean it for next processed vhost. $this->action = ''; } function delete($event_name, $data) { - global $app, $conf; - - // load the server configuration options - $app->uses('getconf'); - $app->uses('system'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') $app->system->web_folder_protection($data['old']['document_root'], false); - - //* Check if this is a chrooted setup - if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) { - $nginx_chrooted = true; - } else { - $nginx_chrooted = false; - } - - //* Remove the mounts - $log_folder = 'log'; - $web_folder = ''; - if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { - $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = ?', $data['old']['parent_domain_id']); - if($tmp['domain'] != ''){ - $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']); - } else { - // get log folder from /etc/fstab - /* - $bind_mounts = $app->system->file_get_contents('/etc/fstab'); - $bind_mount_lines = explode("\n", $bind_mounts); - if(is_array($bind_mount_lines) && !empty($bind_mount_lines)){ - foreach($bind_mount_lines as $bind_mount_line){ - $bind_mount_line = preg_replace('/\s+/', ' ', $bind_mount_line); - $bind_mount_parts = explode(' ', $bind_mount_line); - if(is_array($bind_mount_parts) && !empty($bind_mount_parts)){ - if($bind_mount_parts[0] == '/var/log/ispconfig/httpd/'.$data['old']['domain'] && $bind_mount_parts[2] == 'none' && strpos($bind_mount_parts[3], 'bind') !== false){ - $subdomain_host = str_replace($data['old']['document_root'].'/log/', '', $bind_mount_parts[1]); - } - } - } - } - */ - // we are deleting the parent domain, so we can delete everything in the log directory - $subdomain_hosts = array(); - $files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..')); - if(is_array($files) && !empty($files)){ - foreach($files as $file){ - if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){ - $subdomain_hosts[] = $file; - } - } - } - } - if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){ - $log_folders = array(); - foreach($subdomain_hosts as $subdomain_host){ - $log_folders[] = $log_folder.'/'.$subdomain_host; - } - } else { - if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id']; - $log_folder .= '/' . $subdomain_host; - } - $web_folder = $data['old']['web_folder']; - unset($tmp); - unset($subdomain_hosts); - } - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias'){ - if(is_array($log_folders) && !empty($log_folders)){ - foreach($log_folders as $log_folder){ - //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - } - } else { - //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); - //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); - } - - //try umount mysql - if(file_exists($data['old']['document_root'].'/var/run/mysqld')) { - $fstab_line = '/var/run/mysqld ' . $data['old']['document_root'] . '/var/run/mysqld none bind,nobootwait 0 0'; - $app->system->removeLine('/etc/fstab', $fstab_line); - $command = 'umount ' . escapeshellarg($data['old']['document_root']) . '/var/run/mysqld/'; - exec($command); - } - // remove letsencrypt if it exists (renew will always fail otherwise) - - $old_domain = $data['old']['domain']; - if(substr($old_domain, 0, 2) === '*.') { - // wildcard domain not yet supported by letsencrypt! - $old_domain = substr($old_domain, 2); - } - $le_conf_file = '/etc/letsencrypt/renewal/' . $old_domain . '.conf'; - @rename('/etc/letsencrypt/renewal/' . $old_domain . '.conf', '/etc/letsencrypt/renewal/' . $old_domain . '.conf~backup'); - } - - //* remove mountpoint from fstab - if(is_array($log_folders) && !empty($log_folders)){ - foreach($log_folders as $log_folder){ - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - } - } else { - $fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind'; - $app->system->removeLine('/etc/fstab', $fstab_line); - } - unset($log_folders); - - if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['type'] != 'vhostalias' && $data['old']['parent_domain_id'] > 0) { - //* This is a alias domain or subdomain, so we have to update the website instead - $parent_domain_id = intval($data['old']['parent_domain_id']); - $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND active = 'y'", $parent_domain_id); - $data['new'] = $tmp; - $data['old'] = $tmp; - $this->action = 'update'; - $this->update_letsencrypt = true; - // just run the update function - $this->update($event_name, $data); - - } else { - //* This is a website - // Deleting the vhost file, symlink and the data directory - $vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); - - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - $vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost'); - if(is_link($vhost_symlink)){ - $app->system->unlink($vhost_symlink); - $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG); - } - - $app->system->unlink($vhost_file); - $app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG); - - if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') { - $docroot = escapeshellcmd($data['old']['document_root']); - if($docroot != '' && !stristr($docroot, '..')) { - if($data['old']['type'] == 'vhost') { - // this is a vhost - we delete everything in here. - exec('rm -rf '.$docroot); - } elseif(!stristr($data['old']['web_folder'], '..')) { - // this is a vhost subdomain - // IMPORTANT: do some folder checks before we delete this! - $do_delete = true; - $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times - if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1); - if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1); - - $path_elements = explode('/', $delete_folder); - - if($path_elements[0] == 'web' || $path_elements[0] === '') { - // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here! - // we use strict check as otherwise directories named '0' may not be deleted - $do_delete = false; - } else { - // read all vhost subdomains and alias with same parent domain - $used_paths = array(); - $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE (type = 'vhostsubdomain' OR type = 'vhostalias') AND parent_domain_id = ? AND domain_id != ?", $data['old']['parent_domain_id'], $data['old']['domain_id']); - foreach($tmp as $tmprec) { - // we normalize the folder entries because we need to compare them - $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times - if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1); - if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1); - - // add this path and it's parent paths to used_paths array - while(strpos($tmp_folder, '/') !== false) { - if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; - $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/')); - } - if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder; - } - unset($tmp); - - // loop and check if the path is still used and stop at first used one - // set do_delete to false so nothing gets deleted if the web_folder itself is still used - $do_delete = false; - while(count($path_elements) > 0) { - $tmp_folder = implode('/', $path_elements); - if(in_array($tmp_folder, $used_paths) == true) break; - - // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true - $delete_folder = $tmp_folder; - $do_delete = true; - array_pop($path_elements); - } - unset($tmp_folder); - unset($used_paths); - } - - if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder); - - unset($delete_folder); - unset($path_elements); - } - } - - //remove the php fastgi starter script if available - if ($data['old']['php'] == 'fast-cgi') { - $this->php_fpm_pool_delete($data, $web_config); - $fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['fastcgi_starter_path']); - if($data['old']['type'] == 'vhost') { - if (is_dir($fastcgi_starter_path)) { - exec('rm -rf '.$fastcgi_starter_path); - } - } else { - $fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id']; - if (file_exists($fcgi_starter_script)) { - exec('rm -f '.$fcgi_starter_script); - } - } - } - - // remove PHP-FPM pool - if ($data['old']['php'] == 'php-fpm') { - $this->php_fpm_pool_delete($data, $web_config); - } elseif($data['old']['php'] == 'hhvm') { - $this->hhvm_update($data, $web_config); - $this->php_fpm_pool_delete($data, $web_config); - } - - //remove the php cgi starter script if available - if ($data['old']['php'] == 'cgi') { - // TODO: fetch the date from the server-settings - $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/'; - - $cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']); - if($data['old']['type'] == 'vhost') { - if (is_dir($cgi_starter_path)) { - exec('rm -rf '.$cgi_starter_path); - } - } else { - $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id']; - if (file_exists($cgi_starter_script)) { - exec('rm -f '.$cgi_starter_script); - } - } - } - - $app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG); - - // Delete the symlinks for the sites - $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = ?', $data['old']['sys_groupid']); - $client_id = intval($client['client_id']); - unset($client); - $tmp_symlinks_array = explode(':', $web_config['website_symlinks']); - if(is_array($tmp_symlinks_array)) { - foreach($tmp_symlinks_array as $tmp_symlink) { - $tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink); - $tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink); - // Remove trailing slash - if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1); - // delete the symlink - if(is_link($tmp_symlink)) { - $app->system->unlink($tmp_symlink); - $app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG); - } - } - } - // end removing symlinks - } - - // Delete the log file directory - $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']); - if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir); - $app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG); - - if($data['old']['type'] == 'vhost') { - //delete the web user - $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel'; - $command .= ' '.escapeshellcmd($data['old']['system_user']); - exec($command); - if($nginx_chrooted) $app->system->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command); - - } - - //* Remove the awstats configuration file - if($data['old']['stats_type'] == 'awstats') { - $this->awstats_delete($data, $web_config); - } - - //* Delete the web-backups - if($data['old']['type'] == 'vhost') { - $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); - $backup_dir = $server_config['backup_dir']; - $mount_backup = true; - if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') { - //* mount backup directory, if necessary - if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $mount_backup = false; - - if($mount_backup){ - $web_backup_dir = $backup_dir.'/web'.$data_old['domain_id']; - //** do not use rm -rf $web_backup_dir because database(s) may exits - exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data_old['domain_id'].'_').'*'); - //* cleanup database - $sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename LIKE ?"; - $app->db->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); - if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); - - $app->log('Deleted the web backup files', LOGLEVEL_DEBUG); - } - } - } - - $app->services->restartServiceDelayed('httpd', 'reload'); - - } - + global $app; - if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true); + $app->plugin_webserver_base->eventDelete($event_name, $data, 'nginx'); } - //* This function is called when a IP on the server is inserted, updated or deleted + //* This function is called when a IP on the server is inserted, updated or deleted or when anon_ip setting is altered function server_ip($event_name, $data) { - return; + global $app; + + $app->plugin_webserver_base->eventServerIp($event_name, $data, 'nginx'); + } //* Create or update the .htaccess folder protection function web_folder_user($event_name, $data) { - global $app, $conf; - - $app->uses('system'); - - if($event_name == 'web_folder_user_delete') { - $folder_id = $data['old']['web_folder_id']; - } else { - $folder_id = $data['new']['web_folder_id']; - } - - $folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ?", $folder_id); - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); - - if(!is_array($folder) or !is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } - - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; - - //* Get the folder path. - if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); - if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); - $folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']); - if(substr($folder_path, -1) != '/') $folder_path .= '/'; - - //* Check if the resulting path is inside the docroot - if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) { - $app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } - - //* Create the folder path, if it does not exist - if(!is_dir($folder_path)) { - $app->system->mkdirpath($folder_path, 0755, $website['system_user'], $website['system_group']); - } - - //* Create empty .htpasswd file, if it does not exist - if(!is_file($folder_path.'.htpasswd')) { - $app->system->touch($folder_path.'.htpasswd'); - $app->system->chmod($folder_path.'.htpasswd', 0755); - $app->system->chown($folder_path.'.htpasswd', $website['system_user']); - $app->system->chgrp($folder_path.'.htpasswd', $website['system_group']); - $app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } + global $app; - if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') { - $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); - $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); - } + $app->plugin_webserver_base->eventWebFolderUser($event_name, $data, 'nginx'); - //* Add or remove the user from .htpasswd file - if($event_name == 'web_folder_user_delete') { - $app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':'); - $app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG); - } else { - if($data['new']['active'] == 'y') { - $app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1); - $app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG); - } - } - - // write basic auth configuration to vhost file because nginx does not support .htaccess - $webdata['new'] = $webdata['old'] = $website; - $this->update('web_domain_update', $webdata); } //* Remove .htpasswd file, when folder protection is removed function web_folder_delete($event_name, $data) { - global $app, $conf; - - $folder_id = $data['old']['web_folder_id']; - - $folder = $data['old']; - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $folder['parent_domain_id']); - - if(!is_array($folder) or !is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } - - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; - - //* Get the folder path. - if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1); - if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1); - $folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']); - if(substr($folder_path, -1) != '/') $folder_path .= '/'; - - //* Check if the resulting path is inside the docroot - if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG); - return false; - } - - //* Remove .htpasswd file - if(is_file($folder_path.'.htpasswd')) { - $app->system->unlink($folder_path.'.htpasswd'); - $app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } + global $app; - // write basic auth configuration to vhost file because nginx does not support .htaccess - $webdata['new'] = $webdata['old'] = $website; - $this->update('web_domain_update', $webdata); + $app->plugin_webserver_base->eventWebFolderDelete($event_name, $data, 'nginx'); } //* Update folder protection, when path has been changed function web_folder_update($event_name, $data) { - global $app, $conf; - - $website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); - - if(!is_array($website)) { - $app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG); - return false; - } - - $web_folder = 'web'; - if($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') $web_folder = $website['web_folder']; - - //* Get the folder path. - if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1); - if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1); - $old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']); - if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/'; - - if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1); - if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1); - $new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']); - if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/'; - - //* Check if the resulting path is inside the docroot - if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) { - $app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } - if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) { - $app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG); - return false; - } - - //* Check if the resulting path is inside the docroot - if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); - return false; - } - if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) { - $app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG); - return false; - } - - //* Create the folder path, if it does not exist - if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path); - - if($data['old']['path'] != $data['new']['path']) { - - - //* move .htpasswd file - if(is_file($old_folder_path.'.htpasswd')) { - $app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd'); - $app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG); - } - - } - - // write basic auth configuration to vhost file because nginx does not support .htaccess - $webdata['new'] = $webdata['old'] = $website; - $this->update('web_domain_update', $webdata); - } - - function _create_web_folder_auth_configuration($website){ - global $app, $conf; - //* Create the domain.auth file which is included in the vhost configuration file - $app->uses('getconf'); - $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); - $basic_auth_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$website['domain'].'.auth'); - //$app->load('tpl'); - //$tpl = new tpl(); - //$tpl->newTemplate('nginx_http_authentication.auth.master'); - $website_auth_locations = $app->db->queryAllRecords("SELECT * FROM web_folder WHERE active = 'y' AND parent_domain_id = ?", $website['domain_id']); - $basic_auth_locations = array(); - if(is_array($website_auth_locations) && !empty($website_auth_locations)){ - foreach($website_auth_locations as $website_auth_location){ - if(substr($website_auth_location['path'], 0, 1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 1); - if(substr($website_auth_location['path'], -1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 0, -1); - if($website_auth_location['path'] != ''){ - $website_auth_location['path'] .= '/'; - } - $basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'], - 'htpasswd_path' => $website['document_root'].'/' . (($website['type'] == 'vhostsubdomain' || $website['type'] == 'vhostalias') ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']); - } - } - return $basic_auth_locations; - //$tpl->setLoop('basic_auth_locations', $basic_auth_locations); - //file_put_contents($basic_auth_file,$tpl->grab()); - //$app->log('Writing the http basic authentication file: '.$basic_auth_file,LOGLEVEL_DEBUG); - //unset($tpl); - //$app->services->restartServiceDelayed('httpd','reload'); - } - - //* Update the awstats configuration file - private function awstats_update ($data, $web_config) { global $app; - $web_folder = $data['new']['web_folder']; - if($data['new']['type'] == 'vhost') $web_folder = 'web'; - $awstats_conf_dir = $web_config['awstats_conf_dir']; - - if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats"); - if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) { - if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { - $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); - } - - $content = ''; - if (is_file($awstats_conf_dir."/awstats.conf")) { - $include_file = $awstats_conf_dir."/awstats.conf"; - } elseif (is_file($awstats_conf_dir."/awstats.model.conf")) { - $include_file = $awstats_conf_dir."/awstats.model.conf"; - } - $content .= "Include \"".$include_file."\"\n"; - $content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n"; - $content .= "SiteDomain=\"".$data['new']['domain']."\"\n"; - $content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n"; - - if (isset($include_file)) { - $app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content); - $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG); - } else { - $app->log("No awstats base config found. Either awstats.conf or awstats.model.conf must exist in ".$awstats_conf_dir.".", LOGLEVEL_WARN); - } - } - - if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html"); - if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) { - $app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); - } else { - $app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php"); - } + $app->plugin_webserver_base->eventWebFolderUpdate($event_name, $data, 'nginx'); } - //* Delete the awstats configuration file - private function awstats_delete ($data, $web_config) { + public function ftp_user_delete($event_name, $data) { global $app; - $awstats_conf_dir = $web_config['awstats_conf_dir']; - - if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) { - $app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf'); - $app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG); - } - } - - private function hhvm_update($data, $web_config) { - global $app, $conf; - - if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_starter.master')) { - $content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_starter.master'); - } else { - $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master'); - } - if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) { - $monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master'); - } else { - $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master'); - } - - if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || ($data['new']['php'] == 'hhvm' && isset($data['old']['custom_php_ini']) && isset($data['new']['custom_php_ini']) && $data['new']['custom_php_ini'] != $data['old']['custom_php_ini'])) { - - // Custom php.ini settings - $custom_php_ini_settings = trim($data['new']['custom_php_ini']); - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $custom_php_ini_settings .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - if($custom_php_ini_settings != ''){ - // Make sure we only have Unix linebreaks - $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); - $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); - if(@is_dir('/etc/hhvm')) file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); - } else { - if($data['old']['system_user'] != '' && is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - } - - $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); - file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); - exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); - exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); - exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); - - if(is_dir('/etc/monit/conf.d')){ - $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); - file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); - if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); - exec('/etc/init.d/monit restart >/dev/null 2>&1'); - } - - } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { - if($data['old']['system_user'] != ''){ - exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); - exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); - unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); - if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - } - - if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ - if(is_file('/etc/monit/conf.d/hhvm_' . $data['old']['system_user'])){ - unlink('/etc/monit/conf.d/hhvm_' . $data['old']['system_user']); - } - if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user'])){ - unlink('/etc/monit/conf.d/00-hhvm_' . $data['old']['system_user']); - } - exec('/etc/init.d/monit restart >/dev/null 2>&1'); - } - } - } - - //* Update the PHP-FPM pool configuration file - private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) { - global $app, $conf; - $pool_dir = trim($pool_dir); - $rh_releasefiles = array('/etc/centos-release', '/etc/redhat-release'); - - // HHVM => PHP-FPM-Fallback - if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ - if(trim($data['new']['fastcgi_php_version']) != ''){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } else { - if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - } - - $app->uses("getconf"); - $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - - // HHVM => PHP-FPM-Fallback - if($data['new']['php'] != 'php-fpm' && $data['new']['php'] != 'hhvm'){ - if(@is_file($pool_dir.$pool_name.'.conf')){ - $app->system->unlink($pool_dir.$pool_name.'.conf'); - //$reload = true; - } - if($data['old']['php'] != 'no'){ - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - return; - } - - $app->load('tpl'); - $tpl = new tpl(); - $tpl->newTemplate('php_fpm_pool.conf.master'); - - if($data['new']['php_fpm_chroot'] == 'y'){ - $php_fpm_chroot = 1; - } else { - $php_fpm_chroot = 0; - } - if($data['new']['php_fpm_use_socket'] == 'y'){ - $use_tcp = 0; - $use_socket = 1; - if(!is_dir($socket_dir)) $app->system->mkdirpath($socket_dir); - } else { - $use_tcp = 1; - $use_socket = 0; - } - $tpl->setVar('use_tcp', $use_tcp); - $tpl->setVar('use_socket', $use_socket); - $tpl->setVar('php_fpm_chroot', $php_fpm_chroot); - - $fpm_socket = $socket_dir.$pool_name.'.sock'; - $tpl->setVar('fpm_socket', $fpm_socket); - $tpl->setVar('fpm_listen_mode', '0660'); - - $tpl->setVar('fpm_pool', $pool_name); - $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); - $tpl->setVar('fpm_user', $data['new']['system_user']); - - //Red Hat workaround for group ownership of socket files - foreach($rh_releasefiles as $rh_file) { - if(file_exists($rh_file) && (filesize($rh_file) > 0)) { - $tmp = file_get_contents($rh_file); - if(preg_match('/[67]+\.[0-9]+/m', $tmp)) { - $tpl->setVar('fpm_group', $data['new']['system_group']); - $tpl->setVar('fpm_listen_group', $data['new']['system_group']); - } - unset($tmp); - } elseif(!file_exists($rh_file)) { - //OS seems to be not Red Hat'ish - $tpl->setVar('fpm_group', $data['new']['system_group']); - $tpl->setVar('fpm_listen_group', $web_config['group']); - } - break; - } - - $tpl->setVar('fpm_listen_user', $data['new']['system_user']); - $tpl->setVar('fpm_domain', $data['new']['domain']); - $tpl->setVar('pm', $data['new']['pm']); - $tpl->setVar('pm_max_children', $data['new']['pm_max_children']); - $tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']); - $tpl->setVar('pm_min_spare_servers', $data['new']['pm_min_spare_servers']); - $tpl->setVar('pm_max_spare_servers', $data['new']['pm_max_spare_servers']); - $tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']); - $tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']); - $tpl->setVar('document_root', $data['new']['document_root']); - $tpl->setVar('security_level', $web_config['security_level']); - $tpl->setVar('domain', $data['new']['domain']); - $php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']); - if($php_fpm_chroot){ - $document_root = $data['new']['document_root']; - $domain = $data['new']['domain']; - $php_open_basedir = str_replace(":/srv/www/$domain/web",'',$php_open_basedir); - $php_open_basedir = str_replace(":/var/www/$domain/web",'',$php_open_basedir); - $php_open_basedir = str_replace("$document_root",'',$php_open_basedir); - } - $tpl->setVar('php_open_basedir', $php_open_basedir); - if($php_open_basedir != ''){ - $tpl->setVar('enable_php_open_basedir', ''); - } else { - $tpl->setVar('enable_php_open_basedir', ';'); - } - - // Custom php.ini settings - $final_php_ini_settings = array(); - $custom_php_ini_settings = trim($data['new']['custom_php_ini']); - - if(intval($data['new']['directive_snippets_id']) > 0){ - $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); - if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ - $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); - if(is_array($required_php_snippets) && !empty($required_php_snippets)){ - foreach($required_php_snippets as $required_php_snippet){ - $required_php_snippet = intval($required_php_snippet); - if($required_php_snippet > 0){ - $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE ".($snippet['master_directive_snippets_id'] > 0 ? 'master_' : '')."directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); - $php_snippet['snippet'] = trim($php_snippet['snippet']); - if($php_snippet['snippet'] != ''){ - $custom_php_ini_settings .= "\n".$php_snippet['snippet']; - } - } - } - } - } - } - - $custom_session_save_path = false; - if($custom_php_ini_settings != ''){ - // Make sure we only have Unix linebreaks - $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); - $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); - $ini_settings = explode("\n", $custom_php_ini_settings); - if(is_array($ini_settings) && !empty($ini_settings)){ - foreach($ini_settings as $ini_setting){ - $ini_setting = trim($ini_setting); - if(substr($ini_setting, 0, 1) == ';') continue; - if(substr($ini_setting, 0, 1) == '#') continue; - if(substr($ini_setting, 0, 2) == '//') continue; - list($key, $value) = explode('=', $ini_setting, 2); - $value = trim($value); - if($value != ''){ - $key = trim($key); - if($key == 'session.save_path') $custom_session_save_path = true; - switch (strtolower($value)) { - case '0': - // PHP-FPM might complain about invalid boolean value if you use 0 - $value = 'off'; - case '1': - case 'on': - case 'off': - case 'true': - case 'false': - case 'yes': - case 'no': - $final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value); - break; - default: - $final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value); - } - } - } - } - } + $ftpquota_file = $data['old']['dir'].'/.ftpquota'; + if(file_exists($ftpquota_file)) $app->system->unlink($ftpquota_file); - $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); - - $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); - - $app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab()); - $app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - unset($tpl); - - // delete pool in all other PHP versions - $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); - if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; - if($default_pool_dir != $pool_dir){ - if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($default_pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $conf["server_id"]); - if(is_array($php_versions) && !empty($php_versions)){ - foreach($php_versions as $php_version){ - $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); - if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; - if($php_version['php_fpm_pool_dir'] != $pool_dir){ - if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { - $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); - } - } - } - } - // Reload current PHP-FPM after all others - sleep(1); - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - - //* Delete the PHP-FPM pool configuration file - private function php_fpm_pool_delete ($data, $web_config) { - global $app, $conf; - - if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){ - $default_php_fpm = false; - list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version'])); - if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/'; - } else { - $default_php_fpm = true; - } - - if($default_php_fpm){ - $pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']); - } else { - $pool_dir = $custom_php_fpm_pool_dir; - } - $pool_dir = trim($pool_dir); - - if(substr($pool_dir, -1) != '/') $pool_dir .= '/'; - $pool_name = 'web'.$data['old']['domain_id']; - - if ( @is_file($pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - } - - // delete pool in all other PHP versions - $default_pool_dir = trim(escapeshellcmd($web_config['php_fpm_pool_dir'])); - if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/'; - if($default_pool_dir != $pool_dir){ - if ( @is_file($default_pool_dir.$pool_name.'.conf') ) { - $app->system->unlink($default_pool_dir.$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - $php_versions = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?", $data['old']['server_id']); - if(is_array($php_versions) && !empty($php_versions)){ - foreach($php_versions as $php_version){ - $php_version['php_fpm_pool_dir'] = trim($php_version['php_fpm_pool_dir']); - if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/'; - if($php_version['php_fpm_pool_dir'] != $pool_dir){ - if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) { - $app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf'); - $app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG); - $app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']); - } - } - } - } - - // Reload current PHP-FPM after all others - sleep(1); - if(!$default_php_fpm){ - $app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script); - } else { - $app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']); - } - } - - private function nginx_replace($matches){ - $location = 'location'.($matches[1] != '' ? ' '.$matches[1] : '').' '.$matches[2].' '.$matches[3]; - if($matches[4] == '##merge##' || $matches[7] == '##merge##') $location .= ' ##merge##'; - if($matches[4] == '##delete##' || $matches[7] == '##delete##') $location .= ' ##delete##'; - $location .= "\n"; - $location .= $matches[5]."\n"; - $location .= $matches[6]; - return $location; - } - - private function nginx_merge_locations($vhost_conf) { - global $app, $conf; - - if(preg_match('/##subroot (.+?)\s*##/', $vhost_conf, $subroot)) { - if(!preg_match('/^(?:[a-z0-9\/_-]|\.(?!\.))+$/iD', $subroot[1])) { - $app->log('Token ##subroot is unsecure (server ID: '.$conf['server_id'].').', LOGLEVEL_WARN); - } else { - $insert_pos = strpos($vhost_conf, ';', strpos($vhost_conf, 'root ')); - $vhost_conf = substr_replace($vhost_conf, ltrim($subroot[1], '/'), $insert_pos, 0); - } - } - - $lines = explode("\n", $vhost_conf); - - // if whole location block is in one line, split it up into multiple lines - if(is_array($lines) && !empty($lines)){ - $linecount = sizeof($lines); - for($h=0;$h<$linecount;$h++){ - // remove comments - if(substr(trim($lines[$h]), 0, 1) == '#'){ - unset($lines[$h]); - continue; - } - - $lines[$h] = rtrim($lines[$h]); - /* - if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], ';') !== false){ - $lines[$h] = str_replace("{", "{\n", $lines[$h]); - $lines[$h] = str_replace(";", ";\n", $lines[$h]); - if(strpos($lines[$h], '##merge##') !== false){ - $lines[$h] = str_replace('##merge##', '', $lines[$h]); - $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1); - } - } - if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], '}') !== false && strpos($lines[$h], ';') === false){ - $lines[$h] = str_replace("{", "{\n", $lines[$h]); - if(strpos($lines[$h], '##merge##') !== false){ - $lines[$h] = str_replace('##merge##', '', $lines[$h]); - $lines[$h] = substr($lines[$h],0,strpos($lines[$h], '{')).' ##merge##'.substr($lines[$h],strpos($lines[$h], '{')+1); - } - } - */ - $pattern = '/^[^\S\n]*location[^\S\n]+(?:(.+)[^\S\n]+)?(.+)[^\S\n]*(\{)[^\S\n]*(##merge##|##delete##)?[^\S\n]*(.+)[^\S\n]*(\})[^\S\n]*(##merge##|##delete##)?[^\S\n]*$/'; - $lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') , $lines[$h]); - } - } - $vhost_conf = implode("\n", $lines); - unset($lines); - unset($linecount); - - $lines = explode("\n", $vhost_conf); - - if(is_array($lines) && !empty($lines)){ - $locations = array(); - $locations_to_delete = array(); - $islocation = false; - $linecount = sizeof($lines); - $server_count = 0; - - for($i=0;$i<$linecount;$i++){ - $l = trim($lines[$i]); - if(substr($l, 0, 8) == 'server {') $server_count += 1; - if($server_count > 1) break; - if(substr($l, 0, 8) == 'location' && !$islocation){ - - $islocation = true; - $level = 0; - - // Remove unnecessary whitespace - $l = preg_replace('/\s\s+/', ' ', $l); - - $loc_parts = explode(' ', $l); - // see http://wiki.nginx.org/HttpCoreModule#location - if($loc_parts[1] == '=' || $loc_parts[1] == '~' || $loc_parts[1] == '~*' || $loc_parts[1] == '^~'){ - $location = $loc_parts[1].' '.$loc_parts[2]; - } else { - $location = $loc_parts[1]; - } - unset($loc_parts); - - if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace'; - if(substr($l, -9) == '##merge##') $locations[$location]['action'] = 'merge'; - if(substr($l, -10) == '##delete##') $locations[$location]['action'] = 'delete'; - - if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = ' location '.$location.' {'; - if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = ''; - if($locations[$location]['action'] == 'delete') $locations_to_delete[] = $location; - if(!isset($locations[$location]['end_tag'])) $locations[$location]['end_tag'] = ' }'; - if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i; - - unset($lines[$i]); - - } else { - - if($islocation){ - $openingbracketpos = strrpos($l, '{'); - if($openingbracketpos !== false){ - $level += 1; - } - $closingbracketpos = strrpos($l, '}'); - if($closingbracketpos !== false && $level > 0 && $closingbracketpos >= intval($openingbracketpos)){ - $level -= 1; - $locations[$location]['location'] .= $lines[$i]."\n"; - } elseif($closingbracketpos !== false && $level == 0 && $closingbracketpos >= intval($openingbracketpos)){ - $islocation = false; - } else { - $locations[$location]['location'] .= $lines[$i]."\n"; - } - unset($lines[$i]); - } - - } - } - - if(is_array($locations) && !empty($locations)){ - if(is_array($locations_to_delete) && !empty($locations_to_delete)){ - foreach($locations_to_delete as $location_to_delete){ - if(isset($locations[$location_to_delete])) unset($locations[$location_to_delete]); - } - } - - foreach($locations as $key => $val){ - $new_location = $val['open_tag']."\n".$val['location'].$val['end_tag']; - $lines[$val['start_line']] = $new_location; - } - } - ksort($lines); - $vhost_conf = implode("\n", $lines); - } - - return trim($vhost_conf); } function client_delete($event_name, $data) { - global $app, $conf; - - $app->uses("getconf"); - $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - - $client_id = intval($data['old']['client_id']); - if($client_id > 0) { - - $client_dir = $web_config['website_basedir'].'/clients/client'.$client_id; - if(is_dir($client_dir) && !stristr($client_dir, '..')) { - // remove symlinks from $client_dir - $files = array_diff(scandir($client_dir), array('.', '..')); - if(is_array($files) && !empty($files)){ - foreach($files as $file){ - if(is_link($client_dir.'/'.$file)){ - unlink($client_dir.'/'.$file); - $app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG); - } - } - } - - @rmdir($client_dir); - $app->log('Removed client directory: '.$client_dir, LOGLEVEL_DEBUG); - } - - if($app->system->is_group('client'.$client_id)){ - $app->system->_exec('groupdel client'.$client_id); - $app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG); - } - } - - } - - private function _checkTcp ($host, $port) { - - $fp = @fsockopen($host, $port, $errno, $errstr, 2); - - if ($fp) { - fclose($fp); - return true; - } else { - return false; - } - } - - private function _rewrite_quote($string) { - return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string); - } - - private function url_is_local($hostname, $domain_id){ global $app; - // ORDER BY clause makes sure wildcard subdomains (*) are listed last in the result array so that we can find direct matches first - $webs = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' ORDER BY subdomain ASC"); - if(is_array($webs) && !empty($webs)){ - foreach($webs as $web){ - // web domain doesn't match hostname - if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue; - // own vhost and therefore server {} container of its own - //if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') continue; - // alias domains/subdomains using rewrites and therefore a server {} container of their own - //if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue; - - if($web['subdomain'] == '*'){ - $pattern = '/\.?'.str_replace('.', '\.', $web['domain']).'$/i'; - } - if($web['subdomain'] == 'none'){ - if($web['domain'] == $hostname){ - if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ - // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; - // alias domains/subdomains using rewrites and therefore a server {} container of their own - if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; - return true; - } else { - return false; - } - } - $pattern = '/^'.str_replace('.', '\.', $web['domain']).'$/i'; - } - if($web['subdomain'] == 'www'){ - if($web['domain'] == $hostname || $web['subdomain'].'.'.$web['domain'] == $hostname){ - if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ - // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; - // alias domains/subdomains using rewrites and therefore a server {} container of their own - if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; - return true; - } else { - return false; - } - } - $pattern = '/^(www\.)?'.str_replace('.', '\.', $web['domain']).'$/i'; - } - if(preg_match($pattern, $hostname)){ - if($web['domain_id'] == $domain_id || $web['parent_domain_id'] == $domain_id){ - // own vhost and therefore server {} container of its own - if($web['type'] == 'vhostsubdomain' || $web['type'] == 'vhostalias') return false; - // alias domains/subdomains using rewrites and therefore a server {} container of their own - if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') return false; - return true; - } else { - return false; - } - } - } - } - - return false; + $app->plugin_webserver_base->eventClientDelete($event_name, $data, 'nginx'); } - private function get_seo_redirects($web, $prefix = '', $force_subdomain = false){ - // $force_subdomain = 'none|www' - $seo_redirects = array(); - - if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*'; - - if(($web['subdomain'] == 'www' || $web['subdomain'] == '*') && $force_subdomain != 'www'){ - if($web['seo_redirect'] == 'non_www_to_www'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain']; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '='; - } - if($web['seo_redirect'] == '*_domain_tld_to_www_domain_tld'){ - // ^(example\.com|(?!\bwww\b)\.example\.com)$ - // ^(example\.com|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.example\.com))$ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '^('.str_replace('.', '\.', $web['domain']).'|((?:\w+(?:-\w+)*\.)*)((?!www\.)\w+(?:-\w+)*)(\.'.str_replace('.', '\.', $web['domain']).'))$'; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '~*'; - } - if($web['seo_redirect'] == '*_to_www_domain_tld'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '!='; - } - } - if($force_subdomain != 'none'){ - if($web['seo_redirect'] == 'www_to_non_www'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = 'www.'.$web['domain']; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '='; - } - if($web['seo_redirect'] == '*_domain_tld_to_domain_tld'){ - // ^(.+)\.example\.com$ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = '^(.+)\.'.str_replace('.', '\.', $web['domain']).'$'; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '~*'; - } - if($web['seo_redirect'] == '*_to_domain_tld'){ - $seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain']; - $seo_redirects[$prefix.'seo_redirect_target_domain'] = $web['domain']; - $seo_redirects[$prefix.'seo_redirect_operator'] = '!='; - } - } - return $seo_redirects; - } } // end class -?> diff --git a/server/plugins-available/openvz_plugin.inc.php b/server/plugins-available/openvz_plugin.inc.php deleted file mode 100644 index 5cc4bf6522aaf1a64ab8d375b96ed8b6f89de18a..0000000000000000000000000000000000000000 --- a/server/plugins-available/openvz_plugin.inc.php +++ /dev/null @@ -1,212 +0,0 @@ -plugins->registerEvent('openvz_vm_insert', $this->plugin_name, 'vm_insert'); - $app->plugins->registerEvent('openvz_vm_update', $this->plugin_name, 'vm_update'); - $app->plugins->registerEvent('openvz_vm_delete', $this->plugin_name, 'vm_delete'); - - //* Register for actions - $app->plugins->registerAction('openvz_start_vm', $this->plugin_name, 'actions'); - $app->plugins->registerAction('openvz_stop_vm', $this->plugin_name, 'actions'); - $app->plugins->registerAction('openvz_restart_vm', $this->plugin_name, 'actions'); - $app->plugins->registerAction('openvz_create_ostpl', $this->plugin_name, 'actions'); - - - - } - - - function vm_insert($event_name, $data) { - global $app, $conf; - - $veid = intval($data['new']['veid']); - - if($veid == 0) { - $app->log("VEID = 0, we stop here.", LOGLEVEL_WARN); - return; - } - - $tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ?", $data['new']['ostemplate_id']); - $ostemplate = escapeshellcmd($tmp['template_file']); - unset($tmp); - - //* Create the virtual machine - exec("vzctl create $veid --ostemplate $ostemplate"); - $app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate", LOGLEVEL_DEBUG); - - //* Write the configuration of the VM - file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']); - - //* Start the VM - if($data['new']['active'] == 'y') { - exec("vzctl start $veid"); - $app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG); - } - - //* Set the root password in the virtual machine - exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password'])); - - } - - function vm_update($event_name, $data) { - global $app, $conf; - - $veid = intval($data['new']['veid']); - - if($veid == 0) { - $app->log("VEID = 0, we stop here.", LOGLEVEL_WARN); - return; - } - - //* Write the configuration of the VM - file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']); - $app->log("Writing new configuration for $veid", LOGLEVEL_DEBUG); - - //* new diskspace for ploop-containers requieres "vzctl set" - if($data['new']['diskspace'] != $data['old']['diskspace']) { - exec("vzctl set ".$veid." --diskspace ".$data['new']['diskspace']."G --save"); - } - - //* Apply config changes to the VM - if($data['new']['active'] == 'y' && $data['old']['active'] == 'y') { - exec("vzctl restart $veid"); - $app->log("Restarting OpenVZ VM: vzctl restart $veid", LOGLEVEL_DEBUG); - } elseif ($data['new']['active'] == 'y' && $data['old']['active'] == 'n') { - exec("vzctl start $veid"); - $app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG); - } elseif ($data['new']['active'] == 'n' && $data['old']['active'] == 'y') { - exec("vzctl stop $veid"); - $app->log("Stopping OpenVZ VM: vzctl stop $veid", LOGLEVEL_DEBUG); - } - - //* Set the root password in the virtual machine - if($data['new']['vm_password'] != $data['old']['vm_password']) { - exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password'])); - } - - - } - - function vm_delete($event_name, $data) { - global $app, $conf; - - $veid = intval($data['old']['veid']); - - if($veid == 0) { - $app->log("VEID = 0, we stop here.", LOGLEVEL_WARN); - return; - } - - exec("vzctl stop $veid"); - exec("vzctl destroy $veid"); - $app->log("Destroying OpenVZ VM: vzctl destroy $veid", LOGLEVEL_DEBUG); - - } - - function actions($action_name, $data) { - global $app, $conf; - - if ($action_name == 'openvz_start_vm') { - $veid = intval($data); - if($veid > 0) { - exec("vzctl start $veid"); - $app->log("Start VM: vzctl start $veid", LOGLEVEL_DEBUG); - } - return 'ok'; - } - if ($action_name == 'openvz_stop_vm') { - $veid = intval($data); - if($veid > 0) { - exec("vzctl stop $veid"); - $app->log("Stop VM: vzctl stop $veid", LOGLEVEL_DEBUG); - } - return 'ok'; - } - if ($action_name == 'openvz_restart_vm') { - $veid = intval($data); - if($veid > 0) { - exec("vzctl restart $veid"); - $app->log("Restart VM: vzctl restart $veid", LOGLEVEL_DEBUG); - } - return 'ok'; - } - if ($action_name == 'openvz_create_ostpl') { - $parts = explode(':', $data); - $veid = intval($parts[0]); - $template_cache_dir = '/vz/template/cache/'; - $template_name = escapeshellcmd($parts[1]); - if($veid > 0 && $template_name != '' && is_dir($template_cache_dir)) { - $command = "vzdump --suspend --compress --stdexcludes --dumpdir $template_cache_dir $veid"; - exec($command); - exec("mv ".$template_cache_dir."vzdump-openvz-".$veid."*.tgz ".$template_cache_dir.$template_name.".tar.gz"); - exec("rm -f ".$template_cache_dir."vzdump-openvz-".$veid."*.log"); - } - $app->log("Created OpenVZ OStemplate $template_name from VM $veid", LOGLEVEL_DEBUG); - return 'ok'; - } - - } - - -} // end class - -?> diff --git a/server/plugins-available/pma_symlink_plugin.inc.php b/server/plugins-available/pma_symlink_plugin.inc.php index 6b9b4fb2642f4b65dad4c511a851c5e6dc5ab857..88c68da83cef9b514a2721193c80e7d2e4896840 100644 --- a/server/plugins-available/pma_symlink_plugin.inc.php +++ b/server/plugins-available/pma_symlink_plugin.inc.php @@ -101,9 +101,7 @@ class pma_symlink_plugin { } $symlink = true; - if($data["new"]["php"] == "suphp") $symlink = false; - elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false; - elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; + if($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true); diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php index 64c557139088088f21dd35c547a9462361c6162a..3d32d805403d3e3bdbb85181ca91352d5a74cc97 100644 --- a/server/plugins-available/postfix_server_plugin.inc.php +++ b/server/plugins-available/postfix_server_plugin.inc.php @@ -60,15 +60,11 @@ class postfix_server_plugin { Register for the events */ - $app->plugins->registerEvent('server_insert', 'postfix_server_plugin', 'insert'); - $app->plugins->registerEvent('server_update', 'postfix_server_plugin', 'update'); - - - + $app->plugins->registerEvent('server_insert', $this->plugin_name, 'insert'); + $app->plugins->registerEvent('server_update', $this->plugin_name, 'update'); } function insert($event_name, $data) { - global $app, $conf; $this->update($event_name, $data); @@ -89,7 +85,7 @@ class postfix_server_plugin { $content = file_exists('/etc/postfix/sasl_passwd') ? file_get_contents('/etc/postfix/sasl_passwd') : ''; $content = preg_replace('/^'.preg_quote($old_ini_data['email']['relayhost']).'\s+[^\n]*(:?\n|)/m','',$content); - if (!empty($mail_config['relayhost']) || !empty($mail_config['relayhost_user']) || !empty($mail_config['relayhost_password'])) { + if (!empty($mail_config['relayhost_user']) || !empty($mail_config['relayhost_password'])) { $content .= "\n".$mail_config['relayhost'].' '.$mail_config['relayhost_user'].':'.$mail_config['relayhost_password']; } @@ -116,7 +112,7 @@ class postfix_server_plugin { if($rbl_hosts != ''){ $rbl_hosts = explode(",", $rbl_hosts); } - $options = explode(", ", exec("postconf -h smtpd_recipient_restrictions")); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); $new_options = array(); foreach ($options as $key => $value) { if (!preg_match('/reject_rbl_client/', $value)) { @@ -162,7 +158,8 @@ class postfix_server_plugin { } if($app->system->is_installed('dovecot')) { - $temp = exec("postconf -n virtual_transport", $out); + $out = null; + exec("postconf -n virtual_transport", $out); if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') { // If dovecot switch to lmtp if($out[0] != "virtual_transport = lmtp:unix:private/dovecot-lmtp") { @@ -182,12 +179,51 @@ class postfix_server_plugin { } } - exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); //TODO : no reload? - exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); //TODO : no reload? + if($mail_config['content_filter'] != $old_ini_data['mail']['content_filter']) { + if($mail_config['content_filter'] == 'rspamd'){ + exec("postconf -X 'receive_override_options'"); + exec("postconf -X 'content_filter'"); + + exec("postconf -e 'smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'non_smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'milter_protocol = 6'"); + exec("postconf -e 'milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}'"); + exec("postconf -e 'milter_default_action = accept'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, permit_mynetworks, permit_sasl_authenticated'"); + + $new_options = array(); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); + foreach ($options as $key => $value) { + if (!preg_match('/check_policy_service\s+inet:127.0.0.1:10023/', $value)) { + $new_options[] = $value; + } + } + exec("postconf -e 'smtpd_recipient_restrictions = ".implode(", ", $new_options)."'"); + } elseif($mail_config['content_filter'] == 'amavisd'){ + exec("postconf -X 'smtpd_milters'"); + exec("postconf -X 'milter_protocol'"); + exec("postconf -X 'milter_mail_macros'"); + exec("postconf -X 'milter_default_action'"); + + exec("postconf -e 'receive_override_options = no_address_mappings'"); + exec("postconf -e 'content_filter = amavis:[127.0.0.1]:10024'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf regexp:/etc/postfix/tag_as_originating.re, permit_mynetworks, permit_sasl_authenticated, check_sender_access regexp:/etc/postfix/tag_as_foreign.re'"); + } + } + if($mail_config['content_filter'] == 'rspamd' && ($mail_config['rspamd_password'] != $old_ini_data['mail']['rspamd_password'] || $mail_config['content_filter'] != $old_ini_data['mail']['content_filter'])) { + $tpl = new tpl(); + $tpl->newTemplate('rspamd_worker-controller.inc.master'); + $tpl->setVar('rspamd_password', $mail_config['rspamd_password']); + $app->system->file_put_contents('/etc/rspamd/local.d/worker-controller.inc', $tpl->grab()); + $app->services->restartServiceDelayed('rspamd', 'reload'); + } + exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); + exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); + $app->services->restartServiceDelayed('postfix', 'reload'); } } // end class - -?> diff --git a/server/plugins-available/powerdns_plugin.inc.php b/server/plugins-available/powerdns_plugin.inc.php index 412050d009225126e08fba0f3d39b6f1c2e998cb..1ecdfaf50174825e6817631434b8c6c287cda9de 100644 --- a/server/plugins-available/powerdns_plugin.inc.php +++ b/server/plugins-available/powerdns_plugin.inc.php @@ -7,14 +7,14 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of ISPConfig nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of ISPConfig nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -97,7 +97,7 @@ class powerdns_plugin { /* - This function is called when the plugin is loaded + This function is called when the plugin is loaded */ function onLoad() { @@ -151,6 +151,8 @@ class powerdns_plugin { //* tell pdns to rediscover zones in DB $this->zoneRediscover(); + //* handle dnssec + $this->handle_dnssec($data); //* tell pdns to use 'pdnssec rectify' on the new zone $this->rectifyZone($data); //* tell pdns to send notify to slave @@ -181,10 +183,6 @@ class powerdns_plugin { $ttl = $data["new"]["ttl"]; $app->db->query("UPDATE powerdns.records SET name = ?, content = ?, ttl = ?, change_date = UNIX_TIMESTAMP() WHERE ispconfig_id = ? AND type = 'SOA'", $origin, $content, $ttl, $data["new"]["id"]); - //* tell pdns to use 'pdnssec rectify' on the new zone - $this->rectifyZone($data); - //* tell pdns to send notify to slave - $this->notifySlave($data); } else { $this->soa_insert($event_name, $data); $ispconfig_id = $data["new"]["id"]; @@ -196,11 +194,14 @@ class powerdns_plugin { $this->rr_insert("dns_rr_insert", $data); } } - //* tell pdns to use 'pdnssec rectify' on the new zone - $this->rectifyZone($data); - //* tell pdns to send notify to slave - $this->notifySlave($data); } + + //* handle dnssec + $this->handle_dnssec($data); + //* tell pdns to use 'pdnssec rectify' on the new zone + $this->rectifyZone($data); + //* tell pdns to send notify to slave + $this->notifySlave($data); } } @@ -420,15 +421,23 @@ class powerdns_plugin { } } - function find_pdns_pdnssec() { + function find_pdns_pdnssec_or_pdnsutil() { $output = array(); $retval = ''; + + // The command is named pdnssec in PowerDNS 3 exec("type -p pdnssec", $output, $retval); if ($retval == 0 && is_file($output[0])){ return $output[0]; - } else { - return false; } + + // But in PowerNDS 4 they renamed it to pdnsutil + exec("type -p pdnsutil", $output, $retval); + if ($retval == 0 && is_file($output[0])){ + return $output[0]; + } + + return false; } function zoneRediscover() { @@ -465,19 +474,230 @@ class powerdns_plugin { } } + function is_pdns_version_supported() { + if (preg_match('/^[34]/',$this->get_pdns_version())) { + return true; + } + + return false; + } + + function handle_dnssec($data) { + // If origin changed, delete keys first + if ($data['old']['origin'] != $data['new']['origin']) { + if (@$data['old']['dnssec_initialized'] == 'Y' && strlen(@$data['old']['origin']) > 3) { + $this->soa_dnssec_delete($data); + } + } + + // If DNSSEC is disabled, but was enabled before, just disable DNSSEC but leave the keys in dns_info + if ($data['new']['dnssec_wanted'] === 'N' && $data['old']['dnssec_wanted'] === 'Y') { + $this->soa_dnssec_disable($data); + + return; + } + + // If DNSSEC is wanted, enable it + if ($data['new']['dnssec_wanted'] === 'Y' && $data['old']['dnssec_wanted'] === 'N') { + $this->soa_dnssec_create($data); + } + } + + function soa_dnssec_create($data) { + global $app; + + if (false === $this->is_pdns_version_supported()) { + return; + } + + $pdns_pdnssec = $this->find_pdns_pdnssec_or_pdnsutil(); + if ($pdns_pdnssec === false) { + return; + } + + $zone = rtrim($data['new']['origin'],'.'); + $log = array(); + + // We don't log the actual commands here, because having commands in the dnssec_info field will trigger + // the IDS if you try to save the record using the interface afterwards. + $cmd_add_zone_key_ksk = sprintf('%s add-zone-key %s ksk active 2048 rsasha256', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running add-zone-key ksk command...'); + exec($cmd_add_zone_key_ksk, $log); + + $cmd_add_zone_key_zsk = sprintf('%s add-zone-key %s zsk active 1024 rsasha256', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running add-zone-key zsk command...'); + exec($cmd_add_zone_key_zsk, $log); + + $cmd_set_nsec3 = sprintf('%s set-nsec3 %s "1 0 10 deadbeef" 2>&1', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running set-nsec3 command...'); + exec($cmd_set_nsec3, $log); + + $pubkeys = []; + $cmd_show_zone = sprintf('%s show-zone %s 2>&1', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running show-zone command...'); + exec($cmd_show_zone, $pubkeys); + + $log = array_merge($log, $pubkeys); + + $dnssec_info = array_merge($this->format_dnssec_pubkeys($pubkeys), ['', '== Raw log ============================'], $log); + $dnssec_info = implode("\r\n", $dnssec_info); + + if ($app->dbmaster !== $app->db) { + $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id'])); + } + $app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id'])); + } + + function format_dnssec_pubkeys($lines) { + $formatted = []; + + // We don't care about the first two lines about presigning and NSEC + array_shift($lines); + array_shift($lines); + + foreach ($lines as $line) { + switch ($part = substr($line, 0, 3)) { + case 'ID ': + // Only process active keys + // 'Active: 1' is pdnssec (PowerDNS 3.x) output + // 'Active (' is pdnsutil (PowerDNS 4.x) output + if (!strpos($line, 'Active: 1') && !strpos($line, 'Active ( ')) { + break; + } + + // Determine key type (KSK, ZSK or CSK) + preg_match('/(KSK|ZSK|CSK)/', $line, $matches_key_type); + $key_type = $matches_key_type[1]; + + // We only care about the KSK or CSK + if (!in_array($key_type, ['KSK', 'CSK'], true)) { + break; + } + + // Determine key tag + preg_match('/ tag = (\d+),/', $line, $matches_key_tag); + $formatted[] = sprintf('%s key tag: %d', $key_type, $matches_key_tag[1]); + + // Determine algorithm + preg_match('/ algo = (\d+),/', $line, $matches_algo_id); + preg_match('/ \( (.*) \)$/', $line, $matches_algo_name); + $formatted[] = sprintf('Algo: %d (%s)', $matches_algo_id[1], $matches_algo_name[1]); + + // Determine bits + preg_match('/ bits = (\d+)/', $line, $matches_bits); + $formatted[] = sprintf('Bits: %d', $matches_bits[1]); + + break; + + case 'KSK': + case 'CSK': + // Determine DNSKEY + preg_match('/ IN DNSKEY \d+ \d+ \d+ (.*) ;/', $line, $matches_dnskey); + $formatted[] = sprintf('DNSKEY: %s', $matches_dnskey[1]); + + break; + + case 'DS ': + // Determine key tag + preg_match('/ IN DS (\d+) \d+ \d+ /', $line, $matches_ds_key_tag); + $formatted[] = sprintf(' - DS key tag: %d', $matches_ds_key_tag[1]); + + // Determine key tag + preg_match('/ IN DS \d+ (\d+) \d+ /', $line, $matches_ds_algo); + $formatted[] = sprintf(' Algo: %d', $matches_ds_algo[1]); + + // Determine digest + preg_match('/ IN DS \d+ \d+ (\d+) /', $line, $matches_ds_digest_id); + preg_match('/ \( (.*) \)$/', $line, $matches_ds_digest_name); + $formatted[] = sprintf(' Digest: %d (%s)', $matches_ds_digest_id[1], $matches_ds_digest_name[1]); + + // Determine public key + preg_match('/ IN DS \d+ \d+ \d+ (.*) ;/', $line, $matches_ds_key); + $formatted[] = sprintf(' Public key: %s', $matches_ds_key[1]); + break; + + default: + break; + } + } + + return $formatted; + } + + function soa_dnssec_disable($data) { + global $app; + + if (false === $this->is_pdns_version_supported()) { + return; + } + + $pdns_pdnssec = $this->find_pdns_pdnssec_or_pdnsutil(); + if ($pdns_pdnssec === false) { + return; + } + + $zone = rtrim($data['new']['origin'],'.'); + $log = array(); + + // We don't log the actual commands here, because having commands in the dnssec_info field will trigger + // the IDS if you try to save the record using the interface afterwards. + $cmd_disable_dnssec = sprintf('%s disable-dnssec %s 2>&1', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running disable-dnssec command...'); + exec($cmd_disable_dnssec, $log); + + if ($app->dbmaster !== $app->db) { + $app->dbmaster->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id'])); + } + $app->db->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id'])); + } + + function soa_dnssec_delete($data) { + global $app; + + if (false === $this->is_pdns_version_supported()) { + return; + } + + $pdns_pdnssec = $this->find_pdns_pdnssec_or_pdnsutil(); + if ($pdns_pdnssec === false) { + return; + } + + $zone = rtrim($data['old']['origin'],'.'); + $log = array(); + + // We don't log the actual commands here, because having commands in the dnssec_info field will trigger + // the IDS if you try to save the record using the interface afterwards. + $cmd_disable_dnssec = sprintf('%s disable-dnssec %s 2>&1', $pdns_pdnssec, $zone); + $log[] = sprintf("\r\n%s %s", date('c'), 'Running disable-dnssec command...'); + exec($cmd_disable_dnssec, $log); + + + $dnssec_info = array_merge(['== Raw log ============================'], $log); + $dnssec_info = implode("\r\n", $dnssec_info); + + if ($app->dbmaster !== $app->db) { + $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id'])); + } + $app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id'])); + } + function rectifyZone($data) { global $app, $conf; - if ( preg_match('/^3/',$this->get_pdns_version()) ) { - $pdns_pdnssec = $this->find_pdns_pdnssec(); - if ( $pdns_pdnssec != false ) { - if (isset($data["new"]["origin"])) { - //* data has origin field only for SOA recordtypes - exec($pdns_pdnssec . ' rectify-zone ' . rtrim($data["new"]["origin"],".")); - } else { - // get origin from DB for all other recordtypes - $zn = $app->db->queryOneRecord("SELECT d.name AS name FROM powerdns.domains d, powerdns.records r WHERE r.ispconfig_id=? AND r.domain_id = d.id", $data["new"]["id"]); - exec($pdns_pdnssec . ' rectify-zone ' . trim($zn["name"])); - } + + if (false === $this->is_pdns_version_supported()) { + return; + } + + $pdns_pdnssec = $this->find_pdns_pdnssec_or_pdnsutil(); + if ( $pdns_pdnssec != false ) { + if (isset($data["new"]["origin"])) { + //* data has origin field only for SOA recordtypes + exec($pdns_pdnssec . ' rectify-zone ' . rtrim($data["new"]["origin"],".")); + } else { + // get origin from DB for all other recordtypes + $zn = $app->db->queryOneRecord("SELECT d.name AS name FROM powerdns.domains d, powerdns.records r WHERE r.ispconfig_id=? AND r.domain_id = d.id", $data["new"]["id"]); + exec($pdns_pdnssec . ' rectify-zone ' . trim($zn["name"])); } } } diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..c9af1be00825249b4de017d609d3e228708d6610 --- /dev/null +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -0,0 +1,255 @@ +plugins->registerEvent('spamfilter_users_insert', $this->plugin_name, 'spamfilter_users_insert'); + $app->plugins->registerEvent('spamfilter_users_update', $this->plugin_name, 'spamfilter_users_update'); + $app->plugins->registerEvent('spamfilter_users_delete', $this->plugin_name, 'spamfilter_users_delete'); + + //* spamfilter_wblist + $app->plugins->registerEvent('spamfilter_wblist_insert', $this->plugin_name, 'spamfilter_wblist_insert'); + $app->plugins->registerEvent('spamfilter_wblist_update', $this->plugin_name, 'spamfilter_wblist_update'); + $app->plugins->registerEvent('spamfilter_wblist_delete', $this->plugin_name, 'spamfilter_wblist_delete'); + + //* server ip + $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip'); + } + + function spamfilter_users_insert($event_name, $data) { + global $app, $conf; + + $this->action = 'insert'; + // just run the spamfilter_users_update function + $this->spamfilter_users_update($event_name, $data); + } + + function spamfilter_users_update($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses('getconf,system,functions'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $policy = $app->db->queryOneRecord("SELECT * FROM spamfilter_policy WHERE id = ?", intval($data['new']['policy_id'])); + + //* Create the config file + $user_file = $this->users_config_dir.'spamfilter_user_'.intval($data['new']['id']).'.conf'; + + if($data['new']['local'] == 'Y' && is_array($policy) && !empty($policy)){ + if(!is_dir($this->users_config_dir)){ + $app->system->mkdirpath($this->users_config_dir); + } + + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.inc.conf.master'); + $tpl->setVar('record_id', intval($data['new']['id'])); + $tpl->setVar('priority', intval($data['new']['priority'])); + $tpl->setVar('recipient', $app->functions->idn_encode($data['new']['email'])); + + $tpl->setVar('rspamd_greylisting', $policy['rspamd_greylisting']); + $tpl->setVar('rspamd_spam_greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); + + $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); + $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); + + $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); + $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); + + $spam_lover_virus_lover = ''; + if($policy['spam_lover'] == 'Y' && $policy['virus_lover'] == 'Y') $spam_lover_virus_lover = 'spam_lover_AND_virus_lover'; + if($policy['spam_lover'] == 'Y' && $policy['virus_lover'] != 'Y') $spam_lover_virus_lover = 'spam_lover_AND_NOTvirus_lover'; + if($policy['spam_lover'] != 'Y' && $policy['virus_lover'] == 'Y') $spam_lover_virus_lover = 'NOTspam_lover_AND_virus_lover'; + if($policy['spam_lover'] != 'Y' && $policy['virus_lover'] != 'Y') $spam_lover_virus_lover = 'NOTspam_lover_AND_NOTvirus_lover'; + + $tpl->setVar('spam_lover_virus_lover', $spam_lover_virus_lover); + + //$groups_disabled = array(); + //if($policy['virus_lover'] == 'Y') $groups_disabled[] = ''; + + $app->system->file_put_contents($user_file, $tpl->grab()); + } else { + if(is_file($user_file)) { + unlink($user_file); + } + } + + if($mail_config['content_filter'] == 'rspamd'){ + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function spamfilter_users_delete($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + //* delete the config file + $user_file = $this->users_config_dir.'spamfilter_user_'.intval($data['old']['id']).'.conf'; + if(is_file($user_file)) unlink($user_file); + + } + + if($mail_config['content_filter'] == 'rspamd') { + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + + function spamfilter_wblist_insert($event_name, $data) { + global $app, $conf; + + $this->action = 'insert'; + // just run the spamfilter_wblist_update function + $this->spamfilter_wblist_update($event_name, $data); + } + + function spamfilter_wblist_update($event_name, $data) { + global $app, $conf; + + $app->uses('getconf,system,functions'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $recipient = $app->db->queryOneRecord("SELECT email FROM spamfilter_users WHERE id = ?", intval($data['new']['rid'])); + //* Create the config file + $wblist_file = $this->users_config_dir.'spamfilter_wblist_'.intval($data['new']['wblist_id']).'.conf'; + + if($data['new']['active'] == 'y' && is_array($recipient) && !empty($recipient)){ + if(!is_dir($this->users_config_dir)){ + $app->system->mkdirpath($this->users_config_dir); + } + + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_wblist.inc.conf.master'); + $tpl->setVar('record_id', intval($data['new']['wblist_id'])); + $tpl->setVar('priority', intval($data['new']['priority'])); + $tpl->setVar('from', $app->functions->idn_encode($data['new']['email'])); + $tpl->setVar('recipient', $app->functions->idn_encode($recipient['email'])); + //$tpl->setVar('action', ($data['new']['wb'] == 'W'? 'want_spam = yes;' : 'action = "reject";')); + $tpl->setVar('wblist', $data['new']['wb']); + + $app->system->file_put_contents($wblist_file, $tpl->grab()); + } else { + if(is_file($wblist_file)) unlink($wblist_file); + } + + if($mail_config['content_filter'] == 'rspamd'){ + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function spamfilter_wblist_delete($event_name, $data) { + global $app, $conf; + + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + //* delete the config file + $wblist_file = $this->users_config_dir.'spamfilter_wblist_'.intval($data['old']['wblist_id']).'.conf'; + if(is_file($wblist_file)) unlink($wblist_file); + + if($mail_config['content_filter'] == 'rspamd'){ + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function server_ip($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses("getconf,system"); + $app->load('tpl'); + + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.conf.master'); + + $whitelist_ips = array(); + $ips = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ?", $conf['server_id']); + if(is_array($ips) && !empty($ips)){ + foreach($ips as $ip){ + $whitelist_ips[] = array('ip' => $ip['ip_address']); + } + } + $tpl->setLoop('whitelist_ips', $whitelist_ips); + $app->system->file_put_contents('/etc/rspamd/local.d/users.conf', $tpl->grab()); + + if($mail_config['content_filter'] == 'rspamd'){ + $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + +} // end class +?> \ No newline at end of file diff --git a/server/plugins-available/server_services_plugin.inc.php b/server/plugins-available/server_services_plugin.inc.php index 29710a72852376cf3bb0d4b34676f506787447ae..31afe58fe668d71cafa9b358bf06bb6555344f69 100644 --- a/server/plugins-available/server_services_plugin.inc.php +++ b/server/plugins-available/server_services_plugin.inc.php @@ -36,10 +36,9 @@ class server_services_plugin { var $plugin_name = 'server_services_plugin'; var $class_name = 'server_services_plugin'; - var $services = array('mail_server', 'web_server', 'dns_server', 'db_server', 'vserver_server', 'xmpp_server'); + var $services = array('mail_server', 'web_server', 'dns_server', 'db_server'); - var $mail_plugins = array('getmail_plugin', 'mail_plugin', 'mail_plugin_dkim', 'mailman_plugin', 'postfix_filter_plugin', 'postfix_server_plugin'); - var $courier_plugins = array('maildrop_plugin'); + var $mail_plugins = array('getmail_plugin', 'mail_plugin', 'mail_plugin_dkim', 'postfix_filter_plugin', 'postfix_server_plugin'); var $dovecot_plugins = array('maildeliver_plugin'); var $web_plugins = array('aps_plugin', 'cron_plugin', 'cron_jailkit_plugin', 'ftpuser_base_plugin', 'shelluser_base_plugin', 'shelluser_jailkit_plugin', 'webserver_plugin'); @@ -51,10 +50,8 @@ class server_services_plugin { var $db_plugins = array('mysql_clientdb_plugin'); - var $openvz_plugins = array('openvz_plugin'); - - var $xmpp_plugins = array('xmpp_plugin'); - + /** TODO: implement plugins from addons **/ + function onInstall() { return true; @@ -97,7 +94,7 @@ class server_services_plugin { switch($service) { case 'mail_server': $config = $app->getconf->get_server_config($conf['server_id'], 'mail'); - $plugins = @($config['pop3_imap_daemon'] == 'dovecot')?$this->dovecot_plugins:$this->courier_plugins; + $plugins = $this->dovecot_plugins; $plugins = array_merge($plugins, $this->mail_plugins); $this->change_state($plugins, $value, $config); break; @@ -115,12 +112,6 @@ class server_services_plugin { case 'db_server': $this->change_state($this->db_plugins, $value, $config); break; - case 'vserver_server': - $this->change_state($this->openvz_plugins, $value, $config); - break; - case 'xmpp_server': - $this->change_state($this->xmpp_plugins, $value, $config); - break; } } diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 9a29a10a6fcc7da9c6cedaee82af41cc60070369..147d39d571947ae7026ca263623a70a74d89b836 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -131,10 +131,11 @@ class shelluser_jailkit_plugin { $this->_update_website_security_level(); $app->system->web_folder_protection($web['document_root'], true); + $app->log("Jailkit Plugin -> insert username:".$data['new']['username'], LOGLEVEL_DEBUG); + } else { + $app->log("Jailkit Plugin -> insert username:".$data['new']['username']. "skipped, Jailkit not selected", LOGLEVEL_DEBUG); } - $app->log("Jailkit Plugin -> insert username:".$data['new']['username'], LOGLEVEL_DEBUG); - } else { $app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.", LOGLEVEL_WARN); } diff --git a/server/plugins-available/webmail_symlink_plugin.inc.php b/server/plugins-available/webmail_symlink_plugin.inc.php index c64b706d7e4361d42919246c8e8804426ea2def9..9edce913dfd6081f1c7ed0e01050452f05c61c42 100644 --- a/server/plugins-available/webmail_symlink_plugin.inc.php +++ b/server/plugins-available/webmail_symlink_plugin.inc.php @@ -101,9 +101,7 @@ class webmail_symlink_plugin { } $symlink = true; - if($data["new"]["php"] == "suphp") $symlink = false; - elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false; - elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; + if($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false; if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true); diff --git a/server/plugins-available/website_symlink_plugin.inc.php b/server/plugins-available/website_symlink_plugin.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..a17732c5e4abcceb1ecdc96f73f98387d0e21c63 --- /dev/null +++ b/server/plugins-available/website_symlink_plugin.inc.php @@ -0,0 +1,80 @@ + ../../web + */ +class website_symlink_plugin { + + var $plugin_name = 'website_symlink_plugin'; + var $class_name = 'website_symlink_plugin'; + + public function onInstall() { + global $conf; + + // Enable the following code section to activate the plugin automatically at install time + /* + if ($conf['services']['web'] == true) { + return true; + } + */ + + return false; + } + + public function onLoad() { + global $app; + + $app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'createSymlinkForWebDomain'); + $app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'createSymlinkForWebDomain'); + + $app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'createSymlinkForShellUser'); + $app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'createSymlinkForShellUser'); + } + + public function createSymlinkForWebDomain($event_name, $data) { + $homeDirectories = glob(sprintf('%s/home', $data['new']['document_root']) . '/*', GLOB_ONLYDIR); + + foreach ($homeDirectories as $dir) { + $target = sprintf('%s/web', $data['new']['document_root']); + $link = sprintf('%s/website', $dir); + + $this->createSymlink($target, $link); + } + } + + public function createSymlinkForShellUser($event_name, $data) { + $target = sprintf('%s/web', $data['new']['dir']); + $link = sprintf('%s/home/%s/website', $data['new']['dir'], $data['new']['username']); + + $this->createSymlink($target, $link); + } + + private function createSymlink($target, $link) { + global $app; + + if (file_exists($link)) { + $app->log(sprintf('Not creating symlink because "%s" already exists', $link), LOGLEVEL_DEBUG); + + return; + } + + if ($app->system->create_relative_link($target, $link)) { + $app->log(sprintf('Created symlink from "%s" to "%s"', $link, $target), LOGLEVEL_DEBUG); + } else { + $app->log(sprintf('Failed to create symlink from "%s" to "%s"', $link, $target), LOGLEVEL_WARN); + } + } +} \ No newline at end of file diff --git a/server/plugins-available/xmpp_plugin.inc.php b/server/plugins-available/xmpp_plugin.inc.php deleted file mode 100644 index 7803e632366088ff997df52038db62b88ee7c72d..0000000000000000000000000000000000000000 --- a/server/plugins-available/xmpp_plugin.inc.php +++ /dev/null @@ -1,464 +0,0 @@ -uses("getconf"); - /* - Register for the events - */ - - $app->plugins->registerEvent('server_insert', 'xmpp_plugin', 'insert'); - $app->plugins->registerEvent('server_update', 'xmpp_plugin', 'update'); - - $app->plugins->registerEvent('xmpp_domain_insert', 'xmpp_plugin', 'ssl'); - $app->plugins->registerEvent('xmpp_domain_update', 'xmpp_plugin', 'ssl'); - $app->plugins->registerEvent('xmpp_domain_delete', 'xmpp_plugin', 'ssl'); - - $app->plugins->registerEvent('xmpp_domain_insert', 'xmpp_plugin', 'domainInsert'); - $app->plugins->registerEvent('xmpp_domain_update', 'xmpp_plugin', 'domainUpdate'); - $app->plugins->registerEvent('xmpp_domain_delete', 'xmpp_plugin', 'domainDelete'); - $app->plugins->registerEvent('xmpp_user_insert', 'xmpp_plugin', 'userInsert'); - $app->plugins->registerEvent('xmpp_user_update', 'xmpp_plugin', 'userUpdate'); - $app->plugins->registerEvent('xmpp_user_delete', 'xmpp_plugin', 'userDelete'); - - // set some params - $xmpp_config = $app->getconf->get_server_config($conf['server_id'], 'xmpp'); - $daemon = $xmpp_config['xmpp_daemon']; - $this->daemon = $daemon; - $this->xmpp_config_dir = "/etc/${daemon}"; - } - - function insert($event_name, $data) { - global $app, $conf; - - $this->update($event_name, $data); - - } - - // The purpose of this plugin is to rewrite the main.cf file - function update($event_name, $data) { - global $app, $conf; - - // get the config - $app->uses("getconf,system,tpl"); - - $old_ini_data = $app->ini_parser->parse_ini_string($data['old']['config']); - $xmpp_config = $app->getconf->get_server_config($conf['server_id'], 'xmpp'); - - // Global server config - $tpl = new tpl(); - $tpl->newTemplate("xmpp_{$this->daemon}_conf_global.master"); - $tpl->setVar('ipv6', $xmpp_config['xmpp_use_ipv6']=='y'?'true':'false'); - $tpl->setVar('bosh_timeout', intval($xmpp_config['xmpp_bosh_max_inactivity'])); - $tpl->setVar('port_http', intval($xmpp_config['xmpp_port_http'])); - $tpl->setVar('port_https', intval($xmpp_config['xmpp_port_https'])); - $tpl->setVar('port_pastebin', intval($xmpp_config['xmpp_port_pastebin'])); - $tpl->setVar('port_bosh', intval($xmpp_config['xmpp_port_bosh'])); - // Global server admins (for all hosted domains) - $admins = ''; - foreach(explode(',', $xmpp_config['xmpp_server_admins']) AS $a) - $admins.= "\t\"".trim($a)."\",\n"; - $tpl->setVar('server_admins', $admins); - unset($admins); - // enabled modules, so own modules or simmilar prosody-modules can easily be added - $modules = ''; - foreach(explode(',', $xmpp_config['xmpp_modules_enabled']) AS $m) - $modules.= "\t\"".trim($m)."\",\n"; - $tpl->setVar('modules_enabled', $modules); - unset($modules); - $app->system->file_put_contents($this->xmpp_config_dir.'/global.cfg.lua', $tpl->grab()); - unset($tpl); - - $app->services->restartServiceDelayed('xmpp', 'restart'); - return; - } - - function domainInsert($event_name, $data) { - global $app, $conf; - - $this->domainUpdate($event_name, $data); - // Need to restart the server - $app->services->restartServiceDelayed('xmpp', 'restart'); - - } - - function domainUpdate($event_name, $data){ - global $app, $conf; - - // get the config - $app->uses("getconf,system,tpl"); - - // Collections - $status_hosts = array($data['new']['domain']); - $status_comps = array(); - - // Create main host file - $tpl = new tpl(); - $tpl->newTemplate("xmpp_{$this->daemon}_conf_host.master"); - $tpl->setVar('main_host', $conf['serverconfig']['server']['hostname']); - $tpl->setVar('domain', $data['new']['domain']); - $tpl->setVar('active', $data['new']['active'] == 'y' ? 'true' : 'false'); - $tpl->setVar('public_registration', $data['new']['public_registration'] == 'y' ? 'true' : 'false'); - $tpl->setVar('registration_url', $data['new']['registration_url']); - $tpl->setVar('registration_message', $data['new']['registration_message']); - - // Domain admins - $admins = array(); - foreach(explode(',',$data['new']['domain_admins']) AS $adm){ - $admins[] = trim($adm); - } - $tpl->setVar('domain_admins', "\t\t\"".implode("\",\n\t\t\"",$admins)."\"\n"); - - // Enable / Disable features - $tpl->setVar('use_status_host', $data['new']['use_status_host'] == 'y' ? 'true' : 'false'); - $tpl->setVar('use_webpresence', $data['new']['use_webpresence'] == 'y' ? 'true' : 'false'); - if($data['new']['use_pubsub']=='y'){ - $tpl->setVar('use_pubsub', 'true'); - $status_comps[] = 'pubsub.'.$data['new']['domain']; - }else{ - $tpl->setVar('use_pubsub', 'false'); - } - if($data['new']['use_proxy']=='y'){ - $tpl->setVar('use_proxy', 'true'); - $status_comps[] = 'proxy.'.$data['new']['domain']; - }else{ - $tpl->setVar('use_proxy', 'false'); - } - - if($data['new']['use_anon_host']=='y'){ - $tpl->setVar('use_anon_host', 'true'); - $status_hosts[] = 'anon.'.$data['new']['domain']; - }else{ - $tpl->setVar('use_anon_host', 'false'); - } - if($data['new']['use_vjud']=='y'){ - $tpl->setVar('use_vjud', 'true'); - $tpl->setVar('vjud_opt_mode', 'opt-'.$data['new']['vjud_opt_mode']); - $status_comps[] = 'vjud.'.$data['new']['domain']; - }else{ - $tpl->setVar('use_vjud', 'false'); - } - if($data['new']['use_muc_host']=='y'){ - $tpl->setVar('use_http_upload', 'true'); - $status_comps[] = 'upload.'.$data['new']['domain']; - }else{ - $tpl->setVar('use_http_upload', 'false'); - } - - $tpl->setVar('use_muc', $data['new']['use_muc_host']=='y'?'true':'false'); - if($data['new']['use_muc_host'] == 'y'){ - $status_comps[] = 'muc.'.$data['new']['domain']; - switch($data['new']['muc_restrict_room_creation']) { - case 'n': - $tpl->setVar('muc_restrict_room_creation', 'false'); - break; - case 'y': - $tpl->setVar('muc_restrict_room_creation', 'admin'); - break; - case 'm': - $tpl->setVar('muc_restrict_room_creation', 'local'); - break; - } - $tpl->setVar('muc_name', strlen($data['new']['muc_name']) ? $data['new']['muc_name'] : $data['new']['domain'].' Chatrooms'); - // Admins for MUC channels - $admins = array(); - foreach(explode(',',$data['new']['muc_admins']) AS $adm){ - $admins[] = trim($adm); - } - $tpl->setVar('muc_admins', "\t\t\"".implode("\",\n\t\t\"",$admins)."\"\n"); - $tpl->setVar('use_pastebin', $data['new']['use_pastebin']=='y'?'true':'false'); - $tpl->setVar('pastebin_expire', intval($data['new']['pastebin_expire_after'])); - $tpl->setVar('pastebin_trigger', $data['new']['pastebin_trigger']); - $tpl->setVar('use_archive', $data['new']['use_http_archive']=='y'?'true':'false'); - $tpl->setVar('archive_join', $data['new']['http_archive_show_join']=='y'?'true':'false'); - $tpl->setVar('archive_status', $data['new']['http_archive_show_status']=='y'?'true':'false'); - - } - - // Check for SSL - if(strlen($data['new']['ssl_cert']) && strlen($data['new']['ssl_key']) && !$this->ssl_certificate_deleted || $this->ssl_certificate_changed) - $tpl->setVar('ssl_cert', true); - - $app->system->file_put_contents($this->xmpp_config_dir.'/hosts/'.$data['new']['domain'].'.cfg.lua', $tpl->grab()); - unset($tpl); - - // Create http host file - //$tpl = new tpl; - //$tpl->newTemplate("xmpp_{$this->daemon}_conf_status.master"); - //$tpl->setVar('domain', $data['new']['domain']); - //$httpMods = 0; - //$tpl->setVar('use_webpresence', $data['new']['use_webpresence'] == 'y' ? 'true' : 'false'); - //if($data['new']['use_webpresence']=='y') { - // $httpMods++; - //} - //$tpl->setVar('use_status_host', $data['new']['use_status_host'] == 'y' ? 'true' : 'false'); - //if($data['new']['use_status_host']=='y'){ - // $httpMods++; - // $tpl->setVar('status_hosts', "\t\t\"".implode("\",\n\t\t\"",$status_hosts)."\"\n"); - // $tpl->setVar('status_comps', "\t\t\"".implode("\",\n\t\t\"",$status_comps)."\"\n"); - //} - //if($httpMods > 0){ - // $app->system->file_put_contents($this->xmpp_config_dir.'/status/'.$data['new']['domain'].'.cfg.lua', $tpl->grab()); - //} else { - // unlink($this->xmpp_config_dir.'/status/'.$data['new']['domain'].'.cfg.lua'); - //} - //unset($tpl); - - $app->services->restartServiceDelayed('xmpp', 'reload'); - } - - function domainDelete($event_name, $data){ - global $app, $conf; - - // get the config - $app->uses("system"); - $domain = $data['old']['domain']; - - // Remove config files - $app->system->unlink("/etc/{$this->daemon}/hosts/$domain.cfg.lua"); - $app->system->unlink("/etc/{$this->daemon}/status/$domain.cfg.lua"); - if($this->daemon === 'prosody') - $app->system->unlink("/etc/{$this->daemon}/certs/$domain.crt"); - else - $app->system->unlink("/etc/{$this->daemon}/certs/$domain.cert"); - $app->system->unlink("/etc/{$this->daemon}/certs/$domain.key"); - $app->system->unlink("/etc/{$this->daemon}/certs/$domain.csr"); - // Remove all stored data - $folder = str_replace('-', '%2d', str_replace('.', '%2e', $str = urlencode($domain))); - - exec("rm -rf /var/lib/{$this->daemon}/{$folder}"); - exec("rm -rf /var/lib/{$this->daemon}/*%2e{$folder}"); - switch($this->daemon) { - case 'metronome': - break; - case 'prosody': - exec("php /usr/local/lib/prosody/auth/prosody-purge domain {$domain}"); - break; - } - - $app->services->restartServiceDelayed('xmpp', 'restart'); - } - - function userInsert($event_name, $data){ - //$data['new']['auth_method'] - // Check domain for auth settings - // Don't allow manual user creation for mailaccount controlled domains - - // maybe metronomectl adduser for new local users - } - function userUpdate($event_name, $data){ - // Check domain for auth settings - // Don't allow manual user update for mailaccount controlled domains - - // maybe metronomectl passwd for existing local users - } - function userDelete($event_name, $data){ - // Check domain for auth settings - // Don't allow manual user deletion for mailaccount controlled domains - - $jid_parts = explode('@', $data['old']['jid']); - - switch($this->daemon) { - case 'metronome': - // Remove account from metronome - exec("{$this->daemon}ctl deluser {$data['old']['jid']}"); - break; - case 'prosody': - exec("php /usr/local/lib/prosody/auth/prosody-purge user {$jid_parts[1]} {$jid_parts[0]}"); - break; - } - } - - // Handle the creation of SSL certificates - function ssl($event_name, $data) { - global $app, $conf; - - $app->uses('system,tpl'); - - // load the server configuration options - $app->uses('getconf'); - - $ssl_dir = "/etc/{$this->daemon}/certs"; - $domain = $data['new']['domain']; - $cnf_file = $ssl_dir.'/'.$domain.'.cnf'; - $key_file = $ssl_dir.'/'.$domain.'.key'; - $csr_file = $ssl_dir.'/'.$domain.'.csr'; - if ($this->daemon === 'prosody') { - $crt_file = $ssl_dir.'/'.$domain.'.crt'; - } else { - $crt_file = $ssl_dir.'/'.$domain.'.cert'; - } - - - //* Create a SSL Certificate, but only if this is not a mirror server. - if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) { - - $this->ssl_certificate_changed = true; - - //* Rename files if they exist - if(file_exists($cnf_file)) $app->system->rename($cnf_file, $cnf_file.'.bak'); - if(file_exists($key_file)){ - $app->system->rename($key_file, $key_file.'.bak'); - $app->system->chmod($key_file.'.bak', 0400); - $app->system->chown($key_file.'.bak', $this->daemon); - } - if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak'); - if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak'); - - // Write new CNF file - $tpl = new tpl(); - $tpl->newTemplate('xmpp_conf_ssl.master'); - $tpl->setVar('domain', $domain); - $tpl->setVar('ssl_country', $data['new']['ssl_country']); - $tpl->setVar('ssl_locality', $data['new']['ssl_locality']); - $tpl->setVar('ssl_organisation', $data['new']['ssl_organisation']); - $tpl->setVar('ssl_organisation_unit', $data['new']['ssl_organisation_unit']); - $tpl->setVar('ssl_email', $data['new']['ssl_email']); - $app->system->file_put_contents($cnf_file, $tpl->grab()); - - // Generate new key, csr and cert - exec("(cd /etc/{$this->daemon}/certs && make $domain.key)"); - exec("(cd /etc/{$this->daemon}/certs && make $domain.csr)"); - if ($this->daemon === 'prosody') { - exec("(cd /etc/{$this->daemon}/certs && make $domain.crt)"); - } else { - exec("(cd /etc/{$this->daemon}/certs && make $domain.cert)"); - } - - $ssl_key = $app->system->file_get_contents($key_file); - $app->system->chmod($key_file, 0400); - $app->system->chown($key_file, $this->daemon); - $ssl_request = $app->system->file_get_contents($csr_file); - $ssl_cert = $app->system->file_get_contents($crt_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE xmpp_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->db->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_request = ?, ssl_cert = ?, ssl_key = ? WHERE domain = ?", $ssl_request, $ssl_cert, $ssl_key, $data['new']['domain']); - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - $app->log('Creating XMPP SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - //* Save a SSL certificate to disk - if($data["new"]["ssl_action"] == 'save') { - $this->ssl_certificate_changed = true; - - //* Rename files if they exist - if(file_exists($cnf_file)) $app->system->rename($cnf_file, $cnf_file.'.bak'); - if(file_exists($key_file)){ - $app->system->rename($key_file, $key_file.'.bak'); - $app->system->chmod($key_file.'.bak', 0400); - $app->system->chown($key_file.'.bak', $this->daemon); - } - if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak'); - if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak'); - - //* Write new ssl files - if(trim($data["new"]["ssl_request"]) != '') - $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]); - if(trim($data["new"]["ssl_cert"]) != '') - $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); - - //* Write the key file, if field is empty then import the key into the db - if(trim($data["new"]["ssl_key"]) != '') { - $app->system->file_put_contents($key_file, $data["new"]["ssl_key"]); - $app->system->chmod($key_file, 0400); - $app->system->chown($key_file, $this->daemon); - } else { - $ssl_key = $app->system->file_get_contents($key_file); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE xmpp_domain SET ssl_key = ? WHERE domain = ?", $ssl_key, $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_key = '$ssl_key' WHERE domain = ?", $data['new']['domain']); - } - - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - $app->log('Saving XMPP SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - //* Delete a SSL certificate - if($data['new']['ssl_action'] == 'del') { - $this->ssl_certificate_deleted = true; - $app->system->unlink($csr_file); - $app->system->unlink($crt_file); - $app->system->unlink($key_file); - $app->system->unlink($cnf_file); - $app->system->unlink($csr_file.'.bak'); - $app->system->unlink($crt_file.'.bak'); - $app->system->unlink($key_file.'.bak'); - $app->system->unlink($cnf_file.'.bak'); - /* Update the DB of the (local) Server */ - $app->db->query("UPDATE xmpp_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->db->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - /* Update also the master-DB of the Server-Farm */ - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_request = '', ssl_cert = '', ssl_key = '' WHERE domain = ?", $data['new']['domain']); - $app->dbmaster->query("UPDATE xmpp_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); - $app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG); - } - - } - -} // end class - -?> diff --git a/server/scripts/create_daily_nginx_access_logs.sh b/server/scripts/create_daily_nginx_access_logs.sh index ce4945f85fe231a3c1aeae24428d87385b03db62..8b4d4db6bea9152c0563ff2fceeddc299a1db861 100644 --- a/server/scripts/create_daily_nginx_access_logs.sh +++ b/server/scripts/create_daily_nginx_access_logs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin FILES=/var/log/ispconfig/httpd/* for f in $FILES diff --git a/server/scripts/create_jailkit_chroot.sh b/server/scripts/create_jailkit_chroot.sh index 9ddfb3834809fdf14824c25d381c1f8d0b17aae4..57a749c9b65d15403c1e41e3fca588b0426ae7f2 100755 --- a/server/scripts/create_jailkit_chroot.sh +++ b/server/scripts/create_jailkit_chroot.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Create the jailkit chroot diff --git a/server/scripts/create_jailkit_programs.sh b/server/scripts/create_jailkit_programs.sh index 11641f2c1ff506db996cb3063b2cefb41f985ff7..06c2fde84013bf2a91565a6d76ddee9f985984fe 100755 --- a/server/scripts/create_jailkit_programs.sh +++ b/server/scripts/create_jailkit_programs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Add specified programs and their libraries to the jailkit chroot diff --git a/server/scripts/create_jailkit_user.sh b/server/scripts/create_jailkit_user.sh index 5e1060be2503bc713842d3ef83910e675cf8d2d7..2ecd24b9fc862d6cd336e4bcc191115b4c4bc6f1 100755 --- a/server/scripts/create_jailkit_user.sh +++ b/server/scripts/create_jailkit_user.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Add user to the jailkit chroot diff --git a/server/scripts/ispconfig_update.sh b/server/scripts/ispconfig_update.sh index fc3450663449adec1cf5ed05922104e93de8e465..be7af8b5fb27ef6fce97ece379a44745a157adb2 100644 --- a/server/scripts/ispconfig_update.sh +++ b/server/scripts/ispconfig_update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _UPD=1 diff --git a/server/scripts/run-getmail.sh b/server/scripts/run-getmail.sh index 3eac5ec194033c69b9029d0df144c616b837ae08..e78fc5823f4ceddbee6c6a146a6275834d2104d9 100644 --- a/server/scripts/run-getmail.sh +++ b/server/scripts/run-getmail.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin set -e cd /etc/getmail diff --git a/server/scripts/update_from_dev.sh b/server/scripts/update_from_dev.sh index 0be65986d68b56fcf97e536447be8676f2ab7c24..8413f0c59cc27c24f8b8e62f7607900344e1adf7 100755 --- a/server/scripts/update_from_dev.sh +++ b/server/scripts/update_from_dev.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash { umask 0077 \ diff --git a/server/scripts/update_from_dev_stable.sh b/server/scripts/update_from_dev_stable.sh index a5dc10605b1ce72f36cb5116067d077702d0f62f..2a99494bea12617d0e818c7f76851f9c818d500e 100644 --- a/server/scripts/update_from_dev_stable.sh +++ b/server/scripts/update_from_dev_stable.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash { umask 0077 \ diff --git a/server/scripts/update_from_svn.sh b/server/scripts/update_from_svn.sh index 8c8ee2ae18deee4dd818476d7b9e8ee63fc59305..128182639e611abbd6098e99bd5512bff97bfd83 100644 --- a/server/scripts/update_from_svn.sh +++ b/server/scripts/update_from_svn.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CUR=`dirname $0` bash ${CUR}/update_from_dev.sh diff --git a/server/scripts/update_stable.sh b/server/scripts/update_stable.sh index 854731077e764ff10a4c14e83d75793edc032847..fbe8480ca226afdbb182a8e39fb9e211479f11ce 100644 --- a/server/scripts/update_stable.sh +++ b/server/scripts/update_stable.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _UPD=1 diff --git a/server/scripts/vlogger b/server/scripts/vlogger index 8703df0d77a58f667574e8f7deb4ea1e6253f6ba..4e60254d0eea218602e2d8b80909137c0c957bdb 100755 --- a/server/scripts/vlogger +++ b/server/scripts/vlogger @@ -510,11 +510,9 @@ else { $log_line =~ s/^\S*\s+//o; } - if ($reqsize ne "-") { - if ( $reqsize =~ m/\d|/ && $reqsize > 0 ) { - $tracker{$vhost} += $reqsize; - } - } + if ( $reqsize =~ m/^\d+$/ && $reqsize > 0 ) { + $tracker{$vhost} += $reqsize; + } print $vhost $log_line; diff --git a/server/server.php b/server/server.php index 689cb174901017229d480e1f3dc920375303507a..106d3edc654f4dd9974b76fca0f183d1dd2d56cd 100644 --- a/server/server.php +++ b/server/server.php @@ -61,7 +61,7 @@ $conf['server_id'] = intval($conf['server_id']); /* * Try to Load the server configuration from the master-db */ -if ($app->dbmaster->connect_error == NULL) { +if ($app->dbmaster->testConnection()) { $server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = ?", $conf['server_id']); if(!is_array($server_db_record)) die('Unable to load the server configuration from database.'); @@ -152,7 +152,7 @@ $needStartCore = true; /* * Next we try to process the datalog */ -if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) { +if ($app->db->testConnection() && $app->dbmaster->testConnection()) { // Check if there is anything to update if ($conf['mirror_server_id'] > 0) { @@ -187,7 +187,7 @@ if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) { $needStartCore = false; } else { - if ($app->db->connect->connect_error == NULL) { + if (!$app->db->connect->testConnection()) { $app->log('Unable to connect to local server.' . $app->db->errorMessage, LOGLEVEL_WARN); } else { $app->log('Unable to connect to master server.' . $app->dbmaster->errorMessage, LOGLEVEL_WARN); diff --git a/server/server.sh b/server/server.sh index 9c92a868b0532d07eb224e50da7cc07fc538b620..ebd1d56c6085cfe8326e6b1b705e8e102e7c440c 100755 --- a/server/server.sh +++ b/server/server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin