Skip to content
Commits on Source (15)
......@@ -123,4 +123,4 @@ $web_config = $app->getconf->get_server_config($server_id,'web');
# Learn about the form validators
There are form validators in interface/lib/classes/tform.inc.php to make validating forms easier.
Read about: REGEX,UNIQUE,NOTEMPTY,ISEMAIL,ISINT,ISPOSITIVE,ISIPV4,CUSTOM
Read about: REGEX,UNIQUE,NOTEMPTY,ISEMAIL,ISINT,ISPOSITIVE,ISIPV4,ISIPV6,ISIP,CUSTOM
......@@ -55,6 +55,7 @@ tab_change_warning=n
use_loadindicator=y
use_combobox=y
maintenance_mode=n
maintenance_mode_exclude_ips=
admin_dashlets_left=
admin_dashlets_right=
reseller_dashlets_left=
......
......@@ -333,6 +333,22 @@ class app {
$this->tpl->setVar('globalsearch_noresults_limit_txt', $this->lng('globalsearch_noresults_limit_txt'));
$this->tpl->setVar('globalsearch_searchfield_watermark_txt', $this->lng('globalsearch_searchfield_watermark_txt'));
}
public function is_under_maintenance() {
$system_config_misc = $this->getconf->get_global_config('misc');
$maintenance_mode = 'n';
$maintenance_mode_exclude_ips = [];
if (!empty($system_config_misc['maintenance_mode'])) {
$maintenance_mode = $system_config_misc['maintenance_mode'];
}
if (!empty($system_config_misc['maintenance_mode_exclude_ips'])) {
$maintenance_mode_exclude_ips = array_map('trim', explode(',', $system_config_misc['maintenance_mode_exclude_ips']));
}
return 'y' === $maintenance_mode && !in_array($_SERVER['REMOTE_ADDR'], $maintenance_mode_exclude_ips);
}
private function get_cookie_domain() {
$sec_config = $this->getconf->get_security_config('permissions');
......
......@@ -30,45 +30,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class ISPConfigJSONHandler {
private $methods = array();
private $classes = array();
public function __construct() {
global $app;
// load main remoting file
$app->load('remoting');
// load all remote classes and get their methods
$dir = dirname(realpath(__FILE__)) . '/remote.d';
$d = opendir($dir);
while($f = readdir($d)) {
if($f == '.' || $f == '..') continue;
if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
$name = substr($f, 0, strpos($f, '.'));
include $dir . '/' . $f;
$class_name = 'remoting_' . $name;
if(class_exists($class_name, false)) {
$this->classes[$class_name] = new $class_name();
foreach(get_class_methods($this->classes[$class_name]) as $method) {
$this->methods[$method] = $class_name;
}
}
}
closedir($d);
// add main methods
$this->methods['login'] = 'remoting';
$this->methods['logout'] = 'remoting';
$this->methods['get_function_list'] = 'remoting';
// create main class
$this->classes['remoting'] = new remoting(array_keys($this->methods));
}
class ISPConfigJSONHandler extends ISPConfigRemotingHandlerBase {
private function _return_json($code, $message, $data = false) {
$ret = new stdClass;
$ret->code = $code;
......
......@@ -72,9 +72,7 @@ class remoting {
global $app, $conf;
// Maintenance mode
$app->uses('ini_parser,getconf');
$server_config_array = $app->getconf->get_global_config('misc');
if($server_config_array['maintenance_mode'] == 'y'){
if($app->is_under_maintenance()){
throw new SoapFault('maintenance_mode', 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.');
return false;
}
......
<?php
/*
Copyright (c) 2020, ISPConfig
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.
*/
class ISPConfigRemotingHandlerBase
{
protected $methods = array();
protected $classes = array();
public function __construct()
{
global $app;
// load main remoting file
$app->load('remoting');
// load all remoting classes and get their methods
$this->load_remoting_classes(realpath(__DIR__) . '/remote.d/*.inc.php');
// load all remoting classes from modules
$this->load_remoting_classes(realpath(__DIR__) . '/../../web/*/lib/classes/remote.d/*.inc.php');
// add main methods
$this->methods['login'] = 'remoting';
$this->methods['logout'] = 'remoting';
$this->methods['get_function_list'] = 'remoting';
// create main class
$this->classes['remoting'] = new remoting(array_keys($this->methods));
}
private function load_remoting_classes($glob_pattern)
{
$files = glob($glob_pattern);
foreach ($files as $file) {
$name = str_replace('.inc.php', '', basename($file));
$class_name = 'remoting_' . $name;
include_once $file;
if(class_exists($class_name, false)) {
$this->classes[$class_name] = new $class_name();
foreach(get_class_methods($this->classes[$class_name]) as $method) {
$this->methods[$method] = $class_name;
}
}
}
}
}
......@@ -30,46 +30,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class ISPConfigRESTHandler {
private $methods = array();
private $classes = array();
class ISPConfigRESTHandler extends ISPConfigRemotingHandlerBase {
private $api_version = 1;
public function __construct() {
global $app;
// load main remoting file
$app->load('remoting');
// load all remote classes and get their methods
$dir = dirname(realpath(__FILE__)) . '/remote.d';
$d = opendir($dir);
while($f = readdir($d)) {
if($f == '.' || $f == '..') continue;
if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
$name = substr($f, 0, strpos($f, '.'));
include $dir . '/' . $f;
$class_name = 'remoting_' . $name;
if(class_exists($class_name, false)) {
$this->classes[$class_name] = new $class_name();
foreach(get_class_methods($this->classes[$class_name]) as $method) {
$this->methods[$method] = $class_name;
}
}
}
closedir($d);
// add main methods
$this->methods['login'] = 'remoting';
$this->methods['logout'] = 'remoting';
$this->methods['get_function_list'] = 'remoting';
// create main class
$this->classes['remoting'] = new remoting(array_keys($this->methods));
}
private function _return_error($code, $codename, $message) {
header('HTTP/1.1 ' . $code . ' ' . $codename);
......
......@@ -30,45 +30,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class ISPConfigSoapHandler {
private $methods = array();
private $classes = array();
public function __construct() {
global $app;
// load main remoting file
$app->load('remoting');
// load all remote classes and get their methods
$dir = dirname(realpath(__FILE__)) . '/remote.d';
$d = opendir($dir);
while($f = readdir($d)) {
if($f == '.' || $f == '..') continue;
if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
$name = substr($f, 0, strpos($f, '.'));
include_once $dir . '/' . $f;
$class_name = 'remoting_' . $name;
if(class_exists($class_name, false)) {
$this->classes[$class_name] = new $class_name();
foreach(get_class_methods($this->classes[$class_name]) as $method) {
$this->methods[$method] = $class_name;
}
}
}
closedir($d);
// add main methods
$this->methods['login'] = 'remoting';
$this->methods['logout'] = 'remoting';
$this->methods['get_function_list'] = 'remoting';
// create main class
$this->classes['remoting'] = new remoting(array_keys($this->methods));
}
class ISPConfigSoapHandler extends ISPConfigRemotingHandlerBase {
public function __call($method, $params) {
if(array_key_exists($method, $this->methods) == false) {
throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist');
......
......@@ -606,6 +606,20 @@ $form["tabs"]['misc'] = array (
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'maintenance_mode_exclude_ips' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array(
0 => array (
'type' => 'ISIP',
'allowempty' => true,
'separator' => ',',
'errmsg'=> 'maintenance_mode_exclude_ips_error_isip'
),
),
'default' => '',
'value' => ''
),
'admin_dashlets_left' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -29,6 +29,8 @@ $wb['admin_mail_txt'] = 'Administrators e-mail';
$wb['monitor_key_txt'] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrators name';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -29,6 +29,8 @@ $wb['admin_mail_txt'] = 'Администраторски емаил';
$wb['admin_name_txt'] = 'Администраторски имена';
$wb['system_config_desc_txt'] = '';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -40,6 +40,8 @@ $wb['admin_mail_txt'] = 'Administrador(es) de e-mails';
$wb['monitor_key_txt'] = 'Palavras reservadas a monitorar';
$wb['admin_name_txt'] = 'Nome do administrador';
$wb['maintenance_mode_txt'] = 'Modo manutenção';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Usar SMTP para enviar e-mails do sistema';
$wb['smtp_host_txt'] = 'Host SMTP';
$wb['smtp_port_txt'] = 'Porta SMTP';
......
......@@ -40,6 +40,8 @@ $wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb['monitor_key_txt'] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrator\'s name';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -29,6 +29,8 @@ $wb['mailmailinglist_link_txt'] = 'Ikonový odkaz na aplikaci E-mailových konfe
$wb['mailmailinglist_url_txt'] = 'E-mailové konference URL';
$wb['monitor_key_txt'] = 'Monitor keyword';
$wb['maintenance_mode_txt'] = 'Režim údržby';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Použít (zvolit) SMTP server pro zasílání systémových mailů';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -37,6 +37,8 @@ $wb['admin_mail_txt'] = 'Administrator E-Mail';
$wb['monitor_key_txt'] = 'ISPConfig Monitor App Passwort';
$wb['admin_name_txt'] = 'Name des Administrators';
$wb['maintenance_mode_txt'] = 'Wartungsmodus';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'SMTP zum System E-Mailversand nutzen';
$wb['smtp_host_txt'] = 'SMTP Server';
$wb['smtp_port_txt'] = 'SMTP Port';
......
......@@ -35,6 +35,8 @@ $wb['admin_mail_txt'] = 'Administratorer e-mail';
$wb['monitor_key_txt'] = 'Monitor nøgleord';
$wb['admin_name_txt'] = 'Administratorer navn';
$wb['maintenance_mode_txt'] = 'Vedligeholdelsestilstand';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Brug SMTP for at sende system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -29,6 +29,8 @@ $wb['admin_mail_txt'] = 'e-mail Διαχειριστών';
$wb['monitor_key_txt'] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Όνομα Administrator';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP θύρα';
......
......@@ -40,6 +40,8 @@ $wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb["monitor_key_txt"] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrator\'s name';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......
......@@ -40,6 +40,8 @@ $wb['mailboxlist_webmail_link_txt'] = 'Vinculo a correo web en la lista de buzon
$wb['mailmailinglist_link_txt'] = 'Vínculo a la lista de correos en la lista de la Lista de correos';
$wb['mailmailinglist_url_txt'] = 'URL a la lista de correos';
$wb['maintenance_mode_txt'] = 'Modo de mantenimiento';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['min_password_length_txt'] = 'Longitud mínima de la contraseña';
$wb['min_password_strength_txt'] = 'Fortaleza mínima de la contraseña';
$wb['monitor_key_txt'] = 'Palabra clave del Monitor';
......
......@@ -29,6 +29,8 @@ $wb['admin_mail_txt'] = 'Administrators e-mail';
$wb['monitor_key_txt'] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrators name';
$wb['maintenance_mode_txt'] = 'Maintenance Mode';
$wb['maintenance_mode_exclude_ips_txt'] = 'Exclude IP\'s from maintenance';
$wb['maintenance_mode_exclude_ips_error_isip'] = 'One or more invalid IP addresses in maintenance mode exclude list. Must be a list of comma-separated IPv4 and/or IPv6 addresses.';
$wb['smtp_enabled_txt'] = 'Use SMTP to send system mails';
$wb['smtp_host_txt'] = 'SMTP host';
$wb['smtp_port_txt'] = 'SMTP port';
......