Odyssey
cu_fun.i
1 <?php
2 // These functions are used to display text properly based on how it is stored in the
3 // database. They should also prepare strings for being saved in the database
4  function disp_text($text) {
5  // ** MWS 7/23/2004 -- PASS ENT_QUOTES -- So single quotes ' are escaped
6  return htmlspecialchars(trim($text), ENT_QUOTES);
7  }
8 
9  function save_text($text, $max=0) {
10  // Currently this is ONLY setup for POSTGRES
11  // What will need to be done is double up the ' or ", depending on
12  // which is used to define the string
13 
14  // Before modifying the text, make sure it does NOT go past the maximum
15  // NOTE: if max is 0, then that is the same as unlimited
16  if ($max > 0)
17  $text = substr($text, 0, $max);
18 
19  $text = prep_save(trim($text));
20 
21  return $text;
22  }
23 
24  function post_text($text) {
25  // Make sure any added slashes have been removed
26  $text = trim($text);
27 
28  return $text;
29  }
30  function dollar_amt($fmt_value) {
31  $return_amt = $fmt_value;
32  // First strip the $ '-' and ,'s from the number
33  // then take the doubleval of the amount
34 
35  return $return_amt;
36  }
37  function dateformat($pFormat, $pDate, $pNull=1) {
38  if (trim($pDate) == "" && $pNull == 1)
39  return $pDate;
40  else
41  return date($pFormat, strtotime($pDate));
42  }
43 ?>