From: Steve Sutton
Date: Thu, 17 Mar 2016 17:55:15 +0000 (-0400)
Subject: old site from ws1
X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;p=web%2Fkiosk.pellstonairport.com.git
old site from ws1
---
9df0d30b26656ed72f4b3e5988dbc4e55e47acee
diff --git a/.#google-map.php b/.#google-map.php
new file mode 100755
index 0000000..de7143a
--- /dev/null
+++ b/.#google-map.php
@@ -0,0 +1,289 @@
+memb_names[$_GET['catid']];
+$page_city = $_GET['city'];
+$member_list = $toolbox->get_member_list();
+
+switch($_SERVER['GLM_SERVER_ID'])
+{
+ case "devsys.gaslightmedia.com":
+ $conn = pg_connect('host=devsys user=postgres dbname=pellstonairport');
+ break;
+ default:
+ $conn = pg_connect('host=ds1 user=postgres dbname=pellstonairport');
+ break;
+}
+
+function text_clean($text)
+{
+ return str_replace("'","´",$text);
+}
+
+if(!function_exists('file_get_contents')) // we have an ancient copy of php, so this function doesn't exist
+{
+ function file_get_contents($filename)
+ {
+ return implode("\n",file($filename));
+ }
+}
+
+// get our member info
+
+$qs = "SELECT * FROM member WHERE id = ".$_GET['id'];
+$res = pg_exec($conn,$qs);
+$rcount = pg_numrows($res);
+$member = pg_fetch_array($res,0,PGSQL_ASSOC);
+
+// set up the map
+$map = new GMap();
+//$map->addSmallMapControl();
+//$map->addMapTypeControl();
+//$map->addSmallZoomControl();
+//$map->addExtentMap();
+$map->zoom = 11;
+
+// making my custom control
+$custcontrol = '
+// A TextualZoomControl is a GControl that displays textual "Zoom In"
+// and "Zoom Out" buttons (as opposed to the iconic buttons used in
+// Google Maps).
+function TextualZoomControl() {
+}
+TextualZoomControl.prototype = new GControl();
+
+// Creates a one DIV for each of the buttons and places them in a container
+// DIV which is returned as our control element. We add the control to
+// to the map container and return the element for the map class to
+// position properly.
+TextualZoomControl.prototype.initialize = function(map) {
+
+ var container = document.createElement("div");
+ var zoomInDiv = document.createElement("div");
+
+ this.setButtonStyle_(zoomInDiv,"glm_zoomin");
+ container.appendChild(zoomInDiv);
+
+ var ZoomInImage = document.createElement("img");
+ ZoomInImage.src = "'.URL_BASE.'maps/zoom-in.png";
+ // ZoomInImage.id = "glm_zoomin";
+
+ zoomInDiv.appendChild(ZoomInImage);
+
+ //zoomInDiv.appendChild(document.createTextNode("Zoom In"));
+ GEvent.addDomListener(zoomInDiv, "click", function() {
+ map.zoomIn();
+ });
+
+ var ZoomOutImage = document.createElement("img");
+ ZoomOutImage.src = "'.URL_BASE.'maps/zoom-out.png";
+ // ZoomOutImage.id = "glm_zoomout";
+
+
+ var zoomOutDiv = document.createElement("div");
+ this.setButtonStyle_(zoomOutDiv,"glm_zoomout");
+ container.appendChild(zoomOutDiv);
+ zoomOutDiv.appendChild(ZoomOutImage);
+ //zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));
+ GEvent.addDomListener(zoomOutDiv, "click", function() {
+ map.zoomOut();
+ });
+
+ map.getContainer().appendChild(container);
+ return container;
+}
+
+// By default, the control will appear in the top left corner of the
+// map with 7 pixels of padding.
+TextualZoomControl.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
+}
+
+// Sets the proper CSS for the given button element.
+TextualZoomControl.prototype.setButtonStyle_ = function(button,bid) {
+// button.style.textDecoration = "underline";
+ // button.style.color = "#0000cc";
+ // button.style.backgroundColor = "white";
+ // button.style.font = "small Arial";
+ // button.style.border = "1px solid black";
+ button.style.padding = "2px";
+ button.style.marginBottom = "3px";
+ //button.style.textAlign = "center";
+ // button.style.width = "6em";
+ button.style.cursor = "pointer";
+ button.id = bid;
+}
+
+map.addControl(new TextualZoomControl());
+';
+
+$map->extrajs($custcontrol);
+// end the custom control
+
+// add the icon class
+$iconclass = new GIconClass(URL_BASE.'maps/pins/010.png',URL_BASE.'maps/pins/shadow.png',1);
+$map->addIconClass($iconclass->display());
+
+// plot the member
+$x = trim(str_replace("\n","",$member['lon']));
+$y = trim(str_replace("\n","",$member['lat']));
+//$map->center = new GLatLng(45.571571,-84.783961);
+$map->center = new GLatLng($y,$x);
+if($x != '' && $y !='') // make sure we have lat lon data
+{
+ $newpoint = new GPoint($x,$y); // create a new point
+ $bubbledata = '
+ *
+ * @package Toolbox Library
+ * @subpackage Database Library
+ * @author $Author: cscott $
+ * @copyright 2005
+ * @version $Revision: 1.1.1.1 $
+ * @since $Date: 2006/04/25 18:14:59 $
+ * @todo create mysql part of these function for abstraction also
+ *
+
+*/
+class GLM_DB
+ {
+ /**
+ * host
+ * string host database host server name
+ *
+ * @var mixed
+ * @access public
+ */
+ var $host;
+ /**
+ * dbname
+ * string dbname name of the database
+ *
+ * @var mixed
+ * @access public
+ */
+ var $dbname;
+ /**
+ * user
+ * string user The user to connect as
+ *
+ * @var mixed
+ * @access public
+ */
+ var $user;
+ /**
+ * password
+ * string password The users password if any
+ *
+ * @var mixed
+ * @access public
+ */
+ var $password;
+ /**
+ * dbd
+ * string dbd Database connection result ID#
+ *
+ * @var mixed
+ * @access public
+ */
+ var $dbd;
+ /**
+ * conn
+ * string conn string postgres connection string default = CONN_STR
+ *
+ * @var mixed
+ * @access public
+ */
+ var $conn;
+ /**
+ * trans
+ * boolean trans bool if true a transaction is in process
+ *
+ * @var mixed
+ * @access public
+ */
+ var $trans;
+ /**
+ * dbd
+ * resource dbd connection object from postgres
+ *
+ * @var mixed
+ * @access public
+ */
+ var $dbd;
+ /**
+ * Result
+ *
+ * @var mixed
+ * @access public
+ */
+ var $Result;
+
+ function GLM_DB( $conn = CONN_STR )
+ {
+ $this->host = "";
+ $this->dbname = "";
+ $this->user = "nobody";
+ $this->password = "";
+ $this->conn = $conn;
+ $this->trans = 0;
+ $this->dbd = "";
+ }
+
+ /**
+ * db_connect
+ *
+ * Creates a connection to database specified $conn_str,
+ * and returns a boolean for success.
+ *
+ * @uses GLM_DB::$dbd
+ * @uses GLM_DB::$conn
+ * @uses GLM_DB::$dbname
+ * @uses GLM_DB::$host
+ * @uses GLM_DB::$user
+ * @uses GLM_DB::$password
+ * {@source }
+ * @param conn_str Connect String
+ * @param fail_mode Failure Mode TRUE = Abort with HTML FALSE = Return with fail code
+ * @returns int
+ * @access public
+ */
+
+ function db_connect()
+ {
+ if( isset( $this->dbd ) && $this->dbd != "" )
+ {
+ return( $this->dbd );
+ }
+ switch ( DB_TYPE )
+ {
+ case "postgres":
+ if( $this->host == "" && $this->dbname == "" )
+ {
+ $conn = $this->conn;// CONN_STR;
+ }
+ else
+ {
+ $conn .= ( $this->host ) ? 'host='.$this->host.' ' : '';
+ $conn .= ( $this->dbname ) ? 'dbname='.$this->dbname.' ' : '';
+ $conn .= ( $this->user ) ? 'user='.$this->user." " : '';
+ $conn .= ( $this->password ) ? "password=".$this->password : '';
+ }
+ if( !$this->dbd = pg_connect( $conn ) )
+ {
+ echo pg_errormessage( $conn );
+ }
+ break;
+
+ default:
+ return( 0 );
+ break;
+ }
+ return( $this->dbd );
+ }
+
+ /** db_close
+ *
+ * Closes the connection to database specified by the handle dbd
+ * returns a boolean for success
+ *
+ * {@source }
+ * @returns bool - Returns 1 on success 0 if dbd is not a valid connection
+ * @access public
+ */
+
+ function db_close()
+ {
+ switch (DB_TYPE)
+ {
+ case "postgres":
+ @pg_close($this->dbd);
+ break;
+ default:
+ return(0);
+ }
+ }
+
+ /** db_exec
+ *
+ * Execute an SQL query, * returning a valid result index or zero(0) on
+ * failure.
+ *
+ * {@source }
+ * @param $qs -- SQL query string
+ * @returns int Returns a valid result index on success 0 on failure
+ * @access public
+ */
+ function db_exec( $qs )
+ {
+ if( !$this->dbd )
+ {
+ $this->dbd = $this->db_connect();
+ }
+ switch ( DB_TYPE )
+ {
+ case "postgres":
+ if(!$ret = pg_exec( $this->dbd, $qs ) )
+ echo "".$qs."";
+ break;
+ default:
+ return( 0 );
+ }
+ return( $ret );
+ }
+
+ /** db_fetch_array
+ *
+ * Stores the data in associative indices, using the field names as
+ * keys.
+ *
+ * {@source }
+ * @param $res -- valid database result index
+ * @param $i -- row number
+ * @param $type -- PGSQL_ASSOC,PGSQL_BOTH,PGSQL_NUM
+ * @returns array Returns an associative array of key-value pairs
+ * @access public
+ */
+
+ function db_fetch_array( $res, $i, $type )
+ {
+ switch ( DB_TYPE )
+ {
+ case "postgres":
+ $row = pg_fetch_array( $res, $i, $type );
+ break;
+
+ default:
+ return( 0 );
+ }
+ return( $row );
+ }
+
+ /** db_freeresult
+ *
+ * Free result memory.
+ *
+ * {@source }
+ * @param $res -- valid database result index
+ * @returns bool - Returns 1 for success 0 for failure
+ * @access public
+ */
+
+ function db_freeresult( $res )
+ {
+ switch ( DB_TYPE )
+ {
+ case "postgres":
+ $ret = pg_freeresult( $res );
+ break;
+
+ default:
+ return( 0 );
+ }
+ return( $ret );
+ }
+
+ /** db_numrows
+ *
+ * Determine number of rows in a result index
+ *
+ * {@source }
+ * @param $res -- valid database result index
+ * @returns int - Returns number of rows
+ * @access public
+ */
+
+ function db_numrows( $res )
+ {
+
+ switch ( DB_TYPE )
+ {
+ case "postgres":
+ $ret = pg_numrows( $res );
+ break;
+
+ default:
+ return( -1 );
+ }
+ return( $ret );
+ }
+ /** db_auto_get_array
+ *
+ * The auto function for retrieving an array based soley on a query
+ * string. This function makes the connection, does the exec, fetches
+ * the array, closes the connection, frees memory used by the result,
+ * and then returns the array
+ *
+ * {@source }
+ * @param $qs SQL query string
+ * @param $i row number
+ * @param $type PGSQL_ASSOC or PGSQL_BOTH or PSQL_NUM
+ * @returns array - Returns an associative array of key-value pairs
+ * @access public
+ */
+
+ function db_auto_array( $qs, $i, $type )
+ {
+
+ $dbd = $this->db_connect();
+ if( !$dbd )
+ {
+ return( 0 );
+ }
+ $res = db_exec( $dbd, $qs );
+ if( !$res )
+ {
+ return( 0 );
+ }
+
+ $row = db_fetch_array( $res, $i, $type );
+
+ if(!db_freeresult( $res ) )
+ {
+ return( 0 );
+ }
+
+ return( $row );
+ }
+
+ /** db_auto_exec
+ *
+ * The auto function for executing a query.
+ * This function makes the connection, does the exec, fetches
+ * the array, closes the connection, frees memory used by the result,
+ * and then returns success (not a valid result index)
+ *
+ * {@source }
+ * @param $qs SQL query string
+ * @returns int - Returns 1 for success 0 for failure
+ * @access public
+ */
+
+ function db_auto_exec( $qs )
+ {
+ $this->db_connect();
+ if( !$this->dbd )
+ {
+ return( 0 );
+ }
+ if( !$this->db_exec( $qs ) )
+ {
+ return( 0 );
+ }
+ else
+ {
+ return( 1 );
+ }
+ }
+ /** db_auto_get_data
+ *
+ *
The auto function for retrieving an array based soley on a query
+ * string. This function makes the connection, does the exec, fetches
+ * the array, closes the connection, frees memory used by the result,
+ * and then returns the array.
+ ';
+ }
+ return( $out );
+ }
+ }
+?>
diff --git a/classes/class_importer.inc b/classes/class_importer.inc
new file mode 100755
index 0000000..64c3802
--- /dev/null
+++ b/classes/class_importer.inc
@@ -0,0 +1,124 @@
+ each line must have only one record
+ * each record must only be on one line
+ * the first line must have the field names Quoted
+ * fields must be quoted when they have single quotes in them
+ * fields must be seperated by a comma
+ *
+ * @package Toolbox Library
+ * @subpackage DB_import Library
+ * @filesource
+ *
+ */
+/**
+ * Import Library
+ *
+ * GLM_IMPORT will take a file and import it into a Postgres database
+ * each line must have only one record
+ * each record must only be on one line
+ * the first line must have the field names Quoted
+ * fields must be quoted when they have single quotes in them
+ * fields must be seperated by a comma
+ *
+ * @package Toolbox Library
+ * @subpackage DB_import Library
+ *
+ */
+class GLM_IMPORT
+ {
+ /** @var file string name of the file to import */
+ var $file;
+ /** @var host string name of host server */
+ var $host;
+ /** @var string dbname name of te database */
+ var $dbname;
+ /** @var user */
+ var $user;
+ /** @var password */
+ var $password;
+ /** @var data array the contents of the file in an array */
+ var $data;
+ /** @var conn object database connect object */
+
+ /** GLM_IMPORT
+ class constructor
+ this is called an initialization
+ */
+ function GLM_IMPORT($file,$host,$dbname,$user="nobody",$password="",$debugMode=NULL)
+ {
+
+ $this->file = $file;
+ $this->host = $host;
+ $this->dbname = $dbname;
+ $this->user = $user;
+ $this->password = $password;
+ $this->debugMode = $debugMode;
+ $this->readFile();
+ // $this->connect();
+ // $this->startImport();
+ // $this->sendImport();
+ // $this->endImport();
+
+ }
+
+ /** connect
+ Start the postgres connect
+ */
+ function connect()
+ {
+ if($this->host)
+ $host = "host=".$this->host;
+ if($this->dbname)
+ $dbname = "dbname=".$this->dbname;
+ if($this->user)
+ $user = "user=".$this->user;
+ if($this->password)
+ $password = "password=".$this->password;
+ $this->conn = pg_connect("$host $dbname $user $password");
+ }
+
+ /** readFile
+ read the csv file into an array
+ using the first line as key values
+ */
+ function readFile()
+ {
+ $row = 0;
+ $handle = fopen ($this->file,"r");
+ while ($data = fgetcsv ($handle, 1000, ","))
+ {
+ if($row == 0){
+ // set the varible array
+ $num = count ($data);
+ $csvNames = array();
+ for ($c=0; $c < $num; $c++)
+ {
+ $csvNames[$c] = $data[$c];
+ $data[$c] = array();
+ }
+ $row = 1;
+ }else{
+ $num = count ($data);
+ $row++;
+ for ($c=0; $c < $num; $c++)
+ {
+ $data1[($row - 1 )][$csvNames[$c]] = $data[$c];
+ }
+ }
+ }
+ fclose ($handle);
+ $this->data = $data1;
+ if($this->debugMode == true)
+ {
+ echo "
';
+ $output .= $this->getPhotos( $catid );
+ return($output);
+ }
+}
+?>
diff --git a/classes/class_search.inc b/classes/class_search.inc
new file mode 100755
index 0000000..19ecd9b
--- /dev/null
+++ b/classes/class_search.inc
@@ -0,0 +1,362 @@
+seach glm-search engine for the category/business_listing
+ * This class was made to provide a search page for
+ * our event,business_listing,newsletter databases
+ *
+ * @package Toolbox
+ * @subpackage Search
+ * @filesource
+ */
+/**
+ *
seach glm-search engine for the category/business_listing
+ * This class was made to provide a search page for
+ * our event,business_listing,newsletter databases
+ *
+ * @package Toolbox
+ * @subpackage Search
+ * @category Search
+ * @author Steve Sutton
+ * @version $Revision: 1.1.1.1 $
+ * @since $Date: 2006/04/25 18:14:59 $
+ */
+class search{
+ /** @var -*/
+ var $parentshow; // array containting the catids and parentids
+ /** @var pages */
+ var $pages;
+ /** @var eventquery */
+ var $eventquery;
+ /** @var bussyquery */
+ var $bussyquery;
+ /** @var newsyquery */
+ var $newsyquery;
+ /** @var sr */
+ var $sr;
+ /** @var p */
+ var $p;
+ /** @var results */
+ var $results;
+ /** @var threads */
+ var $threads;
+ var $type;
+
+ /** search
+ constructor function
+ @param none
+ @returns none
+ */
+ function search()
+ {
+ $this->newsyquery = "";
+ $this->bussyquery = "";
+ $this->eventquery = "";
+ $this->pages = array();
+ $this->parentshow = array();
+ $this->type = "general";
+ }
+
+ /** set_events
+ Sets up the query for the event search
+ @param none
+ @returns none
+ */
+ function set_events()
+ {
+ $eventf[] = "e.header".$this->sr;
+ $eventf[] = "e.descr".$this->sr;
+ $eventf[] = "e.loc".$this->sr;
+ $eventf[] = "e.contact".$this->sr;
+ $this->eventquery = "SELECT e.*
+ FROM event e
+ WHERE ";
+ $eevent = implode(" OR ",$eventf);
+ $this->eventquery .= $eevent;
+ }
+
+ /** set_bus
+ Sets the query for the business_listing db search
+ @param none
+ @returns none
+ */
+ function set_bus()
+ {
+ $busf[] = "b.name".$this->sr;
+ $busf[] = "b.description".$this->sr;
+ $busf[] = "b.city".$this->sr;
+ $busf[] = "b.state".$this->sr;
+ $busf[] = "b.zip".$this->sr;
+ $busf[] = "b.phone".$this->sr;
+ $busf[] = "b.fax".$this->sr;
+ $busf[] = "b.email".$this->sr;
+ $buscatf[] = "bc.category".$this->sr;
+ $buscatf[] = "bc.description".$this->sr;
+ $buscatf[] = "bc.intro".$this->sr;
+ $this->bussyquery = "SELECT DISTINCT ON (bc.category) bc.*, b.*,bc.id as catid
+ FROM (bus_category bc LEFT OUTER JOIN bus_category_bus bcb ON (bcb.catid = bc.id))
+ LEFT OUTER JOIN bus b ON (b.id = bcb.busid)
+ WHERE (";
+ $ebus = implode(" OR ",$busf);
+ $ebuscat = implode(" OR ",$buscatf);
+ $this->bussyquery .= $ebus." OR ".$ebuscat.")";
+ }
+
+ /** set_news
+ Sets the newsletter query for the search
+ @param none
+ @returns none
+ */
+ function set_news()
+ {
+ $newsf[] = "n.title".$this->sr;
+ $newsf[] = "n.header".$this->sr;
+ $newsf[] = "n.description".$this->sr;
+ $newsblockf[] = "nb.header".$this->sr;
+ $newsblockf[] = "nb.description".$this->sr;
+ $this->newsyquery = "SELECT n.*, nb.*
+ FROM news n LEFT OUTER JOIN news_block nb ON (n.id = nb.news_id)
+ WHERE ";
+
+ $enews = implode(" OR ",$newsf);
+ $enewsblock = implode(" OR ",$newsblockf);
+ $this->newsyquery .= $enews." OR ".$enewsblock;
+ }
+
+ /** set_query
+ calls the queries for events,bus,and the newsletter
+ @param none
+ @returns none
+ */
+ function set_queries()
+ {
+ $this->set_events();
+ $this->set_bus();
+ $this->set_news();
+ }
+
+ /** posted
+ Sets sr variable with the POST var search
+ @param none
+ @returns none
+ */
+ function posted()
+ {
+ if($_POST && $_POST["search"])
+ {
+ //$this->show_form();
+ if($_POST["search"])
+ $this->sr = " ~* '".$_POST["search"]."'";
+ $this->set_queries();
+ $this->execute_search();
+ }
+ else
+ {
+ //$this->show_form();
+ }
+ }
+
+ /** show_form
+ Outputs the form for the search
+ @param none
+ @returns none
+ */
+ function show_form()
+ {
+ ?>
+
+
+
+ }
+
+ /** execute_search
+ Sends the queries to to database
+ @param none
+ @returns none
+ */
+ function execute_search()
+ {
+ extract($_POST);
+ $qs = "";
+ switch($this->type)
+ {
+ case "events"://Events
+ $qs = $this->eventquery;
+ $qs .= " AND edate > CURRENT_DATE";
+ $href = $this->pages["events"];
+ break;
+
+ case "general"://General
+ $qs = $this->bussyquery;
+ break;
+
+ case "newsletter"://Library
+ $qs = $this->newsyquery;
+ $href = $this->pages["newsletter"];
+ break;
+
+ default:
+ html_error("All",1);
+ break;
+ }
+
+ //echo $qs;
+ $this->result = db_auto_get_data($qs,CONN_STR);
+ if($this->result != "")
+ {
+ echo "
Found ".count($this->result);
+ if(count($this->result)>1)
+ echo " matches for \"".$search."\"";
+ else
+ echo " match for \"".$search."\"";
+ echo "
";
+ }
+ else
+ {
+ echo "
No Matches
";
+ }
+ if($this->type == "general")
+ {
+ if($this->result != "")
+ {
+ foreach($this->result as $key=>$data)
+ {
+ $this->threads[] = array(
+ "ID" => $data[catid],
+ "content" => $data[category],
+ "parent" => $data[parent]
+ );
+ }
+ }
+ }
+ elseif($this->type == "events")
+ {
+ if($this->result != "")
+ {
+ foreach($this->result as $key=>$data)
+ {
+ printf("%s ",$href,$data[id],$data[header]);
+ }
+ }
+ }
+ elseif($this->type == "newsletter")
+ {
+ if($this->result != "")
+ {
+ foreach($this->result as $key=>$data)
+ {
+ printf("%s ",$href,$data[title]);
+ }
+ }
+ }
+
+ if(is_array($this->threads))
+ {
+ $this->get_parentshow();
+ $output = $this->printout($this->threads);
+ echo $output;
+ }
+ }
+
+ /** get_parent
+ Finds the parent. Will traverse up until it reaches top of
+ chain.
+ @param id - The catid to find parent of
+ @returns Parent - The parent id
+ */
+ function get_parent($id)
+ {
+ if($id == 0)
+ return(0);
+ if($this->parentshow[$id]['parent'] != "")
+ {
+
+ $test = $this->parentshow[$id]['parent'];
+ if($test === 0)
+ {
+ return($id);
+ }
+ else
+ {
+ $id = $this->get_parent($test);
+ }
+ if($id == 0)
+ return($test);
+ return($id);
+ }
+ return($id);
+ }
+
+ /** get_parentshow
+ Sets the array parentshow with all categories.
+ @param none
+ @returns none
+ */
+ function get_parentshow()
+ {
+ $qs = "SELECT id,parent,category
+ FROM bus_category";
+
+ $parentrow = db_auto_get_data($qs,CONN_STR);
+
+ foreach($parentrow as $key=>$value)
+ {
+ $this->parentshow[$value[id]] = $value[parent];
+ }
+ }
+
+ /** printout
+ Print the results out as links to their pages.
+ @param none
+ @returns none
+ */
+ function printout()
+ {
+ if(is_array($this->threads))
+ {
+ foreach($this->threads as $key=>$value)
+ {
+ $p = $this->get_parent($value[ID]);
+ if($p!=1)
+ {
+ $string .= "".$value[content]." ";
+ }
+ else
+ {
+ $string .= "".$value[content]." ";
+ }
+ }
+ echo $string;
+ }
+ }
+}
+?>
diff --git a/classes/class_tellfriend.inc b/classes/class_tellfriend.inc
new file mode 100755
index 0000000..84ce94d
--- /dev/null
+++ b/classes/class_tellfriend.inc
@@ -0,0 +1,230 @@
+
+ * 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.
+ *
+ *
+ * @package Toolbox Library
+ * @subpackage Forms Library
+ * @filesource
+*/
+/**
+* Include DocBlock
+*/
+require_once("class_db.inc");
+/**
+* Include DocBlock
+*/
+require_once("class_toolbox.inc");
+/**
+* Include DocBlock
+*/
+require_once("class_contact_form.inc");
+/**
+ * tell_friend
+ *
+ * Update on the tellfriend script this one now uses the contact_form class
+ * entends it and creates new class called tell_friend.
+ * That way it has the ability of the form display function built in to it.
+ *
+ *
+ * @package Toolbox Library
+ * @subpackage Forms Library
+ * @version $id$
+ * @copyright 2005 Gaslight Media
+ * @author Steve Sutton
+ * @license
+ */
+class tell_friend extends contact_form {
+
+ /**
+ * contact_form
+ *
+ * @access public
+ * @return void
+ */
+ function contact_form()
+ {
+ $this->CDB =& new GLM_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->styleLabel = "labelcell"; // css style for the labelcell
+ $this->fieldcell = "fieldcell"; // css style for the field input
+ $this->instructioncell = "instructioncell"; // css style for the field input
+ $this->submit_value = 'Send Email';
+ $this->subject = 'Tell a friend ';
+ $this->contact_db = 1; // if they have contact database or not
+ $this->get_form(); // the whole thing runs upon class creation
+ }
+
+ /**
+ * get_form: one function to rule them all
+ *
+ * @return void
+ * @access public
+ **/
+ function get_form()
+ {
+ if( $_POST )
+ {
+ if( $error = $this->form_process() )
+ {
+ echo '
Warning: The form was not sent, please review the errors below.
';
+ echo $this->display_form( $error );
+ }
+ }
+ else
+ {
+ echo $this->display_form();
+ }
+ }
+
+ /**
+ * set_DB_fields:
+ *
+ * @return void
+ * @access public
+ **/
+ function set_DB_fields()
+ {
+ $DB_fields[]=array('name'=>'friend_name', 'title'=>'Friends Name:', 'type' => 'text', 'req' => 1,'inst'=>'You need to enter Friends Name');
+ $DB_fields[]=array('name'=>'friend_email', 'title'=>'Friends Email:', 'type' => 'text', 'req' => 1,'inst'=>'You need to enter a valid email address');
+ $DB_fields[]=array('name'=>'message', 'title' =>'Message To Friend:', 'type' => 'desc');
+ $DB_fields[]=array('name'=>'your_lname', 'title'=>'Your Name:', 'type' => 'text', 'req' => 1,'inst'=>'You need to enter your name');
+ $DB_fields[]=array('name'=>'your_email', 'title'=>'Your Email:', 'type' => 'text', 'req' => 1,'inst'=>'You need to enter a valid email address');
+ $this->DB_fields = &$DB_fields;
+ }
+
+ /**
+ * form_process: process the form checking for any required form values as set up in the
+ * and send the email if the emails are valid.
+ * DB_fields array.
+ *
+ * @return error array if bad
+ * @access public
+ **/
+ function form_process()
+ {
+ $ban_words[] = "content-type";
+ $ban_words[] = "content-transfer-encoding";
+ $ban_words[] = "mime-version";
+ $ban_words[] = "cc\:";
+ $ban_words[] = "bcc\:";
+
+ if(is_array($_POST))
+ {
+ foreach($_POST as $k=>$v)
+ {
+ if( !is_array( $v ))
+ {
+ $_POST[$k] = trim(stripslashes($v));
+ }
+
+ foreach($ban_words as $k => $word)
+ {
+ $wordstr = "/$word/i";
+ if(preg_match($wordstr,$v))
+ {
+ // let's unset the $_POST array
+ foreach( $_POST as $key => $val )
+ {
+ $_POST[$key] = '';
+ }
+ // if we matched, return.
+ return( true );
+ }
+ }
+ }
+ }
+ if( !GLM_TOOLBOX::valid_email( $_POST['friend_email'] ) )
+ {
+ $error['friend_email'] = 1;
+ }
+ if( !GLM_TOOLBOX::valid_email( $_POST['your_email'] ) )
+ {
+ $error['your_email'] = 1;
+ }
+ foreach( $this->DB_fields as $value )
+ {
+ if( $value['req'] == 1 && $_POST[$value['name']] == '' )
+ {
+ $error[$value['name']] = 1;
+ }
+ }
+
+ if(count($error) > 0)
+ {
+ return($error);
+ }
+ // adding comments again
+ //mail the contact info to mail address.
+ $body = '
+
+
+
+
Dear '.$_POST["friend_name"].'
+
Your friend '.$_POST["your_lname"].' has been to http://www.4drinkspecials.com, and thought you might be interested in it.
+
+
+';
+ mail($_POST[friend_email],'Message From '.$_POST["your_lname"],$body,$headers);
+ echo '
Thank You, your message is sent.
';
+ }
+}
+?>
diff --git a/classes/class_template.inc b/classes/class_template.inc
new file mode 100755
index 0000000..217afc9
--- /dev/null
+++ b/classes/class_template.inc
@@ -0,0 +1,2758 @@
+
+ * $Id: class_template.inc,v 1.15 2006/10/04 19:35:12 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
+ *
+ *
+ * @package Toolbox Library
+ * @subpackage Template Library
+ * @filesource
+ *
+ */
+/**
+ * Require DocBlock
+ */
+require_once(BASE."classes/class_db.inc");
+/**
+ * Require DocBlock
+ */
+require_once(BASE."classes/class_toolbox.inc");
+/**
+ * Template Class :)
+ *
+ *
+ * $Id: class_template.inc,v 1.15 2006/10/04 19:35:12 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
+ *
For the page title and meta tags make a $title and $meta vars depending on
+ * weather or not it is the home page.
+ *
+ * if($catid == 1)
+ * {
+ * // title and meta description for home page only
+ * $title = '';
+ * $meta = '';
+ * }
+ * else
+ * {
+ * $title = $toolbox->title().' - Site Name';
+ * $meta = $toolbox->meta();
+ * }
+ *
+ *
+ *
+ *
+ * @package Toolbox Library
+ * @subpackage Template Library
+ * @category Template
+ * @author Steve Sutton
+ * @copyright 2005
+ * @version $Revision: 1.15 $
+ * @since $Date: 2006/10/04 19:35:12 $
+ *
+ * @todo update the phpdocs for all classes
+ * @todo add title for all the navigation links if and only if they have page title
+ * @todo some tutorial in the docs for how to set things up.
+ */
+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;
+ /**
+ * split
+ * how many per page to show (members only)
+ *
+ * @var mixed
+ * @access public
+ */
+ var $split;
+ /**
+ * paginate
+ *
+ * @var mixed
+ * @access public
+ */
+ var $paginate;
+ /**
+ * kiosk_sections
+ *
+ * @var mixed
+ * @access public
+ */
+ var $kiosk_sections;
+ /** @var string $php_ext pgae extension for php pages .php or .phtml */
+
+ /**
+ * GLM_TEMPLATE:Contsructor of the class
+ * This function is run on intialization.
+ * Any setup vars should be overwritten by creating a new class
+ * that extends this one and setting new vars in the constructor.
+ *
+ * @param integer $catid: catid Must be set
+ * @uses GLM_DB
+ * @example /media/homes/matrix/www/www.setup.com/index.php
+ *
+ * @return void
+ * @access public
+ **/
+ function GLM_TEMPLATE( $catid, $DB = NULL )
+ {
+ $this->catid = $catid; // sets $this->catid
+ $this->set_DB( &$DB ); // using a reference to $DB (should be started on setup.phtml
+ $this->split = 3;
+ $this->memb_toolbox = $this->memb_toolbox_array();
+ $this->memb_names = $this->memb_names_array();
+ $this->kiosk_sections = $this->kiosk_section_array();
+ switch( $GLOBALS['GLM_SERVER_ID'] )
+ {
+ case "devsys.gaslightmedia.com":
+ $this->member_mid_image_path = '/home/httpd/www/www.pellstonairport.com/images/midsized/';
+ $this->member_mid_image_url = 'http://devsys.gaslightmedia.com/www.pellstonairport.com/images/midsized/';
+ break;
+ case "ws1.gaslightmedia.com":
+ $this->member_mid_image_path = '/home/httpd/server/www.pellstonairport.com/images/midsized/';
+ $this->member_mid_image_url = 'http://www.pellstonairport.com/images/midsized/';
+ break;
+ }
+ $this->header_begin = "
"; // class="content" should not be used anymore
+ $this->header_end = "
"; // create style for p h1 h2 tags if needed try to keep it clean
+ $this->subheader_begin = "
";// should not be using h3 here duh go from 1 to 2 instead
+ $this->subheader_end = "
"; // 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'] );
+ $this->set_active_query(); // set active query string
+ }
+
+ /**
+ * memb_toolbox_array
+ *
+ * @access public
+ * @return string
+ */
+ function memb_toolbox_array()
+ {
+ static $memb_toolbox;
+ if( !is_array( $memb_toolbox ) )
+ {
+ $memb_toolbox[8] = array(10); // Transportation
+ $memb_toolbox[9] = array(8,9,12); // Attractions
+ $memb_toolbox[4] = array(3,4,5,6,7); // services
+ $memb_toolbox[5] = array(11); // Dining
+ $memb_toolbox[6] = array(1); // Lodging
+ $memb_toolbox[7] = array(2,13); // Area Info
+ }
+ return( $memb_toolbox );
+ }
+
+ /**
+ * kiosk_section_array
+ *
+ * @access public
+ * @return string
+ */
+ function kiosk_section_array()
+ {
+ static $kiosk_sections;
+ if( !is_array( $kiosk_sections ) )
+ {
+ $kiosk_sections[2] = 'flight.gif';
+ $kiosk_sections[3] = 'about.gif';
+ $kiosk_sections[4] = 'services.gif';
+ $kiosk_sections[5] = 'dining.gif';
+ $kiosk_sections[6] = 'lodging.gif';
+ $kiosk_sections[7] = 'info.gif';
+ $kiosk_sections[8] = 'transportation.gif';
+ $kiosk_sections[9] = 'attractions.gif';
+ }
+ return( $kiosk_sections );
+ }
+ /**
+ * memb_names_array
+ *
+ * @access public
+ * @return string
+ */
+ function memb_names_array()
+ {
+ static $memb_names;
+ if( !is_array( $memb_names ) )
+ {
+ $memb_names[8] = 'Transportation';
+ $memb_names[9] = 'Attractions';
+ $memb_names[4] = 'Services';
+ $memb_names[5] = 'Dining';
+ $memb_names[6] = 'Area Lodging';
+ }
+ return( $memb_names );
+ }
+
+ /**
+ * get_city_list
+ *
+ * @param mixed $catid
+ * @access public
+ * @return string
+ */
+ function get_city_list( $catid )
+ {
+ $out = '';
+ if( $memb_types = $this->memb_toolbox[$catid] )
+ {
+ $query = "select distinct city from member where inactive = 'f' and memb_type in (".implode(",",$memb_types).") order by city;";
+ if( $data = $this->DB->db_auto_get_data( $query ) )
+ {
+ $out .= '
+ ';
+ return( $out );
+ }
+
+ function member_first_letters()
+ {
+ $out = '';
+ if( $memb_types = $this->memb_toolbox[$_GET['catid']] )
+ {
+ if($_GET['memb_type'])
+ {
+ $query = "select distinct on ( substr(lower(name),1,1) ) substr(lower(name),1,1) as letter from member where memb_type = ".$_GET['memb_type']." and inactive = 'f'";
+ }
+ else
+ {
+ if( $_GET['city'] == 'Transportation' )
+ {
+ $query = "select distinct on ( substr(lower(name),1,1) ) substr(lower(name),1,1) as letter from member where inactive = 'f' and memb_type in (".implode(",",$memb_types).") order by letter;";
+ }
+ else
+ {
+ $query = "select distinct on ( substr(lower(name),1,1) ) substr(lower(name),1,1) as letter from member where inactive = 'f' and city = '".$_GET['city']."' and memb_type in (".implode(",",$memb_types).") order by letter;";
+ }
+ }
+ if( $data = $this->DB->db_auto_get_data( $query ) )
+ {
+ $out = '
' );
+ }
+ }
+
+ /**
+ * 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 ) );
+ }
+ }
+
+ /**
+ * call all class methods to set tho data elements
+ *
+ *
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]