Florian Schaal
2015-06-02 6c424f1677753663ca1e086a955f2843f86854f3
add option to rewite ipv4-addresses on web-mirrors
5 files modified
53 files added
924 ■■■■■ changed files
install/sql/incremental/upd_dev_collection.sql 15 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 19 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/server_ip_map.tform.php 98 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ar_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ar_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/bg_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/bg_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/br_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/br_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/cz_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/cz_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/el_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/el_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/es_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/es_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/fi_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/fi_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/fr_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/fr_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/hr_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/hr_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/hu_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/hu_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/id_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/id_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/it_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/it_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ja_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ja_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/nl_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/nl_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/pl_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/pl_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/pt_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/pt_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ro_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ro_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ru_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/ru_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/se_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/se_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/sk_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/sk_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/tr_server_ip_map.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/tr_server_ip_map_list.lng 7 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/module.conf.php 5 ●●●● patch | view | raw | blame | history
interface/web/admin/list/server_ip_map.list.php 62 ●●●●● patch | view | raw | blame | history
interface/web/admin/server_ip_map_del.php 44 ●●●●● patch | view | raw | blame | history
interface/web/admin/server_ip_map_edit.php 108 ●●●●● patch | view | raw | blame | history
interface/web/admin/server_ip_map_list.php 46 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_ip_map_edit.htm 44 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_ip_map_list.htm 49 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 9 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 11 ●●●●● patch | view | raw | blame | history
install/sql/incremental/upd_dev_collection.sql
@@ -150,3 +150,18 @@
ALTER TABLE openvz_vm ADD COLUMN `features` TEXT DEFAULT NULL AFTER `capability`;
ALTER TABLE openvz_template ADD COLUMN `iptables` varchar(255) DEFAULT NULL AFTER `features`;
ALTER TABLE openvz_vm ADD COLUMN `iptables` TEXT DEFAULT NULL AFTER `features`;
CREATE TABLE `server_ip_map` (
  `server_ip_map_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
  `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
  `sys_perm_user` varchar(5) DEFAULT NULL,
  `sys_perm_group` varchar(5) DEFAULT NULL,
  `sys_perm_other` varchar(5) DEFAULT NULL,
  `server_id` int(11) unsigned NOT NULL DEFAULT '0',
  `source_ip` varchar(15) DEFAULT NULL,
  `destination_ip` varchar(35) DEFAULT '',
  `active` enum('n','y') NOT NULL DEFAULT 'y',
  PRIMARY KEY (`server_ip_map_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
install/sql/ispconfig3.sql
@@ -1252,6 +1252,25 @@
-- --------------------------------------------------------
--
-- Table structure for table  `server_ip_map`
--
CREATE TABLE `server_ip_map` (
  `server_ip_map_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
  `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
  `sys_perm_user` varchar(5) DEFAULT NULL,
  `sys_perm_group` varchar(5) DEFAULT NULL,
  `sys_perm_other` varchar(5) DEFAULT NULL,
  `server_id` int(11) unsigned NOT NULL DEFAULT '0',
  `source_ip` varchar(15) DEFAULT NULL,
  `destination_ip` varchar(35) DEFAULT '',
  `active` enum('n','y') NOT NULL DEFAULT 'y',
  PRIMARY KEY (`server_ip_map_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table  `server_php`
interface/web/admin/form/server_ip_map.tform.php
New file
@@ -0,0 +1,98 @@
<?php
/*
Copyright (c) 2015, Florian Schaal, schaal @it
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.
*/
$form["title"]    = "IP Addresse mapping";
$form["description"]  = "";
$form["name"]    = "server_ip_map";
$form["action"]   = "server_ip_map_edit.php";
$form["db_table"]  = "server_ip_map";
$form["db_table_idx"] = "server_ip_map_id";
$form["db_history"]  = "yes";
$form["tab_default"] = "server_ip_map";
$form["list_default"] = "server_ip_map_list.php";
$form["auth"]   = 'yes';
$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 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"]['server_ip_map'] = array (
    'title'  => "IP Address Mapping",
    'width'  => 80,
    'template'  => "templates/server_ip_map_edit.htm",
    'fields'  => array (
        'server_id' => array (
//            'datatype' => 'INTEGER',
            'datatype' => 'VARCHAR',
            'formtype' => 'SELECT',
            'default' => '',
//            'datasource' => array (  'type' => 'SQL',
//                'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND mirror_server_id > 0 ORDER BY server_name',
//                'keyfield'=> 'server_id',
//                'valuefield'=> 'server_name'
//            ),
            'value'  => ''
        ),
        'source_ip' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'SELECT',
            'validators' => array (
                0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'source_ip_empty'),
            ),
            'default' => '',
            'value'  => ''
        ),
        'destination_ip' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'validators' => array (
                0 => array ( 'type' => 'ISIP', 'errmsg'=> 'ip_error_wrong'),
                1 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'destination_ip_empty'),
            ),
            'default' => '',
            'value'  => '',
            'separator' => '',
            'width'  => '15',
            'maxlength' => '15',
            'rows'  => '',
            'cols'  => '',
            'searchable' => 1
        ),
        'active' => array(
            'datatype' => 'VARCHAR',
            'formtype' => 'CHECKBOX',
            'default' => 'y',
            'value' => array(0 => 'n', 1 => 'y')
        ),
    )
);
?>
interface/web/admin/lib/lang/ar_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/ar_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/bg_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/bg_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/br_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/br_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/cz_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/cz_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/de_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite auf Server';
$wb["source_txt"] = 'eigentliche IP';
$wb["destination_txt"] = 'neue IP';
$wb["active_txt"] = 'Aktiv';
$wb["ip_error_wrong"] = 'Die neue IP ist ungueltig';
$wb["destination_ip_empty"] = 'Die neue IP ist leer.';
$wb["source_ip_empty"] = 'Die eigentliche IP ist leer.';
$wb["duplicate_mapping_error"] = "Mapping existiert bereits.";
$wb["duplicate_mapping_error"] = "Die eigentliche IP darf keine IP des Rewrite-Servers sein.";
?>
interface/web/admin/lib/lang/de_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'eigentliche IP';
$wb["destination_ip_txt"] = 'neue IP';
$wb["active_txt"] = 'Aktiv';
?>
interface/web/admin/lib/lang/el_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/el_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/en_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/en_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/es_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/es_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/fi_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/fi_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/fr_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/fr_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/hr_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/hr_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/hu_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/hu_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/id_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/id_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/it_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/it_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/ja_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/ja_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/nl_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/nl_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/pl_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/pl_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/pt_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/pt_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/ro_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/ro_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/ru_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/ru_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/se_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/se_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/sk_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/sk_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/lang/tr_server_ip_map.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["server_id_txt"] = 'Rewrite on Server';
$wb["source_txt"] = 'Source IP';
$wb["destination_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
$wb["source_ip_empty"] = 'The Source IP is empty.';
$wb["duplicate_mapping_error"] = "Mapping already exists.";
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
?>
interface/web/admin/lib/lang/tr_server_ip_map_list.lng
New file
@@ -0,0 +1,7 @@
<?php
$wb["list_head_txt"] = 'IP Mappings';
$wb["server_id_txt"] = 'Server';
$wb["source_ip_txt"] = 'Source IP';
$wb["destination_ip_txt"] = 'Destination IP';
$wb["active_txt"] = 'Active';
?>
interface/web/admin/lib/module.conf.php
@@ -42,7 +42,10 @@
    'link' => 'admin/server_ip_list.php',
    'html_id'   => 'server_ip_list');
$items[] = array(   'title'  => 'Server IP mapping',
    'target'  => 'content',
    'link' => 'admin/server_ip_map_list.php',
    'html_id'   => 'server_ip_map_list');
$items[] = array(   'title'  => 'Additional PHP Versions',
    'target'  => 'content',
interface/web/admin/list/server_ip_map.list.php
New file
@@ -0,0 +1,62 @@
<?php
$liste['name']     = 'server_ip_map';
$liste['table']    = 'server_ip_map';
$liste['table_idx']   = 'server_ip_map_id';
$liste['search_prefix']  = 'search_';
$liste['records_per_page']  = "15";
$liste['file']    = 'server_ip_map_list.php';
$liste['edit_file']   = 'server_ip_map_edit.php';
$liste['delete_file']  = 'server_ip_del.php';
$liste['paging_tpl']  = 'templates/paging.tpl.htm';
$liste['auth']    = 'no';
$liste["item"][] = array( 'field'  => "active",
    'datatype' => "VARCHAR",
    'formtype' => "SELECT",
    'op'  => "=",
    'prefix' => "",
    'suffix' => "",
    'width'  => "",
    'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
$liste['item'][] = array( 'field'  => 'server_id',
    'datatype' => 'INTEGER',
    'formtype' => 'SELECT',
    'op'  => '=',
    'prefix' => '',
    'suffix' => '',
    'datasource' => array (  'type' => 'SQL',
        'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
        'keyfield'=> 'server_id',
        'valuefield'=> 'server_name'
    ),
    'width'  => '',
    'value'  => '');
$liste['item'][] = array( 'field'  => 'source_ip',
    'datatype' => 'VARCHAR',
    'op'  => '=',
    'prefix' => '',
    'suffix' => '',
    'datasource' => array (  'type' => 'SQL',
        'querystring' => 'SELECT server_ip_map_id,source_ip FROM server_ip_map WHERE {AUTHSQL}',
        'keyfield'=> 'server_ip_map_id',
        'valuefield'=> 'source_ip'
    ),
    'width'  => '',
    'value'  => '');
$liste['item'][] = array( 'field'  => 'destination_ip',
    'datatype' => 'VARCHAR',
    'op'  => '=',
    'prefix' => '',
    'suffix' => '',
    'datasource' => array (  'type' => 'SQL',
        'querystring' => 'SELECT server_ip_map_id,destination_ip FROM server_ip_map WHERE {AUTHSQL}',
        'keyfield'=> 'server_ip_map_id',
        'valuefield'=> 'destination_ip'
    ),
    'width'  => '',
    'value'  => '');
?>
interface/web/admin/server_ip_map_del.php
New file
@@ -0,0 +1,44 @@
<?php
/*
Copyright (c) 2015, Florian Schaal, schaal @it
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.
*/
$list_def_file = "list/server_ip_map.list.php";
$tform_def_file = "form/server_ip_map.tform.php";
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_ip');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
?>
interface/web/admin/server_ip_map_edit.php
New file
@@ -0,0 +1,108 @@
<?php
/*
Copyright (c) 2015, Florian Schaal, schaal @it
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.
*/
$tform_def_file = "form/server_ip_map.tform.php";
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->auth->check_security_permissions('admin_allow_server_ip');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
    function onShowEnd() {
        global $app;
        // server-list
        $sql = "SELECT server_id, server_name FROM server WHERE mirror_server_id > 0 ORDER BY server_name";
        $servers =  $app->db->queryAllRecords($sql);
        $server_select = "<option value=''></option>";
        if(is_array($servers)) {
            foreach($servers as $server) {
                $selected = ($server['server_id'] == $this->dataRecord['server_id'])?'SELECTED':'';
                $server_select .= "<option value='$server[server_id]' $selected>$server[server_name]</option>\r\n";
            }
        }
        unset($servers);
        $app->tpl->setVar('server_id', $server_select);
        // ip-list
        $sql = "SELECT server_ip.server_ip_id, server_ip.ip_address AS ip_address, server.server_name, CONCAT(server_ip.ip_address,' :: [', server.server_name, ']') AS source FROM server_ip, server WHERE (server_ip.server_id = server.server_id AND server.web_server =1 AND mirror_server_id = 0 AND virtualhost = 'y')";
        $ips = $app->db->queryAllRecords($sql);
        $ip_select = "<option value=''></option>";
        if(is_array($ips)) {
            foreach( $ips as $ip) {
                $selected = ($ip['ip_address'] == $this->dataRecord['source_ip'])?'SELECTED':'';
                $ip_select .= "<option value='$ip[ip_address]' $selected>$ip[source]</option>\r\n";
            }
        }
        unset($ips);
        $app->tpl->setVar('source_ip', $ip_select);
        parent::onShowEnd();
    }
    function onBeforeInsert() {
        global $app;
        $sql = "SELECT * FROM server_ip WHERE server_id = ? and ip_address = ?";
        $ip_check=$app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip']);
        if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error'];
        $sql = 'SELECT count(*) as no FROM server_ip_map WHERE server_id = ? AND source_ip = ? AND destination_ip = ?';
        $check = $app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip'], $this->dataRecord['destination_ip']);
        if ($check['no'] > 0) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error'];
    }
    function onBeforeUpdate() {
        global $app;
        $sql = "SELECT * FROM server_ip WHERE server_id = ? and ip_address = ?";
        $ip_check=$app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip']);
        if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error'];
        $this->oldDataRecord = $app->tform->getDataRecord($this->id);
        if ($this->dataRecord['source_ip'] != $this->oldDataRecord['source_ip'] || $this->dataRecord['destination_ip'] != $this->oldDataRecord['destination_ip']) {
            $sql = 'SELECT count(*) as no FROM server_ip_map WHERE server_id = ? AND source_ip = ? AND destination_ip = ?';
            $check = $app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip'], $this->dataRecord['destination_ip']);
            if ($check['no'] > 0) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error'];
        }
    }
}
$page = new page_action;
$page->onLoad();
?>
interface/web/admin/server_ip_map_list.php
New file
@@ -0,0 +1,46 @@
<?php
/*
Copyright (c) 2015, Florian Schaal, schaal @it
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.
*/
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
$list_def_file = "list/server_ip_map.list.php";
//* Check permissions for module
$app->auth->check_module_permissions('admin');
$app->uses('listform_actions');
//$app->listform_actions->SQLOrderBy = "ORDER BY server_ip.server_id, server_ip.ip_address";
$app->listform_actions->SQLOrderBy = "";
$app->listform_actions->onLoad();
?>
interface/web/admin/templates/server_ip_map_edit.htm
New file
@@ -0,0 +1,44 @@
<div class='page-header'>
    <h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
<legend>IP Address Mapping</legend>
<div class="form-group">
    <label for="server_id" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label>
    <div class="col-sm-9">
        <select name="server_id" id="server_id" class="form-control">
            {tmpl_var name='server_id'}
        </select>
    </div>
</div>
<div class="form-group">
    <label for="source_ip" class="col-sm-3 control-label">{tmpl_var name='source_txt'}</label>
    <div class="col-sm-9">
        <select name="source_ip" id="source_ip" class="form-control">
            {tmpl_var name='source_ip'}
        </select>
    </div>
</div>
<div class="form-group">
    <label for="destination_ip" class="col-sm-3 control-label">{tmpl_var name='destination_txt'}</label>
    <div class="col-sm-9">
        <input type="text" name="destination_ip" id=destination_ip" value="{tmpl_var name='destination_ip'}" class="form-control" />
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
    <div class="col-sm-9">
        {tmpl_var name='active'}
    </div>
</div>
<div class="form-group">
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
     <div class="clear"><div class="right">
        <button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="admin/server_ip_map_edit.php">{tmpl_var name='btn_save_txt'}</button>
        <button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="admin/server_ip_map_list.php">{tmpl_var name='btn_cancel_txt'}</button>
    </div></div>
</div>
interface/web/admin/templates/server_ip_map_list.htm
New file
@@ -0,0 +1,49 @@
<div class='page-header'></div>
<p class="fieldset-legend">{tmpl_var name="toolsarea_head_txt"}</p>
<button class="btn btn-default formbutton-success" type="button" data-load-content="admin/server_ip_map_edit.php">{tmpl_var name="add_new_record_txt"}</button>
<p class="fieldset-legend"><tmpl_var name="list_head_txt"></p>
<div class="table-wrapper marginTop15">
    <table class="table">
        <thead class="dark form-group-sm">
            <tr>
                <th class="tiny-col" data-column="active"><tmpl_var name="active_txt"></th>
                <th data-column="server_id"><tmpl_var name="server_id_txt"></th>
                <th data-column="source_ip"><tmpl_var name="source_ip_txt"></th>
                <th data-column="destination_ip"><tmpl_var name="destination_ip_txt"></th>
                <th class="text-right">{tmpl_var name='search_limit'}</th>
            </tr>
            <tr>
                <td><select class="form-control" name="search_active">{tmpl_var name='search_active'}</select></td>
                <td><select class="form-control" name="search_server_id">{tmpl_var name='search_server_id'}</select></td>
                <td><input class="form-control" type="text" name="search_ip_address" value="{tmpl_var name='search_ip_address'}" /></td>
                <td><input class="form-control" type="text" name="search_ip_address" value="{tmpl_var name='search_ip_address'}" /></td>
                <td class="text-right">
                    <button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="admin/server_ip_map_list.php"><span class="icon icon-filter"></span></button>
                </td>
            </tr>
        </thead>
        <tbody>
            <tmpl_loop name="records">
                <tr>
                    <td><a href="#" data-load-content="admin/server_ip_map_edit.php?id={tmpl_var name='id'}">{tmpl_var name="active"}</a></td>
                    <td><a href="#" data-load-content="admin/server_ip_map_edit.php?id={tmpl_var name='id'}">{tmpl_var name="server_id"}</a></td>
                    <td><a href="#" data-load-content="admin/server_ip_map_edit.php?id={tmpl_var name='id'}">{tmpl_var name="source_ip"}</a></td>
                    <td><a href="#" data-load-content="admin/server_ip_map_edit.php?id={tmpl_var name='id'}">{tmpl_var name="destination_ip"}</a></td>
                    <td class="text-right">
                        <a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('admin/server_ip_map_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
                    </td>
                </tr>
            </tmpl_loop>
            <tmpl_unless name="records">
                <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
                    <td colspan="4">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
                </tr>
            </tmpl_unless>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="4"><tmpl_var name="paging"></td>
            </tr>
        </tfoot>
    </table>
</div>
server/plugins-available/apache2_plugin.inc.php
@@ -1515,6 +1515,15 @@
        $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);
server/plugins-available/nginx_plugin.inc.php
@@ -902,7 +902,18 @@
        $tpl = new tpl();
        $tpl->newTemplate('nginx_vhost.conf.master');
        // IPv4
        //* 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;