--- /dev/null
+<?php\r
+/***************************************\r
+** Title.........: HTML Mime Mail class\r
+** Version.......: 1.34\r
+** Author........: Richard Heyes <richard.heyes@heyes-computing.net>\r
+** Filename......: html_mime_mail.class\r
+** Last changed..: 28/01/01\r
+** Notes.........: Based upon mime_mail.class\r
+** by Tobias Ratschiller <tobias@dnet.it>\r
+** and Sascha Schumann <sascha@schumann.cx>.\r
+** See http://www.heyes-computing.net/scripts/\r
+** for full tar/zip if you haven't got one.\r
+***************************************/\r
+\r
+class html_mime_mail{\r
+\r
+ var $mime;\r
+ var $html;\r
+ var $body;\r
+ var $do_html;\r
+ var $multipart;\r
+ var $html_text;\r
+ var $html_images;\r
+ var $headers;\r
+ var $parts;\r
+ var $charset;\r
+ var $charsetlist;\r
+\r
+/***************************************\r
+** Constructor function. Sets the headers\r
+** if supplied.\r
+***************************************/\r
+\r
+ function html_mime_mail($headers = ''){\r
+\r
+ $this->html_images = array();\r
+ $this->headers = array();\r
+ $this->parts = array();\r
+ $this->charsetlist = array('iso' => 'us-ascii',\r
+ 'big5' => 'big5',\r
+ 'gb' => 'gb2312');\r
+\r
+ $this->charset = 'us-ascii';\r
+\r
+ if($headers == '') return TRUE;\r
+ if(is_string($headers)) $headers = explode("\n", trim($headers));\r
+ for($i=0; $i<count($headers); $i++){\r
+ if(is_array($headers[$i])) for($j=0; $j<count($headers[$i]); $j++) if($headers[$i][$j] != '') $this->headers[] = $headers[$i][$j];\r
+ if($headers[$i] != '') $this->headers[] = $headers[$i];\r
+ }\r
+ }\r
+\r
+/***************************************\r
+** Accessor function to set the body text.\r
+** Body text is used if it's not an html\r
+** mail being sent.\r
+***************************************/\r
+\r
+ function set_body($text = ''){\r
+ if(is_string($text)){\r
+ $this->body = $text;\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+ }\r
+\r
+/***************************************\r
+** Accessor function to return the mime\r
+** class variable. Purely for debug.\r
+***************************************/\r
+\r
+ function get_mime(){\r
+ if(!isset($this->mime)) $this->mime = '';\r
+ return $this->mime;\r
+ }\r
+\r
+/***************************************\r
+** Function to set a header. Shouldn't\r
+** really be necessary as you could use\r
+** the constructor and send functions,\r
+** it's here nonetheless. Takes any number\r
+** of arguments, which can be either\r
+** strings or arrays full of strings.\r
+** this function is php4 only and will\r
+** return false otherwise. Will return\r
+** true upon finishing.\r
+***************************************/\r
+\r
+ function add_header(){\r
+ if((int)phpversion() < 4) return FALSE;\r
+ $args = func_get_args();\r
+ for($i=0; $i<count($args); $i++){\r
+ if(is_array($args[$i])) for($j=0; $j<count($args[$i]); $j++) if($args[$i][$j] != '') $this->headers[] = $args[$i][$j];\r
+ if($args[$i] != '') $this->headers[] = $args[$i];\r
+ }\r
+ return TRUE;\r
+ }\r
+\r
+/***************************************\r
+** Accessor function to set the content charset.\r
+** Matt add 2000/10/19\r
+***************************************/\r
+ function set_charset($charset = '', $raw = FALSE){\r
+\r
+ if($raw == TRUE){\r
+ $this->charset = $charset;\r
+ return TRUE;\r
+ }\r
+\r
+ if(is_string($charset)){\r
+ while(list($k,$v) = each($this->charsetlist)){\r
+ if($k == $charset){\r
+ $this->charset = $v;\r
+ return TRUE;\r
+ }\r
+ }\r
+ }\r
+ return FALSE;\r
+ }\r
+\r
+/***************************************\r
+** Adds a html part to the mail.\r
+** Also replaces image names with\r
+** content-id's.\r
+***************************************/\r
+ function add_html($html, $text){\r
+ $this->do_html = 1;\r
+ $this->html = $html;\r
+ $this->html_text = $text;\r
+ if(is_array($this->html_images) AND count($this->html_images) > 0){\r
+ for($i=0; $i<count($this->html_images); $i++) $this->html = ereg_replace($this->html_images[$i]['name'], 'cid:'.$this->html_images[$i]['cid'], $this->html);\r
+ }\r
+ }\r
+\r
+/***************************************\r
+** Builds html part of email.\r
+***************************************/\r
+ function build_html($orig_boundary){\r
+ $sec_boundary = '=_'.md5(uniqid(time()));\r
+ $thr_boundary = '=_'.md5(uniqid(time()));\r
+\r
+ if(count($this->html_images) == 0){\r
+ $this->multipart.= '--'.$orig_boundary."\n";\r
+ $this->multipart.= 'Content-Type: multipart/alternative;'.chr(10).chr(9).'boundary="'.$sec_boundary."\"\n\n\n";\r
+\r
+ $this->multipart.= '--'.$sec_boundary."\n";\r
+ $this->multipart.= 'Content-Type: text/plain; charset="'.$this->charset.'"'."\n";\r
+ $this->multipart.= 'Content-Transfer-Encoding: base64'."\n\n";\r
+ $this->multipart.= chunk_split(base64_encode($this->html_text))."\n\n";\r
+\r
+ $this->multipart.= '--'.$sec_boundary."\n";\r
+ $this->multipart.= 'Content-Type: text/html; charset="'.$this->charset.'"'."\n";\r
+ $this->multipart.= 'Content-Transfer-Encoding: base64'."\n\n";\r
+ $this->multipart.= chunk_split(base64_encode($this->html))."\n\n";\r
+ $this->multipart.= '--'.$sec_boundary."--\n\n";\r
+ }else{\r
+ $this->multipart.= '--'.$orig_boundary."\n";\r
+ $this->multipart.= 'Content-Type: multipart/related;'.chr(10).chr(9).'boundary="'.$sec_boundary."\"\n\n\n";\r
+\r
+ $this->multipart.= '--'.$sec_boundary."\n";\r
+ $this->multipart.= 'Content-Type: multipart/alternative;'.chr(10).chr(9).'boundary="'.$thr_boundary."\"\n\n\n";\r
+\r
+ $this->multipart.= '--'.$thr_boundary."\n";\r
+ $this->multipart.= 'Content-Type: text/plain; charset="'.$this->charset.'"'."\n";\r
+ $this->multipart.= 'Content-Transfer-Encoding: base64'."\n\n";\r
+ $this->multipart.= chunk_split(base64_encode($this->html_text))."\n\n";\r
+\r
+ $this->multipart.= '--'.$thr_boundary."\n";\r
+ $this->multipart.= 'Content-Type: text/html'."\n";\r
+ $this->multipart.= 'Content-Transfer-Encoding: base64'."\n\n";\r
+ $this->multipart.= chunk_split(base64_encode($this->html))."\n\n";\r
+ $this->multipart.= '--'.$thr_boundary."--\n\n";\r
+\r
+ for($i=0; $i<count($this->html_images); $i++){\r
+ $this->multipart.= '--'.$sec_boundary."\n";\r
+ $this->build_html_image($i);\r
+ }\r
+\r
+ $this->multipart.= "--".$sec_boundary."--\n\n";\r
+ }\r
+ }\r
+/***************************************\r
+** Adds an image to the list of embedded\r
+** images.\r
+***************************************/\r
+ function add_html_image($file, $name = '', $c_type='application/octet-stream'){\r
+ $this->html_images[] = array( 'body' => $file,\r
+ 'name' => $name,\r
+ 'c_type' => $c_type,\r
+ 'cid' => md5(uniqid(time())) );\r
+ }\r
+\r
+\r
+/***************************************\r
+** Adds a file to the list of attachments.\r
+***************************************/\r
+ function add_attachment($file, $name = '', $c_type='application/octet-stream'){\r
+ $this->parts[] = array( 'body' => $file,\r
+ 'name' => $name,\r
+ 'c_type' => $c_type );\r
+ }\r
+\r
+/***************************************\r
+** Builds an embedded image part of an\r
+** html mail.\r
+***************************************/\r
+ function build_html_image($i){\r
+ $this->multipart.= 'Content-Type: '.$this->html_images[$i]['c_type'];\r
+\r
+ if($this->html_images[$i]['name'] != '') $this->multipart .= '; name="'.$this->html_images[$i]['name']."\"\n";\r
+ else $this->multipart .= "\n";\r
+\r
+ $this->multipart.= 'Content-Transfer-Encoding: base64'."\n";\r
+ $this->multipart.= 'Content-ID: <'.$this->html_images[$i]['cid'].">\n\n";\r
+ $this->multipart.= chunk_split(base64_encode($this->html_images[$i]['body']))."\n";\r
+ }\r
+\r
+/***************************************\r
+** Builds a single part of a multipart\r
+** message.\r
+***************************************/\r
+ function build_part($i){\r
+ $message_part = '';\r
+ $message_part.= 'Content-Type: '.$this->parts[$i]['c_type'];\r
+ if($this->parts[$i]['name'] != '')\r
+ $message_part .= '; name="'.$this->parts[$i]['name']."\"\n";\r
+ else\r
+ $message_part .= "\n";\r
+\r
+ // Determine content encoding.\r
+ if($this->parts[$i]['c_type'] == 'text/plain'){\r
+ $message_part.= 'Content-Transfer-Encoding: base64'."\n\n";\r
+ $message_part.= chunk_split(base64_encode($this->parts[$i]['body']))."\n";\r
+ }elseif($this->parts[$i]['c_type'] == 'message/rfc822'){\r
+ $message_part.= 'Content-Transfer-Encoding: 7bit'."\n\n";\r
+ $message_part.= $this->parts[$i]['body']."\n";\r
+ }else{\r
+ $message_part.= 'Content-Transfer-Encoding: base64'."\n";\r
+ $message_part.= 'Content-Disposition: attachment; filename="'.$this->parts[$i]['name']."\"\n\n";\r
+ $message_part.= chunk_split(base64_encode($this->parts[$i]['body']))."\n";\r
+ }\r
+\r
+ return $message_part;\r
+ }\r
+\r
+/***************************************\r
+** Builds the multipart message from the\r
+** list ($this->_parts).\r
+***************************************/\r
+ function build_message(){\r
+ $boundary = '=_'.md5(uniqid(time()));\r
+\r
+ $this->headers[] = 'MIME-Version: 1.0';\r
+ $this->headers[] = 'Content-Type: multipart/mixed;'.chr(10).chr(9).'boundary="'.$boundary.'"';\r
+ $this->multipart = "This is a MIME encoded message.\n\n";\r
+\r
+ if(isset($this->do_html) AND $this->do_html == 1) $this->build_html($boundary);\r
+ if(isset($this->body) AND $this->body != '') $this->parts[] = array('body' => $this->body, 'name' => '', 'c_type' => 'text/plain');\r
+\r
+ for($i=(count($this->parts)-1); $i>=0; $i--){\r
+ $this->multipart.= '--'.$boundary."\n".$this->build_part($i);\r
+ }\r
+\r
+ $this->mime = $this->multipart."--".$boundary."--\n";\r
+ }\r
+\r
+/***************************************\r
+** Sends the mail.\r
+***************************************/\r
+ function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = ''){\r
+\r
+ if($to_name != '') $to = '"'.$to_name.'" <'.$to_addr.'>';\r
+ else $to = $to_addr;\r
+\r
+ if($from_name != '') $from = '"'.$from_name.'" <'.$from_addr.'>';\r
+ else $from = $from_addr;\r
+\r
+ if(is_string($headers)) $headers = explode("\n", trim($headers));\r
+ for($i=0; $i<count($headers); $i++){\r
+ if(is_array($headers[$i])) for($j=0; $j<count($headers[$i]); $j++) if($headers[$i][$j] != '') $xtra_headers[] = $headers[$i][$j];\r
+ if($headers[$i] != '') $xtra_headers[] = $headers[$i];\r
+ }\r
+ if(!isset($xtra_headers)) $xtra_headers = array();\r
+\r
+ mail($to, $subject, $this->mime, 'From: '.$from."\n".implode("\n", $this->headers)."\n".implode("\n", $xtra_headers));\r
+ }\r
+\r
+/***************************************\r
+** Use this method to deliver using direct\r
+** smtp connection. Relies upon Manuel Lemos'\r
+** smtp mail delivery class available at:\r
+** http://phpclasses.upperdesign.com\r
+**\r
+** void smtp_send( string *Name* of smtp object,\r
+** string From address,\r
+** array To addresses,\r
+** string Subject,\r
+** array Extra headers)\r
+***************************************/\r
+ function smtp_send($smtp_obj, $from_addr, $to_addr, $subject, $xtra_headers = ''){\r
+ global $$smtp_obj;\r
+ $smtp_obj = $$smtp_obj;\r
+\r
+ $headers = $this->headers;\r
+ $headers[] = 'From: '.$from_addr;\r
+ $headers[] = 'Subject: '.$subject;\r
+ if(is_array($xtra_headers)) for(reset($xtra_headers); list(,$header) = each($xtra_headers); ) $headers[] = $header;\r
+\r
+ // the following: sendmessage(string from address, array to addresses, array headers, string body)\r
+ $smtp_obj->sendmessage($from_addr, $to_addr, $headers, $this->mime);\r
+ }\r
+\r
+/***************************************\r
+** Use this method to return the email\r
+** in message/rfc822 format. Useful for\r
+** adding an email to another email as\r
+** an attachment. there's a commented\r
+** out example in example.php.\r
+**\r
+** string get_rfc822(string To name,\r
+** string To email,\r
+** string From name,\r
+** string From email,\r
+** [string Subject,\r
+** string Extra headers])\r
+***************************************/\r
+ function get_rfc822($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = ''){\r
+\r
+ // Make up the date header as according to RFC822\r
+ $date = 'Date: '.date('D, d M y H:i:s');\r
+\r
+ if($to_name != '') $to = 'To: "'.$to_name.'" <'.$to_addr.'>';\r
+ else $to = $to_addr;\r
+\r
+ if($from_name != '') $from = 'From: "'.$from_name.'" <'.$from_addr.'>';\r
+ else $from = $from_addr;\r
+\r
+ if(is_string($subject)) $subject = 'Subject: '.$subject;\r
+\r
+ if(is_string($headers)) $headers = explode("\n", trim($headers));\r
+ for($i=0; $i<count($headers); $i++){\r
+ if(is_array($headers[$i])) for($j=0; $j<count($headers[$i]); $j++) if($headers[$i][$j] != '') $xtra_headers[] = $headers[$i][$j];\r
+ if($headers[$i] != '') $xtra_headers[] = $headers[$i];\r
+ }\r
+ if(!isset($xtra_headers)) $xtra_headers = array();\r
+\r
+ return $date."\n".$from."\n".$to."\n".$subject."\n".implode("\n", $this->headers)."\n".implode("\n", $xtra_headers)."\n\n".$this->mime;\r
+ }\r
+\r
+\r
+} // End of class.\r
+?>\r
--- /dev/null
+<?php
+include_once('../../setup.phtml');
+include("contact_setup.inc");
+top('Contact Inquiries','');
+html_nav_table($nav, $navWidth);
+$conn =& db_connect();
+if(!$conn)
+ {
+ echo "No database connection";
+ }
+
+$qs = "SELECT id,header,pos
+FROM contact_inq
+ORDER BY pos;";
+
+$result = pg_Exec($conn,$qs);
+?>
+<table id="admin-list-table">
+<tr>
+ <th colspan=2>
+<form action="edit_inquiry.phtml" method="POST" name="f">
+<input type="submit" name="Command" value="Add Item">
+ </form>
+ </th>
+<tr>
+<?php
+if(pg_numrows($result) > 0)
+{
+ for($i=0;$i<pg_numrows($result);$i++)
+ {
+ $data = pg_fetch_array($result,$i);
+ ?>
+ <tr>
+ <td width="10" nowrap><a href="edit_inquiry.phtml?id=<?echo $data[id]?>&Command=Edit">[Edit]</a></td>
+ <td>
+ <?
+ $qs = "SELECT MAX(pos) as maxpos
+ FROM contact_inq";
+
+ $maxresult = pg_exec($conn,$qs);
+ $max_data = pg_fetch_array($maxresult,0,PGSQL_ASSOC);
+ $maxpos = $max_data['maxpos'];
+ $pos = "<select style=\"font-size:10pt;\" name=pos
+ onChange=location.href=this[this.selectedIndex].value;
+ size=1>";
+ for($newpos=1;$newpos<=$maxpos;$newpos++) {
+ $string = "Command=Move&id=$data[id]&newpos=$newpos";
+ $pos .= "<option value=\"update_inquiry.phtml?$string\"";
+ if($newpos == $data[pos]) {
+ $pos .= " selected";
+ }
+ $pos .= ">$newpos</option>";
+ }
+ $pos .= "</select>";
+ echo $pos;
+ ?>
+ </td>
+ <td width=80% align=left><?echo $data[header]?>
+ </tr>
+ <?
+ }
+}
+else {
+ ?>
+ <tr><th colspan=2>Nothing in the database yet</th></tr>
+ <?
+}
+?>
+</table>
+<?
+footer();
+?>
--- /dev/null
+<?
+//$Id: contact_setup.inc,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+if(!defined("ENTRIES_PER_PAGE"))
+{
+ define("ENTRIES_PER_PAGE",10); // Entries per Page in list_contact.phtml
+}
+define("CUSTOMER_TABLE","customer"); // name of customer table
+define("CONTACT_TABLE","contact"); // name of contact table
+define("TABLE",CONTACT_TABLE); // which table to use
+define("DATEFORMAT","US"); // date format (for edit_contact.phmtl)
+define("NEWSLETTER_PROTOTYPE","newsletter_template.html");
+/*
+ setup the following in the setup.phtml (in root directory) file.
+defines:
+HTML_EMAIL = ON or OFF
+PRODUCTION_MODE = ON ,r OFF
+ */
+/*
+ define("NEWSLETTER",1); //bool- does the contact database mail out a newsletter?
+ define("NEWSLETTRE_TYPE","TEXT"); // can be text or html(with images)
+ */
+
+$unit_size2[6] = "5 bedroom & loft, 3.5 bathroom (sleeps 12)";
+$unit_size2[0] = "3 bedroom & loft, 2 bathroom (sleeps 8-10)";
+$unit_size2[1] = "2 bedroom & loft, 2 bathroom (sleeps 6-8)";
+$unit_size2[2] = "2 bedroom, 2 bathroom + (sleeps 4-6)";
+$unit_size2[3] = "2 bedroom, 2 bathroom (sleeps 4-6)";
+$unit_size2[4] = "2 bedroom, 1 bathroom (sleeps 4-6)";
+$unit_size2[5] = "1 bedroom, 1 bathroom (sleeps 2-4)";
+
+$referred_by2[0] = "AAA";
+$referred_by2[1] = "Big Fore";
+$referred_by2[2] = "Chamber/Visitors Bureau";
+$referred_by2[3] = "Detroit Free Press";
+$referred_by2[4] = "Friends/Relatives";
+$referred_by2[5] = "Great Rentals Web Site";
+$referred_by2[6] = "Internet";
+$referred_by2[7] = "Nubs Nob";
+$referred_by2[8] = "Other";
+$referred_by2[9] = "Past Guest";
+
+$int_qs = "select * from contact_inq order by pos;";
+
+if( $data = db_auto_get_data($int_qs,CONN_STR) )
+{
+ foreach( $data as $row )
+ {
+ $interest2[$row['id']] = $row['header'];
+ }
+}
+/*
+$interest2[0] = "Golf Trip";
+$interest2[1] = "Big 4 Golf Package";
+$interest2[2] = "Ski Trip";
+$interest2[3] = "Family vacation";
+$interest2[4] = "Family Reunion";
+$interest2[5] = "Romantic Getaway";
+$interest2[6] = "Honeymoon/Anniversary";
+$interest2[7] = "Soccer Weekend";
+$interest2[8] = "Wedding Group";
+$interest2[9] = "Biking";
+$interest2[10] = "Fishing";
+$interest2[11] = "Tennis";
+$interest2[12] = "Business";
+$interest2[13] = "Fall Color Tour";
+$interest2[14] = "Morel Mushrooms";
+$interest2[15] = "Spring/Fall Relaxing vacation";
+$interest2[16] = "Empty Nester Getaway";
+$interest2[17] = "Real Estate";
+$interest2[18] = "Senior Packages";
+$interest2[19] = "Scrapbooking";
+*/
+
+if(!function_exists("template_read"))
+{
+ function template_read($template)
+ {
+ $fp = fopen($template, "r");
+ $contents = fread($fp,filesize($template));
+ fclose($fp);
+ if($contents)
+ {
+ return $contents;
+ }
+ else
+ {
+ return "";
+ }
+ }
+}
+
+if(!function_exists("explode_template"))
+{
+ function explode_template($template,$data)
+ {
+ $template = template_read($template);
+ $output = template_replacement($template,$data);
+ $output = wordwrap($output, 72);
+ return($output);
+
+ }
+}
+
+if(!function_exists("template_replacement"))
+{
+ function template_replacement($template,$fieldarr)
+ {
+ if(is_array($fieldarr))
+ {
+ foreach($fieldarr as $key=>$value)
+ {
+ $template = str_replace( "<!-- ".$key." -->", $value, $template );
+ }
+ }
+
+ return $template;
+ }
+}
+if(!function_exists("add_image"))
+{
+ function add_image($image,$align,$url)
+ {
+ if($image != "")
+ {
+ $output .= '<div style="margin:5px;float:'.$align.';">';
+ if( $url != '' )
+ {
+ $output .= '<a href="http://'.$url.'">';
+ }
+ $output .= '<img src="'.MIDSIZED.$image.'">';
+ if( $url != '' )
+ {
+ $output .= '</a>';
+ }
+ $output .= '</div>';
+ }
+ return($output);
+ }
+}
+// Navigation array
+$nav = array(
+ "Add Contact" => "edit_contact.phtml",
+ "Saved Reports" => "list_query.phtml",
+ "Compose Email" => "edit_autoresponse.phtml?id=1",
+ "List Contacts" => "list_contact.phtml",
+ "Contact Inquiry Fields" => "contact_inquiry.phtml",
+ "Report Builder" => "index.phtml",
+ "Preview Email" => "view_newsletter.phtml",);
+
+
+function interest($field)
+{
+ global $interest2;
+ if( !is_array( $interest2 ) )
+ {
+ return( false );
+ }
+ echo "<table><tr>";
+ $count = 0;
+ foreach($interest2 as $key=>$value)
+ {
+ if($count==0)
+ echo "<td>";
+ echo "<input type=\"checkbox\" name=\"interest[]\" value=\"$key\"";
+ if(strstr($field,":".$key.":"))
+ echo " checked";
+ echo ">$value<br>";
+ if($count==5)
+ echo "</td><td>";
+ if($count==11)
+ echo "</td>";
+ $count++;
+ }
+ echo "</tr></TABLE>";
+}
+
+// default query on create_date
+$c_date_from = contact_date_entry("","","","fc_month","fc_day","fc_year");
+$c_date_to = contact_date_entry("","","","tc_month","tc_day","tc_year");
+/* The following is for setting up the defines and arrays that are needed
+ * based on which table ( customer or contact ) in use
+ * formats for arrays
+ * $DB_fields[] = array( name =>"{FIELD NAME}", title => "{FIELD TITLE}", type => "{FIELD TYPE}")
+ * $fields["{FIELD_NAME}"] = "{FIELD TITLE}";
+ *
+ * must have these defines
+ * ID - The primary key
+ * SEQUENCE - sequence name
+ * WHERE - where clause
+ */
+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 => "address", title => "Address", 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 => "phone", title => "Phone", type => "text");
+ $DB_fields[] = array( name => "email", title => "Email", type => "text");
+ $DB_fields[] = array( name => "arrive_date",title => "Arrival Date",type => "date");
+ $DB_fields[] = array( name => "depart_date",title => "Departure Date",type => "date");
+ $DB_fields[] = array( name => "unit_size", title => "Unit Size", type => "array_drop",drop=>$unit_size2);
+ $DB_fields[] = array( name => "referred_by",title => "Referred By",type => "array_drop",drop=>$referred_by2);
+ $DB_fields[] = array( name => "other", title => "Referred By Other",type => "text");
+ $DB_fields[] = array( name => "interest", title => "Interest", type=> "interest");
+ $DB_fields[] = array( name => "questions", title => "Additional Questions",type => "desc");
+ $DB_fields[] = array( name => "mail_ok", title => "Mail Ok?", type => "radio");
+ //$DB_fields[] = array( name => "contestant",title => "Contestant?", type => "radio");
+
+ // $fields are used for building the query page
+ foreach($DB_fields as $key=>$value){
+ if($value['type'] == "text" || $value['type'] == "array_drop")
+ $fields[$value['name']] = $value['title'];
+ }
+ $fields["questions"] = "Questions";
+ $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");
+}
+?>
--- /dev/null
+<?php
+include('../../setup.phtml');
+include(BASE.'classes/class_db.inc');
+$interest['0'] = "Golf Trip";
+$interest['1'] = "Big 4 Golf Package";
+$interest['2'] = "Ski Trip";
+$interest['3'] = "Family vacation";
+$interest['4'] = "Family Reunion";
+$interest['5'] = "Romantic Getaway";
+$interest['6'] = "Honeymoon/Anniversary";
+$interest['7'] = "Soccer Weekend";
+$interest['8'] = "Wedding Group";
+$interest['9'] = "Biking";
+$interest['10'] = "Fishing";
+$interest['11'] = "Tennis";
+$interest['12'] = "Business";
+$interest['13'] = "Fall Color Tour";
+$interest['14'] = "Morel Mushrooms";
+$interest['15'] = "Spring/Fall Relaxing vacation";
+$interest['16'] = "Empty Nester Getaway";
+$interest['17'] = "Real Estate";
+$interest['18'] = "Senior Packages";
+$interest['19'] = "Scrapbooking";
+$DB =& new GLM_DB();
+$intQuery = "select id,header from contact_inq order by pos;";
+if( $iRes = $DB->db_exec( $intQuery ) )
+{
+ while( $iRow = pg_fetch_object( $iRes ) )
+ {
+ $tKey = array_search( $iRow->header, $interest );
+ $intArray["$tKey"] = (string)$iRow->id;
+ $intArray["$iRow->header"] = (string)$iRow->id;
+ }
+}
+//echo '<pre>';
+//print_r( $intArray );
+//echo '</pre>';
+$query = "select id,interest from contact where interest != '' and interest is not null order by id;";
+$DB->db_exec("BEGIN WORK;");
+if( $res = $DB->db_exec( $query ) )
+{
+ while( $row = pg_fetch_object( $res ) )
+ {
+ unset( $mArr );
+ unset( $fkey );
+ unset( $match );
+ $mArr = explode( ':',ereg_replace(":$","",$row->interest) );
+ if( is_array( $mArr ) )
+ {
+ foreach( $mArr as $key => $val )
+ {
+ $val = trim( $val );
+ $fkey = array_search( $val, $interest, true );
+ if( is_numeric( $val ) && $interest[$val] )
+ {
+ echo '<p>matched '.$interest[$val].'</p>';
+ $mArr[$key] = $intArray[$val];
+ }
+ elseif( $fkey == '0' )
+ {
+ echo '<p>matched -> null val '.$interest[$fkey].'</p>';
+ $mArr[$key] = $intArray[$interest[$fkey]];
+ }
+ elseif( $fkey !== false )
+ {
+ echo '<p>matched '.$interest[$fkey].'</p>';
+ $mArr[$key] = $intArray[$fkey];
+ }
+ else
+ {
+ echo '<p>not matched ';
+ var_dump( $val );
+ var_dump( $interest[0] );
+ echo '</p>';
+ }
+ }
+ }
+ $newQuery = "update contact set interest = ':".implode(":",$mArr).":' where id = ".$row->id;
+ $DB->db_exec($newQuery);
+ echo $newQuery;
+ //$dObj[] = $row;
+ }
+}
+$DB->db_exec("ABORT WORK;");
+?>
--- /dev/null
+<?php
+//$Id: del_query.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+$qs = "DELETE
+ FROM query_db
+ WHERE id = $id";
+
+if(!db_auto_exec($qs)) html_error(DB_ERROR_MSG.$qs,1);
+html_header("Admin","Deleted","");
+?>
+<script lang="javascript">
+document.onload=window.opener.location.reload(1);
+</script>
+Query <?echo $id?> is Deleted
+<center><a href="" onClick="window.close();return(false);">Close This
+Window</a></center>
--- /dev/null
+<?
+/*****************************************************************************
+* File download
+* Author: Steve Sutton
+*
+* pass $query_string
+*
+*****************************************************************************/
+//$Id: download.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+if(!$dbd = db_connect())
+ die("Warning: FATAL! No Connection to DB_SERVER");
+
+$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<pg_numrows($res);$i++) {
+ $result_string = "";
+ $row = pg_fetch_array($res,$i,PGSQL_ASSOC);
+ $contactedby = pg_fieldnum($res,'contactedby');
+ for($b=0;$b<count($row);$b++) {
+ $result_string .= pg_result($res,$i,$b)."|";
+ }
+ $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));
+ }
+ }
+ 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");
+}
+?>
--- /dev/null
+<?
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+$id = $_GET['id'];
+
+top("AutoReponse for Newsletter", HELP_BASE."response.phtml?key=edit+section");
+
+
+html_nav_table($nav,3);
+if(!$dbd = db_connect(CONN_STR)) html_error(DB_ERROR_MSG, 1);
+
+$qs = "SET DATESTYLE TO 'SQL, NONEUROPEAN'";
+
+if(!db_exec($dbd, $qs))
+ html_error(DB_ERROR_MSG, 1);
+
+$qs = "SELECT *
+ FROM news_response
+ WHERE id = $id";
+
+if(!$res = db_exec($dbd, $qs)) html_error(DB_ERROR_MSG,1);
+
+
+echo '
+ <script type="text/javascript" language="JavaScript">
+ _editor_url = "'.URL_BASE.'admin/htmlarea/";
+ </script>';
+echo '<script type="text/javascript" src="'.URL_BASE.'admin/htmlarea/htmlarea.js"></script>';
+echo '<script type="text/javascript" src="'.URL_BASE.'admin/htmlarea/lang/en.js"></script>';
+echo '<script type="text/javascript" src="'.URL_BASE.'admin/htmlarea/dialog.js"></script>';
+echo '<link type="text/css" rel=stylesheet href="'.URL_BASE.'admin/htmlarea/htmlarea.css">';
+?>
+
+<script src=<?echo URL_BASE."admin/verify.js"?>></script>
+<form enctype="multipart/form-data" action="update_autoresponse.phtml" method="POST"
+
+onSubmit="
+this.response.optional = false;
+this.response.r = 'Description';
+this.subject.optional = false;
+this.subject.r = 'Subject';
+return(verify(this))
+">
+<?
+echo '<table id="admin-edit-table">';
+for($i = 0; $i < db_numrows($res); $i++) {
+ $row = db_fetch_array($res,$i, PGSQL_ASSOC);
+
+ if(!$row[id])
+ html_error(DB_ERROR_MSG,1);
+
+ foreach($row as $key=>$value) {
+ switch($key) {
+
+ case "id":
+ echo "<input type=\"hidden\" name=\"id\" value=\"$value\">";
+ break;
+
+ case "subject":
+ echo "<tr><td class=\"navtd\" align=\"right\">Subject:</td>";
+ text_box("subject",$value);
+ echo "</tr>";
+ break;
+
+ case "coupon_link":
+ echo "<td class=\"navtd\" align=\"right\">Coupon Link Address:</td>\n";
+ text_box("coupon_link",$value);
+ break;
+
+ case "response":
+ echo "<tr><td class=\"navtd\" align=\"right\">Response:</td>";
+ echo '<td align="left"><textarea style="width:400px;" id="response" name="response" cols="55" rows="35">'.$value.'</textarea></td>';
+ //text_area("response",$value,8,60);
+ echo "</tr>";
+ echo "<tr><td> </td><td>NOTE: Insert COUPON IMAGE1 IMAGE2 IMAGE3 etc. in the body of
+ your text where you want the images to appear.</td></tr>";
+ break;
+
+ case "image":
+ case "image2":
+ case "image3":
+ case "coupon":
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+echo "<script language=\"Javascript\">
+var config = new HTMLArea.Config();
+//config.imgURL = '".URL_BASE."admin/tt/htmlarea/images/';
+//config.popupURL = '".URL_BASE."admin/tt/htmlarea/popups/';
+config.width = '570px';
+config.height = '200px';
+config.width = '570px';
+config.height = '200px';
+config.statusBar = false;
+config.toolbar = [
+[ 'fontname', 'space',
+ 'fontsize', 'space',
+ 'formatblock', 'space',
+ 'bold', 'italic', 'underline', 'separator',
+ 'copy', 'cut', 'paste', 'space', 'undo', 'redo' ],
+
+ [ 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'separator',
+ 'orderedlist', 'unorderedlist', 'outdent', 'indent', 'separator',
+ 'forecolor', 'separator',
+ 'inserthorizontalrule', 'createlink', 'htmlmode'
+ ]
+];
+HTMLArea.replace('response', config);
+</script>";
+
+
+ if ($row["coupon"] != "")
+ {
+ echo "<TR>"
+ ."<TD> </TD>"
+ ."<TD>"
+ ."<BR>"
+ ."<TABLE ALIGN=LEFT border=2 cellpadding=0 cellspacing=0><TD><IMG SRC=\"".THUMB."$row[coupon]\" ALIGN=LEFT HSPACE=0 VSPACE=0></TD></TABLE>"
+ ."<BR CLEAR=ALL><BR>"
+ ."<TABLE border=0 CELLPADDING=4 WIDTH=300><TR><TD>"
+ ."$FT1 This is the current coupon attached to this newsletter."
+ ."To change the coupon, select a new one by clicking the browse button below."
+ ."To delete the coupon without uploading a new one, select "
+ ."<B>Yes</B> below and click the <B>Update Category button</B>. In addition,
+ if you'd like readers to be able to click the coupon to go to a site, enter
+ the address into "Coupon Link Address"."
+ ."</TD></TR></TABLE>"
+ ."<P>"
+ ."</FONT>"
+ ."$TDFT Delete Coupon? Yes </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delcoupon\" VALUE=\"TRUE\"> "
+ ."$TDFT No </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delcoupon\" VALUE=\"FALSE\" CHECKED><BR>"
+ ."</TD>"
+ ."</TR>";
+ }
+
+?>
+<tr>
+ <td class="navtd" align="right">Coupon:</td>
+ <td align="left"><input type="file" name="coupon"></td>
+ <input type="hidden" name="oldcoupon" value="<?=$row[coupon]?>">
+</tr>
+
+<?
+
+
+
+
+
+ if ($row["image"] != "")
+ {
+ echo "<TR>"
+ ."<TD> </TD>"
+ ."<TD>"
+ ."<BR>"
+ ."<TABLE ALIGN=LEFT border=2 cellpadding=0 cellspacing=0><TD><IMG SRC=\"".THUMB."$row[image]\" ALIGN=LEFT HSPACE=0 VSPACE=0></TD></TABLE>"
+ ."<BR CLEAR=ALL><BR>"
+ ."<TABLE border=0 CELLPADDING=4 WIDTH=300><TR><TD>"
+ ."$FT1 This is the current image attached to this newsletter."
+ ."To change the image, select a new one by clicking the browse button below."
+ ."To delete the image without uploading a new one, select "
+ ."<B>Yes</B> below and click the <B>Update Category button</B>."
+ ."</TD></TR></TABLE>"
+ ."<P>"
+ ."</FONT>"
+ ."$TDFT Delete Item Image? Yes </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage\" VALUE=\"TRUE\"> "
+ ."$TDFT No </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage\" VALUE=\"FALSE\" CHECKED><BR>"
+ ."</TD>"
+ ."</TR>";
+ }
+
+?>
+<tr>
+ <td class="navtd" align="right">IMAGE1:</td>
+ <td align="left"><input type="file" name="image"></td>
+ <input type="hidden" name="oldimage" value="<?=$row[image]?>">
+</tr>
+<tr>
+ <td class="navtd" align="right">Image1 Link:</td>
+ <td align="left"><input type="text" name="image_link" value="<?=$row[image_link]?>" size="55"></td>
+</tr>
+<?
+ if ($row["image2"] != "")
+ {
+ echo "<TR>"
+ ."<TD> </TD>"
+ ."<TD>"
+ ."<BR>"
+ ."<TABLE ALIGN=LEFT border=2 cellpadding=0 cellspacing=0><TD><IMG SRC=\"".THUMB."$row[image2]\" ALIGN=LEFT HSPACE=0 VSPACE=0></TD></TABLE>"
+ ."<BR CLEAR=ALL><BR>"
+ ."<TABLE border=0 CELLPADDING=4 WIDTH=300><TR><TD>"
+ ."$FT1 This is the second image attached to this newsletter."
+ ."To change the image, select a new one by clicking the browse button below."
+ ."To delete the image without uploading a new one, select "
+ ."<B>Yes</B> below and click the <B>Update Category button</B>."
+ ."</TD></TR></TABLE>"
+ ."<P>"
+ ."</FONT>"
+ ."$TDFT Delete Item Image? Yes </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage2\" VALUE=\"TRUE\"> "
+ ."$TDFT No </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage2\" VALUE=\"FALSE\" CHECKED><BR>"
+ ."</TD>"
+ ."</TR>";
+ }
+
+?>
+<tr>
+ <td class="navtd" align="right">IMAGE2:</td>
+ <td align="left"><input type="file" name="image2"></td>
+ <input type="hidden" name="oldimage2" value="<?=$row[image2]?>">
+</tr>
+<tr>
+ <td class="navtd" align="right">Image2 Link:</td>
+ <td align="left"><input type="text" name="image2_link" value="<?=$row[image2_link]?>" size="55"></td>
+</tr>
+<?
+ if ($row["image3"] != "")
+ {
+ echo "<TR>"
+ ."<TD> </TD>"
+ ."<TD>"
+ ."<BR>"
+ ."<TABLE ALIGN=LEFT border=2 cellpadding=0 cellspacing=0><TD><IMG SRC=\"".THUMB."$row[image3]\" ALIGN=LEFT HSPACE=0 VSPACE=0></TD></TABLE>"
+ ."<BR CLEAR=ALL><BR>"
+ ."<TABLE border=0 CELLPADDING=4 WIDTH=300><TR><TD>"
+ ."$FT1 This is the third image attached to this newsletter."
+ ."To change the image, select a new one by clicking the browse button below."
+ ."To delete the image without uploading a new one, select "
+ ."<B>Yes</B> below and click the <B>Update Category button</B>."
+ ."</TD></TR></TABLE>"
+ ."<P>"
+ ."</FONT>"
+ ."$TDFT Delete Item Image? Yes </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage3\" VALUE=\"TRUE\"> "
+ ."$TDFT No </FONT>"
+ ."<INPUT TYPE=RADIO NAME=\"delimage3\" VALUE=\"FALSE\" CHECKED><BR>"
+ ."</TD>"
+ ."</TR>";
+ }
+
+?>
+<tr>
+ <td class="navtd" align="right">IMAGE3:</td>
+ <td align="left"><input type="file" name="image3"></td>
+ <input type="hidden" name="oldimage3" value="<?=$row[image3]?>">
+</tr>
+<tr>
+ <td class="navtd" align="right">Image3 Link:</td>
+ <td align="left"><input type="text" name="image3_link" value="<?=$row[image3_link]?>" size="55"></td>
+</tr>
+<tr><td></td><td NOWRAP>
+<input type="submit" name="Command" value="Update">
+</td></tr>
+</table>
+</form>
+<?
+footer();
+?>
+
+
--- /dev/null
+<?
+//$Id: edit_contact.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek 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;$i<count($DB_fields);$i++) {
+ $qs .= $DB_fields[$i][name];
+ if($i != count($DB_fields)-1)
+ $qs .= ",";
+ }
+ $qs .= " FROM ".TABLE."
+ WHERE ".ID." = $id";
+
+ if(!$res = db_exec($dbd, $qs))
+ html_error(DB_ERROR_MSG.$qs,0);
+ if(db_numrows($res)>0){
+ $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<count($DB_fields);$i++) {
+ if($DB_fields[$i][name] == "submitdate"){
+ $row[$DB_fields[$i][name]] = date("m/d/Y H:i:s T");
+ }
+ else{
+ $row[$DB_fields[$i][name]] = "";
+ }
+ $row['mail_ok'] = 't';
+ }
+}
+
+top("Updatable Listings (Add/Edit)", "help/contact.phtml?key=Edit");
+
+html_nav_table($nav, 3);
+?>
+
+<form action="update_contact.phtml" method="POST" enctype="multipart/form-data">
+<?
+echo '<table id="admin-edit-table">';
+echo "<tr><td colspan=2><hr noshade></td></tr>";
+
+foreach($DB_fields as $key=>$value) {
+ if($value[type] == "text") {
+ ?>
+ <tr><td class="navtd" align="right" nowrap><?echo $value[title]?></td>
+ <td><input name="<?echo $value[name]?>"
+ value="<?echo $row[$value[name]]?>" size=40></td>
+ </tr>
+ <?
+ }
+ elseif($value[type] == "date") {
+ ?>
+ <tr><td class="navtd" align="right" nowrap><?echo $value[title]?> (MM/DD/YYYY)</td>
+ <td><input name="<?echo $value[name]?>"
+ value="<?echo $row[$value[name]]?>" size=40></td>
+ </tr>
+ <?
+ }
+ elseif($value[type] == "static") {
+ ?>
+ <tr><td class="navtd" align="right" nowrap><?echo $value[title]?></td>
+ <td><?echo $row[$value[name]]?></td>
+ </tr>
+ <?
+ }
+ elseif($value[type] == "interest") {
+ ?>
+ <tr><td class="navtd" align="right" nowrap><?echo $value[title]?></td>
+ <td><?interest($row[$value[name]])?></td>
+ </tr>
+ <?
+ }
+ elseif($value[type] == "img") {
+ ?>
+ <tr></tr>
+ <?
+ echo "<input type=\"hidden\" name=\"old".$value[name]."\"
+ value=\"".$row[$value[name]]."\">";
+ if($row[$value[name]] != "") {
+ echo "<tr><td class=\"navtd2\" align=\"right\">Current Image:</td>";
+ echo "<td><img src=\"".MIDSIZED.$row[$value[name]]."\">
+ </td>
+ </tr>
+ <tr>
+ <td class=\"navtd2\" align=\"right\">Delete this image:</td>
+ <td>
+ <input type=\"radio\" name=\"delete".$value[name]."\" value=\"1\">Yes
+ <input type=\"radio\" name=\"delete".$value[name]."\" value=\"2\" CHECKED>No
+ </td>
+ </tr>";
+ }
+ echo "<tr><td class=\"navtd\" align=\"right\">New $value[title]:</td>";
+ echo "<td><input type=\"file\" name=\"".$value[name]."\"></td>";
+ echo "</tr>";
+ }
+ elseif($value[type] == "file") {
+ ?>
+ <tr></tr>
+ <?
+ echo "<input type=\"hidden\" name=\"old".$value[name]."\"
+ value=\"".$row[$value[name]]."\">";
+ if($row[$value[name]] != "") {
+ echo "<tr><td class=\"navtd2\" align=\"right\">Current File:</td>";
+ echo "<td>".$row[$value[name]]."
+ </td>
+ </tr>
+ <tr>
+ <td class=\"navtd2\" align=\"right\">Delete this File:</td>
+ <td>
+ <input type=\"radio\" name=\"delete".$value[name]."\" value=\"1\">Yes
+ <input type=\"radio\" name=\"delete".$value[name]."\" value=\"2\" CHECKED>No
+ </td>
+ </tr>";
+ }
+ echo "<tr><td class=\"navtd\" align=\"right\">New $value[title]:</td>";
+ echo "<td><input type=\"file\" name=\"".$value[name]."\"></td>";
+ echo "</tr>";
+ }
+ if($value[type] == "desc") {
+ if($value[name] == "description") {
+ echo "<tr><td colspan=2><hr noshade></td></tr>";
+ echo "<tr><th colspan=2>Description and Images</th></tr>";
+ }
+ echo "<tr><td class=\"navtd\" align=\"right\" nowrap>$value[title]:</td>";
+ text_area("$value[name]",$row[$value[name]]);
+ echo "</tr>";
+ }
+ elseif($value[type] == "hide") {
+ echo "<input type=\"hidden\" name=\"".$value[title]."\" value=\"".$row[$value[name]]."\">";
+ }
+ elseif($value[type] == "radio") {
+ echo "<tr><td class=\"navtd\" align=\"right\">$value[title]:</td>";
+ echo "<td><input type=\"radio\" name=\"".$value[name]."\" value=\"t\"";
+ if($row[$value[name]]=="t")
+ echo " checked";
+ echo ">Yes";
+ echo "<input type=\"radio\" name=\"".$value[name]."\" value=\"f\"";
+ if($row[$value[name]]!="t")
+ echo " checked";
+ echo ">No</td>";
+ echo "</tr>";
+ }
+ elseif($value[type] == "array_drop"){
+ echo "<tr><td class=\"navtd\" align=\"right\" nowrap>$value[title]:</td>";
+ echo "<td>";
+ if(is_array($value[drop])){
+ echo '<select name="'.$value[name].'">';
+ echo '<option value="">-- select '.$value[name].' --</option>';
+ foreach($value[drop] as $dkey=>$dval){
+ echo '<option value="'.$dkey.'"';
+ if($row[$value[name]] == $dkey && $row[$value[name]] != "")
+ echo ' selected';
+ echo '>'.$dval.'</option>';
+ }
+ echo '</select>';
+ }
+ echo "</td></tr>";
+ }
+}
+
+if(isset($id)) {
+?>
+<tr><td colspan=2 align=center>
+<input type="submit" name="Command" value="Update">
+<input type="submit" name="Command" value="Cancel">
+<input type="submit" name="Command" value="Delete" onClick="
+if(confirm('This will delete this Record!\n Are you sure?'))
+ return(true);
+else
+ return(false);
+">
+</td></tr>
+<?
+}
+else {
+ form_footer("Insert","",2);
+}
+echo "</td></tr></table>
+</form>";
+
+footer();
+?>
--- /dev/null
+<?php
+include("../../setup.phtml");
+include("contact_setup.inc");
+$conn =& 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');
+ ?>
+ <table id="admin-edit-table">
+ <tr>
+ <td>Header:</td>
+ <td>
+ <form action="update_inquiry.phtml" method="POST" enctype="multipart/form-data">
+ <input type="text" name="header" value="<?echo $header?>">
+ <input type="hidden" name="id" value="<?echo $id?>"></td>
+ </tr>
+ <?
+ /*
+ echo "<tr><td align=\"right\">Description:</td>";
+ echo "<td><textarea cols=35 rows=8 name=\"description\">$description</textarea></td>";
+ echo "</tr>";
+ */
+ echo "<input type=\"hidden\" name=\"oldimage\" value=\"".$image."\">";
+ echo "<input type=\"hidden\" name=\"oldpos\" value=\"".$pos."\">";
+ /*
+ if($image != "") {
+ echo "<tr><td align=\"right\">Current Image:</td>";
+ echo "<td><img src=\"".MIDSIZED."/".$image."\">
+ </td>
+ </tr>
+ <tr>
+ <td class=\"navtd2\" align=\"right\">Delete this image:</td>
+ <td>
+ <input type=\"radio\" name=\"deleteimage\" value=\"1\">Yes
+ <input type=\"radio\" name=\"deleteimage\" value=\"2\" CHECKED>No
+ </td>
+ </tr>";
+ }
+ echo "<tr><td align=\"right\">New Image:</td>";
+ echo "<td><input type=\"file\" name=\"image\"></td>";
+ echo "</tr>";
+ */
+ ?>
+ <tr>
+ <td colspan=2 align=center>
+ <input type="submit" name="Command" value="Edit">
+ <input type="submit" name="Command" value="Delete">
+ </td>
+ </tr>
+ </form>
+ </table>
+ <?
+
+ break;
+
+ case "Add Item":
+ ?>
+ <table id="admin-edit-table">
+ <tr>
+ <th>Header:</th>
+ <td><form action="update_inquiry.phtml" method="POST">
+ <input type="text" name="header">
+ <input type="submit" name="Command" value="Add">
+ </form>
+ </td>
+ </tr>
+ </table>
+ <?
+ break;
+
+}
+footer();
+?>
--- /dev/null
+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('<OPTION VALUE="',href,'">',text,'<\/OPTION>');
+}
--- /dev/null
+<HTML>
+<HEAD>
+<TITLE>Help</TITLE>
+</HEAD>
+<BODY BGCOLOR="#FFFFFF" BACKGROUND="../../help/helpbg.gif" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
+<FONT FACE="ms sans serif,arial,helvetica" SIZE=2 COLOR="#444444">
+<H4 align="center">Contact Help</H4>
+<hr>
+<?
+switch ($key) {
+ case "search":
+ ?>
+<h4 align="center">Contact Database Search</h4>
+
+<P>
+In this page you will start to build your query to the contact database.
+</p>
+<p>
+<big><b>Search:</b></big>
+</p>
+<p>
+<b>Search records for:</b>
+</p>
+<p>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.</p>
+<p><font color=red>HINT:</font>To help search use wildcards!</p>
+<p>? optional space<br>
+* optional spaces<br>
++ at least one space
+. will match anything<br>
+</p>
+<p><font color=green>NOTE:</font>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.</p>
+<p><b>Search Where in fields:</b></p>
+<p>Tells the database to Search "Anywhere", "Beginning", or "Ending" of the
+fields to be searched.</p>
+<p><b>In Fields:</b></p>
+<p>Select from "In Fields" box. This determines what fields to look in for
+this search.</p>
+<p><font color=red>HINT</font>
+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.</p>
+<p><font color=red>HINT</font>
+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.</p>
+<p><b>Search Type:</b></p>
+<p>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"</p>
+<p><b>Case Sensitivity:</b></p>
+<p>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".</p>
+
+<p>
+<big><b>Output of records</b></big>
+</p>
+<p><b>Output Fields:</b></p>
+<p>Select from "Output Fields" box. This determines what fields will be in the
+output of this search.</p>
+<p><font color=red>HINT</font>
+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.</p>
+<p><font color=red>HINT</font>
+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.</p>
+<p><b>File Output:</b></p>
+<p>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.</p>
+<p><font color=green>NOTE:</font>The text file is output as report.doc. This
+is only a text file.
+</p>
+<p><b>Delimiter:</b></p>
+<p>This determines what separates the fields in your file.</p>
+
+<?
+ break;
+
+ case "List":
+ ?>
+<h4 align="center">List Contacts</h4>
+<P>
+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.
+</p>
+<p><b>[Edit]</b></p>
+<p>Link to contact edit page.</p>
+
+<p><b>[Delete]</b></p>
+<p>Link to Delete Contact.</p>
+
+<p><big><b>Download Files</b></big></p>
+<p>If you see this then there is a file you can download.
+Click on the file and you can download it.</p>
+<?
+ break;
+
+ case "Edit":
+ ?>
+<h4 align="center">Edit a Contact</h4>
+<P>
+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.
+</p>
+<p>
+
+<p>
+<b>Submit Query</b>
+</p>
+<p>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.
+</p>
+<?
+ break;
+
+ case "Add":
+ ?>
+<h4 align="center">Add an Contact</h4>
+<P>
+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.
+</p>
+
+<p>
+<b>Submit Query</b>
+</p>
+<p>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.
+</p>
+<?
+ break;
+
+}
+?>
+<BR CLEAR=ALL>
+<CENTER><A HREF="" onClick = "window.close('self');"><IMG SRC="../../help/closewindow.gif" border=0></A></CENTER>
+</BODY>
+</HTML>
--- /dev/null
+<?php
+session_start();
+if(isset($mailout))
+{
+ session_unregister("mailout");
+}
+if(isset($sess_vars))
+{
+ extract($sess_vars);
+ session_unregister("sess_vars");
+}
+extract($_POST);
+extract($_GET);
+//$Id: index.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+$dbd = db_connect();
+$qs = "SELECT count(*) as total
+ FROM ".TABLE;
+if(TABLE==CUSTOMER_TABLE)
+{
+ $qs .= " WHERE fname != '-Guest-'";
+}
+$res = db_exec($dbd,$qs);
+$total = pg_result($res,0,'total');
+top("Contact Database","help/contact.phtml?key=search");
+html_nav_table($nav,3);
+?>
+<form name="search" action="query_contact.phtml" method="POST" onSubmit="
+ var msg = '';
+ var errors = '';
+ var ping = 0;
+ var all = 0;
+ this.fvalue.value = '';
+ this.rfvalue.value = '';
+ this.rdvalue.value = '';
+
+ if(this.search.value == '') {
+ all++;
+ }
+
+ for(var i = 0;i<4;i++) {
+ if(this.search_type.options[i].selected){
+ ping++;
+ }
+ }
+
+ if(all == 0) {
+ if(ping == 0) {
+ errors += '-You must select a search type\n';
+ }
+ }
+
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ if(this.ifields.options[i].selected) {
+ this.fvalue.value += ':' + this.ifields.options[i].value;
+ }
+ }
+
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ if(this.return_fields.options[i].selected && this.return_fields.options[i].value != '') {
+ this.rfvalue.value += ':' + this.return_fields.options[i].value;
+ }
+ }
+
+ for(var i=0;i<3;i++) {
+ if(this.dates.options[i].selected) {
+ this.rdvalue.value += ':' + this.dates.options[i].value;
+ }
+ }
+
+ if(all == 0) {
+ if(this.fvalue.value == '') {
+ errors += '-You must select at least one field to search in\n';
+ }
+ }
+
+ if(this.rfvalue.value == '' && this.rdvalue == '') {
+ errors += '-You must select at least one field for output\n';
+ }
+
+ if(all == 1) {
+ if(errors == '') {
+ return(true);
+ }
+ }
+
+ if(errors == '') {
+ return(true);
+ }
+ else {
+ msg += '_______________________________________\n\n';
+ msg += 'The form was not submitted please check\n';
+ msg += 'the following and resubmit\n\n';
+ msg += errors + '\n\n';
+ msg += '_______________________________________\n\n';
+
+ alert(msg);
+ return(false);
+ }
+ ">
+<table id="admin-list-table">
+ <tr>
+ <td colspan=4>
+ There
+<?php
+if($total < 1 )
+{
+ echo " No records";
+}
+elseif($total > 1)
+{
+ echo "are $total contacts";
+}
+else
+{
+ echo "is $total contact";
+}
+?>
+in the database.
+ </td>
+ </tr>
+ <tr>
+ <th colspan=4>
+ Search:
+ </th>
+ </tr>
+ <tr>
+ <td colspan=4>
+ <b>Search records for:</b><br>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=4>
+ <input name="search" value="<?echo $search?>" size=40>
+ <input type="submit" name="Submit Query">
+ </td>
+ </tr>
+ <tr>
+ <td valign=top>
+ <b>In Fields:</b><br>
+ <select name="ifields" multiple size=8>
+ <?foreach($fields as $key2=>$value2) {?>
+ <option value="<?echo $key2?>" <?=(strstr($fvalue,$key2))?"selected":""?>><?echo $value2?>
+ <?}?>
+ </select>
+ <br>
+ <input type="radio" name="a" onClick="
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ this.form.ifields.options[i].selected=1;
+ }
+ ">All
+ <input type="radio" name="a" onClick="
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ this.form.ifields.options[i].selected=0;
+ }
+ ">None
+ </td>
+ <td valign=top nowrap>
+ <b>Search Where:</b><br>
+ <select name="alter">
+ <option value="0" <?=($alter=="0")?"selected":""?>>Anywhere
+ <option value="1" <?=($alter=="1")?"selected":""?>>Begining
+ <option value="2" <?=($alter=="2")?"selected":""?>>Ending
+ </select><br>
+ <input type="hidden" name="fvalue">
+ <br>
+ <b>Mail Ok</b><br>
+<?
+if(TABLE==CUSTOMER_TABLE)
+{
+ $mail = "mail_ok";
+}
+else
+{
+ $mail = "mailok";
+}
+?>
+ <select name="<?=$mail?>">
+ <option value="n" <?=($$mail=="n")?"selected":""?>>---
+ <option value="1" <?=($$mail=="1")?"selected":""?>>Yes
+ <option value="0" <?=($$mail=="0")?"selected":""?>>No
+ </select>
+ <br>
+ <b>Contestant</b><br>
+ <select name="contestant">
+ <option value="n" <?=($contestant=="n")?"selected":""?>>---
+ <option value="1" <?=($contestant=="1")?"selected":""?>>Yes
+ <option value="0" <?=($contestant=="0")?"selected":""?>>No
+ </select>
+ </td>
+ <td valign=top width="25%" colspan=2>
+ <b>Search Type:</b><br>
+ <select name="search_type" size=4>
+ <option value="1" <?=(!isset($search_type) || $search_type=="1")?"selected":""?>>Exact string
+ <option value="2" <?=($search_type=="2")?"selected":""?>>And
+ <option value="3" <?=($search_type=="3")?"selected":""?>>Or
+ <option value="4" <?=($search_type=="4")?"selected":""?>>Not
+ </select><br>
+ <b>Case Sensitivity:</b><br>
+ <select name="case">
+ <option value="ON" <?=($case == "ON")?"selected":""?>>On
+ <option value="OFF" <?=(!isset($case) || $case == "OFF")?"selected":""?>>Off
+ </select><br>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+<?
+if(is_array($interest2))
+ {
+ echo '<b>Interest:</b><br><select name="cols[]" multiple size="12">';
+ foreach($interest2 as $ikey=>$ivalue)
+ {
+ echo '<option value="'.$ikey.'">'.substr($ivalue,0,20).'...';
+ }
+ echo '</select>';
+ }
+?>
+ </td>
+ <td colspan=2>
+ <?php
+ if(is_array($unit_size2)){
+ echo '<b>Unit Size</b><br><select name="unit[]" multiple size="5">';
+ foreach($unit_size2 as $key=>$value){
+ echo '<option value="'.$key.'">'.$value;
+ }
+ echo '</select><br>';
+ }
+ if(is_array($referred_by2)){
+ echo '<b>Referred By</b><br><select name="referred[]" multiple size="5">';
+ foreach($referred_by2 as $key=>$value){
+ echo '<option value="'.$key.'">'.$value;
+ }
+ echo '</select>';
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <th colspan=4>
+ Output of records:
+ </th>
+ </tr>
+ <tr>
+ <td valign=top>
+ <b>Output Fields:</b><br>
+ <select name="return_fields" multiple size=8>
+ <?foreach($fields as $key2=>$value2) {?>
+ <option value="<?echo $key2?>" <?=(strstr($rfvalue,$key2))?"selected":""?>><?echo $value2?>
+ <?}?>
+ </select>
+ <br>
+ <input type="hidden" name="rfvalue">
+ <input type="radio" name="a" onClick="
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ this.form.return_fields.options[i].selected=1;
+ }
+ for(var i=0;i<<?echo ($p_date_from)?"3":"1";?>;i++) {
+ this.form.dates.options[i].selected=1;
+ }
+ ">All
+ <input type="radio" name="a" onClick="
+ for(var i=0;i<<?echo count($fields)?>;i++) {
+ this.form.return_fields.options[i].selected=0;
+ }
+ for(var i=0;i<<?echo ($p_date_from)?"3":"1";?>;i++) {
+ this.form.dates.options[i].selected=0;
+ }
+ ">None
+ </td>
+ <td valign=top>
+ <input type="hidden" name="rdvalue" value="">
+ <b>Output fields (Dates):</b>
+ <select name="dates" multiple size=3>
+ <?if($p_date_from){?>
+ <option value="arrive_date" <?=(strstr($rdvalue,"arrive_date"))?"selected":""?>>Arrival Date
+ <?}
+ if($a_date_from){?>
+ <option value="depart_date" <?=(strstr($rdvalue,"depart_date"))?"selected":""?>>Departure Date
+ <?}?>
+ <option value="create_date" <?=(strstr($rdvalue,"create_date"))?"selected":""?>>Created Date
+ </select>
+ </td>
+ <td valign=top width=25%>
+ <b>File output:</b><br>
+ <select name="file" size=4>
+ <option value="" <?=(!isset($file) || $file == "")?"selected":""?>>No File
+ <option value="zip" <?=($file=="zip")?"selected":""?>>zip file
+ <option value="gz" <?=($file=="gz")?"selected":""?>>tar.gz(tar ball)
+ <option value="rpt" <?=($file=="rpt")?"selected":""?>>text file
+ </select>
+ </td>
+ <td valign=top class=small width=25%>
+ <b>Delimiter:</b><br>
+ <select name="delimiter" size=4>
+ <option value="tab" <?=($delimiter=="tab")?"selected":""?>>TAB
+ <option value="comma" <?=($delimiter=="comma")?"selected":""?>>Comma
+ <option value="csv" <?=($delimiter=="csv")?"selected":""?>>CSV
+ <option value="pipe" <?=($delimiter=="pipe")?"selected":""?>>Pipe
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="4" align="center">
+ <input type="submit" name="Submit Query">
+ </td>
+ </tr>
+ <tr>
+ <th colspan=4>
+ Search Dates Ranges
+ </th>
+ </tr>
+ <tr>
+ <th colspan=2>
+ From
+ </th>
+ <th colspan=2>
+ To
+ </th>
+ </tr>
+
+ <?if($p_date_from){?>
+ <tr>
+ <th colspan=4>
+ Arrival Date
+ </th>
+ </tr>
+ <tr>
+ <td align="center" colspan=2> <?echo $p_date_from?> </td>
+ <td align="center" colspan=2> <?echo $p_date_to?> </td>
+ </tr>
+ <?}?>
+ <?if($a_date_from){?>
+ <tr>
+ <th colspan=4>
+ Departure Date
+ </th>
+ </tr>
+ <tr>
+ <td align="center" colspan=2> <?echo $a_date_from?> </td>
+ <td align="center" colspan=2> <?echo $a_date_to?> </td>
+ </tr>
+ <?}?>
+ <tr>
+ <th colspan=4>
+ Create Date
+ </th>
+ </tr>
+ <tr>
+ <td align="center" colspan=2> <?echo $c_date_from?> </td>
+ <td align="center" colspan=2> <?echo $c_date_to?> </td>
+ </tr>
+
+ </table>
+<?
+footer();
+?>
--- /dev/null
+<?php
+//$Id: list_contact.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+extract($_POST);
+if(!$start)
+ $start = 0;
+
+if($postquery)
+ $query_string = $postquery;
+if(!$dbd = db_connect())
+ html_error(DB_ERROR_MSG."no connection",1);
+
+$checkqs = "SELECT count(*) as contacts
+ FROM ".TABLE;
+
+if(!$checkres = db_exec($dbd,$checkqs))
+ html_error(DB_ERROR_MSG.__LINE__.$checkqs,1);
+
+$numcontacts = pg_result($checkres,0,"contacts");
+if($numcontacts == 0)
+ html_error("There are no contacts in the database",1);
+
+if(!isset($back) && !isset($query_string)) {
+ $query = "SELECT ".ID.",*
+ FROM ".TABLE."
+ WHERE ".WHERE."
+ ORDER BY lname,fname";
+
+ $query = addslashes($query);
+ $qs = "SELECT id
+ FROM query_db
+ WHERE query_name = '(current)'";
+
+ if(!$res = db_exec($dbd,$qs))
+ html_error(DB_ERROR_MSG.__LINE__.$qs,1);
+
+ if(db_numrows($res)==0) {
+ $qs = "INSERT
+ INTO query_db
+ (query,query_name)
+ VALUES ('$query','(current)')";
+ }
+ else {
+ $id = pg_result($res,0,"id");
+ $qs = "UPDATE query_db
+ SET query = '$query',
+ file = '',
+ delimiter = ''
+ WHERE id = $id";
+ }
+ if(!$res = db_exec($dbd,$qs))
+ html_error(DB_ERROR_MSG.__LINE__.$qs,1);
+ unset($qs);
+}
+
+if($delimiter == "csv")
+ $csv = TRUE;
+
+if(isset($query_string)) {
+ $query_string = strtr($query_string,"\n"," ");
+ $query_string = strtr($query_string,"\t"," ");
+ $query_string = stripslashes($query_string);
+ $qs = $query_string;
+}
+else {
+ $queryqs = "SELECT query
+ FROM query_db
+ WHERE query_name LIKE '(current)'";
+
+ if(!$queryres = db_exec($dbd,$queryqs)) {
+ $qs = "SELECT ".ID.",*
+ FROM ".TABLE."
+ WHERE ".WHERE."
+ ORDER BY lname,fname";
+ }
+ else {
+ //print_r($queryrow);
+ $qs = pg_result($queryres,0,"query");;
+ }
+}
+
+top("List Contacts","help/contact.phtml?key=List");
+?>
+<script src="wm.js"></script>
+<script src="msg.js"></script>
+<?
+html_nav_table($nav,3);
+if(NEWSLETTER){
+ if(NEWSLETTER_TYPE == "TEXT"){
+ ?>
+ <?
+ }
+ elseif(NEWSLETTER_TYPE == "HTML"){
+ ?>
+ <?
+ }
+$mquery = "SELECT subject FROM news_response";
+$mres = db_exec($dbd,$mquery);
+$mailout = pg_result($mres,0,'subject');
+?>
+<script lang="javascript">
+var remind;
+remind = 'This will mailout the Newsletter\n';
+remind += '<?echo $mailout?>\n';
+</script>
+<table id="admin-list-table">
+ <tr>
+ <th colspan=2>
+<form action="mailout.phtml" method="POST" onSubmit="
+return(confirm(remind));
+">
+<input type="hidden" name="postmail" value="<?echo $qs?>">
+<input type="submit" value="Mail Out the Newsletter">
+</form>
+ </th>
+</tr>
+<?}?>
+<tr>
+ <th> Functions: </th>
+ <th> Contact Info </th>
+</tr>
+<?
+$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,"SET DATESTYLE TO 'SQL,US';".$qs);
+?>
+<tr>
+ <td colspan="2"><?echo $totalnum?>Result(s)</td>
+</tr>
+<?
+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;
+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 = "<a href=\"list_contact.phtml?".$stuff."&start=".$last."\">PREV</a>";
+if($end < $totalnum)
+ $next = "<a href=\"list_contact.phtml?".$stuff."&start=".$end."\">NEXT</a>";
+else
+ $next = "NEXT";
+ ?>
+<tr>
+ <td colspan="2">
+ <?
+ if($num!=0)
+ echo $prev."-".($start+1)."-to-".$end."-".$next;
+ ?>
+ </td>
+</tr>
+<?
+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<count($row);$b++) {
+ $fields[$b] = pg_fieldname($res,$b);
+ if($csv)
+ $result_string .= "\"".$row[$fields[$b]]."\"";
+ else
+ $result_string .= $row[$fields[$b]];
+ if($b != count($row)-1)
+ $result_string .= $delimiter;
+ if($b == count($row)-1)
+ $result_string .= "\n";
+ }
+ if($i%2==0) {
+ $background = " bgcolor=\"#bfbfbf\"";
+ }
+ else {
+ $background = " bgcolor=\"#e0e0e0\"";
+ }
+ ?>
+ <tr <?echo $background;
+ $id = ID;
+ ?>>
+ <td nowrap><a href="edit_contact.phtml?id=<?echo $row[$id]?>">
+ [Edit]</a>
+ <a href="update_contact.phtml?Command=Delete&id=<?echo $row[$id]?>" onClick="
+ if(confirm('This will delete this record Are you sure?')) {
+ return(true);
+ }else {
+ return(false);
+ }
+ ">
+ [Delete]</a>
+ </td>
+ <td align=left>
+ <?
+ foreach($fields as $key) {
+ if($key != "id" && $key != "cust_id"
+ && $key != "userid" && $key != "usernum"
+ && $key != "usergroup" && $key != "passwd")
+ echo $row[$key]." ";
+ }
+ ?>
+ </td>
+ </tr>
+ <?
+ }
+ }
+ ?>
+ <?
+if(isset($file) && $file != "" && db_numrows($res) > 0) {
+?>
+<tr>
+ <th>Download files</th>
+</tr>
+<tr>
+ <td colspan=2><form action="download.phtml">
+ <input type="hidden" name="query_string" value="<?echo $query_string?>">
+ <input type="hidden" name="file" value="<?echo $file?>">
+ <input type="hidden" name="delimiter" value="<?echo $delimiter?>">
+ <input type="hidden" name="csv" value="<?echo $csv?>">
+ <input type="submit" value="Download Report">
+ </form></td>
+</tr>
+<?
+}
+echo '</table>';
+html_nav_table($nav,3);
+footer();
+?>
--- /dev/null
+<?php
+//$Id: list_query.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+top("Query DB","");
+
+html_nav_table($nav,3);
+?>
+<script src="<?echo URL_BASE."admin/wm.js"?>"></script>
+<script src="<?echo URL_BASE."admin/msg.js"?>"></script>
+<table id="admin-list-table">
+<tr>
+ <th>
+ Functions:
+ </th>
+ <th>
+ Queries in database
+ </th>
+</tr>
+<?
+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<db_numrows($res);$i++) {
+ $row = db_fetch_array($res,$i,PGSQL_ASSOC);
+
+?>
+ <script lang="javascript">
+ var o<?echo $i?> = new Object();
+ o<?echo $i?>.msg = 'You are about to Permanently Delete this Query';
+ o<?echo $i?>.url = 'del_query.phtml?id=<?echo $row[id]?>';
+ o<?echo $i?>.popup = '1';
+ o<?echo $i?>.popup.name = "delwin";
+ o<?echo $i?>.width = 630;
+ o<?echo $i?>.height = 300;
+ </script>
+<tr>
+ <td>
+ <a href="query_contact.phtml?query_no=<?echo $row[id]?>">[Recall]</a>
+ <?if($row[query_name] != "(current)") {?>
+ <a href="del_query.phtml?id=<?echo $row[id]?>" onClick="
+ glm_confirm(o<?echo $i?>);
+ return(false);
+ ">[Delete]</a>
+ <?}?>
+ </td>
+ <td><b><?echo $row[query_name]?></b></td>
+</tr>
+<?}?>
+</table>
+<?
+footer();
+?>
--- /dev/null
+<html>
+<head>
+<title>Mailing out The Newsletter (Retail)</title>
+</head>
+<body bgcolor=white>
+<?php
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+// File names for SPAMerizer
+$Filename = tempnam( "/var/spool/SPAMerizer", "TROUT" );
+unlink($Filename);
+
+$HeadFilename = $Filename.".head";
+$BodyFilename = $Filename.".body";
+$ToFilename = $Filename.".to";
+$ReadyFilename = $Filename.".ready";
+
+if(!$dbd = db_connect(CONN_STR))
+ html_error(DB_ERROR_MSG,1);
+$postmail = stripslashes($postmail);
+$postmail = eregi_replace("SELECT.*FROM","SELECT email INTO TEMPORARY temp_table FROM",$postmail);
+$postmail = eregi_replace("ORDER BY.*","",$postmail);
+$postmail .= " AND ".MAILOK." = 't'";
+$postmail .= ";CREATE INDEX email_indx on temp_table (email);";
+
+if(!$mailres = db_exec($dbd,$postmail))
+ html_error(DB_ERROR_MSG.__LINE__.$postmail,1);
+
+$mailqs = "SELECT
+ DISTINCT ON (email) email
+ FROM temp_table
+ GROUP BY email;";
+flush();
+if(!$mailres = db_exec($dbd,$mailqs))
+ html_error(DB_ERROR_MSG.__LINE__.$mailqs,1);
+
+if(db_numrows($mailres)>0)
+ {
+ for($a=0;$a<db_numrows($mailres);$a++)
+ {
+ $mvdata = db_fetch_array($mailres,$a,PGSQL_ASSOC);
+ $email = trim($mvdata["email"]);
+ if($email)
+ {
+ $mail[] = $email;
+ }
+ }
+ }
+if(is_array($mail) && count($mail)>0) {
+ // 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 = 1";
+ if(!$resres = db_exec($dbd,$responseqs))
+ html_error(DB_ERROR_MSG.$responseqs,0);
+
+ $responserow = db_fetch_array($resres,0,PGSQL_ASSOC);
+ unset($data);
+ /*
+ ob_start();
+ require(BASE."bottomlinks.inc");
+ $data['bottomlinks'] = ob_get_contents();
+ ob_end_clean();
+ */
+
+ $subject = trim($responserow['subject']);
+ $data['subject'] = &$subject;
+ $data['url'] = URL_BASE;
+ $message = $responserow['response'];
+ // html part of email
+ //$data['response'] = stripslashes(nl2br($message));
+ $message = str_replace("COUPON","<!-- coupon -->",$message);
+ $message = str_replace("IMAGE1","<!-- image -->",$message);
+ $message = str_replace("IMAGE2","<!-- image2 -->",$message);
+ $message = str_replace("IMAGE3","<!-- image3 -->",$message);
+ $data['response'] = $message;
+
+ $data['image'] = add_image($responserow["image"],"right",$responserow['image_link']);
+ $data['image2'] = add_image($responserow["image2"],"left",$responserow['image2_link']);
+ $data['image3'] = add_image($responserow["image3"],"right",$responserow['image3_link']);
+ $data['coupon'] = add_image($responserow["coupon"],"right",$responserow['coupon_link']);
+ $data['url'] = URL_BASE;
+ $data['year'] = date("Y");
+ $data['bailout'] = "<br clear=\"all\"><br>-------------------------------------------------------------------<br>";
+ $data['bailout'] .= "You are receiving this message because you have expressed an interest in<br>";
+ $data['bailout'] .= "receiving specials and information from ".SITENAME.". If you do not<br>";
+ $data['bailout'] .= "wish to receive future items of this nature, please reply to this e-mail<br>";
+ $data['bailout'] .= "with the word \"CANCEL\" on the subject line. You will then be removed <br>";
+ $data['bailout'] .= "from future mailings. ";
+ $data['bailout'] .= "<a href=\"".URL_BASE."\"><B> ".SITENAME."</b></a><br>";
+ $data['bailout'] .= "-------------------------------------------------------------------<br>";
+ $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: info@troutcreek.com\n"
+ . "ReportInterval: 2\n"
+ . "BlockSive: 20\n"
+ . "ProductionMode: ".PRODUCTION_MODE."\n";
+
+ $fp = fopen($HeadFilename,"w");
+ fputs($fp,$glm_headers,strlen($glm_headers));
+ fclose($fp);
+
+ $headers = "From: TroutCreekNews <news@troutcreek.com>\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="utf-8"
+'.$text.'
+--ContentBoundry
+Content-Type: text/html; charset="utf-8"
+
+'.$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);
+?>
+<table>
+<tr>
+ <td>Mail the current <?echo $subject?></td>
+</tr>
+<tr>
+ <td><?echo (PRODUCTION_MODE == "ON")?"ProductionMode is ON, Mail is sent.":"ProductionMode is OFF, Mail is not sent."?></td>
+</tr>
+<tr>
+ <td><?echo (HTML_EMAIL == "ON")?"HTML Email is ON, Mail is html encoded.":"HTML Email is OFF, Mail is plain text."?></td>
+</tr>
+<tr>
+ <td>You will recieve notification on the mailing task by email at <?=OWNER_EMAIL?>.</td>
+</tr>
+</table>
+<?
+ }
+ else {
+?>
+<table width=500 bgcolor="#e0e0e0">
+<tr bgcolor="#2f4f4f">
+ <th><font color=white>Newsletter Not Sent!</th>
+ </tr>
+</table>
+<?
+ }
+
+?>
+</body>
+</html>
--- /dev/null
+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;
+}
--- /dev/null
+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);
+ }
+ }
+}
--- /dev/null
+<html>
+<head>
+<title>Trout Creek Condominiums Newsletter</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+td, div { font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px; color: #000000;}
+
+a:link { color: #0f3220; }
+a:visited { color: #0f3220; }
+a:hover { color: #4e6e52; }
+a:link { color: #0f3220; }
+
+h1 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 18px;
+ font-weight: bold;
+ color: #213A62;
+ margin-bottom: 4px;}
+h2 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ font-weight: bold;
+ color: #0f3220;
+ margin-bottom: 3px;
+ margin-top: 15px;
+ clear: both;
+ }
+.address {
+ float: bottom;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ color: #1c3962;
+ margin: 10px;}
+-->
+</style>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<style type="text/css">
+<!--
+td, div { font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px; color: #000000;}
+
+a:link { color: #0f3220; }
+a:visited { color: #0f3220; }
+a:hover { color: #4e6e52; }
+a:link { color: #0f3220; }
+
+h1 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 18px;
+ font-weight: bold;
+ color: #213A62;
+ margin-bottom: 4px;}
+h2 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ font-weight: bold;
+ color: #0f3220;
+ margin-bottom: 3px;
+ margin-top: 15px;
+ clear: both;
+ }
+.address {
+ float: bottom;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ color: #1c3962;
+ margin: 10px;}
+-->
+</style>
+ <div align="center" style="border: 1px solid #2a8251; width: 550px; margin: 0 auto;">
+ <div align="left">
+ <table cellspacing="0" cellpadding="0" border="0" width="550" style="width: 500px;">
+ <tr>
+ <td width="275"><a href="<!-- url -->"><img src="<!-- url -->assets/newsletter-logo.gif" width="275" height="91" alt="" title="Trout Creeks Website" border="0" style="display: block;"></a></td>
+ <td width="138"><a href="http://reservations.troutcreek.com/irm/AccessType.ASP"><img src="<!-- url -->assets/newsletter-reservation.gif" width="138" height="91" alt="" title="Make a Reservation" border="0" style="display: block;"></a></td>
+ <td width="137"><a href="<!-- url -->specialspackages-4/"><img src="<!-- url -->assets/newsletter-specials.gif" width="137" height="91" alt="" title="Check our current specials" border="0" style="display: block;"></a></td>
+ </tr>
+ </table>
+ <div style="margin: 10px;">
+ <!-- response -->
+ </div>
+ <div style="font-size: 11px;"><!-- bailout --></div>
+ <div class="address">
+ 4749 Pleasantview ~
+ Harbor Springs, MI 49740 ~
+ <b>1-231-526-2148 ~
+ 1-800-748-0245</b> ~
+ <a href="mailto:info@troutcreek.com">info@troutcreek.com</a>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
--- /dev/null
+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
+
--- /dev/null
+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
--- /dev/null
+\connect - postgres
+
+CREATE TABLE "contact" (
+ "id" SERIAL,
+ "create_date" date,
+ "fname" character varying(8104),
+ "lname" character varying(8104),
+ "address" character varying(8104),
+ "city" character varying(8104),
+ "state" character varying(8104),
+ "zip" character varying(8104),
+ "country" character varying(8104),
+ "phone" character varying(8104),
+ "fax" character varying(8104),
+ "email" character varying(8104),
+ "user_agent" character varying(8104),
+ "remote_addr" character varying(8104),
+ "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,
+ "query_name" character varying(8000),
+ "query" character varying(8000),
+ "file" character varying(100),
+ "delimiter" character varying(100)
+);
+
+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,
+ "subject" text,
+ "response" text,
+ "mailout" date
+);
+
+REVOKE ALL on "news_response" from PUBLIC;
+GRANT ALL on "news_response" to "postgres";
+GRANT ALL on "news_response" to "nobody";
+
+INSERT INTO news_response (subject,response) values ('subject','response');
--- /dev/null
+<?
+include("../../setup.phtml");
+include("contact_setup.inc");
+unset($data);
+/*
+ob_start();
+require(BASE."bottomlinks.inc");
+$data['bottomlinks'] = ob_get_contents();
+ob_end_clean();
+*/
+
+$query = "SELECT * FROM news_response WHERE id = 1";
+$res = db_auto_get_data($query, CONN_STR);
+$data['url'] = URL_BASE;
+$data['subject'] = $res[0]["subject"];
+$response = $res[0]["response"];
+$response = str_replace("COUPON","<!-- coupon -->",$response);
+$response = str_replace("IMAGE1","<!-- image -->",$response);
+$response = str_replace("IMAGE2","<!-- image2 -->",$response);
+$response = str_replace("IMAGE3","<!-- image3 -->",$response);
+$data['response'] = $response;
+$data['coupon'] = add_image($res[0]["coupon"],"right",$res[0]["coupon_link"]);
+$data['image'] = add_image($res[0]["image"],"right",$res[0]["image_link"]);
+$data['image2'] = add_image($res[0]["image2"],"left",$res[0]["image2_link"]);
+$data['image3'] = add_image($res[0]["image3"],"right",$res[0]["image3_link"]);
+$data['year'] = date("Y");
+$data['bailout'] = "<br clear=\"all\"><br>-------------------------------------------------------------------<br>";
+$data['bailout'] .= "You are receiving this message because you have expressed an interest in<br>";
+$data['bailout'] .= "receiving specials and information from ".SITENAME.". If you do not<br>";
+$data['bailout'] .= "wish to receive future items of this nature, please reply to this e-mail<br>";
+$data['bailout'] .= "with the word \"CANCEL\" on the subject line. You will then be removed <br>";
+$data['bailout'] .= "from future mailings. ";
+$data['bailout'] .= "<a href=\"".URL_BASE."\"><B> ".SITENAME."</b></a><br>";
+$data['bailout'] .= "-------------------------------------------------------------------<br>";
+$page = explode_template(NEWSLETTER_PROTOTYPE,$data);
+echo $page;
+?>
--- /dev/null
+<?php
+session_start();
+//$Id: query_contact.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+/* Includes */
+include("../../setup.phtml");
+include("contact_setup.inc");
+extract($_POST);
+session_register("sess_vars");
+function clean_array(&$array){
+ if(is_array($array)){
+ $counter = 0;
+ foreach($array as $key=>$value){
+ if($value == ""){
+ unset($array[$counter]);
+ }
+ $counter++;
+ }
+ }
+}
+$sess_vars = $HTTP_POST_VARS;
+if(!isset($query_no)) {
+ /* The fields array is sent as a string
+ split it out using : as delimiter */
+ $fvalue = ereg_replace("^:","",$fvalue);
+ $fields = split(":",$fvalue);
+ $rfvalue = ereg_replace("^:","",$rfvalue);
+ $return_fields = split(":",$rfvalue);
+ $dates = ereg_replace("^:","",$rdvalue);
+ $dates = split(":",$dates);
+ clean_array($return_fields);
+ clean_array($dates);
+ if(!isset($search)) {
+ header("Location: index.phtml");
+ }
+ /* Chop off whitespaces spaces */
+ $search = chop(trim($search));
+ if( !$search && ( count( $fields ) == 1 && $fields[0] == '' ) )
+ {
+ $ALL = TRUE;
+ }
+
+ function getKeywords($keywords) {
+ /* Replace the whitespace with a , */
+ $keywords = ereg_replace(" ",",",$keywords);
+
+ while(ereg(",,",$keywords)) {
+ /* Replace the ,, with a , */
+ $keywords = ereg_replace(",,",",",$keywords);
+ }
+ $seperated = explode(",",$keywords);
+ /* Return exploded string */
+ return $seperated;
+ }
+
+ switch($search_type) {
+ case "1":
+ $keywords = $search;
+ $compare = "OR";
+ break;
+
+ case "2":
+ $keywords = getKeywords($search);
+ $compare = "AND";
+ break;
+
+ case "3":
+ $keywords = getKeywords($search);
+ $compare = "OR";
+ break;
+
+ case "4":
+ $keywords = getKeywords($search);
+ $compare = "AND";
+ $NOT = TRUE;
+ break;
+
+ default:
+ echo "not valid";
+ break;
+ }
+
+ if(is_array($keywords)) {
+ for($rip=0;$rip<count($keywords);$rip++) {
+ $keywords[$rip] = trim($keywords[$rip]);
+ /* if * is at the begging the replace with .* */
+ $keywords[$rip] = ereg_replace("[\x2a]",".*",$keywords[$rip]);
+ $keywords[$rip] = ereg_replace("[\x3f]",".?",$keywords[$rip]);
+ $keywords[$rip] = ereg_replace("[\x2b]",".+",$keywords[$rip]);
+ }
+ }
+ else {
+ $keywords = trim($keywords);
+ /* if * is at the begging the replace with .* */
+ $keywords = ereg_replace("[\x2a]",".*",$keywords);
+ $keywords = ereg_replace("[\x3f]",".?",$keywords);
+ $keywords = ereg_replace("[\x2b]",".+",$keywords);
+ }
+
+ switch($alter) {
+ /* $alter defines where to look in fields */
+ case "1":
+ $begin = "^";
+ $end = "";
+ break;
+
+ case "2":
+ $begin = "";
+ $end = " *$";
+ break;
+
+ default:
+ $begin = "";
+ $end = "";
+ break;
+ }
+
+ $operator = " ";
+ if($NOT) {
+ $operator .= "!~";
+ }
+ else {
+ $operator .= "~";
+ }
+ if($case == "OFF") {
+ $operator .= "*";
+ }
+ if($search == "" && !( count( $fields ) == 1 && $fields[0] == '' ) )
+ {
+ $operator = "=";
+ }
+ $operator .= " ";
+
+ /* finally, build the query string from string or array $keywords */
+ $query_string = "SELECT ".ID;
+ if(count($return_fields)>0){
+ $rf = implode(",",$return_fields);
+ $query_string .= ", $rf";
+ }
+ if(count($dates)>0){
+ $rd = implode(",",$dates);
+ $query_string .= ", $rd";
+ }
+ if(!$ALL) {
+ $query_string .= "\nFROM\t".TABLE." \nWHERE\t".WHERE."\nAND\t";
+ for($b=0;$b<count($fields);$b++) {
+ $totalb = count($fields)-1;
+ if(is_array($keywords)) {
+ for($c=0;$c<count($keywords);$c++) {
+ $totalc = count($keywords)-1;
+ $query_string .= $fields[$b].$operator."'".
+ $begin.$keywords[$c].$end."'";
+ if($c != $totalc) {
+ $query_string .= " \n$compare\t";
+ }
+ }
+ }
+ else {
+ $query_string .= $fields[$b].$operator."'". $begin.$keywords.$end."'";
+ }
+ if($b != $totalb) {
+ $query_string .= " \n$compare\t";
+ }
+ }
+ }
+ else {
+ $query_string .= "\nFROM\t".TABLE." \nWHERE\t".WHERE."\n";
+ }
+ if($mail_ok == "1") {
+ $query_string .= " AND mail_ok = 't'";
+ }
+ if($mail_ok == "0") {
+ $query_string .= " AND mail_ok = 'f'";
+ }
+
+ if($contestant == "1") {
+ $query_string .= " AND contestant = 't'";
+ }
+ if($contestant == "0") {
+ $query_string .= " AND contestant = 'f'";
+ }
+
+ if(is_array($unit)){
+ $query_string .= " AND (";
+ foreach($unit as $ukey=>$uval){
+ $unit_qs[] = " unit_size = $uval";
+ }
+ $query_string .= implode(" OR ",$unit_qs);
+ $query_string .= " )";
+ }
+
+ if(is_array($referred)){
+ $query_string .= " AND (";
+ foreach($referred as $rkey=>$rval){
+ $referred_qs[] = " referred_by = $rval";
+ }
+ $query_string .= implode(" OR ",$referred_qs);
+ $query_string .= " )";
+ }
+
+ if( is_array( $cols ) )
+ {
+ foreach( $cols as $ikey => $ival )
+ {
+ $query_string .= " AND interest $operator ':$ival:'";
+ }
+ }
+
+ 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 arrive_date >= '$fp_date'
+ AND arrive_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 depart_date >= '$fa_date'
+ AND depart_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 arrive_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 depart_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,3);
+?>
+<script src="<?echo URL_BASE."admin/wm.js"?>"></script>
+<script src="<?echo URL_BASE."admin/msg.js"?>"></script>
+
+<table id="admin-list-table">
+<tr>
+ <th>
+ Submit Query
+ </th>
+ </tr>
+ <tr>
+ <td><a href="index.phtml">Go Back to Query page</a></td>
+ </tr>
+ <tr>
+ <td>
+ <?echo nl2br($showq)?>
+ <br>
+ <?if(isset($query_name)) {
+ echo "Query ".$query_name." Recalled";
+ }?>
+
+ <form action="list_contact.phtml" method="POST">
+ <input type="hidden" name="delimiter" value="<?echo $delimiter?>">
+ <input type="hidden" name="file" value="<?echo $file?>">
+ <input type="hidden" name="query_string" value="<?echo $query_string?>">
+ <input type="hidden" name="Submit" value="Submit Query">
+ <center>
+ <input type="submit" value="Send Query">
+ </form>
+ </center>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ Do you wish to save this query for future use?
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <a href="" onClick="
+ glm_open(o_save);
+ return(false);
+ ">Save This Query</a>
+ </td>
+</tr>
+</table>
+<script lang="javascript">
+ var o_save = new Object();
+ o_save.url = 'query_save.phtml';
+ o_save.name = 'savewin';
+ o_save.width = 510;
+ o_save.height = 150;
+</script>
+<?
+/* 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();
+?>
--- /dev/null
+<?php
+//$Id: query_db.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+
+if(!isset($file)) $file = "";
+if(!isset($delimiter)) $delimiter = "";
+
+$qs = "UPDATE query_db
+ SET query_name = '$query_name'
+ WHERE query_name = '(current)'";
+
+if(!db_auto_exec($qs)) html_error(DB_ERROR_MSG.$qs,1);
+
+html_header("Saving Query","Saved","");
+?>
+Query is saved as <?echo $query_name?>
+<center><a href="" onClick="window.close();return(false);">Close This
+Window</a></center>
--- /dev/null
+<?
+//$Id: query_save.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+?>
+<html>
+<body>
+<table width=500 cellpadding=4 cellspacing=0 border=0>
+ <tr>
+ <th>
+ Do you wish to save this query for future use?
+ </th>
+ </tr>
+ <tr>
+ <td>Name of query
+
+ <form name="form2" action="query_db.phtml" method="POST">
+ <input type="hidden" name="query" value="<?echo $query_string?>">
+ <input type="hidden" name="delimiter" value="<?echo $delimiter?>">
+ <input type="hidden" name="file" value="<?echo $file?>">
+ <input name="query_name">
+ <input type="submit" name="Submit" value="Save">
+ </form>
+ </td>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php\r
+include_once("../../setup.phtml");\r
+# include_once("../graphics.lib" );\r
+\r
+ switch($Command) {\r
+ \r
+ case "Update":\r
+ \r
+ $dbd = db_connect();\r
+ \r
+ if(!$dbd) html_error(DB_ERROR_MSG,1);\r
+ \r
+ if( $coupon == '' ) $coupon = 'none';\r
+ if( $image == '' ) $image = 'none';\r
+ if( $image2== '' ) $image2= 'none';\r
+ if( $image3== '' ) $image3= 'none';\r
+ \r
+ \r
+ if ($coupon == 'none' || $delcoupon == 'TRUE')\r
+ $coupon_upload = 'FALSE';\r
+ else\r
+ $coupon_upload = 'TRUE';\r
+ \r
+ if ($image == 'none' || $delimage == 'TRUE')\r
+ $img_upload = 'FALSE';\r
+ else\r
+ $img_upload = 'TRUE';\r
+\r
+ if ($image2 == 'none' || $delimage2 == 'TRUE')\r
+ $img_upload2 = 'FALSE';\r
+ else\r
+ $img_upload2 = 'TRUE';\r
+\r
+ if ($image3 == 'none' || $delimage3 == 'TRUE')\r
+ $img_upload3 = 'FALSE';\r
+ else\r
+ $img_upload3 = 'TRUE';\r
+ \r
+ // **Coupon**\r
+ \r
+ if ($coupon_upload == 'TRUE')\r
+ {\r
+ $coupon_upload_array = img_upload($coupon,$coupon_name,BASE . "images/");\r
+ img_resize($coupon_upload_array[1],RESIZED_PATH."/$coupon_upload_array[0]",'a', "320");\r
+ img_resize($coupon_upload_array[1],MIDSIZED_PATH."/$coupon_upload_array[0]",'a',"180");\r
+ img_resize($coupon_upload_array[1],THUMB_PATH."/$coupon_upload_array[0]",'a',"90");\r
+ $coupon_name = $coupon_upload_array[0];\r
+\r
+ if($oldcoupon != '')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldcoupon");\r
+ @unlink(RESIZED_PATH."/$oldcoupon");\r
+ @unlink(MIDSIZED_PATH."/$oldcoupon");\r
+ @unlink(THUMB_PATH."/$oldcoupon");\r
+ }\r
+ }\r
+ elseif ($coupon_upload == 'FALSE')\r
+ {\r
+ if($delcoupon == 'TRUE')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldcoupon");\r
+ @unlink(RESIZED_PATH."/$oldcoupon");\r
+ @unlink(MIDSIZED_PATH."/$oldcoupon");\r
+ @unlink(THUMB_PATH."/$oldcoupon");\r
+ $coupon_name = '';\r
+ }\r
+ else\r
+ {\r
+ $coupon_name = $oldcoupon;\r
+ }\r
+ }\r
+\r
+ // **IMAGE ONE**\r
+ \r
+ if ($img_upload == 'TRUE')\r
+ {\r
+ $image_upload_array = img_upload($image,$image_name,BASE . "images/");\r
+ img_resize($image_upload_array[1],RESIZED_PATH."/$image_upload_array[0]",'a', "320");\r
+ img_resize($image_upload_array[1],MIDSIZED_PATH."/$image_upload_array[0]",'a',"180");\r
+ img_resize($image_upload_array[1],THUMB_PATH."/$image_upload_array[0]",'a',"90");\r
+ $image_name = $image_upload_array[0];\r
+\r
+ if($oldimage != '')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage");\r
+ @unlink(RESIZED_PATH."/$oldimage");\r
+ @unlink(MIDSIZED_PATH."/$oldimage");\r
+ @unlink(THUMB_PATH."/$oldimage");\r
+ }\r
+ }\r
+ elseif ($img_upload == 'FALSE')\r
+ {\r
+ if($delimage == 'TRUE')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage");\r
+ @unlink(RESIZED_PATH."/$oldimage");\r
+ @unlink(MIDSIZED_PATH."/$oldimage");\r
+ @unlink(THUMB_PATH."/$oldimage");\r
+ $image_name = '';\r
+ }\r
+ else\r
+ {\r
+ $image_name = $oldimage;\r
+ }\r
+ }\r
+\r
+ // ***IMAGE TWO***\r
+ \r
+ if ($img_upload2 == 'TRUE')\r
+ {\r
+ $image_upload_array2 = img_upload($image2,$image2_name,BASE . "images/");\r
+ img_resize($image_upload_array2[1],RESIZED_PATH."/$image_upload_array2[0]",'a', "320");\r
+ img_resize($image_upload_array2[1],MIDSIZED_PATH."/$image_upload_array2[0]",'a',"180");\r
+ img_resize($image_upload_array2[1],THUMB_PATH."/$image_upload_array2[0]",'a',"90");\r
+ $image2_name = $image_upload_array2[0];\r
+\r
+ if($oldimage2 != '')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage2");\r
+ @unlink(RESIZED_PATH."/$oldimage2");\r
+ @unlink(MIDSIZED_PATH."/$oldimage2");\r
+ @unlink(THUMB_PATH."/$oldimage2");\r
+ }\r
+ }\r
+ elseif ($img_upload2 == 'FALSE')\r
+ {\r
+ if($delimage2 == 'TRUE')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage2");\r
+ @unlink(RESIZED_PATH."/$oldimage2");\r
+ @unlink(MIDSIZED_PATH."/$oldimage2");\r
+ @unlink(THUMB_PATH."/$oldimage2");\r
+ $image2_name = '';\r
+ }\r
+ else\r
+ {\r
+ $image2_name = $oldimage2;\r
+ }\r
+ }\r
+\r
+ \r
+ // ***IMAGE THREE***\r
+ \r
+ if ($img_upload3 == 'TRUE')\r
+ {\r
+ $image_upload_array3 = img_upload($image3,$image3_name,BASE . "images/");\r
+ img_resize($image_upload_array3[1],RESIZED_PATH."/$image_upload_array3[0]",'a', "320");\r
+ img_resize($image_upload_array3[1],MIDSIZED_PATH."/$image_upload_array3[0]",'a',"180");\r
+ img_resize($image_upload_array3[1],THUMB_PATH."/$image_upload_array3[0]",'a',"90");\r
+ $image3_name = $image_upload_array3[0];\r
+\r
+ if($oldimage3 != '')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage3");\r
+ @unlink(RESIZED_PATH."/$oldimage3");\r
+ @unlink(MIDSIZED_PATH."/$oldimage3");\r
+ @unlink(THUMB_PATH."/$oldimage3");\r
+ }\r
+ }\r
+ elseif ($img_upload3 == 'FALSE')\r
+ {\r
+ if($delimage3 == 'TRUE')\r
+ {\r
+ @unlink(IMAGE_PATH."/$oldimage3");\r
+ @unlink(RESIZED_PATH."/$oldimage3");\r
+ @unlink(MIDSIZED_PATH."/$oldimage3");\r
+ @unlink(THUMB_PATH."/$oldimage3");\r
+ $image3_name = '';\r
+ }\r
+ else\r
+ {\r
+ $image3_name = $oldimage3;\r
+ }\r
+ }\r
+\r
+\r
+ http_strip($coupon_link);\r
+ http_strip($image_link);\r
+ http_strip($image2_link);\r
+ http_strip($image3_link);\r
+ $qs = "UPDATE news_response \r
+ SET subject = '$subject',\r
+ response = '$response',\r
+ coupon = '$coupon_name',\r
+ coupon_link = '$coupon_link',\r
+ image = '$image_name',\r
+ image_link = '$image_link',\r
+ image2 = '$image2_name',\r
+ image2_link = '$image2_link',\r
+ image3 = '$image3_name',\r
+ image3_link = '$image3_link'\r
+ WHERE id = $id";\r
+\r
+ if(!db_exec($dbd,$qs)) html_error("failed ->".$qs,1);\r
+ \r
+ \r
+ break;\r
+ \r
+ case "Insert":\r
+ $dbd = db_connect();\r
+ \r
+ if(!$dbd) html_error(DB_ERROR_MSG,1);\r
+ \r
+ $qs = "INSERT INTO news_response \r
+ (subject,response)\r
+ VALUES \r
+ ('$subject','$response')";\r
+ \r
+ if(!db_exec($dbd,$qs)) html_error(DB_ERROR_MSG.$qs,1);\r
+ \r
+ \r
+ break;\r
+ \r
+ case "Cancel":\r
+ break;\r
+ \r
+ default:\r
+ html_error("incorrect value for Command",1);\r
+ break;\r
+ }\r
+ $location = "view_newsletter.phtml?id=$id";\r
+ \r
+header("Location: $location");\r
+?>\r
--- /dev/null
+<?php
+//$Id: update_contact.phtml,v 1.1.1.1 2008/07/08 15:02:13 jmeek Exp $
+include("../../setup.phtml");
+include("contact_setup.inc");
+$location = "list_contact.phtml?back=1";
+
+if( is_array( $interest ) ){
+ $interest = ':'.implode(":",$interest).':';
+}
+//if(is_array($interest2)){
+//$interest = "";
+//for($i=0;$i<count($interest2);$i++)
+// {
+// $temp = "interest_".$i;
+// if(isset(${$temp}))
+// $interest .= ${$temp}.":";
+// }
+//}
+http_strip($url);
+
+$LAST = count($DB_fields)-1;
+if($REQUEST_METHOD == "POST" || $Command == "Delete")
+ {
+ switch($Command)
+ {
+ case "Update":
+ for($i=0;$i<count($DB_fields);$i++)
+ {
+ if($DB_fields[$i][type]=="img")
+ {
+ $tmp = $DB_fields[$i]['name'];
+ $image = $$tmp;
+ $oldimage = ${$tmp."_old"};
+ $image_name = ${$tmp."_name"};
+ if($image == "none" || $image == "")
+ {
+ $image_name = $oldimage;
+ }
+ else
+ {
+ $image_name = process_image($image,$image_name);
+ }
+ $delete = ${"delete".$tmp};
+ if($delete==1)
+ {
+ $image_name = "";
+ @unlink(ORIGINAL_PATH."/".$oldimage);
+ @unlink(RESIZED_PATH.$oldimage);
+ @unlink(THUMB_PATH.$oldimage);
+ @unlink(MIDSIZED_PATH.$oldimage);
+ }
+ }
+ }
+ $DB_fields = array_reverse($DB_fields);
+ $qs = "UPDATE ".TABLE." SET ";
+ for($i=0;$i<count($DB_fields);$i++)
+ {
+ if($DB_fields[$i][type]=="date")
+ {
+ if($$DB_fields[$i][name] == ""){
+ continue;
+ }
+ $qs .= $DB_fields[$i][name]." = '".$$DB_fields[$i][name]."'";
+ if($i != $LAST)
+ $qs .= ",";
+ /*
+ $month = $DB_fields[$i][name]."_month";
+ $day = $DB_fields[$i][name]."_day";
+ $year = $DB_fields[$i][name]."_year";
+ $date = date("Y-m-d H:i:s T",mktime(0,0,0,$$month,$$day,$$year));
+ $qs .= $DB_fields[$i][name]." = '$date'";
+ if($i != $LAST)
+ $qs .= ",";
+ */
+ }
+ elseif($DB_fields[$i][type]=="datetime")
+ {
+ $month = $DB_fields[$i][name]."_month";
+ $day = $DB_fields[$i][name]."_day";
+ $year = $DB_fields[$i][name]."_year";
+ $H = $DB_fields[$i][name]."_hour";
+ $mm = $DB_fields[$i][name]."_mm";
+ if($$mm == "PM")
+ $$H = $$H + 12;
+ $m = $DB_fields[$i][name]."_min";
+ $date = date("Y-m-d",mktime($$H,$$m,0,$$month,$$day,$$year));
+ if($date = "1969-12-31")
+ $date = date("Y-m-d");
+ $qs .= $DB_fields[$i][name]." = '$date'";
+ if($i != $LAST)
+ $qs .= ",";
+ }
+ elseif($DB_fields[$i][type]=="array_drop")
+ {
+ if($$DB_fields[$i][name] == "")
+ $qs .= $DB_fields[$i][name]." = NULL";
+ else
+ $qs .= $DB_fields[$i][name]." = '".$$DB_fields[$i][name]."'";
+ if($i != $LAST)
+ $qs .= ",";
+ }
+ elseif($DB_fields[$i][name]!=ID)
+ {
+ if($DB_fields[$i][type]=="img")
+ {
+ $qs .= $DB_fields[$i][name]." = '".$image_name."'";
+ if($i != $LAST)
+ $qs .= ",";
+ }
+ elseif($DB_fields[$i][type]=="static")
+ {
+ }
+ elseif($DB_fields[$i][type]=="password")
+ {
+ if(($password && $password2) && ($password == $password2))
+ {
+ $qs .= $DB_fields[$i][name]." = '".$$DB_fields[$i][name]."'";
+ if($i != $LAST)
+ $qs .= ",";
+ }
+ }
+ else
+ {
+ $qs .= $DB_fields[$i][name]." = '".$$DB_fields[$i][name]."'";
+ if($i != $LAST)
+ $qs .= ",";
+ }
+ }
+ else
+ {
+ $qs = substr($qs,0,strlen($qs)-1);
+ $qs .= " WHERE ".$DB_fields[$i][name]." = ".$$DB_fields[$i][name];
+ }
+ }
+ $DB_fields = array_reverse($DB_fields);
+ if(!db_auto_exec($qs))
+ $ERRORS .= pg_errormessage($dbd).$qs;
+
+ break;
+
+ case "Insert":
+ $create_date = date("m-d-Y");
+ for($i=0;$i<count($DB_fields);$i++)
+ {
+ if($DB_fields[$i][type]=="img")
+ {
+ $tmp = $DB_fields[$i]['name'];
+ $image = $$tmp;
+ $image_name = ${$tmp."_name"};
+ if($image == "none" || $image == "")
+ {
+ $image_name = $oldimage;
+ }
+ else
+ {
+ $image_name = process_image($image,$image_name);
+ }
+ }
+ }
+ $tmp = "";
+ $tmp_value = "";
+ for($i=0;$i<count($DB_fields);$i++)
+ {
+ if($DB_fields[$i][name]!=ID)
+ {
+ if($DB_fields[$i][type]!="static")
+ {
+ $tmp .= $DB_fields[$i][name];
+ $tmp .= ",";
+ }
+ }
+ }
+ for($i=0;$i<count($DB_fields);$i++)
+ {
+ if($DB_fields[$i][type]=="date")
+ {
+ $month = $DB_fields[$i][name]."_month";
+ $day = $DB_fields[$i][name]."_day";
+ $year = $DB_fields[$i][name]."_year";
+ $date = date("Y-m-d",mktime(0,0,0,$$month,$$day,$$year));
+ if($date = "1969-12-31")
+ $date = date("Y-m-d");
+ $tmp_value .= "'$date'";
+ $tmp_value .= ",";
+ }
+ elseif($DB_fields[$i][type]=="static")
+ {
+ }
+ elseif($DB_fields[$i][type]=="datetime")
+ {
+ $month = $DB_fields[$i][name]."_month";
+ $day = $DB_fields[$i][name]."_day";
+ $year = $DB_fields[$i][name]."_year";
+ $H = $DB_fields[$i][name]."_hour";
+ $mm = $DB_fields[$i][name]."_mm";
+ if($$mm == "PM")
+ $$H = $$H + 12;
+ $m = $DB_fields[$i][name]."_min";
+ $date = date("Y-m-d H:i:s T",mktime($$H,$$m,0,$$month,$$day,$$year));
+ $tmp_value .= "'$date'";
+ $tmp_value .= ",";
+ }
+ elseif($DB_fields[$i][type]=="array_drop")
+ {
+ if($$DB_fields[$i][name] == "")
+ {
+ $tmp_value .= "NULL";
+ $tmp_value .= ",";
+ }
+ else
+ {
+ $tmp_value .= $$DB_fields[$i][name];
+ $tmp_value .= ",";
+ }
+ }
+ elseif($DB_fields[$i][type]=="img")
+ {
+ $tmp_value .= "'".$image_name."'";
+ $tmp_value .= ",";
+ }
+ elseif($DB_fields[$i][name]!=ID)
+ {
+ $tmp_value .= "'".$$DB_fields[$i][name]."'";
+ $tmp_value .= ",";
+ }
+ }
+ // check for all blanks
+ $tmp_blank = str_replace("'","",$tmp_value);
+ $tmp_blank = str_replace(",","",$tmp_blank);
+ if($tmp_blank)
+ {
+ $qs = "INSERT INTO ".TABLE."
+ (".ID.", $tmp create_date)
+ VALUES
+ (nextval('".SEQUENCE."'), $tmp_value '$create_date')";
+//echo $qs;
+ if(!db_auto_exec($qs))
+ $ERRORS .= pg_errormessage($dbd).$qs;
+ }
+ break;
+
+ case "Delete":
+ $qs = "DELETE FROM ".TABLE."
+ WHERE ".ID." = $id";
+
+ if(!db_auto_exec($qs))
+ $ERRORS .= pg_errormessage($dbd).$qs;
+
+ break;
+
+ case "Cancel":
+ break;
+
+ default:
+ $ERRORS .= "incorrect value for Command";
+ break;
+
+ }
+
+header("Location: $location");
+}
+?>
--- /dev/null
+<?php
+include("../../setup.phtml");
+include("contact_setup.inc");
+$conn =& 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<db_numrows($res);$i++)
+ {
+ $res_data = db_fetch_array($res,$i,PGSQL_ASSOC);
+ $res_id = $res_data['id'];
+ $res_pos = $res_data['pos'];
+ $qs = "UPDATE contact_inq
+ SET pos = $counter
+ WHERE id = $res_id";
+
+ if(!db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+ $counter++;
+ }
+ }
+ else
+ {
+ $qs = "SELECT pos,id
+ 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 = ($pos);
+ for($i=0;$i<db_numrows($res);$i++)
+ {
+ $res_data = db_fetch_array($res,$i,PGSQL_ASSOC);
+ $res_id = $res_data['id'];
+ $res_pos = $res_data['pos'];
+ $qs = "UPDATE contact_inq
+ SET pos = $counter
+ WHERE id = $res_id";
+
+ if(!db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+ $counter++;
+ }
+ }
+ $qs = "UPDATE contact_inq
+ SET pos = $newpos
+ WHERE id = $id";
+
+ if(!db_exec($conn,$qs))
+ {
+ html_error(DB_ERROR_MSG.$qs,0);
+ }
+ break;
+
+ case "Edit":
+ $qs = "UPDATE contact_inq
+ SET header = '$header',
+ image = '$image_name',
+ description = '$description'
+ WHERE id = $id;";
+
+ //echo $qs;
+ pg_Exec($conn,$qs);
+ break;
+
+ case "Add":
+ $qs = "SELECT MAX(pos) as maxpos
+ FROM contact_inq";
+
+ $res = db_exec($conn,$qs);
+ $row = db_fetch_array($res,0,PGSQL_ASSOC);
+ $nextpos = $row[maxpos];
+ $nextpos++;
+ $qs = "INSERT
+ INTO contact_inq
+ (header,description,image,pos)
+ VALUES ('$header','$description','$image_name',$nextpos);";
+
+ pg_exec($conn,$qs);
+ break;
+
+ case "Delete":
+ $qs = "DELETE
+ FROM contact_inq
+ WHERE id = $id";
+
+ pg_Exec($conn,$qs);
+ @unlink(ORIGINAL_PATH."/".$oldimage);
+ @unlink(RESIZED_PATH.$oldimage);
+ @unlink(THUMB_PATH.$oldimage);
+ @unlink(MIDSIZED_PATH.$oldimage);
+
+ $qs = "SELECT pos,id
+ FROM contact_inq
+ WHERE pos > $oldpos
+ ORDER BY pos";
+
+ $res2 = db_exec($conn,$qs);
+ $oldcatid_counter = $oldpos;
+ for($i=0;$i<db_numrows($res2);$i++)
+ {
+ $row2 = db_fetch_array($res2,$i,PGSQL_ASSOC);
+ $qs = "UPDATE contact_inq
+ SET pos = $oldcatid_counter
+ WHERE id = $row2[id]";
+ }
+ db_exec($conn,$qs);
+
+ break;
+ }
+header("Location: contact_inquiry.phtml");
+?>
--- /dev/null
+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);
+}
--- /dev/null
+<?php
+include("../../setup.phtml");
+include("contact_setup.inc");
+define("STYLE","main.css");
+if($id == '')
+$id = 1;
+top("AutoReponse for Newsletter", HELP_BASE."response.phtml?key=edit+section");
+?>
+
+<?
+
+html_nav_table($nav,3);
+
+echo'
+<iframe src="preview.phtml"
+width="780" height="480"
+align="center">
+</iframe>
+
+
+ </td>
+</tr>
+</table>';
+
+footer();
+?>
+
+
+
--- /dev/null
+function glm_open(o) {
+ var x = (screen.width/2) - (o.width/2);
+ var y = (screen.height/2) - (o.height/2);
+ var args = "width="+o.width+",height="+o.height+",screenX="+x+",screenY="+y+",top="+y+",left="+x;
+ if(o.scroll == true)
+ args += ",scrollbars=1";
+ //args += "\'";
+ //alert(args);
+ pow=window.open(o.url,o.name,args);
+ //confirm(args);
+ if (pow.opener == null)
+ pow.opener = self;
+}