From 040f8cf58a0e20edb77a6fe4cfb4df1b35dc45d7 Mon Sep 17 00:00:00 2001 From: NBonline <NBonline@ispconfig3> Date: Sun, 27 Nov 2005 18:24:00 -0500 Subject: [PATCH] Updated Swe lng files --- interface/lib/classes/tform.inc.php | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 5fb6444..54bbce1 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -101,7 +101,7 @@ * der Variablen mit Regex * @var errorMessage */ - var $errorMessage; + var $errorMessage = ''; var $dateformat = "d.m.Y"; var $formDef; @@ -216,6 +216,7 @@ $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); @@ -435,7 +436,7 @@ break; default: - $new_record[$key] = htmlspecialchars($field['value']); + $new_record[$key] = htmlspecialchars($field['default']); } } @@ -456,7 +457,7 @@ function encode($record,$tab) { if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab ist leer oder existiert nicht (TAB: $tab)."); - $this->errorMessage = ''; + //$this->errorMessage = ''; if(is_array($record)) { foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) { @@ -556,14 +557,12 @@ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n"; } break; - /* case 'ISEMAIL': - if(!preg_match("", $field_value)) { + if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,4}$/i", $field_value)) { $errmsg = $validator['errmsg']; $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n"; } break; - */ case 'ISINT': $tmpval = intval($field_value); if($tmpval === 0 and !empty($field_value)) { @@ -602,6 +601,9 @@ 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") { @@ -631,14 +633,22 @@ if($action == "INSERT") { if($field['formtype'] == 'PASSWORD') { $sql_insert_key .= "`$key`, "; - $sql_insert_val .= "md5('".$record[$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') { - $sql_update .= "`$key` = md5('".$record[$key]."'), "; + if($field['encryption'] == 'CRYPT') { + $sql_update .= "`$key` = '".crypt($record[$key])."', "; + } else { + $sql_update .= "`$key` = md5('".$record[$key]."'), "; + } } else { $sql_update .= "`$key` = '".$record[$key]."', "; } @@ -646,6 +656,7 @@ } } } + // F�ge Backticks nur bei unvollst�ndigen Tabellennamen ein if(stristr($this->formDef['db_table'],'.')) { @@ -835,9 +846,12 @@ } 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"]["userid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true; + if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true; if(@stristr($perm,$this->formDef["auth_preset"]["perm_other"])) $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) $result = true; + return $result; } -- Gitblit v1.9.1