From c86da31b33c57df2e2cc611bf088be70830bcd0c Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Sun, 21 Mar 2010 07:05:13 -0400 Subject: [PATCH] Fixed: FS#1111 - Delete an 'in use' template should be blocked --- interface/lib/classes/tform.inc.php | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 2d258f6..9c2ec9c 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; @@ -182,7 +191,7 @@ break; case 'CURRENCY': - $new_record[$key] = number_format($record[$key], 2, ',', ''); + $new_record[$key] = number_format((double)$record[$key], 2, ',', ''); break; default: @@ -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"; @@ -965,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.. @@ -972,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'); @@ -1188,7 +1199,7 @@ // translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook function lng($msg) { - global $app; + global $app,$conf; if(isset($this->wordbook[$msg])) { return $this->wordbook[$msg]; -- Gitblit v1.9.1