Add honeypot field to the add your event form.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Sep 2016 13:45:31 +0000 (09:45 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Sep 2016 13:45:31 +0000 (09:45 -0400)
Using css to hide the tr that the field is in. If the field has content
then the form will not submit. Form still appears to submit.

css/front.css
models/front/events/frontAdd.php
views/front/events/frontAdd.html

index 4e27140..b73d8c5 100644 (file)
@@ -292,3 +292,6 @@ a.fc-time-grid-event.fc-v-event {
         float: right;
     }
 }
+#glmRealEmail {
+    display: none;
+}
index 682de6a..daf1e26 100644 (file)
@@ -157,377 +157,374 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
 
         // if form is submitted
         if ( isset( $_REQUEST['newEvent'] ) && $_REQUEST['newEvent'] == "Add Event" ) {
-
-            // parse dates and times
-            date_default_timezone_set('America/New_York');
-            $date     = date('y/m/d H:i:s a', time());
-            $starting = trim(filter_var($_REQUEST['starting'], FILTER_SANITIZE_STRING));
-            $ending   = trim(filter_var($_REQUEST['ending'], FILTER_SANITIZE_STRING));
-            if ( !$ending ) {
-                $ending = $starting;
-            }
-
-
-
-            // if there are no times selected, default the start time to midnight or get the starting / ending times
-            if ( empty( $_REQUEST['shour'] ) && strlen( $_REQUEST['smin'] ) === 0 ) {
-                $smilitaryTime = "00:00:00";
+            // Check to see if the honey pot caught spam.
+            if ( isset( $_REQUEST['real_email'] ) && $_REQUEST['real_email'] ) {
+                $view = 'confirmation';
             } else {
+                // parse dates and times
+                date_default_timezone_set('America/New_York');
+                $date     = date('y/m/d H:i:s a', time());
+                $starting = trim(filter_var($_REQUEST['starting'], FILTER_SANITIZE_STRING));
+                $ending   = trim(filter_var($_REQUEST['ending'], FILTER_SANITIZE_STRING));
+                if ( !$ending ) {
+                    $ending = $starting;
+                }
 
-                $startTime = trim(filter_var($_REQUEST['shour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['smin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['sampm'],FILTER_SANITIZE_STRING));
+                // if there are no times selected, default the start time to midnight or get the starting / ending times
+                if ( empty( $_REQUEST['shour'] ) && strlen( $_REQUEST['smin'] ) === 0 ) {
+                    $smilitaryTime = "00:00:00";
+                } else {
 
-                $smilitaryTime = date("H:i:s", strtotime($startTime));
-            }
+                    $startTime = trim(filter_var($_REQUEST['shour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['smin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['sampm'],FILTER_SANITIZE_STRING));
 
-            // Get the ending time
-            if(empty($_REQUEST['ehour']) && strlen($_REQUEST['emin']) === 0){
-                $startTimeOnly = 1;
-                $emilitaryTime = $smilitaryTime;
-            } else {
-
-                $endTime = trim(filter_var($_REQUEST['ehour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['emin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['eampm'],FILTER_SANITIZE_STRING));
-                $emilitaryTime = date("H:i:s", strtotime($endTime));
-            }
+                    $smilitaryTime = date("H:i:s", strtotime($startTime));
+                }
 
-            if(empty($_REQUEST['shour'])  && empty($_REQUEST['ehour'])){
-                $allDay = true;
-                $startTimeOnly = 0;
-            }
+                // Get the ending time
+                if(empty($_REQUEST['ehour']) && strlen($_REQUEST['emin']) === 0){
+                    $startTimeOnly = 1;
+                    $emilitaryTime = $smilitaryTime;
+                } else {
 
-            $starting_date = strtotime($starting . " " . $smilitaryTime);
-            $mysqlStart = date("Y-m-d H:i:s",$starting_date);
-
-            $ending_date = strtotime($ending . " " . $emilitaryTime);
-            $mysqlEnd = date("Y-m-d H:i:s",$ending_date);
-
-            // events table data
-            $name         = $this->filterInput( $_REQUEST['event_name'] );
-            $intro        = $this->filterInput( $_REQUEST['intro'] );
-            $descr        = $this->filterInput( $_REQUEST['descr'], true );
-            $cost         = $this->filterInput( $_REQUEST['cost'] );
-            $url          = $this->filterInput( $_REQUEST['url'] );
-            $admin_name   = $this->filterInput( $_REQUEST['admin_name'] );
-            $admin_org    = $this->filterInput( $_REQUEST['admin_org'] );
-            $adminPhone   = $this->filterInput( $_REQUEST['admin_phone'] );
-            $adminEmail   = $this->filterInput( $_REQUEST['admin_email'] );
-            $contactFirst = $this->filterInput( $_REQUEST['contact_fname'] );
-            $contactLast  = $this->filterInput( $_REQUEST['contact_lname'] );
-            $place        = $this->filterInput( $_REQUEST['place'] );
-            $address      = $this->filterInput( $_REQUEST['address'] );
-            $city         = $this->filterInput( $_REQUEST['city'] );
-            $state        = $this->filterInput( $_REQUEST['state'] );
-            $zip          = $this->filterInput( $_REQUEST['zip'] );
-            $contactEmail = $this->filterInput( $_REQUEST['contact_email'] );
-            $contactPhone = $this->filterInput( $_REQUEST['contact_phone'] );
-            $fileDescr    = $this->filterInput( $_REQUEST['fileDescription'] );
-
-            // get lat lon
-            $latLon = $this->getGeoLocation( array($address, $city, $state) );
-            if ($latLon) {
-               $lat = $latLon[0];
-               $lon = $latLon[1];
-            }
+                    $endTime = trim(filter_var($_REQUEST['ehour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['emin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['eampm'],FILTER_SANITIZE_STRING));
+                    $emilitaryTime = date("H:i:s", strtotime($endTime));
+                }
 
-            $weekOfMonth = $_REQUEST['weekom'];
-            if(strlen($weekOfMonth) !== 0){
-                $weekOfMonth = pow(2, $weekOfMonth);
-            }
-            $category = $_REQUEST['categories'];
+                if(empty($_REQUEST['shour'])  && empty($_REQUEST['ehour'])){
+                    $allDay = true;
+                    $startTimeOnly = 0;
+                }
 
-            // set boolean values based on selected recurrence options
-            if(!empty($dayOfMonth =  $_REQUEST['dayom'])){
-                $dayOfMonth = pow(2, $dayOfMonth);
-                $byDayOfMonth = true;
-            } else {
-                $byDayOfMonth = false;
-            }
+                $starting_date = strtotime($starting . " " . $smilitaryTime);
+                $mysqlStart = date("Y-m-d H:i:s",$starting_date);
+
+                $ending_date = strtotime($ending . " " . $emilitaryTime);
+                $mysqlEnd = date("Y-m-d H:i:s",$ending_date);
+
+                // events table data
+                $name         = $this->filterInput( $_REQUEST['event_name'] );
+                $intro        = $this->filterInput( $_REQUEST['intro'] );
+                $descr        = $this->filterInput( $_REQUEST['descr'], true );
+                $cost         = $this->filterInput( $_REQUEST['cost'] );
+                $url          = $this->filterInput( $_REQUEST['url'] );
+                $admin_name   = $this->filterInput( $_REQUEST['admin_name'] );
+                $admin_org    = $this->filterInput( $_REQUEST['admin_org'] );
+                $adminPhone   = $this->filterInput( $_REQUEST['admin_phone'] );
+                $adminEmail   = $this->filterInput( $_REQUEST['admin_email'] );
+                $contactFirst = $this->filterInput( $_REQUEST['contact_fname'] );
+                $contactLast  = $this->filterInput( $_REQUEST['contact_lname'] );
+                $place        = $this->filterInput( $_REQUEST['place'] );
+                $address      = $this->filterInput( $_REQUEST['address'] );
+                $city         = $this->filterInput( $_REQUEST['city'] );
+                $state        = $this->filterInput( $_REQUEST['state'] );
+                $zip          = $this->filterInput( $_REQUEST['zip'] );
+                $contactEmail = $this->filterInput( $_REQUEST['contact_email'] );
+                $contactPhone = $this->filterInput( $_REQUEST['contact_phone'] );
+                $fileDescr    = $this->filterInput( $_REQUEST['fileDescription'] );
+
+                // get lat lon
+                $latLon = $this->getGeoLocation( array($address, $city, $state) );
+                if ($latLon) {
+                   $lat = $latLon[0];
+                   $lon = $latLon[1];
+                }
 
-            if(empty($_REQUEST['free'])){
-                $free = false;
-            } else {
-                $free = true;
-            }
-            if(empty($_REQUEST['repeating'])){
-                $repeating = false;
-            } else {
-                $repeating = $_REQUEST['repeating'];
-            }
-            if(empty($_REQUEST['allday'])){
-                $allDay = false;
-            } else {
-                $allDay = $_REQUEST['allday'];
-            }
+                $weekOfMonth = $_REQUEST['weekom'];
+                if(strlen($weekOfMonth) !== 0){
+                    $weekOfMonth = pow(2, $weekOfMonth);
+                }
+                $category = $_REQUEST['categories'];
+
+                // set boolean values based on selected recurrence options
+                if(!empty($dayOfMonth =  $_REQUEST['dayom'])){
+                    $dayOfMonth = pow(2, $dayOfMonth);
+                    $byDayOfMonth = true;
+                } else {
+                    $byDayOfMonth = false;
+                }
 
-            //get days of the week values for recurrences
-            foreach($_REQUEST['daysow'] as $check){
-                $daysOfWeek[] = $check;
-            }
-//             foreach($_REQUEST['weekom'] as $check){
-//                 $weekOfMonth[] = $check;
-//
-//             }
-//             print_r($weeksOfMonth);
-            foreach($daysOfWeek as $key=>$value){
-                if(!empty($value)){
-                    $days += $value;
+                if(empty($_REQUEST['free'])){
+                    $free = false;
+                } else {
+                    $free = true;
+                }
+                if(empty($_REQUEST['repeating'])){
+                    $repeating = false;
+                } else {
+                    $repeating = $_REQUEST['repeating'];
+                }
+                if(empty($_REQUEST['allday'])){
+                    $allDay = false;
+                } else {
+                    $allDay = $_REQUEST['allday'];
                 }
-            }
 
-            $city =  $this->getCityId($city);
-            // image upload settings
-            $image = $_FILES['image_new'];
-            $imageName = $image['name'];
-            $imageTmp = $image['tmp_name'];
-            $imageSize = $image['size'];
-            $imageError = $image['error'];
-
-            $temp = explode('.', $imageName);
-            $imageExt  = array_pop($temp);
-            $imageExt = strtolower($imageExt);
-            $tmpName = implode('.', $temp);
-
-            $allowed = array('jpeg', 'png', 'jpg', 'bmp', 'gif','svg');
-            if(in_array($imageExt, $allowed)){
-                if($imageError === 0){
-                    if($imageSize <= 1000000){
-                        $imageName = $tmpName . "-" . uniqid() . "." . $imageExt;
-                        $imgUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/images/small/" . $imageName;
-                        if(!file_exists($imgUrl)){
-                           if(move_uploaded_file($imageTmp, $imgUrl)){
+                //get days of the week values for recurrences
+                foreach($_REQUEST['daysow'] as $check){
+                    $daysOfWeek[] = $check;
+                }
+                foreach($daysOfWeek as $key=>$value){
+                    if(!empty($value)){
+                        $days += $value;
+                    }
+                }
 
+                $city =  $this->getCityId($city);
+                // image upload settings
+                $image = $_FILES['image_new'];
+                $imageName = $image['name'];
+                $imageTmp = $image['tmp_name'];
+                $imageSize = $image['size'];
+                $imageError = $image['error'];
+
+                $temp = explode('.', $imageName);
+                $imageExt  = array_pop($temp);
+                $imageExt = strtolower($imageExt);
+                $tmpName = implode('.', $temp);
+
+                $allowed = array('jpeg', 'png', 'jpg', 'bmp', 'gif','svg');
+                if(in_array($imageExt, $allowed)){
+                    if($imageError === 0){
+                        if($imageSize <= 1000000){
+                            $imageName = $tmpName . "-" . uniqid() . "." . $imageExt;
+                            $imgUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/images/small/" . $imageName;
+                            if(!file_exists($imgUrl)){
+                               if(move_uploaded_file($imageTmp, $imgUrl)){
+
+                               }
+                           } else {
+                                echo "Image Already Exists";
                            }
-                       } else {
-                            echo "Image Already Exists";
                        }
-                   }
+                    }
                 }
-            }
-            //file upload settings
-            $file      = $_FILES['file_rmv'];
-            $fileName  = $file['name'];
-            $fileTmp   = $file['tmp_name'];
-            $fileSize  = $file['size'];
-            $fileError = $file['error'];
-            $temp      = explode('.', $fileName);
-            $fileExt   = array_pop($temp);
-            $fileExt   = strtolower($fileExt);
-            $tmpName   = implode('.', $temp);
-            $allowed   = array('txt', 'pdf', 'docx', 'odt', 'xls', 'doc');
-            if (in_array($fileExt, $allowed)) {
-                if ($fileError === 0) {
-                    if($fileSize <= 2621440){
-                        $fileName = $tmpName . "-" . uniqid() . "." . $fileExt;
-                        $fileUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/files/" .$fileName;
-                        if(!file_exists($fileUrl)){
-                            if(move_uploaded_file($fileTmp, $fileUrl)){
-
+                //file upload settings
+                $file      = $_FILES['file_rmv'];
+                $fileName  = $file['name'];
+                $fileTmp   = $file['tmp_name'];
+                $fileSize  = $file['size'];
+                $fileError = $file['error'];
+                $temp      = explode('.', $fileName);
+                $fileExt   = array_pop($temp);
+                $fileExt   = strtolower($fileExt);
+                $tmpName   = implode('.', $temp);
+                $allowed   = array('txt', 'pdf', 'docx', 'odt', 'xls', 'doc');
+                if (in_array($fileExt, $allowed)) {
+                    if ($fileError === 0) {
+                        if($fileSize <= 2621440){
+                            $fileName = $tmpName . "-" . uniqid() . "." . $fileExt;
+                            $fileUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/files/" .$fileName;
+                            if(!file_exists($fileUrl)){
+                                if(move_uploaded_file($fileTmp, $fileUrl)){
+
+                                }
+                            } else {
+                                echo "File Already Exists";
                             }
-                        } else {
-                            echo "File Already Exists";
                         }
                     }
                 }
-            }
-            // mySql transactions
-            $eventData = array(
-                'status'            => '20',
-                'created'           => $date,
-                'updated'           => $date,
-                'name'              => $name,
-                'intro'             => $intro,
-                'descr'             => $descr,
-                'image'             => $imageName,
-                'file1'             => $fileName,
-                'file1_descr'       => $fileDescr,
-                'cost'              => $cost,
-                'free'              => $free,
-                'url'               => $url,
-                'contact_phone'     => $contactPhone,
-                'admin_name'        => $admin_name,
-                'admin_phone'       => $adminPhone,
-                'admin_email'       => $adminEmail,
-                'contact_name'      => $contactFirst . " " . $contactLast,
-                'contact_email'     => $contactEmail,
-                'admin_org'         => $admin_org
-            );
-            $eventDataFormat = array(
-                 '%d',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s'
-            );
-            $this->wpdb->insert(
-                GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
-                $eventData,
-                $eventDataFormat
-            );
-            $eventID = $this->wpdb->insert_id;
-
-            $locationData = array(
-                'event'         => $eventID,
-                'name'          => $place,
-                'address'       => $address,
-                'city'          => $city,
-                'state'         => $state,
-                'zip'           => $zip,
-                'phone'         => $contactPhone,
-                'contact_fname' => $contactFirst,
-                'contact_lname' => $contactLast,
-                'email'         => $contactEmail
-
-            );
-            $locationDataFormat = array(
-                 '%d',
-                 '%s',
-                 '%s',
-                 '%d',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s',
-                 '%s'
-            );
-            if ($lat && $lon) {
-                $locationData['lat'] = $lat;
-                $locationData['lon'] = $lon;
-                $locationDataFormat[] = '%s';
-                $locationDataFormat[] = '%s';
-            }
-            $this->wpdb->insert(
-                GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations',
-                $locationData,
-                 $locationDataFormat
-            );
-            $ending = date("Y-m-d", strtotime($ending));
-            $starting = date("Y-m-d", strtotime($starting));
-            $recurData =array(
-                'event'             => $eventID,
-                'start_time'        => $smilitaryTime,
-                'end_time'          => $emilitaryTime,
-                'start_date'        => $starting,
-                'from_date'         => $starting,
-                'to_date'           => $ending,
-                'all_day'           => $allDay,
-                'recurring'         => $repeating,
-                'day_of_month'      => $dayOfMonth,
-                'week_of_month'     => $weekOfMonth,
-                'start_time_only'   => $startTimeOnly,
-                'month_of_year'     => 4095,
-                'day_of_week'       => $days,
-                'by_day_of_month'   => $byDayOfMonth,
-                'last_day_of_month' => $lastDayOfMonth
-            );
-            $this->wpdb->insert(
-                GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences',
-                $recurData,
-                array(
-                         '%d',
-                         '%s',
-                         '%s',
-                         '%s',
-                         '%s',
-                         '%s',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
+                // mySql transactions
+                $eventData = array(
+                    'status'            => '20',
+                    'created'           => $date,
+                    'updated'           => $date,
+                    'name'              => $name,
+                    'intro'             => $intro,
+                    'descr'             => $descr,
+                    'image'             => $imageName,
+                    'file1'             => $fileName,
+                    'file1_descr'       => $fileDescr,
+                    'cost'              => $cost,
+                    'free'              => $free,
+                    'url'               => $url,
+                    'contact_phone'     => $contactPhone,
+                    'admin_name'        => $admin_name,
+                    'admin_phone'       => $adminPhone,
+                    'admin_email'       => $adminEmail,
+                    'contact_name'      => $contactFirst . " " . $contactLast,
+                    'contact_email'     => $contactEmail,
+                    'admin_org'         => $admin_org
+                );
+                $eventDataFormat = array(
+                     '%d',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s'
+                );
+                $this->wpdb->insert(
+                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
+                    $eventData,
+                    $eventDataFormat
+                );
+                $eventID = $this->wpdb->insert_id;
+
+                $locationData = array(
+                    'event'         => $eventID,
+                    'name'          => $place,
+                    'address'       => $address,
+                    'city'          => $city,
+                    'state'         => $state,
+                    'zip'           => $zip,
+                    'phone'         => $contactPhone,
+                    'contact_fname' => $contactFirst,
+                    'contact_lname' => $contactLast,
+                    'email'         => $contactEmail
+
+                );
+                $locationDataFormat = array(
+                     '%d',
+                     '%s',
+                     '%s',
+                     '%d',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s',
+                     '%s'
+                );
+                if ($lat && $lon) {
+                    $locationData['lat'] = $lat;
+                    $locationData['lon'] = $lon;
+                    $locationDataFormat[] = '%s';
+                    $locationDataFormat[] = '%s';
+                }
+                $this->wpdb->insert(
+                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations',
+                    $locationData,
+                     $locationDataFormat
+                );
+                $ending = date("Y-m-d", strtotime($ending));
+                $starting = date("Y-m-d", strtotime($starting));
+                $recurData =array(
+                    'event'             => $eventID,
+                    'start_time'        => $smilitaryTime,
+                    'end_time'          => $emilitaryTime,
+                    'start_date'        => $starting,
+                    'from_date'         => $starting,
+                    'to_date'           => $ending,
+                    'all_day'           => $allDay,
+                    'recurring'         => $repeating,
+                    'day_of_month'      => $dayOfMonth,
+                    'week_of_month'     => $weekOfMonth,
+                    'start_time_only'   => $startTimeOnly,
+                    'month_of_year'     => 4095,
+                    'day_of_week'       => $days,
+                    'by_day_of_month'   => $byDayOfMonth,
+                    'last_day_of_month' => $lastDayOfMonth
+                );
+                $this->wpdb->insert(
+                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences',
+                    $recurData,
+                    array(
+                             '%d',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d',
+                             '%d'
+                        )
+                );
+                $recurID = $this->wpdb->insert_id;
+                $Recurrences->optionIncludeSelectListData = false;
+                $times = $Recurrences->createRecurrenceTimesEntries($recurID, true, true);
+
+                // event category data
+                $categoryData = array(
+                    'event'    => $eventID,
+                    'category' => $category
+                );
+                $this->wpdb->insert(
+                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories',
+                    $categoryData,
+                    array(
                          '%d',
                          '%d'
                     )
-            );
-            $recurID = $this->wpdb->insert_id;
-            $Recurrences->optionIncludeSelectListData = false;
-            $times = $Recurrences->createRecurrenceTimesEntries($recurID, true, true);
-
-            // event category data
-            $categoryData = array(
-                'event'    => $eventID,
-                'category' => $category
-            );
-            $this->wpdb->insert(
-                GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories',
-                $categoryData,
-                array(
-                     '%d',
-                     '%d'
-                )
-            );
+                );
 
-            $smarty = new smartyTemplateSupport();
+                $smarty = new smartyTemplateSupport();
 
-            $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
-            $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
-            $smarty->template->setTemplateDir($viewPath);
-            $smarty->templateAssign('eventUrlBase', get_bloginfo('url') . '/add-an-event/');
-            $smarty->templateAssign('title', 'Events');
-            $smarty->templateAssign('to_email', $to_email);
-            $smarty->templateAssign('from_email', $fromEmail);
-            $smarty->templateAssign('emailNotification', $emailNotification);
-            $smarty->templateAssign('pendingEvents', $eventsList);
-            $smarty->templateAssign('name', $name);
-            $smarty->templateAssign('startDate', $starting);
-            $smarty->templateAssign('endDate', $ending);
-            $smarty->templateAssign('startTime', $startTime);
-            $smarty->templateAssign('endTime', $endTime);
+                $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
+                $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
+                $smarty->template->setTemplateDir($viewPath);
+                $smarty->templateAssign('eventUrlBase', get_bloginfo('url') . '/add-an-event/');
+                $smarty->templateAssign('title', 'Events');
+                $smarty->templateAssign('to_email', $to_email);
+                $smarty->templateAssign('from_email', $fromEmail);
+                $smarty->templateAssign('emailNotification', $emailNotification);
+                $smarty->templateAssign('pendingEvents', $eventsList);
+                $smarty->templateAssign('name', $name);
+                $smarty->templateAssign('startDate', $starting);
+                $smarty->templateAssign('endDate', $ending);
+                $smarty->templateAssign('startTime', $startTime);
+                $smarty->templateAssign('endTime', $endTime);
 
 
-            $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
-            $smarty->templateAssign('items', $events);
+                $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
+                $smarty->templateAssign('items', $events);
 
-            // Add standard parameters
-            require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+                // Add standard parameters
+                require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
 
-            $viewFile = 'front/events/ownerEmail.html';
+                $viewFile = 'front/events/ownerEmail.html';
 
-            // Generate output from model data and view
-            $htmlMessage = $smarty->template->fetch($viewFile);
+                // Generate output from model data and view
+                $htmlMessage = $smarty->template->fetch($viewFile);
 
-            function set_content_type(){
-                return "text/html";
-            }
+                function set_content_type(){
+                    return "text/html";
+                }
 
-            // change the default wordpress from name when sending mail
-            add_filter('wp_mail_from_name','yoursite_wp_mail_from_name');
-            function yoursite_wp_mail_from_name($name) {
-                $siteName = get_bloginfo('name');
-                return $siteName;
-            }
-            // Send confirmation email, set the content type to allow html by using this filter
-            add_filter( 'wp_mail_content_type', 'set_content_type' );
+                // change the default wordpress from name when sending mail
+                add_filter('wp_mail_from_name','yoursite_wp_mail_from_name');
+                function yoursite_wp_mail_from_name($name) {
+                    $siteName = get_bloginfo('name');
+                    return $siteName;
+                }
+                // Send confirmation email, set the content type to allow html by using this filter
+                add_filter( 'wp_mail_content_type', 'set_content_type' );
 
-            $to      = $to_email;
-            $subject = 'Event Form Submission';
-            $message = $htmlMessage;
-            $headers = 'From:' . $fromEmail . "\r\n" .
-                       'Reply-To:' . $contactEmail;
-            $header[] = 'From:' . $fromEmail;
-            $header[] = 'Reply-To:' . $contactEmail;
+                $to      = $to_email;
+                $subject = 'Event Form Submission';
+                $message = $htmlMessage;
+                $headers = 'From:' . $fromEmail . "\r\n" .
+                           'Reply-To:' . $contactEmail;
+                $header[] = 'From:' . $fromEmail;
+                $header[] = 'Reply-To:' . $contactEmail;
 
-            wp_mail($to, $subject, $message, $header);
+                wp_mail($to, $subject, $message, $header);
 
-            // remove the filter to avoid conflicts
-            remove_filter( 'wp_mail_content_type', 'set_content_type' );
+                // remove the filter to avoid conflicts
+                remove_filter( 'wp_mail_content_type', 'set_content_type' );
 
-            $view = 'confirmation';
+                $view = 'confirmation';
+            }
         }
 
         $default_state = ( $this->config['settings']['default_state'] )
index 6303d52..b0345d8 100644 (file)
@@ -4,6 +4,10 @@
 
 <form action="{$thisUrl}" method="post" enctype="multipart/form-data" name="frontAddForm" id="frontForm">
     <table id="glm-table-descr" class="glm-admin-table glm-event-table">
+        <tr id="glmRealEmail">
+            <td>Real Email</td>
+            <td><input type="text" name="real_email"></td>
+        </tr>
         <tr>
             <th style="color: red;">Event Name: </th>
             <td>
                     <option value="31">Every Week</option> <option value="0">Every First Week of Month</option><option value="1">Every Second Week of Month</option><option value="2">Every Third Week of Month</option><option value="3">Every Fourth Week of Month</option><option value="4">Every Fifth Week of Month</option> <option value="5">Every Last Week of Month</option>
                 </select>
             </td>
-<!--<td>
-
-                        <input name="weekom[1]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[1]" value="31" type="checkbox">Every Week
-                        </label>
-                        <input name="weekom[2]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[2]" value="1" type="checkbox"> First Week
-                        </label>
-                        <input name="weekom[3]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[3]" value="2" type="checkbox">Second Week
-                        </label>
-                        <input name="weekom[4]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[4]" value="4" type="checkbox">Third Week
-                        </label>
-                        <input name="weekom[5]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[5]" value="8" type="checkbox">Fourth Week
-                        </label>
-                        <input name="weekom[6]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[6]" value="16" type="checkbox">Fifth Week
-                        </label>
-                        <input name="weekom[7]" value="" type="hidden">
-                        <label class="glmCheckBox">
-                          <input name="weekom[7]" value="32" type="checkbox">Last Week
-                        </label>
-            </td>-->
         </tr>
         <tr class="frontRecurrences" id="daysOfWeek">
             <td class="labelcell"><label>Days of Week</label></td>