Marius Cramer
2013-11-14 7fe908c50c8dbc5cc05f571dbe11d66141caacd4
interface/lib/classes/tform.inc.php
@@ -58,6 +58,7 @@
*
*/
class tform {
        /**
@@ -124,24 +125,24 @@
    function loadFormDef($file,$module = '') {
                global $app,$conf;
                include($file);
      include $file;
                $this->formDef = $form;
                $this->module = $module;
            $wb = array();
            
            include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng');
      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";
               include($lng_file);
         include $lng_file;
                } else {
               $lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
               if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
               include($lng_file);
         include $lng_file;
                }
            if(is_array($wb_global)) {
@@ -223,6 +224,7 @@
        return $new_record;
        }
        /**
        * Get the key => value array of a form filled from a datasource definitiom
        *
@@ -230,7 +232,6 @@
        * @param record = Dataset as array
        * @return key => value array for the value field of a form
        */
        function getDatasourceData($field, $record) {
                global $app;
@@ -626,6 +627,7 @@
                return $new_record;
        }
        /**
        * Rewrite the record data to be stored in the database
        * and check values with regular expressions.
@@ -734,6 +736,10 @@
                return $new_record;
        }
      
      /**
        * process the filters for a given field.
        *
@@ -743,7 +749,6 @@
      * @param filter_event = 'SAVE'or 'SHOW'
        * @return record
        */
        function filterField($field_name, $field_value, $filters, $filter_event) {
         global $app;
@@ -774,6 +779,7 @@
            return $returnval;
        }
        /**
        * process the validators for a given field.
        *
@@ -782,7 +788,6 @@
        * @param validatoors = Array of validators
        * @return record
        */
        function validateField($field_name, $field_value, $validators) {
                global $app;
@@ -931,7 +936,7 @@
                        if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
                        $groups=explode(".",$field_value);
                        foreach($groups as $group){
                           if($group<0 OR $group>255)
                  if($group<0 or $group>255)
                           $vip=0;
                        }
                        }else{$vip=0;}
@@ -1030,6 +1035,7 @@
                return true;
        }
        /**
        * Create SQL statement
@@ -1189,6 +1195,7 @@
                return $sql;
        }
        /**
        * Debugging arrays.
        *
@@ -1323,7 +1330,7 @@
                        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;
         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;
@@ -1469,6 +1476,10 @@
      
      }
      
      /**
       * Generate HTML for DATETIME fields.
       * 
@@ -1571,6 +1582,7 @@
         
         return $out;
      }
}
?>