From 8402bd0da524a02eca7123f3f14ad8f91c55a17e Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 1 Dec 2016 15:37:23 -0500 Subject: [PATCH] contact form update --- classes/class_contact_form.inc | 114 ++++++++++++++++----------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/classes/class_contact_form.inc b/classes/class_contact_form.inc index 4fc10f6..49b4a47 100755 --- a/classes/class_contact_form.inc +++ b/classes/class_contact_form.inc @@ -18,17 +18,17 @@ class contact_form { /** * contact_form: constructor - * - * @return void + * + * @return void * @access public **/ function contact_form() { - $this->CDB =& new GLM_DB(); // creates DB object + $this->CDB =& new GLM_DB(); // creates DB object $this->set_DB_fields(); // set up the DB_fields array (configuration) $this->set_int_array(); // interest array $this->email = OWNER_EMAIL; // email address for mail function - $this->table_name = 'contact'; // the contact table + $this->table_name = 'contact'; // the contact table $this->styleLabel = "labelcell";// css style for the labelcell $this->fieldcell = "fieldcell"; // css style for the field input $this->styleLabelSmall = "smalllabelcell";// css style for the labelcell @@ -40,9 +40,9 @@ class contact_form { /** * get_form: one function to rule them all - * - * @return void - * @access + * + * @return void + * @access **/ function get_form() { @@ -63,9 +63,9 @@ class contact_form { /** * set_DB_fields: - * - * @return - * @access + * + * @return + * @access **/ function set_DB_fields() { @@ -85,17 +85,17 @@ class contact_form { $DB_fields[]=array('name'=>'contact_method','title' => 'Preferred Contact Method', 'type' => 'radio', 'options'=>'Telephone|E-mail'); $DB_fields[]=array('name'=>'comments', 'title' =>'Message', 'type' => 'desc'); $DB_fields[]=array('name'=>'mail_ok', 'title' => 'Sign me up for the Newsletter', 'type' => 'checkbox','value'=>'t','colspan'=>4,'checked'=>1); - - $this->DB_fields = &$DB_fields; + + $this->DB_fields = &$DB_fields; } /** * set_int_array: - * - * @return - * @access + * + * @return + * @access **/ - + function set_int_array() { $int_array = array( @@ -104,44 +104,44 @@ class contact_form { "class_registration" => "Class Registration", "ticket_sales" => "Ticket Sales", "no_preference" => "No Preference", - ); + ); $this->int_array = $int_array; } /** * interest: - * @param $field: - * - * @return - * @access + * @param $field: + * + * @return + * @access **/ function interest($field) - { + { $out .= ''; $count = 0; foreach($this->int_array as $key=>$value) { if($count==0) { - $out .= ''; + $out .= ''; } - $count++; - } + $count++; + } $out .= "
'; + $out .= ''; } $out .= ''; + $out .= '>'.$value.'
'; if($count==5) { - $out .= '
'; + $out .= ''; } if($count==11) { - $out .= '
"; return( $out ); } @@ -149,13 +149,13 @@ class contact_form { /** * display_form: shows the form and any errors in it - * @param $error = NULL: error array - * + * @param $error = NULL: error array + * * @return string $out * @access public **/ function display_form($error=NULL) - { + { if(is_array($_POST)) { foreach($_POST as $k=>$v) @@ -194,7 +194,7 @@ class contact_form { //if($value['req']) //{ // $out .= ''; - //} + //} $out .= ' '; $out .= GLM_TEMPLATE::build_picklist($value['name'],$GLOBALS['states_US'],$_POST['state']); @@ -214,7 +214,7 @@ class contact_form { $colcount++; } break; - + case "country": if( $value['colspan'] == 2 || $colcount == 1 ) { @@ -231,21 +231,21 @@ class contact_form { $field = $this->fieldcell; } //$out .= ''; - + $out .= "\n\t".''; if($value['req']) { $out .= '* '; } $out.=$value['title'].""; - + $out .= "\n\t".''; $out .= GLM_TEMPLATE::build_picklist($value['name'],$GLOBALS['country_codes'],$_POST['country']); $out .= "\n"; - + $out .= ''; break; - + case "text": if( $value['colspan'] == 2 || $colcount == 1 ) { @@ -267,11 +267,11 @@ class contact_form { $out .= '* '; } $out .= $value['title']; - /* + /* if($value['req']) { $out .= ''; - } + } */ $out .= ' @@ -360,7 +360,7 @@ class contact_form { { $cols=' cols="'.$value['cols'].'"'; } - + $out .= ''.$value[title].': '; $out .= ''; @@ -385,13 +385,13 @@ class contact_form { $out .= ''; $out .= ''; break; - + case "radio": $out .= ''.$value[title].':'; $rvals = explode("|",$value['options']); - + // check to see if any of these vals is in the post array (did we already submit this form basically) - + if(isset($_POST[$value['name']])) // it's set, so we must have something there { $dvar = $_POST[$value['name']]; @@ -399,9 +399,9 @@ class contact_form { { $dvar = 'notset'; } - + $inc = 0; - + foreach($rvals as $rvK => $rvV) { if($dvar != 'notset') @@ -417,24 +417,24 @@ class contact_form { { if($inc == 0) { - $checked = ' checked'; + $checked = ' checked'; $inc =1; }else { $checked = ''; } } - + $rads .= ' '.$rvV.'
'."\n"; } - + $out .= ''; $out.=$rads; $out .= ''; $out .= ''; break; } - } + } $out .= ''; $out .= ''; $out .= ''; @@ -444,8 +444,8 @@ class contact_form { /** * form_process: process the form checking for any required form values as set up in the * DB_fields array. - * - * @return error array if bad + * + * @return error array if bad * @access public **/ function form_process() @@ -455,7 +455,7 @@ class contact_form { $ban_words[] = "mime-version"; $ban_words[] = "cc\:"; $ban_words[] = "bcc\:"; - + if(is_array($_POST)) { foreach($_POST as $k=>$v) @@ -498,14 +498,14 @@ class contact_form { $in_vars[] = 'f'; }else { - $in_vars[] = addslashes(trim($_POST[$value['name']])); + $in_vars[] = addslashes(stripslashes(trim($_POST[$value['name']]))); } $in_fields[] = $value['name']; - + }else { $in_fields[] = $value['name']; - $in_vars[] = addslashes(trim($_POST[$value['name']])); + $in_vars[] = addslashes(stripslashes(trim($_POST[$value['name']]))); } } } @@ -521,7 +521,7 @@ class contact_form { { $invars = implode("','",$in_vars); } - $query = "INSERT INTO ".$this->table_name." + $query = "INSERT INTO ".$this->table_name." ($infds) VALUES ('$invars')"; -- 2.17.1