From 5667a9291050824f4c7c3ca20cce3bbc1e023bff Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Fri, 25 Nov 2005 11:47:33 -0500 Subject: [PATCH] Added DNS module. --- interface/web/dns/lib/lang/en_rr.lng | 10 interface/web/dns/soa_edit.php | 145 +++++ interface/web/dns/lib/module.conf.php | 27 + interface/web/dns/soa_list.php | 26 + interface/web/dns/templates/soa_edit_rr.htm | 16 interface/web/dns/templates/rr_edit.htm | 40 + interface/web/dns/templates/soa_list.htm | 54 ++ interface/lib/config.inc.php | 59 + interface/web/dns/lib/admin.conf.php | 2 interface/web/dns/lib/lang/en_rr_list.lng | 14 interface/web/dns/rr_list.php | 27 + interface/web/dns/list/soa.list.php | 150 +++++ interface/web/dns/rr_del.php | 136 +++++ interface/web/dns/soa_del.php | 119 ++++ interface/web/dns/list/rr.list.php | 104 ++++ interface/web/dns/rr_edit.php | 130 +++++ interface/web/dns/templates/rr_list.htm | 45 + interface/web/dns/templates/soa_edit.htm | 56 ++ interface/web/dns/form/soa.tform.php | 199 +++++++ interface/web/dns/form/rr.tform.php | 136 +++++ interface/web/dns/lib/lang/en_soa.lng | 15 interface/web/dns/lib/lang/en_soa_list.lng | 20 22 files changed, 1,507 insertions(+), 23 deletions(-) diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php index 0fe510c..137e890 100644 --- a/interface/lib/config.inc.php +++ b/interface/lib/config.inc.php @@ -29,54 +29,67 @@ ini_set('register_globals',0); -$conf["rootpath"] = "D:\\www\\ispconfig3\\interface"; -//$conf["rootpath"] = "D:\\www\\ispconfig3\\interface"; -//$conf["rootpath"] = "/home/www/ispconfig3/web/cms"; +$conf["rootpath"] = "D:\\www\\ispconfig3\\interface"; +//$conf["rootpath"] = "D:\\www\\ispconfig3\\interface"; +//$conf["rootpath"] = "/home/www/ispconfig3/web/cms"; -$conf["fs_div"] = "\\"; // File system divider, \\ on windows and / on linux and unix -$conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes"; -$conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp"; +$conf["fs_div"] = "\\"; // File system divider, \\ on windows and / on linux and unix +$conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes"; +$conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp"; /* - Database Settings + Database Settings */ -$conf["db_type"] = 'mysql'; -$conf["db_host"] = 'localhost'; -$conf["db_database"] = 'ispconfig3'; -$conf["db_user"] = 'root'; -$conf["db_password"] = ''; +$conf["db_type"] = 'mysql'; +$conf["db_host"] = 'localhost'; +$conf["db_database"] = 'ispconfig3'; +$conf["db_user"] = 'root'; +$conf["db_password"] = ''; /* - External programs + External programs */ -//$conf["programs"]["convert"] = "/usr/bin/convert"; -$conf["programs"]["wput"] = $conf["rootpath"]."\\tools\\wput\\wput.exe"; +//$conf["programs"]["convert"] = "/usr/bin/convert"; +$conf["programs"]["wput"] = $conf["rootpath"]."\\tools\\wput\\wput.exe"; /* - Themes + Themes */ -$conf["theme"] = 'default'; -$conf["html_content_encoding"] = 'text/html; charset=iso-8859-1'; +$conf["theme"] = 'default'; +$conf["html_content_encoding"] = 'text/html; charset=iso-8859-1'; /* - Default Language + Default Language */ -$conf['language'] = 'en'; +$conf['language'] = 'en'; /* - Auto Load Modules + Auto Load Modules */ -$conf["start_db"] = true; -$conf["start_session"] = true; +$conf["start_db"] = true; +$conf["start_session"] = true; + +/* + DNS Settings +*/ + +$conf['auto_create_ptr'] = 1; // Automatically create PTR records? +$conf['default_ns'] = 'ns1.example.com.'; // must be set if $conf['auto_create_ptr'] is 1. Don't forget the trailing dot! +$conf['default_mbox'] = 'admin.example.com.'; // Admin email address. Must be set if $conf['auto_create_ptr'] is 1. Replace "@" with ".". Don't forget the trailing dot! +$conf['default_ttl'] = 86400; +$conf['default_refresh'] = 28800; +$conf['default_retry'] = 7200; +$conf['default_expire'] = 604800; +$conf['default_minimum_ttl'] = 86400; ?> \ No newline at end of file diff --git a/interface/web/dns/form/rr.tform.php b/interface/web/dns/form/rr.tform.php new file mode 100644 index 0000000..40284a8 --- /dev/null +++ b/interface/web/dns/form/rr.tform.php @@ -0,0 +1,136 @@ +<?php + +/* + Form Definition + + Tabledefinition + + Datatypes: + - INTEGER (Forces the input to Int) + - DOUBLE + - CURRENCY (Formats the values to currency notation) + - VARCHAR (no format check, maxlength: 255) + - TEXT (no format check) + - DATE (Dateformat, automatic conversion to timestamps) + + Formtype: + - TEXT (Textfield) + - TEXTAREA (Textarea) + - PASSWORD (Password textfield, input is not shown when edited) + - SELECT (Select option field) + - RADIO + - CHECKBOX + - CHECKBOXARRAY + - FILE + + VALUE: + - Wert oder Array + + Hint: + The ID field of the database table is not part of the datafield definition. + The ID field must be always auto incement (int or bigint). + + +*/ + +$form["title"] = "Record"; +$form["description"] = ""; +$form["name"] = "rr"; +$form["action"] = "rr_edit.php"; +$form["db_table"] = "rr"; +$form["db_table_idx"] = "id"; +$form["db_history"] = "yes"; +$form["tab_default"] = "rr"; +$form["list_default"] = "rr_list.php"; +$form["auth"] = 'no'; // yes / no + +$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"]['rr'] = array ( + 'title' => "Record", + 'width' => 100, + 'template' => "templates/rr_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 1 ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), +*/ + 'zone' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ('type' => 'NOTEMPTY', + 'errmsg'=> 'rr_zone_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'type' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT') + ), + 'data' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ('type' => 'NOTEMPTY', + 'errmsg'=> 'rr_data_error_empty'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'aux' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ttl' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ('type' => 'NOTEMPTY', + 'errmsg'=> 'rr_ttl_error_empty'), + ), + 'default' => '86400', + 'value' => '86400', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + + +?> \ No newline at end of file diff --git a/interface/web/dns/form/soa.tform.php b/interface/web/dns/form/soa.tform.php new file mode 100644 index 0000000..354b969 --- /dev/null +++ b/interface/web/dns/form/soa.tform.php @@ -0,0 +1,199 @@ +<?php + +/* + Form Definition + + Tabledefinition + + Datatypes: + - INTEGER (Forces the input to Int) + - DOUBLE + - CURRENCY (Formats the values to currency notation) + - VARCHAR (no format check, maxlength: 255) + - TEXT (no format check) + - DATE (Dateformat, automatic conversion to timestamps) + + Formtype: + - TEXT (Textfield) + - TEXTAREA (Textarea) + - PASSWORD (Password textfield, input is not shown when edited) + - SELECT (Select option field) + - RADIO + - CHECKBOX + - CHECKBOXARRAY + - FILE + + VALUE: + - Wert oder Array + + Hint: + The ID field of the database table is not part of the datafield definition. + The ID field must be always auto incement (int or bigint). + + +*/ + +$form["title"] = "SOA"; +$form["description"] = ""; +$form["name"] = "soa"; +$form["action"] = "soa_edit.php"; +$form["db_table"] = "soa"; +$form["db_table_idx"] = "id"; +$form["db_history"] = "yes"; +$form["tab_default"] = "soa"; +$form["list_default"] = "soa_list.php"; +$form["auth"] = 'no'; // yes / no + +$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"]['soa'] = array ( + 'title' => "SOA", + 'width' => 100, + 'template' => "templates/soa_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 1 ORDER BY server_name', + 'keyfield'=> 'server_id', + 'valuefield'=> 'server_name' + ), + 'value' => '' + ), +*/ + 'origin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'soa_error_empty'), + 1 => array ( 'type' => 'UNIQUE', + 'errmsg'=> 'soa_error_unique'), + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'ns' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'ns_error_empty'), + ), + 'default' => $conf['default_ns'], + 'value' => $conf['default_ns'], + 'width' => '30', + 'maxlength' => '255' + ), + 'mbox' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array (0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'mbox_error_empty'), + ), + 'default' => $conf['default_mbox'], + 'value' => $conf['default_mbox'], + 'width' => '30', + 'maxlength' => '255' + ), + 'serial' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => date("Ymd").'01', + 'value' => date("Ymd").'01', + 'width' => '30', + 'maxlength' => '255' + ), + 'refresh' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => $conf['default_refresh'], + 'value' => $conf['default_refresh'], + 'width' => '30', + 'maxlength' => '255' + ), + 'retry' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => $conf['default_retry'], + 'value' => $conf['default_retry'], + 'width' => '30', + 'maxlength' => '255' + ), + 'expire' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => $conf['default_expire'], + 'value' => $conf['default_expire'], + 'width' => '30', + 'maxlength' => '255' + ), + 'minimum' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => $conf['default_minimum_ttl'], + 'value' => $conf['default_minimum_ttl'], + 'width' => '30', + 'maxlength' => '255' + ), + 'ttl' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => $conf['default_ttl'], + 'value' => $conf['default_ttl'], + 'width' => '30', + 'maxlength' => '255' + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'RADIO', + 'default' => 'Y', + 'value' => array('Y' => 'Yes','N'=>'No') + ), + 'xfer' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + ################################## + # ENDE Datatable fields + ################################## + ) +); + +$form["tabs"]['rr'] = array ( + 'title' => "Records", + 'width' => 100, + 'template' => "templates/soa_edit_rr.htm", + 'fields' => array ( + ################################## + # Beginn Datatable fields + ################################## + + ################################## + # ENDE Datatable fields + ################################## + ), + 'plugins' => array ( + 'rr_list' => array ( + 'class' => 'plugin_listview', + 'options' => array('listdef' => 'list/rr.list.php', 'sqlextwhere' => "zone = ".intval($_REQUEST['id'])) + ) + ) +); + + +?> \ No newline at end of file diff --git a/interface/web/dns/lib/admin.conf.php b/interface/web/dns/lib/admin.conf.php new file mode 100644 index 0000000..a45d440 --- /dev/null +++ b/interface/web/dns/lib/admin.conf.php @@ -0,0 +1,2 @@ +<?php +?> \ No newline at end of file diff --git a/interface/web/dns/lib/lang/en_rr.lng b/interface/web/dns/lib/lang/en_rr.lng new file mode 100644 index 0000000..7b70435 --- /dev/null +++ b/interface/web/dns/lib/lang/en_rr.lng @@ -0,0 +1,10 @@ +<?php +$wb["zone_txt"] = 'zone'; +$wb["name_txt"] = 'name'; +$wb["type_txt"] = 'type'; +$wb["data_txt"] = 'data'; +$wb["aux_txt"] = 'aux'; +$wb["ttl_txt"] = 'ttl'; +$wb["btn_save_txt"] = 'Save'; +$wb["btn_cancel_txt"] = 'Cancel'; +?> \ No newline at end of file diff --git a/interface/web/dns/lib/lang/en_rr_list.lng b/interface/web/dns/lib/lang/en_rr_list.lng new file mode 100644 index 0000000..c496f04 --- /dev/null +++ b/interface/web/dns/lib/lang/en_rr_list.lng @@ -0,0 +1,14 @@ +<?php +$wb["list_head_txt"] = 'rr'; +$wb["name_txt"] = 'name'; +$wb["type_txt"] = 'type'; +$wb["data_txt"] = 'data'; +$wb["aux_txt"] = 'aux'; +$wb["ttl_txt"] = 'ttl'; +$wb["page_txt"] = 'Page'; +$wb["page_of_txt"] = 'of'; +$wb["page_next_txt"] = 'Next'; +$wb["page_back_txt"] = 'Back'; +$wb["delete_txt"] = 'Delete'; +$wb["filter_txt"] = 'Filter'; +?> \ No newline at end of file diff --git a/interface/web/dns/lib/lang/en_soa.lng b/interface/web/dns/lib/lang/en_soa.lng new file mode 100644 index 0000000..d543c0d --- /dev/null +++ b/interface/web/dns/lib/lang/en_soa.lng @@ -0,0 +1,15 @@ +<?php +$wb["origin_txt"] = 'origin'; +$wb["ns_txt"] = 'ns'; +$wb["mbox_txt"] = 'mbox'; +$wb["serial_txt"] = 'serial'; +$wb["refresh_txt"] = 'refresh'; +$wb["retry_txt"] = 'retry'; +$wb["expire_txt"] = 'expire'; +$wb["minimum_txt"] = 'minimum'; +$wb["ttl_txt"] = 'ttl'; +$wb["active_txt"] = 'active'; +$wb["xfer_txt"] = 'xfer'; +$wb["btn_save_txt"] = 'Save'; +$wb["btn_cancel_txt"] = 'Cancel'; +?> \ No newline at end of file diff --git a/interface/web/dns/lib/lang/en_soa_list.lng b/interface/web/dns/lib/lang/en_soa_list.lng new file mode 100644 index 0000000..6d77a78 --- /dev/null +++ b/interface/web/dns/lib/lang/en_soa_list.lng @@ -0,0 +1,20 @@ +<?php +$wb["list_head_txt"] = 'soa'; +$wb["origin_txt"] = 'origin'; +$wb["ns_txt"] = 'ns'; +$wb["mbox_txt"] = 'mbox'; +$wb["serial_txt"] = 'serial'; +$wb["refresh_txt"] = 'refresh'; +$wb["retry_txt"] = 'retry'; +$wb["expire_txt"] = 'expire'; +$wb["minimum_txt"] = 'minimum'; +$wb["ttl_txt"] = 'ttl'; +$wb["active_txt"] = 'active'; +$wb["xfer_txt"] = 'xfer'; +$wb["page_txt"] = 'Page'; +$wb["page_of_txt"] = 'of'; +$wb["page_next_txt"] = 'Next'; +$wb["page_back_txt"] = 'Back'; +$wb["delete_txt"] = 'Delete'; +$wb["filter_txt"] = 'Filter'; +?> \ No newline at end of file diff --git a/interface/web/dns/lib/module.conf.php b/interface/web/dns/lib/module.conf.php new file mode 100644 index 0000000..05ebee8 --- /dev/null +++ b/interface/web/dns/lib/module.conf.php @@ -0,0 +1,27 @@ +<?php +$module = array ( + 'name' => 'dns', + 'title' => 'DNS', + 'template' => 'module.tpl.htm', + 'navframe_page' => '', + 'startpage' => 'dns/soa_list.php', + 'tab_width' => '', + 'nav' => + array ( + 0 => + array ( + 'title' => 'Zones', + 'open' => 1, + 'items' => + array ( + 0 => + array ( + 'title' => 'SOA', + 'target' => 'content', + 'link' => 'dns/soa_list.php', + ), + ), + ), + ), +) +?> \ No newline at end of file diff --git a/interface/web/dns/list/rr.list.php b/interface/web/dns/list/rr.list.php new file mode 100644 index 0000000..24becc2 --- /dev/null +++ b/interface/web/dns/list/rr.list.php @@ -0,0 +1,104 @@ +<?php + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + + + +// Name of the list +$liste["name"] = "rr"; + +// Database table +$liste["table"] = "rr"; + +// Index index field of the database table +$liste["table_idx"] = "id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = 15; + +// Script File of the list +$liste["file"] = "rr_list.php"; + +// Script file of the edit form +$liste["edit_file"] = "rr_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "rr_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "no"; + + +/***************************************************** +* Suchfelder +*****************************************************/ +/* +$liste["item"][] = array( 'field' => "server_id", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); +*/ +$liste["item"][] = array( 'field' => "name", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "type", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('A' => 'A', 'AAAA' => 'AAAA', 'ALIAS' => 'ALIAS', 'CNAME' => 'CNAME', 'HINFO' => 'HINFO', 'MX' => 'MX', 'NS' => 'NS', 'PTR' => 'PTR', 'RP' => 'RP', 'SRV' => 'SRV', 'TXT' => 'TXT')); + +$liste["item"][] = array( 'field' => "data", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "aux", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "ttl", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +?> \ No newline at end of file diff --git a/interface/web/dns/list/soa.list.php b/interface/web/dns/list/soa.list.php new file mode 100644 index 0000000..3c6c46c --- /dev/null +++ b/interface/web/dns/list/soa.list.php @@ -0,0 +1,150 @@ +<?php + +/* + Datatypes: + - INTEGER + - DOUBLE + - CURRENCY + - VARCHAR + - TEXT + - DATE +*/ + + + +// Name of the list +$liste["name"] = "soa"; + +// Database table +$liste["table"] = "soa"; + +// Index index field of the database table +$liste["table_idx"] = "id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = 15; + +// Script File of the list +$liste["file"] = "soa_list.php"; + +// Script file of the edit form +$liste["edit_file"] = "soa_edit.php"; + +// Script File of the delete script +$liste["delete_file"] = "soa_del.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "yes"; + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste["item"][] = array( 'field' => "origin", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "ns", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "mbox", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "serial", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "refresh", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "retry", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "expire", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "minimum", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "ttl", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "active", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "xfer", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "LIKE", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + + +?> \ No newline at end of file diff --git a/interface/web/dns/rr_del.php b/interface/web/dns/rr_del.php new file mode 100644 index 0000000..d90001f --- /dev/null +++ b/interface/web/dns/rr_del.php @@ -0,0 +1,136 @@ +<?php + +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +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. +*/ + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/rr.list.php"; +$tform_def_file = "form/rr.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checke Berechtigungen f�r Modul +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +// Loading classes +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onDelete() { + global $app, $conf; + + $rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']); + $zone_id = $rr['zone']; + + // update serial + $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zone_id); + $serial = $soa['serial']; + $update = 1; + + if($update > 0){ + $serial_date = substr($serial, 0, 8); + $count = intval(substr($serial, 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$zone_id); + } + + // PTR + if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){ + if($rr['type'] == 'A' || $rr['type'] == 'AAAA'){ + list($a, $b, $c, $d) = explode('.', $rr['data']); + $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.'; + if(substr($rr['name'], -1) == '.'){ + $ptr_soa_rr_data = $rr['name']; + } else { + $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin']; + } + if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){ + if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){ + $app->db->query("DELETE FROM rr WHERE id = ".$ptr_soa_rr_exist['id']); + // is there another A/AAAA record with that IP address? + if($other_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id'])){ + $other_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$other_rr['zone']); + if(substr($other_rr['name'], -1) == '.'){ + $other_ptr_soa_rr_data = $other_rr['name']; + } else { + $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin']; + } + $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."')"); + } + + // if no more records exist for the ptr_soa, delete it + if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."'")){ + $app->db->query("DELETE FROM soa WHERE id = ".$ptr_soa_exist['id']); + } else { // increment serial + $serial_date = substr($ptr_soa_exist['serial'], 0, 8); + $count = intval(substr($ptr_soa_exist['serial'], 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']); + } + } + } + } + } + + + parent::onDelete(); + } + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onDelete(); + + +?> \ No newline at end of file diff --git a/interface/web/dns/rr_edit.php b/interface/web/dns/rr_edit.php new file mode 100644 index 0000000..582fec8 --- /dev/null +++ b/interface/web/dns/rr_edit.php @@ -0,0 +1,130 @@ +<?php +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +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. +*/ + + +/****************************************** +* Begin Form configuration +******************************************/ + +$tform_def_file = "form/rr.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onSubmit() { + global $app, $conf; + + $this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id']; + + // update serial + $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["zone"]); + $serial = $soa['serial']; + $update = 0; + if($old_record = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$this->dataRecord["id"])){ + foreach($old_record as $key => $val){ + if($this->dataRecord[$key] != $val) $update += 1; + } + } else { // new record + $update = 1; + } + if($update > 0){ + $serial_date = substr($serial, 0, 8); + $count = intval(substr($serial, 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$this->dataRecord["zone"]); + } + + // PTR + if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){ + if($this->dataRecord['type'] == 'A' || $this->dataRecord['type'] == 'AAAA'){ + list($a, $b, $c, $d) = explode('.', $this->dataRecord['data']); + $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.'; + if(substr($this->dataRecord['name'], -1) == '.'){ + $ptr_soa_rr_data = $this->dataRecord['name']; + } else { + $ptr_soa_rr_data = $this->dataRecord['name'].(trim($this->dataRecord['name']) == '' ? '' : '.').$soa['origin']; + } + if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){ + $app->db->query("INSERT INTO soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active) VALUES ('".$ptr_soa."', '".trim($conf['default_ns'])."', '".trim($conf['default_mbox'])."', '".date("Ymd").'01'."', '".$conf['default_refresh']."', '".$conf['default_retry']."', '".$conf['default_expire']."', '".$conf['default_minimum_ttl']."', '".$conf['default_ttl']."', 'Y')"); + $ptr_soa_id = $app->db->insertID(); + $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."')"); + } else { + if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']); + if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){ + $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."')"); + // increase serial of PTR SOA + $ptr_soa_serial_date = substr($ptr_soa_exist['serial'], 0, 8); + $ptr_soa_count = intval(substr($ptr_soa_exist['serial'], 8, 2)); + $ptr_soa_current_date = date("Ymd"); + if($ptr_soa_serial_date == $ptr_soa_current_date){ + $ptr_soa_count += 1; + $ptr_soa_count = str_pad($ptr_soa_count, 2, "0", STR_PAD_LEFT); + $ptr_soa_new_serial = $ptr_soa_current_date.$ptr_soa_count; + } else { + $ptr_soa_new_serial = $ptr_soa_current_date.'01'; + } + $app->db->query("UPDATE soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']); + } + } + } + } + + + parent::onSubmit(); + } + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/dns/rr_list.php b/interface/web/dns/rr_list.php new file mode 100644 index 0000000..03f797b --- /dev/null +++ b/interface/web/dns/rr_list.php @@ -0,0 +1,27 @@ +<?php +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/rr.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +$app->uses('listform_actions'); + +// Generate the page +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/dns/soa_del.php b/interface/web/dns/soa_del.php new file mode 100644 index 0000000..9d84e32 --- /dev/null +++ b/interface/web/dns/soa_del.php @@ -0,0 +1,119 @@ +<?php + +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +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. +*/ + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/soa.list.php"; +$tform_def_file = "form/soa.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checke Berechtigungen f�r Modul +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +// Loading classes +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onDelete() { + global $app, $conf; + + // PTR + if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){ + $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']); + $rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = '".$_REQUEST['id']."' AND (type = 'A' OR type = 'AAAA')"); + if(!empty($rrs)){ + foreach($rrs as $rr){ + list($a, $b, $c, $d) = explode('.', $rr['data']); + $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.'; + if(substr($rr['name'], -1) == '.'){ + $ptr_soa_rr_data = $rr['name']; + } else { + $ptr_soa_rr_data = $rr['name'].(trim($rr['name']) == '' ? '' : '.').$soa['origin']; + } + if($ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$ptr_soa."'")){ + if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){ + $app->db->query("DELETE FROM rr WHERE id = ".$ptr_soa_rr_exist['id']); + // is there another A/AAAA record with that IP address? + if($other_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id']." AND zone != ".$rr['zone'])){ + $other_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$other_rr['zone']); + if(substr($other_rr['name'], -1) == '.'){ + $other_ptr_soa_rr_data = $other_rr['name']; + } else { + $other_ptr_soa_rr_data = $other_rr['name'].(trim($other_rr['name']) == '' ? '' : '.').$other_soa['origin']; + } + $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."')"); + } + + // if no more records exist for the ptr_soa, delete it + if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr_soa_exist['id']."'")){ + $app->db->query("DELETE FROM soa WHERE id = ".$ptr_soa_exist['id']); + } else { // increment serial + $serial_date = substr($ptr_soa_exist['serial'], 0, 8); + $count = intval(substr($ptr_soa_exist['serial'], 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']); + } + } + } + } + } + } + + // delete associated records + $app->db->query("DELETE FROM rr WHERE zone = ".$_REQUEST['id']); + + parent::onDelete(); + } + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/dns/soa_edit.php b/interface/web/dns/soa_edit.php new file mode 100644 index 0000000..4f3179b --- /dev/null +++ b/interface/web/dns/soa_edit.php @@ -0,0 +1,145 @@ +<?php +/* +Copyright (c) 2005, Till Brehm, projektfarm Gmbh +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. +*/ + + +/****************************************** +* Begin Form configuration +******************************************/ + +$tform_def_file = "form/soa.tform.php"; + +/****************************************** +* End Form configuration +******************************************/ + +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onSubmit() { + global $app, $conf; + + // update serial + $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["id"]); + $serial = $soa['serial']; + $update = 0; + if($old_record = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["id"])){ + foreach($old_record as $key => $val){ + if($this->dataRecord[$key] != $val && $key != 'active') $update += 1; + } + } else { // new record + $update = 1; + } + if($update > 0){ + $serial_date = substr($serial, 0, 8); + $count = intval(substr($serial, 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + $this->dataRecord["serial"] = $new_serial; + } + + // update rr if origin has changed + if($soa['origin'] != $this->dataRecord['origin']){ + /* + if($rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = ".$soa['id'])){ + foreach($rrs as $rr){ + if(substr($rr['name'], -(strlen($this->dataRecord['origin']))) != $this->dataRecord['origin']) $app->db->query("UPDATE rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE id = ".$rr['id']); + if(substr($rr['data'], -(strlen($this->dataRecord['origin']))) != $this->dataRecord['origin']) $app->db->query("UPDATE rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE id = ".$rr['id']); + } + } + */ + if($rrs = $app->db->queryAllRecords("SELECT * FROM rr")){ + $update_soas = array(); + foreach($rrs as $rr){ + if($soa['origin'] == substr($rr['name'], -(strlen($soa['origin']))) || $soa['origin'] == substr($rr['data'], -(strlen($soa['origin'])))) $update_soas[] = $rr['zone']; + //$update_soas[] = $app->db->queryAllRecords("SELECT DISTINCT zone FROM rr WHERE name LIKE '%".$soa['origin']."' OR data LIKE '%".$soa['origin']."'"); + + $app->db->query("UPDATE rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type != 'PTR'"); + $app->db->query("UPDATE rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type != 'PTR'"); + + if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){ + $app->db->query("UPDATE rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type = 'PTR'"); + $app->db->query("UPDATE rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type = 'PTR'"); + } + } + + // increase serial + if(!empty($update_soas)){ + //print_r($update_soas); + //die(); + $update_soas = array_unique($update_soas); + foreach($update_soas as $update_soa){ + $u_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$update_soa); + $serial_date = substr($u_soa['serial'], 0, 8); + $count = intval(substr($u_soa['serial'], 8, 2)); + $current_date = date("Ymd"); + if($serial_date == $current_date){ + $count += 1; + $count = str_pad($count, 2, "0", STR_PAD_LEFT); + $new_serial = $current_date.$count; + } else { + $new_serial = $current_date.'01'; + } + if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){ + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$update_soa); + } else { + $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$update_soa." AND origin NOT LIKE '%.in-addr.arpa.'"); + } + } + } + } + } + + + parent::onSubmit(); + } + +} + +$app->tform_actions = new page_action; +$app->tform_actions->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/dns/soa_list.php b/interface/web/dns/soa_list.php new file mode 100644 index 0000000..73407de --- /dev/null +++ b/interface/web/dns/soa_list.php @@ -0,0 +1,26 @@ +<?php +require_once('../../lib/config.inc.php'); +require_once('../../lib/app.inc.php'); + +/****************************************** +* Begin Form configuration +******************************************/ + +$list_def_file = "list/soa.list.php"; + +/****************************************** +* End Form configuration +******************************************/ + +// Checking module permissions +if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) { + header("Location: ../index.php"); + exit; +} + +$app->uses('listform_actions'); + +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/dns/templates/rr_edit.htm b/interface/web/dns/templates/rr_edit.htm new file mode 100644 index 0000000..77bcaee --- /dev/null +++ b/interface/web/dns/templates/rr_edit.htm @@ -0,0 +1,40 @@ +<table width="500" border="0" cellspacing="0" cellpadding="2"> + <!--<tr> + <td width="126" class="frmText11">{tmpl_var name='zone_txt'}:</td> + <td width="366" class="frmText11"><input name="zone" type="text" class="text" value="{tmpl_var name='zone'}" size="30" maxlength="255"></td> + </tr>//--> + <tr> + <td width="126" class="frmText11">{tmpl_var name='name_txt'}:</td> + <td width="366" class="frmText11"><input name="name" type="text" class="text" value="{tmpl_var name='name'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='type_txt'}:</td> + <td width="366" class="frmText11"> + <select name="type" class="text"> + {tmpl_var name='type'} + </select> + </td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='data_txt'}:</td> + <td width="366" class="frmText11"><input name="data" type="text" class="text" value="{tmpl_var name='data'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='aux_txt'}:</td> + <td width="366" class="frmText11"><input name="aux" type="text" class="text" value="{tmpl_var name='aux'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='ttl_txt'}:</td> + <td width="366" class="frmText11"><input name="ttl" type="text" class="text" value="{tmpl_var name='ttl'}" size="30" maxlength="255"></td> + </tr> <tr> + <td class="frmText11"> </td> + <td class="frmText11"> </td> + </tr> + <tr> + <td> </td> + <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}"> + <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='rr_list.php';"> + </td> + </tr> +</table> +<input type="hidden" name="id" value="{tmpl_var name='id'}"> \ No newline at end of file diff --git a/interface/web/dns/templates/rr_list.htm b/interface/web/dns/templates/rr_list.htm new file mode 100644 index 0000000..fe6ac79 --- /dev/null +++ b/interface/web/dns/templates/rr_list.htm @@ -0,0 +1,45 @@ +<script language="JavaScript"> +<!-- + +function del_record(link) { + if(window.confirm("Wollen Sie den Datensatz l�schen?")) { + location.href = link; + } +} + +//--> +</script> +<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br /> +<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='rr_edit.php'" /><br /><br /> +<table width="100%" border="0" cellspacing="0" cellpadding="4"> + <tr> + <td class="tblHead"><tmpl_var name="name_txt"></td> + <td class="tblHead"><tmpl_var name="type_txt"></td> + <td class="tblHead"><tmpl_var name="data_txt"></td> + <td class="tblHead"><tmpl_var name="aux_txt"></td> + <td class="tblHead"><tmpl_var name="ttl_txt"></td> + <td class="tblHead"> </td> + </tr> + <tr> + <td class="frmText11"><input type="text" name="search_name" value="{tmpl_var name='search_name'}" class="text" /></td> + <td class="frmText11"><select name="search_type" onChange="document.myform.submit();">{tmpl_var name='search_type'}</select></td> + <td class="frmText11"><input type="text" name="search_data" value="{tmpl_var name='search_data'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_aux" value="{tmpl_var name='search_aux'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_ttl" value="{tmpl_var name='search_ttl'}" class="text" /></td> + <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td> + </tr> + <tmpl_loop name="records"> + <tr bgcolor="{tmpl_var name="bgcolor"}"> + <td class="frmText11"><a href="rr_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="name"}</a></td> + <td class="frmText11"><a href="rr_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="type"}</a></td> + <td class="frmText11"><a href="rr_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="data"}</a></td> + <td class="frmText11"><a href="rr_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="aux"}</a></td> + <td class="frmText11"><a href="rr_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="ttl"}</a></td> + <td class="frmText11" align="right">[<a href="javascript: del_record('rr_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td> + </tr> + </tmpl_loop> + + <tr> + <td colspan="6" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td> + </tr> +</table> \ No newline at end of file diff --git a/interface/web/dns/templates/soa_edit.htm b/interface/web/dns/templates/soa_edit.htm new file mode 100644 index 0000000..bd24e73 --- /dev/null +++ b/interface/web/dns/templates/soa_edit.htm @@ -0,0 +1,56 @@ +<table width="500" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td width="126" class="frmText11">{tmpl_var name='origin_txt'}:</td> + <td width="366" class="frmText11"><input name="origin" type="text" class="text" value="{tmpl_var name='origin'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='ns_txt'}:</td> + <td width="366" class="frmText11"><input name="ns" type="text" class="text" value="{tmpl_var name='ns'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='mbox_txt'}:</td> + <td width="366" class="frmText11"><input name="mbox" type="text" class="text" value="{tmpl_var name='mbox'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='serial_txt'}:</td> + <td width="366" class="frmText11"><input name="serial" type="text" class="text" value="{tmpl_var name='serial'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='refresh_txt'}:</td> + <td width="366" class="frmText11"><input name="refresh" type="text" class="text" value="{tmpl_var name='refresh'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='retry_txt'}:</td> + <td width="366" class="frmText11"><input name="retry" type="text" class="text" value="{tmpl_var name='retry'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='expire_txt'}:</td> + <td width="366" class="frmText11"><input name="expire" type="text" class="text" value="{tmpl_var name='expire'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='minimum_txt'}:</td> + <td width="366" class="frmText11"><input name="minimum" type="text" class="text" value="{tmpl_var name='minimum'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='ttl_txt'}:</td> + <td width="366" class="frmText11"><input name="ttl" type="text" class="text" value="{tmpl_var name='ttl'}" size="30" maxlength="255"></td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='active_txt'}:</td> + <td width="366" class="frmText11">{tmpl_var name='active'}</td> + </tr> + <tr> + <td width="126" class="frmText11">{tmpl_var name='xfer_txt'}:</td> + <td width="366" class="frmText11"><input name="xfer" type="text" class="text" value="{tmpl_var name='xfer'}" size="30" maxlength="255"></td> + </tr> <tr> + <td class="frmText11"> </td> + <td class="frmText11"> </td> + </tr> + <tr> + <td> </td> + <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}"> + <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='soa_list.php';"> + </td> + </tr> +</table> +<input type="hidden" name="id" value="{tmpl_var name='id'}"> \ No newline at end of file diff --git a/interface/web/dns/templates/soa_edit_rr.htm b/interface/web/dns/templates/soa_edit_rr.htm new file mode 100644 index 0000000..a40b38b --- /dev/null +++ b/interface/web/dns/templates/soa_edit_rr.htm @@ -0,0 +1,16 @@ +<table width="500" border="0" cellspacing="0" cellpadding="2"> + <tr> + <td class="frmText11" colspan="2">{tmpl_var name='rr_list'}</td> + </tr> + <tr> + <td class="frmText11"> </td> + <td class="frmText11"> </td> + </tr> + <tr> + <td> </td> + <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}"> + <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='soa_list.php';"> + </td> + </tr> +</table> +<input type="hidden" name="id" value="{tmpl_var name='id'}"> \ No newline at end of file diff --git a/interface/web/dns/templates/soa_list.htm b/interface/web/dns/templates/soa_list.htm new file mode 100644 index 0000000..42c3faa --- /dev/null +++ b/interface/web/dns/templates/soa_list.htm @@ -0,0 +1,54 @@ +<form name="myform" action="soa_list.php" method="POST"> +<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br /> +<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='soa_edit.php'" /><br /><br /> +<table width="100%" border="0" cellspacing="0" cellpadding="4"> + <tr> + <td class="tblHead"><tmpl_var name="origin_txt"></td> + <td class="tblHead"><tmpl_var name="ns_txt"></td> + <td class="tblHead"><tmpl_var name="mbox_txt"></td> + <td class="tblHead"><tmpl_var name="serial_txt"></td> + <td class="tblHead"><tmpl_var name="refresh_txt"></td> + <td class="tblHead"><tmpl_var name="retry_txt"></td> + <td class="tblHead"><tmpl_var name="expire_txt"></td> + <td class="tblHead"><tmpl_var name="minimum_txt"></td> + <td class="tblHead"><tmpl_var name="ttl_txt"></td> + <td class="tblHead"><tmpl_var name="active_txt"></td> + <td class="tblHead"><tmpl_var name="xfer_txt"></td> + <td class="tblHead"> </td> + </tr> + <tr> + <td class="frmText11"><input type="text" name="search_origin" value="{tmpl_var name='search_origin'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_ns" value="{tmpl_var name='search_ns'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_mbox" value="{tmpl_var name='search_mbox'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_serial" value="{tmpl_var name='search_serial'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_refresh" value="{tmpl_var name='search_refresh'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_retry" value="{tmpl_var name='search_retry'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_expire" value="{tmpl_var name='search_expire'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_minimum" value="{tmpl_var name='search_minimum'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_ttl" value="{tmpl_var name='search_ttl'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_active" value="{tmpl_var name='search_active'}" class="text" /></td> + <td class="frmText11"><input type="text" name="search_xfer" value="{tmpl_var name='search_xfer'}" class="text" /></td> + <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td> + </tr> + <tmpl_loop name="records"> + <tr bgcolor="{tmpl_var name="bgcolor"}"> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="origin"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="ns"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="mbox"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="serial"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="refresh"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="retry"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="expire"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="minimum"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="ttl"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="active"}</a></td> + <td class="frmText11"><a href="soa_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="xfer"}</a></td> + <td class="frmText11" align="right">[<a href="javascript: del_record('soa_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td> + </tr> + </tmpl_loop> + + <tr> + <td colspan="12" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td> + </tr> +</table> +</form> \ No newline at end of file -- Gitblit v1.9.1