From 286d1bf1b746b49e43fd674bbc47afd25adfbedb Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 31 Jan 2010 12:33:18 -0500
Subject: [PATCH] Fixed: FS#1053 - Syntax Error in form_list.php

---
 interface/lib/classes/tform.inc.php |   52 ++++++++++++++++++++++++++--------------------------
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 3d29591..31916ac 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -131,6 +131,9 @@
 				$wb = array();
 				
 				include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng');
+				
+				if(is_array($wb)) $wb_global = $wb;
+				
                 if($module == '') {
 					$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
 					if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng";
@@ -140,6 +143,12 @@
 					if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
 					include($lng_file);
                 }
+				
+				if(is_array($wb_global)) {
+					$wb = array_merge($wb_global,$wb);
+				}
+				if(isset($wb_global)) unset($wb_global);
+				
                 $this->wordbook = $wb;
 
                 return true;
@@ -700,7 +709,7 @@
                                         }
                                 break;
                                 case 'ISEMAIL':
-                                        if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
+                                        if(!preg_match("/^\w+[\w.-]*\w{0,}@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
                                                 $errmsg = $validator['errmsg'];
                                                 if(isset($this->wordbook[$errmsg])) {
                                                     $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
@@ -816,8 +825,10 @@
                                                         $sql_insert_key .= "`$key`, ";
                                                         if($field['encryption'] == 'CRYPT') {
                                                                 $salt="$1$";
+																$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 																for ($n=0;$n<8;$n++) {
-																	$salt.=chr(mt_rand(64,126));
+																	//$salt.=chr(mt_rand(64,126));
+																	$salt.=$base64_alphabet[mt_rand(0,63)];
 																}
 																$salt.="$";
 																// $salt = substr(md5(time()),0,2);
@@ -849,8 +860,10 @@
                                                 if($field['formtype'] == 'PASSWORD') {
 														if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
                                                                 $salt="$1$";
+																$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 																for ($n=0;$n<8;$n++) {
-																	$salt.=chr(mt_rand(64,126));
+																	//$salt.=chr(mt_rand(64,126));
+																	$salt.=$base64_alphabet[mt_rand(0,63)];
 																}
 																$salt.="$";
 																// $salt = substr(md5(time()),0,2);
@@ -961,6 +974,9 @@
         foreach( $this->formDef["tabs"] as $key => $tab) {
 
             $tab['name'] = $key;
+			// Translate the title of the tab
+			$tab['title'] = $this->lng($tab['title']);
+			
             if($tab['name'] == $active_tab) {
 
                 // If module is set, then set the template path relative to the module..
@@ -968,8 +984,7 @@
 
                 // Generate the template if it does not exist yet.
 				
-				// Translate the title of the tab
-				$tab['title'] = $this->lng($tab['title']);
+				
 								
                 if(!is_file($tab["template"])) {
                      $app->uses('tform_tpl_generator');
@@ -1017,7 +1032,11 @@
 
         function datalogSave($action,$primary_id, $record_old, $record_new) {
                 global $app,$conf;
-
+				
+				$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
+				return true;
+				
+				/*
                 // Add backticks for incomplete table names.
                 if(stristr($this->formDef['db_table'],'.')) {
                         $escape = '';
@@ -1026,26 +1045,6 @@
                 }
 
                 $this->diffrec = array();
-				/*
-                if(is_array($record_new) && count($record_new) > 0) {
-                        foreach($record_new as $key => $val) {
-                                if(@$record_old[$key] != $val) {
-										// Record has changed
-                                        $diffrec[$key] = array('old' => @$record_old[$key],
-                                                               'new' => $val);
-                                }
-                        }
-                } elseif(is_array($record_old)) {
-                        foreach($record_old as $key => $val) {
-                                if($record_new[$key] != $val) {
-										// Record has changed
-                                        $diffrec[$key] = array('new' => $record_new[$key],
-                                                               'old' => $val);
-                                }
-                        }
-                }
-				$this->diffrec = $diffrec;
-				*/
 				
 				// Full diff records for ISPConfig, they have a different format then the simple diffrec
 				$diffrec_full = array();
@@ -1098,6 +1097,7 @@
                 }
 
                 return true;
+				*/
 
         }
 

--
Gitblit v1.9.1