Updates for php
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 28 Nov 2016 20:20:47 +0000 (15:20 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 28 Nov 2016 20:20:47 +0000 (15:20 -0500)
Removing calls to deprecated functions
ereg eregi ereg_relpace session_register session_unregister

admin/Contact/index.phtml
admin/Contact/mailout.phtml
admin/Contact/query_contact.phtml
admin/htmlarea/plugins/ImageManager/Classes/NetPBM.php
admin/htmlarea/plugins/ImageManager/Classes/Transform.php
classes/glm-Events-calendar-2-0.phtml
setup.phtml

index 50e776d..9012fb8 100755 (executable)
@@ -1,23 +1,25 @@
-<?php 
+<?php
 session_start();
 require_once("../../setup.phtml");
 require_once("contact_setup.inc");
 error_reporting();
 if(isset($mailout))
 {
-       session_unregister("mailout");
+    unset($_SESSION['mailout']);
+       //session_unregister("mailout");
 }
 if(isset($sess_vars))
 {
        extract($sess_vars);
-       session_unregister("sess_vars");
+    unset($_SESSION['sess_vars']);
+       //session_unregister("sess_vars");
 }
 //$dbd = db_connect();
-$qs = "SELECT  count(*) as total 
+$qs = "SELECT  count(*) as total
           FROM         ".TABLE;
 if( TABLE == CUSTOMER_TABLE )
 {
-       $qs .= " WHERE fname != '-Guest-'";     
+       $qs .= " WHERE fname != '-Guest-'";
 }
 $res = $DB->db_exec($qs);
 $total = pg_result($res,0,'total');
@@ -29,26 +31,26 @@ html_nav_table($nav,$navWidth);
     <td colspan=4>
        There
        <?
-       if($total < 1 ) 
+       if($total < 1 )
        {
                echo " No records";
        }
-       elseif($total > 1) 
+       elseif($total > 1)
        {
                echo "are $total contacts";
        }
-       else 
+       else
        {
                echo "is $total contact";
        }
        ?> in the database.
        </td>
-  </tr>        
+  </tr>
   <tr>
     <th colspan=4 class="theader">
        Search:
     </th>
-  </tr>        
+  </tr>
   <tr>
     <td colspan=4>
        <b>Search records for:</b><br>
@@ -78,8 +80,8 @@ html_nav_table($nav,$navWidth);
        if(all == 0) {
                if(ping == 0) {
                        errors += '-You must select a search type\n';
-               }       
-       }       
+               }
+       }
 
        for(var i=0;i<<?echo count($fields)?>;i++) {
                if(this.ifields.options[i].selected) {
@@ -92,29 +94,29 @@ html_nav_table($nav,$navWidth);
                        this.rfvalue.value += ':' + this.return_fields.options[i].value;
                }
        }
-       
+
        for(var i=0;i<1;i++) {
                if(this.dates.options[i].selected) {
                        this.rdvalue.value += ':' + this.dates.options[i].value;
                }
        }
+
        if(all == 0) {
                if(this.fvalue.value == '') {
                        errors += '-You must select at least one field to search in\n';
                }
        }
-       
+
         if(this.rfvalue.value == '') {
                errors += '-You must select at least one field for output\n';
        }
-       
+
        if(all == 1) {
                if(errors == '') {
                        return(true);
                }
        }
-       
+
        if(errors == '') {
                return(true);
        }
@@ -124,7 +126,7 @@ html_nav_table($nav,$navWidth);
                msg += 'the following and resubmit\n\n';
                msg += errors + '\n\n';
                msg += '_______________________________________\n\n';
-       
+
                alert(msg);
                return(false);
        }
@@ -188,8 +190,8 @@ html_nav_table($nav,$navWidth);
 ?>
        <br><b>Search Type:</b><br>
   <select name="search_type" size=4>
-  <option value="1" <?=(!isset($search_type) || $search_type=="1")?"selected":""?>>Exact string 
-  <option value="2" <?=($search_type=="2")?"selected":""?>>And 
+  <option value="1" <?=(!isset($search_type) || $search_type=="1")?"selected":""?>>Exact string
+  <option value="2" <?=($search_type=="2")?"selected":""?>>And
   <option value="3" <?=($search_type=="3")?"selected":""?>>Or
   <option value="4" <?=($search_type=="4")?"selected":""?>>Not
   </select>
@@ -213,7 +215,7 @@ html_nav_table($nav,$navWidth);
                        $res = db_auto_get_data($qs);
                        if(is_array($res))
                        {
-                               foreach($res as $i=>$data) 
+                               foreach($res as $i=>$data)
                                {
                                ?>
                                <label for="intfield<?php echo $data['id'];?>"><input type="checkbox" id="intfield<?php echo $data['id'];?>" name="cols[]" value="<?echo $data['id'];?>" <?php if(is_array( $cols ) && in_array($data['id'],$cols)){echo 'checked';}?>>
@@ -229,7 +231,7 @@ html_nav_table($nav,$navWidth);
     <th colspan=4>
        Output of records:
     </th>
-  </tr>        
+  </tr>
   <tr>
     <td class="small" valign=top>
        <b>Output Fields:</b><br>
@@ -278,7 +280,7 @@ html_nav_table($nav,$navWidth);
   <option value="" <?=(!isset($file) || $file == "")?"selected":""?>>No File
   <option value="zip" <?=($file=="zip")?"selected":""?>>zip file
   <option value="gz" <?=($file=="gz")?"selected":""?>>tar.gz(tar ball)
-  <option value="rpt" <?=($file=="rpt")?"selected":""?>>text file 
+  <option value="rpt" <?=($file=="rpt")?"selected":""?>>text file
   </select>
   </td>
   <td valign=top class=small width=25%>
@@ -303,16 +305,16 @@ html_nav_table($nav,$navWidth);
     <th colspan=4 class="theader">
        Search Dates Ranges
     </th>
-  </tr>        
+  </tr>
   <tr>
     <th colspan=2>
-       From 
+       From
     </th>
     <th colspan=2>
-       To 
+       To
     </th>
-  </tr>        
-       
+  </tr>
+
   <?php
        if($p_date_from)
        {
@@ -321,7 +323,7 @@ html_nav_table($nav,$navWidth);
                <th colspan=4>
                Last Purchase Date
                </th>
-         </tr> 
+         </tr>
          <tr>
          <td align="center" colspan=2> <?echo $p_date_from?> </td>
          <td align="center" colspan=2> <?echo $p_date_to?> </td>
@@ -333,7 +335,7 @@ html_nav_table($nav,$navWidth);
     <th colspan=4>
        Create Date
     </th>
-  </tr>        
+  </tr>
   <tr>
   <td align="center" colspan=2> <?echo $c_date_from?> </td>
   <td align="center" colspan=2> <?echo $c_date_to?> </td>
@@ -346,7 +348,7 @@ html_nav_table($nav,$navWidth);
                <th colspan=4>
                 Last Access Date
                </th>
-         </tr> 
+         </tr>
          <tr>
          <td align="center" colspan=2> <?echo $a_date_from?> </td>
          <td align="center" colspan=2> <?echo $a_date_to?> </td>
index 6c794b2..2becb72 100644 (file)
@@ -16,34 +16,34 @@ $BodyFilename = $Filename.".body";
 $ToFilename = $Filename.".to";
 $ReadyFilename = $Filename.".ready";
 
-if(!$dbd = db_connect(CONN_STR)) 
+if(!$dbd = db_connect(CONN_STR))
        html_error(DB_ERROR_MSG,1);
 $postmail = stripslashes($postmail);
-$postmail = eregi_replace("SELECT.*FROM","SELECT email INTO TEMPORARY temp_table FROM",$postmail);
-$postmail = eregi_replace("ORDER BY.*","",$postmail);
+$postmail = preg_replace("%SELECT.*FROM%i","SELECT email INTO TEMPORARY temp_table FROM",$postmail);
+$postmail = preg_replace("%ORDER BY.*%i","",$postmail);
 $postmail .= " AND ".MAILOK." = 't'";
 $postmail .= ";CREATE INDEX email_indx on temp_table (email);";
 
-if(!$mailres = db_exec($dbd,$postmail)) 
+if(!$mailres = db_exec($dbd,$postmail))
        html_error(DB_ERROR_MSG.__LINE__.$postmail,1);
 
-$mailqs = "SELECT 
+$mailqs = "SELECT
                   DISTINCT ON (email) email
                   FROM         temp_table
                   GROUP BY email;";
 flush();
-if(!$mailres = db_exec($dbd,$mailqs)) 
+if(!$mailres = db_exec($dbd,$mailqs))
        html_error(DB_ERROR_MSG.__LINE__.$mailqs,1);
 
 if(db_numrows($mailres)>0)
        {
-       for($a=0;$a<db_numrows($mailres);$a++) 
+       for($a=0;$a<db_numrows($mailres);$a++)
                {
-               $mvdata = db_fetch_array($mailres,$a,PGSQL_ASSOC);      
-               $email = trim($mvdata["email"]); 
+               $mvdata = db_fetch_array($mailres,$a,PGSQL_ASSOC);
+               $email = trim($mvdata["email"]);
                if($email)
                        {
-                       $mail[] = $email;       
+                       $mail[] = $email;
                        }
                }
        }
@@ -62,8 +62,8 @@ else {
 if($mail != "") {
        // I am changing this to a two part mime type email
        // html and text
-       // using class_html     
-       $responseqs = "SELECT   * 
+       // using class_html
+       $responseqs = "SELECT   *
                                   FROM         news_response
                                   WHERE        id = $mail_id";
        if(!$resres = db_exec($dbd,$responseqs))
@@ -84,7 +84,7 @@ if($mail != "") {
        $data['image2'] = add_image($responserow["image2"],$responserow["image2_align"]);
        $data['image3'] = add_image($responserow["image3"],$responserow["image3_align"]);
        $data['url'] = URL_BASE;
-       
+
        $html = explode_template(NEWSLETTER_PROTOTYPE,$data);
 
        // text part of email
@@ -96,7 +96,7 @@ if($mail != "") {
        $text .= "with the word \"CANCEL\" on the subject line. You will then be removed \n";
        $text .= "from future mailings.\n";
        $text .= "-------------------------------------------------------------------\n";
-       
+
        // Write the temp.header file
        $glm_headers = "NotifyAddr: ".OWNER_EMAIL."\n"
                . "ProcessName: ".SITENAME."\n"
@@ -115,7 +115,7 @@ if($mail != "") {
                                "Subject: $subject\n".
                                "Reply-to: ".REPLY_TO."\n".
                                "Mime-Version: 1.0\n".
-                               "Content-Type: multipart/alternative; boundary=ContentBoundry\n\n";     
+                               "Content-Type: multipart/alternative; boundary=ContentBoundry\n\n";
        $fp = fopen($BodyFilename,"w");
        if(HTML_EMAIL=="ON"){
                $body_html = '--ContentBoundry
@@ -132,7 +132,7 @@ Content-Type: text/html; charset="UTF-8"
        }
        else{
                fputs($fp,$headers,strlen($headers));
-               fputs($fp,$text,strlen($text)); 
+               fputs($fp,$text,strlen($text));
        }
        fclose($fp);
        // write the temp.ready file and your done!
index 1e8f9e2..e2b9904 100755 (executable)
@@ -5,7 +5,6 @@ include("contact_setup.inc");
 //$Id: query_contact.phtml,v 1.1.1.1 2007/04/19 13:06:15 matrix Exp $
 /* Includes  */
 extract($_POST);
-session_register("sess_vars");
 function clean_array(&$array){
        if(is_array($array)){
                $counter = 0;
@@ -18,15 +17,16 @@ function clean_array(&$array){
        }
 }
 $sess_vars = $HTTP_POST_VARS;
+$_SESSION['sess_vars'] = $sess_vars;
 if(!isset($query_no)) {
-       /* The fields array is sent as a string 
+       /* The fields array is sent as a string
                split it out using : as delimiter */
-       $fvalue = ereg_replace("^:","",$fvalue);
-       $fields = split(":",$fvalue);
-       $rfvalue = ereg_replace("^:","",$rfvalue);
-       $return_fields = split(":",$rfvalue);
-       $dates = ereg_replace("^:","",$rdvalue);
-       $dates = split(":",$dates);
+       $fvalue = preg_replace("%^:%","",$fvalue);
+       $fields = preg_split("%:%",$fvalue);
+       $rfvalue = preg_replace("%^:%","",$rfvalue);
+       $return_fields = preg_split("%:%",$rfvalue);
+       $dates = preg_replace("%^:%","",$rdvalue);
+       $dates = preg_split("%:%",$dates);
 
        clean_array($return_fields);
        clean_array($dates);
@@ -42,11 +42,11 @@ if(!isset($query_no)) {
 
        function getKeywords($keywords) {
                /* Replace the whitespace with a , */
-               $keywords = ereg_replace(" ",",",$keywords);
-       
-               while(ereg(",,",$keywords)) {
+               $keywords = preg_replace("% %",",",$keywords);
+
+               while(preg("%,,%",$keywords)) {
                /* Replace the ,, with a , */
-                       $keywords = ereg_replace(",,",",",$keywords);
+                       $keywords = preg_replace("%,,%",",",$keywords);
                }
                $seperated = explode(",",$keywords);
                /* Return exploded string */
@@ -74,7 +74,7 @@ if(!isset($query_no)) {
                        $compare = "AND";
                        $NOT = TRUE;
                break;
-       
+
                default:
                        echo "not valid";
                break;
@@ -84,26 +84,26 @@ if(!isset($query_no)) {
                for($rip=0;$rip<count($keywords);$rip++) {
                        $keywords[$rip] = trim($keywords[$rip]);
                        /* if * is at the begging the replace with .* */
-                       $keywords[$rip] = ereg_replace("[\x2a]",".*",$keywords[$rip]);
-                       $keywords[$rip] = ereg_replace("[\x3f]",".?",$keywords[$rip]);
-                       $keywords[$rip] = ereg_replace("[\x2b]",".+",$keywords[$rip]);
+                       $keywords[$rip] = preg_replace("%[\x2a]%",".*",$keywords[$rip]);
+                       $keywords[$rip] = preg_replace("%[\x3f]%",".?",$keywords[$rip]);
+                       $keywords[$rip] = preg_replace("%[\x2b]%",".+",$keywords[$rip]);
                }
        }
        else {
                $keywords = trim($keywords);
                /* if * is at the begging the replace with .* */
-               $keywords = ereg_replace("[\x2a]",".*",$keywords);
-               $keywords = ereg_replace("[\x3f]",".?",$keywords);
-               $keywords = ereg_replace("[\x2b]",".+",$keywords);
+               $keywords = preg_replace("%[\x2a]%",".*",$keywords);
+               $keywords = preg_replace("%[\x3f]%",".?",$keywords);
+               $keywords = preg_replace("%[\x2b]%",".+",$keywords);
        }
-       
+
        switch($alter) {
                /* $alter defines where to look in fields */
                case "1":
                        $begin = "^";
                        $end = "";
                break;
-       
+
                case "2":
                        $begin = "";
                        $end = " *$";
@@ -114,7 +114,7 @@ if(!isset($query_no)) {
                        $end = "";
                break;
        }
-       
+
        $operator = " ";
        if($NOT) {
                $operator .= "!~";
@@ -125,7 +125,7 @@ if(!isset($query_no)) {
        if($case == "OFF") {
                $operator .= "*";
        }
-       if($search == "" && !( count( $fields ) == 1 && $fields[0] == '' ) ) 
+       if($search == "" && !( count( $fields ) == 1 && $fields[0] == '' ) )
        {
                $operator = "=";
        }
@@ -155,7 +155,7 @@ if(!isset($query_no)) {
                        $query_string .= ",";
                }
        }
-       if(!$ALL) {     
+       if(!$ALL) {
                $query_string .= "\nFROM\t".TABLE." \nWHERE\t".WHERE."\nAND\t";
                $query_string .= "(";
                for($b=0;$b<count($fields);$b++) {
@@ -231,7 +231,7 @@ if(!isset($query_no)) {
                $tp_str = mktime(0,0,0,$tp_month,$tp_day,$tp_year);
                $fa_str = mktime(0,0,0,$fa_month,$fa_day,$fa_year);
                $ta_str = mktime(0,0,0,$ta_month,$ta_day,$ta_year);
-               
+
                if($fp_str<$tp_str) {
                        $fp_date = $fp_month."/".$fp_day."/".$fp_year;
                        $tp_date = $tp_month."/".$tp_day."/".$tp_year;
@@ -258,7 +258,7 @@ if(!isset($query_no)) {
        if(isset($fc_month)) {
                $fc_str = mktime(0,0,0,$fc_month,$fc_day,$fc_year);
                $tc_str = mktime(0,0,0,$tc_month,$tc_day,$tc_year);
-               
+
                if($fc_str<$tc_str) {
                        $fc_date = $fc_month."/".$fc_day."/".$fc_year;
                        $tc_date = $tc_month."/".$tc_day."/".$tc_year;
@@ -271,11 +271,11 @@ if(!isset($query_no)) {
                        $query_string .= " AND create_date <= '$tc_date'";
                }
        }
-}      
+}
 else {
 //     if(!$dbd = db_connect()) html_error(DB_ERROR_MSG,0);
 
-       $qs = "SELECT   query_name,query,delimiter,file 
+       $qs = "SELECT   query_name,query,delimiter,file
                   FROM         query_db
                   WHERE        id = $query_no";
 
@@ -355,7 +355,7 @@ html_nav_table($nav,$navWidth);
        <?if(isset($query_name)) {
        echo "Query ".$query_name." Recalled";
        }?>
-       
+
        <form action="list_contact.phtml" method="POST">
        <input type="hidden" name="delimiter" value="<?echo $delimiter?>">
        <input type="hidden" name="file" value="<?echo $file?>">
@@ -409,19 +409,19 @@ html_nav_table($nav,$navWidth);
 //if(!$dbd = db_connect()) html_error("Cant connect",0);
 
 $qs = "SELECT  id
-          FROM         query_db 
+          FROM         query_db
           WHERE        query_name = '(current)'";
 
 if(!$res = $DB->db_exec($qs)) html_error(DB_ERROR_MSG.$qs,0);
 
 if(!$row = $DB->db_fetch_array($res,0,PGSQL_ASSOC)) {
-       $qs = "INSERT 
+       $qs = "INSERT
                   INTO         query_db
                                        (query_name,query,file,delimiter)
                   VALUES       ('(current)','$query','$file','$delimiter')";
 }
 else {
-       $qs = "UPDATE   query_db 
+       $qs = "UPDATE   query_db
                   SET          query = '$query',
                                        file = '$file',
                                        delimiter = '$delimiter'
@@ -430,6 +430,6 @@ else {
 //@db_close($dbd);
 
 if(!$DB->db_auto_exec($qs)) html_error(DB_ERROR_MSG.$qs,0);
-         
+
 footer();
 ?>
index 35190e0..4dfe862 100755 (executable)
@@ -4,7 +4,7 @@
 ** Version.......:  1.0
 ** Author........:  Xiang Wei ZHUO <wei@zhuo.org>
 ** Filename......:  NetPBM.php
-** Last changed..:  30 Aug 2003 
+** Last changed..:  30 Aug 2003
 ** Notes.........:  Orginal is from PEAR
 **/
 
@@ -45,7 +45,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
     function Image_Transform_Driver_NetPBM()
     {
         $this->uid = md5($_SERVER['REMOTE_ADDR']);
-            
+
         return true;
     } // End function Image_NetPBM
 
@@ -90,7 +90,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
      * @param int $crop_width new cropped image width
      * @param int $crop_height new cropped image height
      */
-    function crop($crop_x, $crop_y, $crop_width, $crop_height) 
+    function crop($crop_x, $crop_y, $crop_width, $crop_height)
     {
         $this->command[] = IMAGE_TRANSFORM_LIB_PATH .
                             "pnmcut -left $crop_x -top $crop_y -width $crop_width -height $crop_height";
@@ -106,7 +106,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
         $angle = -1*floatval($angle);
 
         if($angle > 90)
-        {   
+        {
             $this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmrotate -noantialias 90";
             $this->rotate(-1*($angle-90));
         }
@@ -124,9 +124,9 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
      *
      * @param boolean $horizontal true if horizontal flip, vertical otherwise
      */
-    function flip($horizontal) 
+    function flip($horizontal)
     {
-        if($horizontal) 
+        if($horizontal)
             $this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmflip -lr";
         else
             $this->command[] = IMAGE_TRANSFORM_LIB_PATH . "pnmflip -tb";
@@ -200,7 +200,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
                 break;
         } // switch
         return implode('|', $this->command);
-    } 
+    }
 
     /**
      * Save the image file
@@ -213,10 +213,10 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
     function save($filename, $type=null, $quality = 85)
     {
         $cmd = $this->_postProcess('', $quality, $type) . ">$filename";
-            
+
                //if we have windows server
-        if(isset($_ENV['OS']) && eregi('window',$_ENV['OS']))
-                       $cmd = ereg_replace('/','\\',$cmd);
+        if(isset($_ENV['OS']) && preg('%window%i',$_ENV['OS']))
+                       $cmd = preg_replace('%/%','\\',$cmd);
         //echo $cmd."##";
         $output = system($cmd);
                error_log('NETPBM: '.$cmd);
@@ -236,7 +236,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
     {
         header('Content-type: image/' . $type);
         $cmd = $this->_postProcess($type, $quality);
-        
+
         passthru($cmd);
         $this->command = array();
     }
index 0738569..b02c4a3 100755 (executable)
@@ -4,9 +4,9 @@
 ** Version.......:  1.0
 ** Author........:  Xiang Wei ZHUO <wei@zhuo.org>
 ** Filename......:  Transform.php
-** Last changed..:  30 Aug 2003 
+** Last changed..:  30 Aug 2003
 ** Notes.........:  Orginal is from PEAR
-                    
+
                     Added a few extra,
                         - create unique filename in a particular directory,
                           used for temp image files.
@@ -343,9 +343,9 @@ Class Image_Transform
         $id_length = strlen($id);
 
         while (false !== ($entry = $d->read())) {
-            if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !ereg($entry, $this->image))
+            if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !preg_match("%$entry%", $this->image))
             {
-                //echo filemtime($this->directory.'/'.$entry)."<br>"; 
+                //echo filemtime($this->directory.'/'.$entry)."<br>";
                 //echo time();
 
                 if (filemtime($dir.'/'.$entry) + $this->lapse_time < time())
@@ -365,13 +365,13 @@ Class Image_Transform
     function createUnique($dir)
     {
        $unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
-        
+
        //make sure the the unique temp file does not exists
         while (file_exists($dir.$unique_str))
         {
             $unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
         }
-        
+
       $this->cleanUp($this->uid, $dir);
 
        return $unique_str;
@@ -556,7 +556,7 @@ Class Image_Transform
         return null; //PEAR::raiseError("No crop method exists", true);
     }
 
-    function flip() 
+    function flip()
     {
         return null;
     }
index a0272a6..f6815cd 100755 (executable)
@@ -2,20 +2,20 @@
 /**
  *     Event Calendar display
  * used by class_events.inc to display colanedar output.
- *     
+ *
  * @package Toolbox
  * @subpackage Event
  * @author Steve Sutton
  * @filesource
- */ 
+ */
 $LEFTLINK = '<img src="'.BASE_URL.'images/left.gif" class="calleftarrow" border="0">';
 $RIGHTLINK = '<img src="'.BASE_URL.'images/right.gif" class="calrightarrow" border="0">';
 $dbd = db_connect(CONN_STR);
 /**
- * GetTimeStamp 
+ * GetTimeStamp
  * Get unix timestamp from sql date
- * 
- * @param mixed $MySqlDate 
+ *
+ * @param mixed $MySqlDate
  * @access public
  * @return void
  */
@@ -29,15 +29,15 @@ function GetTimeStamp($SqlDate)
 
        $var_timestamp = mktime(0,0,0,$var_month,$var_day,$var_year);
        return($var_timestamp); // return it to the user
-}  
+}
 /**
- * ordinalDay 
+ * ordinalDay
  * get ordinal (th) day for given timestamp
- * 
- * @param mixed $ord 
- * @param mixed $day 
- * @param mixed $month 
- * @param mixed $year 
+ *
+ * @param mixed $ord
+ * @param mixed $day
+ * @param mixed $month
+ * @param mixed $year
  * @access public
  * @return void
  */
@@ -53,19 +53,19 @@ function ordinalDay($ord, $day, $month, $year)
                {
                        $dayOccurs++;
                        if ($dayOccurs == $ord)
-                       { 
-                       $ordDay = $i; 
+                       {
+                       $ordDay = $i;
                        }
                }
        }
        return $ordDay;
-}  
+}
 /**
  * lastDoyOfMonth
  *
- * <p>given timestamp get the last day of the month it 
+ * <p>given timestamp get the last day of the month it
  * fall in</p>
- * 
+ *
  * @param string $timestamp
  * @return string timestamp
  */
@@ -97,16 +97,16 @@ if(!$year)
 }
 if(!$month || $month == "All")
 {
-       $month = date("n");     
+       $month = date("n");
 }
-if(ereg("^0([0-9]).*",$month,$part))
+if(preg("%^0([0-9]).*%",$month,$part))
 {
        $month = $part[1];
 }
 $st1 = mktime(0,0,0,$month - 1,1,$year);
 $st2 = mktime(0,0,0,$month + 1,1,$year);
 /**
- * build start and end timestamps for getting an array of events for the 
+ * build start and end timestamps for getting an array of events for the
  * month.
  */
 $starting = date("m-d-Y",firstDayOfMonth($st1));
@@ -126,13 +126,13 @@ SELECT e.id,e.header,
           bdate as sdate, e.edate as edate,weekom,
           e.btime,e.etime,e.descr,e.loc,e.contact,e.email,e.url,
           e.img,e.daysow,e.reacur,t.topiccolor,
-       case when reacur = 't' then 0 
-when (e.edate - e.bdate) > 1 then (e.edate - e.bdate) 
-       else 0 
-       end as sortflag,e.all_day 
+       case when reacur = 't' then 0
+when (e.edate - e.bdate) > 1 then (e.edate - e.bdate)
+       else 0
+       end as sortflag,e.all_day
 FROM event e left outer join  topic t on (t.id = e.topicid)
        WHERE visable = 't'";
-       $query .= " AND                 e.bdate <= '$ending' 
+       $query .= " AND                 e.bdate <= '$ending'
        AND             e.edate >= '$starting' $addpart";
        $query .= "ORDER BY sortflag desc,e.bdate DESC,e.btime ASC";
        $events_data = db_auto_get_data($query,CONN_STR);
@@ -141,7 +141,7 @@ FROM event e left outer join  topic t on (t.id = e.topicid)
         * this will result in an array like the following:
         * $newdata['x-date'] = $row;
         * in which x-data is the date of the event (ie.) $months['08-07-2005']
-        * and 4row is the $rom from the $evwents_data array 
+        * and 4row is the $rom from the $evwents_data array
         */
 if(is_array($events_data))
 {
@@ -184,7 +184,7 @@ if(is_array($events_data))
                if( $row['weekom'] == 9 )
                {
                        // calculate the timestamps for this month
-                       // start with first 
+                       // start with first
                        $fWeekNum = date("W",$sdate );
                        if( date('w',$sdate) == 0 )
                        {
@@ -336,7 +336,7 @@ $GLOBALS['colorArray'] = array( '#FFCCCC' => 'color1',
                '#CCCCCC' => 'color25' );
 /**
  * disColor
- * 
+ *
  * <p>Goes back to color array and grabs the class for that peticular color.</p>
  *
  * @param string $color
@@ -352,15 +352,15 @@ function disColor( $color )
        return( $GLOBALS['colorArray'][$color] );
 }
 /**
- * cal_time 
- * 
- * @param mixed $time 
+ * cal_time
+ *
+ * @param mixed $time
  * @access public
  * @return void
  */
 function cal_time( $time )
 {
-       if( eregi( "([0-9]{1,2}):?([0-9]{2})? ?([AP]M)", $time, $temp ) )
+       if( preg( "%([0-9]{1,2}):?([0-9]{2})? ?([AP]M)%i", $time, $temp ) )
        {
                $out = (int)$temp[1];
                $out .= ':'.$temp[2];
@@ -373,7 +373,7 @@ function myGetTimeStamp( $time, $all_day )
        static $count,$count2;
        $count = ( $count ) ? $count : 1;
        $count2 = ( $count2 ) ? $count2 : 1;
-       if( eregi( "^([0-9]{1,2}):?([0-9]{1,2})? ?([AP]M)",trim($time), $tar1 ) )
+       if( preg( "%^([0-9]{1,2}):?([0-9]{1,2})? ?([AP]M)%i",trim($time), $tar1 ) )
        {
                if( ( $tar1[3] == 'PM' || $tar1[3] == 'pm' ) && (int)$tar1[1] < 12 )
                {
@@ -401,16 +401,16 @@ function myGetTimeStamp( $time, $all_day )
        }
 }
 /**
- * show_event_headers 
- * 
- * @param mixed $date 
+ * show_event_headers
+ *
+ * @param mixed $date
  * @access public
  * @return void
  */
 function show_event_headers($date)
 {
        global $newdata;
-       if(ereg("([0-9]{1,2})[-/]([0-9]{1,2})[-/]([0-9]{4})",$date,$dpart))
+       if(preg("%([0-9]{1,2})[-/]([0-9]{1,2})[-/]([0-9]{4})%",$date,$dpart))
        {
                $month = (int)$dpart[1];
                $year = (int)$dpart[3];
@@ -442,15 +442,15 @@ function show_event_headers($date)
        return( $output );
 }
 /**
- * data 
- * 
- * @param mixed $month 
- * @param mixed $day 
- * @param mixed $year 
+ * data
+ *
+ * @param mixed $month
+ * @param mixed $day
+ * @param mixed $year
  * @access public
  * @return void
  */
-function data( $month, $day, $year ) 
+function data( $month, $day, $year )
 {
        global $newdata;
        if($month < 10)
@@ -472,13 +472,13 @@ function data( $month, $day, $year )
        }
 }
 /**
- * calendar 
- * 
- * @param mixed $month 
- * @param mixed $year 
- * @param mixed $size 
- * @param mixed $href 
- * @param mixed $href2 
+ * calendar
+ *
+ * @param mixed $month
+ * @param mixed $year
+ * @param mixed $size
+ * @param mixed $href
+ * @param mixed $href2
  * @access public
  * @return void
  */
@@ -486,7 +486,7 @@ function calendar( $month, $year, $size, $href ,$href2) {
        global $RIGHTLINK,$LEFTLINK;
        $LEFTLINK = '<img src="'.BASE_URL.'images/left.gif" class="calleftarrow" border="0">';
        $RIGHTLINK = '<img src="'.BASE_URL.'images/right.gif" class="calrightarrow" border="0">';
-       // Change to month/year to display 
+       // Change to month/year to display
        if( !isset( $month ) )
        {
                $month = date('m');
@@ -555,13 +555,13 @@ function calendar( $month, $year, $size, $href ,$href2) {
                        $calendar = date( "F", mktime( 0, 0, 0, $month + 1, 0, $year ) );
                        break;
        }
-       // determine total number of days in a month 
+       // determine total number of days in a month
        $totaldays = 0;
        while ( checkdate( $month, $totaldays + 1, $year ) )
        {
                $totaldays++;
        }
-       // build table 
+       // build table
        $out = '';
        $out .= '<table class="'.$caltable.'">';
        if( $size == 1 )
@@ -597,7 +597,7 @@ function calendar( $month, $year, $size, $href ,$href2) {
                        ';
        }
        // ensure that a number of blanks are put in so that the first day of the month
-       // lines up with the proper day of the week 
+       // lines up with the proper day of the week
        $offset = date( "w", mktime( 0, 0, 0, $month, 0, $year ) ) + 1;
        $out .= '
                <tr>
@@ -612,8 +612,8 @@ function calendar( $month, $year, $size, $href ,$href2) {
        {
                $offset = 0;
        }
-       // start entering in the information 
-       for ( $day = 1; $day <= $totaldays; $day++ ) 
+       // start entering in the information
+       for ( $day = 1; $day <= $totaldays; $day++ )
        {
                $out .= '
                        <td class="'.$calday.'" valign="top">';
@@ -634,7 +634,7 @@ function calendar( $month, $year, $size, $href ,$href2) {
                $out .= '</td>
                        ';
                $offset++;
-               // if we're on the last day of the week, wrap to the other side 
+               // if we're on the last day of the week, wrap to the other side
                if ( $offset > 6 )
                {
                        $offset = 0;
@@ -650,7 +650,7 @@ function calendar( $month, $year, $size, $href ,$href2) {
                }
        }
        // fill in the remaining spaces for the end of the month, just to make it look
-       // pretty 
+       // pretty
        if ( $offset > 0 )
        {
                $offset = 7 - $offset;
@@ -661,7 +661,7 @@ function calendar( $month, $year, $size, $href ,$href2) {
                                <td class=\"".$calspacer."\">&nbsp;</td>
                                ", $offset );
        }
-       // end the table 
+       // end the table
        $out .= '
                </tr></table>
                ';
index beca8af..b1eff56 100755 (executable)
@@ -12,7 +12,7 @@ ini_set('include_path', '/usr/share/pear' . ':' .ini_get('include_path'));
 if( !isset($SITEINFO) )
 {
 
-       if(!isset($DEBUG))      
+       if(!isset($DEBUG))
        {
                $DEBUG = (isset($mysecretcode) && $mysecretcode == 1234);
        }
@@ -25,19 +25,19 @@ if( !isset($SITEINFO) )
        //$DEBUG = TRUE;
 
        /*
-        *      Customer Setup 
+        *      Customer Setup
         */
        define("SITENAME","Mackinac Island Packages");  // used for outputing name of site in admin area
        define("SITE_NAME",SITENAME);   // same as SITENAME
        define("DB_TYPE", "postgres");  // DB library only knows postgres (FUTURE EXPANSION)
        define("DB_ERROR_MSG", "an error has occured with the database!");      // default error message
        define("MULTIPLE_CAT",0);               // weather or not to use many to many relations
-       define("CAT_LOCK",0);                   // If set to 1 or true will lock the categories 
+       define("CAT_LOCK",0);                   // If set to 1 or true will lock the categories
        define("ENTRIES_PER_PAGE",10);  // default per page number
        define("HTML_HELP_CODE",1);     // this is being depreciated for general help guides
        define("PRODUCTION_MODE","ON"); // used in the email out for contact DB
        define("HTML_EMAIL","ON");      // turn ON for html emails
-       define("ACTIVE_FLAG",1);                // turn on if bus_category table has active bool field 
+       define("ACTIVE_FLAG",1);                // turn on if bus_category table has active bool field
        define("DELUXE_TOOLBOX",1);             // used for the toolbox deluxe vrs.
        define("SEO_URL",1);                    // weather to use Search Engine Optimisezd url's requires .htaccess enabled
        /* integration of different apps */
@@ -84,13 +84,13 @@ if( !isset($SITEINFO) )
        switch( $GLM_SERVER_ID )
        {
 
-               case "devsys.gaslightmedia.com":        
+               case "devsys.gaslightmedia.com":
                        ini_set("display_errors","1");
                        // Use the $BASE_URL for secure URL on Devsys
-                       $BASE_SECURE_URL = $BASE_URL;   
+                       $BASE_SECURE_URL = $BASE_URL;
                        define("AUTH_TEST_MODE","TRUE");
-                       define("BASE_SECURE_URL", $BASE_SECURE_URL."/");         
-                       define("BASE_INSECURE_URL", $BASE_URL."/");      
+                       define("BASE_SECURE_URL", $BASE_SECURE_URL."/");
+                       define("BASE_INSECURE_URL", $BASE_URL."/");
                        define("CONN_STR", "host=devsys dbname=mackinacislandpackages");                // DB connection string
                        define("OWNER_EMAIL", "jamie.kahgee@gmail.com");                // site owner's email address
                        define("FROM_NEWS_EMAIL", "info@gaslightmedia.com");            // site owner's email address
@@ -101,17 +101,17 @@ if( !isset($SITEINFO) )
                        error_reporting(0);
                        ini_set("display_errors","0");
                        $BASE_SECURE_URL = "https://".$base_url;
-                       define("BASE_SECURE_URL", $BASE_SECURE_URL."/");         
-                       $BASE_URL = "http://".$base_url;                                         
-                       define("BASE_INSECURE_URL", $BASE_URL."/");                     
-                       //define("BASE_INSECURE_URL", "http://www.mackinacislandpackage.com/");                 
+                       define("BASE_SECURE_URL", $BASE_SECURE_URL."/");
+                       $BASE_URL = "http://".$base_url;
+                       define("BASE_INSECURE_URL", $BASE_URL."/");
+                       //define("BASE_INSECURE_URL", "http://www.mackinacislandpackage.com/");
                        define("AUTH_TEST_MODE","FALSE");
                        define("CONN_STR", "host=ds4 dbname=mackinacislandpackages");                    // DB connection string
                        define("OWNER_EMAIL", "mackinacpackage@mict.com");               // site owner's email address
                        define("FROM_NEWS_EMAIL", "mackinacpackage@mict.com");          // site owner's email address
                        define("REPLY_TO", "mackinacpackage@mict.com");                  // the reply-to field for email's
                break;
-               default:        
+               default:
             error_reporting( E_ALL ^ E_NOTICE );
                        ini_set("display_errors","1");
                        $BASE_SECURE_URL = "https://".$base_url;
@@ -121,7 +121,7 @@ if( !isset($SITEINFO) )
                                define("BASE_SECURE_URL", $BASE_SECURE_URL."/");         // url used for the secur site
                                $BASE_URL = "http://".$base_url;                                         // This needs to be set to the real url ie. http://www.upnorth.net
                        }
-                       define("BASE_INSECURE_URL", $BASE_URL."/");                     
+                       define("BASE_INSECURE_URL", $BASE_URL."/");
                        define("CONN_STR", "user=nobody dbname=mackinacislandpackages");                         // DB connection string
                        define("OWNER_EMAIL", "mackinacpackage@mict.com");               // site owner's email address
                        define("FROM_NEWS_EMAIL", "mackinacpackage@mict.com");          // site owner's email address
@@ -142,28 +142,28 @@ if( !isset($SITEINFO) )
        define("HELP_IMG",URL_BASE."images/help.gif");          // help image url (depriated)
        define("ORIGINAL_PATH", BASE."images/original/");       // path of original images
        define("RESIZED_PATH", BASE."images/resized/");         // path of first resized image
-       define("MIDSIZED_PATH", BASE."images/midsized/");       // path of half sized of resized 
+       define("MIDSIZED_PATH", BASE."images/midsized/");       // path of half sized of resized
        define("THUMB_PATH", BASE."images/thumb/");                     // path of thumbnail directory
        if( $_SERVER['HTTPS'] == "on" )
        {
                define("ORIGINAL", $BASE_SECURE_URL."/images/original/");       // url of original images
-               define("RESIZED", $BASE_SECURE_URL."/images/resized/");         // url of resized 
+               define("RESIZED", $BASE_SECURE_URL."/images/resized/");         // url of resized
                define("MIDSIZED", $BASE_SECURE_URL."/images/midsized/");       // url of midsized
                define("THUMB", $BASE_SECURE_URL."/images/thumb/");                     // url of thumbnail
        }
        else
        {
                define("ORIGINAL", URL_BASE."images/original/");        // url of original images
-               define("RESIZED", URL_BASE."images/resized/");          // url of resized 
+               define("RESIZED", URL_BASE."images/resized/");          // url of resized
                define("MIDSIZED", URL_BASE."images/midsized/");        // url of midsized
                define("THUMB", URL_BASE."images/thumb/");                      // url of thumbnail
        }
 
-       /** these are the image sizing defines USE THESE ONLY 
+       /** these are the image sizing defines USE THESE ONLY
          only allowed string of 'WxH[<>]' [-quality Percentage]
         */
        define("ITEM_RESIZED", "'287>'");               // used in convert call to resize images
-       define("ITEM_MIDSIZED", "'210>'");              
+       define("ITEM_MIDSIZED", "'210>'");
        define("ITEM_THUMB","'120>'");
 
        define("FOOTER_IMG", URL_BASE."images/logosmall.gif");
@@ -309,7 +309,7 @@ if( !isset($SITEINFO) )
        $states["YT"] =  "Yukon";
 //     $states["Asia"] =  "Asia";
 //     $states["Australia"] =  "Australia";
-//     $states["Bahamas"] =  "Bahamas"; 
+//     $states["Bahamas"] =  "Bahamas";
 //     $states["Caribbean"] =  "Caribbean";
 //     $states["Costa Rica"] =  "Costa Rica";
 //     $states["South America"] =  "South America";
@@ -350,9 +350,9 @@ if( !isset($SITEINFO) )
                        "\xc2\x9f" => "\xc5\xb8"      /* LATIN CAPITAL LETTER Y WITH DIAERESIS*/
                                );
        /**
-        * is_utf8 
-        * 
-        * @param mixed $string 
+        * is_utf8
+        *
+        * @param mixed $string
         * @access public
         * @return void
         */
@@ -360,9 +360,9 @@ if( !isset($SITEINFO) )
                return (preg_match('/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xec][\x80-\xbf]{2}|\xed[\x80-\x9f][\x80-\xbf]|[\xee-\xef][\x80-\xbf]{2}|f0[\x90-\xbf][\x80-\xbf]{2}|[\xf1-\xf3][\x80-\xbf]{3}|\xf4[\x80-\x8f][\x80-\xbf]{2})*$/', $string) === 1);
        }
        /**
-        * cp1252_to_utf8 
-        * 
-        * @param mixed $str 
+        * cp1252_to_utf8
+        *
+        * @param mixed $str
         * @access public
         * @return void
         */
@@ -371,9 +371,9 @@ if( !isset($SITEINFO) )
                return  strtr(utf8_encode($str), $cp1252_map);
        }
        /**
-        * myEncode 
-        * 
-        * @param mixed $string 
+        * myEncode
+        *
+        * @param mixed $string
         * @access public
         * @return void
         */
@@ -387,7 +387,7 @@ if( !isset($SITEINFO) )
                {
                        return( cp1252_to_utf8( $string ) );
                }
-       }       
+       }
 
        /**
         * CreditVal : CreditVal Checks for a valid credit card number doing Luhn check, if no
@@ -397,47 +397,47 @@ if( !isset($SITEINFO) )
         * @param $Num: Credit Card Number
         * @param $Name = '': Type of Card
         * @param $Accepted='' : Accepted array
-        * 
-        * @return bool 
-        * @access 
+        *
+        * @return bool
+        * @access
         **/
-       function CreditVal($Num, $Name = '', $Accepted='') 
-       { 
+       function CreditVal($Num, $Name = '', $Accepted='')
+       {
                $Name = strtolower( $Name );
                $Accepted = strtolower( $Accepted );
                $GoodCard = 1;
-               $Num = ereg_replace("[^[:digit:]]", "", $Num); 
-               switch ($Name) 
-               { 
+               $Num = preg_replace("%[^[:digit:]]%", "", $Num);
+               switch ($Name)
+               {
 
-                       case "mastercard" : 
-                               $GoodCard = ereg("^5[1-5].{14}$", $Num); 
-                       break; 
+                       case "mastercard" :
+                               $GoodCard = preg_match("%^5[1-5].{14}$%", $Num);
+                       break;
 
-                       case "visa" : 
-                               $GoodCard = ereg("^4.{15}$|^4.{12}$", $Num); 
-                       break; 
+                       case "visa" :
+                               $GoodCard = preg_match("%^4.{15}$|^4.{12}$%", $Num);
+                       break;
 
-                       case "americanexpress" : 
-                               $GoodCard = ereg("^3[47].{13}$", $Num); 
-                       break; 
+                       case "americanexpress" :
+                               $GoodCard = preg_match("%^3[47].{13}$%", $Num);
+                       break;
 
-                       case "discover" : 
-                               $GoodCard = ereg("^6011.{12}$", $Num); 
-                       break; 
+                       case "discover" :
+                               $GoodCard = preg_match("%^6011.{12}$%", $Num);
+                       break;
 
-                       case "dinerscard" : 
-                               $GoodCard = ereg("^30[0-5].{11}$|^3[68].{12}$", $Num); 
+                       case "dinerscard" :
+                               $GoodCard = preg_match("%^30[0-5].{11}$|^3[68].{12}$%", $Num);
                        break;
 
                        default:
-                       if( ereg("^5[1-5].{14}$", $Num) ) $Name = "mastercard";
-                       if( ereg("^4.{15}$|^4.{12}$", $Num) ) $Name = "visa";
-                       if( ereg("^3[47].{13}$", $Num) ) $Name = "americanexpress";
-                       if( ereg("^6011.{12}$", $Num) ) $Name = "discover";
-                       if( ereg("^30[0-5].{11}$|^3[68].{12}$", $Num) ) $Name="dinerscard";
+                       if( preg_match("%^5[1-5].{14}$%", $Num) ) $Name = "mastercard";
+                       if( preg_match("%^4.{15}$|^4.{12}$%", $Num) ) $Name = "visa";
+                       if( preg_match("%^3[47].{13}$%", $Num) ) $Name = "americanexpress";
+                       if( preg_match("%^6011.{12}$%", $Num) ) $Name = "discover";
+                       if( preg_match("%^30[0-5].{11}$|^3[68].{12}$%", $Num) ) $Name="dinerscard";
                        break;
-               } 
+               }
 
                // If there's a limit on card types we accept, check for it here.
                if( $Accepted )
@@ -451,28 +451,28 @@ if( !isset($SITEINFO) )
                        if( !$type_verified ) return(FALSE);
                }
 
-               $Num = strrev($Num); 
+               $Num = strrev($Num);
 
-               $Total = 0; 
+               $Total = 0;
 
-               for ($x=0; $x<strlen($Num); $x++) 
-               { 
-                       $digit = substr($Num,$x,1); 
-                       if ($x/2 != floor($x/2)) 
-                       { 
-                               $digit *= 2; 
-                               if (strlen($digit) == 2)  
-                                       $digit = substr($digit,0,1) + substr($digit,1,1); 
-                       } 
-                       $Total += $digit; 
-               } 
-               if ($GoodCard && $Total % 10 == 0) 
+               for ($x=0; $x<strlen($Num); $x++)
+               {
+                       $digit = substr($Num,$x,1);
+                       if ($x/2 != floor($x/2))
+                       {
+                               $digit *= 2;
+                               if (strlen($digit) == 2)
+                                       $digit = substr($digit,0,1) + substr($digit,1,1);
+                       }
+                       $Total += $digit;
+               }
+               if ($GoodCard && $Total % 10 == 0)
                {
-                       return(true); 
+                       return(true);
                }
-               else 
+               else
                {
-                       return(false); 
+                       return(false);
                }
        }
        /* DataBase Library */
@@ -480,14 +480,14 @@ if( !isset($SITEINFO) )
        /**
         * db_connect :Creates a connection to database specified $conn_str
         * @param $conn="" : connection string
-        * 
-        * @return index or bool 
-        * @access 
+        *
+        * @return index or bool
+        * @access
         **/
-       function db_connect($conn="") 
+       function db_connect($conn="")
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                if($conn == "")
@@ -502,16 +502,16 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * db_close :Closes the connection to database specified by the handle dbd      
-        * @param $$dbd : database handle 
-        * 
-        * @return bool 
-        * @access 
+        * db_close :Closes the connection to database specified by the handle dbd
+        * @param $$dbd : database handle
+        *
+        * @return bool
+        * @access
         **/
-       function db_close($dbd) 
+       function db_close($dbd)
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                $ret = pg_close($dbd);
@@ -526,16 +526,16 @@ if( !isset($SITEINFO) )
        /**
          NOTICE DON'T USE THIS
         * db_pconnect :Creates a persistant connection to database specified in $conn_str
-        * @param $$conn="" : connection string 
-        * 
-        * @return 
-        * @access 
+        * @param $$conn="" : connection string
+        *
+        * @return
+        * @access
         **/
-       function db_pconnect($conn="") 
+       function db_pconnect($conn="")
        {
                return( false );
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                if($conn == "")
@@ -551,16 +551,16 @@ if( !isset($SITEINFO) )
 
        /**
         * db_exec : Execute an SQL query
-        * @param $dbd: database handle 
+        * @param $dbd: database handle
         * @param $$qs : Query
-        * 
+        *
         * @return int Returns a valid result index on success 0 on failure
-        * @access 
+        * @access
         **/
-       function db_exec($dbd, $qs) 
+       function db_exec($dbd, $qs)
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                $ret = pg_exec($dbd, $qs);
@@ -574,19 +574,19 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * db_fetch_array :Stores the data in associative indices, using the field names as     
+        * db_fetch_array :Stores the data in associative indices, using the field names as
         * keys.
         * @param $res: valid database result index
         * @param $i: row number
-        * @param $$type : database type 
-        * 
+        * @param $$type : database type
+        *
         * @return array Returns an associative array of key-value pairs
-        * @access 
+        * @access
         **/
-       function db_fetch_array($res, $i, $type) 
+       function db_fetch_array($res, $i, $type)
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                $row = pg_fetch_array($res, $i, $type);
@@ -602,14 +602,14 @@ if( !isset($SITEINFO) )
        /**
         * db_freeresult :Free result memory.
         * @param $$res : valid database result index
-        * 
+        *
         * @return bool - Returns 1 for success 0 for failure
-        * @access 
+        * @access
         **/
-       function db_freeresult($res) 
+       function db_freeresult($res)
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                $ret = pg_freeresult($res);
@@ -625,14 +625,14 @@ if( !isset($SITEINFO) )
        /**
         * db_numrows :Determine number of rows in a result index
         * @param $$res : valid database result index
-        * 
+        *
         * @return int - Returns number of rows
-        * @access 
+        * @access
         **/
-       function db_numrows($res) 
+       function db_numrows($res)
        {
 
-               switch (DB_TYPE) 
+               switch (DB_TYPE)
                {
                        case "postgres":
                                $ret = pg_numrows($res);
@@ -652,18 +652,18 @@ if( !isset($SITEINFO) )
         ***********************************************************************/
 
        /**
-        * db_auto_array :The auto function for retrieving an array based soley on a query      
-        * string. This function makes the connection, does the exec, fetches   
-        * the array, closes the connection, frees memory used by the result,   
+        * db_auto_array :The auto function for retrieving an array based soley on a query
+        * string. This function makes the connection, does the exec, fetches
+        * the array, closes the connection, frees memory used by the result,
         * and then returns the array
         * @param $qs: SQL query string
         * @param $i: row number
         * @param $$type : PGSQL_ASSOC or PGSQL_BOTH or PSQL_NUM
-        * 
+        *
         * @return array - Returns an associative array of key-value pairs
-        * @access 
+        * @access
         **/
-       function db_auto_array($qs, $i, $type) 
+       function db_auto_array($qs, $i, $type)
        {
 
                $dbd = db_connect();
@@ -689,17 +689,17 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * db_auto_exec :The auto function for executing a query.                               
-        * This function makes the connection, does the exec, fetches           
-        * the array, closes the connection, frees memory used by the result,   
+        * db_auto_exec :The auto function for executing a query.
+        * This function makes the connection, does the exec, fetches
+        * the array, closes the connection, frees memory used by the result,
         * and then returns success (not a valid result index)
         * @param $qs: SQL query string
         * @param $$conn="" : Connect String
-        * 
+        *
         * @return int - Returns 1 (or oid, if available) for success 0 for failure
-        * @access 
+        * @access
         **/
-       function db_auto_exec($qs, $conn="") 
+       function db_auto_exec($qs, $conn="")
        {
 
                if($conn == "")
@@ -707,12 +707,12 @@ if( !isset($SITEINFO) )
                $dbd = db_connect($conn);
                if(!$dbd)
                        return(0);
-               if(!db_exec($dbd, $qs)) 
+               if(!db_exec($dbd, $qs))
                {
                        db_close($dbd);
                        return(0);
                }
-               else 
+               else
                {
                        db_close($dbd);
                        return(1);
@@ -720,18 +720,18 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * db_auto_get_data :The auto function for retrieving an array based soley on a query   
-        string. This function makes the connection, does the exec, fetches     
-        the array, closes the connection, frees memory used by the result,     
+        * db_auto_get_data :The auto function for retrieving an array based soley on a query
+        string. This function makes the connection, does the exec, fetches
+        the array, closes the connection, frees memory used by the result,
         and then returns the array
         * @param $qs:  SQL query string
         * @param $CONN_STR: Connect String
         * @param $$fail_mode=0 : Failure Mode
-        * 
+        *
         * @return array Returns an associative array of key-value pairs
-        * @access 
+        * @access
         **/
-       function db_auto_get_data($qs,$conn = CONN_STR,$fail_mode=0) 
+       function db_auto_get_data($qs,$conn = CONN_STR,$fail_mode=0)
        {
 
                if( !($dbd = db_connect($conn)) )
@@ -752,7 +752,7 @@ if( !isset($SITEINFO) )
                }
 
                db_close( $dbd );
-               if(isset($data) && $data!="")   
+               if(isset($data) && $data!="")
                {
                        return( $data );
                }
@@ -765,13 +765,13 @@ if( !isset($SITEINFO) )
        /* HTML Libraries */
 
        /**
-        * html_footer :Generates a footer table on the bottom of the page it's called on.      
+        * html_footer :Generates a footer table on the bottom of the page it's called on.
         and closes out the body and html tags.
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function html_footer() 
+       function html_footer()
        {
                $footer_table_width = "400";
                $footer_table_align = "center";
@@ -796,15 +796,15 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * html_error :Generates a footer table on the bottom of the page it's called on.       
+        * html_error :Generates a footer table on the bottom of the page it's called on.
         and closes out the body and html tags.
         * @param $msg: string error message to be displayed
         * @param $$bail : bool whether or not to exit() after $msg
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function html_error($msg, $bail) 
+       function html_error($msg, $bail)
        {
                ?>
                        <table summary="Error Information" class="errortable" cellspacing="0">
@@ -826,11 +826,11 @@ if( !isset($SITEINFO) )
         * html_nav_table :Generates a navigation table on the page it's called on.
         * @param $nav: associative array with entries like:$nav[text][url]
         * @param $$w : max width of table
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function html_nav_table($nav, $w) 
+       function html_nav_table($nav, $w)
        {
                if( is_array( $nav ) )
                {
@@ -845,16 +845,16 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * html_header :Opens up the html tags, and includes the style sheet link                       
+        * html_header :Opens up the html tags, and includes the style sheet link
         generates a header table on the top of the page it's called on.
-        * @param $title: Page Title 
-        * @param $msg: message to display 
+        * @param $title: Page Title
+        * @param $msg: message to display
         * @param $$img : image to display
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function html_header($title, $msg, $img) 
+       function html_header($title, $msg, $img)
        {
                $header_table_width = "400";
                $header_table_align = "center";
@@ -872,7 +872,7 @@ if( !isset($SITEINFO) )
                        <tr class="headertr">
                        <td class="headertd">
                        <?
-                       if($img) 
+                       if($img)
                        {
                                ?>
                                        <img src="<?echo IMG_BASE.$img?>" alt="<?echo HEAD?>" border="0">
@@ -891,22 +891,22 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * form_header :Opens up the form tag, and includes the hidden assoc array as hidden    
+        * form_header :Opens up the form tag, and includes the hidden assoc array as hidden
         fields.
         * @param $action: string form action string
         * @param $method: string Method of form
         * @param $$hidden = "" : assoc array with $hidden($name => $value)
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function form_header($action, $method, $hidden = "") 
+       function form_header($action, $method, $hidden = "")
        {
-               echo "<form action=\"$action\" method=\"$method\" 
+               echo "<form action=\"$action\" method=\"$method\"
                        enctype=\"multipart/form-data\">";
-               if($hidden != "" && is_array($hidden)) 
-               {               
-                       foreach($hidden as $key=>$value) 
+               if($hidden != "" && is_array($hidden))
+               {
+                       foreach($hidden as $key=>$value)
                        {
                                echo "<input type=\"hidden\" name=\"$key\" value=\"$value\">";
                        }
@@ -920,13 +920,13 @@ if( !isset($SITEINFO) )
         * @param $$rows = 15: int4 number of rows in textarea box
         * @param $$cols = 50: int4 number of cols in textarea box
         * @param $$wrap = "virtual"  : string the wrap value for the textarea box
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function text_area($name, $value, $rows = 15, $cols = 50, $wrap = "virtual" ) 
+       function text_area($name, $value, $rows = 15, $cols = 50, $wrap = "virtual" )
        {
-               echo "<td class=\"navtd2\"><textarea id=\"$name\" name=\"$name\" cols=\"$cols\" 
+               echo "<td class=\"navtd2\"><textarea id=\"$name\" name=\"$name\" cols=\"$cols\"
                        rows=\"$rows\" wrap=\"$wrap\" maxlength=\"8104\">$value</textarea></td>";
        }
 
@@ -935,13 +935,13 @@ if( !isset($SITEINFO) )
         * @param $name: string name of text box
         * @param $value: string value of text box
         * @param $$size = 35 : string size of text box
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function text_box($name, $value, $size = 35) 
+       function text_box($name, $value, $size = 35)
        {
-               echo "<td class=\"navtd2\"><input type=\"text\" name=\"$name\" 
+               echo "<td class=\"navtd2\"><input type=\"text\" name=\"$name\"
                        value=\"".htmlspecialchars($value)."\" size=\"$size\"></td>";
        }
 
@@ -949,16 +949,16 @@ if( !isset($SITEINFO) )
         * form_footer :Closes up the form tag, and includes the submit button
         * @param $name: string form action string
         * @param $$suppress = 0: string Method of form
-        * @param $$cs : int colspan for td 
-        * 
-        * @return void 
-        * @access 
+        * @param $$cs : int colspan for td
+        *
+        * @return void
+        * @access
         **/
-       function form_footer($name, $suppress = 0, $cs) 
+       function form_footer($name, $suppress = 0, $cs)
        {
                echo "<tr><td colspan=\"$cs\" align=center>
                        <input type=\"SUBMIT\" name=\"Command\" value=\"$name\">";
-               if($suppress == 1) 
+               if($suppress == 1)
                {
                        echo "<input type=\"SUBMIT\" name=\"Command\" value=\"Delete\">";
                }
@@ -968,35 +968,35 @@ if( !isset($SITEINFO) )
 
        /* Graphics Libraries */
        /**
-        * process_image 
-        * NOTES:                                                               
-        * This function does the following:                       
+        * process_image
+        * NOTES:
+        * This function does the following:
         *
-        * 1) places image into original folder                    
+        * 1) places image into original folder
         *
         * 2) makes three images from original size and places them
         * into the RESIZED, MIDSIZED, and THUMB folders
-        * 
-        * @param mixed $image 
-        * @param mixed $image_name 
+        *
+        * @param mixed $image
+        * @param mixed $image_name
         * @access public
         * @return string
         */
-       function process_image( $image, $image_name ) 
+       function process_image( $image, $image_name )
        {
-               if(!defined("ORIGINAL_PATH")) 
+               if(!defined("ORIGINAL_PATH"))
                {
                        html_error("this not defined original_path",1);
                }
-               if(!defined("RESIZED_PATH")) 
+               if(!defined("RESIZED_PATH"))
                {
                        html_error("this not defined resized_path",1);
                }
-               if(!defined("MIDSIZED_PATH")) 
+               if(!defined("MIDSIZED_PATH"))
                {
                        html_error("this not defined midsized_path",1);
                }
-               if(!defined("THUMB_PATH")) 
+               if(!defined("THUMB_PATH"))
                {
                        html_error("this not defined thumb_path",1);
                }
@@ -1010,18 +1010,18 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * img_resize 
+        * img_resize
         * resized based on imagick widthxheight given
         * to scale by maxwidth of 280 use '280>'
-        * which will keep it from making image larger 
-        * 
-        * @param mixed $path2image 
-        * @param mixed $path2thumb 
-        * @param mixed $size 
+        * which will keep it from making image larger
+        *
+        * @param mixed $path2image
+        * @param mixed $path2thumb
+        * @param mixed $size
         * @access public
         * @return string
         */
-       function img_resize( $path2image, $path2thumb, $size ) 
+       function img_resize( $path2image, $path2thumb, $size )
        {
                exec( "which convert", $output, $return );
                if( $return == 0 )
@@ -1042,37 +1042,37 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * img_upload 
+        * img_upload
         * simplified to use the file_upload function with restricted set to true
         * which will return an array instead of string (as in files)
         * and only allow png,gif,jpg images to be uploaded
-        * 
-        * @param mixed $form_field 
-        * @param mixed $img_name 
-        * @param mixed $destination_path 
+        *
+        * @param mixed $form_field
+        * @param mixed $img_name
+        * @param mixed $destination_path
         * @access public
         * @return string
         */
-       function img_upload( $form_field, $img_name, $destination_path ) 
+       function img_upload( $form_field, $img_name, $destination_path )
        {
                return( file_upload( $form_field, $img_name, $destination_path, true ) );
        }
 
        /**
         * file_upload
-        * this will replace the older version and that of img_upload which calls this with extra 
-        * restricted of true 
-        * 
-        * @param mixed $form_field 
-        * @param mixed $file_name 
-        * @param mixed $destination_path 
+        * this will replace the older version and that of img_upload which calls this with extra
+        * restricted of true
+        *
+        * @param mixed $form_field
+        * @param mixed $file_name
+        * @param mixed $destination_path
         * @access public
         * @return string
         */
-       function file_upload( $form_field, $file_name, $destination_path, $restricted = false ) 
+       function file_upload( $form_field, $file_name, $destination_path, $restricted = false )
        {
                $file_name_in_use = false;
-               $file_name = ereg_replace( "[!@#$%^&()+={};:\'\"\/ ]", "-", $file_name );
+               $file_name = preg_replace( "%[!@#$\%^&()+={};:\'\"\/ ]%", "-", $file_name );
                if( $restricted )
                {
                        $size = getImageSize( $form_field );
@@ -1092,7 +1092,7 @@ if( !isset($SITEINFO) )
                {
                        $file_name_in_use = true;
                }
-               if( $file_name_in_use == true ) 
+               if( $file_name_in_use == true )
                {
                        $new_file_name = mktime().$file_name;
                        $new_file_location = $destination_path.$new_file_name;
@@ -1100,7 +1100,7 @@ if( !isset($SITEINFO) )
                        $file_upload = $new_file_name;
                        $file_upload_array = array( $new_file_name, $new_file_location );
                }
-               else 
+               else
                {
                        $new_file_name = $file_name;
                        $new_file_location = $destination_path.$new_file_name;
@@ -1127,31 +1127,31 @@ if( !isset($SITEINFO) )
        /**
         * http_strip :Strips the http:// part from start of string
         * @param $&$string : $string
-        * 
+        *
         * @return string $stirng minus http:// in front
-        * @access 
+        * @access
         **/
-       function http_strip(&$string) 
+       function http_strip(&$string)
        {
                $test_string = strtolower($string);
-               if(substr($test_string,0,7) == "http://") 
+               if(substr($test_string,0,7) == "http://")
                {
                        $string = substr($string,7);
                }
        }
 
        /**
-        * footer : used for admin page footer to close out the top function 
-        * 
-        * @return void 
-        * @access 
+        * footer : used for admin page footer to close out the top function
+        *
+        * @return void
+        * @access
         **/
-       function footer() 
+       function footer()
        {
                $out = '
                        </body>
                        </html>
-                       ';      
+                       ';
                echo $out;
        }
 
@@ -1160,22 +1160,22 @@ if( !isset($SITEINFO) )
         * @param $message: The title
         * @param $hp: The help file to use
         * @param $$hp2 = NULL : The help file to use (links to gaslightmedia.com)
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
-       function top($message, $hp,$hp2 = NULL) 
+       function top($message, $hp,$hp2 = NULL)
        {
                if($hp2 != "")
                {
                        $help_guide = '<div id="glm-manual">';
                        /*
                           $help_guide = '<div id="glm-manual"><a id="manual-html"
-                          href="http://www.gaslightmedia.com/manuals/html/'.$hp2.'.html" 
+                          href="http://www.gaslightmedia.com/manuals/html/'.$hp2.'.html"
                           target="_blank">Online Help Guide</a>&nbsp;';
                         */
                        $help_guide .= '<a id="manual-pdf"
-                               href="http://www.gaslightmedia.com/manuals/pdf/'.$hp2.'.pdf" 
+                               href="http://www.gaslightmedia.com/manuals/pdf/'.$hp2.'.pdf"
                                target="_blank">Printable Help Guide</a></div>';
                }
                $out = '
@@ -1188,7 +1188,7 @@ if( !isset($SITEINFO) )
                        <link rel="stylesheet" type="text/css" href="../main.css">
                        </head>
                        <body>
-                       <h1>'.$message.'</h1>   
+                       <h1>'.$message.'</h1>
                        '.$help_guide.'
                        ';
                echo $out;
@@ -1196,14 +1196,14 @@ if( !isset($SITEINFO) )
 
        /**
         * top2 : alias to top()
-        * @param $message: message title 
-        * @param $hp: help file 
+        * @param $message: message title
+        * @param $hp: help file
         * @param $$hp2 = NULL : gaslight help file
-        * 
-        * @return 
-        * @access 
+        *
+        * @return
+        * @access
         **/
-       function top2($message, $hp,$hp2 = NULL) 
+       function top2($message, $hp,$hp2 = NULL)
        {
                // make this an alias to top()
                // by calling top instead of adding extra code
@@ -1322,9 +1322,9 @@ if( !isset($SITEINFO) )
         * MUST BE CALLED AFTER TEXTAREAS ON PAGE
         * @param $$w = 570: width of htmlarea in px
         * @param $$h = 400: height of htmlarea in px
-        * 
+        *
         * @return void
-        * @access 
+        * @access
         **/
        function htmlcode( $w = 570, $h = 400, $textarea = array('description') )
        {
@@ -1332,7 +1332,7 @@ if( !isset($SITEINFO) )
                        <style type="text/css">
                        /*<![CDATA[*/
                        <!--
-                       .textarea { height: '.$h.'px; width: '.$w.'px; } 
+                       .textarea { height: '.$h.'px; width: '.$w.'px; }
                -->
                        /*]]>*/
                        </style>
@@ -1416,7 +1416,7 @@ if( !isset($SITEINFO) )
                                        }
                                        echo ', "htmlmode", "separator",
                                                 "copy", "cut", "paste", "space", "undo", "redo" ]
-                                                        ];     
+                                                        ];
                                        ';
                                        if( HTMLAREA_CONTEXT_MENU == true )
                                        {
@@ -1430,7 +1430,7 @@ if( !isset($SITEINFO) )
                                                echo '
 
                                                        // register the TableOperations plugin
-                                                       editor_'.$htmlarea.'.registerPlugin(TableOperations); 
+                                                       editor_'.$htmlarea.'.registerPlugin(TableOperations);
                                                ';
                                        }
                                        if( HTMLAREA_CHARACTER_MAP == true )
@@ -1438,7 +1438,7 @@ if( !isset($SITEINFO) )
                                                echo '
 
                                                        // register the CharacterMap plugin
-                                                       editor_'.$htmlarea.'.registerPlugin(CharacterMap); 
+                                                       editor_'.$htmlarea.'.registerPlugin(CharacterMap);
                                                ';
                                        }
                                        echo '
@@ -1447,50 +1447,50 @@ if( !isset($SITEINFO) )
                                }
 
                                echo '
-                       } 
+                       }
                function addEvent(obj, evType, fn)
-               { 
-                       if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 
-                       else if (obj.attachEvent) {  var r = obj.attachEvent("on"+evType, fn);  return r;  } 
-                       else {  return false; } 
-               } 
+               {
+                       if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
+                       else if (obj.attachEvent) {  var r = obj.attachEvent("on"+evType, fn);  return r;  }
+                       else {  return false; }
+               }
                addEvent(window, \'load\', initdocument);
                //]]>
-               </script>       
+               </script>
                        ';
        }
 
        /**
         * date_entry : Generate the select boxes for date entry
         * month-day-year as drop down select
-        * @param $month: 
-        * @param $day: 
-        * @param $year: 
-        * @param $month_name: name of select month 
-        * @param $day_name: name of select day 
+        * @param $month:
+        * @param $day:
+        * @param $year:
+        * @param $month_name: name of select month
+        * @param $day_name: name of select day
         * @param $$year_name : name of select year
-        * 
-        * @return 
-        * @access 
+        *
+        * @return
+        * @access
         **/
-       function date_entry($month,$day,$year,$month_name,$day_name,$year_name,$onChange = NULL) 
+       function date_entry($month,$day,$year,$month_name,$day_name,$year_name,$onChange = NULL)
        {
                $cur_date = getdate();
 
-               if($month == "") 
+               if($month == "")
                {
                        $month = $cur_date['mon'];
                }
-               if($day == "") 
+               if($day == "")
                {
                        $day = $cur_date['mday'];
-               }       
-               if($year == "") 
+               }
+               if($year == "")
                {
                        $year = $cur_date['year'];
                }
                $date = '<SELECT id="'.$month_name.'" NAME="'.$month_name.'" '.$onChange.'>';
-               for($i=1;$i<13;$i++) 
+               for($i=1;$i<13;$i++)
                {
                        $date .= '<OPTION VALUE="';
                        if($i < 10)
@@ -1498,34 +1498,34 @@ if( !isset($SITEINFO) )
                                $date .= "0";
                        }
                        $date .= $i.'"';
-                       if($i == $month) 
+                       if($i == $month)
                        {
                                $date .= ' SELECTED';
                        }
-                       $date .= '>'.$i;        
+                       $date .= '>'.$i;
                }
                $date .= '</SELECT>';
                $date .= '<SELECT id="'.$day_name.'" NAME="'.$day_name.'" '.$onChange.'>';
-               for($i=1;$i<32;$i++) 
+               for($i=1;$i<32;$i++)
                {
                        $date .= '<OPTION VALUE="';
-                       if($i < 10) 
+                       if($i < 10)
                        {
                                $date .= "0";
                        }
                        $date .= $i.'"';
-                       if($i == $day) 
+                       if($i == $day)
                        {
                                $date .= ' SELECTED';
                        }
-                       $date .= '>'.$i;        
-               }       
+                       $date .= '>'.$i;
+               }
                $date .= '</SELECT>';
                $date .= '<SELECT id="'.$year_name.'" NAME="'.$year_name.'" '.$onChange.'>';
-               for($i=2000;$i<2023;$i++) 
+               for($i=2000;$i<2023;$i++)
                {
                        $date .= '<OPTION VALUE="'.$i.'"';
-                       if($i == $year) 
+                       if($i == $year)
                        {
                                $date .= ' SELECTED';
                        }
@@ -1533,38 +1533,38 @@ if( !isset($SITEINFO) )
                }
                $date .= '</SELECT>';
                return $date;
-       }       
+       }
 
        /**
         * contact_date_entry : build select boxes for date entry going backwords in years
-        * @param $month: 
-        * @param $day: 
-        * @param $year: 
+        * @param $month:
+        * @param $day:
+        * @param $year:
         * @param $month_name: name of select month
         * @param $day_name: name of select day
         * @param $$year_name : name of select year
-        * 
+        *
         * @return void
-        * @access 
+        * @access
         **/
-       function contact_date_entry($month,$day,$year,$month_name,$day_name,$year_name) 
+       function contact_date_entry($month,$day,$year,$month_name,$day_name,$year_name)
        {
                $cur_date = getdate();
 
-               if($month == "") 
+               if($month == "")
                {
                        $month = $cur_date['mon'];
                }
-               if($day == "") 
+               if($day == "")
                {
                        $day = $cur_date['mday'];
-               }       
-               if($year == "") 
+               }
+               if($year == "")
                {
                        $year = $cur_date['year'];
                }
                $date = '<SELECT NAME="'.$month_name.'">';
-               for($i=1;$i<13;$i++) 
+               for($i=1;$i<13;$i++)
                {
                        $date .= '<OPTION VALUE="';
                        if($i < 10)
@@ -1572,35 +1572,35 @@ if( !isset($SITEINFO) )
                                $date .= "0";
                        }
                        $date .= $i.'"';
-                       if($i == $month) 
+                       if($i == $month)
                        {
                                $date .= ' SELECTED';
                        }
-                       $date .= '>'.$i;        
+                       $date .= '>'.$i;
                }
                $date .= '</SELECT>';
                $date .= '<SELECT NAME="'.$day_name.'">';
-               for($i=1;$i<32;$i++) 
+               for($i=1;$i<32;$i++)
                {
                        $date .= '<OPTION VALUE="';
-                       if($i < 10) 
+                       if($i < 10)
                        {
                                $date .= "0";
                        }
                        $date .= $i.'"';
-                       if($i == $day) 
+                       if($i == $day)
                        {
                                $date .= ' SELECTED';
                        }
-                       $date .= '>'.$i;        
-               }       
+                       $date .= '>'.$i;
+               }
                $date .= '</SELECT>';
                $date .= '<SELECT NAME="'.$year_name.'">';
                $ystart = $cur_date['year'] - 10;
-               for($i=$ystart;$i<=$year;$i++) 
+               for($i=$ystart;$i<=$year;$i++)
                {
                        $date .= '<OPTION VALUE="'.$i.'"';
-                       if($i == $year) 
+                       if($i == $year)
                        {
                                $date .= ' SELECTED';
                        }
@@ -1612,34 +1612,34 @@ if( !isset($SITEINFO) )
 
        /**
         * time_entry : build select boxes for time entry
-        * @param $H: 
-        * @param $m: 
-        * @param $F: 
+        * @param $H:
+        * @param $m:
+        * @param $F:
         * @param $H_name: name of select hour
         * @param $m_name: name of select min
         * @param $$F_name : name of select sec
-        * 
-        * @return 
-        * @access 
+        *
+        * @return
+        * @access
         **/
-       function time_entry($H,$m,$F,$H_name,$m_name,$F_name) 
+       function time_entry($H,$m,$F,$H_name,$m_name,$F_name)
        {
                $cur_date = getdate();
-               if($H == "") 
+               if($H == "")
                {
                        $H = $cur_date['hours'];
                }
-               if($m == "") 
+               if($m == "")
                {
                        $m = $cur_date['minutes'];
-               }       
-               if($H>12) 
+               }
+               if($H>12)
                {
                        $F = "PM";
                        $H = $H - 12;
                }
                $time = "Hr:<select name=\"$H_name\" size=\"1\">";
-               for($i=1;$i<=12;$i++) 
+               for($i=1;$i<=12;$i++)
                {
                        $time .= "<option value=\"";
                        if($i < 10)
@@ -1647,43 +1647,43 @@ if( !isset($SITEINFO) )
                                $time .= "0";
                        }
                        $time .= "$i\"";
-                       if($i == $H) 
+                       if($i == $H)
                        {
                                $time .= " selected";
                        }
-                       $time .= ">$i\n";       
+                       $time .= ">$i\n";
                }
                $time .= "</select>\n";
                $time .= "Min:<select name=\"$m_name\" size=\"1\">";
-               for($i=0;$i<60;$i=$i+15) 
+               for($i=0;$i<60;$i=$i+15)
                {
                        $time .= "<Option value=\"";
-                       if($i < 10) 
+                       if($i < 10)
                        {
                                $time .= "0";
                        }
                        $time .= "$i\"";
-                       if($i == $m) 
+                       if($i == $m)
                        {
                                $time .= " selected";
                        }
                        $time .= ">";
-                       if($i < 10) 
+                       if($i < 10)
                        {
                                $time .= "0";
                        }
-                       $time .= "$i\n";        
-               }       
+                       $time .= "$i\n";
+               }
                $time .= "</select>";
                $time .= "<select name=\"$F_name\" size=\"1\">";
                $time .= "<option value=\"AM\"";
-               if($F == "AM") 
+               if($F == "AM")
                {
                        $time .= " selected";
                }
                $time .= ">AM\n";
                $time .= "<option value=\"PM\"";
-               if($F == "PM") 
+               if($F == "PM")
                {
                        $time .= " selected";
                }
@@ -1695,21 +1695,21 @@ if( !isset($SITEINFO) )
        /**
         * get_parentid: get the (highest level) parent category for this id
         * @param $id: id from bus_category table
-        * 
-        * @return int parent  
-        * @access 
+        *
+        * @return int parent
+        * @access
         **/
        function get_parentid( $id )
        {
                static $parentshow;
                if( $id == 0 )
                {
-                       return( 0 );            
+                       return( 0 );
                }
                if(!is_array($parentshow))
                {
                        $qs = "select parent from bus_category where id = $id";
-                       $parentrow = db_auto_get_data( $qs );     
+                       $parentrow = db_auto_get_data( $qs );
                }
                if($parentrow[0]['parent'] == 0)
                {
@@ -1729,9 +1729,9 @@ if( !isset($SITEINFO) )
         * @param $$type = "standard": type Standard,multi
         * @param $$auto = 0: auto
         * @param $$width = NULL : width width controlled by css
-        * 
-        * @return void 
-        * @access 
+        *
+        * @return void
+        * @access
         **/
        function build_picklist( $fieldname, $data, $selected, $type = "standard",$auto = 0,$width = NULL )
        {
@@ -1751,7 +1751,7 @@ if( !isset($SITEINFO) )
                {
                        case "multiple":
                                $str = "<SELECT NAME=\"".$fieldname."\" multiple size=\"10\" ".$autosubmit.">\n";
-                       while( list($key, $val) = each($data) ) 
+                       while( list($key, $val) = each($data) )
                        {
                                if( in_array($key,$sel) )
                                {
@@ -1764,7 +1764,7 @@ if( !isset($SITEINFO) )
                        break;
                        case "simple":
                                $str = "<SELECT NAME=\"$fieldname\" ".$autosubmit.">\n";
-                       for( $i=0 ; $i<count($data) ; $i++ ) 
+                       for( $i=0 ; $i<count($data) ; $i++ )
                        {
                                $select = (in_array($data[$i],$sel)) ? " SELECTED ":"";
                                $str .= "       <OPTION VALUE=\"".$data[$i]."\"".$select.">".$data[$i]."\n";
@@ -1774,7 +1774,7 @@ if( !isset($SITEINFO) )
                        case "standard":
                        default:
                                $str = "<SELECT NAME=\"$fieldname\" ".$autosubmit.">\n";
-                               while( list($key, $val) = each($data) ) 
+                               while( list($key, $val) = each($data) )
                                {
                                        $select = (in_array($key,$sel)) ? " SELECTED ":"";
                                        $str .= "       <OPTION VALUE=\"$key\"".$select.">$val\n";
@@ -1788,29 +1788,29 @@ if( !isset($SITEINFO) )
        }
 
        /**
-        * create_page_links:Create prev and next links 
+        * create_page_links:Create prev and next links
         * to page through the results.
         * @param $totalnum: The total result of the query
         * @param $num: The total result for the page
         * @param $$start=0: The starting num defaults to 0
         * @param $params: variables to add to the url
         * @param $ENTRIES_PER_PAGE: number of items on page defaults to the ENTRIES_PER_PAGE
-        * 
-        * @return string of links 
-        * @access 
+        *
+        * @return string of links
+        * @access
         **/
        function create_page_links($totalnum,$num,$start=0,$params,$page_length=ENTRIES_PER_PAGE)
        {
                // find out which page we're on.
                if($totalnum!=0)
-               {  
-                       $total_pages = floor($totalnum / $page_length);         // total pages = the total result divided by page length rounded down 
+               {
+                       $total_pages = floor($totalnum / $page_length);         // total pages = the total result divided by page length rounded down
                        $total_pages++;                                                                         // then add one
                        if($start == 0)                                                                         // if start is 0 then page is one
                        {
-                               $page = 1;                                                                              
+                               $page = 1;
                        }
-                       else    
+                       else
                        {
                                $page = ($start / $page_length) + 1;
                        }
@@ -1824,10 +1824,10 @@ if( !isset($SITEINFO) )
                {
                        $end = $totalnum;
                }
-               $last = $start - $page_length;  
+               $last = $start - $page_length;
                if(($start - $page_length) < 0)
                        $prev = "";
-               else    
+               else
                        $prev = "<span class=\"accenttext\">[</span><a class=\"small\"
                                href=\"$GLOBALS[PHP_SELF]?start=".$last."&$params\">PREVIOUS PAGE</a><span
                                class=\"accenttext\"> ]</span>";
@@ -1835,14 +1835,14 @@ if( !isset($SITEINFO) )
                        $next = "<span class=\"accenttext\">[</span><a class=\"small\"
                                href=\"$GLOBALS[PHP_SELF]?start=".$end."&$params\">NEXT PAGE</a><span
                                class=\"accenttext\"> ]</span>";
-               else    
+               else
                        $next = "";
-               $starting = $start + 1; 
+               $starting = $start + 1;
                $last_c = $start + $num;
                $links = '<center><span class="pagetitle">Listings Displayed: </span><span
                        class="accenttext">'.$starting.' to '.$last_c.'</span>
-                       <span class="pagetitle"> of '.$totalnum.'<br></span> '.$prev. ' &nbsp; <span 
-                       class="pagetitle"></span> '.$next.'<BR></span></center>';       
+                       <span class="pagetitle"> of '.$totalnum.'<br></span> '.$prev. ' &nbsp; <span
+                       class="pagetitle"></span> '.$next.'<BR></span></center>';
                return($links);
        }
 }