+ ";
+ $count = 1;
+ foreach ($data as $row) {
+ if ($count == 1) {
+ $out .= "
+
+ ";
+ }
+ $out .= " "{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
+ */
+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");
+ }
+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 => "cellphone", title => "Cell 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 => "contactby",title => "Contact by",type => "text");
+
+ $DB_fields[] = array( name => "arrive1", title => "Arrive 1", type => "text");
+ $DB_fields[] = array( name => "depart1", title => "Depart 1", type => "text");
+ $DB_fields[] = array( name => "arrive2", title => "Arrive 2", type => "text");
+ $DB_fields[] = array( name => "depart2", title => "Depart 2", type => "text");
+ $DB_fields[] = array( name => "numberofgolfers",title => "Number of Golfers",type => "text");
+ $DB_fields[] = array( name => "days_playing_golf",title => "Days Playing Golf",type => "text");
+ $DB_fields[] = array( name => "property", title => "Property", type => "text");
+ //$DB_fields[] = array( name => "golfcourse", title => "Golf Course", type => "text");
+ $DB_fields[] = array( name => "golfcourse", title => "Golf Courses", type => "courses");
+ $DB_fields[] = array( name => "teetime", title => "Tee Times", type => "text");
+
+ $DB_fields[] = array( name => "heardabout", title => "Heard About", type => "drop", "drop"=>array(''=>'-- Options --','Internet'=>'Internet','Magazine Ad'=>'Magazine Ad','Newspaper'=>'Newspaper','Radio'=>'Radio','Referral'=>'Referral','Other'=>'Other'));
+ $DB_fields[] = array( name => "mail_ok", title => "Mail Ok?", type => "radio");
+ $DB_fields[] = array( name => "letstalkgolf", title => "Lets Talk Golf?", type => "radio");
+ $DB_fields[] = array( name => "interest", title => "Interest", type => "interest");
+ $DB_fields[] = array( name => "additionalinformation",title => "Additional Info", type => "desc");
+ // $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'];
+ }
+ }
+ }
+$data['bailout'] = " ------------------------------------------------------------------- ";
+$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 ";
+$data['bailout'] .= "with the word \"CANCEL\" on the subject line. You will then be removed ";
+$data['bailout'] .= "from future mailings. ";
+$data['bailout'] .= "".OWNER_EMAIL." ";
+$data['bailout'] .= "------------------------------------------------------------------- ";
+?>
diff --git a/admin/Contact/csv.inc b/admin/Contact/csv.inc
new file mode 100755
index 0000000..0fd20c7
--- /dev/null
+++ b/admin/Contact/csv.inc
@@ -0,0 +1,195 @@
+
+class CSV
+{
+ var $splitchar = '"';
+ var $read_topline = true;
+ var $lines_end_with_splitchar = false;
+ var $columns;
+ var $check_columns;
+
+ function parse_string($string)
+ {
+ if($this->splitchar=="@")
+ $quotereplace="!!!!xCROMULENTx!!!!";
+ else
+ $quotereplace="@@@@CROMULENT@@@@";
+ $string = preg_replace("/\"\"/", $quotereplace, $string);
+ $chars = preg_split("//", $string);
+
+ if($chars[(sizeof($chars)-1)] != "\n")
+ $chars[] = "\n";
+
+ $state=1;
+ for($count=0; $countsplitchar) // If it's the variable separator, tack this onto $record and start a new $cell.
+ {
+ $cell = preg_replace("/$quotereplace/", "\"", $cell);
+ $record[] = $cell;
+ unset($cell);
+ }
+ elseif($char=="\n") // If it's a linefeed, tack this onto $record, tack $record onto $table, and start again
+ {
+ $cell = preg_replace("/$quotereplace/", "\"", $cell);
+ if(!$this->lines_end_with_splitchar)
+ $record[] = $cell;
+ elseif($cell != '')
+ $record[] = $cell;
+ unset($cell);
+ $table[] = $record;
+ unset($record);
+ }
+ else // Otherwise, just add this onto $cell
+ $cell .= $char;
+ break;
+ case 2: // State when we're in-between quotation marks
+ if($char=='"') // If it's a quotation mark, save this value and switch to state 1
+ $state=1;
+ else // Otherwise, add this onto $cell
+ $cell .= $char;
+ break;
+ }
+ }
+
+ if(!$this->read_topline)
+ array_splice($table, 0, 1);
+
+ $lastindex = sizeof($table)-1;
+ if(sizeof($table[$lastindex])parse_string($data);
+ }
+
+ function set_splitchar($char)
+ {
+ $this->splitchar=$char;
+ }
+
+ function set_read_topline($bool)
+ {
+ $this->read_topline=$bool;
+ }
+
+ function set_lines_end_with_splitchar($bool)
+ {
+ $this->lines_end_with_splitchar=$bool;
+ }
+
+ // Okay, everything below this line is insane alpha code. If you have any troubles with
+ // this class, don't hesitate to wipe it out.
+
+ // Easy enough. You take the name of a column in a target table, and
+ // its corresponding index number (starting with zero :) in the text file.
+ function define_column($colname, $fieldno, $check_this=null)
+ {
+ $this->columns[$fieldno] = $colname;
+ if(isset($check_this)) $this->check_columns[]=$colname;
+ }
+
+ function check_columns()
+ {
+ $cols = func_get_args();
+ foreach($cols as $col)
+ $this->check_columns[] = $col;
+ }
+
+ function insert_into_table($data, $tablename, $conn)
+ {
+ $table = $conn->get_table_metadata($tablename);
+
+ foreach($data as $row)
+ {
+ // First - build an associative array of columns matched to values.
+ foreach($this->columns as $num=>$colname)
+ {
+ $value = $row[$num];
+ settype($value, $table[$colname]);
+ if( !$value && $colname == 'email' ){
+ $value="NULL";
+ }
+ elseif(is_string($value)){
+ $value="'".$value."'";
+ }
+
+ $rowdata[$colname] = $value;
+ }
+
+ // Next - if necessary, check to ensure the data isn't already
+ // in the database.
+ $date = date("m-d-Y");
+ if(isset($this->check_columns))
+ {
+ $sqlstring = "SELECT id FROM $tablename WHERE ";
+ if($rowdata['email'] != "NULL"){
+ $sqlstring .= "email = {$rowdata['email']} OR (";
+ }
+ $commachar = "";
+ foreach($this->check_columns as $check_colname)
+ {
+ $sqlstring .= $commachar.$check_colname.'='.$rowdata[$check_colname];
+ $commachar = " AND ";
+ }
+ if($rowdata['email'] != "NULL"){
+ $sqlstring .= ")";
+ }
+ // echo ''.$sqlstring.'
';
+
+ $rs = new ResultSet($sqlstring, $conn);
+ if($rs->numrows() > 0)
+ {
+ $duplicates[] = $rowdata;
+ $myData = $rs->next();
+ // update the duplicate records with new create_date
+ $query = "UPDATE $tablename set create_date = '$date' WHERE id = ".$myData['id'];
+ new Query($query, $conn);
+
+ continue;
+ }
+ }
+ // echo '';
+ // print_r($rowdata);
+ // echo ' ';
+ // exit;
+ // Assuming the continue statement didn't kick us out into another
+ // row, it's okay now to add the record into the database.
+ //
+ // Hey, quick thought - why does ALL program documentation take place
+ // in the plural second person? "WE" should think about that.
+ $sqlstring1 = "INSERT INTO $tablename(create_date,";
+ $sqlstring2 = ") VALUES ('$date',";
+ $commachar = "";
+
+ foreach($rowdata as $key=>$val)
+ {
+ $sqlstring1 .= $commachar.$key;
+ $sqlstring2 .= $commachar.$val;
+ $commachar = ", ";
+ }
+ $sqlstring = $sqlstring1.$sqlstring2.")";
+ new Query($sqlstring, $conn);
+ }
+ return $duplicates;
+ }
+
+ function insert_file_into_table($filename, $tablename, $conn)
+ {
+ $data = $this->read_file($filename);
+ return $this->insert_into_table($data, $tablename, $conn);
+ }
+}
diff --git a/admin/Contact/del_query.phtml b/admin/Contact/del_query.phtml
new file mode 100755
index 0000000..9d7dfb8
--- /dev/null
+++ b/admin/Contact/del_query.phtml
@@ -0,0 +1,18 @@
+
+
+Query is Deleted
+Close This
+Window
diff --git a/admin/Contact/download.phtml b/admin/Contact/download.phtml
new file mode 100755
index 0000000..614dacb
--- /dev/null
+++ b/admin/Contact/download.phtml
@@ -0,0 +1,129 @@
+
+/*****************************************************************************
+* File download
+* Author: Steve Sutton
+*
+* pass $query_string
+*
+*****************************************************************************/
+//$Id: download.phtml,v 1.2 2010/01/05 19:00:30 matrix Exp $
+require_once "../../setup.phtml";
+require_once "contact_setup.inc";
+if (!$dbd = db_connect()) {
+ die("Warning: FATAL! No Connection to DB_SERVER");
+}
+pg_exec($dbd, "BEGIN WORK;");
+$sql = "
+ PREPARE get_courses(int) AS
+ SELECT name
+ FROM courses
+ WHERE id IN (
+ SELECT course_id
+ FROM contact_course
+ WHERE contact_id = $1)
+ORDER BY name";
+pg_exec($dbd, $sql);
+$delimiter = str_replace("comma",",",$delimiter);
+$delimiter = str_replace("tab","\t",$delimiter);
+$delimiter = str_replace("csv",",",$delimiter);
+$delimiter = str_replace("pipe","|",$delimiter);
+
+if ($query_string) {
+ /* Remove the old reports if they exsists */
+ if (is_file("report.csv")) {
+ unlink("report.csv");
+ }
+ if (is_file("report.tar.gz")) {
+ unlink("report.tar.gz");
+ }
+ if (is_file("report.zip")) {
+ unlink("report.zip");
+ }
+
+ if (!$fp = fopen("report.csv","w")) {
+ html_error("Cant open report",0);
+ }
+ $query_string = stripslashes($query_string);
+ //$query_string = str_replace("SELECT ".ID.",","SELECT ",$query_string);
+
+ if (!$res = pg_Exec($dbd,$query_string)) {
+ echo "failed to ->".$query_string;
+ }
+ if (pg_numrows($res)>0) {
+ for($i=0;$i'.print_r($cData, true). '';
+ //exit;
+ $result_string = substr($result_string,0,strlen($result_string)-1);
+ if ($csv) {
+ $result_string = str_replace("|","\",\"",$result_string);
+ $result_string = "\"".$result_string."\"\n";
+ //echo $result_string;
+ } else {
+ $result_string = str_replace("|",$delimiter,$result_string);
+ $result_string = $result_string."\n";
+ }
+ fputs($fp,$result_string,strlen($result_string));
+ }
+ }
+ pg_exec($dbd, "COMMIT WORK;");
+ if (!fclose($fp)) {
+ html_error("Cant close filepointer",0);
+ }
+ chmod("report.csv",0660);
+ $output = "report.csv";
+
+ if ($file == "gz") {
+ $output = "report.tar.gz";
+ exec("tar -czvf report.tar.gz report.csv 2>&1",$result_array,$result);
+ if ($result != 0){
+ echo $result_array[0];
+ exit;
+ }
+ chmod("report.tar.gz",0660);
+ }
+
+ if ($file == "zip") {
+ $output = "report.zip";
+ exec("zip report report.csv 2>&1",$result_array,$result);
+ if ($result != 0){
+ echo $result_array[0];
+ exit;
+ }
+ chmod("report.zip",0660);
+ }
+ if ($file == "rpt") {
+ $output = "report.csv";
+ chmod("report.csv",0660);
+ }
+ if (ini_get('zlib.output_compression'))
+ {
+ ini_set('zlib.output_compression', 'Off');
+ }
+ header("Content-Type: application/force-download\n");
+ /* Correction for the stupid MSIE thing */
+ if (strstr(getenv('HTTP_USER_AGENT'), 'MSIE')) {
+ header("Content-Disposition: inline; filename=\"$output\"");
+ } else {
+ header("Content-Disposition: attachment; filename=\"$output\"");
+ }
+ //header("Location: $output");
+ $fn=fopen($output , "r");
+ fpassthru($fn);
+ @fclose($fn);
+ exit();
+} else {
+ header("Location: list_contact.phtml");
+}
+?>
diff --git a/admin/Contact/edit_autoresponse.phtml b/admin/Contact/edit_autoresponse.phtml
new file mode 100755
index 0000000..defed6c
--- /dev/null
+++ b/admin/Contact/edit_autoresponse.phtml
@@ -0,0 +1,151 @@
+
+//$Id: edit_autoresponse.phtml,v 1.1.1.1 2009/12/18 17:46:59 matrix Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+top("AutoReponse for Newsletter", HELP_BASE."response.phtml?key=edit+section");
+
+html_nav_table($nav,$navWidth);
+if(!$dbd = db_connect(CONN_STR))
+{
+ html_error(DB_ERROR_MSG.__LINE__, 1);
+}
+
+if( $id )
+{
+ $qs = "SET DATESTYLE TO 'SQL, US';";
+ if(!db_exec($dbd, $qs))
+ {
+ html_error(DB_ERROR_MSG.__LINE__, 1);
+ }
+ $qs = "SELECT id,subject,response,image,image2,image3,image_align,image2_align,image3_align
+ FROM news_response
+ WHERE id = $id";
+
+ if(!$res = db_exec($dbd, $qs))
+ {
+ html_error(DB_ERROR_MSG.__LINE__,1);
+ }
+ $row = db_fetch_array($res,0, PGSQL_ASSOC);
+}
+else
+{
+ $row['subject'] = '';
+ $row['response'] = '';
+ $row['image'] = '';
+ $row['image2'] = '';
+ $row['image3'] = '';
+}
+?>
+
+
+
+';
+footer();
+?>
+
+
diff --git a/admin/Contact/edit_contact.phtml b/admin/Contact/edit_contact.phtml
new file mode 100755
index 0000000..4aa62f7
--- /dev/null
+++ b/admin/Contact/edit_contact.phtml
@@ -0,0 +1,186 @@
+
+//$Id: edit_contact.phtml,v 1.2 2010/01/05 19:00:30 matrix Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+if(!$dbd = db_connect()) html_error(DB_ERROR_MSG, 1);
+
+if($id) { // If there's $id then editing
+ $qs = "SET DATESTYLE TO 'SQL,".DATEFORMAT."';";
+ $qs .= "SELECT ";
+ for($i=0;$i0){
+ $row = db_fetch_array($res,0, PGSQL_ASSOC);
+ }
+ else{
+ die("No such record");
+ }
+}
+else { // else new entry
+ // Grab the array of name from $DB_fields and stick it into $row
+ // Any default values must be placed inside this loop
+ $row = array();
+ for($i=0;$i
+
+";
+
+footer();
+?>
diff --git a/admin/Contact/edit_inquiry.phtml b/admin/Contact/edit_inquiry.phtml
new file mode 100755
index 0000000..556e11c
--- /dev/null
+++ b/admin/Contact/edit_inquiry.phtml
@@ -0,0 +1,87 @@
+db_connect();
+if(!$conn)
+ {
+ echo "No Database connection";
+ }
+top('Edit/Add Inquiry','');
+html_nav_table($nav,$navWidth);
+switch($Command)
+ {
+ case "Edit":
+ $qs = "SELECT *
+ FROM contact_inq
+ WHERE id = $id";
+ $result = pg_Exec($conn,$qs);
+ $header = pg_result($result,0,'header');
+ $description = pg_result($result,0,'description');
+ $image = pg_result($result,0,'image');
+ $pos = pg_result($result,0,'pos');
+ ?>
+
+
+
+ break;
+
+ case "Add Item":
+ ?>
+
+
+ break;
+
+}
+footer();
+?>
diff --git a/admin/Contact/emails.php b/admin/Contact/emails.php
new file mode 100755
index 0000000..d6d79f3
--- /dev/null
+++ b/admin/Contact/emails.php
@@ -0,0 +1,38 @@
+db_auto_get_data( $query );
+top( "Email HTML Newsletters", "");
+html_nav_table($nav,$navWidth);
+$out = '
+
+
+
+ Function:
+ Subject:
+ Last Update:
+
+ ';
+
+if( is_array( $data ) )
+{
+ foreach( $data as $key => $val )
+ {
+ $out .= '
+ [Edit]
+ [View]
+ '.$val["subject"].'
+ '.$val["last_update"].'
+ [Delete]
+ ';
+ }
+}
+$out .= '
';
+echo $out;
+footer();
+?>
diff --git a/admin/Contact/form.js b/admin/Contact/form.js
new file mode 100755
index 0000000..0bbabf0
--- /dev/null
+++ b/admin/Contact/form.js
@@ -0,0 +1,42 @@
+function reshow(object) {
+ artist = object.options[object.selectedIndex].text;
+ for (var i = document.track.names.length;i > 0;i--)
+ document.track.names.options[0] = null;
+ reloading = true;
+ showlinks();
+ document.track.names.options[0].selected = true;
+ return false;
+}
+
+function load(object) {
+ alert('Just testing: ' + object.options[object.selectedIndex].value);
+ //window.location.href = object.options[object.selectedIndex].value;
+ return false;
+}
+
+function showlinks() {
+ if (artist == 'Chris Rea') {
+ opt('cr/one.zip','The Road To Hell');
+ opt('cr/two.zip','Let\'s Dance');
+ }
+
+ if (artist == 'Annie Lennox') {
+ opt('al/why.zip','Why');
+ opt('al/wobg.zip','Walking on Broken Glass');
+ }
+
+ if (artist == 'Dina Carrol') {
+ opt('dc/track1.zip','Escaping');
+ opt('dc/track2.zip','Only Human');
+ }
+}
+
+function opt(href,text) {
+ if (reloading) {
+ var optionName = new Option(text, href, false, false)
+ var length = document.track.names.length;
+ document.track.names.options[length] = optionName;
+ }
+ else
+ document.write('',text,'<\/OPTION>');
+}
diff --git a/admin/Contact/golfCourses.sql b/admin/Contact/golfCourses.sql
new file mode 100755
index 0000000..42e991b
--- /dev/null
+++ b/admin/Contact/golfCourses.sql
@@ -0,0 +1,20 @@
+CREATE TABLE courses (
+ id SERIAL,
+ name TEXT,
+ PRIMARY KEY (id)
+);
+GRANT ALL ON courses TO nobody;
+GRANT ALL ON courses_id_seq TO nobody;
+
+CREATE TABLE contact_course (
+ id SERIAL,
+ contact_id INT
+ REFERENCES contact
+ ON DELETE CASCADE,
+ course_id INT
+ REFERENCES courses
+ ON DELETE CASCADE
+ );
+
+GRANT ALL ON contact_course TO nobody;
+GRANT ALL ON contact_course_id_seq TO nobody;
diff --git a/admin/Contact/help/contact.phtml b/admin/Contact/help/contact.phtml
new file mode 100755
index 0000000..bdec6d7
--- /dev/null
+++ b/admin/Contact/help/contact.phtml
@@ -0,0 +1,146 @@
+
+
+Help
+
+
+
+Contact Help
+
+
+switch ($key) {
+ case "search":
+ ?>
+Contact Database Search
+
+
+In this page you will start to build your query to the contact database.
+
+
+Search:
+
+
+Search records for:
+
+Here is where you will enter any keywords to use in the search. You must
+enter in something in the "Search records for" box. You may use more than one
+word (ie.) Sam Field.
+HINT: To help search use wildcards!
+? optional space
+* optional spaces
++ at least one space
+. will match anything
+
+NOTE: Leaving this fields blank will select all
+contacts. You can leave this blank and choose "Mail OK" true to get all
+contacts that allow emails.
+Search Where in fields:
+Tells the database to Search "Anywhere", "Beginning", or "Ending" of the
+fields to be searched.
+In Fields:
+Select from "In Fields" box. This determines what fields to look in for
+this search.
+HINT
+If you want to select more than one field to search in hold down the 'Ctrl' key while clicking on the selection to select or
+deselect it from the list.
+HINT
+You can use the "All" and "None" buttons to help you save time. This will
+select all or none of the fields in the boxes.
+Search Type:
+Select the type of search you want (ie.) an "Exact string" search will return
+only those fields which match the "Search records" for string exactly as compared
+to "Or" which will return any field that match any words you place into "Search
+records for"
+Case Sensitivity:
+This will turn "On" and "Off" the case sensitivity.
+(ie.)If you leave it "Off" and enter "bob" it will return anything like
+"bob","BOB","Bob","BOb","boB",or "BoB" turned "On" will match only "bob".
+
+
+Output of records
+
+Output Fields:
+Select from "Output Fields" box. This determines what fields will be in the
+output of this search.
+HINT
+You can use the "All" and "None" buttons to help you save time. This will
+select all or none of the fields in the boxes.
+HINT
+If you want to select more than
+one Output field hold down the 'Ctrl' key while clicking on the selection to select or
+deselect it from the list.
+File Output:
+Select from here if you wish to download a file with the results of this
+search. The file will built "On the Fly" so you can download it.
+NOTE: The text file is output as report.doc. This
+is only a text file.
+
+Delimiter:
+This determines what separates the fields in your file.
+
+
+ break;
+
+ case "List":
+ ?>
+List Contacts
+
+This page is for listing the results of your query. You can download files if
+you have selected a file type or edit and delete the contact found.
+
+[Edit]
+Link to contact edit page.
+
+[Delete]
+Link to Delete Contact.
+
+Download Files
+If you see this then there is a file you can download.
+Click on the file and you can download it.
+
+ break;
+
+ case "Edit":
+ ?>
+Edit a Contact
+
+This page is for editing and modifying an existing Contact in the database.
+When editing is complete, click on the "Submit Query" button. The database will
+be updated, and you will be directed back to the "List Contacts" page.
+
+
+
+
+Submit Query
+
+When you have made the changes you want to the Contact,
+you can click "Submit Query." This will update the information about the
+Contact in the database.
+
+
+ break;
+
+ case "Add":
+ ?>
+Add an Contact
+
+This page is for Adding Contacts in the database.
+When form is complete, click on the "Submit Query" button. The database will
+be updated, and you will be directed back to the "List Contacts" page.
+
+
+
+Submit Query
+
+When you have made the changes you want to the Contact,
+you can click "Submit Query." This will update the information about the
+Contact in the database.
+
+
+ break;
+
+}
+?>
+
+
+
+
diff --git a/admin/Contact/htmlarea.css b/admin/Contact/htmlarea.css
new file mode 100755
index 0000000..23bdf7d
--- /dev/null
+++ b/admin/Contact/htmlarea.css
@@ -0,0 +1,180 @@
+.htmlarea { background: #fff; }
+
+.htmlarea .toolbar {
+ cursor: default;
+ background: ButtonFace;
+ padding: 1px 1px 2px 1px;
+ border: 1px solid;
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+.htmlarea .toolbar table { font-family: tahoma,verdana,sans-serif; font-size: 11px; }
+.htmlarea .toolbar img { border: none; }
+.htmlarea .toolbar .label { padding: 0px 3px; }
+
+.htmlarea .toolbar .button {
+ background: ButtonFace;
+ color: ButtonText;
+ border: 1px solid ButtonFace;
+ padding: 1px;
+ margin: 0px;
+}
+.htmlarea .toolbar .buttonHover {
+ border: 1px solid;
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+.htmlarea .toolbar .buttonActive, .htmlarea .toolbar .buttonPressed {
+ padding: 2px 0px 0px 2px;
+ border: 1px solid;
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+.htmlarea .toolbar .buttonPressed {
+ background: ButtonHighlight;
+}
+.htmlarea .toolbar .indicator {
+ padding: 0px 3px;
+ overflow: hidden;
+ width: 20px;
+ text-align: center;
+ cursor: default;
+ border: 1px solid ButtonShadow;
+}
+
+.htmlarea .toolbar .buttonDisabled { background-color: #aaa; }
+
+.htmlarea .toolbar .buttonDisabled img {
+ filter: alpha(opacity = 25);
+ -moz-opacity: 25%;
+}
+
+.htmlarea .toolbar .separator {
+ position: relative;
+ margin: 3px;
+ border-left: 1px solid ButtonShadow;
+ border-right: 1px solid ButtonHighlight;
+ width: 0px;
+ height: 16px;
+ padding: 0px;
+}
+
+.htmlarea .toolbar .space { width: 5px; }
+
+.htmlarea .toolbar select { font: 11px Tahoma,Verdana,sans-serif; }
+
+.htmlarea .toolbar select,
+.htmlarea .toolbar select:hover,
+.htmlarea .toolbar select:active { background: FieldFace; color: ButtonText; }
+
+.htmlarea .statusBar {
+ border: 1px solid;
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+ padding: 2px 4px;
+ background-color: ButtonFace;
+ color: ButtonText;
+ font: 11px Tahoma,Verdana,sans-serif;
+}
+
+.htmlarea .statusBar .statusBarTree a {
+ padding: 2px 5px;
+ color: #00f;
+}
+
+.htmlarea .statusBar .statusBarTree a:visited { color: #00f; }
+.htmlarea .statusBar .statusBarTree a:hover {
+ background-color: Highlight;
+ color: HighlightText;
+ padding: 1px 4px;
+ border: 1px solid HighlightText;
+}
+
+
+/* Hidden DIV popup dialogs (PopupDiv) */
+
+.dialog {
+ color: ButtonText;
+ background: ButtonFace;
+}
+
+.dialog .content { padding: 2px; }
+
+.dialog, .dialog button, .dialog input, .dialog select, .dialog textarea, .dialog table {
+ font: 11px Tahoma,Verdana,sans-serif;
+}
+
+.dialog table { border-collapse: collapse; }
+
+.dialog .title {
+ background: #008;
+ color: #ff8;
+ border-bottom: 1px solid #000;
+ padding: 1px 0px 2px 5px;
+ font-size: 12px;
+ font-weight: bold;
+ cursor: default;
+}
+
+.dialog .title .button {
+ float: right;
+ border: 1px solid #66a;
+ padding: 0px 1px 0px 2px;
+ margin-right: 1px;
+ color: #fff;
+ text-align: center;
+}
+
+.dialog .title .button-hilite { border-color: #88f; background: #44c; }
+
+.dialog button {
+ width: 5em;
+ padding: 0px;
+}
+
+.dialog .buttonColor {
+ padding: 1px;
+ cursor: default;
+ border: 1px solid;
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+
+.dialog .buttonColor-hilite {
+ border-color: #000;
+}
+
+.dialog .buttonColor .chooser, .dialog .buttonColor .nocolor {
+ height: 0.6em;
+ border: 1px solid;
+ padding: 0px 1em;
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+
+.dialog .buttonColor .nocolor { padding: 0px; }
+.dialog .buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }
+
+.dialog .label { text-align: right; width: 6em; }
+.dialog .value input { width: 100%; }
+.dialog .buttons { text-align: right; padding: 2px 4px 0px 4px; }
+
+.dialog legend { font-weight: bold; }
+.dialog fieldset table { margin: 2px 0px; }
+
+.popupdiv {
+ border: 2px solid;
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+
+.popupwin {
+ padding: 0px;
+ margin: 0px;
+}
+
+.popupwin .title {
+ background: #fff;
+ color: #000;
+ font-weight: bold;
+ font-size: 120%;
+ padding: 3px 10px;
+ margin-bottom: 10px;
+ border-bottom: 1px solid black;
+ letter-spacing: 2px;
+}
+
+form { margin: 0px; border: none; }
diff --git a/admin/Contact/importcsv.phtml b/admin/Contact/importcsv.phtml
new file mode 100755
index 0000000..a9d140f
--- /dev/null
+++ b/admin/Contact/importcsv.phtml
@@ -0,0 +1,46 @@
+set_splitchar("|");
+ $csv->set_read_topline(false);
+ $csv->set_lines_end_with_splitchar(true);
+
+ $csv->define_column("fname", 2);
+ $csv->define_column("mname", 3);
+ $csv->define_column("lname", 4);
+ $csv->define_column("address", 8);
+ $csv->define_column("city", 10);
+ $csv->define_column("state", 11);
+ $csv->define_column("zip", 12);
+ $csv->define_column("country", 13);
+ $csv->define_column("title", 1);
+ $csv->define_column("suffix", 5);
+ $csv->define_column("organization", 7);
+ $csv->define_column("email", 14);
+ $csv->check_columns("fname", "lname", "city", "state");
+ $errs = $csv->insert_file_into_table($_FILES["contactfile"]["tmp_name"], "contact", $conn);
+
+ if(sizeof($errs)>0)
+ $alertstring = sizeof($errs)." record(s) were UPDATED because they were already in the database.";
+ else
+ $alertstring = "Contacts added successfully.";
+
+ print "\n";
+}
+?>
+ Add a contact
+
+
diff --git a/admin/Contact/index.phtml b/admin/Contact/index.phtml
new file mode 100755
index 0000000..f6c4fe2
--- /dev/null
+++ b/admin/Contact/index.phtml
@@ -0,0 +1,379 @@
+
+
+
+footer();
+?>
diff --git a/admin/Contact/list_contact.phtml b/admin/Contact/list_contact.phtml
new file mode 100755
index 0000000..226f6c4
--- /dev/null
+++ b/admin/Contact/list_contact.phtml
@@ -0,0 +1,271 @@
+
+
+
+
+html_nav_table($nav,$navWidth);
+if(NEWSLETTER)
+{
+$mquery = "SELECT id,subject FROM news_response;";
+$mres = db_exec($dbd,$mquery);
+while( $mrow = pg_fetch_array( $mres ) )
+{
+ $mailout[] = array( 'subject' => $mrow['subject'], 'id' => $mrow['id'] );
+}
+?>
+
+
+
+
+
+
+
+}?>
+
+
+
+
+
+$totalqs = substr_replace($qs," count(*) as total FROM ",strpos($qs,"SELECT")+7,strpos($qs,"FROM")-3);
+if(strpos($totalqs,"ORDER BY")!=0)
+ $totalqs = substr_replace($totalqs,"",strpos($totalqs,"ORDER"));
+if(!$totalres = db_exec($dbd,$totalqs))
+ html_error(DB_ERROR_MSG.__LINE__.$totalqs,1);
+if(count($totalres)==0)
+ $totalnum = 0;
+else
+ $totalnum = pg_result($totalres,0,"total");
+$qs .= " LIMIT ".ENTRIES_PER_PAGE." OFFSET ".$start;
+$res = db_exec($dbd,$qs);
+?>
+
+ Result(s)
+
+
+if(!$res) html_error(DB_ERROR_MSG.__LINE__.$qs,1);
+// What page are you on?
+if($start==0)
+ $page == 1;
+else
+ $page = ($start / ENTRIES_PER_PAGE) + 1;
+$totalpages = floor($totalnum / ENTRIES_PER_PAGE);
+$totalpages++;
+
+$result_string = "";
+$num = db_numrows($res);
+if(!$start)
+ $start = 0;
+$begin = 0;
+$ending = $num;
+// for paging results get a first page and last page link also
+// first page is easy use 0
+$first = 'First - ';
+// last page use total pages
+$lastpage = ' - Last ';
+if($totalnum > ENTRIES_PER_PAGE && ( $page != $totalpages ) )
+ {
+ $end = ENTRIES_PER_PAGE + $start;
+ }
+else
+ {
+ $end = $totalnum;
+ }
+$last = $start - ENTRIES_PER_PAGE;
+if(!$query_string)
+ {
+ $query_string = $qs;
+ $query_string = str_replace(" LIMIT ".ENTRIES_PER_PAGE." OFFSET ".$start,"",$query_string);
+ }
+$stuff = "query_string=".urlencode($query_string)."&file=".$file."&delimiter=".$delimiter."&csv=".$csv;
+if(($start - ENTRIES_PER_PAGE) < 0)
+ $prev = "PREV";
+else
+ $prev = "PREV ";
+if($end < $totalnum)
+ $next = "NEXT ";
+else
+ $next = "NEXT";
+ ?>
+
+
+
+ if($num!=0)
+ echo $first.$prev."-".($start+1)."-to-".$end."-".$next.$lastpage;
+ ?>
+
+
+
+if(count($res)>0)
+ {
+ for($i=$begin;$i<$ending;$i++)
+ {
+ if(!$row = db_fetch_array($res,$i,PGSQL_ASSOC))
+ html_error(DB_ERROR_MSG.__LINE__,1);;
+ for($b=1;$b
+ >
+
+ [Edit]
+
+ [Delete]
+
+
+
+ foreach($fields as $key) {
+ if($key != "id" && $key != "cust_id"
+ && $key != "userid" && $key != "usernum"
+ && $key != "usergroup" && $key != "passwd")
+ echo $row[$key]." ";
+ }
+ ?>
+
+
+
+ }
+ }
+ ?>
+
+
+if(isset($file) && $file != "" && db_numrows($res) > 0) {
+?>
+
+
+}
+html_nav_table($nav,5);
+footer();
+?>
diff --git a/admin/Contact/list_query.phtml b/admin/Contact/list_query.phtml
new file mode 100755
index 0000000..5228300
--- /dev/null
+++ b/admin/Contact/list_query.phtml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+if(!$dbd = db_connect()) html_error(DB_ERROR_MSG,0);
+
+$qs = "SELECT id,query_name
+ FROM query_db";
+
+if(!$res = db_exec($dbd,$qs)) html_error(DB_ERROR_MSG.$qs,0);
+
+for($i=0;$i
+
+
+
+ [Recall]
+
+ [Delete]
+ }?>
+
+
+
+}?>
+
+
+footer();
+?>
diff --git a/admin/Contact/mailout.phtml b/admin/Contact/mailout.phtml
new file mode 100755
index 0000000..6df7776
--- /dev/null
+++ b/admin/Contact/mailout.phtml
@@ -0,0 +1,170 @@
+
+
+Mailing out The Newsletter
+
+
+0)
+ {
+ for($a=0;$a0) {
+ // write the temp.to file
+ $mail = implode("\n",$mail);
+ $fp = fopen($ToFilename,"w");
+ fputs($fp,$mail,strlen($mail));
+ fclose($fp);
+}
+else {
+ $mail = "";
+}
+
+
+if($mail != "") {
+ // I am changing this to a two part mime type email
+ // html and text
+ // using class_html
+ $responseqs = "SELECT *
+ FROM news_response
+ WHERE id = $mail_id";
+ if(!$resres = db_exec($dbd,$responseqs))
+ html_error(DB_ERROR_MSG.$responseqs,0);
+
+ $responserow = db_fetch_array($resres,0,PGSQL_ASSOC);
+
+ $subject = trim($responserow['subject']);
+ $data['subject'] = &$subject;
+ $message = $responserow['response'];
+ // html part of email
+ //$data['response'] = stripslashes(nl2br($message));
+ $message = str_replace("IMAGE1","",$message);
+ $message = str_replace("IMAGE2","",$message);
+ $message = str_replace("IMAGE3","",$message);
+ $data['response'] = $message;
+ $data['image'] = add_image($responserow["image"],$responserow["image_align"]);
+ $data['image2'] = add_image($responserow["image2"],$responserow["image2_align"]);
+ $data['image3'] = add_image($responserow["image3"],$responserow["image3_align"]);
+ $data['url'] = URL_BASE;
+
+ $html = explode_template(NEWSLETTER_PROTOTYPE,$data);
+
+ // text part of email
+ $text = strip_tags($message);
+ $text .= "\n\n-------------------------------------------------------------------\n";
+ $text .= "You are receiving this message because you have expressed an interest in\n";
+ $text .= "receiving specials and information from ".SITENAME.". If you do not\n";
+ $text .= "wish to receive future items of this nature, please reply to this e-mail\n";
+ $text .= "with the word \"CANCEL\" on the subject line. You will then be removed \n";
+ $text .= "from future mailings.\n";
+ $text .= "-------------------------------------------------------------------\n";
+
+ // Write the temp.header file
+ $glm_headers = "NotifyAddr: ".OWNER_EMAIL."\n"
+ . "ProcessName: ".SITENAME."\n"
+ . "From: ".FROM_NEWS_EMAIL."\n"
+ . "ReportInterval: 2\n"
+ . "BlockSize: 1\n"
+ . "ProductionMode: ".PRODUCTION_MODE."\n";
+
+ $fp = fopen($HeadFilename,"w");
+ fputs($fp,$glm_headers,strlen($glm_headers));
+ fclose($fp);
+
+ $headers = "From: ".OWNER_EMAIL."\n".
+ "Return-To: ".OWNER_EMAIL."\n".
+ "To: ".OWNER_EMAIL."\n".
+ "Subject: $subject\n".
+ "Reply-to: ".REPLY_TO."\n".
+ "Mime-Version: 1.0\n".
+ "Content-Type: multipart/alternative; boundary=ContentBoundry\n\n";
+ $fp = fopen($BodyFilename,"w");
+ if(HTML_EMAIL=="ON"){
+ $body_html = '--ContentBoundry
+Content-Type: text/plain; charset="US-ASCII"
+'.$text.'
+--ContentBoundry
+Content-Type: text/html; charset="US-ASCII"
+
+'.$html.'
+
+--ContentBoundry--';
+ fputs($fp,$headers,strlen($headers));
+ fputs($fp,$body_html,strlen($body_html));
+ }
+ else{
+ fputs($fp,$headers,strlen($headers));
+ fputs($fp,$text,strlen($text));
+ }
+ fclose($fp);
+ // write the temp.ready file and your done!
+ $fp = fopen($ReadyFilename,"w");
+ fclose($fp);
+?>
+
+
+ Mail the current
+
+
+
+
+
+
+
+
+ You will recieve notification on the mailing task by email at =OWNER_EMAIL?>.
+
+
+
+ }
+ else {
+?>
+
+
+ Newsletter Not Sent!
+
+
+
+ }
+
+?>
+
+
diff --git a/admin/Contact/main.css b/admin/Contact/main.css
new file mode 100755
index 0000000..fef38df
--- /dev/null
+++ b/admin/Contact/main.css
@@ -0,0 +1,23 @@
+body {
+ background-color: #FFFFFF;
+}
+
+.navlink {
+ font-size: 80%;
+ font-family: arial;
+}
+
+td {
+ font-size: 80%;
+ font-family: arial,helvetica;
+}
+
+.theader {
+ font-size: 120%;
+ font-family: arial,helvetica;
+ color: #FFFFFF;
+}
+
+.theadertd {
+ background-color: #000080;
+}
diff --git a/admin/Contact/msg.js b/admin/Contact/msg.js
new file mode 100755
index 0000000..8ed837d
--- /dev/null
+++ b/admin/Contact/msg.js
@@ -0,0 +1,29 @@
+function glm_confirm(o) {
+ var p = o.msg.split("\n");
+ var k = 0;
+ for(i = 0;i < p.length;i++) {
+ if(k > p[i].length)
+ continue;
+ else
+ k = p[i].length;
+ }
+
+ var bound = "";
+ for(i = 0; i < k; i++) {
+ bound = bound+'_';
+ }
+ var str = bound+"\n\n"+o.msg+"\n\n"+bound+"\n\nAre You Sure?";
+ if(confirm(str)) {
+ if(o.popup == '1') {
+ var nw = new Object();
+ nw.url = o.url;
+ nw.name = o.popup.name;
+ nw.width = o.width;
+ nw.height = o.height;
+ glm_open(nw);
+ }
+ else {
+ location.replace(o.url);
+ }
+ }
+}
diff --git a/admin/Contact/newsletter_template.html b/admin/Contact/newsletter_template.html
new file mode 100755
index 0000000..5417be4
--- /dev/null
+++ b/admin/Contact/newsletter_template.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
diff --git a/admin/Contact/notes/ChangeLog b/admin/Contact/notes/ChangeLog
new file mode 100755
index 0000000..fc6c567
--- /dev/null
+++ b/admin/Contact/notes/ChangeLog
@@ -0,0 +1,327 @@
+2002-05-07 13:47 matrix
+
+ * contact_setup.inc, del_query.phtml, download.phtml,
+ edit_contact.phtml, form.js, index.phtml, list_contact.phtml,
+ list_query.phtml, mailout.phtml, main.css, msg.js,
+ query_contact.phtml, query_db.phtml, query_save.phtml,
+ update_contact.phtml, verify.js, wm.js, help/contact.phtml,
+ notes/ChangeLog, notes/Contact, notes/adm2.sql, notes/contact.sql,
+ notes/guest.sql: "version 2.4"
+
+2002-05-07 13:45 matrix
+
+ * contact.sql, contact_setup.inc, edit_contact.phtml,
+ list_contact.phtml, update_contact.phtml, notes/ChangeLog,
+ notes/contact.sql, notes/Contact: adding ChangeLog file and moving
+ sql file into notes. I have also set the insert part of
+ update_contact.phtml to use nextval to generate the PRIMEKEY so
+ this will work with previous version of th shop which don't have
+ the default set on cust_id
+
+2002-05-07 11:14 matrix
+
+ * contact.sql, contact_setup.inc, del_query.phtml, download.phtml,
+ edit_contact.phtml, form.js, index.phtml, list_contact.phtml,
+ list_query.phtml, mailout.phtml, main.css, msg.js,
+ query_contact.phtml, query_db.phtml, query_save.phtml,
+ update_contact.phtml, verify.js, wm.js, help/contact.phtml,
+ notes/adm2.sql, notes/guest.sql: testing out both contact and
+ customer table use
+
+2002-05-07 10:08 matrix
+
+ * form.js, msg.js, verify.js, wm.js: "putting javascript files in
+ dir"
+
+2002-05-07 09:57 matrix
+
+ * index.phtml: "all versions now 2.0"
+
+2002-05-07 09:57 matrix
+
+ * index.phtml: new file
+
+2002-05-07 09:44 matrix
+
+ * admin_constants.inc, contact.phtml, contact.sql,
+ contact_setup.inc, contact_test.sql, del_query.phtml,
+ download.phtml, edit_contact.phtml, index.html, list_contact.phtml,
+ list_cust_form.phtml, list_customers.phtml, list_query.phtml,
+ mailout.phtml, main.css, path.phtml, query_contact.phtml,
+ query_db.phtml, query_save.phtml, shopping_cart_setup.inc,
+ update_contact.phtml, help/contact.phtml, notes/adm2.sql,
+ notes/guest.sql: "merging final changes into one app"
+
+2002-03-14 11:23 matrix
+
+ * download.phtml: removed offending dot
+
+2002-03-12 10:32 matrix
+
+ * contact_setup.inc: file contact_setup.inc was initially added on
+ branch glm-Contact-2-0.
+
+2002-03-12 10:32 matrix
+
+ * download.phtml: file download.phtml was initially added on branch
+ glm-Contact-2-0.
+
+2002-03-12 10:32 matrix
+
+ * contact.phtml, contact_setup.inc, del_query.phtml,
+ download.phtml, edit_contact.phtml, list_contact.phtml,
+ list_query.phtml, mailout.phtml, query_contact.phtml,
+ query_db.phtml, update_contact.phtml: make it customer and ocntact
+
+2002-03-12 09:36 matrix
+
+ * list_cust_form.phtml, list_customers.phtml, path.phtml,
+ shopping_cart_setup.inc: updates
+
+2002-03-12 09:34 matrix
+
+ * contact.phtml, del_query.phtml, edit_contact.phtml,
+ list_contact.phtml, list_query.phtml, query_contact.phtml,
+ query_db.phtml, update_contact.phtml: prepare for merging
+
+2001-12-17 10:13 matrix
+
+ * list_contact.phtml, mailout.phtml: added ID
+
+2001-12-17 10:02 matrix
+
+ * list_contact.phtml, mailout.phtml: mail can't be sent by url
+
+2001-11-27 16:50 matrix
+
+ * contact.phtml, del_query.phtml, edit_contact.phtml,
+ list_contact.phtml, list_query.phtml, query_contact.phtml,
+ query_db.phtml, query_save.phtml, update_contact.phtml: needed to
+ update adding contacts to customer table as there is no default
+ value for cust_id
+
+2001-11-21 14:07 matrix
+
+ * contact.phtml, del_query.phtml, edit_contact.phtml,
+ list_contact.phtml, list_query.phtml, path.phtml,
+ query_contact.phtml, query_db.phtml, update_contact.phtml: using
+ setup.phtml not path.phtml
+
+2001-11-07 14:30 matrix
+
+ * list_contact.phtml: removed echo
+
+2001-11-07 14:27 matrix
+
+ * contact.phtml, del_query.phtml, edit_contact.phtml,
+ list_query.phtml, mailout.phtml, path.phtml, query_contact.phtml,
+ query_db.phtml, update_contact.phtml: updatng now using setup.phtml
+
+2001-11-07 14:24 matrix
+
+ * list_contact.phtml: correcting email out code
+
+2001-10-15 15:19 matrix
+
+ * contact.phtml, query_contact.phtml: adding date search
+
+2001-10-11 14:44 matrix
+
+ * list_contact.phtml: updating
+
+2001-10-11 14:34 matrix
+
+ * mailout.phtml: file mailout.phtml was initially added on branch
+ glm-Contact-2-0.
+
+2001-10-11 14:32 matrix
+
+ * list_contact.phtml, mailout.phtml: added autoresponder
+
+2001-09-25 10:14 matrix
+
+ * path.phtml: changed the path so we use one file
+
+2001-09-25 10:13 matrix
+
+ * contact.phtml: tr tag
+
+2001-07-02 14:29 matrix
+
+ * path.phtml: symplified the path files now this referes to the
+ main one in admin
+
+2001-06-22 08:55 matrix
+
+ * contact.phtml, contact.sql, edit_contact.phtml,
+ update_contact.phtml: adding field referred_by
+
+2001-06-19 08:50 matrix
+
+ * list_contact.phtml: no real change
+
+2001-06-19 08:49 matrix
+
+ * update_contact.phtml, edit_contact.phtml: modified for mailok
+
+2001-06-19 08:45 matrix
+
+ * list_contact.phtml: modified for errors on recalls
+
+2001-06-19 08:45 matrix
+
+ * edit_contact.phtml, update_contact.phtml: modified for mailok
+
+2001-06-18 10:08 matrix
+
+ * query_db.phtml: shop_query_db
+
+2001-06-18 10:08 matrix
+
+ * help/helpbg.gif: file helpbg.gif was initially added on branch
+ glm-Contact-shop-1-0.
+
+2001-06-18 10:08 matrix
+
+ * help/: closewindow.gif, contact.phtml, helpbg.gif: added images
+ to help folder
+
+2001-06-18 10:08 matrix
+
+ * help/closewindow.gif: file closewindow.gif was initially added on
+ branch glm-Contact-shop-1-0.
+
+2001-06-18 10:05 matrix
+
+ * query_contact.phtml: shop_query_db
+
+2001-06-18 10:04 matrix
+
+ * list_query.phtml: added nav links
+
+2001-06-18 10:03 matrix
+
+ * list_query.phtml: new shop query db
+
+2001-06-11 13:14 matrix
+
+ * list_contact.phtml: error correction
+
+2001-06-11 10:51 matrix
+
+ * list_contact.phtml: if there are no queries insert current
+
+2001-06-11 10:31 matrix
+
+ * list_contact.phtml: if there are no contacts html_error
+
+2001-06-11 10:18 matrix
+
+ * list_query.phtml: added nav to top of page
+
+2001-06-11 10:15 matrix
+
+ * help/contact.phtml: corrected paths to help images
+
+2001-06-08 09:17 matrix
+
+ * contact.sql: changing query table name to keep from messing up
+ other application
+
+2001-06-08 09:16 matrix
+
+ * help/contact.phtml: updateing help file
+
+2001-06-08 09:12 matrix
+
+ * contact.phtml: changed radio buttons on mail_ok to drop down
+
+2001-06-08 08:50 matrix
+
+ * list_contact.phtml: modified
+
+2001-06-08 08:46 matrix
+
+ * contact.phtml: made the mail_ok a drop down
+
+2001-06-07 14:54 matrix
+
+ * contact.phtml, list_contact.phtml, query_contact.phtml: updated
+ per gloriebe contactdb
+
+2001-06-07 14:06 matrix
+
+ * query_contact.phtml, help/contact.phtml: made changes for ereg
+ wildcards
+
+2001-06-06 15:51 matrix
+
+ * contact.phtml, contact.sql, edit_contact.phtml,
+ list_contact.phtml, query_contact.phtml, query_save.phtml,
+ update_contact.phtml: shop version
+
+2001-06-06 15:42 matrix
+
+ * main.css: added file
+
+2001-06-06 15:40 matrix
+
+ * report.rpt: "removed"
+
+2001-06-06 15:00 matrix
+
+ * contact.phtml, list_contact.phtml, query_contact.phtml,
+ update_contact.phtml, help/contact.phtml: worked out some bugs
+
+2001-06-06 13:41 matrix
+
+ * help/contact.phtml: changed path on images
+
+2001-06-06 13:38 matrix
+
+ * main.css: adding needed files
+
+2001-06-06 13:38 matrix
+
+ * main.css: file main.css was initially added on branch
+ glm-Contact-2-0.
+
+2001-06-05 11:17 matrix
+
+ * path.phtml: changed path to help
+
+2001-06-05 11:13 matrix
+
+ * path.phtml: changed path to help
+
+2001-06-05 10:45 matrix
+
+ * path.phtml: added path file
+
+2001-06-05 10:38 matrix
+
+ * contact.phtml, list_contact.phtml, query_contact.phtml: added
+ pipe and csv delimiter
+
+2001-05-31 12:43 matrix
+
+ * contact.phtml, contact.sql, contact_test.sql, del_query.phtml,
+ edit_contact.phtml, list_contact.phtml, list_query.phtml,
+ query_contact.phtml, query_db.phtml, query_save.phtml,
+ update_contact.phtml, help/contact.phtml: combining the contact
+ databases
+
+2001-04-04 13:42 matrix
+
+ * admin_constants.inc, index.html, list_cust_form.phtml,
+ list_customers.phtml, path.phtml, report.rpt,
+ shopping_cart_setup.inc, notes/adm2.sql, notes/guest.sql: Initial
+ revision
+
+2001-04-04 13:42 matrix
+
+ * admin_constants.inc, index.html, list_cust_form.phtml,
+ list_customers.phtml, path.phtml, report.rpt,
+ shopping_cart_setup.inc, notes/adm2.sql, notes/guest.sql: imported
+ sources
+
diff --git a/admin/Contact/notes/Contact b/admin/Contact/notes/Contact
new file mode 100755
index 0000000..937f46f
--- /dev/null
+++ b/admin/Contact/notes/Contact
@@ -0,0 +1,4 @@
+All application setup stuff will be in contact_setup.phtml
+1) right now if you add to the $fields array you'll still have to change
+ edit_contact.phtml and update_contact.phtml
+2) contact.sql - contains the query to build the contact table and query_db table
diff --git a/admin/Contact/notes/contact.sql b/admin/Contact/notes/contact.sql
new file mode 100755
index 0000000..e14c3c2
--- /dev/null
+++ b/admin/Contact/notes/contact.sql
@@ -0,0 +1,89 @@
+\connect - postgres
+
+CREATE TABLE "contact" (
+ "id" SERIAL PRIMARY KEY,
+ "create_date" date,
+ "fname" text,
+ "lname" text,
+ "company" text,
+ "address" text,
+ "address2" text,
+ "city" text,
+ "state" text,
+ "zip" text,
+ "country" text,
+ "phone" text,
+ "fax" text,
+ "email" text,
+ "user_agent" text,
+ "remote_addr" text,
+ "interest" text,
+ "mail_ok" boolean
+);
+
+REVOKE ALL on "contact" from PUBLIC;
+GRANT ALL on "contact" to "nobody";
+GRANT ALL on "contact" to "postgres";
+
+REVOKE ALL on "contact_id_seq" from PUBLIC;
+GRANT ALL on "contact_id_seq" to "nobody";
+GRANT ALL on "contact_id_seq" to "postgres";
+
+CREATE TABLE "query_db" (
+ "id" SERIAL PRIMARY KEY,
+ "query_name" text,
+ "query" text,
+ "file" text,
+ "delimiter" text
+);
+
+REVOKE ALL on "query_db" from PUBLIC;
+GRANT ALL on "query_db" to "nobody";
+GRANT ALL on "query_db" to "postgres";
+
+REVOKE ALL on "query_db_id_seq" from PUBLIC;
+GRANT ALL on "query_db_id_seq" to "nobody";
+GRANT ALL on "query_db_id_seq" to "postgres";
+
+CREATE TABLE "news_response" (
+ "id" SERIAL PRIMARY KEY,
+ "subject" text,
+ "response" text,
+ "image" text,
+ "image2" text,
+ "image3" text,
+ "image_align" text,
+ "image2_align" text,
+ "image3_align" text,
+ "mailout" date,
+ "last_update" date
+);
+
+REVOKE ALL on "news_response" from PUBLIC;
+GRANT ALL on "news_response" to "postgres";
+GRANT ALL on "news_response" to "nobody";
+GRANT ALL on "news_response_id_seq" to "nobody";
+
+INSERT INTO news_response (subject,response) values ('subject','response');
+
+CREATE UNIQUE INDEX contact_id_indx ON contact(id);
+CREATE INDEX contact_email_indx ON contact(email);
+CREATE INDEX contact_fname_indx ON contact(fname);
+CREATE INDEX contact_lname_indx ON contact(lname);
+CREATE INDEX contact_create_date_indx ON contact(create_date);
+CREATE UNIQUE INDEX news_response_id_indx ON contact(id);
+CREATE UNIQUE INDEX query_db_id_indx ON contact(id);
+
+CREATE TABLE contact_inq (
+ id serial NOT NULL,
+ header text,
+ pos integer,
+ description text,
+ image text
+);
+REVOKE ALL ON TABLE contact_inq FROM PUBLIC;
+GRANT ALL ON TABLE contact_inq TO nobody;
+REVOKE ALL ON TABLE contact_inq_id_seq FROM PUBLIC;
+GRANT ALL ON TABLE contact_inq_id_seq TO nobody;
+ALTER TABLE ONLY contact_inq
+ ADD CONSTRAINT contact_inq_pkey PRIMARY KEY (id);
diff --git a/admin/Contact/obj_db.inc b/admin/Contact/obj_db.inc
new file mode 100755
index 0000000..0ce77e7
--- /dev/null
+++ b/admin/Contact/obj_db.inc
@@ -0,0 +1,300 @@
+connect( $conn_str, $db_type );
+ // register_shutdown_function( "disconnect" );
+ }
+
+/*! @function connect
+ * @abstract Establishes a database connection
+
+ * @param $conn_str The string to feed to a database's connect function. Defaults to CONN_STR from the siteinfo.inc file.
+ * @param $db_type The type of database we're connecting to. Defaults to DB_TYPE from the "siteinfo.inc" file.
+ */
+ function connect( $conn_str = CONN_STR, $db_type = DB_TYPE )
+ {
+ $this->conn_str = $conn_str;
+ $this->db_type = $db_type;
+
+ switch( $db_type )
+ {
+ case "postgres":
+ $this->conn_id = pg_connect( $conn_str );
+ break;
+ default:
+ $this->conn_id = NULL;
+ }
+
+ return $this->conn_id;
+ }
+
+ function get_conn_id()
+ {
+ return $this->conn_id;
+ }
+
+ function get_db_type()
+ {
+ return $this->db_type;
+ }
+
+ function disconnect()
+ {
+ switch( $this->db_type )
+ {
+ case "postgres":
+ pg_close( $this->conn_id );
+ break;
+ }
+ $this->conn_id = NULL;
+ $this->conn_str = NULL;
+ $this->db_type = NULL;
+ }
+
+ function get_table_metadata($tablename)
+ {
+ // Like I'm even gonna bother looking this up for mySQL
+ switch( $this->db_type )
+ {
+ case "postgres":
+ $rs = new ResultSet("SELECT oid FROM pg_class WHERE relname='$tablename'", $this);
+ $row = $rs->next();
+ $rs = new ResultSet("SELECT * FROM pg_attribute WHERE attrelid=$row[0]", $this);
+ while($row = $rs->next())
+ {
+ $sqlstring="SELECT * FROM pg_type WHERE oid=$row[atttypid]";
+ $rs2 = new ResultSet($sqlstring, $this);
+ $attr_data = $rs2->next();
+
+ switch($attr_data["typname"])
+ {
+ case "varchar":
+ case "char":
+ case "name":
+ case "timestamp":
+ case "date":
+ case "time":
+ $phptype = "string";
+ break;
+ case "int8":
+ case "int4":
+ case "int2":
+ $phptype = "integer";
+ break;
+ case "float4":
+ case "float8":
+ $phptype="float";
+ break;
+ case "bool":
+ $phptype = "boolean";
+ break;
+ default:
+ $phptype = "string";
+ break;
+ }
+
+ $table[($row['attname'])] = $phptype;
+ }
+ return $table;
+ break;
+ }
+ }
+ }
+
+/*! @class ResultSet
+ * @abstract Holds a set of results for a specific query
+ * @discussion This class attempts to rip off Java's ResultSet class as much
+ as is humanly possible. Right now enough code is in place for a
+ simple "while( $row = $resultset->next() )", but there's a LOT
+ of room for expansion in this class.
+ */
+class ResultSet
+ {
+ var $conn; // Our current connection object
+ var $db_type; // Our connection's database type
+ var $sqlstring; // This object's SQL query string
+ var $result; // This object's result ID
+ var $numrows; // The number of rows in this object's resultset
+ var $currentpos; // Our current row position in the ResultSet
+
+/*! @function ResultSet
+ * @abstract ResultSet constructor
+ * @discussion Executes the SQL query, then stores the result pointer and other class variables.
+
+ * @param $sqlstring The SQL string by which to search.
+ * @param $conn The DB_Conn object to use - creates a default connection if none is provided.
+ */
+ function ResultSet( $sqlstring, $conn = NULL )
+ {
+ if( !$conn )
+ $this->conn = new DB_Conn();
+ else
+ $this->conn = $conn;
+
+ $this->db_type = $conn->get_db_type();
+ $this->sqlstring = $sqlstring;
+ $this->currentpos = "-1";
+
+ switch( $this->db_type )
+ {
+ case "postgres":
+ $this->result = pg_exec( $conn->get_conn_id(), $sqlstring );
+ $this->numrows = pg_numrows( $this->result );
+ break;
+ }
+
+ if( !$this->numrows || $this->numrows < 0 )
+ $this->numrows=0;
+ }
+
+/*! @function next
+ * @abstract Returns the next row in the database
+ * @discussion Fairly simplistic - advances the position pointer by 1, and returns that row in the form of an array.
+
+ * @return $row An associative array containing the current row in the resultset.
+ */
+ function next()
+ {
+ $this->currentpos = $this->currentpos + 1;
+ if( $this->currentpos == $this->numrows ) return NULL;
+
+ switch( $this->db_type )
+ {
+ case "postgres":
+ return pg_fetch_array( $this->result, $this->currentpos );
+ break;
+ }
+ }
+
+/*! @function numrows
+ * @abstract Number of rows in the resultset.
+ * @result $this->numrows Numrows class variable
+ */
+ function numrows()
+ {
+ return $this->numrows;
+ }
+
+/*! @function reset
+ * @abstract Return to the beginning of the resultset (sets $this->currentpos to -1)
+ */
+ function reset()
+ {
+ $this->currentpos = "-1";
+ }
+
+ }
+
+/*! @class Query
+ * @abstract Designed to execute a quick, response-less query
+ * @discussion This was just a quick hack for stuff like INSERTs where we don't
+ care what the database says back. It probably could be combined
+ pretty successfully with the ResultSet class for increased
+ simplicity. Especially since the "affected_row()" method beings
+ to overlap ResultSet's functionality.
+ */
+class Query
+ {
+ var $conn; // Our database connection object
+ var $sqlstring; // The SQL string of this query
+ var $oid; // The result's OID (for postgres).
+ var $db_type; // The type of DB to which we're connecting
+
+/*! @function Query
+ * @abstract Query constructor.
+ * @param $sqlstring SQL string to send to database for processing
+ * @param $conn Database connection object (a default is created if none are provided)
+ */
+ function Query( $sqlstring = NULL, $conn = NULL )
+ {
+ if( $sqlstring )
+ $this->exec_query( $sqlstring, $conn );
+ }
+
+/*! @function exec_query
+ * @abstract Executes a query, stores the transaction ID in class variable "$oid".
+ * @param $sqlstring SQL string to send to database for processing
+ * @param $conn Database connection object (a default is created if none are provided)
+ */
+ function exec_query( $sqlstring, $conn = NULL )
+ {
+ if( !$conn )
+ {
+ if( !$this->conn )
+ $this->conn = new DB_Conn();
+ }
+ else
+ $this->conn = $conn;
+
+ $conn = $this->conn;
+ $this->db_type = $conn->get_db_type();
+ $this->sqlstring = $sqlstring;
+
+ switch( $this->db_type )
+ {
+ case "postgres":
+ $this->oid = pg_exec( $conn->get_conn_id(), $sqlstring );
+ if( $this->oid < 0 ) $this->oid = NULL;
+ break;
+ }
+ }
+
+/*! @function affected_row
+* @abstract Returns a table row affected by the last query
+ * @discussion Passing this method a table will return a ResultSet object containing
+ the table row affected by the previous query.
+
+ @param $table A string containing the name of the table to check
+ @result $rs A ResultSet object containing the affeected row
+ */
+ function affected_row( $table )
+ {
+ $sqlstring = "SELECT * FROM $table WHERE oid=$this->oid";
+ $rs = new ResultSet( $sqlstring, $this->conn );
+
+ return $rs;
+ }
+
+/*! @function oid
+ * @abstract Returns the OID of the last database transaction
+ */
+ function oid()
+ {
+ return $this->oid;
+ }
+ }
+
+?>
diff --git a/admin/Contact/preview.phtml b/admin/Contact/preview.phtml
new file mode 100755
index 0000000..2561baf
--- /dev/null
+++ b/admin/Contact/preview.phtml
@@ -0,0 +1,20 @@
+
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+$query = "SELECT * FROM news_response WHERE id = $id";
+$res = db_auto_get_data($query, CONN_STR);
+$data['url'] = URL_BASE;
+$data['subject'] = $res[0]["subject"];
+$response = $res[0]["response"];
+$response = str_replace("IMAGE1","",$response);
+$response = str_replace("IMAGE2","",$response);
+$response = str_replace("IMAGE3","",$response);
+$data['response'] = $response;
+$data['image'] = add_image($res[0]["image"],$res[0]['image_align']);
+$data['image2'] = add_image($res[0]["image2"],$res[0]['image2_align']);
+$data['image3'] = add_image($res[0]["image3"],$res[0]['image3_align']);
+
+$page = explode_template(NEWSLETTER_PROTOTYPE,$data);
+echo $page;
+?>
diff --git a/admin/Contact/query_contact.phtml b/admin/Contact/query_contact.phtml
new file mode 100755
index 0000000..2e6647c
--- /dev/null
+++ b/admin/Contact/query_contact.phtml
@@ -0,0 +1,406 @@
+ $ival )
+ {
+ $query_string .= " AND interest $operator ':$ival:'";
+ }
+ }
+ if (is_array($_POST['cors'])) {
+ $query_string .= " AND id in (
+ SELECT contact_id
+ FROM contact_course
+ WHERE course_id in (".implode(",", $_POST['cors'])."))";
+ }
+ if(isset($fp_month)) {
+ $fp_str = mktime(0,0,0,$fp_month,$fp_day,$fp_year);
+ $tp_str = mktime(0,0,0,$tp_month,$tp_day,$tp_year);
+ $fa_str = mktime(0,0,0,$fa_month,$fa_day,$fa_year);
+ $ta_str = mktime(0,0,0,$ta_month,$ta_day,$ta_year);
+
+ if($fp_str<$tp_str) {
+ $fp_date = $fp_month."/".$fp_day."/".$fp_year;
+ $tp_date = $tp_month."/".$tp_day."/".$tp_year;
+ $query_string .= " AND purch_date >= '$fp_date'
+ AND purch_date < '$tp_date'";
+ }
+ if($fa_str<$ta_str) {
+ $fa_date = $fa_month."/".$fa_day."/".$fa_year;
+ $ta_date = $ta_month."/".$ta_day."/".$ta_year;
+ $query_string .= " AND access_date >= '$fa_date'
+ AND access_date < '$ta_date'";
+ }
+ if($fp_str>$tp_str) {
+ $fp_date = $fp_month."/".$fp_day."/".$fp_year;
+ $tp_date = $tp_month."/".$tp_day."/".$tp_year;
+ $query_string .= " AND purch_date < '$tp_date'";
+ }
+ if($fa_str>$ta_str) {
+ $fa_date = $fa_month."/".$fa_day."/".$fa_year;
+ $ta_date = $ta_month."/".$ta_day."/".$ta_year;
+ $query_string .= " AND access_date < '$ta_date'";
+ }
+ }
+ if(isset($fc_month)) {
+ $fc_str = mktime(0,0,0,$fc_month,$fc_day,$fc_year);
+ $tc_str = mktime(0,0,0,$tc_month,$tc_day,$tc_year);
+
+ if($fc_str<$tc_str) {
+ $fc_date = $fc_month."/".$fc_day."/".$fc_year;
+ $tc_date = $tc_month."/".$tc_day."/".$tc_year;
+ $query_string .= " AND create_date >= '$fc_date'
+ AND create_date <= '$tc_date'";
+ }
+ if($fc_str>$tc_str) {
+ $fc_date = $fc_month."/".$fc_day."/".$fc_year;
+ $tc_date = $tc_month."/".$tc_day."/".$tc_year;
+ $query_string .= " AND create_date < '$tc_date'";
+ }
+ }
+}
+else {
+ if(!$dbd = db_connect()) html_error(DB_ERROR_MSG,0);
+
+ $qs = "SELECT query_name,query,delimiter,file
+ FROM query_db
+ WHERE id = $query_no";
+
+ if(!$res = db_exec($dbd,$qs)) html_error(DB_ERROR_MSG.$qs,0);
+ $row = db_fetch_array($res,0,PGSQL_ASSOC);
+ $query_name = $row[query_name];
+ $query_string = $row[query];
+ $file = $row[file];
+ $delimiter = $row[delimiter];
+}
+
+/* Thought the customer would like to see what's in the query */
+$showq = str_replace("SELECT","Return\n",$query_string);
+$showq = str_replace( "\nFROM\t".TABLE." \nWHERE\t".WHERE."\nAND\t",
+" \nfrom the contact database \nwhere ",$showq);
+$showq = str_replace( "\nFROM\t".TABLE." \nWHERE\t".WHERE."\n",
+" \nfrom the contact database",$showq);
+$showq = str_replace("fname","first name",$showq);
+$showq = str_replace("cust_id,","",$showq);
+$showq = str_replace("lname","last name",$showq);
+$showq = str_replace("!~*","does not contain",$showq);
+$showq = str_replace("!~","does not contain",$showq);
+$showq = str_replace("~*","contains",$showq);
+$showq = str_replace("~","is in",$showq);
+$showq = str_replace("does not contain '^"," does not start with ",$showq);
+$showq = str_replace("contains '^"," starts with ",$showq);
+$showq = str_replace("is in '^"," starts with ",$showq);
+$showq = str_replace("$"," in the ending ",$showq);
+$showq = str_replace("OR","or",$showq);
+$showq = str_replace("AND","and",$showq);
+$showq = str_replace("'","",$showq);
+if(!$ALL) {
+ if($case == "OFF") {
+ $showq .= "\n(case insensitive match)";
+ } else {
+ $showq .= "\n(case sensitive match)";
+ }
+}
+if(isset($file) && $file != "") {
+ $showq .= "\noutput 1 file in ";
+ if($file == "rpt") {
+ $showq .= "text";
+ }elseif($file == "gz") {
+ $showq .= "tar ball";
+ }else {
+ $showq .= "zip";
+ }
+ if($delimiter == "csv")
+ $showq .= " format using ".$delimiter;
+ else
+ $showq .= " format using ".$delimiter." as delimiter";
+}
+$showq .= ".";
+
+
+$query = addslashes($query_string);
+
+top("QUERY BUILDER PAGE","");
+html_nav_table($nav,$navWidth);
+?>
+
+
+
+
+
+
+
+
+/* Save the query with (current) as query_name */
+if(!$dbd = db_connect()) html_error("Cant connect",0);
+
+$qs = "SELECT id
+ FROM query_db
+ WHERE query_name = '(current)'";
+
+if(!$res = @db_exec($dbd,$qs)) html_error(DB_ERROR_MSG.$qs,0);
+
+if(!$row = @db_fetch_array($res,0,PGSQL_ASSOC)) {
+ $qs = "INSERT
+ INTO query_db
+ (query_name,query,file,delimiter)
+ VALUES ('(current)','$query','$file','$delimiter')";
+}
+else {
+ $qs = "UPDATE query_db
+ SET query = '$query',
+ file = '$file',
+ delimiter = '$delimiter'
+ WHERE id = $row[id]";
+}
+@db_close($dbd);
+
+if(!db_auto_exec($qs)) html_error(DB_ERROR_MSG.$qs,0);
+
+footer();
+?>
diff --git a/admin/Contact/query_db.phtml b/admin/Contact/query_db.phtml
new file mode 100755
index 0000000..9e7d57e
--- /dev/null
+++ b/admin/Contact/query_db.phtml
@@ -0,0 +1,20 @@
+
+Query is saved as
+Close This
+Window
diff --git a/admin/Contact/query_save.phtml b/admin/Contact/query_save.phtml
new file mode 100755
index 0000000..61c4a0d
--- /dev/null
+++ b/admin/Contact/query_save.phtml
@@ -0,0 +1,18 @@
+
+
+
+
+ Name of Report
+
+
+
+
+
+
+
diff --git a/admin/Contact/update_autoresponse.phtml b/admin/Contact/update_autoresponse.phtml
new file mode 100755
index 0000000..01aa848
--- /dev/null
+++ b/admin/Contact/update_autoresponse.phtml
@@ -0,0 +1,304 @@
+".$qs,1);
+
+ $location = "emails.php";
+ break;
+
+ case "Insert":
+ $dbd = db_connect(CONN_STR);
+if( $image == '' ) $image = 'none';
+ if( $image2== '' ) $image2= 'none';
+ if( $image3== '' ) $image3= 'none';
+ if ($image == 'none' || $delimage == 'TRUE')
+ {
+ $img_upload = 'FALSE';
+ }
+ else
+ {
+ $img_upload = 'TRUE';
+ }
+
+ if ($image2 == 'none' || $delimage2 == 'TRUE')
+ {
+ $img_upload2 = 'FALSE';
+ }
+ else
+ {
+ $img_upload2 = 'TRUE';
+ }
+
+ if ($image3 == 'none' || $delimage3 == 'TRUE')
+ {
+ $img_upload3 = 'FALSE';
+ }
+ else
+ {
+ $img_upload3 = 'TRUE';
+ }
+
+ if ($img_upload == 'TRUE')
+ {
+ $image_name = process_image($image,$image_name);
+ if($oldimage != '')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage");
+ @unlink(RESIZED_PATH."/$oldimage");
+ @unlink(MIDSIZED_PATH."/$oldimage");
+ @unlink(THUMB_PATH."/$oldimage");
+ }
+ }
+ elseif ($img_upload == 'FALSE')
+ {
+ if($delimage == 'TRUE')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage");
+ @unlink(RESIZED_PATH."/$oldimage");
+ @unlink(MIDSIZED_PATH."/$oldimage");
+ @unlink(THUMB_PATH."/$oldimage");
+ $image_name = '';
+ }
+ else
+ {
+ $image_name = $oldimage;
+ }
+ }
+
+ // ***IMAGE TWO***
+ if ($img_upload2 == 'TRUE')
+ {
+ $image2_name = process_image($image2,$image2_name);
+ if($oldimage2 != '')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage2");
+ @unlink(RESIZED_PATH."/$oldimage2");
+ @unlink(MIDSIZED_PATH."/$oldimage2");
+ @unlink(THUMB_PATH."/$oldimage2");
+ }
+ }
+ elseif ($img_upload2 == 'FALSE')
+ {
+ if($delimage2 == 'TRUE')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage2");
+ @unlink(RESIZED_PATH."/$oldimage2");
+ @unlink(MIDSIZED_PATH."/$oldimage2");
+ @unlink(THUMB_PATH."/$oldimage2");
+ $image2_name = '';
+ }
+ else
+ {
+ $image2_name = $oldimage2;
+ }
+ }
+
+
+ // ***IMAGE THREE***
+ if ($img_upload3 == 'TRUE')
+ {
+ $image3_name = process_image($image3,$image3_name);
+ if($oldimage3 != '')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage3");
+ @unlink(RESIZED_PATH."/$oldimage3");
+ @unlink(MIDSIZED_PATH."/$oldimage3");
+ @unlink(THUMB_PATH."/$oldimage3");
+ }
+ }
+ elseif ($img_upload3 == 'FALSE')
+ {
+ if($delimage3 == 'TRUE')
+ {
+ @unlink(ORIGINAL_PATH."/$oldimage3");
+ @unlink(RESIZED_PATH."/$oldimage3");
+ @unlink(MIDSIZED_PATH."/$oldimage3");
+ @unlink(THUMB_PATH."/$oldimage3");
+ $image3_name = '';
+ }
+ else
+ {
+ $image3_name = $oldimage3;
+ }
+ }
+ if(!$dbd) html_error(DB_ERROR_MSG,1);
+
+ $qs = "INSERT INTO news_response
+ (last_update,subject,response, image,image2,image3, image_align,image2_align,image3_align)
+ VALUES
+ (current_date,'$subject','$response','$image_name','$image2_name','$image3_name','$image_align','$image2_align','$image3_align')";
+
+ if(!$res = db_exec($dbd,$qs))
+ {
+ echo pg_errormessage($res);
+ html_error(DB_ERROR_MSG.$qs,1);
+ }
+
+ $location = "emails.php";
+
+ break;
+
+ case "Cancel":
+ $location = "emails.php";
+ break;
+
+ case "Delete":
+ $dbd = db_connect(CONN_STR);
+ db_exec( $dbd, "BEGIN WORK" );
+ $query = "select image,image2,image3 from news_response where id = $id;";
+ $res = db_exec($dbd,$query);
+ for( $i = 1; $i <= 3; $i++ )
+ {
+ $imagename = ( $i == 1 ) ? 'image' : 'image'.$i ;
+ if( $img = pg_result( $res, 0 , $imagename ) )
+ {
+ @unlink( ORIGINAL_PATH.'/'.$img );
+ @unlink( RESIZED_PATH.'/'.$img );
+ @unlink( MIDSIZED_PATH.'/'.$img );
+ @unlink( THUMB_PATH.'/'.$img );
+ }
+ }
+ $query = "delete from news_response where id = $id;";
+ db_exec( $dbd, $query );
+ db_exec( $dbd, "COMMIT WORK" );
+ $location = "emails.php";
+ break;
+
+ default:
+ html_error("incorrect value for Command",1);
+ break;
+}
+
+header("Location: $location");
+?>
diff --git a/admin/Contact/update_contact.phtml b/admin/Contact/update_contact.phtml
new file mode 100755
index 0000000..7bc40b4
--- /dev/null
+++ b/admin/Contact/update_contact.phtml
@@ -0,0 +1,260 @@
+
diff --git a/admin/Contact/update_inquiry.phtml b/admin/Contact/update_inquiry.phtml
new file mode 100755
index 0000000..98a822d
--- /dev/null
+++ b/admin/Contact/update_inquiry.phtml
@@ -0,0 +1,174 @@
+db_connect();
+if(!$conn)
+ {
+ echo "No Database connection";
+ }
+if($image == "none" || $image == "")
+ {
+ $image_name = $oldimage;
+ }
+else
+ {
+ $image_name = process_image($image,$image_name);
+ @unlink(ORIGINAL_PATH."/".$oldimage);
+ @unlink(RESIZED_PATH.$oldimage);
+ @unlink(THUMB_PATH.$oldimage);
+ @unlink(MIDSIZED_PATH.$oldimage);
+
+ }
+if($deleteimage == "1")
+ {
+ $image_name = "";
+
+ @unlink(ORIGINAL_PATH."/".$oldimage);
+ @unlink(RESIZED_PATH.$oldimage);
+ @unlink(THUMB_PATH.$oldimage);
+ @unlink(MIDSIZED_PATH.$oldimage);
+ }
+
+switch($Command)
+ {
+ case "Move":
+ $qs = "SELECT pos,id
+ FROM contact_inq
+ WHERE id = $id";
+
+ if(!$result = db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+
+ $data = db_fetch_array($result,0,PGSQL_ASSOC);
+ $pos = $data['pos'];
+
+ if($newpos < $pos)
+ {
+ $qs = "SELECT id,pos
+ FROM contact_inq
+ WHERE pos < $pos
+ AND pos >= $newpos
+ ORDER BY pos";
+
+ if(!$res = db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+
+ $counter = ($newpos + 1);
+ for($i=0;$i $pos
+ AND pos <= $newpos
+ ORDER BY pos";
+
+ if(!$res = db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+
+ $counter = ($pos);
+ for($i=0;$i $oldpos
+ ORDER BY pos";
+
+ $res2 = db_exec($conn,$qs);
+ $oldcatid_counter = $oldpos;
+ for($i=0;$i
diff --git a/admin/Contact/verify.js b/admin/Contact/verify.js
new file mode 100755
index 0000000..a254639
--- /dev/null
+++ b/admin/Contact/verify.js
@@ -0,0 +1,72 @@
+function isblank(s) {
+ for(var i = 0; i < s.length; i++) {
+ var c = s.charAt(i);
+ if((c != ' ') && (c != '\n') && (c != '\t'))
+ return(false);
+ }
+ return(true);
+}
+
+function verify(f) {
+ var msg;
+ var empty_fields = "";
+ var errors = "";
+
+ for(var i = 0; i < f.length; i++) {
+ var e = f.elements[i];
+ if(((e.type == "text") || (e.type == "textarea")) && !e.optional) {
+ if((e.value == null) || (e.value == "") || isblank(e.value)) {
+ empty_fields += "\n " + e.r;
+ continue;
+ }
+
+ if(e.d) {
+ if(isNaN(Date.parse(e.value)))
+ errors += "- The field " +e.r+" must be formated like 01/17/2001\n";
+ }
+ if(e.numeric || (e.min != null) || (e.max != null)) {
+ if(e.i) {
+ var v = parseInt(e.value);
+ if(v != e.value) {
+ errors += "- The field " +e.r + " must be a ";
+ errors += "number with no decimal\n";
+ continue;
+ }
+ }
+ else
+ var v = parseFloat(e.value);
+ if(isNaN(v) ||
+ ((e.min != null) && (v < e.min)) ||
+ ((e.max != null) && (v > e.max))) {
+
+ errors += "- The field " + e.r + " must be a number";
+ if(e.min != null)
+ errors += " that is greater than " + e.min;
+ if(e.max != null && e.min != null)
+ errors += " and less than " + e.max;
+ else if (e.max != null)
+ errors += " that is less than " + e.max;
+ errors += ".\n";
+ }
+ }
+ }
+ }
+
+ if(!empty_fields && !errors)
+ return(true);
+
+ msg = "_____________________________________________________\n\n";
+ msg +="The form was not submitted because of the following error(s).\n";
+ msg +="Please correct these error(s) and re-submit.\n";
+ msg +="_____________________________________________________\n\n";
+
+ if(empty_fields) {
+ msg += "- The following required field(s) are empty:"
+ + empty_fields + "\n";
+ if(errors)
+ msg += "\n";
+ }
+ msg += errors;
+ alert(msg);
+ return(false);
+}
diff --git a/admin/Contact/view_newsletter.phtml b/admin/Contact/view_newsletter.phtml
new file mode 100755
index 0000000..feb057a
--- /dev/null
+++ b/admin/Contact/view_newsletter.phtml
@@ -0,0 +1,23 @@
+
+
+
+
+
+