diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 9b32e27ddd6dfed84fb0993953e58443ad2fccfa..a7f821a799193b465a775b79bc4d402d2c2302c2 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -1,931 +1,944 @@
-tableDef = $table;
- $this->table_name = $table_name;
- $this->table_index = $table_index;
- return true;
- }
- */
-
- function loadFormDef($file,$module = '') {
- global $app,$conf;
-
- include_once($file);
- $this->formDef = $form;
-
- $this->module = $module;
- if($module == '') {
- include_once("lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
- } else {
- include_once("../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
- }
- $this->wordbook = $wb;
-
- return true;
- }
-
-
- /**
- * Konvertiert die Daten des übergebenen assoziativen
- * Arrays in "menschenlesbare" Form.
- * Datentyp Konvertierung, z.B. für Ausgabe in Listen.
- *
- * @param record
- * @return record
- */
- function decode($record,$tab) {
- if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
- if(is_array($record)) {
- foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
- switch ($field['datatype']) {
- case 'VARCHAR':
- $new_record[$key] = stripslashes($record[$key]);
- break;
-
- case 'TEXT':
- $new_record[$key] = stripslashes($record[$key]);
- break;
-
- case 'DATE':
- if($record[$key] > 0) {
- $new_record[$key] = date($this->dateformat,$record[$key]);
- }
- break;
-
- case 'INTEGER':
- $new_record[$key] = intval($record[$key]);
- break;
-
- case 'DOUBLE':
- $new_record[$key] = $record[$key];
- break;
-
- case 'CURRENCY':
- $new_record[$key] = number_format($record[$key], 2, ',', '');
- break;
-
- default:
- $new_record[$key] = stripslashes($record[$key]);
- }
- }
-
- }
- return $new_record;
- }
-
- /**
- * Get the key => value array of a form filed from a datasource definitiom
- *
- * @param field = array with field definition
- * @param record = Dataset as array
- * @return key => value array for the value field of a form
- */
-
- function getDatasourceData($field, $record) {
- global $app;
-
- $values = array();
-
- if($field["datasource"]["type"] == 'SQL') {
-
- // Preparing SQL string. We will replace some
- // common placeholders
- $querystring = $field["datasource"]["querystring"];
- $querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
- $querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
- $querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
- $table_idx = $this->formDef['db_table_idx'];
- $querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
- $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
-
- // Getting the records
- $tmp_records = $app->db->queryAllRecords($querystring);
- if($app->db->errorMessage != '') die($app->db->errorMessage);
- if(is_array($tmp_records)) {
- $key_field = $field["datasource"]["keyfield"];
- $value_field = $field["datasource"]["valuefield"];
- foreach($tmp_records as $tmp_rec) {
- $tmp_id = $tmp_rec[$key_field];
- $values[$tmp_id] = $tmp_rec[$value_field];
- }
- }
- }
-
- if($field["datasource"]["type"] == 'CUSTOM') {
- // Calls a custom class to validate this record
- if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
- $datasource_class = $field["datasource"]['class'];
- $datasource_function = $field["datasource"]['function'];
- $app->uses($datasource_class);
- $values = $app->$datasource_class->$datasource_function($field, $record);
- } else {
- $this->errorMessage .= "Custom datasource class or function is empty \r\n";
- }
- }
-
- return $values;
-
- }
-
-
- /**
- * Record für Ausgabe in Formularen vorbereiten.
- *
- * @param record = Datensatz als Array
- * @param action = NEW oder EDIT
- * @return record
- */
- function getHTML($record, $tab, $action = 'NEW') {
-
- global $app;
-
- $this->action = $action;
-
- if(!is_array($this->formDef)) $app->error("Keine Formdefinition vorhanden.");
- if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-
- $new_record = array();
- if($action == 'EDIT') {
- $record = $this->decode($record,$tab);
- if(is_array($record)) {
- foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
- $val = $record[$key];
-
- // If Datasource is set, get the data from there
- if(is_array($field['datasource'])) {
- $field["value"] = $this->getDatasourceData($field, $record);
- }
-
- switch ($field['formtype']) {
- case 'SELECT':
- if(is_array($field['value'])) {
- $out = '';
- foreach($field['value'] as $k => $v) {
- $selected = ($k == $val)?' SELECTED':'';
- $out .= "\r\n";
- }
- }
- $new_record[$key] = $out;
- break;
- case 'MULTIPLE':
- if(is_array($field['value'])) {
-
- // aufsplitten ergebnisse
- $vals = explode($field['separator'],$val);
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
-
- $selected = '';
- foreach($vals as $tvl) {
- if(trim($tvl) == trim($k)) $selected = ' SELECTED';
- }
-
- $out .= "\r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- case 'PASSWORD':
- $new_record[$key] = '';
- break;
-
- case 'CHECKBOX':
- $checked = (empty($val))?'':' CHECKED';
- $new_record[$key] = "\r\n";
- break;
-
- case 'CHECKBOXARRAY':
- if(is_array($field['value'])) {
-
- // aufsplitten ergebnisse
- $vals = explode($field['separator'],$val);
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
-
- $checked = '';
- foreach($vals as $tvl) {
- if(trim($tvl) == trim($k)) $checked = ' CHECKED';
- }
-
- $out .= "$v \r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- case 'RADIO':
- if(is_array($field['value'])) {
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
- $checked = ($k == $val)?' CHECKED':'';
- $out .= " $v \r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- default:
- $new_record[$key] = htmlspecialchars($record[$key]);
- }
- }
- }
- } else {
- // Action: NEW
- foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
- // If Datasource is set, get the data from there
- if(is_array($field['datasource'])) {
- $field["value"] = $this->getDatasourceData($field, $record);
- }
-
- switch ($field['formtype']) {
- case 'SELECT':
- if(is_array($field['value'])) {
- $out = '';
- foreach($field['value'] as $k => $v) {
- $selected = ($k == $val)?' SELECTED':'';
- $out .= "\r\n";
- }
- }
- $new_record[$key] = $out;
- break;
- case 'MULTIPLE':
- if(is_array($field['value'])) {
-
- // aufsplitten ergebnisse
- $vals = explode($field['separator'],$val);
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
-
- $out .= "\r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- case 'PASSWORD':
- $new_record[$key] = '';
- break;
-
- case 'CHECKBOX':
- $checked = (empty($field["default"]))?'':' CHECKED';
- $new_record[$key] = "\r\n";
- break;
-
- case 'CHECKBOXARRAY':
- if(is_array($field['value'])) {
-
- // aufsplitten ergebnisse
- $vals = explode($field['separator'],$field["default"]);
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
-
- $checked = '';
- foreach($vals as $tvl) {
- if(trim($tvl) == trim($k)) $checked = ' CHECKED';
- }
-
- $out .= " $v \r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- case 'RADIO':
- if(is_array($field['value'])) {
-
- // HTML schreiben
- $out = '';
- foreach($field['value'] as $k => $v) {
- $checked = ($k == $field["default"])?' CHECKED':'';
- $out .= " $v \r\n";
- }
- }
- $new_record[$key] = $out;
- break;
-
- default:
- $new_record[$key] = htmlspecialchars($field['default']);
- }
- }
-
- }
-
- if($this->debug == 1) $this->dbg($new_record);
-
- return $new_record;
- }
-
- /**
- * Record in "maschinen lesbares" Format überführen
- * und Werte gegen reguläre Ausdrücke prüfen.
- *
- * @param record = Datensatz als Array
- * @return record
- */
- function encode($record,$tab) {
-
- if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
- //$this->errorMessage = '';
-
- if(is_array($record)) {
- foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
- if(is_array($field['validators'])) $this->validateField($key, $record[$key], $field['validators']);
-
- switch ($field['datatype']) {
- case 'VARCHAR':
- if(!is_array($record[$key])) {
- $new_record[$key] = addslashes($record[$key]);
- } else {
- $new_record[$key] = implode($field['separator'],$record[$key]);
- }
- break;
- case 'TEXT':
- if(!is_array($record[$key])) {
- $new_record[$key] = addslashes($record[$key]);
- } else {
- $new_record[$key] = implode($field['separator'],$record[$key]);
- }
- break;
- case 'DATE':
- if($record[$key] > 0) {
- list($tag,$monat,$jahr) = explode('.',$record[$key]);
- $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
- } else {
- $new_record[$key] = 0;
- }
- break;
- case 'INTEGER':
- $new_record[$key] = intval($record[$key]);
- //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
- //if($key == 'refresh') die($record[$key]);
- break;
- case 'DOUBLE':
- $new_record[$key] = addslashes($record[$key]);
- break;
- case 'CURRENCY':
- $new_record[$key] = str_replace(",",".",$record[$key]);
- break;
- }
-
- // The use of the field value is deprecated, use validators instead
- if($field['regex'] != '') {
- // Enable that "." matches also newlines
- $field['regex'] .= 's';
- if(!preg_match($field['regex'], $record[$key])) {
- $errmsg = $field['errmsg'];
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- }
- }
-
-
- }
- }
- return $new_record;
- }
-
- /**
- * process the validators for a given field.
- *
- * @param field_name = Name of the field
- * @param field_value = value of the field
- * @param validatoors = Array of validators
- * @return record
- */
-
- function validateField($field_name, $field_value, $validators) {
-
- global $app;
-
- // loop trough the validators
- foreach($validators as $validator) {
-
- switch ($validator['type']) {
- case 'REGEX':
- $validator['regex'] .= 's';
- if(!preg_match($validator['regex'], $field_value)) {
- $errmsg = $validator['errmsg'];
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- }
- break;
- case 'UNIQUE':
- if($this->action == 'NEW') {
- $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
- if($num_rec["number"] > 0) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- } else {
- $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
- if($num_rec["number"] > 0) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- }
- break;
- case 'NOTEMPTY':
- if(empty($field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- break;
- case 'ISEMAIL':
- if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- break;
- case 'ISINT':
- $tmpval = intval($field_value);
- if($tmpval === 0 and !empty($field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- break;
- case 'ISPOSITIVE':
- if(!is_numeric($field_value) || $field_value <= 0){
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
- } else {
- $this->errorMessage .= $errmsg." \r\n";
- }
- }
- break;
- case 'CUSTOM':
- // Calls a custom class to validate this record
- if($validator['class'] != '' and $validator['function'] != '') {
- $validator_class = $validator['class'];
- $validator_function = $validator['function'];
- $app->uses($validator_class);
- $this->errorMessage .= $app->$validator_class->$validator_function($validator);
- } else {
- $this->errorMessage .= "Custom validator class or function is empty \r\n";
- }
- break;
- default:
- $this->errorMessage .= "Unknown Validator: ".$validator['type'];
- break;
- }
-
-
- }
-
- return true;
- }
-
- /**
- * SQL Statement für Record erzeugen.
- *
- * @param record = Datensatz als Array
- * @param action = INSERT oder UPDATE
- * @param primary_id
- * @return record
- */
- function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-
- global $app;
-
- // If there are no data records on the tab, return empty sql string
- if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
-
- // checking permissions
- if($this->formDef['auth'] == 'yes') {
- if($action == "INSERT") {
- if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied. \r\n";
- } else {
- if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Insert denied. \r\n";
- }
- }
-
- $this->action = $action;
- $this->primary_id = $primary_id;
-
- $record = $this->encode($record,$tab);
- $sql_insert_key = '';
- $sql_insert_val = '';
- $sql_update = '';
-
- if(!is_array($this->formDef)) $app->error("Keine Formulardefinition vorhanden.");
- if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
-
- // gehe durch alle Felder des Tabs
- if(is_array($record)) {
- foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
- // Wenn es kein leeres Passwortfeld ist
- if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
- // Erzeuge Insert oder Update Quelltext
- if($action == "INSERT") {
- if($field['formtype'] == 'PASSWORD') {
- $sql_insert_key .= "`$key`, ";
- if($field['encryption'] == 'CRYPT') {
- $sql_insert_val .= "'".crypt($record[$key])."', ";
- } else {
- $sql_insert_val .= "md5('".$record[$key]."'), ";
- }
- } else {
- $sql_insert_key .= "`$key`, ";
- $sql_insert_val .= "'".$record[$key]."', ";
- }
- } else {
- if($field['formtype'] == 'PASSWORD') {
- if($field['encryption'] == 'CRYPT') {
- $sql_update .= "`$key` = '".crypt($record[$key])."', ";
- } else {
- $sql_update .= "`$key` = md5('".$record[$key]."'), ";
- }
- } else {
- $sql_update .= "`$key` = '".$record[$key]."', ";
- }
- }
- }
- }
- }
-
-
- // Füge Backticks nur bei unvollständigen Tabellennamen ein
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
-
- if($action == "INSERT") {
- if($this->formDef['auth'] == 'yes') {
- // Setze User und Gruppe
- $sql_insert_key .= "`sys_userid`, ";
- $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
- $sql_insert_key .= "`sys_groupid`, ";
- $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
- $sql_insert_key .= "`sys_perm_user`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
- $sql_insert_key .= "`sys_perm_group`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
- $sql_insert_key .= "`sys_perm_other`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
- }
- $sql_insert_key = substr($sql_insert_key,0,-2);
- $sql_insert_val = substr($sql_insert_val,0,-2);
- $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
- } else {
- if($primary_id != 0) {
- $sql_update = substr($sql_update,0,-2);
- $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
- if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
- } else {
- $app->error("Primary ID fehlt!");
- }
- }
-
- // Daten in History tabelle speichern
- if($this->errorMessage == '' and $this->formDef['db_history'] == 'yes') $this->datalogSave($action,$primary_id,$record);
- // die($sql);
- return $sql;
- }
-
- /**
- * Debugging arrays.
- *
- * @param array_data
- */
- function dbg($array_data) {
-
- echo "
";
- print_r($array_data);
- echo "
";
-
- }
-
-
- function showForm() {
- global $app,$conf;
-
- if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
-
- $active_tab = $this->getNextTab();
-
- // definiere Tabs
- foreach( $this->formDef["tabs"] as $key => $tab) {
-
- $tab['name'] = $key;
- if($tab['name'] == $active_tab) {
-
- // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
- if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
-
- // überprüfe, ob das Template existiert, wenn nicht
- // dann generiere das Template
- if(!is_file($tab["template"])) {
- $app->uses('tform_tpl_generator');
- $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
- }
-
- $app->tpl->setInclude('content_tpl',$tab["template"]);
- $tab["active"] = 1;
- $_SESSION["s"]["form"]["tab"] = $tab['name'];
- } else {
- $tab["active"] = 0;
- }
-
- // Die Datenfelder werden für die Tabs nicht benötigt
- unset($tab["fields"]);
- unset($tab["plugins"]);
-
- $frmTab[] = $tab;
- }
-
- // setting form tabs
- $app->tpl->setLoop("formTab", $frmTab);
-
- // Set form action
- $app->tpl->setVar('form_action',$this->formDef["action"]);
- $app->tpl->setVar('form_active_tab',$active_tab);
-
- // Set form title
- $form_hint = ''.$this->formDef["title"].'';
- if($this->formDef["description"] != '') $form_hint .= '
'.$this->formDef["description"];
- $app->tpl->setVar('form_hint',$form_hint);
-
- // Set Wordbook for this form
-
- $app->tpl->setVar($this->wordbook);
- }
-
-
-
- function datalogSave($action,$primary_id,$record_new) {
- global $app,$conf;
-
- // Füge Backticks nur bei unvollständigen Tabellennamen ein
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
- if($action == "UPDATE") {
- $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
- $record_old = $app->db->queryOneRecord($sql);
- } else {
- $record_old = array();
- }
-
- $diffrec = array();
-
- if(is_array($record_new)) {
- foreach($record_new as $key => $val) {
- if($record_old[$key] != $val) {
- // Datensatz hat sich geändert
- $diffrec[$key] = array('old' => $record_old[$key],
- 'new' => $val);
- }
- }
- }
-
- // Insert the server_id, if the record has a server_id
- $server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0;
-
- if(count($diffrec) > 0) {
-
- // We need the full records in ISPConfig, not only the diffs
- $diffrec = array( 'old' => $record_old,
- 'new' => $record_new);
-
- $diffstr = $app->db->quote(serialize($diffrec));
- $username = $app->db->quote($_SESSION["s"]["user"]["username"]);
- $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
- $action = ($action == 'INSERT')?'i':'u';
- $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
- $app->db->query($sql);
- }
-
- return true;
-
- }
-
- function getAuthSQL($perm) {
-
- $sql = '(';
- $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
- $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
- $sql .= "sys_perm_other like '%$perm%'";
- $sql .= ')';
-
- return $sql;
- }
-
- /*
- Diese funktion überprüft, ob ein User die Berechtigung $perm für den Datensatz mit der ID $record_id
- hat. It record_id = 0, dann wird gegen die user Defaults des Formulares getestet.
- */
- function checkPerm($record_id,$perm) {
- global $app;
-
- if($record_id > 0) {
- // Füge Backticks nur bei unvollständigen Tabellennamen ein
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
- $sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
- if($record = $app->db->queryOneRecord($sql)) {
- return true;
- } else {
- return false;
- }
- } else {
- $result = false;
- if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
- if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
- if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
-
- // if preset == 0, everyone can insert a record of this type
- if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
-
- return $result;
-
- }
-
- }
-
- function getNextTab() {
- // Welcher Tab wird angezeigt
- if($this->errorMessage == '') {
- // wenn kein Fehler vorliegt
- if($_REQUEST["next_tab"] != '') {
- // wenn nächster Tab bekannt
- $active_tab = $_REQUEST["next_tab"];
- } else {
- // ansonsten ersten tab nehmen
- $active_tab = $this->formDef['tab_default'];
- }
- } else {
- // bei Fehlern den gleichen Tab nochmal anzeigen
- $active_tab = $_SESSION["s"]["form"]["tab"];
- }
-
- return $active_tab;
- }
-
- function getCurrentTab() {
- return $_SESSION["s"]["form"]["tab"];
- }
-
-}
-
+tableDef = $table;
+ $this->table_name = $table_name;
+ $this->table_index = $table_index;
+ return true;
+ }
+ */
+
+ function loadFormDef($file,$module = '') {
+ global $app,$conf;
+
+ include_once($file);
+ $this->formDef = $form;
+
+ $this->module = $module;
+ if($module == '') {
+ include_once("lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
+ } else {
+ include_once("../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng");
+ }
+ $this->wordbook = $wb;
+
+ return true;
+ }
+
+
+ /**
+ * Konvertiert die Daten des übergebenen assoziativen
+ * Arrays in "menschenlesbare" Form.
+ * Datentyp Konvertierung, z.B. für Ausgabe in Listen.
+ *
+ * @param record
+ * @return record
+ */
+ function decode($record,$tab) {
+ if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+ if(is_array($record)) {
+ foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+ switch ($field['datatype']) {
+ case 'VARCHAR':
+ $new_record[$key] = stripslashes($record[$key]);
+ break;
+
+ case 'TEXT':
+ $new_record[$key] = stripslashes($record[$key]);
+ break;
+
+ case 'DATE':
+ if($record[$key] > 0) {
+ $new_record[$key] = date($this->dateformat,$record[$key]);
+ }
+ break;
+
+ case 'INTEGER':
+ $new_record[$key] = intval($record[$key]);
+ break;
+
+ case 'DOUBLE':
+ $new_record[$key] = $record[$key];
+ break;
+
+ case 'CURRENCY':
+ $new_record[$key] = number_format($record[$key], 2, ',', '');
+ break;
+
+ default:
+ $new_record[$key] = stripslashes($record[$key]);
+ }
+ }
+
+ }
+ return $new_record;
+ }
+
+ /**
+ * Get the key => value array of a form filed from a datasource definitiom
+ *
+ * @param field = array with field definition
+ * @param record = Dataset as array
+ * @return key => value array for the value field of a form
+ */
+
+ function getDatasourceData($field, $record) {
+ global $app;
+
+ $values = array();
+
+ if($field["datasource"]["type"] == 'SQL') {
+
+ // Preparing SQL string. We will replace some
+ // common placeholders
+ $querystring = $field["datasource"]["querystring"];
+ $querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
+ $querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
+ $querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
+ $table_idx = $this->formDef['db_table_idx'];
+ $querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
+ $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
+
+ // Getting the records
+ $tmp_records = $app->db->queryAllRecords($querystring);
+ if($app->db->errorMessage != '') die($app->db->errorMessage);
+ if(is_array($tmp_records)) {
+ $key_field = $field["datasource"]["keyfield"];
+ $value_field = $field["datasource"]["valuefield"];
+ foreach($tmp_records as $tmp_rec) {
+ $tmp_id = $tmp_rec[$key_field];
+ $values[$tmp_id] = $tmp_rec[$value_field];
+ }
+ }
+ }
+
+ if($field["datasource"]["type"] == 'CUSTOM') {
+ // Calls a custom class to validate this record
+ if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+ $datasource_class = $field["datasource"]['class'];
+ $datasource_function = $field["datasource"]['function'];
+ $app->uses($datasource_class);
+ $values = $app->$datasource_class->$datasource_function($field, $record);
+ } else {
+ $this->errorMessage .= "Custom datasource class or function is empty \r\n";
+ }
+ }
+
+ return $values;
+
+ }
+
+
+ /**
+ * Record für Ausgabe in Formularen vorbereiten.
+ *
+ * @param record = Datensatz als Array
+ * @param action = NEW oder EDIT
+ * @return record
+ */
+ function getHTML($record, $tab, $action = 'NEW') {
+
+ global $app;
+
+ $this->action = $action;
+
+ if(!is_array($this->formDef)) $app->error("Keine Formdefinition vorhanden.");
+ if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+
+ $new_record = array();
+ if($action == 'EDIT') {
+ $record = $this->decode($record,$tab);
+ if(is_array($record)) {
+ foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+ $val = $record[$key];
+
+ // If Datasource is set, get the data from there
+ if(is_array($field['datasource'])) {
+ $field["value"] = $this->getDatasourceData($field, $record);
+ }
+
+ switch ($field['formtype']) {
+ case 'SELECT':
+ if(is_array($field['value'])) {
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+ $selected = ($k == $val)?' SELECTED':'';
+ $out .= "\r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+ case 'MULTIPLE':
+ if(is_array($field['value'])) {
+
+ // aufsplitten ergebnisse
+ $vals = explode($field['separator'],$val);
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+
+ $selected = '';
+ foreach($vals as $tvl) {
+ if(trim($tvl) == trim($k)) $selected = ' SELECTED';
+ }
+
+ $out .= "\r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ case 'PASSWORD':
+ $new_record[$key] = '';
+ break;
+
+ case 'CHECKBOX':
+ $checked = ($val == $field['value'][1])?' CHECKED':'';
+ $new_record[$key] = "\r\n";
+ break;
+
+ case 'CHECKBOXARRAY':
+ if(is_array($field['value'])) {
+
+ // aufsplitten ergebnisse
+ $vals = explode($field['separator'],$val);
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+
+ $checked = '';
+ foreach($vals as $tvl) {
+ if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+ }
+
+ $out .= "$v \r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ case 'RADIO':
+ if(is_array($field['value'])) {
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+ $checked = ($k == $val)?' CHECKED':'';
+ $out .= " $v \r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ default:
+ $new_record[$key] = htmlspecialchars($record[$key]);
+ }
+ }
+ }
+ } else {
+ // Action: NEW
+ foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+ // If Datasource is set, get the data from there
+ if(is_array($field['datasource'])) {
+ $field["value"] = $this->getDatasourceData($field, $record);
+ }
+
+ switch ($field['formtype']) {
+ case 'SELECT':
+ if(is_array($field['value'])) {
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+ $selected = ($k == $val)?' SELECTED':'';
+ $out .= "\r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+ case 'MULTIPLE':
+ if(is_array($field['value'])) {
+
+ // aufsplitten ergebnisse
+ $vals = explode($field['separator'],$val);
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+
+ $out .= "\r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ case 'PASSWORD':
+ $new_record[$key] = '';
+ break;
+
+ case 'CHECKBOX':
+ // $checked = (empty($field["default"]))?'':' CHECKED';
+ $checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
+ $new_record[$key] = "\r\n";
+ break;
+
+ case 'CHECKBOXARRAY':
+ if(is_array($field['value'])) {
+
+ // aufsplitten ergebnisse
+ $vals = explode($field['separator'],$field["default"]);
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+
+ $checked = '';
+ foreach($vals as $tvl) {
+ if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+ }
+
+ $out .= " $v \r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ case 'RADIO':
+ if(is_array($field['value'])) {
+
+ // HTML schreiben
+ $out = '';
+ foreach($field['value'] as $k => $v) {
+ $checked = ($k == $field["default"])?' CHECKED':'';
+ $out .= " $v \r\n";
+ }
+ }
+ $new_record[$key] = $out;
+ break;
+
+ default:
+ $new_record[$key] = htmlspecialchars($field['default']);
+ }
+ }
+
+ }
+
+ if($this->debug == 1) $this->dbg($new_record);
+
+ return $new_record;
+ }
+
+ /**
+ * Record in "maschinen lesbares" Format überführen
+ * und Werte gegen reguläre Ausdrücke prüfen.
+ *
+ * @param record = Datensatz als Array
+ * @return record
+ */
+ function encode($record,$tab) {
+
+ if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+ //$this->errorMessage = '';
+
+ if(is_array($record)) {
+ foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+ if(is_array($field['validators'])) $this->validateField($key, $record[$key], $field['validators']);
+
+ switch ($field['datatype']) {
+ case 'VARCHAR':
+ if(!is_array($record[$key])) {
+ $new_record[$key] = addslashes($record[$key]);
+ } else {
+ $new_record[$key] = implode($field['separator'],$record[$key]);
+ }
+ break;
+ case 'TEXT':
+ if(!is_array($record[$key])) {
+ $new_record[$key] = addslashes($record[$key]);
+ } else {
+ $new_record[$key] = implode($field['separator'],$record[$key]);
+ }
+ break;
+ case 'DATE':
+ if($record[$key] > 0) {
+ list($tag,$monat,$jahr) = explode('.',$record[$key]);
+ $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+ } else {
+ $new_record[$key] = 0;
+ }
+ break;
+ case 'INTEGER':
+ $new_record[$key] = intval($record[$key]);
+ //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+ //if($key == 'refresh') die($record[$key]);
+ break;
+ case 'DOUBLE':
+ $new_record[$key] = addslashes($record[$key]);
+ break;
+ case 'CURRENCY':
+ $new_record[$key] = str_replace(",",".",$record[$key]);
+ break;
+ }
+
+ // The use of the field value is deprecated, use validators instead
+ if($field['regex'] != '') {
+ // Enable that "." matches also newlines
+ $field['regex'] .= 's';
+ if(!preg_match($field['regex'], $record[$key])) {
+ $errmsg = $field['errmsg'];
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ }
+ }
+
+
+ }
+ }
+ return $new_record;
+ }
+
+ /**
+ * process the validators for a given field.
+ *
+ * @param field_name = Name of the field
+ * @param field_value = value of the field
+ * @param validatoors = Array of validators
+ * @return record
+ */
+
+ function validateField($field_name, $field_value, $validators) {
+
+ global $app;
+
+ // loop trough the validators
+ foreach($validators as $validator) {
+
+ switch ($validator['type']) {
+ case 'REGEX':
+ $validator['regex'] .= 's';
+ if(!preg_match($validator['regex'], $field_value)) {
+ $errmsg = $validator['errmsg'];
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ }
+ break;
+ case 'UNIQUE':
+ if($this->action == 'NEW') {
+ $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+ if($num_rec["number"] > 0) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ } else {
+ $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+ if($num_rec["number"] > 0) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ }
+ break;
+ case 'NOTEMPTY':
+ if(empty($field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ break;
+ case 'ISEMAIL':
+ if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ break;
+ case 'ISINT':
+ $tmpval = intval($field_value);
+ if($tmpval === 0 and !empty($field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ break;
+ case 'ISPOSITIVE':
+ if(!is_numeric($field_value) || $field_value <= 0){
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]." \r\n";
+ } else {
+ $this->errorMessage .= $errmsg." \r\n";
+ }
+ }
+ break;
+ case 'CUSTOM':
+ // Calls a custom class to validate this record
+ if($validator['class'] != '' and $validator['function'] != '') {
+ $validator_class = $validator['class'];
+ $validator_function = $validator['function'];
+ $app->uses($validator_class);
+ $this->errorMessage .= $app->$validator_class->$validator_function($validator);
+ } else {
+ $this->errorMessage .= "Custom validator class or function is empty \r\n";
+ }
+ break;
+ default:
+ $this->errorMessage .= "Unknown Validator: ".$validator['type'];
+ break;
+ }
+
+
+ }
+
+ return true;
+ }
+
+ /**
+ * SQL Statement für Record erzeugen.
+ *
+ * @param record = Datensatz als Array
+ * @param action = INSERT oder UPDATE
+ * @param primary_id
+ * @return record
+ */
+ function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
+
+ global $app;
+
+ // If there are no data records on the tab, return empty sql string
+ if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
+
+ // checking permissions
+ if($this->formDef['auth'] == 'yes') {
+ if($action == "INSERT") {
+ if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied. \r\n";
+ } else {
+ if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Insert denied. \r\n";
+ }
+ }
+
+ $this->action = $action;
+ $this->primary_id = $primary_id;
+
+ $record = $this->encode($record,$tab);
+ $sql_insert_key = '';
+ $sql_insert_val = '';
+ $sql_update = '';
+
+ if(!is_array($this->formDef)) $app->error("Keine Formulardefinition vorhanden.");
+ if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab).");
+
+ // gehe durch alle Felder des Tabs
+ if(is_array($record)) {
+ foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+ // Wenn es kein leeres Passwortfeld ist
+ if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+ // Erzeuge Insert oder Update Quelltext
+ if($action == "INSERT") {
+ if($field['formtype'] == 'PASSWORD') {
+ $sql_insert_key .= "`$key`, ";
+ if($field['encryption'] == 'CRYPT') {
+ $sql_insert_val .= "'".crypt($record[$key])."', ";
+ } else {
+ $sql_insert_val .= "md5('".$record[$key]."'), ";
+ }
+ } elseif ($field['formtype'] == 'CHECKBOX') {
+ $sql_insert_key .= "`$key`, ";
+ if($record[$key] == '') {
+ $sql_insert_val .= "'".$field['value'][0]."', ";
+ } else {
+ $sql_insert_val .= "'".$record[$key]."', ";
+ }
+ } else {
+ $sql_insert_key .= "`$key`, ";
+ $sql_insert_val .= "'".$record[$key]."', ";
+ }
+ } else {
+ if($field['formtype'] == 'PASSWORD') {
+ if($field['encryption'] == 'CRYPT') {
+ $sql_update .= "`$key` = '".crypt($record[$key])."', ";
+ } else {
+ $sql_update .= "`$key` = md5('".$record[$key]."'), ";
+ }
+ } elseif ($field['formtype'] == 'CHECKBOX') {
+ if($record[$key] == '') {
+ $sql_update .= "`$key` = '".$field['value'][0]."', ";
+ } else {
+ $sql_update .= "`$key` = '".$record[$key]."', ";
+ }
+ } else {
+ $sql_update .= "`$key` = '".$record[$key]."', ";
+ }
+ }
+ }
+ }
+ }
+
+
+ // Füge Backticks nur bei unvollständigen Tabellennamen ein
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+
+ if($action == "INSERT") {
+ if($this->formDef['auth'] == 'yes') {
+ // Setze User und Gruppe
+ $sql_insert_key .= "`sys_userid`, ";
+ $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
+ $sql_insert_key .= "`sys_groupid`, ";
+ $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
+ $sql_insert_key .= "`sys_perm_user`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+ $sql_insert_key .= "`sys_perm_group`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+ $sql_insert_key .= "`sys_perm_other`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+ }
+ $sql_insert_key = substr($sql_insert_key,0,-2);
+ $sql_insert_val = substr($sql_insert_val,0,-2);
+ $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+ } else {
+ if($primary_id != 0) {
+ $sql_update = substr($sql_update,0,-2);
+ $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+ } else {
+ $app->error("Primary ID fehlt!");
+ }
+ }
+
+ // Daten in History tabelle speichern
+ if($this->errorMessage == '' and $this->formDef['db_history'] == 'yes') $this->datalogSave($action,$primary_id,$record);
+ return $sql;
+ }
+
+ /**
+ * Debugging arrays.
+ *
+ * @param array_data
+ */
+ function dbg($array_data) {
+
+ echo "
";
+ print_r($array_data);
+ echo "
";
+
+ }
+
+
+ function showForm() {
+ global $app,$conf;
+
+ if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+
+ $active_tab = $this->getNextTab();
+
+ // definiere Tabs
+ foreach( $this->formDef["tabs"] as $key => $tab) {
+
+ $tab['name'] = $key;
+ if($tab['name'] == $active_tab) {
+
+ // Wenn Modul gesetzt, dann setzte template pfad relativ zu modul.
+ if($this->module != '') $tab["template"] = "../".$this->module."/".$tab["template"];
+
+ // überprüfe, ob das Template existiert, wenn nicht
+ // dann generiere das Template
+ if(!is_file($tab["template"])) {
+ $app->uses('tform_tpl_generator');
+ $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
+ }
+
+ $app->tpl->setInclude('content_tpl',$tab["template"]);
+ $tab["active"] = 1;
+ $_SESSION["s"]["form"]["tab"] = $tab['name'];
+ } else {
+ $tab["active"] = 0;
+ }
+
+ // Die Datenfelder werden für die Tabs nicht benötigt
+ unset($tab["fields"]);
+ unset($tab["plugins"]);
+
+ $frmTab[] = $tab;
+ }
+
+ // setting form tabs
+ $app->tpl->setLoop("formTab", $frmTab);
+
+ // Set form action
+ $app->tpl->setVar('form_action',$this->formDef["action"]);
+ $app->tpl->setVar('form_active_tab',$active_tab);
+
+ // Set form title
+ $form_hint = ''.$this->formDef["title"].'';
+ if($this->formDef["description"] != '') $form_hint .= '
'.$this->formDef["description"];
+ $app->tpl->setVar('form_hint',$form_hint);
+
+ // Set Wordbook for this form
+
+ $app->tpl->setVar($this->wordbook);
+ }
+
+
+
+ function datalogSave($action,$primary_id,$record_new) {
+ global $app,$conf;
+
+ // Füge Backticks nur bei unvollständigen Tabellennamen ein
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+ if($action == "UPDATE") {
+ $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ $record_old = $app->db->queryOneRecord($sql);
+ } else {
+ $record_old = array();
+ }
+
+ $diffrec = array();
+
+ if(is_array($record_new)) {
+ foreach($record_new as $key => $val) {
+ if($record_old[$key] != $val) {
+ // Datensatz hat sich geändert
+ $diffrec[$key] = array('old' => $record_old[$key],
+ 'new' => $val);
+ }
+ }
+ }
+
+ // Insert the server_id, if the record has a server_id
+ $server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0;
+
+ if(count($diffrec) > 0) {
+
+ // We need the full records in ISPConfig, not only the diffs
+ $diffrec = array( 'old' => $record_old,
+ 'new' => $record_new);
+
+ $diffstr = $app->db->quote(serialize($diffrec));
+ $username = $app->db->quote($_SESSION["s"]["user"]["username"]);
+ $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
+ $action = ($action == 'INSERT')?'i':'u';
+ $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+ $app->db->query($sql);
+ }
+
+ return true;
+
+ }
+
+ function getAuthSQL($perm) {
+
+ $sql = '(';
+ $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
+ $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
+ $sql .= "sys_perm_other like '%$perm%'";
+ $sql .= ')';
+
+ return $sql;
+ }
+
+ /*
+ Diese funktion überprüft, ob ein User die Berechtigung $perm für den Datensatz mit der ID $record_id
+ hat. It record_id = 0, dann wird gegen die user Defaults des Formulares getestet.
+ */
+ function checkPerm($record_id,$perm) {
+ global $app;
+
+ if($record_id > 0) {
+ // Füge Backticks nur bei unvollständigen Tabellennamen ein
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+ $sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
+ if($record = $app->db->queryOneRecord($sql)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ $result = false;
+ if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
+ if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
+ if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
+
+ // if preset == 0, everyone can insert a record of this type
+ if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
+
+ return $result;
+
+ }
+
+ }
+
+ function getNextTab() {
+ // Welcher Tab wird angezeigt
+ if($this->errorMessage == '') {
+ // wenn kein Fehler vorliegt
+ if($_REQUEST["next_tab"] != '') {
+ // wenn nächster Tab bekannt
+ $active_tab = $_REQUEST["next_tab"];
+ } else {
+ // ansonsten ersten tab nehmen
+ $active_tab = $this->formDef['tab_default'];
+ }
+ } else {
+ // bei Fehlern den gleichen Tab nochmal anzeigen
+ $active_tab = $_SESSION["s"]["form"]["tab"];
+ }
+
+ return $active_tab;
+ }
+
+ function getCurrentTab() {
+ return $_SESSION["s"]["form"]["tab"];
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/interface/web/dns/form/rr.tform.php b/interface/web/dns/form/rr.tform.php
index 0ce50378a2e892745573806aea28764c3ad1d817..0b3352a94ca5a173a410ef219e96c2e7eaf949f1 100644
--- a/interface/web/dns/form/rr.tform.php
+++ b/interface/web/dns/form/rr.tform.php
@@ -1,170 +1,170 @@
- 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',
- /*
- 'validators' => array (0 => array ('type' => 'ISINT',
- 'errmsg'=> 'rr_aux_error_noint'),
- ),
- */
- 'default' => '',
- 'value' => '',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'ttl' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ('type' => 'ISPOSITIVE',
- 'errmsg'=> 'rr_ttl_error_notpositive'),
- ),
- */
- 'default' => '86400',
- 'value' => '86400',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- ##################################
- # ENDE Datatable fields
- ##################################
- )
-);
-
-
+ 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',
+ /*
+ 'validators' => array (0 => array ('type' => 'ISINT',
+ 'errmsg'=> 'rr_aux_error_noint'),
+ ),
+ */
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ttl' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ('type' => 'ISPOSITIVE',
+ 'errmsg'=> 'rr_ttl_error_notpositive'),
+ ),
+ */
+ '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
index b456a79c0a3df751f14179ec116bd480e6c3c111..e5f961e1f32276266b37a0bf602448f6526d79c8 100644
--- a/interface/web/dns/form/soa.tform.php
+++ b/interface/web/dns/form/soa.tform.php
@@ -1,258 +1,258 @@
- 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' => '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',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'serial_error_notpositive'),
- ),
- */
- 'default' => date("Ymd").'01',
- 'value' => date("Ymd").'01',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'refresh' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'refresh_error_notpositive'),
- ),
- */
- 'default' => $conf['default_refresh'],
- 'value' => $conf['default_refresh'],
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'retry' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'retry_error_notpositive'),
- ),
- */
- 'default' => $conf['default_retry'],
- 'value' => $conf['default_retry'],
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'expire' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'expire_error_notpositive'),
- ),
- */
- 'default' => $conf['default_expire'],
- 'value' => $conf['default_expire'],
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'minimum' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'minimum_error_notpositive'),
- ),
- */
- 'default' => $conf['default_minimum_ttl'],
- 'value' => $conf['default_minimum_ttl'],
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'ttl' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- /*
- 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
- 'errmsg'=> 'ttl_error_notpositive'),
- ),
- */
- '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']))
- )
- )
-);
-
-
+ 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' => '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',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'serial_error_notpositive'),
+ ),
+ */
+ 'default' => date("Ymd").'01',
+ 'value' => date("Ymd").'01',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'refresh' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'refresh_error_notpositive'),
+ ),
+ */
+ 'default' => $conf['default_refresh'],
+ 'value' => $conf['default_refresh'],
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'retry' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'retry_error_notpositive'),
+ ),
+ */
+ 'default' => $conf['default_retry'],
+ 'value' => $conf['default_retry'],
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'expire' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'expire_error_notpositive'),
+ ),
+ */
+ 'default' => $conf['default_expire'],
+ 'value' => $conf['default_expire'],
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'minimum' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'minimum_error_notpositive'),
+ ),
+ */
+ 'default' => $conf['default_minimum_ttl'],
+ 'value' => $conf['default_minimum_ttl'],
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'ttl' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ /*
+ 'validators' => array (0 => array ( 'type' => 'ISPOSITIVE',
+ 'errmsg'=> 'ttl_error_notpositive'),
+ ),
+ */
+ '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/list/rr.list.php b/interface/web/dns/list/rr.list.php
index 127ffa66b72244e7266a48e70453d7c6c0046941..852c5153c7a6ffecaa40665c7c1aac77abd482f8 100644
--- a/interface/web/dns/list/rr.list.php
+++ b/interface/web/dns/list/rr.list.php
@@ -1,131 +1,131 @@
- "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' => "");
-
+ "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
index c41e88ea8cdbe2ebfaba86ddc3aed9ab6a587d30..fe4bcf594925ffae1c10aae554f8f47925f03cda 100644
--- a/interface/web/dns/list/soa.list.php
+++ b/interface/web/dns/list/soa.list.php
@@ -1,178 +1,178 @@
- "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' => "SELECT",
- 'op' => "=",
- 'prefix' => "",
- 'suffix' => "",
- 'width' => "",
- 'value' => array('Y' => $app->lng('Yes'), 'N' => $app->lng('No')));
-
-/*
-$liste["item"][] = array( 'field' => "xfer",
- 'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "LIKE",
- 'prefix' => "%",
- 'suffix' => "%",
- 'width' => "",
- 'value' => "");
-*/
+ "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' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => array('Y' => $app->lng('Yes'), 'N' => $app->lng('No')));
+
+/*
+$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
index e18122105d11f613c692e2ec5b75d82963727598..af379b03669c29865f5c9a97628b7aa0c9305738 100644
--- a/interface/web/dns/rr_del.php
+++ b/interface/web/dns/rr_del.php
@@ -1,139 +1,139 @@
-load('tform_actions');
-
-class page_action extends tform_actions {
-
- function onDelete() {
- global $app, $conf;
-
- $app->uses('tform');
- if(!$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->lng('error_no_permission'));
-
- //$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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- }
-
- // 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();
-
-
+load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onDelete() {
+ global $app, $conf;
+
+ $app->uses('tform');
+ if(!$rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->lng('error_no_permission'));
+
+ //$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']);
+ $zone_id = $rr['zone'];
+
+ // update serial
+ $soa = $app->db->queryOneRecord("SELECT * FROM dns_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 dns_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 dns_soa WHERE origin = '".$ptr_soa."'")){
+ if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_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 dns_rr WHERE (type = 'A' OR type = 'AAAA') AND data = '".$rr['data']."' AND id != ".$rr['id'])){
+ $other_soa = $app->db->queryOneRecord("SELECT * FROM dns_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 dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ }
+
+ // if no more records exist for the ptr_soa, delete it
+ if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."'")){
+ $app->db->query("DELETE FROM dns_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 dns_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
index 2686b2aa7ef62b0265a27d09dd42067085c0d51a..369183ca23f149fb7a1dda2c76ced4290555e86c 100644
--- a/interface/web/dns/rr_edit.php
+++ b/interface/web/dns/rr_edit.php
@@ -1,186 +1,186 @@
-uses('tpl,tform,tform_actions');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-
- function onSubmit() {
- global $app, $conf;
-
- if($this->dataRecord['id'] > 0){
- if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
- } else {
- if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
- }
-
- $this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id'];
-
- $app->uses('validate_dns');
- $app->tform->errorMessage .= $app->validate_dns->validate_rr($this->dataRecord);
-
- $increased_serials[] = -1;
- if($app->tform->errorMessage == ''){
- // 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 && isset($this->dataRecord[$key])) $update += 1;
- }
- } else { // new record
- $update = 1;
- }
-
- if($update > 0 && !in_array($soa['id'], $increased_serials)){
- $new_serial = $app->validate_dns->increase_serial($serial);
- $increased_serials[] = $soa['id'];
- $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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) 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', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- $ptr_soa_id = $app->db->insertID();
- $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- } 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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- // increase serial of PTR SOA
- if(!in_array($ptr_soa_exist['id'], $increased_serials)){
- $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
- $increased_serials[] = $ptr_soa_exist['id'];
- $app->db->query("UPDATE soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
- }
- }
- }
-
- // if IP address changes, delete/change old PTR record
- if(!empty($old_record)){
-
-
-
-
- list($oa, $ob, $oc, $od) = explode('.', $old_record['data']);
- $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
- $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$old_ptr_soa."'");
- if(substr($old_record['name'], -1) == '.'){
- $old_ptr_soa_rr_data = $old_record['name'];
- } else {
- $old_ptr_soa_rr_data = $old_record['name'].(trim($old_record['name']) == '' ? '' : '.').$soa['origin'];
- }
- if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR' AND data = '".$old_ptr_soa_rr_data."'")){
- parent::onSubmit();
- return true;
- }
-
- if($old_record['data'] == $this->dataRecord['data']){
- $a_rr_with_same_ip = $this->dataRecord;
- $a_rr_with_same_ip['origin'] = $soa['origin'];
- } else {
- $a_rr_with_same_ip = $app->db->queryOneRecord("SELECT rr.*, soa.origin FROM rr, soa WHERE rr.type = 'A' AND rr.data = '".$old_record['data']."' AND rr.zone = soa.id AND soa.active = 'Y' AND rr.id != ".$this->dataRecord["id"]);
- }
-
- if($a_rr_with_same_ip){
- if(substr($a_rr_with_same_ip['name'], -1) == '.'){
- $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
- } else {
- $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
- }
- $app->db->query("UPDATE rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
- // increase serial
- if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
- $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
- $increased_serials[] = $old_ptr_soa_exist['id'];
- $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
- }
- } else {
- $app->db->query("DELETE FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
- if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."'")){
- $app->db->query("DELETE FROM soa WHERE id = ".$old_ptr_soa_exist['id']);
- } else {
- // increase serial
- if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
- $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
- $increased_serials[] = $old_ptr_soa_exist['id'];
- $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
- }
- }
- }
- }
-
- }
- }
- }
-
-
- parent::onSubmit();
- }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onLoad();
-
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+
+ function onSubmit() {
+ global $app, $conf;
+
+ if($this->dataRecord['id'] > 0){
+ if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
+ } else {
+ if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
+ }
+
+ $this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id'];
+
+ $app->uses('validate_dns');
+ $app->tform->errorMessage .= $app->validate_dns->validate_rr($this->dataRecord);
+
+ $increased_serials[] = -1;
+ if($app->tform->errorMessage == ''){
+ // update serial
+ $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$this->dataRecord["zone"]);
+ $serial = $soa['serial'];
+ $update = 0;
+ if($old_record = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE id = ".$this->dataRecord["id"])){
+ foreach($old_record as $key => $val){
+ if($this->dataRecord[$key] != $val && isset($this->dataRecord[$key])) $update += 1;
+ }
+ } else { // new record
+ $update = 1;
+ }
+
+ if($update > 0 && !in_array($soa['id'], $increased_serials)){
+ $new_serial = $app->validate_dns->increase_serial($serial);
+ $increased_serials[] = $soa['id'];
+ $app->db->query("UPDATE dns_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 dns_soa WHERE origin = '".$ptr_soa."'")){
+ $app->db->query("INSERT INTO dns_soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) 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', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ $ptr_soa_id = $app->db->insertID();
+ $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ } else {
+ if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE dns_soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
+ if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
+ $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ // increase serial of PTR SOA
+ if(!in_array($ptr_soa_exist['id'], $increased_serials)){
+ $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
+ $increased_serials[] = $ptr_soa_exist['id'];
+ $app->db->query("UPDATE dns_soa SET serial = '".$ptr_soa_new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+ }
+ }
+ }
+
+ // if IP address changes, delete/change old PTR record
+ if(!empty($old_record)){
+
+
+
+
+ list($oa, $ob, $oc, $od) = explode('.', $old_record['data']);
+ $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
+ $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$old_ptr_soa."'");
+ if(substr($old_record['name'], -1) == '.'){
+ $old_ptr_soa_rr_data = $old_record['name'];
+ } else {
+ $old_ptr_soa_rr_data = $old_record['name'].(trim($old_record['name']) == '' ? '' : '.').$soa['origin'];
+ }
+ if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR' AND data = '".$old_ptr_soa_rr_data."'")){
+ parent::onSubmit();
+ return true;
+ }
+
+ if($old_record['data'] == $this->dataRecord['data']){
+ $a_rr_with_same_ip = $this->dataRecord;
+ $a_rr_with_same_ip['origin'] = $soa['origin'];
+ } else {
+ $a_rr_with_same_ip = $app->db->queryOneRecord("SELECT dns_rr.*, dns_soa.origin FROM dns_rr, dns_soa WHERE dns_rr.type = 'A' AND dns_rr.data = '".$old_record['data']."' AND dns_rr.zone = dns_soa.id AND dns_soa.active = 'Y' AND dns_rr.id != ".$this->dataRecord["id"]);
+ }
+
+ if($a_rr_with_same_ip){
+ if(substr($a_rr_with_same_ip['name'], -1) == '.'){
+ $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
+ } else {
+ $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
+ }
+ $app->db->query("UPDATE dns_rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
+ // increase serial
+ if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
+ $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
+ $increased_serials[] = $old_ptr_soa_exist['id'];
+ $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$old_ptr_soa_exist['id']);
+ }
+ } else {
+ $app->db->query("DELETE FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR'");
+ if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$old_ptr_soa_exist['id']."'")){
+ $app->db->query("DELETE FROM dns_soa WHERE id = ".$old_ptr_soa_exist['id']);
+ } else {
+ // increase serial
+ if(!in_array($old_ptr_soa_exist['id'], $increased_serials)){
+ $new_serial = $app->validate_dns->increase_serial($old_ptr_soa_exist['serial']);
+ $increased_serials[] = $old_ptr_soa_exist['id'];
+ $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$old_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/soa_del.php b/interface/web/dns/soa_del.php
index 20aed64a5d95d7ba415451729e8052043b7f7793..049bbef043e93dcecd2887c03dedb5db39655768 100644
--- a/interface/web/dns/soa_del.php
+++ b/interface/web/dns/soa_del.php
@@ -1,122 +1,122 @@
-load('tform_actions');
-
-class page_action extends tform_actions {
-
- function onDelete() {
- global $app, $conf;
-
- $app->uses('tform');
- if(!$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->tform->wordbook['error_no_permission']);
-
- // 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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- }
-
- // 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();
-
+load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onDelete() {
+ global $app, $conf;
+
+ $app->uses('tform');
+ if(!$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error($app->tform->wordbook['error_no_permission']);
+
+ // 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 dns_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 dns_soa WHERE origin = '".$ptr_soa."'")){
+ if($ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR' AND data = '".$ptr_soa_rr_data."'")){
+ $app->db->query("DELETE FROM dns_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 dns_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 dns_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 dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$other_ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ }
+
+ // if no more records exist for the ptr_soa, delete it
+ if(!$ptr_soa_rr = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."'")){
+ $app->db->query("DELETE FROM dns_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 dns_soa SET serial = '".$new_serial."' WHERE id = ".$ptr_soa_exist['id']);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // delete associated records
+ $app->db->query("DELETE FROM dns_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
index 413062d0e23f667561f47b46d4ae02f11c8d9469..d7dfd380a399b8aebc672f43ad52db89accc3c0b 100644
--- a/interface/web/dns/soa_edit.php
+++ b/interface/web/dns/soa_edit.php
@@ -1,231 +1,231 @@
-uses('tpl,tform,tform_actions');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
- function onSubmit() {
- global $app, $conf;
-
- if($app->tform->getCurrentTab() == 'rr'){
- parent::onSubmit();
- return true;
- }
-
- if($this->dataRecord['id'] > 0){
- if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
- } else {
- if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
- }
-
- $app->uses('validate_dns');
- $app->tform->errorMessage .= $app->validate_dns->validate_soa($this->dataRecord);
-
- $increased_serials[] = -1;
- // update serial
- $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$this->dataRecord["id"]);
- $serial = $soa['serial'];
- $update = 0;
- if($soa){
- foreach($soa as $key => $val){
- if($this->dataRecord[$key] != $val && $key != 'active' && isset($this->dataRecord[$key])) $update += 1;
- }
- } else { // new record
- $update = 1;
- }
- if(strlen($this->dataRecord["serial"]) == 10 && intval($this->dataRecord["serial"]) == $this->dataRecord["serial"] && $this->dataRecord["serial"] != $serial){
- $update = 0;
- $increased_serials[] = $soa['id'];
- }
- if($update > 0){
- $new_serial = $app->validate_dns->increase_serial($serial);
- $increased_serials[] = $soa['id'];
- $this->dataRecord["serial"] = $new_serial;
- }
-
- if($soa){
- // update rr if origin has changed
- if($soa['origin'] != $this->dataRecord['origin']){
-
- 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' AND id = ".$rr['id']);
-
- $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' AND id = ".$rr['id']);
-
- 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' AND id = ".$rr['id']);
-
- $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' AND id = ".$rr['id']);
-
- }
- }
-
- // increase serial
- if(!empty($update_soas)){
- $update_soas = array_unique($update_soas);
- foreach($update_soas as $update_soa){
- $u_soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$update_soa);
- if(!in_array($u_soa['id'], $increased_serials)){
- $new_serial = $app->validate_dns->increase_serial($u_soa['serial']);
- 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.'");
- }
- $increased_serials[] = $u_soa['id'];
- }
- }
- }
- }
- }
-
-
- // PTR
- if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
-
- if($soa['active'] = 'Y' && $this->dataRecord['active'][0] == 'N'){
-
- if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
- foreach($soa_rrs as $soa_rr){
- if(substr($soa_rr['name'], -1) == '.'){
- $fqdn = $soa_rr['name'];
- } else {
- $fqdn = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
- }
- list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
- $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
- if($ptr = $app->db->queryOneRecord("SELECT soa.id, soa.serial FROM soa, rr WHERE rr.type = 'PTR' AND rr.data = '".$fqdn."' AND rr.zone = soa.id AND soa.origin = '".$ptr_soa."'")){
- ############
- if($a_rr_with_same_ip = $app->db->queryOneRecord("SELECT rr.*, soa.origin FROM rr, soa WHERE rr.type = 'A' AND rr.data = '".$soa_rr['data']."' AND rr.zone = soa.id AND soa.active = 'Y' AND rr.id != ".$soa_rr["id"]." AND rr.zone != '".$this->dataRecord['zone']."'")){
- if(substr($a_rr_with_same_ip['name'], -1) == '.'){
- $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
- } else {
- $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
- }
- $app->db->query("UPDATE rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
- } else {
- $app->db->query("DELETE FROM rr WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
-
- if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$ptr['id']."'")){
- $app->db->query("DELETE FROM soa WHERE id = ".$ptr['id']);
- } else {
- // increase serial
- if(!in_array($ptr['id'], $increased_serials)){
- $new_serial = $app->validate_dns->increase_serial($ptr['serial']);
- $app->db->query("UPDATE soa SET serial = '".$new_serial."' WHERE id = ".$ptr['id']);
- $increased_serials[] = $ptr['id'];
- }
- }
- }
- ############
- }
- }
- }
-
- /* */
-
-
- }
-
- if($soa['active'] = 'N' && $this->dataRecord['active'][0] == 'Y'){
-
- if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
- foreach($soa_rrs as $soa_rr){
- #################
- list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
- $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
- if(substr($soa_rr['name'], -1) == '.'){
- $ptr_soa_rr_data = $soa_rr['name'];
- } else {
- $ptr_soa_rr_data = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) 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', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- $ptr_soa_id = $app->db->insertID();
- $app->db->query("INSERT INTO rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- } 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, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
- // increase serial of PTR SOA
- if(!in_array($ptr_soa_exist['id'], $increased_serials)){
- $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
- $increased_serials[] = $ptr_soa_exist['id'];
- $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();
-
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onSubmit() {
+ global $app, $conf;
+
+ if($app->tform->getCurrentTab() == 'rr'){
+ parent::onSubmit();
+ return true;
+ }
+
+ if($this->dataRecord['id'] > 0){
+ if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error($app->tform->wordbook['error_no_permission']);
+ } else {
+ if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error($app->tform->wordbook['error_no_permission']);
+ }
+
+ $app->uses('validate_dns');
+ $app->tform->errorMessage .= $app->validate_dns->validate_soa($this->dataRecord);
+
+ $increased_serials[] = -1;
+ // update serial
+ $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$this->dataRecord["id"]);
+ $serial = $soa['serial'];
+ $update = 0;
+ if($soa){
+ foreach($soa as $key => $val){
+ if($this->dataRecord[$key] != $val && $key != 'active' && isset($this->dataRecord[$key])) $update += 1;
+ }
+ } else { // new record
+ $update = 1;
+ }
+ if(strlen($this->dataRecord["serial"]) == 10 && intval($this->dataRecord["serial"]) == $this->dataRecord["serial"] && $this->dataRecord["serial"] != $serial){
+ $update = 0;
+ $increased_serials[] = $soa['id'];
+ }
+ if($update > 0){
+ $new_serial = $app->validate_dns->increase_serial($serial);
+ $increased_serials[] = $soa['id'];
+ $this->dataRecord["serial"] = $new_serial;
+ }
+
+ if($soa){
+ // update rr if origin has changed
+ if($soa['origin'] != $this->dataRecord['origin']){
+
+ if($rrs = $app->db->queryAllRecords("SELECT * FROM dns_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 dns_rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
+
+ $app->db->query("UPDATE dns_rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type != 'PTR' AND id = ".$rr['id']);
+
+ if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+ $app->db->query("UPDATE dns_rr SET name = '".substr($rr['name'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE name LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
+
+ $app->db->query("UPDATE dns_rr SET data = '".substr($rr['data'], 0, -(strlen($this->dataRecord['origin']))).$this->dataRecord['origin']."' WHERE data LIKE '%".$soa['origin']."' AND type = 'PTR' AND id = ".$rr['id']);
+
+ }
+ }
+
+ // increase serial
+ if(!empty($update_soas)){
+ $update_soas = array_unique($update_soas);
+ foreach($update_soas as $update_soa){
+ $u_soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$update_soa);
+ if(!in_array($u_soa['id'], $increased_serials)){
+ $new_serial = $app->validate_dns->increase_serial($u_soa['serial']);
+ if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+ $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$update_soa);
+ } else {
+ $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$update_soa." AND origin NOT LIKE '%.in-addr.arpa.'");
+ }
+ $increased_serials[] = $u_soa['id'];
+ }
+ }
+ }
+ }
+ }
+
+
+ // PTR
+ if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
+
+ if($soa['active'] = 'Y' && $this->dataRecord['active'][0] == 'N'){
+
+ if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
+ foreach($soa_rrs as $soa_rr){
+ if(substr($soa_rr['name'], -1) == '.'){
+ $fqdn = $soa_rr['name'];
+ } else {
+ $fqdn = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
+ }
+ list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
+ $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+ if($ptr = $app->db->queryOneRecord("SELECT dns_soa.id, dns_soa.serial FROM dns_soa, dns_rr WHERE dns_rr.type = 'PTR' AND dns_rr.data = '".$fqdn."' AND dns_rr.zone = dns_soa.id AND dns_soa.origin = '".$ptr_soa."'")){
+ ############
+ if($a_rr_with_same_ip = $app->db->queryOneRecord("SELECT dns_rr.*, dns_soa.origin FROM dns_rr, dns_soa WHERE dns_rr.type = 'A' AND dns_rr.data = '".$soa_rr['data']."' AND dns_rr.zone = dns_soa.id AND dns_soa.active = 'Y' AND dns_rr.id != ".$soa_rr["id"]." AND dns_rr.zone != '".$this->dataRecord['zone']."'")){
+ if(substr($a_rr_with_same_ip['name'], -1) == '.'){
+ $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'];
+ } else {
+ $new_ptr_soa_rr_data = $a_rr_with_same_ip['name'].(trim($a_rr_with_same_ip['name']) == '' ? '' : '.').$a_rr_with_same_ip['origin'];
+ }
+ $app->db->query("UPDATE dns_rr SET data = '".$new_ptr_soa_rr_data."' WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
+ } else {
+ $app->db->query("DELETE FROM dns_rr WHERE zone = '".$ptr['id']."' AND name = '".$d."' AND type = 'PTR'");
+
+ if(!$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr['id']."'")){
+ $app->db->query("DELETE FROM dns_soa WHERE id = ".$ptr['id']);
+ } else {
+ // increase serial
+ if(!in_array($ptr['id'], $increased_serials)){
+ $new_serial = $app->validate_dns->increase_serial($ptr['serial']);
+ $app->db->query("UPDATE dns_soa SET serial = '".$new_serial."' WHERE id = ".$ptr['id']);
+ $increased_serials[] = $ptr['id'];
+ }
+ }
+ }
+ ############
+ }
+ }
+ }
+
+ /* */
+
+
+ }
+
+ if($soa['active'] = 'N' && $this->dataRecord['active'][0] == 'Y'){
+
+ if($soa_rrs = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord['id']." AND type = 'A'")){
+ foreach($soa_rrs as $soa_rr){
+ #################
+ list($a, $b, $c, $d) = explode('.', $soa_rr['data']);
+ $ptr_soa = $c.'.'.$b.'.'.$a.'.in-addr.arpa.';
+ if(substr($soa_rr['name'], -1) == '.'){
+ $ptr_soa_rr_data = $soa_rr['name'];
+ } else {
+ $ptr_soa_rr_data = $soa_rr['name'].(trim($soa_rr['name']) == '' ? '' : '.').$this->dataRecord['origin'];
+ }
+
+ if(!$ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '".$ptr_soa."'")){
+ $app->db->query("INSERT INTO dns_soa (origin, ns, mbox, serial, refresh, retry, expire, minimum, ttl, active, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) 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', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ $ptr_soa_id = $app->db->insertID();
+ $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_id."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ } else {
+ if($ptr_soa_exist['active'] != 'Y') $app->db->query("UPDATE dns_soa SET active = 'Y' WHERE id = ".$ptr_soa_exist['id']);
+ if(!$ptr_soa_rr_exist = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$ptr_soa_exist['id']."' AND name = '".$d."' AND type = 'PTR'")){
+ $app->db->query("INSERT INTO dns_rr (zone, name, type, data, aux, ttl, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other) VALUES ('".$ptr_soa_exist['id']."', '".$d."', 'PTR', '".$ptr_soa_rr_data."', '0', '".$conf['default_ttl']."', '".$_SESSION['s']['user']['sys_userid']."', '".$_SESSION['s']['user']['sys_groupid']."', '".$_SESSION['s']['user']['sys_perm_user']."', '".$_SESSION['s']['user']['sys_perm_group']."', '".$_SESSION['s']['user']['sys_perm_other']."')");
+ // increase serial of PTR SOA
+ if(!in_array($ptr_soa_exist['id'], $increased_serials)){
+ $ptr_soa_new_serial = $app->validate_dns->increase_serial($ptr_soa_exist['serial']);
+ $increased_serials[] = $ptr_soa_exist['id'];
+ $app->db->query("UPDATE dns_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/mail/form/_old_mail_domain_catchall.tform.php b/interface/web/mail/form/_old_mail_domain_catchall.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..262bac13f609faff1b17c8f53ca0252ae6407b71
--- /dev/null
+++ b/interface/web/mail/form/_old_mail_domain_catchall.tform.php
@@ -0,0 +1,107 @@
+ 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"]['catchall'] = array (
+ 'title' => "Domain Catchall",
+ 'width' => 150,
+ 'template' => "templates/mail_domain_catchall_edit.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'VARCHAR',
+ 'default' => '',
+ 'value' => ''
+ ),
+ 'domain' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
+ 'errmsg'=> 'domain_error_unique'),
+ 1 => array ( 'type' => 'REGEX',
+ 'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
+ 'errmsg'=> 'domain_error_regex'),
+ ),
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => "SELECT domain FROM mail_domain WHERE type = 'local' AND {AUTHSQL} ORDER BY domain",
+ 'keyfield'=> 'domain',
+ 'valuefield'=> 'domain'
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'destination' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php
index 4c64d85ea07b2307e277a8932df0b9b8e3285d3c..7ff42289749be9f53d3e9b6b66b93f2b541a79e2 100644
--- a/interface/web/mail/form/mail_alias.tform.php
+++ b/interface/web/mail/form/mail_alias.tform.php
@@ -98,10 +98,10 @@ $form["tabs"]['alias'] = array (
'value' => array('alias' => 'Alias','forward'=>'Forward')
),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_blacklist.tform.php b/interface/web/mail/form/mail_blacklist.tform.php
index 6b91c3a49d00e8513855211b38c08b19c219a34c..a349680bc8037c6614d0259f863e81df17d8a96f 100644
--- a/interface/web/mail/form/mail_blacklist.tform.php
+++ b/interface/web/mail/form/mail_blacklist.tform.php
@@ -37,8 +37,8 @@ $form["title"] = "Email Blacklist";
$form["description"] = "";
$form["name"] = "mail_blacklist";
$form["action"] = "mail_blacklist_edit.php";
-$form["db_table"] = "mail_blacklist";
-$form["db_table_idx"] = "blacklist_id";
+$form["db_table"] = "mail_access";
+$form["db_table_idx"] = "access_id";
$form["db_history"] = "yes";
$form["tab_default"] = "blacklist";
$form["list_default"] = "mail_blacklist_list.php";
@@ -69,30 +69,36 @@ $form["tabs"]['blacklist'] = array (
),
'value' => ''
),
- 'address' => array (
+ 'source' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
+ 'default' => '',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
- 'errmsg'=> 'address_error_notempty'),
+ 'errmsg'=> 'source_error_notempty'),
),
- 'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
- 'recipient' => array (
+ 'access' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
- 'default' => '',
- 'value' => '',
+ 'default' => 'REJECT',
+ 'value' => 'REJECT',
'width' => '30',
'maxlength' => '255'
),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'y',
+ 'value' => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+ ),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_domain.tform.php b/interface/web/mail/form/mail_domain.tform.php
index ecdb76fbdaf373168d584d3f75fc95ff90908bc5..b6ba91024ead8fbfd0c50b1da1987b3f1515e6b6 100644
--- a/interface/web/mail/form/mail_domain.tform.php
+++ b/interface/web/mail/form/mail_domain.tform.php
@@ -85,17 +85,11 @@ $form["tabs"]['domain'] = array (
'width' => '30',
'maxlength' => '255'
),
- 'type' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
- 'default' => '',
- 'value' => array('local' => 'local','relay'=>'relay','manual_relay'=>'manual Relay')
- ),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index 0f16d4405e8f48a9460babb669c56b71ff0d1543..d3197e2c6cc7560ee4cf0fd015c44f998ea3eaa8 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -37,8 +37,8 @@ $form["title"] = "Email Catchall";
$form["description"] = "";
$form["name"] = "mail_domain_catchall";
$form["action"] = "mail_domain_catchall_edit.php";
-$form["db_table"] = "mail_domain_catchall";
-$form["db_table_idx"] = "domain_catchall_id";
+$form["db_table"] = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
$form["db_history"] = "yes";
$form["tab_default"] = "catchall";
$form["list_default"] = "mail_domain_catchall_list.php";
@@ -51,8 +51,8 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['catchall'] = array (
- 'title' => "Domain Catchall",
- 'width' => 150,
+ 'title' => "Email catchall",
+ 'width' => 100,
'template' => "templates/mail_domain_catchall_edit.htm",
'fields' => array (
##################################
@@ -60,24 +60,23 @@ $form["tabs"]['catchall'] = array (
##################################
'server_id' => array (
'datatype' => 'INTEGER',
- 'formtype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
'default' => '',
- 'value' => ''
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
),
- 'domain' => array (
+ 'source' => array (
'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
- 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'domain_error_empty'),
+ 1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'domain_error_unique'),
- 1 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
+ 2 => array ( 'type' => 'REGEX',
+ 'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z]{2,10}$/',
'errmsg'=> 'domain_error_regex'),
),
- 'datasource' => array ( 'type' => 'SQL',
- 'querystring' => "SELECT domain FROM mail_domain WHERE type = 'local' AND {AUTHSQL} ORDER BY domain",
- 'keyfield'=> 'domain',
- 'valuefield'=> 'domain'
- ),
'default' => '',
'value' => '',
'width' => '30',
@@ -85,17 +84,29 @@ $form["tabs"]['catchall'] = array (
),
'destination' => array (
'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
+ 'formtype' => 'SELECT',
'default' => '',
- 'value' => '',
- 'width' => '30',
- 'maxlength' => '255'
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+ 'keyfield' => 'email',
+ 'valuefield' => 'email'
+ ),
+ 'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
+ 'errmsg'=> 'destination_error_isemail'),
+ ),
+ 'value' => ''
+ ),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('alias' => 'Alias','forward'=>'Forward','catchall'=>'Catchall')
),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
@@ -104,4 +115,5 @@ $form["tabs"]['catchall'] = array (
);
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php
index 7d8fd2f3af2377e9a53a267a517aad41d18efa66..503faf11b45c0f3b22dace51cc35c9ab9b088fe3 100644
--- a/interface/web/mail/form/mail_forward.tform.php
+++ b/interface/web/mail/form/mail_forward.tform.php
@@ -1,108 +1,108 @@
- 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"]['forward'] = array (
- 'title' => "Email forward",
- 'width' => 100,
- 'template' => "templates/mail_forward_edit.htm",
- 'fields' => array (
- ##################################
- # Begin Datatable fields
- ##################################
- 'server_id' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'TEXT',
- 'default' => '',
- 'value' => '',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'email' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
- 'errmsg'=> 'email_error_isemail'),
- ),
- 'default' => '',
- 'value' => '',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'destination' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'default' => '',
- 'value' => '',
- 'width' => '30',
- 'maxlength' => '255'
- ),
- 'type' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
- 'default' => '',
- 'value' => array('forward'=>'Forward','alias' => 'Alias')
- ),
- 'active' => array (
- 'datatype' => 'INTEGER',
- 'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
- ),
- ##################################
- # ENDE Datatable fields
- ##################################
- )
-);
-
-
-
+ 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"]['forward'] = array (
+ 'title' => "Email forward",
+ 'width' => 100,
+ 'template' => "templates/mail_forward_edit.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'server_id' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'source' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'ISEMAIL',
+ 'errmsg'=> 'email_error_isemail'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'destination' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('forward'=>'Forward','alias' => 'Alias')
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/form/mail_spamfilter.tform.php b/interface/web/mail/form/mail_spamfilter.tform.php
index 7495fd881b30a13ba6b9b210570c6b8d2d37abb9..aee5d855dfd894403e3a0882883ec3b728c5ed51 100644
--- a/interface/web/mail/form/mail_spamfilter.tform.php
+++ b/interface/web/mail/form/mail_spamfilter.tform.php
@@ -131,10 +131,10 @@ $form["tabs"]['spamfilter'] = array (
'maxlength' => '10'
),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_transport.tform.php b/interface/web/mail/form/mail_transport.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..12dbdacec61ef647eda54104988fa0e72951f623
--- /dev/null
+++ b/interface/web/mail/form/mail_transport.tform.php
@@ -0,0 +1,111 @@
+ 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"]['transport'] = array (
+ 'title' => "Email transport",
+ 'width' => 100,
+ 'template' => "templates/mail_transport_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 {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'value' => ''
+ ),
+ 'domain' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'validators' => array ( 0 => array ( 'type' => 'UNIQUE',
+ 'errmsg'=> 'domain_error_unique'),
+ ),
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'transport' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
+ 'sort_order' => array (
+ 'datatype' => 'INTEGER',
+ 'formtype' => 'SELECT',
+ 'default' => 5,
+ 'value' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+ ),
+ 'active' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index 60a25bbe0a6d746e87b513782075c1f76608c165..f358ff82b5b80dab4a9ee2fa79b4f8e381332062 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -132,16 +132,16 @@ $form["tabs"]['mailuser'] = array (
'maxlength' => '10'
),
'postfix' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(1 => 'y',0 => 'n')
),
'access' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => '1',
- 'value' => '1'
+ 'value' => array(1 => 'y',0 => 'n')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/form/mail_whitelist.tform.php b/interface/web/mail/form/mail_whitelist.tform.php
index 69f68e6226f2f006e7f3f58b68f01a0c0655e7a2..8d98346cf628a94d39c0fe4aec34191e1d77f83a 100644
--- a/interface/web/mail/form/mail_whitelist.tform.php
+++ b/interface/web/mail/form/mail_whitelist.tform.php
@@ -37,8 +37,8 @@ $form["title"] = "Email Whitelist";
$form["description"] = "";
$form["name"] = "mail_whitelist";
$form["action"] = "mail_whitelist_edit.php";
-$form["db_table"] = "mail_whitelist";
-$form["db_table_idx"] = "whitelist_id";
+$form["db_table"] = "mail_access";
+$form["db_table_idx"] = "access_id";
$form["db_history"] = "yes";
$form["tab_default"] = "whitelist";
$form["list_default"] = "mail_whitelist_list.php";
@@ -69,30 +69,36 @@ $form["tabs"]['whitelist'] = array (
),
'value' => ''
),
- 'address' => array (
+ 'source' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
+ 'default' => '',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
- 'errmsg'=> 'address_error_notempty'),
+ 'errmsg'=> 'source_error_notempty'),
),
- 'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
- 'recipient' => array (
+ 'access' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
- 'default' => '',
- 'value' => '',
+ 'default' => 'OK',
+ 'value' => 'OK',
'width' => '30',
'maxlength' => '255'
),
+ 'type' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => 'y',
+ 'value' => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+ ),
'active' => array (
- 'datatype' => 'INTEGER',
+ 'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
- 'default' => '1',
- 'value' => '1'
+ 'default' => 'y',
+ 'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
diff --git a/interface/web/mail/lib/lang/en_mail_blacklist.lng b/interface/web/mail/lib/lang/en_mail_blacklist.lng
index 1138100b0b9f875b535a99b88eac7f89b134303c..b967c3e30e69269a3728ed280efc09731be8cc93 100644
--- a/interface/web/mail/lib/lang/en_mail_blacklist.lng
+++ b/interface/web/mail/lib/lang/en_mail_blacklist.lng
@@ -1,9 +1,10 @@
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_blacklist_list.lng b/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
index cc90ac898e77563528ef75e6e773815fac02b172..833cf217cc290f7aa3003ac3b00b5337a08aaf46 100644
--- a/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_blacklist_list.lng
@@ -1,7 +1,7 @@
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_transport.lng b/interface/web/mail/lib/lang/en_mail_transport.lng
new file mode 100644
index 0000000000000000000000000000000000000000..e454c00f4d559238cbae7dd88e26a1fd173cb396
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_transport.lng
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_transport_list.lng b/interface/web/mail/lib/lang/en_mail_transport_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..562ee8e1cd0b290c0b9f1479568e7e9c3326fb36
--- /dev/null
+++ b/interface/web/mail/lib/lang/en_mail_transport_list.lng
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_whitelist.lng b/interface/web/mail/lib/lang/en_mail_whitelist.lng
index faf06198062438182ffc4791a7dcfb7c82d7f99c..4cf2fb59dbfb534659e5bbffc9badb44b1b9546a 100644
--- a/interface/web/mail/lib/lang/en_mail_whitelist.lng
+++ b/interface/web/mail/lib/lang/en_mail_whitelist.lng
@@ -1,9 +1,10 @@
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_whitelist_list.lng b/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
index 71f7639f3b2239e255452bcc288abbefdae86cf3..e8c58b49e7b2dd07b9d209c962f3f2d3c3d152ec 100644
--- a/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_whitelist_list.lng
@@ -1,7 +1,7 @@
\ No newline at end of file
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index d5f1c7a3df12a925abe0d6b38414f4818685a0c7..d3d3ad90dd2324243e25741257976f92073b3d4a 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -48,7 +48,7 @@ $module = array (
array (
'title' => 'Email Routing',
'target' => 'content',
- 'link' => '',
+ 'link' => 'mail/mail_transport_list.php',
),
),
),
@@ -72,9 +72,15 @@ $module = array (
),
2 =>
array (
- 'title' => 'Spamfilter',
+ 'title' => 'Users',
'target' => 'content',
- 'link' => 'mail/mail_spamfilter_list.php',
+ 'link' => 'mail/spamfilter_user_list.php',
+ ),
+ 3 =>
+ array (
+ 'title' => 'Policys',
+ 'target' => 'content',
+ 'link' => 'mail/spamfilter_policy_list.php',
),
),
),
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index 5ae872782c18b2188c906bc5a6c134b91cafbedd..25c4d5947cf129ced017d9634b437c63112edaba 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -54,7 +54,7 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
$liste["item"][] = array( 'field' => "source",
'datatype' => "VARCHAR",
diff --git a/interface/web/mail/list/mail_blacklist.list.php b/interface/web/mail/list/mail_blacklist.list.php
index 12308e55aa6660b3aa6706203e60fe253cb8f111..ca0677dc031638d4ad7f6f86faeb6853ed307523 100644
--- a/interface/web/mail/list/mail_blacklist.list.php
+++ b/interface/web/mail/list/mail_blacklist.list.php
@@ -16,10 +16,10 @@
$liste["name"] = "mail_blacklist";
// Database table
-$liste["table"] = "mail_blacklist";
+$liste["table"] = "mail_access";
// Index index field of the database table
-$liste["table_idx"] = "blacklist_id";
+$liste["table_idx"] = "access_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
@@ -54,7 +54,7 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
$liste["item"][] = array( 'field' => "server_id",
@@ -71,7 +71,7 @@ $liste["item"][] = array( 'field' => "server_id",
'width' => "",
'value' => "");
-$liste["item"][] = array( 'field' => "address",
+$liste["item"][] = array( 'field' => "source",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
@@ -81,13 +81,14 @@ $liste["item"][] = array( 'field' => "address",
'value' => "");
-$liste["item"][] = array( 'field' => "recipient",
+$liste["item"][] = array( 'field' => "type",
'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "like",
- 'prefix' => "%",
- 'suffix' => "%",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
'width' => "",
- 'value' => "");
+ 'value' => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 359a6dfd360ecf8dd0723b7ab2d96b7645f7d708..0d7796c70b6840ffcd5eb6a1a32de2f30d2df389 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -55,7 +55,7 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
$liste["item"][] = array( 'field' => "server_id",
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index c6f9c3099bfd54fc0a589f6b66f6e3c11a4f68b7..b113a1f5a33e3f2bc63f6061d49cb4beb3c88d0b 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -16,10 +16,10 @@
$liste["name"] = "mail_domain_catchall";
// Database table
-$liste["table"] = "mail_domain_catchall";
+$liste["table"] = "mail_forwarding";
// Index index field of the database table
-$liste["table_idx"] = "domain_catchall_id";
+$liste["table_idx"] = "forwarding_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
@@ -54,18 +54,9 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
-$liste["item"][] = array( 'field' => "server_id",
- 'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "like",
- 'prefix' => "%",
- 'suffix' => "%",
- 'width' => "",
- 'value' => "");
-
-$liste["item"][] = array( 'field' => "domain",
+$liste["item"][] = array( 'field' => "source",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
@@ -82,4 +73,6 @@ $liste["item"][] = array( 'field' => "destination",
'suffix' => "%",
'width' => "",
'value' => "");
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 2b1f02727005312382936827cbe96204d03809d5..f9df32a66af1c0d73bca6be75684691bbabb23b3 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -1,78 +1,78 @@
- "active",
- 'datatype' => "VARCHAR",
- 'formtype' => "SELECT",
- 'op' => "=",
- 'prefix' => "",
- 'suffix' => "",
- 'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
-
-$liste["item"][] = array( 'field' => "email",
- 'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "like",
- 'prefix' => "%",
- 'suffix' => "%",
- 'width' => "",
- 'value' => "");
-
-$liste["item"][] = array( 'field' => "destination",
- 'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "like",
- 'prefix' => "%",
- 'suffix' => "%",
- 'width' => "",
- 'value' => "");
-
-
+ "active",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => array('y' => "Yes",'n' => "No"));
+
+$liste["item"][] = array( 'field' => "source",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "destination",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index d959918a1bf435aeaa5c17392e5c4d15f061e958..3b0c4bc01f5efbeed077fefa3278c74a0b4bf1fb 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -54,7 +54,7 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
$liste["item"][] = array( 'field' => "server_id",
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..839167871825c48a64728e755bb294f807fa25c2
--- /dev/null
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -0,0 +1,104 @@
+ "active",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => array('y' => "Yes",'n' => "No"));
+
+
+$liste["item"][] = array( 'field' => "server_id",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "SELECT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'datasource' => array ( 'type' => 'SQL',
+ 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+ 'keyfield'=> 'server_id',
+ 'valuefield'=> 'server_name'
+ ),
+ 'width' => "",
+ 'value' => "");
+
+$liste["item"][] = array( 'field' => "domain",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
+$liste["item"][] = array( 'field' => "transport",
+ 'datatype' => "VARCHAR",
+ 'formtype' => "TEXT",
+ 'op' => "like",
+ 'prefix' => "%",
+ 'suffix' => "%",
+ 'width' => "",
+ 'value' => "");
+
+
+$liste["item"][] = array( 'field' => "sort_order",
+ 'datatype' => "INTEGER",
+ 'formtype' => "TEXT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
+ 'width' => "",
+ 'value' => "");
+
+?>
\ No newline at end of file
diff --git a/interface/web/mail/list/mail_whitelist.list.php b/interface/web/mail/list/mail_whitelist.list.php
index 79a582cbf7183100107f6b0bc9ddd9746e66a816..0caace865855e8343c0753a513a017f6d6f4f608 100644
--- a/interface/web/mail/list/mail_whitelist.list.php
+++ b/interface/web/mail/list/mail_whitelist.list.php
@@ -16,10 +16,10 @@
$liste["name"] = "mail_whitelist";
// Database table
-$liste["table"] = "mail_whitelist";
+$liste["table"] = "mail_access";
// Index index field of the database table
-$liste["table_idx"] = "whitelist_id";
+$liste["table_idx"] = "access_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
@@ -54,7 +54,7 @@ $liste["item"][] = array( 'field' => "active",
'prefix' => "",
'suffix' => "",
'width' => "",
- 'value' => array('1' => "Yes",'0' => "No"));
+ 'value' => array('y' => "Yes",'n' => "No"));
$liste["item"][] = array( 'field' => "server_id",
@@ -71,7 +71,8 @@ $liste["item"][] = array( 'field' => "server_id",
'width' => "",
'value' => "");
-$liste["item"][] = array( 'field' => "address",
+
+$liste["item"][] = array( 'field' => "source",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
@@ -80,14 +81,14 @@ $liste["item"][] = array( 'field' => "address",
'width' => "",
'value' => "");
-$liste["item"][] = array( 'field' => "recipient",
+$liste["item"][] = array( 'field' => "type",
'datatype' => "VARCHAR",
- 'formtype' => "TEXT",
- 'op' => "like",
- 'prefix' => "%",
- 'suffix' => "%",
+ 'formtype' => "SELECT",
+ 'op' => "=",
+ 'prefix' => "",
+ 'suffix' => "",
'width' => "",
- 'value' => "");
+ 'value' => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index 4caf0344c4d74ed3a080550956c7895ed321f19c..5c741982418149bb95cf435d33b2f23275594b86 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -53,50 +53,6 @@ $app->load('tform_actions');
class page_action extends tform_actions {
- function onShowEnd() {
- global $app, $conf;
-
- // Getting recipient from data record
- $recipient = $this->dataRecord["recipient"];
- $email_parts = explode("@",$recipient);
- $app->tpl->setVar("recipient_local_part",$email_parts[0]);
-
- // Getting Domains of the user
- $sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
- $domains = $app->db->queryAllRecords($sql);
- $domain_select = '';
- if($_SESSION["s"]["user"]["typ"] == 'admin') $domain_select .= '';
- foreach( $domains as $domain) {
- $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
- $domain_select .= "\r\n";
- }
- $app->tpl->setVar("recipient_domain",$domain_select);
-
- parent::onShowEnd();
- }
-
- function onSubmit() {
- global $app, $conf;
-
- // Check if Domain belongs to user
- $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["recipient_domain"])."' AND ".$app->tform->getAuthSQL('r'));
- if($domain["domain"] != $_POST["recipient_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-
- // compose the email field
- if($_POST["recipient_local_part"] != '') {
- $this->dataRecord["recipient"] = $_POST["recipient_local_part"]."@".$_POST["recipient_domain"];
- } else {
- $this->dataRecord["recipient"] = $_POST["recipient_domain"];
- }
- // Set the server id of the mailbox = server ID of mail domain.
- //$this->dataRecord["server_id"] = $domain["server_id"];
-
- unset($this->dataRecord["recipient_local_part"]);
- unset($this->dataRecord["recipient_domain"]);
-
- parent::onSubmit();
- }
-
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index 2679fdfefd651706e3b59ae77930fdc058a43ef4..d6b2700708a4a80f48a97f42c2a649ca9b64f742 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -1,26 +1,27 @@
-uses('listform_actions');
-
-$app->listform_actions->onLoad();
-
-
+uses('listform_actions');
+$app->listform_actions->SQLExtWhere = "access = 'REJECT'";
+
+$app->listform_actions->onLoad();
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index 4ea00b06964ac6ac3d78d9019a6b3cedc85d93f7..a40c5dcbfec6612950d30cf61355813a8a0c5247 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -1,75 +1,101 @@
-uses('tpl,tform,tform_actions');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
- function onSubmit() {
- global $app, $conf;
-
- // Check if Domain belongs to user
- $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["domain"])."' AND ".$app->tform->getAuthSQL('r'));
- if($domain["domain"] != $_POST["domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-
- // Set the server id of the catchall = server ID of mail domain.
- $this->dataRecord["server_id"] = $domain["server_id"];
-
- parent::onSubmit();
- }
-
-}
-
-$app->tform_actions = new page_action;
-$app->tform_actions->onLoad();
-
-
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $email = $this->dataRecord["source"];
+ $email_parts = explode("@",$email);
+ $app->tpl->setVar("email_local_part",$email_parts[0]);
+
+ // Getting Domains of the user
+ $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
+ $domains = $app->db->queryAllRecords($sql);
+ $domain_select = '';
+ if(is_array($domains)) {
+ foreach( $domains as $domain) {
+ $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
+ $domain_select .= "\r\n";
+ }
+ }
+ $app->tpl->setVar("email_domain",$domain_select);
+
+ parent::onShowEnd();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check if Domain belongs to user
+ $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
+ if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // compose the email field
+ $this->dataRecord["source"] = "@".$_POST["email_domain"];
+ // Set the server id of the mailbox = server ID of mail domain.
+ $this->dataRecord["server_id"] = $domain["server_id"];
+
+ //unset($this->dataRecord["email_local_part"]);
+ unset($this->dataRecord["email_domain"]);
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index 7e5f4521f93fd7c62366c57baba2fe77fb1df652..412bb43f7501844cdd6c1e2b906b9aba8ca63b52 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -1,26 +1,29 @@
-uses('listform_actions');
-
-$app->listform_actions->onLoad();
-
-
+uses('listform_actions');
+
+// Limit the results to alias domains
+$app->listform_actions->SQLExtWhere = "type = 'catchall'";
+
+$app->listform_actions->onLoad();
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index 25e12f0e175afc5d4af186e510107acedc7a08c4..5d6b8a7522ff3d73343407634de435eb61083315 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -1,99 +1,99 @@
-uses('tpl,tform,tform_actions');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
- function onShowEnd() {
- global $app, $conf;
-
- $email = $this->dataRecord["email"];
- $email_parts = explode("@",$email);
- $app->tpl->setVar("email_local_part",$email_parts[0]);
-
- // Getting Domains of the user
- $sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
- $domains = $app->db->queryAllRecords($sql);
- $domain_select = '';
- foreach( $domains as $domain) {
- $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
- $domain_select .= "\r\n";
- }
- $app->tpl->setVar("email_domain",$domain_select);
-
- parent::onShowEnd();
- }
-
- function onSubmit() {
- global $app, $conf;
-
- // Check if Domain belongs to user
- $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
- if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-
- // compose the email field
- $this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
- // Set the server id of the mailbox = server ID of mail domain.
- $this->dataRecord["server_id"] = $domain["server_id"];
-
- unset($this->dataRecord["email_local_part"]);
- unset($this->dataRecord["email_domain"]);
-
- parent::onSubmit();
- }
-
-}
-
-$page = new page_action;
-$page->onLoad();
-
+uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+ function onShowEnd() {
+ global $app, $conf;
+
+ $email = $this->dataRecord["source"];
+ $email_parts = explode("@",$email);
+ $app->tpl->setVar("email_local_part",$email_parts[0]);
+
+ // Getting Domains of the user
+ $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
+ $domains = $app->db->queryAllRecords($sql);
+ $domain_select = '';
+ foreach( $domains as $domain) {
+ $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
+ $domain_select .= "\r\n";
+ }
+ $app->tpl->setVar("email_domain",$domain_select);
+
+ parent::onShowEnd();
+ }
+
+ function onSubmit() {
+ global $app, $conf;
+
+ // Check if Domain belongs to user
+ $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
+ if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+
+ // compose the email field
+ $this->dataRecord["source"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
+ // Set the server id of the mailbox = server ID of mail domain.
+ $this->dataRecord["server_id"] = $domain["server_id"];
+
+ unset($this->dataRecord["email_local_part"]);
+ unset($this->dataRecord["email_domain"]);
+
+ parent::onSubmit();
+ }
+
+}
+
+$page = new page_action;
+$page->onLoad();
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_route_del.php b/interface/web/mail/mail_transport_del.php
similarity index 92%
rename from interface/web/mail/mail_domain_route_del.php
rename to interface/web/mail/mail_transport_del.php
index d69f9e20fcccee50718b1508361df37015f09f3d..fd0fcee7ee6eaec4454a752f5303b73b8f112345 100644
--- a/interface/web/mail/mail_domain_route_del.php
+++ b/interface/web/mail/mail_transport_del.php
@@ -1,54 +1,54 @@
-uses("tform_actions");
-$app->tform_actions->onDelete();
-
+uses("tform_actions");
+$app->tform_actions->onDelete();
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_route_edit.php b/interface/web/mail/mail_transport_edit.php
similarity index 95%
rename from interface/web/mail/mail_domain_route_edit.php
rename to interface/web/mail/mail_transport_edit.php
index a87a8ae2c93ec3efecf7819cc2a90b37f07feceb..8bf03f3aa095cfef52bc7732531e6eaca65c8206 100644
--- a/interface/web/mail/mail_domain_route_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -1,56 +1,56 @@
-uses('tpl,tform,tform_actions');
-
-// let tform_actions handle the page
-$app->tform_actions->onLoad();
-
+uses('tpl,tform,tform_actions');
+
+// let tform_actions handle the page
+$app->tform_actions->onLoad();
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_domain_route_list.php b/interface/web/mail/mail_transport_list.php
similarity index 80%
rename from interface/web/mail/mail_domain_route_list.php
rename to interface/web/mail/mail_transport_list.php
index c7f004f8902040d4c3631132f15d096bfe597a56..aa43090444819dc99a447e4f3bfd98a1e99d678f 100644
--- a/interface/web/mail/mail_domain_route_list.php
+++ b/interface/web/mail/mail_transport_list.php
@@ -1,30 +1,29 @@
-uses('listform_actions');
-
-// Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "";
-
-// Generate the page
-$app->listform_actions->onLoad();
-
-
+uses('listform_actions');
+
+// Limit the results to alias domains
+// $app->listform_actions->SQLExtWhere = "type = 'local'";
+
+$app->listform_actions->onLoad();
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index ece39d52e337ae281b96081468f9a07482b5319f..97ec9d44e3b50e5bf9142912daad1da4118d75d3 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -53,50 +53,6 @@ $app->load('tform_actions');
class page_action extends tform_actions {
- function onShowEnd() {
- global $app, $conf;
-
- // Getting recipient from data record
- $recipient = $this->dataRecord["recipient"];
- $email_parts = explode("@",$recipient);
- $app->tpl->setVar("recipient_local_part",$email_parts[0]);
-
- // Getting Domains of the user
- $sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
- $domains = $app->db->queryAllRecords($sql);
- $domain_select = '';
- if($_SESSION["s"]["user"]["typ"] == 'admin') $domain_select .= '';
- foreach( $domains as $domain) {
- $selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
- $domain_select .= "\r\n";
- }
- $app->tpl->setVar("recipient_domain",$domain_select);
-
- parent::onShowEnd();
- }
-
- function onSubmit() {
- global $app, $conf;
-
- // Check if Domain belongs to user
- $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["recipient_domain"])."' AND ".$app->tform->getAuthSQL('r'));
- if($domain["domain"] != $_POST["recipient_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-
- // compose the email field
- if($_POST["recipient_local_part"] != '') {
- $this->dataRecord["recipient"] = $_POST["recipient_local_part"]."@".$_POST["recipient_domain"];
- } else {
- $this->dataRecord["recipient"] = $_POST["recipient_domain"];
- }
- // Set the server id of the mailbox = server ID of mail domain.
- // $this->dataRecord["server_id"] = $domain["server_id"];
-
- unset($this->dataRecord["recipient_local_part"]);
- unset($this->dataRecord["recipient_domain"]);
-
- parent::onSubmit();
- }
-
}
$app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index cc245ffbe057c55aedede94c791c71cf499934eb..68443334413082060dfaf4c2ac525f455664e2c6 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -1,26 +1,27 @@
-uses('listform_actions');
-
-$app->listform_actions->onLoad();
-
-
+uses('listform_actions');
+$app->listform_actions->SQLExtWhere = "access = 'OK'";
+
+$app->listform_actions->onLoad();
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_blacklist_edit.htm b/interface/web/mail/templates/mail_blacklist_edit.htm
index dab389a3e7128fb716be750e99e2865cba48eac7..a707acffcbf5e1967ac4c1c37de42ea9c06631d9 100644
--- a/interface/web/mail/templates/mail_blacklist_edit.htm
+++ b/interface/web/mail/templates/mail_blacklist_edit.htm
@@ -1,23 +1,27 @@
-
{tmpl_var name='server_id_txt'}:
-
+
{tmpl_var name='server_id_txt'}:
+
-
{tmpl_var name='address_txt'}:
-
+
{tmpl_var name='source_txt'}:
+
-
{tmpl_var name='recipient_txt'}:
-
@
+
{tmpl_var name='type_txt'}:
+
+
+
-
{tmpl_var name='active_txt'}:
-
{tmpl_var name='active'}
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
@@ -29,4 +33,5 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_blacklist_list.htm b/interface/web/mail/templates/mail_blacklist_list.htm
index 1d2ec6c4206db7bb56651a55110339e8a3e601fa..f68245dbe3f1c2791e65655a9a4b55a56391786a 100644
--- a/interface/web/mail/templates/mail_blacklist_list.htm
+++ b/interface/web/mail/templates/mail_blacklist_list.htm
@@ -4,27 +4,28 @@
+
+
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_domain_catchall_list.htm b/interface/web/mail/templates/mail_domain_catchall_list.htm
index 5ade0ad5f905e887a083aa8b019a556e4da545ff..f66dc6d9f7d19073d1dc7af03734a2eb24c41bd4 100644
--- a/interface/web/mail/templates/mail_domain_catchall_list.htm
+++ b/interface/web/mail/templates/mail_domain_catchall_list.htm
@@ -4,30 +4,27 @@
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_forward_list.htm b/interface/web/mail/templates/mail_forward_list.htm
index a92ea8f75e36155641c5bda2207cb284ecee1a98..b14c1be4586be842ced08aa7b21e43720dd6337a 100644
--- a/interface/web/mail/templates/mail_forward_list.htm
+++ b/interface/web/mail/templates/mail_forward_list.htm
@@ -1,30 +1,30 @@
-
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_transport_edit.htm b/interface/web/mail/templates/mail_transport_edit.htm
new file mode 100644
index 0000000000000000000000000000000000000000..2095e97c4b9b29a2086b196851dcf87e00ae7fa6
--- /dev/null
+++ b/interface/web/mail/templates/mail_transport_edit.htm
@@ -0,0 +1,40 @@
+
+
+
{tmpl_var name='server_id_txt'}:
+
+
+
+
+
+
{tmpl_var name='domain_txt'}:
+
+
+
+
{tmpl_var name='transport_txt'}:
+
+
+
+
{tmpl_var name='sort_order_txt'}:
+
+
+
+
+
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_transport_list.htm b/interface/web/mail/templates/mail_transport_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..0e43f7e7ffa678da5e902cb635f651434d0bcaeb
--- /dev/null
+++ b/interface/web/mail/templates/mail_transport_list.htm
@@ -0,0 +1,36 @@
+
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_whitelist_edit.htm b/interface/web/mail/templates/mail_whitelist_edit.htm
index 96b2e9518791a031bdb2fa17096f625689fd7b38..1158bf21cb5a09e95c1a79a1724f65be1d96b6e2 100644
--- a/interface/web/mail/templates/mail_whitelist_edit.htm
+++ b/interface/web/mail/templates/mail_whitelist_edit.htm
@@ -1,23 +1,27 @@
-
{tmpl_var name='server_id_txt'}:
-
+
{tmpl_var name='server_id_txt'}:
+
-
{tmpl_var name='address_txt'}:
-
+
{tmpl_var name='source_txt'}:
+
-
{tmpl_var name='recipient_txt'}:
-
@
+
{tmpl_var name='type_txt'}:
+
+
+
-
{tmpl_var name='active_txt'}:
-
{tmpl_var name='active'}
+
{tmpl_var name='active_txt'}:
+
{tmpl_var name='active'}
@@ -29,4 +33,5 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/interface/web/mail/templates/mail_whitelist_list.htm b/interface/web/mail/templates/mail_whitelist_list.htm
index 6c46d1f63c6dcc1466641576b99a4db6d75cc950..f8edee0fd5e5cce4d716342698529b76a8fc0a5c 100644
--- a/interface/web/mail/templates/mail_whitelist_list.htm
+++ b/interface/web/mail/templates/mail_whitelist_list.htm
@@ -4,27 +4,28 @@