Update for php
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 28 Nov 2016 21:01:44 +0000 (16:01 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 28 Nov 2016 21:01:44 +0000 (16:01 -0500)
Replacing =& new calls with = new

15 files changed:
admin/Contact/contact_setup.inc
admin/Contact/emails.php
admin/Contact/update_inquiry.phtml
admin/packages/addPackage.php
admin/packages/index.php
admin/packages/index.save.php [deleted file]
admin/packages/orderForm.php
admin/packages/test.php
classes/class_contact_form.inc
classes/class_template.inc
member/index.php
member/login.php
member/logout.php
order-form.php
setup.phtml

index 6da7dcd..3c4539b 100644 (file)
@@ -1,16 +1,16 @@
 <?
 //$Id: contact_setup.inc,v 1.1.1.1 2007/04/19 13:06:15 matrix Exp $
 if(!defined("ENTRIES_PER_PAGE"))
-       {
-               define("ENTRIES_PER_PAGE",10);  // Entries per Page in list_contact.phtml
-       }
-define("CUSTOMER_TABLE","customer");   // name of customer table
-define("CONTACT_TABLE","contact");             // name of contact table
-define("TABLE",CONTACT_TABLE);                 // which table to use
-define("DATEFORMAT","US");                             // date format (for edit_contact.phmtl)
-define("NEWSLETTER_PROTOTYPE","newsletter_template.html");                             // date format (for edit_contact.phmtl)
+    {
+        define("ENTRIES_PER_PAGE",10);  // Entries per Page in list_contact.phtml
+    }
+define("CUSTOMER_TABLE","customer");    // name of customer table
+define("CONTACT_TABLE","contact");      // name of contact table
+define("TABLE",CONTACT_TABLE);          // which table to use
+define("DATEFORMAT","US");              // date format (for edit_contact.phmtl)
+define("NEWSLETTER_PROTOTYPE","newsletter_template.html");              // date format (for edit_contact.phmtl)
 include_once(BASE.'classes/class_template.inc');
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 /*
    setup the following in the setup.phtml (in root directory) file.
 defines:
@@ -18,238 +18,238 @@ HTML_EMAIL = ON or OFF
 PRODUCTION_MODE = ON ,r OFF
  */
 if(!defined("HTML_EMAIL"))
-       {
-       define("HTML_EMAIL","ON");
-       }
+    {
+    define("HTML_EMAIL","ON");
+    }
 if(!defined("PRODUCTION_MODE"))
-       {
-       define("PRODUCTION_MODE","ON");
-       }
+    {
+    define("PRODUCTION_MODE","ON");
+    }
 if(!defined("NEWSLETTER"))
-       {
-   define("NEWSLETTER",1); //bool- does the contact database mail out a newsletter? 
-       }
+    {
+   define("NEWSLETTER",1); //bool- does the contact database mail out a newsletter?
+    }
 
 if(!function_exists("template_read"))
-       {
-               function template_read($template)
-               {
-                       $fp = fopen($template, "r");
-                       $contents = fread($fp,filesize($template));
-                       fclose($fp);
-                       if($contents)
-                       {
-                               return $contents;
-                       }
-                       else
-                       {
-                               return "";
-                       }
-               }
-       }
+    {
+        function template_read($template)
+        {
+            $fp = fopen($template, "r");
+            $contents = fread($fp,filesize($template));
+            fclose($fp);
+            if($contents)
+            {
+                return $contents;
+            }
+            else
+            {
+                return "";
+            }
+        }
+    }
 
 if(!function_exists("explode_template"))
-       {
-               function explode_template($template,$data)
-               {
-                       $template = template_read($template);
-                       $output = template_replacement($template,$data);
-                       $output = wordwrap($output, 72);
-                       return($output);
+    {
+        function explode_template($template,$data)
+        {
+            $template = template_read($template);
+            $output = template_replacement($template,$data);
+            $output = wordwrap($output, 72);
+            return($output);
 
-               }
-       }
+        }
+    }
 
 if(!function_exists("template_replacement"))
-       {
-               function template_replacement($template,$fieldarr)
-               {
-                       if(is_array($fieldarr))
-                       {
-                               foreach($fieldarr as $key=>$value)
-                               {
-                                       $template = str_replace( "<!-- ".$key." -->", $value, $template );
-                               }
-                       }
+    {
+        function template_replacement($template,$fieldarr)
+        {
+            if(is_array($fieldarr))
+            {
+                foreach($fieldarr as $key=>$value)
+                {
+                    $template = str_replace( "<!-- ".$key." -->", $value, $template );
+                }
+            }
 
-                       return $template;
-               }
-       }
+            return $template;
+        }
+    }
 if(!function_exists("add_image"))
-       {
-               function add_image($image,$align)
-               {
-                       if($image != "")
-                       {
-                               return('<div style="margin:5px;float:'.$align.';"><img src="'.MIDSIZED.$image.'"></div>');
-                       }
-               }
-       }
+    {
+        function add_image($image,$align)
+        {
+            if($image != "")
+            {
+                return('<div style="margin:5px;float:'.$align.';"><img src="'.MIDSIZED.$image.'"></div>');
+            }
+        }
+    }
 
 
 // Navigation array
 $nav = array(
-               "Report Builder" => "index.phtml",
-               "Add Contact" => "edit_contact.phtml",
-               "List Contacts" => "list_contact.phtml",
-               "Contact Inquiry Fields" => "contact_inquiry.phtml",
-               "HTML Emails" => "emails.php",
-               "Saved Reports" => "list_query.phtml",
-               );
+        "Report Builder" => "index.phtml",
+        "Add Contact" => "edit_contact.phtml",
+        "List Contacts" => "list_contact.phtml",
+        "Contact Inquiry Fields" => "contact_inquiry.phtml",
+        "HTML Emails" => "emails.php",
+        "Saved Reports" => "list_query.phtml",
+        );
 $navWidth = 7;
 $query = "select * from contact_inq order by pos;";
 $cData = $DB->db_auto_get_data($query);
 if( is_array( $cData ) )
 {
-       foreach( $cData as $key => $value )
-       {
-               $int_array[$value['id']] = $value['header'];
-       }
+    foreach( $cData as $key => $value )
+    {
+        $int_array[$value['id']] = $value['header'];
+    }
 }
 function search_where( $name, $search_where )
 {
-       $out = '
-               <select name="'.$name.'">
-  <option value="1" '.( ( !isset( $search_type ) || $search_type == "0" ) ? 'selected' : '' ).'>Anywhere 
-  <option value="2" '.( ( $search_where == '1' ) ? 'selected' : '' ).'>Begining 
+    $out = '
+        <select name="'.$name.'">
+  <option value="1" '.( ( !isset( $search_type ) || $search_type == "0" ) ? 'selected' : '' ).'>Anywhere
+  <option value="2" '.( ( $search_where == '1' ) ? 'selected' : '' ).'>Begining
   <option value="3" '.( ( $search_where == '2' ) ? 'selected' : '' ).'>Ending
   </select>';
-       return( $out );
+    return( $out );
 }
 function search_type( $name, $search_type )
 {
-       $out = '
-               <select name="'.$name.'">
-  <option value="2" '.( ( !isset( $search_type ) || $search_type == '2' ) ? 'selected' : '' ).'>And 
+    $out = '
+        <select name="'.$name.'">
+  <option value="2" '.( ( !isset( $search_type ) || $search_type == '2' ) ? 'selected' : '' ).'>And
   <option value="3" '.( ( $search_type == '3' ) ? 'selected' : '' ).'>Or
   <option value="4" '.( ( $search_type == '4' ) ? 'selected' : '' ).'>Not
   </select>';
-       return( $out );
+    return( $out );
 }
 function search_bool( $name, $search_type )
 {
-       $out = '
-               <select name="'.$name.'">
-  <option value="n" '.( !isset( $search_type ) ? 'selected' : '' ).'>Don\'t Care 
+    $out = '
+        <select name="'.$name.'">
+  <option value="n" '.( !isset( $search_type ) ? 'selected' : '' ).'>Don\'t Care
   <option value="1" '.( ( $search_type == '1' ) ? 'selected' : '' ).'>Yes
   <option value="0" '.( ( $search_type == '0' ) ? 'selected' : '' ).'>No
   </select>';
-       return( $out );
+    return( $out );
 }
 function interest($field)
-       {               
-               global $int_array;
-               if( !is_array( $int_array ) )
-               {
-                       return( false );
-               }
-               echo "<table><tr>";
-               $count = 0;
-               foreach($int_array as $key=>$value)
-               {
-                       if($count==0)
-                               echo "<td>";            
-                       echo "<input type=\"checkbox\" name=\"interest[]\" value=\"$key\"";
-                       if(strstr($field,":".$key.":"))
-                               echo " checked";                                
-                       echo ">$value<br>";             
-                       if($count==5)
-                               echo "</td><td>";               
-                       if($count==11)
-                               echo "</td>";           
-                       $count++;               
-               }               
-               echo "</tr></TABLE>";
-       }
+    {
+        global $int_array;
+        if( !is_array( $int_array ) )
+        {
+            return( false );
+        }
+        echo "<table><tr>";
+        $count = 0;
+        foreach($int_array as $key=>$value)
+        {
+            if($count==0)
+                echo "<td>";
+            echo "<input type=\"checkbox\" name=\"interest[]\" value=\"$key\"";
+            if(strstr($field,":".$key.":"))
+                echo " checked";
+            echo ">$value<br>";
+            if($count==5)
+                echo "</td><td>";
+            if($count==11)
+                echo "</td>";
+            $count++;
+        }
+        echo "</tr></TABLE>";
+    }
 
 // default query on create_date
 $c_date_from  = contact_date_entry("","","","fc_month","fc_day","fc_year");
 $c_date_to  = contact_date_entry("","","","tc_month","tc_day","tc_year");
-/*     The following is for setting up the defines and arrays that are needed 
- *     based on which table ( customer or contact ) in use
+/*  The following is for setting up the defines and arrays that are needed
+ *  based on which table ( customer or contact ) in use
  *  formats for arrays
- *     $DB_fields[] = array( name =>"{FIELD NAME}", title => "{FIELD TITLE}", type => "{FIELD TYPE}")
+ *  $DB_fields[] = array( name =>"{FIELD NAME}", title => "{FIELD TITLE}", type => "{FIELD TYPE}")
  *  $fields["{FIELD_NAME}"] = "{FIELD TITLE}";
  *
- *     must have these defines
- *     ID - The primary key
- *     SEQUENCE - sequence name
- *     WHERE - where clause
+ *  must have these defines
+ *  ID - The primary key
+ *  SEQUENCE - sequence name
+ *  WHERE - where clause
  */
 if(TABLE==CUSTOMER_TABLE)
-       {
-               define("ID","cust_id");
-               define("MAILOK","mail_ok");
-               define("SEQUENCE","custkey");
-               define("WHERE","fname != '-Guest-'");
-               // $DB_fields are used for edit and updating contacts
-               $DB_fields[] =  array( name => "cust_id",       title => "cust_id",     type => "hide");
-               $DB_fields[] =  array( name => "purch_date",title => "Last Purchase Date",      type => "static");
-               $DB_fields[] =  array( name => "access_date",title => "Last Access Date",type => "static");
-               $DB_fields[] =  array( name => "create_date",title => "Create Date",type => "static");
-               $DB_fields[] =  array( name => "fname",         title => "First Name",  type => "text");
-               $DB_fields[] =  array( name => "lname",         title => "Last Name",   type => "text");
-               $DB_fields[] =  array( name => "add1",          title => "Address 1",   type => "text");
-               $DB_fields[] =  array( name => "add2",          title => "Address 2",   type => "text");
-               $DB_fields[] =  array( name => "city",          title => "City",                type => "text");
-               $DB_fields[] =  array( name => "state",         title => "State",               type => "text");
-               $DB_fields[] =  array( name => "zip",           title => "Zip",                 type => "text");
-               $DB_fields[] =  array( name => "email",         title => "Email",               type => "text");
-               $DB_fields[] =  array( name => "phone",         title => "Phone",               type => "text");
-               $DB_fields[] =  array( name => "fax",           title => "Fax",                 type => "text");
-               $DB_fields[] =  array( name => "org",           title => "Org",                 type => "text");
-               $DB_fields[] =  array( name => "referred_by",title => "Refered By",     type => "text");
-               $DB_fields[] =  array( name => "mail_ok",       title => "Mail Ok?",    type => "radio");
-               // $fields are used for building the query page
-               foreach($DB_fields as $key=>$value){
-                       if($value['type'] == "text")
-                               $fields[$value['name']] = $value['title'];
-               }
-               // date query fields
-               $p_date_from = contact_date_entry("","","","fp_month","fp_day","fp_year");
-               $p_date_to = contact_date_entry("","","","tp_month","tp_day","tp_year");
-               $a_date_from  = contact_date_entry("","","","fa_month","fa_day","fa_year");
-               $a_date_to  = contact_date_entry("","","","ta_month","ta_day","ta_year");
-       }
+    {
+        define("ID","cust_id");
+        define("MAILOK","mail_ok");
+        define("SEQUENCE","custkey");
+        define("WHERE","fname != '-Guest-'");
+        // $DB_fields are used for edit and updating contacts
+        $DB_fields[] =  array( name => "cust_id",   title => "cust_id",     type => "hide");
+        $DB_fields[] =  array( name => "purch_date",title => "Last Purchase Date",  type => "static");
+        $DB_fields[] =  array( name => "access_date",title => "Last Access Date",type => "static");
+        $DB_fields[] =  array( name => "create_date",title => "Create Date",type => "static");
+        $DB_fields[] =  array( name => "fname",     title => "First Name",  type => "text");
+        $DB_fields[] =  array( name => "lname",     title => "Last Name",   type => "text");
+        $DB_fields[] =  array( name => "add1",      title => "Address 1",   type => "text");
+        $DB_fields[] =  array( name => "add2",      title => "Address 2",   type => "text");
+        $DB_fields[] =  array( name => "city",      title => "City",        type => "text");
+        $DB_fields[] =  array( name => "state",     title => "State",       type => "text");
+        $DB_fields[] =  array( name => "zip",       title => "Zip",         type => "text");
+        $DB_fields[] =  array( name => "email",     title => "Email",       type => "text");
+        $DB_fields[] =  array( name => "phone",     title => "Phone",       type => "text");
+        $DB_fields[] =  array( name => "fax",       title => "Fax",         type => "text");
+        $DB_fields[] =  array( name => "org",       title => "Org",         type => "text");
+        $DB_fields[] =  array( name => "referred_by",title => "Refered By", type => "text");
+        $DB_fields[] =  array( name => "mail_ok",   title => "Mail Ok?",    type => "radio");
+        // $fields are used for building the query page
+        foreach($DB_fields as $key=>$value){
+            if($value['type'] == "text")
+                $fields[$value['name']] = $value['title'];
+        }
+        // date query fields
+        $p_date_from = contact_date_entry("","","","fp_month","fp_day","fp_year");
+        $p_date_to = contact_date_entry("","","","tp_month","tp_day","tp_year");
+        $a_date_from  = contact_date_entry("","","","fa_month","fa_day","fa_year");
+        $a_date_to  = contact_date_entry("","","","ta_month","ta_day","ta_year");
+    }
 else
-       {
-               define("ID","id");
-               define("MAILOK","mail_ok");
-               define("SEQUENCE","contact_id_seq");
-               define("WHERE",ID." IS NOT NULL");
-               // $DB_fields are used for edit and updating contacts
-               $DB_fields[] =  array( name => "id",            title => "id",                  type => "hide");
-               $DB_fields[] =  array( name => "create_date",title => "Create Date",type => "static");
-               $DB_fields[] =  array( name => "fname",         title => "First Name",  type => "text");
-               $DB_fields[] =  array( name => "lname",         title => "Last Name",   type => "text");
-               $DB_fields[] =  array( name => "company",       title => "Company Name",type => "text");
-               $DB_fields[] =  array( name => "address",       title => "Address",     type => "text");
-               $DB_fields[] =  array( name => "address2",      title => "Address 2",   type => "text");
-               $DB_fields[] =  array( name => "city",          title => "City",                type => "text");
-               $DB_fields[] =  array( name => "state",         title => "State",               type => "state");
-               $DB_fields[] =  array( name => "zip",           title => "Zip",                 type => "text");
-               $DB_fields[] =  array( name => "phone",         title => "Phone",               type => "text");
-               $DB_fields[] =  array( name => "fax",           title => "Fax",                 type => "text");
-               $DB_fields[] =  array( name => "email",         title => "Email",               type => "text");
-               $DB_fields[] =  array( name => "mail_ok",       title => "Mail Ok?",    type => "radio");
-               //$DB_fields[] =        array( name => "interest",      title => "Interest",    type => "interest");
-               // $fields are used for building the query page
-               foreach($DB_fields as $key=>$value)
-               {
-                       if($value['type'] == "text" || $value['type'] == "state")
-                       {
-                               $fields[$value['name']] = $value['title'];
-                       }
-                       elseif( $value['type'] == "radio" )
-                       {
-                               $boolean[$value['name']] = $value['title'];
-                       }
-                       elseif( $value['type'] == "drop" )
-                       {
-                               $dropdowns[$value['name']] = array( 'title' => $value['title'], 'drop' => $value['drop'] );
-                       }
-               }
-       }
+    {
+        define("ID","id");
+        define("MAILOK","mail_ok");
+        define("SEQUENCE","contact_id_seq");
+        define("WHERE",ID." IS NOT NULL");
+        // $DB_fields are used for edit and updating contacts
+        $DB_fields[] =  array( name => "id",        title => "id",          type => "hide");
+        $DB_fields[] =  array( name => "create_date",title => "Create Date",type => "static");
+        $DB_fields[] =  array( name => "fname",     title => "First Name",  type => "text");
+        $DB_fields[] =  array( name => "lname",     title => "Last Name",   type => "text");
+        $DB_fields[] =  array( name => "company",   title => "Company Name",type => "text");
+        $DB_fields[] =  array( name => "address",   title => "Address",     type => "text");
+        $DB_fields[] =  array( name => "address2",  title => "Address 2",   type => "text");
+        $DB_fields[] =  array( name => "city",      title => "City",        type => "text");
+        $DB_fields[] =  array( name => "state",     title => "State",       type => "state");
+        $DB_fields[] =  array( name => "zip",       title => "Zip",         type => "text");
+        $DB_fields[] =  array( name => "phone",     title => "Phone",       type => "text");
+        $DB_fields[] =  array( name => "fax",       title => "Fax",         type => "text");
+        $DB_fields[] =  array( name => "email",     title => "Email",       type => "text");
+        $DB_fields[] =  array( name => "mail_ok",   title => "Mail Ok?",    type => "radio");
+        //$DB_fields[] =    array( name => "interest",  title => "Interest",    type => "interest");
+        // $fields are used for building the query page
+        foreach($DB_fields as $key=>$value)
+        {
+            if($value['type'] == "text" || $value['type'] == "state")
+            {
+                $fields[$value['name']] = $value['title'];
+            }
+            elseif( $value['type'] == "radio" )
+            {
+                $boolean[$value['name']] = $value['title'];
+            }
+            elseif( $value['type'] == "drop" )
+            {
+                $dropdowns[$value['name']] = array( 'title' => $value['title'], 'drop' => $value['drop'] );
+            }
+        }
+    }
 $data['bailout'] .= "You are receiving this message because you have expressed an interest in ";
 $data['bailout'] .= "receiving specials and information from ".SITENAME.". If you do not ";
 $data['bailout'] .= "wish to receive future items of this nature, please reply to this e-mail ";
index d6d79f3..9e3485f 100644 (file)
@@ -2,8 +2,8 @@
 require_once('../../setup.phtml');
 require_once(BASE.'classes/class_db.inc');
 include("contact_setup.inc");
-$DB =& new GLM_DB();
-$query = "set datestyle to 'sql,us';select * from news_response order by id;"; 
+$DB = new GLM_DB();
+$query = "set datestyle to 'sql,us';select * from news_response order by id;";
 $data = $DB->db_auto_get_data( $query );
 top( "Email HTML Newsletters", "");
 html_nav_table($nav,$navWidth);
@@ -18,7 +18,7 @@ $out = '<table id="admin-list-table">
                <th>Last Update:</th>
                <th> &nbsp; </th>
        </tr>';
-       
+
 if( is_array( $data ) )
 {
        foreach( $data as $key => $val )
index 98a822d..4a5b899 100755 (executable)
@@ -1,17 +1,17 @@
 <?php
 include("../../setup.phtml");
 include("contact_setup.inc");
-$conn =& $DB->db_connect();
-if(!$conn) 
+$conn = $DB->db_connect();
+if(!$conn)
        {
                echo "No Database connection";
        }
-if($image == "none" || $image == "") 
+if($image == "none" || $image == "")
        {
                $image_name = $oldimage;
        }
-else 
-       { 
+else
+       {
                $image_name = process_image($image,$image_name);
                @unlink(ORIGINAL_PATH."/".$oldimage);
                @unlink(RESIZED_PATH.$oldimage);
@@ -19,7 +19,7 @@ else
                @unlink(MIDSIZED_PATH.$oldimage);
 
        }
-if($deleteimage == "1") 
+if($deleteimage == "1")
        {
                $image_name = "";
 
@@ -29,14 +29,14 @@ if($deleteimage == "1")
                @unlink(MIDSIZED_PATH.$oldimage);
        }
 
-switch($Command) 
+switch($Command)
        {
                case "Move":
                        $qs = "SELECT   pos,id
                        FROM    contact_inq
                        WHERE   id = $id";
 
-               if(!$result = db_exec($conn,$qs)) 
+               if(!$result = db_exec($conn,$qs))
                {
                        html_error(DB_ERROR_MSG.$qs,0);
                }
@@ -44,7 +44,7 @@ switch($Command)
                $data = db_fetch_array($result,0,PGSQL_ASSOC);
                $pos = $data['pos'];
 
-               if($newpos < $pos) 
+               if($newpos < $pos)
                {
                        $qs = "SELECT   id,pos
                                FROM    contact_inq
@@ -52,13 +52,13 @@ switch($Command)
                                AND             pos >= $newpos
                                ORDER BY pos";
 
-                       if(!$res = db_exec($conn,$qs)) 
+                       if(!$res = db_exec($conn,$qs))
                        {
                                html_error(DB_ERROR_MSG.$qs,0);
                        }
 
                        $counter = ($newpos + 1);
-                       for($i=0;$i<db_numrows($res);$i++) 
+                       for($i=0;$i<db_numrows($res);$i++)
                        {
                                $res_data = db_fetch_array($res,$i,PGSQL_ASSOC);
                                $res_id = $res_data['id'];
@@ -67,14 +67,14 @@ switch($Command)
                                        SET             pos = $counter
                                        WHERE   id = $res_id";
 
-                               if(!db_exec($conn,$qs)) 
+                               if(!db_exec($conn,$qs))
                                {
                                        html_error(DB_ERROR_MSG.$qs,0);
                                }
                                $counter++;
                        }
                }
-               else 
+               else
                {
                        $qs = "SELECT   pos,id
                                FROM    contact_inq
@@ -82,13 +82,13 @@ switch($Command)
                                AND             pos <= $newpos
                                ORDER BY pos";
 
-                       if(!$res = db_exec($conn,$qs)) 
+                       if(!$res = db_exec($conn,$qs))
                        {
                                html_error(DB_ERROR_MSG.$qs,0);
                        }
 
                        $counter = ($pos);
-                       for($i=0;$i<db_numrows($res);$i++) 
+                       for($i=0;$i<db_numrows($res);$i++)
                        {
                                $res_data = db_fetch_array($res,$i,PGSQL_ASSOC);
                                $res_id = $res_data['id'];
@@ -97,18 +97,18 @@ switch($Command)
                                        SET             pos = $counter
                                        WHERE   id = $res_id";
 
-                               if(!db_exec($conn,$qs)) 
+                               if(!db_exec($conn,$qs))
                                {
                                        html_error(DB_ERROR_MSG.$qs,0);
                                }
                                $counter++;
                        }
                }
-               $qs = "UPDATE   contact_inq 
+               $qs = "UPDATE   contact_inq
                        SET             pos = $newpos
                        WHERE   id = $id";
 
-               if(!db_exec($conn,$qs)) 
+               if(!db_exec($conn,$qs))
                {
                        html_error(DB_ERROR_MSG.$qs,0);
                }
@@ -133,7 +133,7 @@ switch($Command)
                $row = db_fetch_array($res,0,PGSQL_ASSOC);
                $nextpos = $row[maxpos];
                $nextpos++;
-               $qs = "INSERT 
+               $qs = "INSERT
                        INTO    contact_inq
                        (header,description,image,pos)
                        VALUES  ('$header','$description','$image_name',$nextpos);";
@@ -142,7 +142,7 @@ switch($Command)
                break;
 
                case "Delete":
-                       $qs = "DELETE 
+                       $qs = "DELETE
                        FROM    contact_inq
                        WHERE   id = $id";
 
@@ -152,14 +152,14 @@ switch($Command)
                @unlink(THUMB_PATH.$oldimage);
                @unlink(MIDSIZED_PATH.$oldimage);
 
-               $qs = "SELECT   pos,id 
+               $qs = "SELECT   pos,id
                        FROM    contact_inq
                        WHERE   pos > $oldpos
                        ORDER BY pos";
 
                $res2 = db_exec($conn,$qs);
                $oldcatid_counter = $oldpos;
-               for($i=0;$i<db_numrows($res2);$i++) 
+               for($i=0;$i<db_numrows($res2);$i++)
                {
                        $row2 = db_fetch_array($res2,$i,PGSQL_ASSOC);
                        $qs = "UPDATE   contact_inq
index d86bd07..83167c3 100644 (file)
@@ -5,7 +5,7 @@ $days_in_advance = 7;// number of days in advance the ticket must be purchased
 // get the pricing stucture of the package
 $query = "select adult,youth,child from ticket_member where ferry != 't'";
 (float)$adult_price = (float)$youth_price = (float)$child_price = (float)0.00;
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 if( $_POST )
 {
     $data = $_POST;
@@ -148,7 +148,7 @@ $data['total_amount'] = '<div id="total-amount">$0.00</div>';
 $fields[] = array('name'=>'total_amount','title'=>'Total Price','type'=>'readonly');
 $fields[] = array('name'=>'mail_ok','title'=>'Sign up for E-News','type'=>'radio','req'=>0);
 $prices_array = array( 'adult_price' => $adult_price, 'youth_price' => $youth_price, 'child_price' => $child_price);
-$order_form =& new orderForm( $fields, $data, $prices_array );
+$order_form = new orderForm( $fields, $data, $prices_array );
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
index e26edb2..f640a36 100755 (executable)
@@ -1,10 +1,10 @@
 <?php
 include_once '../../setup.phtml';
 include_once 'setup.php';
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 $DB->db_connect();
-$member =& new glm_member( &$DB, $member_config );
-$package =& new package( &$DB, $package_config );
+$member = new glm_member( &$DB, $member_config );
+$package = new package( &$DB, $package_config );
 $content = administrator::admin_run_action( &$member, &$package );
 echo administrator::page_out( 'Mackinac Island Packages Admin', $nav, $content );
 ?>
diff --git a/admin/packages/index.save.php b/admin/packages/index.save.php
deleted file mode 100755 (executable)
index 67effa7..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-include_once '../../setup.phtml';
-include_once 'setup.php';
-include_once CLASSES.'class_administrator.inc';
-include_once CLASSES.'class_members.inc';
-include_once CLASSES.'class_ticket.inc';
-include_once CLASSES.'class_ticket_inv.inc';
-include_once 'setup.php';
-$DB =& new GLM_DB();
-$DB->db_connect();
-$member =& new glm_member( $DB, $member_config );
-$ticket =& new ticket( $DB, $ticket_config );
-$ticket_inv =& new ticket_inv( $DB, $ticket_inv_config );
-administrator::top('Ticket Member Area','');
-echo '<div id="divId">&nbsp;</div>';
-echo '
-<style type="text/css">
-body {background-color:#fff;}
-#demo .loading {
-    background-image:url(img/loading.gif);
-    background-position:center center;
-    background-repeat:no-repeat;
-}
-
-#demo .loading * {
-    display:none;
-}
-#admin-list-table { border-collapse:collapse;width:100%; }
-#admin-list-table td,#admin-list-table th { padding:5px; }
-#admin-list-table th { text-align:center;font-weight:bold; }
-#admin-list-table td { border:solid 1px #000; }
-
-#admin-edit-table { border-collapse:collapse;width:100%; }
-#admin-edit-table td,#admin-list-table th { padding:5px; }
-#admin-edit-table th { text-align:center;font-weight:bold; }
-#admin-edit-table td { border:solid 1px #000; }
-
-</style>
-<script type="text/javascript">
-       function hideDiv()
-       {
-               alert(\'hide me\');
-               var style = document.getElementById(\'divId\').innerHTML = \'<style type="text/css">#admin-edit-table {display:none;}</style>\';
-       }
-       function showDiv( )
-       {
-               alert(\'show me\');
-               var style = document.getElementById(\'divId\').innerHTML = \'<style type="text/css">#admin-edit-table {display:table;}</style>\';
-       }
-YAHOO.example.init = function() {
-       var tabView = new YAHOO.widget.TabView(\'demo\');
-';
-if( $Action == 'Add Ticket Inventory' || $Action == 'Edit Ticket Inventory' )
-{
-       echo '
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \'List Ticket Members\', 
-               disabled: true,
-               dataSrc: \'test.php\',
-               active: false,
-               cacheData: true,
-               addListener: (\'onclick\',hideDiv)
-       }));
-       
-       ';
-       echo '
-       
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \'List Tickets\', 
-               disabled: true,
-               dataSrc: \'test.php?Action=List+Tickets&member_id='.$_GET['member_id'].'\',
-               active: false,
-               cacheData: true,
-               addListener: (\'click\',hideDiv)
-       }));
-
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \'List Tickets Inventory\', 
-               disabled: true,
-               dataSrc: \'test.php?Action=List+Ticket+Inventory&ticket_id='.$_GET['ticket_id'].'&member_id='.$_GET['member_id'].'\',
-               active: false,
-               cacheData: true,
-               addListener: (\'click\',hideDiv)
-       }));
-
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \''.$Action.'\', 
-               active: true,
-               cacheData: false,
-               addListener: (\'click\',showDiv)
-       }));
-       ';
-}
-elseif( $Action )
-{
-       echo '
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \'List Ticket Members\', 
-               dataSrc: \'test.php\',
-               active: false,
-               cacheData: false
-       }));
-       
-       ';
-       if( $Action == "Edit Ticket" )
-       {
-               echo '
-               
-               tabView.addTab( new YAHOO.widget.Tab({ 
-                       label: \'List Tickets\', 
-                       dataSrc: \'test.php?Action=List+Tickets&member_id='.$_GET['member_id'].'\',
-                       active: true,
-                       cacheData: false
-               }));
-               ';
-       }
-       if( $Action == "List Ticket Inventory" )
-       {
-               echo '
-               
-               tabView.addTab( new YAHOO.widget.Tab({ 
-                       label: \'List Tickets\', 
-                       dataSrc: \'test.php?Action=List+Tickets&member_id='.$_GET['member_id'].'\',
-                       active: true,
-                       cacheData: false
-               }));
-               ';
-       }
-       echo '
-       
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \''.$Action.'\', 
-               dataSrc: \'test.php?'.$QUERY_STRING.'\',
-               active: true,
-               cacheData: true
-       }));
-       ';
-}
-else
-{
-       echo '
-       tabView.addTab( new YAHOO.widget.Tab({ 
-               label: \'List Ticket Members\', 
-               dataSrc: \'test.php\',
-               active: true,
-               cacheData: false
-       }));
-       
-       ';
-}
-$script_out = '';
-switch( $Action )
-{
-       case "Edit Ticket Inventory":
-               $out = $ticket_inv->edit_ticket_inv( $_GET['member_id'], $_GET['ticket_id'], $_GET['id'] );
-               /*
-               $out = '<div><p></p></div>
-               <div><p>'.$out.'</p></div> 
-               ';
-               */
-               $script_out = $ticket_inv->administrator->form_scripts; 
-       break;
-
-       case "Add Ticket Inventory":
-               $out .= $ticket_inv->add_ticket_inv( $_GET['member_id'], $_GET['ticket_id'] );
-               /*
-               $out = '<div><p></p></div>
-               <div><p>'.$out.'</p></div>  
-               ';
-               */
-               $script_out = $ticket_inv->administrator->form_scripts; 
-       break;
-       
-}
-echo '
-};
-
-YAHOO.example.init();
-</script>
-';
-echo '<div id="demo" class="yui-navset">
-       ';
-if( $out )
-{
-       echo '<ul class="yui-nav"></ul>
-               <div class="yui-content"> 
-                       <div id="my-edit"><p>'.$out.'</p></div>
-               </div>';
-}
-if( $script_out )
-{
-       echo $script_out;
-       //echo '<style type="text/css">#admin-edit-table {display:none;}</style>';
-}
-echo '
-</div>';
-/*
-echo '
-
-<div id="myLogger"></div>
-<script type="text/javascript"> 
-       var myLogReader = new YAHOO.widget.LogReader("myLogger"); 
-</script>
-';
-*/
-administrator::footer();
-?>
index 520800c..3b593a7 100644 (file)
@@ -125,7 +125,7 @@ class orderForm extends form_creator
         $this->youth_price = $prices['youth_price'];
         $this->child_price = $prices['child_price'];
         // authorize.net setup
-//        $this->Authorize          =& new authorize();
+//        $this->Authorize          = new authorize();
 //        $this->Authorize->loginid = '6SH53cjDyW';
 //        $this->Authorize->txnkey  = '6WsFYp25433ZjHR3';
         // output of form
index 8794090..5863e1d 100755 (executable)
@@ -7,11 +7,11 @@ include_once CLASSES.'class_members.inc';
 include_once CLASSES.'class_ticket.inc';
 include_once CLASSES.'class_ticket_inv.inc';
 include_once 'setup.php';
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 $DB->db_connect();
-$member =& new glm_member( $DB, $member_config );
-$ticket =& new ticket( $DB, $ticket_config );
-$ticket_inv =& new ticket_inv( $DB, $ticket_inv_config );
+$member = new glm_member( $DB, $member_config );
+$ticket = new ticket( $DB, $ticket_config );
+$ticket_inv = new ticket_inv( $DB, $ticket_inv_config );
 switch( $Action )
 {
        case "Edit":
@@ -56,17 +56,17 @@ switch( $Action )
                header('Location: index.php?Action=List+Tickets&member_id='.$_POST['member_id']);
                exit();
        break;
-       
+
        case "Add Ticket":
                $out .= $ticket->add_ticket( $_GET['member_id'] );
        break;
-       
+
        case "Insert Ticket":
                $out .= $ticket->insert_ticket( $_POST['member_id'] );
                header('Location: index.php?Action=List+Tickets&member_id='.$_POST['member_id']);
                exit();
        break;
-       
+
        case "List Ticket Inventory":
                $out .= '<a title="Add Inventory" href="index.php?Action=Add+Ticket+Inventory&member_id='.$_GET["member_id"].'&ticket_id='.$_GET["ticket_id"].'">'.ADD_INVENTORY_ICON.'Add</a>';
                $out .= $ticket_inv->get_ticket_inv_list( $_GET['member_id'], $_GET['ticket_id'] );
@@ -87,17 +87,17 @@ switch( $Action )
                header('Location: index.php?Action=List+Ticket+Inventory&ticket_id='.$_POST['ticket_id'].'&member_id='.$_POST['member_id']);
                exit();
        break;
-       
+
        case "Add Ticket Inventory":
                $out .= $ticket_inv->add_ticket_inv( $_GET['member_id'], $_GET['ticket_id'] );
        break;
-       
+
        case "Insert Ticket Inventory":
                $out .= $ticket_inv->insert_ticket_inv( $_POST['member_id'], $_POST['ticket_id'] );
                header('Location: index.php?Action=List+Ticket+Inventory&ticket_id='.$_POST['ticket_id'].'&member_id='.$_POST['member_id']);
                exit();
        break;
-       
+
        default:
                $out .= '<div><p>'.$member->get_member_list().'</p></div>';
        break;
index 7c6bf5e..6b84f7d 100644 (file)
@@ -1,15 +1,15 @@
 <?php
-/** 
- * Toolbox Classes 
+/**
+ * Toolbox Classes
  * <p>
  * creates a contact form with an updatable fields array.
  * Don't set values in the var part only declare them.  If you set them their they will be like
  * defines and cannot be changed.  Setup in constructor function then there's no problem.
  * </p>
- * 
+ *
  * @package Toolbox
  * @subpackage Forms
- * @tutorial Toolbox/Forms/contact_form.cls 
+ * @tutorial Toolbox/Forms/contact_form.cls
  * @filesource
 */
 /**
@@ -21,23 +21,23 @@ include_once(BASE."classes/class_db.inc");
 */
 include_once(BASE."classes/class_toolbox.inc");
 /**
- * contact_form 
+ * contact_form
  * <p>
  * creates a contact form with an updatable fields array.
  * Don't set values in the var part only declare them.  If you set them their they will be like
  * defines and cannot be changed.  Setup in constructor function then there's no problem.
  * </p>
- * 
+ *
  * @package Toolbox
  * @subpackage Forms
  * @version $id$
  * @copyright 2005 Gaslight Media
- * @author Steve Sutton <steve@gaslightmedia.com> 
- * @license 
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license
  */
 class contact_form {
        /**
-        * DB_fields 
+        * DB_fields
         *
         * array for the needed fields
         * @var mixed
@@ -45,7 +45,7 @@ class contact_form {
         */
        var $DB_fields;
        /**
-        * CDB 
+        * CDB
         *
         * database object
         * @var mixed
@@ -53,98 +53,90 @@ class contact_form {
         */
        var $CDB;
        /**
-        * email 
+        * email
         * the email address. if blank will not send out
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $email;
        /**
-        * table_name 
+        * table_name
         * database table name.
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $table_name;
        /**
-        * styleLabel 
+        * styleLabel
         * css style for the label cell
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $styleLabel;
        /**
-        * fieldcell 
+        * fieldcell
         * css style class for fieldcell
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $fieldcell;
        /**
-        * contact_db 
+        * contact_db
         * weather or not they have database
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $contact_db;
        /**
-        * instructioncell 
+        * instructioncell
         * style for the instruction cell
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $instructioncell;
        /**
-        * subject 
+        * subject
         * Subject line of the E-mail
-        * 
+        *
         * @var mixed
         * @access public
         */
-       var $subject;           
+       var $subject;
        /**
-        * submit_value  
+        * submit_value
         * value for the submit button on form
-        * 
+        *
         * @var mixed
         * @access public
         */
        var $submit_value;
        /**
-        * subject 
-        * the subject line for the email
-        * 
-        * @var mixed
-        * @access public
-        */
-       var $subject;
-       /**
-        * not_interested 
-        * 
+        * not_interested
+        *
         * @var mixed
         * @access public
         */
        var $not_interested;
        /**
-        * contact_form 
-        * 
-        * @param mixed $toolbox 
+        * contact_form
+        *
+        * @param mixed $toolbox
         * @access public
         * @return void
         */
        function contact_form( )
        {
-               $this->CDB = new GLM_DB(); //& $toolbox->DB;                                    // creates DB object    
+               $this->CDB = new GLM_DB(); //& $toolbox->DB;                                    // creates DB object
                $this->set_DB_fields();                                         // set up the DB_fields array (configuration)
                $this->set_int_array();                                         // interest array
                $this->email = OWNER_EMAIL;                                     // email address for mail function
-               $this->table_name = 'contact';                          // the contact table 
+               $this->table_name = 'contact';                          // the contact table
                $this->table_primary_key = 'id';                        // the contact table primary key field name
                $this->styleLabel = "labelcell";                        // css style for the labelcell
                $this->fieldcell = "fieldcell";                         // css style for the field input
@@ -159,8 +151,8 @@ class contact_form {
 
        /**
        * get_form: one function to rule them all
-        * 
-        * @return void 
+        *
+        * @return void
         * @access public
         **/
        function get_form()
@@ -181,8 +173,8 @@ class contact_form {
 
        /**
         * set_DB_fields:
-        * 
-        * @return void 
+        *
+        * @return void
         * @access public
         **/
        function set_DB_fields()
@@ -201,15 +193,15 @@ class contact_form {
                $DB_fields[] = array( 'name'=>'verify_email','title'=>'Verify Email:',  'type'=>'text',                 'req'=>1,               'vtype'=>'email',       'inst'=>$Einst);
                $DB_fields[] = array( 'name'=>'phone',          'title'=>'Phone:',                      'type'=>'text',                 'req'=>1,               'vtype'=>'phone',       'inst'=>$Pinst);
                $DB_fields[] = array( 'name'=>'fax',            'title'=>'Fax:',                        'type'=>'text',                 'req'=>0,               'vtype'=>'phone',       'inst'=>$Pinst);
-               $DB_fields[] = array( 'name'=>'comments',       'title'=>'Comments:',           'type'=>'desc',                 'req'=>0); 
+               $DB_fields[] = array( 'name'=>'comments',       'title'=>'Comments:',           'type'=>'desc',                 'req'=>0);
                $DB_fields[] = array( 'name'=>'mail_ok',        'title'=>'You can send me email:','type'=>'radio',      'req'=>0);
                //$DB_fields[] = array( 'name'=>'interest',     'title'=>'Interest:',           'type'=>'interest',     'req'=>0);
-               $this->DB_fields = &$DB_fields; 
+               $this->DB_fields = &$DB_fields;
        }
 
        /**
         * set_int_array:
-        * 
+        *
         * @return void
         * @access public
         **/
@@ -235,34 +227,34 @@ class contact_form {
 
        /**
         * interest:
-        * @param $field: 
-        * 
+        * @param $field:
+        *
         * @return void
         * @access public
         **/
        function interest($field)
-       {               
+       {
                foreach( $this->int_array as $key => $value )
                {
                        $out .= '<label for="int'.$key.'"><input type="checkbox" id="int'.$key.'" name="interest[]" value="'.$key.'"';
                                if( strpos( $field, (string)$key ) || ( is_array( $_POST['interest'] ) && in_array( $key, $_POST['interest'] ) ) )
                        {
-                               $out .= ' checked';                             
+                               $out .= ' checked';
                        }
-                       $out .= '> '.$value.'</label><br>';             
-               }               
+                       $out .= '> '.$value.'</label><br>';
+               }
                return( $out );
        }
 
        /**
        * display_form: shows the form and any errors in it
-        * @param $error = NULL: error array  
-        * 
+        * @param $error = NULL: error array
+        *
         * @return string $out
         * @access public
         **/
        function display_form($error=NULL)
-       {                       
+       {
                if(is_array($_POST))
                {
                        foreach($_POST as $k=>$v)
@@ -304,7 +296,7 @@ class contact_form {
                                        if($value['req'])
                                        {
                                                $out .= '</span>';
-                                       }       
+                                       }
                                        $out .= '</label></td>
                                                ';
                                        $out .= '<td class="'.$field.'">';
@@ -328,7 +320,7 @@ class contact_form {
                                        if($value['req'])
                                        {
                                                $out .= '</span>';
-                                       }       
+                                       }
                                        $out .= '</label></td>
                                                <td class="'.$field.'">
                                                <input id="'.$this->form_id.$value["name"].'" name="'.$value["name"].'" value="'.$_POST[$value["name"]].'" maxlength="50">';
@@ -422,7 +414,7 @@ class contact_form {
                                        {
                                                $cols=' cols="'.$value['cols'].'"';
                                        }
-                                       
+
                                        $out .= '<tr';
                                        $out .= ( $error[$value['name']] ) ? ' class="req"' : '';
                                        $out .= '><td colspan="2">';
@@ -487,8 +479,8 @@ class contact_form {
                                        if($value['req'])
                                        {
                                                $out .= '</span>';
-                                       }       
-       
+                                       }
+
                                        $out .= '</td>';
                                        $out .= '<td class="'.$field.'">';
                                        $date_entry = GLM_TOOLBOX::date_entry($_POST[$value['name'].'_month'],$_POST[$value['name'].'_day'],$_POST[$value['name'].'_year'],$value['name'].'_month',$value['name'].'_day',$value['name'].'_year');
@@ -501,7 +493,7 @@ class contact_form {
                                        }
                                        $out .= '</tr>';
                                break;
-                               
+
                                case "checkboxes":
                                        $out .= '<tr';
                                        $out .= ( $error[$value['name']] ) ? ' class="req"' : '';
@@ -551,7 +543,7 @@ class contact_form {
                                        if($value['req'])
                                        {
                                                $out .= '</span>';
-                                       }       
+                                       }
                                        $out .= '</td>';
                                        $out .= '<td class="'.$field.'">';
                                        $cctype = GLM_TOOLBOX::build_radios( $value['name'],$value['drop'] );
@@ -565,7 +557,7 @@ class contact_form {
                                $out .= '</td></tr>';
                                break;
                        }
-               }               
+               }
                $submit_val = ( $this->submit_value != '' ) ? $this->submit_value : 'Send';
                $out .= '<tr align="center"><td colspan="2"><input type="submit" name="Command" value="'.$submit_val.'"></td></tr>';
                $out .= '</table>';
@@ -574,8 +566,8 @@ class contact_form {
        }
 
        /**
-        * get_db_fields 
-        * 
+        * get_db_fields
+        *
         * @access public
         * @return void
         */
@@ -602,9 +594,9 @@ class contact_form {
        }
 
        /**
-        * check_valid_fields 
+        * check_valid_fields
         * validates the fields based on vtype in DB_fields array
-        * 
+        *
         * @access public
         * @return void
         */
@@ -684,8 +676,8 @@ class contact_form {
        /**
        * form_process: process the form checking for any required form values as set up in the
        * DB_fields array.
-        * 
-        * @return error array if bad 
+        *
+        * @return error array if bad
         * @access public
         **/
        function form_process()
@@ -697,7 +689,7 @@ class contact_form {
                $ban_words[] = "bcc\:";
                $ban_words[] = "<([^>]+)>"; // for any html tags
                $ban_words[] = "http"; // for any html tags
-               
+
                if(is_array($_POST))
                {
                        foreach($_POST as $k=>$v)
@@ -725,7 +717,7 @@ class contact_form {
                                }
                        }
                }
-               
+
                $in_fields[] = 'create_date';
                $in_vars[] = date("m-d-Y");
                if($this->contact_db)
@@ -761,12 +753,12 @@ class contact_form {
                        if( $value['name'] == 'zip' && $_POST['zip'] != '' )
                        {
                                $query = "select state from zip where zipcode = '".$_POST['zip']."';";
-                               $zipDB =& new GLM_DB();
+                               $zipDB = new GLM_DB();
                                $zipDB->host = 'ds4.gaslightmedia.com';
                                $zipDB->dbname = 'zip_v2';
                                $zipDB->user = 'nobody';
                                $zipDB->conn = 0;
-                               if( $res = $zipDB->db_auto_get_data( $query ) ) 
+                               if( $res = $zipDB->db_auto_get_data( $query ) )
                                {
                                        if( count( $res ) == 0 )
                                        {
@@ -921,7 +913,7 @@ class contact_form {
                                {
                                        $invars = implode("','",$in_vars);
                                }
-                               $query = "INSERT INTO ".$this->table_name." 
+                               $query = "INSERT INTO ".$this->table_name."
                                        ($infds)
                                        VALUES
                                        ('$invars')";
@@ -942,12 +934,12 @@ body { background-color: #fff;
 color: black;
 font-family: verdana, arial, helvetica, sans-serif;
 }
-h1, h2 {font-family: arial, helvetica, sans-serif;}    
+h1, h2 {font-family: arial, helvetica, sans-serif;}
 h1 {font-size: 18px; }
 h2 {font-size: 16px; margin-bottom: 5px;}
 p {font-size: 12px;}
 .label {
-font-weight: bold; 
+font-weight: bold;
 background-color: transparent;
 text-align: right;
 width: 200px;
@@ -958,25 +950,25 @@ padding: 5px;
 background-color: #fff;
 padding: 3px;
 }
-table.data { 
-//background-color: #F9FBFD; 
-background-color: #fff; 
-color: #000; 
-width: 500px;  
-//border: 1px solid #D7E5F2; 
-border: 1px solid #ccc; 
-border-collapse: collapse; 
+table.data {
+//background-color: #F9FBFD;
+background-color: #fff;
+color: #000;
+width: 500px;
+//border: 1px solid #D7E5F2;
+border: 1px solid #ccc;
+border-collapse: collapse;
 margin-left: 20px;
 }
-table.data td { 
-//border: 1px solid #D7E5F2; 
-border: 1px solid #ccc; 
-padding-left: 4px; 
+table.data td {
+//border: 1px solid #D7E5F2;
+border: 1px solid #ccc;
+padding-left: 4px;
 font-size: 12px;
-}      
+}
 -->
 </style><body>
-               
+
 <h1>'.$this->subject.'</h1>
 <h2>From  '.(($_POST["fname"])?' '.$_POST["fname"].'':'').' '.(($_POST["lname"])?' '.$_POST["lname"].'':'').'</h2>
 <h2>Information</h2>
@@ -1045,7 +1037,7 @@ font-size: 12px;
                        $_POST['lname'] = stripslashes(str_replace(",","",$_POST['lname']));
                        $headers = "From: ".SITENAME." <noreply@gaslightmedia.com>\n"
                                ."Reply-To:  ".$_POST['fname']." ".$_POST['lname']." <".$_POST['email'].">\n"
-                               ."MIME-Version: 1.0\n" 
+                               ."MIME-Version: 1.0\n"
                                ."Content-type: text/html; charset=iso-8859-1";
 
                        $body .= '</table>
index 7e0616c..3b84d4e 100755 (executable)
@@ -1,18 +1,18 @@
 <?php
-/** 
- *     Toolbox Classes :)
- * 
- *     <p>
+/**
+ *  Toolbox Classes :)
+ *
+ *  <p>
  * $Id: class_template.inc,v 1.1.1.1 2007/04/19 13:06:15 matrix Exp $
- *     NOTE: for the search engine freindly url's use .htaccess file.
- *     need to make sure .htaccess is enabled or this work work
- *     to turn off seo url's set define SEO_URL to 0 in setup file
- *     </p>
+ *  NOTE: for the search engine freindly url's use .htaccess file.
+ *  need to make sure .htaccess is enabled or this work work
+ *  to turn off seo url's set define SEO_URL to 0 in setup file
+ *  </p>
  *
  * @package Toolbox Library
  * @subpackage Template Library
  * @filesource
- * 
+ *
  */
 /**
  * Require DocBlock
@@ -23,7 +23,7 @@ require_once(BASE."classes/class_db.inc");
  */
 require_once(BASE."classes/class_toolbox.inc");
 /**
- *     Template Class :)
+ *  Template Class :)
  *
  * <p>
  * $Id: class_template.inc,v 1.1.1.1 2007/04/19 13:06:15 matrix Exp $
@@ -76,17 +76,17 @@ require_once(BASE."classes/class_toolbox.inc");
  * include_once('setup.phtml');
  * include_once(BASE.'classes/class_template.inc');
  * $catid = ( $_GET['catid'] ) ? $_GET['catid']: HOME_ID;
- * $toolbox =& new GLM_TEMPLATE( $catid );
+ * $toolbox = new GLM_TEMPLATE( $catid );
  * if($catid == 1)
  * {
- *     // title and meta description for home page only
- *     $title = '';
- *     $meta = '';
+ *  // title and meta description for home page only
+ *  $title = '';
+ *  $meta = '';
  * }
  * else
  * {
- *     $title = $toolbox->title().' - Site Name';
- *     $meta = $toolbox->meta();
+ *  $title = $toolbox->title().' - Site Name';
+ *  $meta = $toolbox->meta();
  * }
  * ?>
  * <title><?php echo $title;?></title>
@@ -96,7 +96,7 @@ require_once(BASE."classes/class_toolbox.inc");
  * @package Toolbox Library
  * @subpackage Template Library
  * @category Template
- * @author Steve Sutton <steve@gaslightmedia.com> 
+ * @author Steve Sutton <steve@gaslightmedia.com>
  * @copyright 2007
  * @version $Revision: 1.1.1.1 $
  * @since $Date: 2007/04/19 13:06:15 $
@@ -106,2070 +106,2070 @@ require_once(BASE."classes/class_toolbox.inc");
  */
 class GLM_TEMPLATE{
 
-       /** @var string header_begin The style starting for header */
-       var $header_begin;
-       /** @var string header_end The style ending for header*/
-       var $header_end;
-       /** @var string subheader_begin The style starting for header */
-       var $subheader_begin;
-       /** @var string subheader_end The style ending for header*/
-       var $subheader_end;
-       /** @var string img_align The alignment of images*/
-       var $img_align;
-       /** @var string img_alternate 1 alternate images 0 not*/
-       var $img_alternate;
-       /** @var string img_size The path to the image directory*/
-       var $img_size;
-       /** @var object DB The database class*/
-       var $DB;
-       /** @var array data The category array*/
-       var $data;
-       /** @var array items The items array*/
-       var $items;
-       /** @var string type The type*/
-       var $type;      
-       /** @var string whole_thread The thread string*/
-       var $whole_thread;
-       /** @var integer thread_count The thread count*/
-       var $thread_count;
-       /** @var integer catid  catid for the page */
-       var $catid;
-       /** @var array $pages */
-       var $pages;
-       /** @var string $active_query string adding active = 't' to queries only if ACTIVE_FLAG is set to true */
-       var $active_query;
-       /** @var integer $template integer determines page layout */
-       var $template;
-       /** @var string $php_ext pgae extension for php pages .php or .phtml */
-       var $php_ext;
-
-       /**
-        * GLM_TEMPLATE 
-        * 
-        * @param mixed $catid current page category id
-        * @param mixed $DB Object passed from GLM_DB if done 
-        * @access public
-        * @return string
-        */
-       function GLM_TEMPLATE( $catid, $DB = NULL )
-       {
-               $this->catid = $this->get_catid( $catid );          // sets $this->catid
-               $this->set_DB( &$DB );                                                  // using a reference to $DB (should be started on setup.phtml
-               //$this->Member = $this->set_member();                  // used for cvb's
-               $this->header_begin = "<h1>";                                   // class="content" should not be used anymore 
-               $this->header_end = "</h1>";                                    // create style for p h1 h2 tags if needed try to keep it clean
-               $this->subheader_begin = "<h2>";                                // should not be using h3 here duh go from 1 to 2 instead
-               $this->subheader_end = "</h2>";                                 // like your suppose to
-               $this->img_alternate = 1;                                               // for alternating images set to 1 else leave alone
-               $this->img_align = "left";                                              // the starting postion for images change to left if needed
-               $this->img_size = RESIZED;                                              // img_size are RESIZED,MIDSIZED,THUMB do not use ORIGINAL
-               $this->whole_thread = "";                                               // do not touch this it is used for menu generation
-               $this->thread_count = 1;                                                // also used for menu generation
-               $this->php_ext = '.php';                                                // defaults to .php
-               $this->set_pages( &$GLOBALS['PAGES'] );                 // Uses the PAGE array set in setup.phtml
-               $this->page_status( $catid );                                   // tell if page is active, deleted or inactive
-               $this->set_active_query();                                              // set active query string 
-       }
-       
-       /**
-        * page_status 
-        * 
-        * tell if page is active, deleted or inactive
-        * this will redirect to the index.php page if the
-        * id has been deleted or not active
-        * it will display message about page not found.
-        * 
-        * @param mixed $id 
-        * @access public
-        * @return string
-        */
-       function page_status( $id )
-       {
-               if( $id == '' )
-               {
-                       return( false );
-               }
-               if( $id == HOME_ID )
-               {
-                       $this->page_status = 'Good';
-               }
-               $query = "select id,active from bus_category where id = $id;";
-
-               if( $data = $this->DB->db_auto_get_data( $query ) )
-               {
-                       if( $data[0]['active'] == 'f' && !strstr( $_SERVER['HTTP_REFERER'],'admin/' ) )
-                       {
-                               $this->page_status = 'Bad';
-                       }
-                       else
-                       {
-                               $this->page_status = 'Good';
-                       }
-               }
-               else
-               {
-                       // page was deleted and no longer avail.
-                       // give 301 redirect and go back to index page
-                       header('HTTP/1.1 301 Moved Permanently');
-                       header('Location: '.BASE_URL);
-                       exit();
-               }
-       }
-       /**
-        * set_active_query: some toolboxes have an active flag some do not 
-        * so this is to allow both with and without a flag. 
-        *
-        * @uses ACTIVE_FLAG
-        * 
-        * @return void 
-        * @access public
-        **/
-       function set_active_query()
-       {
-               if( ACTIVE_FLAG )
-               {
-                       $this->active_query = " and active = 't'";
-               }
-               return( $this->active_query );
-       }
-       /**
-        * set_member 
-        * 
-        * @access public
-        * @return string
-        */
-       function set_member()
-       {
-               if( MEMBERS_DB && $this->catid )
-               {
-                       require_once(BASE.'classes/class_members.inc');
-                       $Member =& new glm_members( &$this );
-                       return( $Member );
-               }
-       }       
-       /**
-        * get_seo_url: 
-        * grab category part of the search engine friendly url
-        * looks at define for seo_url to see weather to use the seach engine friendly url's or not
-        * 
-        * @param integer $id: 
-        * @param boolean $slash = 1 : to put a slash on end or not
-        * @uses BASE_URL
-        * @uses SEO_URL
-        * @uses HOME_ID
-        * @uses GLM_TEMPLATE::$php_ext
-        * @uses GLM_TEMPLATE::set_name_url()
-        * @uses GLM_TEMPLATE::get_category_name()
-        * @uses GLM_TEMPLATE::get_base_url()
-        * 
-        * @return string $url for page.
-        * @access public
-        **/
-       function get_seo_url( $id, $slash = 1 )
-       {
-               if( $id == HOME_ID && $GLOBALS['GLM_SERVER_ID'] != 'devsys.gaslightmedia.com' )
-               {
-                       return( BASE_URL );
-               }
-               elseif( $id == HOME_ID && $GLOBALS['GLM_SERVER_ID'] == 'devsys.gaslightmedia.com' )
-               {
-                       return( BASE_URL.'index.php' );
-               }
-               if( SEO_URL )
-               {
-                       $url = BASE_URL;
-                       $url .= GLM_TEMPLATE::set_name_url( GLM_TEMPLATE::get_category_name( $id, "bus_category", $this->DB ) );
-                       $url = strip_tags( $url );
-                       $url = htmlspecialchars( $url );
-                       if( $slash )
-                       {
-                               $url .= '/';
-                       }
-               }
-               else
-               {
-                       $url = $this->get_base_url( $id );
-                       if( $url )
-                       {
-                               $url = BASE_URL.$url;
-                               $url .= $this->php_ext.'?catid='.$id;
-                       }
-                       else
-                       {
-                               $url = BASE_URL;
-                       }
-               }       
-
-               return( $url );
-       }
-       /**
-        * set_DB: set the DB up to be that of the global one if it exists
-        * 
-        * @param object $DB : the DB object 
-        * @uses GLM_DB
-        * 
-        * @return void
-        * @access public
-        **/
-       function set_DB( $DB )
-       {
-               if( isset( $DB ) )
-               {
-                       $this->DB =& $DB;
-               }
-               else
-               {
-                       $this->DB =& new GLM_DB();
-               }
-       }
-
-       /**
-        * set_pages: grab the globals for the pages an use this for 
-        *      the pages array for the class
-        * 
-        * @return void
-        * @access public 
-        **/
-       function set_pages( $pages )
-       {
-               if( is_array( $pages ) )
-               {
-                       $this->pages =& $pages;
-               }
-       }
-       
-       /**
-       * set_catid:Set the class catid var
-       * @param integer $catid: $catid
-       * 
-       * @deprecated using get_catid
-       * @return void 
-       * @access public 
-       **/
-       function set_catid( $catid )
-       {
-               if( is_numeric( $catid ) )
-               {
-                       $this->catid = $catid;
-               }
-               else
-               {
-                       $this->catid = 1;
-               }
-       }
-
-       /**
-        * get_id_from_path_info: takes the path_info and gets a catid from bus_category table
-        * NOTE: not used. 
-        * 
-        * @deprecated using .htaccess file for this when using seo url's
-        * @return int catid
-        * @access public
-        **/
-       function get_id_from_path_info()
-       {
-               return( false );
-       }
-
-       /**
-        * get_catid: setting catid for class 
+    /** @var string header_begin The style starting for header */
+    var $header_begin;
+    /** @var string header_end The style ending for header*/
+    var $header_end;
+    /** @var string subheader_begin The style starting for header */
+    var $subheader_begin;
+    /** @var string subheader_end The style ending for header*/
+    var $subheader_end;
+    /** @var string img_align The alignment of images*/
+    var $img_align;
+    /** @var string img_alternate 1 alternate images 0 not*/
+    var $img_alternate;
+    /** @var string img_size The path to the image directory*/
+    var $img_size;
+    /** @var object DB The database class*/
+    var $DB;
+    /** @var array data The category array*/
+    var $data;
+    /** @var array items The items array*/
+    var $items;
+    /** @var string type The type*/
+    var $type;
+    /** @var string whole_thread The thread string*/
+    var $whole_thread;
+    /** @var integer thread_count The thread count*/
+    var $thread_count;
+    /** @var integer catid  catid for the page */
+    var $catid;
+    /** @var array $pages */
+    var $pages;
+    /** @var string $active_query string adding active = 't' to queries only if ACTIVE_FLAG is set to true */
+    var $active_query;
+    /** @var integer $template integer determines page layout */
+    var $template;
+    /** @var string $php_ext pgae extension for php pages .php or .phtml */
+    var $php_ext;
+
+    /**
+     * GLM_TEMPLATE
+     *
+     * @param mixed $catid current page category id
+     * @param mixed $DB Object passed from GLM_DB if done
+     * @access public
+     * @return string
+     */
+    function GLM_TEMPLATE( $catid, $DB = NULL )
+    {
+        $this->catid = $this->get_catid( $catid );      // sets $this->catid
+        $this->set_DB( &$DB );                          // using a reference to $DB (should be started on setup.phtml
+        //$this->Member = $this->set_member();          // used for cvb's
+        $this->header_begin = "<h1>";                   // class="content" should not be used anymore
+        $this->header_end = "</h1>";                    // create style for p h1 h2 tags if needed try to keep it clean
+        $this->subheader_begin = "<h2>";                // should not be using h3 here duh go from 1 to 2 instead
+        $this->subheader_end = "</h2>";                 // like your suppose to
+        $this->img_alternate = 1;                       // for alternating images set to 1 else leave alone
+        $this->img_align = "left";                      // the starting postion for images change to left if needed
+        $this->img_size = RESIZED;                      // img_size are RESIZED,MIDSIZED,THUMB do not use ORIGINAL
+        $this->whole_thread = "";                       // do not touch this it is used for menu generation
+        $this->thread_count = 1;                        // also used for menu generation
+        $this->php_ext = '.php';                        // defaults to .php
+        $this->set_pages( &$GLOBALS['PAGES'] );         // Uses the PAGE array set in setup.phtml
+        $this->page_status( $catid );                   // tell if page is active, deleted or inactive
+        $this->set_active_query();                      // set active query string
+    }
+
+    /**
+     * page_status
+     *
+     * tell if page is active, deleted or inactive
+     * this will redirect to the index.php page if the
+     * id has been deleted or not active
+     * it will display message about page not found.
+     *
+     * @param mixed $id
+     * @access public
+     * @return string
+     */
+    function page_status( $id )
+    {
+        if( $id == '' )
+        {
+            return( false );
+        }
+        if( $id == HOME_ID )
+        {
+            $this->page_status = 'Good';
+        }
+        $query = "select id,active from bus_category where id = $id;";
+
+        if( $data = $this->DB->db_auto_get_data( $query ) )
+        {
+            if( $data[0]['active'] == 'f' && !strstr( $_SERVER['HTTP_REFERER'],'admin/' ) )
+            {
+                $this->page_status = 'Bad';
+            }
+            else
+            {
+                $this->page_status = 'Good';
+            }
+        }
+        else
+        {
+            // page was deleted and no longer avail.
+            // give 301 redirect and go back to index page
+            header('HTTP/1.1 301 Moved Permanently');
+            header('Location: '.BASE_URL);
+            exit();
+        }
+    }
+    /**
+     * set_active_query: some toolboxes have an active flag some do not
+     * so this is to allow both with and without a flag.
+     *
+     * @uses ACTIVE_FLAG
+     *
+     * @return void
+     * @access public
+     **/
+    function set_active_query()
+    {
+        if( ACTIVE_FLAG )
+        {
+            $this->active_query = " and active = 't'";
+        }
+        return( $this->active_query );
+    }
+    /**
+     * set_member
+     *
+     * @access public
+     * @return string
+     */
+    function set_member()
+    {
+        if( MEMBERS_DB && $this->catid )
+        {
+            require_once(BASE.'classes/class_members.inc');
+            $Member = new glm_members( &$this );
+            return( $Member );
+        }
+    }
+    /**
+     * get_seo_url:
+     * grab category part of the search engine friendly url
+     * looks at define for seo_url to see weather to use the seach engine friendly url's or not
+     *
+     * @param integer $id:
+     * @param boolean $slash = 1 : to put a slash on end or not
+     * @uses BASE_URL
+     * @uses SEO_URL
+     * @uses HOME_ID
+     * @uses GLM_TEMPLATE::$php_ext
+     * @uses GLM_TEMPLATE::set_name_url()
+     * @uses GLM_TEMPLATE::get_category_name()
+     * @uses GLM_TEMPLATE::get_base_url()
+     *
+     * @return string $url for page.
+     * @access public
+     **/
+    function get_seo_url( $id, $slash = 1 )
+    {
+        if( $id == HOME_ID && $GLOBALS['GLM_SERVER_ID'] != 'devsys.gaslightmedia.com' )
+        {
+            return( BASE_URL );
+        }
+        elseif( $id == HOME_ID && $GLOBALS['GLM_SERVER_ID'] == 'devsys.gaslightmedia.com' )
+        {
+            return( BASE_URL.'index.php' );
+        }
+        if( SEO_URL )
+        {
+            $url = BASE_URL;
+            $url .= GLM_TEMPLATE::set_name_url( GLM_TEMPLATE::get_category_name( $id, "bus_category", $this->DB ) );
+            $url = strip_tags( $url );
+            $url = htmlspecialchars( $url );
+            if( $slash )
+            {
+                $url .= '/';
+            }
+        }
+        else
+        {
+            $url = $this->get_base_url( $id );
+            if( $url )
+            {
+                $url = BASE_URL.$url;
+                $url .= $this->php_ext.'?catid='.$id;
+            }
+            else
+            {
+                $url = BASE_URL;
+            }
+        }
+
+        return( $url );
+    }
+    /**
+     * set_DB: set the DB up to be that of the global one if it exists
+     *
+     * @param object $DB : the DB object
+     * @uses GLM_DB
+     *
+     * @return void
+     * @access public
+     **/
+    function set_DB( $DB )
+    {
+        if( isset( $DB ) )
+        {
+            $this->DB = $DB;
+        }
+        else
+        {
+            $this->DB = new GLM_DB();
+        }
+    }
+
+    /**
+     * set_pages: grab the globals for the pages an use this for
+     *  the pages array for the class
+     *
+     * @return void
+     * @access public
+     **/
+    function set_pages( $pages )
+    {
+        if( is_array( $pages ) )
+        {
+            $this->pages = $pages;
+        }
+    }
+
+    /**
+    * set_catid:Set the class catid var
+    * @param integer $catid: $catid
+    *
+    * @deprecated using get_catid
+    * @return void
+    * @access public
+    **/
+    function set_catid( $catid )
+    {
+        if( is_numeric( $catid ) )
+        {
+            $this->catid = $catid;
+        }
+        else
+        {
+            $this->catid = 1;
+        }
+    }
+
+    /**
+     * get_id_from_path_info: takes the path_info and gets a catid from bus_category table
+     * NOTE: not used.
+     *
+     * @deprecated using .htaccess file for this when using seo url's
+     * @return int catid
+     * @access public
+     **/
+    function get_id_from_path_info()
+    {
+        return( false );
+    }
+
+    /**
+     * get_catid: setting catid for class
+     *
+     * We should be using the $_POST or $_GET globals here
+     *
+     * @return int catid
+     * @access public
+     **/
+    function get_catid( $catid )
+    {
+        if( is_numeric( $_GET['catid'] ) )
+        {
+            return( $_GET['catid'] );
+        }
+        elseif( is_numeric( $_POST['catid'] ) )
+        {
+            return( $_POST['catid'] );
+        }
+        else
+        {
+            return( $this->catid = $catid );
+        }
+    }
+
+    /**
+    * set_contact:Set the contact string
+    * <code><p><strong>Contact Name:</strong>&nbsp;{$text}</p></code>
+    *
+    * @param string $text: The text as string
+    * @param string $email: email if givin
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_contact( $text, $email )
+    {
+        if( $email != "" )
+        {
+            $text = "";
+        }
+        else
+        {
+            $text = '<p><strong>Contact Name:</strong>&nbsp;'.$text.'</p>';
+        }
+        return($text);
+    }
+
+    /**
+    * set_text:Set the contact string
+    * <code><p>{$text}</code>
+    * @param string $text: The text as string
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_text( $text )
+    {
+        if("" == str_replace("<br />","",trim($text)))
+        {
+            return(false);
+        }
+        if( $text != "" )
+        {
+            $text = $this->keyword_replace( $text );
+            $text = $text;
+        }
+        return($text);
+    }
+
+    /**
+     * get_image_path: get image path from the size used
+     *
+     * @uses MIDSIZED_PATH
+     * @uses RESIZED_PATH
+     * @uses THUMB_PATH
+     *
+     * @return path for images
+     * @access public
+     **/
+    function get_image_path()
+    {
+        if( strstr($this->img_size,'midsized/') )
+        {
+            return( MIDSIZED_PATH );
+        }
+        if( strstr($this->img_size,'resized/') )
+        {
+            return( RESIZED_PATH );
+        }
+        if( strstr($this->img_size,'thumb/') )
+        {
+            return( THUMB_PATH );
+        }
+    }
+
+    /**
+    * set_img:Set the image string
+    * <p><code>
+    * <div class="image{$align}" style="width: {$width}px" src="{$size}{$image}" {$titletag}>
+    * <div class="imagecaption">{$caption}</div>
+    * </div>
+    * </code>
+    * </p>
+    *
+    * @param string $image: The image
+    * @param string $size: The path
+    * @param string $align: The alignment
+    * @param string $name: The image_name (displayed under image)
+    * @param string $alt_title text for use in alt and title tags
+    * @param string $caption Text for image caption if given
+    * @uses GLM_TEMPLATE::get_image_path()
+    *
+    * @return void
+    * @access public
+    **/
+    function set_img( $image, $size, $align, $alt_title = NULL, $caption = NULL )
+    {
+        if( $image != "" )
+        {
+            if( $caption != '' )
+            {
+                $caption = str_replace('&amp;','&',$caption);
+                $titletag = 'title="'.htmlspecialchars(strip_tags($caption)).'"';
+                $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
+            }
+            elseif( $alt_title != '')
+            {
+                $alt_title = str_replace('&amp;','&',$alt_title);
+                $titletag = 'title="'.htmlspecialchars(strip_tags($alt_title)).'"';
+                $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
+            }
+            else
+            {
+                $titletag = 'title="'.htmlspecialchars(strip_tags($image)).'"';
+                $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
+            }
+            if( $align != "" )
+            {
+                $img_align = 'class="image'.$align.'"';
+            }
+            $path = $this->get_image_path();
+            if( is_file( $path.$image ) )
+            {
+                $image_size = getimagesize( $path.$image );
+                $img_attr = $image_size[3];
+            }
+            $img = '
+            <div '.$img_align.' style="width: '.$image_size[0].'px">
+                ';
+            $img .= '<img '.$img_attr.' src="'.$size.$image.'" '.$titletag.'>';
+            if( $caption )
+            {
+                $img .= '
+                <div class="imagecaption">'.$caption.'</div>
+                    ';
+            }
+            $img .= '</div>
+                ';
+            return($img);
+        }
+    }
+
+    /**
+    * set_url:Set the url string
+    * <p>
+    * <code><p><a href="http://{$url}" target="_blank">{$text}</a></code>
+    * </p>
+    *
+    * @param string $url: The url
+    * @param string $text: The text as string
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_url( $url, $text )
+    {
+        if( $url != "" )
+        {
+            if( !$text )
+            {
+                $text = $url;
+            }
+            if( strtolower( substr( $url, 0, 7 ) ) == "https://" )
+            {
+                $url = '<p><a href="'.$url.'" target="_blank">'.htmlspecialchars($text).'</a></p>';
+            }
+            else
+            {
+                $url = '<p><a href="http://'.$url.'" target="_blank">'.htmlspecialchars($text).'</a></p>';
+            }
+        }
+        return( $url );
+    }
+
+    /**
+    * set_email:Set the email string
+    * <code><p><strong>Contact:</strong>&nbsp;&nbsp;<a href="mailto:{$email}" target="_blank">{$text}</a></p></code>
+    * @param string $email: The email as string
+    * @param string $contact: The contactname this is used as the link text
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_email( $email, $contact )
+    {
+        if( $email != "" )
+        {
+            if( $contact != "" )
+            {
+                $email = '<p><strong>Contact:</strong>&nbsp;&nbsp;<a href="mailto:'.$email.'" target="_blank">'.htmlspecialchars($contact).'</a></p>';
+            }
+            else
+            {
+                $email = '<p><strong>Email:</strong>&nbsp;&nbsp;<a href="mailto:'.$email.'" target="_blank">'.htmlspecialchars($email).'</a></p>';
+            }
+        }
+        return( $email );
+    }
+
+    /**
+    * set_header:Set the header string
+    * @param string $text: The text as string
+    * @uses GLM_TEMPLATE::header_begin()
+    * @uses GLM_TEMPLATE::header_end()
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_header( $text )
+    {
+        if( $text != "" )
+        {
+            $text = $this->header_begin.htmlspecialchars($text).$this->header_end;
+        }
+        return( $text );
+    }
+
+    /**
+    * set_subheader:Set the subheader string
+    * @param string $text: The text as string
+    * @uses GLM_TEMPLATE::subheader_begin()
+    * @uses GLM_TEMPLATE::subheader_end()
+    *
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_subheader( $text )
+    {
+        if( $text != "" )
+        {
+            $text = $this->subheader_begin.htmlspecialchars($text).$this->subheader_end;
+        }
+        return( $text );
+    }
+
+    /**
+    * set_phone:Set the phone string
+    * <code><p><strong>Phone:</strong>&nbsp;&nbsp;{$text}</p></code>
+    * @param string $text: The text as string
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_phone( $text )
+    {
+        if( $text != "" )
+        {
+            $text = '<p><strong>Phone:</strong>&nbsp;&nbsp;'.$text.'</p>';
+        }
+        return( $text );
+    }
+
+    /**
+    * set_fax:Set the fax string
+    * <code><p><strong>Fax:</strong>&nbsp;&nbsp;{$text}</p></code>
+    * @param string $text: The text as string
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_fax( $text )
+    {
+        if( $text != "" )
+        {
+            $text = '<p><strong>Fax:</strong>&nbsp;&nbsp;'.htmlspecialchars($text).'</p>';
+        }
+        return( $text );
+    }
+
+    /**
+    * set_file:Set the file string
+    * <code><p><strong>Contact Name:</strong>&nbsp;{$text}</p></code>
+    * @param string $text: The text as string
+    * @param string $name: The file name displayed
+    * @uses URL_BASE
+    *
+    * @return string $text
+    * @access public
+    **/
+    function set_file( $text, $name )
+    {
+        if( $text != "" )
+        {
+            $outtext = '<p><a';
+            if(preg_match("/[.]([A-Z0-9]{3}$)/i",$text,$tmp))
+            {
+                $outtext .= ' class="'.strtolower($tmp[1]).'"';
+            }
+            $outtext .= ' href="'.URL_BASE.'uploads/'.$text.'" target="_blank">';
+            if($name)
+            {
+                $outtext .= htmlspecialchars($name);
+            }
+            else
+            {
+                $outtext .= htmlspecialchars($text);
+            }
+            $outtext .= '</a>';
+            if(preg_match("/[.]([A-Z0-9]{3}$)/i",$text,$tmp))
+            {
+                $outtext .= '<a href="'.BASE_URL.'download.php?file='.$text.'" class="download">Click here to Download&nbsp;</a>';
+            }
+            $outtext .= '</p>';
+        }
+        return( $outtext );
+    }
+
+    /**
+    * set_address:set_address
+    * <code><p>{$address}<br>{$city},{$state} {$zip}</p></code>
+    * @param array $data: data contain the address info for display.
+    *
+    * @return string $address
+    * @access public
+    **/
+    function set_address( $data )
+    {
+        $address = "";
+        if( $data["address"] )
+        {
+            $address .= $data["address"];
+        }
+        if( $data["city"] && $data["state"] && $data["zip"] )
+        {
+            $address .= '<br>'.$data["city"].', '.$data["state"].' '.$data["zip"];
+        }
+        elseif( $data["city"] && $data["state"] )
+        {
+            $address .= '<br>'.$data["city"].', '.$data["state"];
+        }
+        elseif( $data["city"] )
+        {
+            $address .= '<br>'.$data["city"];
+        }
+        if( $address != "" )
+        {
+            return( '<p>'.$address.'<br></p>' );
+        }
+    }
+
+    /**
+    * get_all:Does the query and set_data calls boths arrays
+    *
+    * @uses GLM_TEMPLATE::set_data()
+    * @uses GLM_TEMPLATE::$data
+    * @uses GLM_TEMPLATE::$items
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access public
+    **/
+    function get_all( $type = NULL )
+    {
+        $catid = $this->catid;
+        if( $type == 1 || !$type )
+        {
+            $cat_query = "select * from bus_category where id = $catid order by pos";
+            $res = $this->set_data( $this->DB->db_auto_get_data( $cat_query ) );
+            $this->data = $res[0];
+        }
+        if( $type == 2 || !$type )
+        {
+            $item_query = "select b.* from bus b left outer join bus_category_bus bcb on (bcb.busid = b.id) where bcb.catid = $catid order by bcb.pos";
+            $this->items = $this->set_data( $this->DB->db_auto_get_data( $item_query ) );
+            $file_query = "select * from files where bus_id in ( select bus_id from bus_category_bus where catid = ".$this->catid." ) order by bus_id,pos;";
+            if( $file_data = $this->DB->db_auto_get_data( $file_query ) )
+            {
+                foreach( $file_data as $file_row )
+                {
+                    $this->item_files[$file_row['bus_id']][] = GLM_TEMPLATE::set_file( $file_row['filename'],$file_row['urltext'] );
+                }
+            }
+        }
+    }
+
+    /**
+    * call all class methods to set tho data elements
+    *
+    * <p>This is hightly dependant on the three tables of bus bus_category and bus_category_bus
+    * set_data:Calls each function of the class
+    * based on the key af the array $data[0][$key]</p>
+    * @todo Really need to look at enhancing this function for different datasetups.
+    * @param array $data: The input array from db query
+    * @uses GLM_TEMPLATE::$img_size
+    * @uses GLM_TEMPLATE::$img_align
+    * @uses GLM_TEMPLATE::$img_alternate
+    * @uses GLM_TEMPLATE::set_text()
+    * @uses GLM_TEMPLATE::set_header()
+    * @uses GLM_TEMPLATE::set_subheader()
+    * @uses GLM_TEMPLATE::set_url()
+    * @uses GLM_TEMPLATE::set_address()
+    * @uses GLM_TEMPLATE::set_img()
+    * @uses GLM_TEMPLATE::set_email()
+    * @uses GLM_TEMPLATE::set_phone()
+    *
+    * @return array data The finished array
+    * @access  public
+    **/
+    function set_data( $data )
+    {
+        if( is_array( $data ) )
+        {
+            foreach( $data as $k => $val )
+            {
+                foreach( $val as $key => $value )
+                {
+                    if( strstr( $key, "image" ) && !strstr( $key, "name") && $value != "" )
+                    {
+                        $titletag = ( $data[$k]['category'] ) ? $data[$k]['category'] : $data[$k]['name'];
+                        //$data[$k][$key."_name"] = $value;
+                        $data[$k][$key] = $this->set_img( $value, $this->img_size, $this->img_align, $titletag, $data[$k][$key."name"] );
+                        if( !strstr( $key, "name" ) )
+                        {
+                            if( $this->img_align == "right" && $this->img_alternate )
+                            {
+                                $this->img_align = "left";
+                            }
+                            elseif( $this->img_alternate )
+                            {
+                                $this->img_align = "right";
+                            }
+                        }
+                    }
+                    elseif( strstr($key,"file") && strstr($key,"name") && $value!="" )
+                    {
+                    }
+                    elseif( strstr($key,"url") && strstr($key,"name") && $value!="" )
+                    {
+                    }
+                    elseif( strstr($key,"descr") && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_text( $value );
+                    }
+                    elseif( $key == "contactname" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_contact( $value, $data[$k]['email'] );
+                    }
+                    elseif($key == "name" && $value!="")
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_subheader( $value );
+                    }
+                    elseif( strstr( $key, "header" ) && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_subheader( $value );
+                    }
+                    elseif( $key == "intro" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_header( $value );
+                    }
+                    elseif( $key == "category" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_header( $value );
+                    }
+                    elseif( $key == "url" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_url( $value, $data[$k]["urlname"] );
+                    }
+                    elseif( $key == "email" && $value!="")
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_email( $value, $data[$k]["contactname"] );
+                    }
+                    elseif( $key == "phone" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_phone($value);
+                    }
+                    elseif( $key == "fax" && $value != "" )
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_fax( $value );
+                    }
+                    elseif (strstr( $key, "file" ) && $value!="")
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_file( $value, $data[$k][$key.'name'] );
+                    }
+                    elseif( $key == "address" )
+                    {
+                        $data[$k][$key] =  GLM_TEMPLATE::set_address( $data[$k] );
+                    }
+                    elseif( $key == "id" )
+                    {
+                        $data[$k][$key] = $value;
+                    }
+                    else
+                    {
+                        $data[$k][$key] = GLM_TEMPLATE::set_text( $value );
+                    }
+                }
+            }
+            return( $data );
+        }
+        return( false );
+    }
+
+    /**
+    * load_static_page:using object buffer include the page $catid.phtml from static dir
+    and return it as string
+    *
+    * @return string $text
+    * @access  public
+    **/
+    function load_static_page()
+    {
+        if( file_exists( BASE."static/".$this->catid.".phtml" ) )
+        {
+            ob_start();
+            include("static/".$this->catid.".phtml");
+            $text = ob_get_contents();
+            ob_end_clean();
+            return($text);
+        }
+    }
+
+    /**
+    * clean_text:get rid of single br or p br tags left from htmlarea when textarea is empty.
+    * @param string $output:
+    *
+    * @return string text cleaned
+    * @access  public
+    **/
+    function clean_text($output)
+    {
+        $output = str_replace("<br />","<br>",$output);
+        $output = str_replace("<p><br></p>","",$output);
+        return($output);
+    }
+
+    /**
+    * get_category: grab just category contents
+    * @param integer $catid: id of bus_category
+    * @param object $DB:
+    * @param boolean $showimg=1: weather or not to show category image
+    * @uses DELUXE_TOOLBOX
+    * @uses HOME_PAGE_EVENTS
+    * @uses GLM_TEMPLATE::clean_text()
+    * @uses GLM_TEMPLATE::get_home_events()
+    *
+    * @return string $output
+    * @access public
+    **/
+    function get_category( $showimg = 1,$showdiv=1 )
+    {
+        if( DELUXE_TOOLBOX )
+        {
+            $this->get_template( "cat" );
+        }
+
+        if( !$this->data )
+        {
+            $this->get_all( 1 );
+        }
+        $data = $this->data;
+        if( !$data["image"] && !$data["description"] && !$data["intro"] && ( $this->catid != 1 && HOME_PAGE_EVENTS != true ) )
+        {
+            return( false );
+        }
+        if($showdiv==1)
+        {
+            $output .= '<div id="category">
+                ';
+        }
+        if( $this->catid == 1 && HOME_PAGE_EVENTS )
+        {
+            $output .= $this->get_home_events();
+        }
+        if($data["image"] || $data["description"] || $data["intro"] )
+        {
+            if($showimg == 1)
+            {
+                $output .=$data["image"]." ";
+            }
+            $output .=$data["intro"]." ";
+            $output .=$data["description"]." ";
+        }
+        if($showdiv==1)
+        {
+            $output .= '</div>
+        ';
+        }
+        $output = GLM_TEMPLATE::clean_text($output);
+        return( $output );
+
+    }
+
+    /**
+     * photo_module
+     * Load the photo gallery into page
+     *
+     * @access public
+     * @return string
+     */
+    function photo_module()
+    {
+        $query = "select photocat_id from photo_category_bus where buscat_id = $this->catid;";
+        if( $pData = $this->DB->db_auto_get_data( $query ) )
+        {
+            if( count( $pData ) > 1 )
+            {
+                foreach( $pData as $pKey => $pVal )
+                {
+                    $photocatid[] = $pVal['photocat_id'];
+                }
+            }
+            else
+            {
+                $photocatid = $pData[0]['photocat_id'];
+            }
+            if( is_numeric( $photocatid ) || is_array( $photocatid ) )
+            {
+                if( !$_GET['photo_catid'] )
+                {
+                    $_GET['photo_catid'] = $photocatid;
+                }
+                ob_start();
+                include_once(BASE.'static/photo.php');
+                $out .= ob_get_contents();
+                ob_end_clean();
+            }
+        }
+        return( $out );
+    }
+
+    /**
+     * get_page: replacing template_parser with get_page function
+     *
+     * @uses GLM_TEMPLATE::get_category() For building the main page section
+     * @uses GLM_TEMPLATE::get_listings() For building out the paragraph sections
+     *
+     * @return  string $out NEED to echo results of this function
+     * @access  public
+     **/
+    function get_page( $showimg = 1,$showdiv=1 )
+    {
+        if( $this->page_status != 'Good' )
+        {
+            return('<h1>Sorry this page is temporary Taken Down!</h1>');
+        }
+        if( GOOGLE_SEARCH && ( $_POST['Query'] || $_GET['Query'] ) )        // for the gogle search engine api
+        {                                               // if Query is sent display search results
+            ini_set('include_path', BASE.'google' . ':' .ini_get('include_path'));
+            ob_start();
+            include_once(GOOGLE."search.php");
+            include_once(GOOGLE."results.php");
+
+            echo SearchResults();
+            $out = '<div id="toolbox">'.ob_get_contents().'</div>';
+            ob_end_clean();
+        }
+        elseif(MEMBERS_DB && $this->Member->member_sections[$this->catid] )
+        {
+            if( !$_GET['id'] )
+            {
+                $out .= '<div id="toolbox">'.$this->get_category( $showimg,$showdiv );
+                $out .= $this->get_listings().'</div>';
+            }
+            ob_start();
+            $out .= $this->Member->get_list();
+            $out .= ob_get_contents();
+            ob_end_clean();
+        }
+        else
+        {
+            $out .= '<div id="toolbox">'.$this->get_category( $showimg,$showdiv );
+            $out .= $this->get_listings().'</div>';
+        if( PHOTO_GALLERY )
+        {
+                $out .= $this->photo_module();
+            }
+        }
+        return( $out );
+    }
+
+     /**
+      * get_template: get the template type of the bus_category
+      * @param mixed $type : 'cat' or 'list'
+      *
+      * @uses GLM_DB::db_auto_get_data()
+      * @uses GLM_TEMLATE::img_align()
+      * @uses GLM_TEMLATE::img_alternate()
+      * @uses GLM_TEMLATE::$template
+      *
+      * @return void
+      * @access public
+      **/
+    function get_template( $type )
+    {
+        $query = "select template from bus_category where id = ".$this->catid;
+        $data = $this->DB->db_auto_get_data( $query );
+        switch( $type )
+        {
+            case "cat":
+                switch( $data[0]['template'] )
+                {
+                    case "5":
+                    case "4":
+                    case "2":
+                        $this->img_align = "left";
+                    break;
+
+                    default:
+                        $this->img_align = "right";
+                        break;
+                }
+            break;
+
+            case "list":
+                switch( $data[0]['template'] )
+                {
+                    case "6":
+                    case "2":
+                        $this->img_align = "left";
+                        $this->img_alternate = 0;
+                    break;
+
+                    case "5":
+                    case "1":
+                        $this->img_align = "right";
+                        $this->img_alternate = 0;
+                    break;
+
+                    case "4":
+                        $this->img_align = "right";
+                        $this->img_alternate = 1;
+                    break;
+
+                    case "3":
+                        $this->img_align = "left";
+                        $this->img_alternate = 1;
+                    break;
+
+                    default:
+                        break;
+                }
+            break;
+        }
+        return( $this->template = $data[0]['template'] );
+    }
+    /**
+    * template_parser:This function creates data
+    * and items arrays and does the output for the page.
+    *
+    * @uses DELUXE_TOOLBOX
+    * @uses GLM_TEMPLATE::$items
+    * @uses GLM_TEMPLATE::get_template()
+    * @uses GLM_TEMPLATE::get_all()
+    * @uses GLM_TEMPLATE::load_static_page()
+    * @uses GLM_TEMPLATE::clean_text()
+    * @uses GLM_TEMPLATE::$item_files
+    *
+    * @return void
+    * @access public
+    **/
+    function get_listings()
+    {
+        // grab category and items into data and items respectfully
+        if( DELUXE_TOOLBOX )
+        {
+            $this->get_template( "list" );
+        }
+
+        if( !is_array( $this->items ) )
+        {
+            $this->get_all( 2 );
+        }
+
+        // load any static category page from the static directory
+        // hard codded content would have $catid.phtml page for it
+        $output .= $this->load_static_page();
+        switch($this->type)
+        {
+
+            default:
+            if(is_array($this->items))
+            {
+                foreach($this->items as $key=>$val)
+                {
+                    //$output .= '<div class="clearer"></div>';
+                    // items can be moved around as needed
+                    $output .= '<div class="listing">'."\n";
+                    $output .= $val["image"];
+                    $output .= $val["name"];
+                    $output .= $val["address"];
+                    $output .= $val["description"];
+                    $output .= $val["contactname"];
+                    $output .= $val["email"];
+                    $output .= $val["phone"];
+                    $output .= $val["fax"];
+                    $output .= $val["url"];
+                    if( is_array( $this->item_files[$val['id']] ) )
+                    {
+                        $output .= implode("",$this->item_files[$val['id']]);
+                    }
+                    $output .= "</div>"."\n";
+                }
+            }
+            break;
+        }
+        $output = GLM_TEMPLATE::clean_text($output);
+        return( $output );
+    }
+
+    /**
+    * sub_nav:Create a sub navigation 4 across
+    *
+    * @param integer $catid: The catid for the page
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access public
+    **/
+    function sub_nav($catid)
+    {
+        //$catid = $this->get_top_parent($catid);
+        $query1 = "SELECT category FROM bus_category WHERE id = $catid";
+        $data1 = $this->DB->db_auto_get_data( $query1 );
+        $out = '<div id="nav-sub">
+            <h3>'.htmlentities( strip_tags( $data1[0]['category'] ) ,ENT_QUOTES,'UTF-8').'</h3>';
+
+        $query = "SELECT id,category,intro FROM bus_category WHERE parent = $catid ".$this->active_query." ORDER BY pos";
+        $data = $this->DB->db_auto_get_data($query);
+        if(is_array($data))
+        {
+            $counter = 1;
+            foreach($data as $key=>$val)
+            {
+                $url = $this->get_seo_url( $val['id'] );
+                $title = strip_tags(addslashes($val['intro']));
+                //GLM_TEMPLATE::set_name_url( GLM_TEMPLATE::get_category_Name( $val['id'],"bus_category",$this->DB ) );
+                $out .=  '<a title="'.$title.'" href="'.$url.'">';
+                $out .= $val["category"];
+                $out .= '</a><br>';
+            }
+        }
+        $out .= '</div>';
+        return( $out );
+    }
+
+    /**
+    * get_home_events: get events flaged as home events
+    * @param object $DB: DB reference to DB obj
+    *
+    * @uses GLM_TEMPLATE::get_event_date()
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access public
+    **/
+    function get_home_events()
+    {
+        $query = "select id,header,descr,bdate,edate,img from event where home = 't' and visable='t' and edate >= current_date;";
+        $data = $this->DB->db_auto_get_data($query);
+        if(is_array($data))
+        {
+            $output = '<div id="events">UPCOMING EVENTS<div id="eventsbox">
+                    ';
+            foreach($data as $key=>$value)
+            {
+                $id = $value['id'];
+                $header = $value['header'];
+                $title = strip_tags(addslashes($header));
+                $descr = substr( strip_tags( addslashes( $value['descr'] ) ), 0, 50 );
+                $sdate = strtotime($value['bdate']);
+                $edate = strtotime($value['edate']);
+                $dates = GLM_TEMPLATE::get_event_date($sdate,$edate,"timestamp");
+                $output .= $dates;
+                $output .= '<h3><a title="" href="events.phtml?eventid='.$id.'">'.$header.'</a></h3>';
+            }
+            $output .= '</div></div>';
+            return($output);
+        }
+        else
+        {
+            return( '' );
+        }
+    }
+
+    /**
+    * get_event_date: make the event date human readable
+    * @param string $sdate: start date
+    * @param string $edate: end date
+    * @param string $dateType: dateType Postgres,etc
+    *
+    * @return string
+    * @access public
+    **/
+    function get_event_date($sdate,$edate,$dateType)
+    {
+        switch($dateType)
+        {
+            case "Postgres":
+            if(preg_match("/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/",$sdate,$spt))
+            {
+                $mon = $spt[1];
+                $day = $spt[2];
+                $yr = $spt[3];
+            }
+
+            if(preg_match("/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/",$edate,$ept))
+            {
+                $mon2 = $ept[1];
+                $day2 = $ept[2];
+                $yr2 = $ept[3];
+            }
+            break;
+
+            case "timestamp":
+            $mon = date("m",$sdate);
+            $day = date("d",$sdate);
+            $yr = date("Y",$sdate);
+            $mon2 = date("m",$edate);
+            $day2 = date("d",$edate);
+            $yr2 = date("Y",$edate);
+            break;
+
+        }$start = mktime(0,0,0,$mon,$day,$yr);
+        $end = mktime(0,0,0,$mon2,$day2,$yr2);
+        if ($day == $day2 && $mon == $mon2 && $yr == $yr2)
+        {
+            $dateparam = "F jS, Y";
+            $date_begin = date($dateparam, $start) ;
+            $date_end = "";
+        }
+        elseif ($day == $day2 AND $mon == $mon2 AND $yr != $yr2)
+        {
+            $dateparam1 = "F jS, Y -";
+            $dateparam2 = "Y";
+            $date_begin = date($dateparam1, $start);
+            $date_end = date($dateparam2, $end);
+        }
+        elseif ($day != $day2 AND $mon == $mon2 AND $yr == $yr2)
+        {
+            $dateparam1 = "F jS -";
+            $dateparam2 = "jS, Y";
+            $date_begin = date($dateparam1, $start);
+            $date_end = date($dateparam2, $end);
+        }
+        elseif ($day != $day2 AND $mon == $mon2 AND $yr != $yr2)
+        {
+            $dateparam1 = "F jS, Y -";
+            $dateparam2 = "F jS, Y";
+            $date_begin = date($dateparam1, $start);
+            $date_end = date($dateparam2, $end);
+        }
+        elseif ($yr == $yr2)
+        {
+            $dateparam1 = "F jS -";
+            $dateparam2 = "F jS, Y";
+            $date_begin = date($dateparam1, $start);
+            $date_end = date($dateparam2, $end);
+        }
+        else
+        {
+            $dateparam1 = "F jS, Y -";
+            $dateparam2 = "F jS, Y";
+            $date_begin = date($dateparam1, $start);
+            $date_end = date($dateparam2, $end);
+        }
+
+        return($date_begin." ".$date_end);
+    }
+
+    /**
+    * is_sub_id:Check to see if catid is sub of category
+    *
+    * @param integer $catid: the catid looking at
+    * @param integer $category: to see if it is in category
+    * @param object $DB: Db object reference
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return bool
+    * @access public
+    **/
+    function is_sub_id($catid,$category,&$DB)
+    {
+        if( !is_numeric( $catid ) )
+        {
+            return( false );
+        }
+        if($category==$catid)
+        {
+            return(true);
+        }
+        $query = "select id,parent from bus_category where id = $catid";
+        $data = $DB->db_auto_get_data($query);
+        $parent = $data[0]['parent'];
+        if($parent == 0)
+        {
+            return(false);
+        }
+        else
+        {
+            return( GLM_TEMPLATE::is_sub_id($parent,$category,&$DB) );
+        }
+    }
+
+    /**
+    * get_parent: get parent for this category
+    *
+    * @param integer $catid: id
+    * @param object $DB: database obj
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return int $parent
+    * @access public
+    **/
+    function get_parent($catid,&$DB)
+    {
+        $query = "SELECT parent FROM bus_category WHERE id = $catid ORDER BY pos";
+        $data = $DB->db_auto_get_data($query);
+        return( $data[0]["parent"] );
+    }
+
+    /**
+    * get_sub_nav:
+    * @param integer $catid:
+    * @param object $DB:
+    *
+    * @uses GLM_TEMPLATE::get_parent()
+    * @uses GLM_TEMPLATE::get_seo_url()
+    * @uses GLM_TEMPLATE::is_sub_id()
+    * @uses GLM_TEMPLATE::get_sub_nav()
+    * @uses GLM_TEMPLATE::has_subs()
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return  string
+    * @access  public
+    **/
+    function get_sub_nav($catid,&$DB)
+    {
+        $parentid = GLM_TEMPLATE::get_parent($catid,&$DB);
+        //echo $parentid.'<br>';
+        $query = "SELECT id,category,intro FROM bus_category WHERE parent = $parentid ".$this->active_query." ORDER BY pos";
+        $data = $DB->db_auto_get_data($query);
+        if(is_array($data))
+        {
+            $output = '<div id="subnav">';
+                $counter = 1;
+                foreach($data as $key=>$val)
+                {
+                    $url = $this->get_seo_url( $val['id'] );
+                    $title = strip_tags(addslashes($val['intro']));
+                    if(GLM_TEMPLATE::is_sub_id($catid,$parentid,&$DB) && (GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) || $val['id'] == $catid) )
+                    {
+                        $output .=  '<a title="'.$title.'" class="current" href="'.$url.'">';
+                    }
+                    else
+                    {
+                        $output .=  '<a title="'.$title.'" href="'.$url.'">';
+                    }
+                    $output .=  $val["category"];
+                    $output .=  '</a>';
+                    if( GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) && GLM_TEMPLATE::has_subs($val['id'],&$DB))
+                    {
+                        $output .= GLM_TEMPLATE::get_sub_nav($val["id"],&$DB,$catid);
+                    }
+                }
+                $output .= '</div>';
+            $output = GLM_TEMPLATE::clean_text($output);
+            echo $output;
+        }
+        return(false);
+    }
+
+    /**
+    * has_subs:
+    * @param integer $catid:
+    * @param object $DB:
+    *
+    * @uses GLM_TEMPLATE::$active_query
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return  string
+    * @access  public
+    **/
+    function has_subs($catid,&$DB)
+    {
+        $query = "SELECT id FROM bus_category WHERE parent = $catid ".$this->active_query." ORDER BY pos";
+        $data = $DB->db_auto_get_data($query);
+        if(is_array($data))
+        {
+            return(true);
+        }
+        else
+        {
+            return(false);
+        }
+    }
+
+
+    /**
+    * get_top_parent:Get the highest level parent id (not 0 )for the category.
+    *
+    *   <p><b>NOTICE:</b> This is ment to get the top level parent not the parent of the id given.</p>
+    *
+    * @param integer $id: The catid for the page.
+    * @param object $DB: obj
+    * @uses GLM_TEMPLATE::get_top_parent()
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return int $parent
+    * @access public
+    **/
+    function get_top_parent($id,&$DB)
+    {
+        if( $id == 0 )
+        {
+            return( 0 );
+        }
+        $qs = "select parent from bus_category where id = $id";
+        $parentrow = $DB->db_auto_get_data( $qs );
+        if($parentrow[0]['parent'] == 0)
+        {
+            return($id);
+        }
+        else
+        {
+            return( GLM_TEMPLATE::get_top_parent($parentrow[0]['parent'],&$DB) );
+        }
+    }
+
+    /**
+     * get_main_cats
+     *
+     * @access public
+     * @return string
+     */
+    function get_main_cats()
+    {
+        static $main_cats_array;
+        if( !is_array( $main_cats_array ) )
+        {
+            $query = "select id,category from bus_category where parent = 0 order by pos;";
+            if( $data = $this->DB->db_auto_get_data( $query ) )
+            {
+                foreach( $data as $row )
+                {
+                    $main_cats_array[$row['id']] = htmlentities(strip_tags($row['category']),ENT_QUOTES,'UTF-8');
+                }
+            }
+        }
+        return( $main_cats_array );
+    }
+    /**
+    * show_catimg:output the category image.
+    *
+    * @param integer $catid: The catid for the page.
+    * @uses GLM_TEMPLATE::MIDSIZED
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access  public
+    **/
+    function show_catimg($catid)
+    {
+        $query = "SELECT image FROM bus_category WHERE id = $catid";
+        $data = $this->DB->db_auto_get_data($query);
+        if($data[0]["image"]!="")
+        {
+            $img = '<img src="'.MIDSIZED.$data[0]["image"].'" border="0" vspace="30" hspace="0">';
+        }
+        else
+        {
+            $img = '<img src="assets/logo_small.gif" width="150" height="85" vspace="0" hspace="0" border="0" alt="Birchwood Construction"><BR>';
+        }
+        echo $img;
+        echo '<BR><img src="assets/clear.gif" height="30" width="1">';
+    }
+
+
+    /**
+    * get_catheader:output the category name.
+    *
+    * @param integer $catid: The catid for the page
+    * @param object $DB: db obj
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access  public
+    **/
+    function get_catheader($catid,$DB)
+    {
+        $query = "SELECT category FROM bus_category WHERE id = $catid";
+        $data = $DB->db_auto_get_data($query);
+        if($data[0]['category']!="")
+        {
+            $header = strip_tags($data[0]['category']);
+        }
+        else
+        {
+            $header = '';
+        }
+        return( $header );
+    }
+
+        /**
+    * get_catintro: return the category page name.
+    *
+    * @param integer $catid: The catid for the page
+    * @param object $DB: db obj
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access  public
+    **/
+    function get_catintro($catid)
+    {
+        $query = "SELECT intro FROM bus_category WHERE id = $catid";
+        $data = $this->DB->db_auto_get_data($query);
+        if($data[0]['intro']!="")
+        {
+            $header = strip_tags($data[0]['intro']);
+        }
+        else
+        {
+            $header = '';
+        }
+        return( $header );
+    }
+
+    /**
+    * show_catheader:
+    *
+    * @param integer $catid:
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return  string
+    * @access  public
+    **/
+    function show_catheader($catid)
+    {
+        $query = "SELECT category FROM bus_category WHERE id = $catid";
+        $data = $this->DB->db_auto_get_data($query);
+        if($data[0][category]!="")
+        {
+            $header = $data[0][category];
+        }
+        else
+        {
+            $header = '&nbsp;';
+        }
+        echo $header;
+    }
+
+    /**
+    * get_menu_string:get categories for the phplayermenu
+    *
+    * @uses GLM_TEMPLATE::sort_childs()
+    * @uses GLM_TEMPLATE::convert_to_thread()
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return string
+    * @access  public
+    **/
+    function get_menu_string()
+    {
+        $query = "SELECT id,parent,category FROM bus_category WHERE id != 0 ".$this->active_query." ORDER BY parent,pos";
+        $data = $this->DB->db_auto_get_data($query);
+        $newdata = GLM_TEMPLATE::sort_childs($data);
+        $string = GLM_TEMPLATE::convert_to_thread($newdata,$newdata[0]);
+        return($string);
+    }
+
+
+    /**
+     * get_menu_array: like get_menu_string but returns an array
+     *
+     * @uses GLM_TEMPLATE::sort_childs()
+    * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return  string
+     * @access  public
+     **/
+    function get_menu_array()
+    {
+        $query = "SELECT id,parent,category FROM bus_category WHERE id != 0 ".$this->active_query." ORDER BY parent,pos";
+        $data = $this->DB->db_auto_get_data($query);
+        $newdata = GLM_TEMPLATE::sort_childs($data);
+        return $newdata;
+    }
+
+    /**
+    * sort_childs:
+    * @param array $threads:
+    *
+    * @return  string
+    * @access  public
+    **/
+    function sort_childs($threads)
+    {
+        foreach($threads as $var=>$value)
+        {
+            $childs[$value["parent"]][$value["id"]] = $value;
+        }
+        return($childs);
+    }
+
+    /**
+    * convert_to_thread:
+    *
+    * @param array $threads:
+    * @param array $thread:
+    * @uses GLM_TEMPLATE::$thread_count
+    * @uses GLM_TEMPLATE::$whole_thread
+    * @uses GLM_TEMPLATE::get_seo_url()
+    * @uses GLM_TEMPLATE::convert_to_thread()
+    *
+    * @return string
+    * @access public
+    **/
+    function convert_to_thread($threads, $thread)
+    {
+        foreach($thread as $parent=>$value)
+        {
+            $this->whole_thread .= str_repeat(".",$this->thread_count);
+            $this->whole_thread .= "|".htmlentities($value['category'],ENT_QUOTES,'UTF-8');
+            $url = $this->get_seo_url( $value['id'] );
+            $this->whole_thread .= "|".$url;
+            $this->whole_thread .="\n";
+            if($threads[$parent])
+            {
+                $this->thread_count++;
+                GLM_TEMPLATE::convert_to_thread($threads, $threads[$parent]);
+            }
+        }
+        $this->thread_count--;
+        return $this->whole_thread;
+    }
+
+
+    /**
+     * has_children: return true or false if this category has sub categories under it.
+     *
+     * @param integer $catid:
+     * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return  string
+     * @access  public
+     **/
+    function has_children($catid)
+    {
+        // returns number of children that $catid has
+        $qs="SELECT count(*) FROM bus_category WHERE parent=$catid ".$this->active_query."";
+        $row=$this->DB->db_auto_get_data($qs);
+        return $row[0]['count'];
+    }
+
+    /**
+    * get_ancestors:get the ancestors for this category
+    *
+    * @param integer $catid: catid
+    * @param integer $count: starting counter
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return array
+    * @access  public
+    **/
+    function get_ancestors($catid,$count)
+    {
+        if( $count == 0 )
+        {
+            unset( $this->ancestors );
+        }
+        if($catid)
+        {
+            $query = "SELECT    id,category,parent
+            FROM    bus_category
+            WHERE   id = ".$catid."
+            ".$this->active_query;
+            $res = $this->DB->db_auto_get_data($query);
+            $id = $res[0]['id'];
+            $parent = $res[0]['parent'];
+            $category = $res[0]['category'];
+            $this->ancestors[$count]['id'] = $id;
+            $this->ancestors[$count]['label'] = $category;
+
+            $url = $this->get_seo_url( $id );
+            $this->ancestors[$count]['link'] = $url;
+            GLM_TEMPLATE::get_ancestors($parent,$count+1,$conn);
+
+            return (array_reverse($this->ancestors) );
+        }
+    }
+
+     /**
+     * meta_tags: create the meta description content for this page.
+     * this is taken from the category description.
+     * this should be only done for all but the home page.
+     * $meta = ( $catid != 1 ) ? $toolbox->meta_tags() : '';
+     *
+     * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return  string
+     * @access  public
+     **/
+    function meta_tags()
+    {
+        $query = "select description from bus_category where id = ".$this->catid;
+        $data = $this->DB->db_auto_get_data( $query );
+        $description = htmlentities( substr( trim( strip_tags( $data[0]['description'] ) ), 0, 250 ),ENT_QUOTES,'UTF-8' );
+        return( $description );
+    }
+
+     /**
+     * title: create the title for the page.
+     * this should be only done for all but the home page.
+     * $title = ( $catid != 1 ) ? $toolbox->title() : '';
+     *
+     * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return  string
+     * @access public
+     **/
+    function title()
+    {
+        $query = "select category,intro from bus_category where id = ".$this->catid;
+        $data = $this->DB->db_auto_get_data( $query );
+        if( $data[0]['intro'] )
+        {
+            $title = strip_tags( $data[0]['intro'] );
+        }
+        else
+        {
+            $title = strip_tags( $data[0]['category'] );
+        }
+        return( htmlentities( $title.' - ',ENT_QUOTES,'UTF-8' ) );
+    }
+
+    /**
+     * get_bottom_nav: generate a top level only bottom navigation for the pages.
+     *
+     * @param integer $parent=0:
+     * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return  string
+     * @access public
+     **/
+    function get_bottom_nav($parent=0)
+    {
+        $out = '';
+        $query = "select id,category,intro from bus_category where id != 1 and parent = $parent ".$this->active_query." order by pos asc";
+        $row = $this->DB->db_auto_get_data( $query );
+        $url = $this->get_seo_url( HOME_ID );
+        $links[] = '<a href="'.$url.'">Home</a>';
+        if( !is_array( $row ) )
+        {
+            return( false );
+        }
+        else
+        {
+            $out .= '<div id="nav-bottom">';
+            for( $i=0; $i<sizeof( $row ); $i++)
+            {
+                $category = htmlentities(strip_tags($row[$i]['category']),ENT_QUOTES,'UTF-8');
+                $url = $this->get_seo_url( $row[$i]['id'] );
+                $links[] = '<a href="'.$url.'">'.$category."</a>\n";
+            }
+            if( is_array( $links) )
+            {
+                $out .= implode(" | ",$links);
+            }
+            $out .= '</div>';
+            return( $out );
+        }
+    }
+
+
+    /**
+     * make_ul_menu: create url list of categories
+     *
+     * @param integer $parent parent to start from
+     * @uses GLM_DB::db_auto_get_data()
+     *
+     * @return string
+     * @access public
+     **/
+    function make_ul_menu( $parent = 0 )
+    {
+        $qs = "SELECT id,category,intro FROM bus_category WHERE parent = $parent ".$this->active_query." ORDER BY pos";
+        $data = $this->DB->db_auto_get_data($qs);
+        if(!is_array($data))
+        {
+            return( false );
+        }
+        else
+        {
+            foreach( $data as $key => $row )
+            {
+                $url = $this->get_seo_url( $row['id'] );
+                $title = strip_tags(addslashes($row['intro']));
+                $return.='
+                <li><a title="'.htmlentities($title,ENT_QUOTES,'UTF-8').'" href="'.$url.'"';
+                if( $this->catid == $row['id'] )
+                {
+                    $return .= ' id="current"';
+                }
+                $return .= '>'.htmlentities($row['category'],ENT_QUOTES,'UTF-8')."</a>";
+                if( $this->has_subs( $row['id'], &$this->DB ) && ( $this->is_sub_id( $this->catid, $row['id'], &$this->DB )  || $this->catid == $row['id'] ) )
+                {
+                        $ret2 = $this->make_ul_menu( $row['id'] );
+                        $return.=$ret2;
+                }
+                $return.="
+                </li>";
+            }
+            $main_cats = $this->get_main_cats();
+            if( $main_cats[$parent] )
+            {
+                $return = '<div id="subnav">
+                <div id="subnav-header">'.$this->get_catheader( $parent ,&$this->DB ).'</div>
+                <ul id="navlist">'.$return.'</ul>
+                </div>
+                ';
+                return( $return );
+            }
+            else
+            {
+                $return = '
+                <ul>'.$return.'</ul>
+                ';
+                return( $return );
+            }
+        }
+    }
+
+    /**
+    * print_ancestors:print out the ancestors
+    * @param integer $catid: the id to start at.
+    *
+    * @return string
+    * @access public
+    **/
+    function print_ancestors($catid)
+    {
+        return( $this->get_bread_crumbs( $catid ) );
+    }
+
+    /**
+     * get_bread_crumbs
+     *
+     * @param mixed $catid
+     * @access public
+     * @return string
+     */
+    function get_bread_crumbs( $catid )
+    {
+        $string = $this->get_ancestors( $catid, 0 );
+        if(is_array($string))
+        {
+            $end = count( $string ) - 1;
+            for($i=0;$i<$end;$i++)
+            {
+                $outarray[] = '<a href="'.$string[$i]["link"].'">'.$string[$i]["label"].'</a>';
+            }
+            $outarray[] = $this->get_catheader( $catid, &$this->DB );
+            if( is_array( $outarray ) && count( $outarray ) > 1 )
+            {
+                $out .= implode( " &#187; ", $outarray );
+            }
+            if( $out )
+            {
+                $return = '<div id="breadcrumbs">'.$out.'</div>';
+            }
+        }
+        return( $return );
+    }
+
+    /**
+    * build_picklist:
+    * @param string $fieldname:
+    * @param array $data:
+    * @param mixed $selected:
+    * @param string $type = "standard":
+    * @param boolean $auto = 0:
+    * @param integer $width = NULL :
+    *
+    * @uses GLM_TOOLBOX::build_picklist()
+    *
+    * @return string
+    * @access  public
+    **/
+    function build_picklist( $fieldname, $data, $selected, $type = "standard",$auto = 0,$width = NULL )
+    {
+        return( GLM_TOOLBOX::build_picklist( $fieldname, $data, $selected, $type = "standard",$auto = 0,$width = NULL ) );
+    }
+
+    /**
+    * keyword_replace:
+    *
+    * @param string $string:
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return string
+    * @access public
+    **/
+    function keyword_replace($string)
+    {
+        //return($string);
+        if($search = strstr($string,"{"))
+        {
+            if(preg_match("/\{([A-Z0-9\&\-\,\'\" ]*)\}/i",$string,$needle))
+            {
+                if($needle[0] != "")
+                {
+                    $qs = "SELECT   id,category
+                    FROM        bus_category
+                    WHERE   trim(keyword) = '".trim($needle[1])."'";
+
+                    $keyres = $this->DB->db_auto_get_data($qs);
+                    $parent = $this->get_top_parent($keyres[0]['id'],&$this->DB);
+                    $url = $this->get_seo_url( $keyres[0]['id'] );
+                    $replacement = "<a href=\"".$url."\">".htmlspecialchars($keyres[0]['category'])."</a>";
+                    $string = str_replace($needle[0],$replacement,$string);
+                }
+            }
+            else{
+                return($string);
+            }
+            if($search = strstr($string,"{"))
+            return($this->keyword_replace($string));
+        }
+        return($string);
+    }
+    /**
+    * getIdFromName:
+    *
+    * @param string $name:
+    * @param string $table:
+    * @param object $DB:
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @deprecated Don't use this!  THIS IS A WARNING (this funcion will be gone next time)
+    * @return string
+    * @access  public
+    **/
+    function get_id_from_name( $name, $table, &$DB)
+    {
+        if( $name == "" )
+        {
+            return( 0 );
+        }
+        if( is_numeric( $name ) )
+        {
+            return( $name );
+        }
+        if( preg_match("/(.*)/$/",$name,$tmp) )
+        {
+            $name = $tmp[1];
+        }
+        $category = "category";
+        if( preg_match("/-([0-9]*)$/",$name,$tmp ) )
+        {
+            $id = $tmp[1];
+            return( $id );
+        }
+        // should already be returning id at this point
+        // putting the _id on the end of all url's as
+        // the other way is very inifiecent for the database.
+        $name = str_replace( "-"," ",$name );
+        $query = "select id from $table where trim(lower(replace(replace(replace(replace(replace(replace($category,'\'',''),'/',''),'-',' '),'#',''),'&',''),'?',''))) = '".trim(strtolower($name))."'";
+        $data = $DB->db_auto_get_data( $query );
+        if( is_array( $data ) )
+        {
+            foreach( $data as $key=>$val )
+            {
+                $catid = $val['id'];
+            }
+            return( $catid );
+        }
+        else
+        {
+            return( 0 );
+        }
+    }
+
+    /**
+     * get_base_url: generate the base of the url for the given category id
+     * @param integer $id :
      *
-        * We should be using the $_POST or $_GET globals here
-        * 
-        * @return int catid 
-        * @access public 
-        **/
-       function get_catid( $catid )
-       {
-               if( is_numeric( $_GET['catid'] ) )
-               {
-                       return( $_GET['catid'] );
-               }
-               elseif( is_numeric( $_POST['catid'] ) )
-               {
-                       return( $_POST['catid'] );
-               }
-               else
-               {
-                       return( $this->catid = $catid );
-               }
-       }
-
-       /**
-       * set_contact:Set the contact string
-       * <code><p><strong>Contact Name:</strong>&nbsp;{$text}</p></code>
-       * 
-       * @param string $text: The text as string
-       * @param string $email: email if givin 
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_contact( $text, $email )
-       {
-               if( $email != "" )
-               {
-                       $text = "";
-               }
-               else
-               {
-                       $text = '<p><strong>Contact Name:</strong>&nbsp;'.$text.'</p>';
-               }
-               return($text);
-       }
-
-       /**
-       * set_text:Set the contact string
-       * <code><p>{$text}</code>
-       * @param string $text: The text as string
-       * 
-       * @return string $text
-       * @access public 
-       **/
-       function set_text( $text )
-       {
-               if("" == str_replace("<br />","",trim($text)))
-               {
-                       return(false);
-               }
-               if( $text != "" )
-               {
-                       $text = $this->keyword_replace( $text );
-                       $text = $text;
-               }
-               return($text);
-       }
-
-       /**
-        * get_image_path: get image path from the size used
-        * 
-        * @uses MIDSIZED_PATH 
-        * @uses RESIZED_PATH 
-        * @uses THUMB_PATH 
-        *
-        * @return path for images
-        * @access public
-        **/
-       function get_image_path()
-       {
-               if( strstr($this->img_size,'midsized/') )
-               {
-                       return( MIDSIZED_PATH );
-               }
-               if( strstr($this->img_size,'resized/') )
-               {
-                       return( RESIZED_PATH );
-               }
-               if( strstr($this->img_size,'thumb/') )
-               {
-                       return( THUMB_PATH );
-               }
-       }
-       
-       /**
-       * set_img:Set the image string
-       * <p><code>
-       * <div class="image{$align}" style="width: {$width}px" src="{$size}{$image}" {$titletag}>
-       * <div class="imagecaption">{$caption}</div>
-       * </div>
-       * </code>
-       * </p>
-       *
-       * @param string $image: The image
-       * @param string $size: The path
-       * @param string $align: The alignment
-       * @param string $name: The image_name (displayed under image)
-       * @param string $alt_title text for use in alt and title tags
-       * @param string $caption Text for image caption if given 
-       * @uses GLM_TEMPLATE::get_image_path()
-       * 
-       * @return void
-       * @access public 
-       **/
-       function set_img( $image, $size, $align, $alt_title = NULL, $caption = NULL )
-       {
-               if( $image != "" )
-               {
-                       if( $caption != '' )
-                       {
-                               $caption = str_replace('&amp;','&',$caption);
-                               $titletag = 'title="'.htmlspecialchars(strip_tags($caption)).'"';
-                               $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
-                       }
-                       elseif( $alt_title != '')
-                       {
-                               $alt_title = str_replace('&amp;','&',$alt_title);
-                               $titletag = 'title="'.htmlspecialchars(strip_tags($alt_title)).'"';
-                               $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
-                       }
-                       else
-                       {
-                               $titletag = 'title="'.htmlspecialchars(strip_tags($image)).'"';
-                               $titletag .= ' alt="'.htmlspecialchars(strip_tags($image)).'"';
-                       }
-                       if( $align != "" )
-                       {
-                               $img_align = 'class="image'.$align.'"';
-                       }
-                       $path = $this->get_image_path();
-                       if( is_file( $path.$image ) )
-                       {
-                               $image_size = getimagesize( $path.$image );
-                               $img_attr = $image_size[3];
-                       }
-                       $img = '
-                       <div '.$img_align.' style="width: '.$image_size[0].'px">        
-                               ';
-                       $img .= '<img '.$img_attr.' src="'.$size.$image.'" '.$titletag.'>';
-                       if( $caption )
-                       {
-                               $img .= '
-                               <div class="imagecaption">'.$caption.'</div>    
-                                       ';
-                       }
-                       $img .= '</div>
-                               ';
-                       return($img);
-               }
-       }
-
-       /**
-       * set_url:Set the url string
-       * <p>
-       * <code><p><a href="http://{$url}" target="_blank">{$text}</a></code>
-       * </p>
-       *
-       * @param string $url: The url
-       * @param string $text: The text as string
-       * 
-       * @return string $text
-       * @access public 
-       **/
-       function set_url( $url, $text )
-       {
-               if( $url != "" )
-               {
-                       if( !$text )
-                       {
-                               $text = $url;
-                       }
-                       if( strtolower( substr( $url, 0, 7 ) ) == "https://" )
-                       {
-                               $url = '<p><a href="'.$url.'" target="_blank">'.htmlspecialchars($text).'</a></p>';
-                       }
-                       else
-                       {
-                               $url = '<p><a href="http://'.$url.'" target="_blank">'.htmlspecialchars($text).'</a></p>';
-                       }
-               }
-               return( $url ); 
-       }
-
-       /**
-       * set_email:Set the email string
-       * <code><p><strong>Contact:</strong>&nbsp;&nbsp;<a href="mailto:{$email}" target="_blank">{$text}</a></p></code>
-       * @param string $email: The email as string
-       * @param string $contact: The contactname this is used as the link text
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_email( $email, $contact )
-       {
-               if( $email != "" )
-               {
-                       if( $contact != "" )
-                       {
-                               $email = '<p><strong>Contact:</strong>&nbsp;&nbsp;<a href="mailto:'.$email.'" target="_blank">'.htmlspecialchars($contact).'</a></p>';
-                       }
-                       else
-                       {
-                               $email = '<p><strong>Email:</strong>&nbsp;&nbsp;<a href="mailto:'.$email.'" target="_blank">'.htmlspecialchars($email).'</a></p>';
-                       }
-               }
-               return( $email );       
-       }
-
-       /**
-       * set_header:Set the header string
-       * @param string $text: The text as string
-       * @uses GLM_TEMPLATE::header_begin()
-       * @uses GLM_TEMPLATE::header_end()
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_header( $text )
-       {
-               if( $text != "" )
-               {
-                       $text = $this->header_begin.htmlspecialchars($text).$this->header_end;  
-               }
-               return( $text );
-       }
-
-       /**
-       * set_subheader:Set the subheader string
-       * @param string $text: The text as string
-       * @uses GLM_TEMPLATE::subheader_begin()
-       * @uses GLM_TEMPLATE::subheader_end()
-       *
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_subheader( $text )
-       {
-               if( $text != "" )
-               {
-                       $text = $this->subheader_begin.htmlspecialchars($text).$this->subheader_end;    
-               }
-               return( $text );
-       }
-
-       /**
-       * set_phone:Set the phone string
-       * <code><p><strong>Phone:</strong>&nbsp;&nbsp;{$text}</p></code>
-       * @param string $text: The text as string
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_phone( $text )
-       {
-               if( $text != "" )
-               {
-                       $text = '<p><strong>Phone:</strong>&nbsp;&nbsp;'.$text.'</p>';  
-               }
-               return( $text );
-       }
-
-       /**
-       * set_fax:Set the fax string
-       * <code><p><strong>Fax:</strong>&nbsp;&nbsp;{$text}</p></code>
-       * @param string $text: The text as string
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_fax( $text )
-       {
-               if( $text != "" )
-               {
-                       $text = '<p><strong>Fax:</strong>&nbsp;&nbsp;'.htmlspecialchars($text).'</p>';  
-               }
-               return( $text );
-       }
-
-       /**
-       * set_file:Set the file string
-       * <code><p><strong>Contact Name:</strong>&nbsp;{$text}</p></code>
-       * @param string $text: The text as string
-       * @param string $name: The file name displayed
-       * @uses URL_BASE
-       * 
-       * @return string $text 
-       * @access public 
-       **/
-       function set_file( $text, $name )
-       {
-               if( $text != "" )
-               {       
-                       $outtext = '<p><a';
-                       if(preg_match("/[.]([A-Z0-9]{3}$)/i",$text,$tmp))
-                       {
-                               $outtext .= ' class="'.strtolower($tmp[1]).'"';
-                       }
-                       $outtext .= ' href="'.URL_BASE.'uploads/'.$text.'" target="_blank">';
-                       if($name)
-                       {
-                               $outtext .= htmlspecialchars($name);
-                       }
-                       else
-                       {
-                               $outtext .= htmlspecialchars($text);
-                       }
-                       $outtext .= '</a>';
-                       if(preg_match("/[.]([A-Z0-9]{3}$)/i",$text,$tmp))
-                       {
-                               $outtext .= '<a href="'.BASE_URL.'download.php?file='.$text.'" class="download">Click here to Download&nbsp;</a>';
-                       }
-                       $outtext .= '</p>';
-               }
-               return( $outtext );
-       }
-
-       /**
-       * set_address:set_address
-       * <code><p>{$address}<br>{$city},{$state} {$zip}</p></code>
-       * @param array $data: data contain the address info for display.
-       * 
-       * @return string $address
-       * @access public 
-       **/
-       function set_address( $data )
-       {
-               $address = "";
-               if( $data["address"] )
-               {
-                       $address .= $data["address"];
-               }
-               if( $data["city"] && $data["state"] && $data["zip"] )
-               {
-                       $address .= '<br>'.$data["city"].', '.$data["state"].' '.$data["zip"];
-               }       
-               elseif( $data["city"] && $data["state"] )
-               {
-                       $address .= '<br>'.$data["city"].', '.$data["state"];
-               }
-               elseif( $data["city"] )
-               {
-                       $address .= '<br>'.$data["city"];
-               }
-               if( $address != "" )
-               {
-                       return( '<p>'.$address.'<br></p>' );
-               }
-       }
-
-       /**
-       * get_all:Does the query and set_data calls boths arrays
-       * 
-       * @uses GLM_TEMPLATE::set_data()
-       * @uses GLM_TEMPLATE::$data
-       * @uses GLM_TEMPLATE::$items
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void
-       * @access public 
-       **/
-       function get_all( $type = NULL )
-       {
-               $catid = $this->catid; 
-               if( $type == 1 || !$type )
-               {
-                       $cat_query = "select * from bus_category where id = $catid order by pos";  
-                       $res = $this->set_data( $this->DB->db_auto_get_data( $cat_query ) );
-                       $this->data = $res[0];
-               }
-               if( $type == 2 || !$type )
-               {
-                       $item_query = "select b.* from bus b left outer join bus_category_bus bcb on (bcb.busid = b.id) where bcb.catid = $catid order by bcb.pos";
-                       $this->items = $this->set_data( $this->DB->db_auto_get_data( $item_query ) );
-                       $file_query = "select * from files where bus_id in ( select bus_id from bus_category_bus where catid = ".$this->catid." ) order by bus_id,pos;";
-                       if( $file_data = $this->DB->db_auto_get_data( $file_query ) )
-                       {
-                               foreach( $file_data as $file_row )
-                               {
-                                       $this->item_files[$file_row['bus_id']][] = GLM_TEMPLATE::set_file( $file_row['filename'],$file_row['urltext'] );
-                               }
-                       }
-               }
-       }
-
-       /**
-       * call all class methods to set tho data elements
-       *
-       * <p>This is hightly dependant on the three tables of bus bus_category and bus_category_bus 
-       * set_data:Calls each function of the class
-       * based on the key af the array $data[0][$key]</p>
-       * @todo Really need to look at enhancing this function for different datasetups. 
-       * @param array $data: The input array from db query
-       * @uses GLM_TEMPLATE::$img_size
-       * @uses GLM_TEMPLATE::$img_align
-       * @uses GLM_TEMPLATE::$img_alternate
-       * @uses GLM_TEMPLATE::set_text()
-       * @uses GLM_TEMPLATE::set_header()
-       * @uses GLM_TEMPLATE::set_subheader()
-       * @uses GLM_TEMPLATE::set_url()
-       * @uses GLM_TEMPLATE::set_address()
-       * @uses GLM_TEMPLATE::set_img()
-       * @uses GLM_TEMPLATE::set_email()
-       * @uses GLM_TEMPLATE::set_phone()
-       * 
-       * @return array data The finished array
-       * @access  public
-       **/
-       function set_data( $data )
-       {
-               if( is_array( $data ) )
-               {
-                       foreach( $data as $k => $val )
-                       {
-                               foreach( $val as $key => $value )
-                               {
-                                       if( strstr( $key, "image" ) && !strstr( $key, "name") && $value != "" )
-                                       {
-                                               $titletag = ( $data[$k]['category'] ) ? $data[$k]['category'] : $data[$k]['name'];
-                                               //$data[$k][$key."_name"] = $value;
-                                               $data[$k][$key] = $this->set_img( $value, $this->img_size, $this->img_align, $titletag, $data[$k][$key."name"] );
-                                               if( !strstr( $key, "name" ) )
-                                               {
-                                                       if( $this->img_align == "right" && $this->img_alternate )
-                                                       {
-                                                               $this->img_align = "left";
-                                                       }
-                                                       elseif( $this->img_alternate )
-                                                       {
-                                                               $this->img_align = "right";
-                                                       }
-                                               }
-                                       }
-                                       elseif( strstr($key,"file") && strstr($key,"name") && $value!="" )
-                                       {
-                                       }
-                                       elseif( strstr($key,"url") && strstr($key,"name") && $value!="" )
-                                       {
-                                       }       
-                                       elseif( strstr($key,"descr") && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_text( $value );
-                                       }
-                                       elseif( $key == "contactname" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_contact( $value, $data[$k]['email'] );
-                                       }
-                                       elseif($key == "name" && $value!="")
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_subheader( $value );
-                                       }
-                                       elseif( strstr( $key, "header" ) && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_subheader( $value );
-                                       }
-                                       elseif( $key == "intro" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_header( $value );
-                                       }
-                                       elseif( $key == "category" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_header( $value );
-                                       }
-                                       elseif( $key == "url" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_url( $value, $data[$k]["urlname"] );
-                                       }
-                                       elseif( $key == "email" && $value!="")
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_email( $value, $data[$k]["contactname"] );
-                                       }
-                                       elseif( $key == "phone" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_phone($value);
-                                       }
-                                       elseif( $key == "fax" && $value != "" )
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_fax( $value );
-                                       }
-                                       elseif (strstr( $key, "file" ) && $value!="")
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_file( $value, $data[$k][$key.'name'] );
-                                       }
-                                       elseif( $key == "address" )
-                                       {
-                                               $data[$k][$key] =  GLM_TEMPLATE::set_address( $data[$k] );
-                                       }
-                                       elseif( $key == "id" )
-                                       {
-                                               $data[$k][$key] = $value;
-                                       }
-                                       else
-                                       {
-                                               $data[$k][$key] = GLM_TEMPLATE::set_text( $value );
-                                       }
-                               }
-                       }       
-                       return( $data );
-               }       
-               return( false );
-       }
-
-       /**
-       * load_static_page:using object buffer include the page $catid.phtml from static dir
-       and return it as string
-       * 
-       * @return string $text 
-       * @access  public
-       **/
-       function load_static_page()
-       {
-               if( file_exists( BASE."static/".$this->catid.".phtml" ) )
-               {
-                       ob_start();
-                       include("static/".$this->catid.".phtml");
-                       $text = ob_get_contents();
-                       ob_end_clean();
-                       return($text);
-               }
-       }
-
-       /**
-       * clean_text:get rid of single br or p br tags left from htmlarea when textarea is empty.
-       * @param string $output: 
-       * 
-       * @return string text cleaned
-       * @access  public
-       **/
-       function clean_text($output)
-       {
-               $output = str_replace("<br />","<br>",$output);
-               $output = str_replace("<p><br></p>","",$output);
-               return($output);
-       }
-
-       /**
-       * get_category: grab just category contents
-       * @param integer $catid: id of bus_category
-       * @param object $DB: 
-       * @param boolean $showimg=1: weather or not to show category image
-       * @uses DELUXE_TOOLBOX
-       * @uses HOME_PAGE_EVENTS
-       * @uses GLM_TEMPLATE::clean_text()
-       * @uses GLM_TEMPLATE::get_home_events()
-       * 
-       * @return string $output
-       * @access public
-       **/
-       function get_category( $showimg = 1,$showdiv=1 )
-       {
-               if( DELUXE_TOOLBOX )
-               {
-                       $this->get_template( "cat" );
-               }
-                       
-               if( !$this->data )
-               {
-                       $this->get_all( 1 );
-               }
-               $data = $this->data;
-               if( !$data["image"] && !$data["description"] && !$data["intro"] && ( $this->catid != 1 && HOME_PAGE_EVENTS != true ) )
-               {
-                       return( false );
-               }
-               if($showdiv==1)
-               {
-                       $output .= '<div id="category">
-                               ';
-               }
-               if( $this->catid == 1 && HOME_PAGE_EVENTS )
-               {
-                       $output .= $this->get_home_events();
-               }
-               if($data["image"] || $data["description"] || $data["intro"] )
-               {
-                       if($showimg == 1)
-                       {
-                               $output .=$data["image"]." ";
-                       }
-                       $output .=$data["intro"]." ";
-                       $output .=$data["description"]." ";
-               }
-               if($showdiv==1)
-               {
-                       $output .= '</div>
-               ';
-               }
-               $output = GLM_TEMPLATE::clean_text($output);
-               return( $output );
-
-       }
-
-       /**
-        * photo_module 
-        * Load the photo gallery into page 
-        * 
-        * @access public
-        * @return string
-        */
-       function photo_module()
-       {
-               $query = "select photocat_id from photo_category_bus where buscat_id = $this->catid;";
-               if( $pData = $this->DB->db_auto_get_data( $query ) )
-               {
-                       if( count( $pData ) > 1 )
-                       {
-                               foreach( $pData as $pKey => $pVal )
-                               {
-                                       $photocatid[] = $pVal['photocat_id'];
-                               }
-                       }
-                       else
-                       {
-                               $photocatid = $pData[0]['photocat_id'];
-                       }
-                       if( is_numeric( $photocatid ) || is_array( $photocatid ) )
-                       {
-                               if( !$_GET['photo_catid'] )
-                               {
-                                       $_GET['photo_catid'] = $photocatid;
-                               }
-                               ob_start();
-                               include_once(BASE.'static/photo.php');
-                               $out .= ob_get_contents();
-                               ob_end_clean();
-                       }
-               }
-               return( $out );
-       }
-
-       /**
-        * get_page: replacing template_parser with get_page function
-        *
-        * @uses GLM_TEMPLATE::get_category() For building the main page section
-        * @uses GLM_TEMPLATE::get_listings() For building out the paragraph sections
-        * 
-        * @return  string $out NEED to echo results of this function 
-        * @access  public
-        **/
-       function get_page( $showimg = 1,$showdiv=1 )
-       {
-               if( $this->page_status != 'Good' )
-               {
-                       return('<h1>Sorry this page is temporary Taken Down!</h1>');
-               }
-               if( GOOGLE_SEARCH && ( $_POST['Query'] || $_GET['Query'] ) )            // for the gogle search engine api 
-               {                                                                                               // if Query is sent display search results
-                       ini_set('include_path', BASE.'google' . ':' .ini_get('include_path'));
-                       ob_start();
-                       include_once(GOOGLE."search.php");
-                       include_once(GOOGLE."results.php");
-
-                       echo SearchResults();
-                       $out = '<div id="toolbox">'.ob_get_contents().'</div>';
-                       ob_end_clean();
-               }
-               elseif(MEMBERS_DB && $this->Member->member_sections[$this->catid] )
-               {
-                       if( !$_GET['id'] )
-                       {
-                               $out .= '<div id="toolbox">'.$this->get_category( $showimg,$showdiv );
-                               $out .= $this->get_listings().'</div>';
-                       }
-                       ob_start();
-                       $out .= $this->Member->get_list();
-                       $out .= ob_get_contents();
-                       ob_end_clean();
-               }
-               else
-               {
-                       $out .= '<div id="toolbox">'.$this->get_category( $showimg,$showdiv );
-                       $out .= $this->get_listings().'</div>';
-               if( PHOTO_GALLERY )
-               {
-                               $out .= $this->photo_module();
-                       }
-               }
-               return( $out );
-       }
-
-        /**
-         * get_template: get the template type of the bus_category
-         * @param mixed $type : 'cat' or 'list' 
-         * 
-         * @uses GLM_DB::db_auto_get_data()
-         * @uses GLM_TEMLATE::img_align()
-         * @uses GLM_TEMLATE::img_alternate()
-         * @uses GLM_TEMLATE::$template
-         * 
-         * @return void 
-         * @access public
-         **/
-       function get_template( $type )
-       {
-               $query = "select template from bus_category where id = ".$this->catid;
-               $data = $this->DB->db_auto_get_data( $query );
-               switch( $type )
-               {
-                       case "cat":
-                               switch( $data[0]['template'] )
-                               {
-                                       case "5":
-                                       case "4":       
-                                       case "2":
-                                               $this->img_align = "left";
-                                       break;
-
-                                       default:
-                                               $this->img_align = "right";
-                                               break;
-                               }
-                       break;
-
-                       case "list":
-                               switch( $data[0]['template'] )
-                               {
-                                       case "6":
-                                       case "2":
-                                               $this->img_align = "left";
-                                               $this->img_alternate = 0;
-                                       break;
-
-                                       case "5":
-                                       case "1":       
-                                               $this->img_align = "right";
-                                               $this->img_alternate = 0;
-                                       break;
-
-                                       case "4":       
-                                               $this->img_align = "right";
-                                               $this->img_alternate = 1;
-                                       break;
-
-                                       case "3":       
-                                               $this->img_align = "left";
-                                               $this->img_alternate = 1;
-                                       break;
-
-                                       default:
-                                               break;
-                               }
-                       break;
-               }
-               return( $this->template = $data[0]['template'] );
-       }       
-       /**
-       * template_parser:This function creates data 
-       * and items arrays and does the output for the page.
-       * 
-       * @uses DELUXE_TOOLBOX
-       * @uses GLM_TEMPLATE::$items
-       * @uses GLM_TEMPLATE::get_template()
-       * @uses GLM_TEMPLATE::get_all()
-       * @uses GLM_TEMPLATE::load_static_page()
-       * @uses GLM_TEMPLATE::clean_text()
-       * @uses GLM_TEMPLATE::$item_files
-       * 
-       * @return void
-       * @access public 
-       **/
-       function get_listings()
-       {
-               // grab category and items into data and items respectfully
-               if( DELUXE_TOOLBOX )
-               {
-                       $this->get_template( "list" );
-               }
-               
-               if( !is_array( $this->items ) )
-               {
-                       $this->get_all( 2 );
-               }
-
-               // load any static category page from the static directory 
-               // hard codded content would have $catid.phtml page for it
-               $output .= $this->load_static_page();
-               switch($this->type)
-               {
-
-                       default:        
-                       if(is_array($this->items))
-                       {
-                               foreach($this->items as $key=>$val)
-                               {
-                                       //$output .= '<div class="clearer"></div>';
-                                       // items can be moved around as needed
-                                       $output .= '<div class="listing">'."\n";
-                                       $output .= $val["image"];
-                                       $output .= $val["name"];
-                                       $output .= $val["address"];
-                                       $output .= $val["description"];
-                                       $output .= $val["contactname"];
-                                       $output .= $val["email"];
-                                       $output .= $val["phone"];
-                                       $output .= $val["fax"];
-                                       $output .= $val["url"];
-                                       if( is_array( $this->item_files[$val['id']] ) )
-                                       {
-                                               $output .= implode("",$this->item_files[$val['id']]);
-                                       }
-                                       $output .= "</div>"."\n";
-                               }
-                       }
-                       break;
-               }
-               $output = GLM_TEMPLATE::clean_text($output);
-               return( $output );
-       }
-
-       /**
-       * sub_nav:Create a sub navigation 4 across
-       * 
-       * @param integer $catid: The catid for the page
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void
-       * @access public 
-       **/
-       function sub_nav($catid)
-       {
-               //$catid = $this->get_top_parent($catid);
-               $query1 = "SELECT category FROM bus_category WHERE id = $catid";        
-               $data1 = $this->DB->db_auto_get_data( $query1 );
-               $out = '<div id="nav-sub">
-                       <h3>'.htmlentities( strip_tags( $data1[0]['category'] ) ,ENT_QUOTES,'UTF-8').'</h3>';
-               
-               $query = "SELECT id,category,intro FROM bus_category WHERE parent = $catid ".$this->active_query." ORDER BY pos";       
-               $data = $this->DB->db_auto_get_data($query);
-               if(is_array($data))
-               {
-                       $counter = 1;   
-                       foreach($data as $key=>$val)
-                       {
-                               $url = $this->get_seo_url( $val['id'] );
-                               $title = strip_tags(addslashes($val['intro']));
-                               //GLM_TEMPLATE::set_name_url( GLM_TEMPLATE::get_category_Name( $val['id'],"bus_category",$this->DB ) );
-                               $out .=  '<a title="'.$title.'" href="'.$url.'">';
-                               $out .= $val["category"];
-                               $out .= '</a><br>';     
-                       }       
-               }
-               $out .= '</div>';
-               return( $out );
-       }
-
-       /**
-       * get_home_events: get events flaged as home events
-       * @param object $DB: DB reference to DB obj
-       *
-       * @uses GLM_TEMPLATE::get_event_date()
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void 
-       * @access public 
-       **/
-       function get_home_events()
-       {
-               $query = "select id,header,descr,bdate,edate,img from event where home = 't' and visable='t' and edate >= current_date;";
-               $data = $this->DB->db_auto_get_data($query);
-               if(is_array($data))
-               {
-                       $output = '<div id="events">UPCOMING EVENTS<div id="eventsbox"> 
-                                       ';
-                       foreach($data as $key=>$value)
-                       {
-                               $id = $value['id'];
-                               $header = $value['header'];
-                               $title = strip_tags(addslashes($header));
-                               $descr = substr( strip_tags( addslashes( $value['descr'] ) ), 0, 50 );
-                               $sdate = strtotime($value['bdate']);
-                               $edate = strtotime($value['edate']);
-                               $dates = GLM_TEMPLATE::get_event_date($sdate,$edate,"timestamp");
-                               $output .= $dates;
-                               $output .= '<h3><a title="" href="events.phtml?eventid='.$id.'">'.$header.'</a></h3>';
-                       }
-                       $output .= '</div></div>';
-                       return($output);
-               }
-               else
-               {
-                       return( '' );
-               }
-       }
-
-       /**
-       * get_event_date: make the event date human readable
-       * @param string $sdate: start date
-       * @param string $edate: end date
-       * @param string $dateType: dateType Postgres,etc
-       * 
-       * @return string  
-       * @access public 
-       **/
-       function get_event_date($sdate,$edate,$dateType)
-       {
-               switch($dateType)
-               {
-                       case "Postgres":
-                       if(preg_match("/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/",$sdate,$spt))
-                       {
-                               $mon = $spt[1];
-                               $day = $spt[2];
-                               $yr = $spt[3];
-                       }
-
-                       if(preg_match("/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/",$edate,$ept))
-                       {
-                               $mon2 = $ept[1];
-                               $day2 = $ept[2];
-                               $yr2 = $ept[3];
-                       }
-                       break;
-
-                       case "timestamp":
-                       $mon = date("m",$sdate);
-                       $day = date("d",$sdate);
-                       $yr = date("Y",$sdate);
-                       $mon2 = date("m",$edate);
-                       $day2 = date("d",$edate);
-                       $yr2 = date("Y",$edate);
-                       break;
-
-               }$start = mktime(0,0,0,$mon,$day,$yr);
-               $end = mktime(0,0,0,$mon2,$day2,$yr2);
-               if ($day == $day2 && $mon == $mon2 && $yr == $yr2) 
-               {
-                       $dateparam = "F jS, Y"; 
-                       $date_begin = date($dateparam, $start) ;
-                       $date_end = "";
-               }
-               elseif ($day == $day2 AND $mon == $mon2 AND $yr != $yr2) 
-               {
-                       $dateparam1 = "F jS, Y -";
-                       $dateparam2 = "Y";
-                       $date_begin = date($dateparam1, $start);
-                       $date_end = date($dateparam2, $end);
-               }
-               elseif ($day != $day2 AND $mon == $mon2 AND $yr == $yr2) 
-               {
-                       $dateparam1 = "F jS -";
-                       $dateparam2 = "jS, Y";
-                       $date_begin = date($dateparam1, $start);
-                       $date_end = date($dateparam2, $end);
-               }
-               elseif ($day != $day2 AND $mon == $mon2 AND $yr != $yr2) 
-               {
-                       $dateparam1 = "F jS, Y -";
-                       $dateparam2 = "F jS, Y";
-                       $date_begin = date($dateparam1, $start);
-                       $date_end = date($dateparam2, $end);
-               }
-               elseif ($yr == $yr2) 
-               {
-                       $dateparam1 = "F jS -";
-                       $dateparam2 = "F jS, Y";
-                       $date_begin = date($dateparam1, $start);
-                       $date_end = date($dateparam2, $end);
-               }
-               else 
-               {
-                       $dateparam1 = "F jS, Y -";
-                       $dateparam2 = "F jS, Y";
-                       $date_begin = date($dateparam1, $start);
-                       $date_end = date($dateparam2, $end);
-               }
-
-               return($date_begin." ".$date_end);
-       }
-
-       /**
-       * is_sub_id:Check to see if catid is sub of category
-       * 
-       * @param integer $catid: the catid looking at 
-       * @param integer $category: to see if it is in category
-       * @param object $DB: Db object reference
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return bool 
-       * @access public 
-       **/
-       function is_sub_id($catid,$category,&$DB)
-       {
-               if( !is_numeric( $catid ) )
-               {
-                       return( false );
-               }
-               if($category==$catid)
-               {
-                       return(true);
-               }
-               $query = "select id,parent from bus_category where id = $catid";
-               $data = $DB->db_auto_get_data($query);
-               $parent = $data[0]['parent'];
-               if($parent == 0)
-               {
-                       return(false);
-               }
-               else
-               {
-                       return( GLM_TEMPLATE::is_sub_id($parent,$category,&$DB) );      
-               }
-       }
-
-       /**
-       * get_parent: get parent for this category
-       * 
-       * @param integer $catid: id 
-       * @param object $DB: database obj
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return int $parent
-       * @access public 
-       **/
-       function get_parent($catid,&$DB)
-       {
-               $query = "SELECT parent FROM bus_category WHERE id = $catid ORDER BY pos";      
-               $data = $DB->db_auto_get_data($query);
-               return( $data[0]["parent"] );
-       }
-
-       /**
-       * get_sub_nav:
-       * @param integer $catid: 
-       * @param object $DB: 
-       * 
-       * @uses GLM_TEMPLATE::get_parent()
-       * @uses GLM_TEMPLATE::get_seo_url()
-       * @uses GLM_TEMPLATE::is_sub_id()
-       * @uses GLM_TEMPLATE::get_sub_nav()
-       * @uses GLM_TEMPLATE::has_subs()
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return  string
-       * @access  public
-       **/
-       function get_sub_nav($catid,&$DB)
-       {
-               $parentid = GLM_TEMPLATE::get_parent($catid,&$DB);
-               //echo $parentid.'<br>';
-               $query = "SELECT id,category,intro FROM bus_category WHERE parent = $parentid ".$this->active_query." ORDER BY pos";    
-               $data = $DB->db_auto_get_data($query);
-               if(is_array($data))
-               {
-                       $output = '<div id="subnav">';
-                               $counter = 1;   
-                               foreach($data as $key=>$val)
-                               {
-                                       $url = $this->get_seo_url( $val['id'] );
-                                       $title = strip_tags(addslashes($val['intro']));
-                                       if(GLM_TEMPLATE::is_sub_id($catid,$parentid,&$DB) && (GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) || $val['id'] == $catid) )
-                                       {
-                                               $output .=  '<a title="'.$title.'" class="current" href="'.$url.'">';
-                                       }
-                                       else
-                                       {
-                                               $output .=  '<a title="'.$title.'" href="'.$url.'">';
-                                       }
-                                       $output .=  $val["category"];
-                                       $output .=  '</a>';     
-                                       if( GLM_TEMPLATE::is_sub_id($catid,$val['id'],&$DB) && GLM_TEMPLATE::has_subs($val['id'],&$DB))
-                                       {
-                                               $output .= GLM_TEMPLATE::get_sub_nav($val["id"],&$DB,$catid);
-                                       }       
-                               }       
-                               $output .= '</div>';
-                       $output = GLM_TEMPLATE::clean_text($output);
-                       echo $output;
-               }
-               return(false);
-       }
-
-       /**
-       * has_subs:
-       * @param integer $catid: 
-       * @param object $DB: 
-       * 
-       * @uses GLM_TEMPLATE::$active_query
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return  string
-       * @access  public
-       **/
-       function has_subs($catid,&$DB)
-       {
-               $query = "SELECT id FROM bus_category WHERE parent = $catid ".$this->active_query." ORDER BY pos";      
-               $data = $DB->db_auto_get_data($query);
-               if(is_array($data))
-               {
-                       return(true);
-               }
-               else
-               {
-                       return(false);
-               }
-       }
-
-
-       /**
-       * get_top_parent:Get the highest level parent id (not 0 )for the category.
-       *
-       *       <p><b>NOTICE:</b> This is ment to get the top level parent not the parent of the id given.</p>
-       *
-       * @param integer $id: The catid for the page.
-       * @param object $DB: obj
-       * @uses GLM_TEMPLATE::get_top_parent()
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return int $parent 
-       * @access public 
-       **/
-       function get_top_parent($id,&$DB)
-       {
-               if( $id == 0 )
-               {
-                       return( 0 );            
-               }
-               $qs = "select parent from bus_category where id = $id";
-               $parentrow = $DB->db_auto_get_data( $qs );        
-               if($parentrow[0]['parent'] == 0)
-               {
-                       return($id);
-               }
-               else
-               {
-                       return( GLM_TEMPLATE::get_top_parent($parentrow[0]['parent'],&$DB) );
-               }
-       }
-
-       /**
-        * get_main_cats 
-        * 
-        * @access public
-        * @return string
-        */
-       function get_main_cats()
-       {
-               static $main_cats_array;
-               if( !is_array( $main_cats_array ) )
-               {
-                       $query = "select id,category from bus_category where parent = 0 order by pos;";
-                       if( $data = $this->DB->db_auto_get_data( $query ) )
-                       {
-                               foreach( $data as $row )
-                               {
-                                       $main_cats_array[$row['id']] = htmlentities(strip_tags($row['category']),ENT_QUOTES,'UTF-8');
-                               }
-                       }
-               }
-               return( $main_cats_array );
-       }
-       /**
-       * show_catimg:output the category image.
-       * 
-       * @param integer $catid: The catid for the page.
-       * @uses GLM_TEMPLATE::MIDSIZED
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void 
-       * @access  public
-       **/
-       function show_catimg($catid)
-       {
-               $query = "SELECT image FROM bus_category WHERE id = $catid";
-               $data = $this->DB->db_auto_get_data($query);
-               if($data[0]["image"]!="")
-               {
-                       $img = '<img src="'.MIDSIZED.$data[0]["image"].'" border="0" vspace="30" hspace="0">';
-               }
-               else
-               {
-                       $img = '<img src="assets/logo_small.gif" width="150" height="85" vspace="0" hspace="0" border="0" alt="Birchwood Construction"><BR>';
-               }
-               echo $img;
-               echo '<BR><img src="assets/clear.gif" height="30" width="1">';
-       }
-
-
-       /**
-       * get_catheader:output the category name.
-       * 
-       * @param integer $catid: The catid for the page
-       * @param object $DB: db obj 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void 
-       * @access  public
-       **/
-       function get_catheader($catid,$DB)
-       {
-               $query = "SELECT category FROM bus_category WHERE id = $catid";
-               $data = $DB->db_auto_get_data($query);
-               if($data[0]['category']!="")
-               {
-                       $header = strip_tags($data[0]['category']);
-               }
-               else
-               {
-                       $header = '';
-               }
-               return( $header );
-       }
-       
-               /**
-       * get_catintro: return the category page name.
-       * 
-       * @param integer $catid: The catid for the page
-       * @param object $DB: db obj 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void 
-       * @access  public
-       **/
-       function get_catintro($catid)
-       {
-               $query = "SELECT intro FROM bus_category WHERE id = $catid";
-               $data = $this->DB->db_auto_get_data($query);
-               if($data[0]['intro']!="")
-               {
-                       $header = strip_tags($data[0]['intro']);
-               }
-               else
-               {
-                       $header = '';
-               }
-               return( $header );
-       }
-
-       /**
-       * show_catheader:
-       * 
-       * @param integer $catid: 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return  string
-       * @access  public
-       **/
-       function show_catheader($catid)
-       {
-               $query = "SELECT category FROM bus_category WHERE id = $catid";
-               $data = $this->DB->db_auto_get_data($query);
-               if($data[0][category]!="")
-               {
-                       $header = $data[0][category];
-               }
-               else
-               {
-                       $header = '&nbsp;';
-               }
-               echo $header;
-       }
-
-       /**
-       * get_menu_string:get categories for the phplayermenu
-       * 
-       * @uses GLM_TEMPLATE::sort_childs()
-       * @uses GLM_TEMPLATE::convert_to_thread()
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return string 
-       * @access  public
-       **/
-       function get_menu_string()
-       {
-               $query = "SELECT id,parent,category FROM bus_category WHERE id != 0 ".$this->active_query." ORDER BY parent,pos";
-               $data = $this->DB->db_auto_get_data($query);
-               $newdata = GLM_TEMPLATE::sort_childs($data);
-               $string = GLM_TEMPLATE::convert_to_thread($newdata,$newdata[0]);
-               return($string);
-       }
-       
-
-       /**
-        * get_menu_array: like get_menu_string but returns an array
-        * 
-        * @uses GLM_TEMPLATE::sort_childs()
-       * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return  string
-        * @access  public
-        **/
-       function get_menu_array()
-       {
-               $query = "SELECT id,parent,category FROM bus_category WHERE id != 0 ".$this->active_query." ORDER BY parent,pos";
-               $data = $this->DB->db_auto_get_data($query);
-               $newdata = GLM_TEMPLATE::sort_childs($data);
-               return $newdata;
-       }
-
-       /**
-       * sort_childs:
-       * @param array $threads: 
-       * 
-       * @return  string
-       * @access  public
-       **/
-       function sort_childs($threads)
-       {
-               foreach($threads as $var=>$value)
-               {
-                       $childs[$value["parent"]][$value["id"]] = $value;
-               }
-               return($childs);
-       }
-
-       /**
-       * convert_to_thread:
-       * 
-       * @param array $threads: 
-       * @param array $thread: 
-       * @uses GLM_TEMPLATE::$thread_count
-       * @uses GLM_TEMPLATE::$whole_thread
-       * @uses GLM_TEMPLATE::get_seo_url()
-       * @uses GLM_TEMPLATE::convert_to_thread()
-       * 
-       * @return string
-       * @access public
-       **/
-       function convert_to_thread($threads, $thread)
-       {    
-               foreach($thread as $parent=>$value)
-               {
-                       $this->whole_thread .= str_repeat(".",$this->thread_count);
-                       $this->whole_thread .= "|".htmlentities($value['category'],ENT_QUOTES,'UTF-8');
-                       $url = $this->get_seo_url( $value['id'] );
-                       $this->whole_thread .= "|".$url;
-                       $this->whole_thread .="\n";
-                       if($threads[$parent])
-                       {       
-                               $this->thread_count++;
-                               GLM_TEMPLATE::convert_to_thread($threads, $threads[$parent]);
-                       }
-               }
-               $this->thread_count--;
-               return $this->whole_thread;
-       }
-
-
-       /**
-        * has_children: return true or false if this category has sub categories under it.
-        * 
-        * @param integer $catid: 
-        * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return  string
-        * @access  public
-        **/
-       function has_children($catid)
-       {
-               // returns number of children that $catid has
-               $qs="SELECT count(*) FROM bus_category WHERE parent=$catid ".$this->active_query."";
-               $row=$this->DB->db_auto_get_data($qs);
-               return $row[0]['count'];
-       }
-       
-       /**
-       * get_ancestors:get the ancestors for this category
-       * 
-       * @param integer $catid: catid
-       * @param integer $count: starting counter
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return array 
-       * @access  public
-       **/
-       function get_ancestors($catid,$count)
-       {
-               if( $count == 0 )
-               {
-                       unset( $this->ancestors );
-               }
-               if($catid)
-               {
-                       $query = "SELECT        id,category,parent 
-                       FROM    bus_category
-                       WHERE   id = ".$catid."
-                       ".$this->active_query;
-                       $res = $this->DB->db_auto_get_data($query);
-                       $id = $res[0]['id'];
-                       $parent = $res[0]['parent'];
-                       $category = $res[0]['category'];
-                       $this->ancestors[$count]['id'] = $id;
-                       $this->ancestors[$count]['label'] = $category;
-
-                       $url = $this->get_seo_url( $id ); 
-                       $this->ancestors[$count]['link'] = $url;
-                       GLM_TEMPLATE::get_ancestors($parent,$count+1,$conn);
-
-                       return (array_reverse($this->ancestors) );
-               }
-       }
-
-        /**
-        * meta_tags: create the meta description content for this page.
-        * this is taken from the category description.
-        * this should be only done for all but the home page.
-        * $meta = ( $catid != 1 ) ? $toolbox->meta_tags() : '';
-        * 
-        * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return  string
-        * @access  public
-        **/
-       function meta_tags()
-       {
-               $query = "select description from bus_category where id = ".$this->catid;
-               $data = $this->DB->db_auto_get_data( $query );
-               $description = htmlentities( substr( trim( strip_tags( $data[0]['description'] ) ), 0, 250 ),ENT_QUOTES,'UTF-8' );
-               return( $description );
-       }
-       
-        /**
-        * title: create the title for the page.
-        * this should be only done for all but the home page.
-        * $title = ( $catid != 1 ) ? $toolbox->title() : '';
-        * 
-        * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return  string
-        * @access public 
-        **/
-       function title()
-       {
-               $query = "select category,intro from bus_category where id = ".$this->catid;
-               $data = $this->DB->db_auto_get_data( $query );
-               if( $data[0]['intro'] ) 
-               {
-                       $title = strip_tags( $data[0]['intro'] );
-               }       
-               else
-               {
-                       $title = strip_tags( $data[0]['category'] );
-               }
-               return( htmlentities( $title.' - ',ENT_QUOTES,'UTF-8' ) );
-       }
-       
-       /**
-        * get_bottom_nav: generate a top level only bottom navigation for the pages.
-        * 
-        * @param integer $parent=0: 
-        * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return  string
-        * @access public 
-        **/
-       function get_bottom_nav($parent=0)
-       {
-               $out = '';
-               $query = "select id,category,intro from bus_category where id != 1 and parent = $parent ".$this->active_query." order by pos asc";
-               $row = $this->DB->db_auto_get_data( $query );
-               $url = $this->get_seo_url( HOME_ID );
-               $links[] = '<a href="'.$url.'">Home</a>';
-               if( !is_array( $row ) )
-               {
-                       return( false );
-               }
-               else
-               {
-                       $out .= '<div id="nav-bottom">';
-                       for( $i=0; $i<sizeof( $row ); $i++)
-                       {
-                               $category = htmlentities(strip_tags($row[$i]['category']),ENT_QUOTES,'UTF-8');
-                               $url = $this->get_seo_url( $row[$i]['id'] );
-                               $links[] = '<a href="'.$url.'">'.$category."</a>\n";
-                       }
-                       if( is_array( $links) )
-                       {
-                               $out .= implode(" | ",$links);
-                       }
-                       $out .= '</div>';
-                       return( $out );
-               }
-       }
-       
-
-       /**
-        * make_ul_menu: create url list of categories
-        * 
-        * @param integer $parent parent to start from 
-        * @uses GLM_DB::db_auto_get_data()
-        * 
-        * @return string 
-        * @access public
-        **/
-       function make_ul_menu( $parent = 0 )
-       {
-               $qs = "SELECT id,category,intro FROM bus_category WHERE parent = $parent ".$this->active_query." ORDER BY pos";
-               $data = $this->DB->db_auto_get_data($qs);
-               if(!is_array($data))
-               {
-                       return( false );
-               }
-               else
-               {
-                       foreach( $data as $key => $row )
-                       {
-                               $url = $this->get_seo_url( $row['id'] );
-                               $title = strip_tags(addslashes($row['intro']));
-                               $return.='
-                               <li><a title="'.htmlentities($title,ENT_QUOTES,'UTF-8').'" href="'.$url.'"';
-                               if( $this->catid == $row['id'] )        
-                               {
-                                       $return .= ' id="current"';
-                               }
-                               $return .= '>'.htmlentities($row['category'],ENT_QUOTES,'UTF-8')."</a>";
-                               if( $this->has_subs( $row['id'], &$this->DB ) && ( $this->is_sub_id( $this->catid, $row['id'], &$this->DB )  || $this->catid == $row['id'] ) )
-                               {
-                                               $ret2 = $this->make_ul_menu( $row['id'] );
-                                               $return.=$ret2;
-                               }
-                               $return.="
-                               </li>";
-                       }
-                       $main_cats = $this->get_main_cats();
-                       if( $main_cats[$parent] )
-                       {
-                               $return = '<div id="subnav">
-                               <div id="subnav-header">'.$this->get_catheader( $parent ,&$this->DB ).'</div>
-                               <ul id="navlist">'.$return.'</ul>
-                               </div>
-                               ';
-                               return( $return );
-                       }
-                       else
-                       {
-                               $return = '
-                               <ul>'.$return.'</ul>
-                               ';
-                               return( $return );
-                       }
-               }
-       }       
-       
-       /**
-       * print_ancestors:print out the ancestors
-       * @param integer $catid: the id to start at.
-       * 
-       * @return string 
-       * @access public
-       **/
-       function print_ancestors($catid)
-       {
-               return( $this->get_bread_crumbs( $catid ) );
-       }
-        
-       /**
-        * get_bread_crumbs 
-        * 
-        * @param mixed $catid 
-        * @access public
-        * @return string
-        */
-       function get_bread_crumbs( $catid )
-       {
-               $string = $this->get_ancestors( $catid, 0 );
-               if(is_array($string))
-               {    
-                       $end = count( $string ) - 1;
-                       for($i=0;$i<$end;$i++)
-                       {
-                               $outarray[] = '<a href="'.$string[$i]["link"].'">'.$string[$i]["label"].'</a>';
-                       }
-                       $outarray[] = $this->get_catheader( $catid, &$this->DB );
-                       if( is_array( $outarray ) && count( $outarray ) > 1 )
-                       {
-                               $out .= implode( " &#187; ", $outarray );
-                       }
-                       if( $out )
-                       {
-                               $return = '<div id="breadcrumbs">'.$out.'</div>';
-                       }
-               }
-               return( $return );
-       }
-
-       /**
-       * build_picklist:
-       * @param string $fieldname: 
-       * @param array $data: 
-       * @param mixed $selected: 
-       * @param string $type = "standard": 
-       * @param boolean $auto = 0: 
-       * @param integer $width = NULL : 
-       *
-       * @uses GLM_TOOLBOX::build_picklist()
-       * 
-       * @return string 
-       * @access  public
-       **/
-       function build_picklist( $fieldname, $data, $selected, $type = "standard",$auto = 0,$width = NULL )
-       {
-               return( GLM_TOOLBOX::build_picklist( $fieldname, $data, $selected, $type = "standard",$auto = 0,$width = NULL ) );
-       }
-
-       /**
-       * keyword_replace:
-       * 
-       * @param string $string: 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return string 
-       * @access public
-       **/
-       function keyword_replace($string)
-       {
-               //return($string);
-               if($search = strstr($string,"{"))
-               {
-                       if(preg_match("/\{([A-Z0-9\&\-\,\'\" ]*)\}/i",$string,$needle))
-                       {
-                               if($needle[0] != "")
-                               {               
-                                       $qs = "SELECT   id,category
-                                       FROM            bus_category
-                                       WHERE   trim(keyword) = '".trim($needle[1])."'";
-
-                                       $keyres = $this->DB->db_auto_get_data($qs);                                     
-                                       $parent = $this->get_top_parent($keyres[0]['id'],&$this->DB);
-                                       $url = $this->get_seo_url( $keyres[0]['id'] );
-                                       $replacement = "<a href=\"".$url."\">".htmlspecialchars($keyres[0]['category'])."</a>";
-                                       $string = str_replace($needle[0],$replacement,$string);
-                               }
-                       }               
-                       else{
-                               return($string);
-                       }
-                       if($search = strstr($string,"{"))
-                       return($this->keyword_replace($string));
-               }       
-               return($string);        
-       }
-       /**
-       * getIdFromName:
-       * 
-       * @param string $name: 
-       * @param string $table: 
-       * @param object $DB: 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @deprecated Don't use this!  THIS IS A WARNING (this funcion will be gone next time)
-       * @return string 
-       * @access  public
-       **/
-       function get_id_from_name( $name, $table, &$DB)
-       {
-               if( $name == "" )
-               {
-                       return( 0 );
-               }
-               if( is_numeric( $name ) )
-               {
-                       return( $name );
-               }
-               if( preg_match("/(.*)/$/",$name,$tmp) )
-               {
-                       $name = $tmp[1];
-               }
-               $category = "category";
-               if( preg_match("/-([0-9]*)$/",$name,$tmp ) )
-               {
-                       $id = $tmp[1];
-                       return( $id );
-               }
-               // should already be returning id at this point 
-               // putting the _id on the end of all url's as 
-               // the other way is very inifiecent for the database.
-               $name = str_replace( "-"," ",$name );
-               $query = "select id from $table where trim(lower(replace(replace(replace(replace(replace(replace($category,'\'',''),'/',''),'-',' '),'#',''),'&',''),'?',''))) = '".trim(strtolower($name))."'";
-               $data = $DB->db_auto_get_data( $query );
-               if( is_array( $data ) )
-               {
-                       foreach( $data as $key=>$val )
-                       {
-                               $catid = $val['id'];
-                       }
-                       return( $catid );
-               }
-               else
-               {
-                       return( 0 );
-               }
-       }
-
-       /**
-        * get_base_url: generate the base of the url for the given category id 
-        * @param integer $id : 
-        * 
-        * @return string 
-        * @access public
-        **/
-       function get_base_url( $id )
-       {
-               if( $this->pages[$id] )
-               {
-                       $page = $this->pages[$id];
-               }
-               else
-               {
-                       $page = $this->pages['default'];
-               }
-               if( $GLOBALS['GLM_SERVER_ID'] == 'ws1.gaslightmedia.com' && $this->catid == 1 )
-               {
-                       $page = '';
-               }
-               return( $page );
-       }
-
-       /**
-       * getCategoryName:
-       * used mostly for getting category name for search engine friendly url's 
-       * 
-       * @param integer $id: 
-       * @param string $table: 
-       * @param object &$DB : 
-       * @uses GLM_DB::db_auto_get_data()
-       * 
-       * @return void 
-       * @access public 
-       **/
-       function get_category_name( $id, $table,&$DB )
-       {
-               if( !is_numeric( $id ) )
-               {
-                       return( false );
-               }
-               if($table == "class_category")
-               {
-                       $category = "name";
-               }
-               else
-               {
-                       $category = "category";
-               }
-               $query = "select $category from $table where id = $id";
-               $data = $DB->db_auto_get_data( $query );
-               if( is_array( $data ) )
-               {
-
-                       $add = '-'.$id;
-                       if( $data[0]['category'] ) 
-                       {
-                               $category = $data[0]['category'].$add;
-                       }
-                       elseif( $data[0]['name'])
-                       {
-                               $category = $data[0]['name'].$add;
-                       }
-                       else
-                       {
-                               $category = $add; 
-                       }
-                       return( htmlspecialchars($category) );
-               }
-       }
-
-
-       /**
-       * setNameUrl:
-       * @param string $name : 
-       * 
-       * @return string 
-       * @access public
-       **/
-       function set_name_url( $name )
-       {
-               $name = preg_replace("/[\/#&?'\"]|amp;/",strip_tags( strtolower( trim( $name ) ) ) );
-//             $name = strtolower( str_replace( " ","-",trim( $name ) ) );
-//             $name = str_replace( "/","",$name );
-//             $name = str_replace( "#","",$name );
-//             $name = str_replace( "&","",$name );
-//             $name = str_replace( "amp;","",$name );
-//             $name = str_replace( "?","",$name );
-//             $name = str_replace( "'","",$name );
-               return( htmlspecialchars( $name ) );
-       }
-
-       /**  valid email
-       *
-       * <p>Checks for a valid format and good (mx check) 
-       * email address.</p>
-       * @deprecated using GLM_TOOLBOX::valid_email()
-       * @uses GLM_TOOLBOX::valid_email()
-       *
-       * @param string email the email address as string.
-       * @return boolean 
-       */ 
-       function valid_email( $email ) 
-       { 
-               return( GLM_TOOLBOX::valid_email( $email ) );
-       }
+     * @return string
+     * @access public
+     **/
+    function get_base_url( $id )
+    {
+        if( $this->pages[$id] )
+        {
+            $page = $this->pages[$id];
+        }
+        else
+        {
+            $page = $this->pages['default'];
+        }
+        if( $GLOBALS['GLM_SERVER_ID'] == 'ws1.gaslightmedia.com' && $this->catid == 1 )
+        {
+            $page = '';
+        }
+        return( $page );
+    }
+
+    /**
+    * getCategoryName:
+    * used mostly for getting category name for search engine friendly url's
+    *
+    * @param integer $id:
+    * @param string $table:
+    * @param object &$DB :
+    * @uses GLM_DB::db_auto_get_data()
+    *
+    * @return void
+    * @access public
+    **/
+    function get_category_name( $id, $table,&$DB )
+    {
+        if( !is_numeric( $id ) )
+        {
+            return( false );
+        }
+        if($table == "class_category")
+        {
+            $category = "name";
+        }
+        else
+        {
+            $category = "category";
+        }
+        $query = "select $category from $table where id = $id";
+        $data = $DB->db_auto_get_data( $query );
+        if( is_array( $data ) )
+        {
+
+            $add = '-'.$id;
+            if( $data[0]['category'] )
+            {
+                $category = $data[0]['category'].$add;
+            }
+            elseif( $data[0]['name'])
+            {
+                $category = $data[0]['name'].$add;
+            }
+            else
+            {
+                $category = $add;
+            }
+            return( htmlspecialchars($category) );
+        }
+    }
+
+
+    /**
+    * setNameUrl:
+    * @param string $name :
+    *
+    * @return string
+    * @access public
+    **/
+    function set_name_url( $name )
+    {
+        $name = preg_replace("/[\/#&?'\"]|amp;/",strip_tags( strtolower( trim( $name ) ) ) );
+//      $name = strtolower( str_replace( " ","-",trim( $name ) ) );
+//      $name = str_replace( "/","",$name );
+//      $name = str_replace( "#","",$name );
+//      $name = str_replace( "&","",$name );
+//      $name = str_replace( "amp;","",$name );
+//      $name = str_replace( "?","",$name );
+//      $name = str_replace( "'","",$name );
+        return( htmlspecialchars( $name ) );
+    }
+
+    /**  valid email
+    *
+    * <p>Checks for a valid format and good (mx check)
+    * email address.</p>
+    * @deprecated using GLM_TOOLBOX::valid_email()
+    * @uses GLM_TOOLBOX::valid_email()
+    *
+    * @param string email the email address as string.
+    * @return boolean
+    */
+    function valid_email( $email )
+    {
+        return( GLM_TOOLBOX::valid_email( $email ) );
+    }
 }
 ?>
index 67fc7b8..4fcdba6 100755 (executable)
@@ -6,11 +6,11 @@ include_once BASE.'classes/class_auth.inc';
 include_once BASE.'admin/packages/setup.php';
 unset($nav);
 $nav['Log Out'] = 'logout.php';
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 $DB->db_connect();
-$Auth =& new authuser($DB);
-$member =& new glm_member( &$DB, $member_config );
-$package =& new package( &$DB, $package_config );
+$Auth = new authuser($DB);
+$member = new glm_member( &$DB, $member_config );
+$package = new package( &$DB, $package_config );
 $logged = $Auth->verify();
 if( !$logged )
 {
index 4c91b66..fb99e5e 100755 (executable)
@@ -2,9 +2,9 @@
 session_start();
 include_once '../setup.phtml';
 include_once BASE.'classes/class_auth.inc';
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 $DB->db_connect();
-$Auth =new authuser($DB);
+$Auth =new authuser($DB);
 $logged = $Auth->login();
 header( 'Location: index.php' );
 ?>
index 3b49816..b5cd567 100755 (executable)
@@ -2,9 +2,9 @@
 session_start();
 include_once '../setup.phtml';
 include_once BASE.'classes/class_auth.inc';
-$DB =& new GLM_DB();
+$DB = new GLM_DB();
 $DB->db_connect();
-$Auth =& new authuser($DB);
+$Auth = new authuser($DB);
 $logged = $Auth->logout();
 header( 'Location: index.php' );
 ?>
index 94b985e..c1f9880 100755 (executable)
@@ -1,4 +1,4 @@
-<?php
+?php
        include_once('setup.phtml');
        include_once(BASE.'classes/class_order_form.inc');
        $people_sel = array(0=>'',1,2,3,4,5,6,7,8,9,10);
@@ -78,7 +78,7 @@
        $fields[] = array('name'=>'over_night_fee','title'=>'Over Night Fee','type'=>'readonly');
        $data['total_amount'] = '<div id="total-amount">$0.00</div>';
        $fields[] = array('name'=>'total_amount','title'=>'Total Price','type'=>'readonly');
-       $order_form =& new order_form( $fields, $data );
+       $order_form = new order_form( $fields, $data );
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
 <link rel="stylesheet" type="text/css" href="<?php echo BASE_URL;?>contactform.css">
 <link rel="stylesheet" type="text/css" href="<?php echo BASE_URL;?>build/calendar/assets/calendar.css">
 <script type="text/javascript">
-       YAHOO.namespace("example.calendar"); 
+       YAHOO.namespace("example.calendar");
 </script>
        </head>
        <body>
index 35fd39e..4d25edb 100755 (executable)
@@ -103,7 +103,7 @@ if( !isset($SITEINFO) )
         define("AUTH_TEST_MODE","TRUE");
         define("BASE_SECURE_URL", $BASE_SECURE_URL."/");
         define("BASE_INSECURE_URL", $BASE_URL."/");
-        define("CONN_STR", "host=devdb dbname=mackinacislandpackages");        // DB connection string
+        define("CONN_STR", "host=localhost user=nobody dbname=mackinacislandpackages");        // DB connection string
         define("OWNER_EMAIL", "dev@gaslightmedia.com");        // site owner's email address
         define("FROM_NEWS_EMAIL", "info@gaslightmedia.com");        // site owner's email address
         define("REPLY_TO", "info@gaslightmedia.com");           // the reply-to field for email's