update_post_meta($lastid, '_thumbnail_id', $thumb_id);
    #Insert the post meta into the database
    update_post_meta($lastid, 'Address', $_POST['farmaddress']);
    $boarding = serialize($_POST['boarding_provided']);
    $discipline = serialize($_POST['discipline']);
    $trails = serialize($_POST['trails']);
    $fencing = serialize($_POST['fencing']);
    $uploadedfile2 = $_FILES['file2'];
    $upload_overrides2 = array('test_form' => false);
    wp_handle_upload($uploadedfile2, $upload_overrides2);
    $uploadedfile3 = $_FILES['file3'];
    $upload_overrides3 = array('test_form' => false);
    wp_handle_upload($uploadedfile3, $upload_overrides3);
    $searchLocation = $_POST['farmzip'];
    if (!empty($searchLocation)) {
        $gMapGeocoder = new simpleGMapGeocoder();
        $result = $gMapGeocoder->getGeoCoords($searchLocation);
        if ($result['status'] === 'OK') {
            $longitude = $result['lng'];
            $latitude = $result['lat'];
        }
    }
    $array = array('post_ID' => $lastid, 'user_ID' => $user_ID, 'boarding_provided' => $boarding, 'discipline_specific' => $discipline, 'trainer_provided' => $_POST['trainerprovided'], 'boarder_population' => $_POST['boarderpopulation'], 'Canworkforboard' => $_POST['Canworkforboard'], 'blanketingsheets' => $_POST['blanketingsheets'], 'boardingstallcost' => $_POST['boardingstallcost'], 'boardingpastureboardcost' => $_POST['boardingpastureboardcost'], 'layoverStayshorsehotel' => $_POST['layoverStayshorsehotel'], 'lessons_provided' => $_POST['lessonsprovided'], 'Owners_live_on_farm' => $_POST['ownersliveonfarm'], 'observation_room' => $_POST['observationroom'], 'inside_bathroom' => $_POST['insidebathroom'], 'grain_provided' => $_POST['grainprovided'], 'supplements_given' => $_POST['supplementsgiven'], 'indoor_arena' => $_POST['indoorarena'], 'outdoor_arena' => $_POST['outdoorarena'], 'round_pen' => $_POST['roundpen'], 'trails' => $trails, 'wash_rack' => $_POST['washrackwithhot'], 'turn_out1' => $_POST['turnout'], 'turn_out2' => $_POST['turnouts'], 'fencing' => $fencing, 'stand_for_vet' => $_POST['standforvet'], 'trailer_parking' => $_POST['trailerparking'], 'main_image' => $_FILES['file']['name'], 'images' => serialize(array('wp-content/uploads' . $upload_dir['subdir'] . DS . $_FILES['file2']['name'], 'wp-content/uploads' . $upload_dir['subdir'] . DS . $_FILES['file3']['name'])), 'package' => $_POST['package'], 'type_of_facility' => $_POST['whattypeoffacility'], 'worming_schedule' => $_POST['wormingschedule'], 'farmcity' => $_POST['farmcity'], 'farmzip' => $_POST['farmzip'], 'latitude' => $latitude, 'longitude' => $longitude, 'phone' => $_POST['farmphone']);
    if ($wpdb->insert('wp_bmee_question', $array)) {
        wp_redirect(site_url('edit-listing'));
    }
}
function reArrayFiles(&$file_post)
{
    $file_ary = array();
    $file_count = count($file_post['name']);
 /**
 * @function     addMarkerByAddress
 * @param        $lat : string (latitude)
 *               $lng : string (longitude)
 *               $tooltip : string (tooltip text)
 *               $info : Message to be displayed in an InfoWindow
 *               $iconURL : URL to an icon to be displayed instead of the default icon
 *               (see for example http://code.google.com/p/google-maps-icons/)
 *               $clickable : boolean (true if the marker should be clickable)
 *               @description  Add's a Marker to be displayed on the Google Map using latitude/longitude
 */
 function addMarkerByAddress($address, $tooltip = "", $info = "", $iconURL = "", $clickable = true)
 {
     $geoCoder = new simpleGMapGeocoder();
     $result = array();
     if (!is_string($address)) {
         die("All Addresses must be passed as a string");
     }
     $result = $geoCoder->getGeoCoords($address);
     if ($result['status'] == "OK") {
         $count = count($this->mapMarkers);
         $this->mapMarkers[$count]['lat'] = $result['lat'];
         $this->mapMarkers[$count]['lng'] = $result['lng'];
         $this->mapMarkers[$count]['tooltip'] = $tooltip;
         $this->mapMarkers[$count]['info'] = $info;
         $this->mapMarkers[$count]['iconURL'] = $iconURL;
         $this->mapMarkers[$count]['clickable'] = $clickable;
         $this->adjustCenterCoords($result['lat'], $result['lng']);
     }
 }
Exemple #3
0
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @author		muinx
 * This component was generated by http://joomlavietnam.net/ - 2012
 */
// no direct access
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$now = time();
$Itemid = JRequest::getInt('Itemid');
$upload_url = JURI::root() . 'images/com_rental/upload/';
$thumb_90x68_url = JURI::root() . 'img.php?w=90&h=68&q=90&src=';
require_once JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'simple-gmap-api' . DS . "simpleGMapAPI.php";
require_once JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'simple-gmap-api' . DS . "simpleGMapGeocoder.php";
$map = new simpleGMapAPI();
$geo = new simpleGMapGeocoder();
$map->setWidth(400);
$map->setHeight(400);
$map->setBackgroundColor('#d0d0d0');
$map->setMapDraggable(true);
$map->setDoubleclickZoom(false);
$map->setScrollwheelZoom(true);
$map->showDefaultUI(false);
$map->showMapTypeControl(true, 'DROPDOWN_MENU');
$map->showNavigationControl(true, 'DEFAULT');
$map->showScaleControl(true);
$map->showStreetViewControl(true);
$map->setZoomLevel(10);
// not really needed because showMap is called in this demo with auto zoom
$map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
$map->setInfoWindowTrigger('CLICK');
 #Insert the attachment.
 $thumb_id = wp_insert_attachment($args, $filename, $lastid);
 #Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
 $metadata = wp_generate_attachment_metadata($thumb_id, $filename);
 #Generate the metadata for the attachment, and update the database record.
 wp_update_attachment_metadata($thumb_id, $metadata);
 update_post_meta($lastid, '_thumbnail_id', $thumb_id);
 #Insert the post meta into the database
 update_post_meta($lastid, 'Address', $_SESSION['FormData']['farmaddress']);
 $boarding = serialize($_SESSION['subFormData']['boarding_provided']);
 $discipline = serialize($_SESSION['subFormData']['discipline']);
 $trails = serialize($_SESSION['subFormData']['trails']);
 $fencing = serialize($_SESSION['subFormData']['fencing']);
 $farmzip = $_SESSION['FormData']['farmzip'];
 if (!empty($farmzip)) {
     $gMapGeocoder = new simpleGMapGeocoder();
     $result = $gMapGeocoder->getGeoCoords($farmzip);
     if ($result['status'] === 'OK') {
         $longitude = $result['lng'];
         $latitude = $result['lat'];
     }
 }
 $plan_up = $_SESSION['FormData']['subscriptionID'];
 if ($plan_up == '3') {
     update_post_meta($lastid, 'sub_id', $plan_up);
     $array = array('post_ID' => $lastid, 'user_ID' => $user_id, 'boarding_provided' => $boarding, 'discipline_specific' => $discipline, 'trainer_provided' => $_SESSION['subFormData']['trainerprovided'], 'boarder_population' => $_SESSION['subFormData']['boarderpopulation'], 'Canworkforboard' => $_SESSION['subFormData']['Canworkforboard'], 'blanketingsheets' => $_SESSION['subFormData']['blanketingsheets'], 'boardingstallcost' => $_SESSION['subFormData']['boardingstallcost'], 'boardingpastureboardcost' => $_SESSION['subFormData']['boardingpastureboardcost'], 'layoverStayshorsehotel' => $_SESSION['subFormData']['layoverStayshorsehotel'], 'lessons_provided' => $_SESSION['subFormData']['lessonsprovided'], 'Owners_live_on_farm' => $_SESSION['subFormData']['ownersliveonfarm'], 'observation_room' => $_SESSION['subFormData']['observationroom'], 'inside_bathroom' => $_SESSION['subFormData']['insidebathroom'], 'grain_provided' => $_SESSION['subFormData']['grainprovided'], 'supplements_given' => $_SESSION['subFormData']['supplementsgiven'], 'indoor_arena' => $_SESSION['subFormData']['indoorarena'], 'outdoor_arena' => $_SESSION['subFormData']['outdoorarena'], 'round_pen' => $_SESSION['subFormData']['roundpen'], 'trails' => $trails, 'wash_rack' => $_SESSION['subFormData']['washrackwithhot'], 'turn_out1' => $_SESSION['FormData']['turnout'], 'turn_out2' => $_SESSION['subFormData']['turnouts'], 'fencing' => $fencing, 'stand_for_vet' => $_SESSION['subFormData']['standforvet'], 'trailer_parking' => $_SESSION['subFormData']['trailerparking'], 'main_image' => $file, 'images' => serialize(array($_SESSION['file_url_2'], $_SESSION['file_url_3'], $_SESSION['file_url_4'], $_SESSION['file_url_5'], $_SESSION['file_url_6'], $_SESSION['file_url_7'], $_SESSION['file_url_8'], $_SESSION['file_url_9'], $_SESSION['file_url_10'])), 'package' => 'top', 'type_of_facility' => $_SESSION['subFormData']['whattypeoffacility'], 'worming_schedule' => $_SESSION['subFormData']['wormingschedule'], 'Region' => $_SESSION['subFormData']['Region'], 'farmcity' => $_SESSION['FormData']['farmcity'], 'farmzip' => $_SESSION['FormData']['farmzip'], 'latitude' => $latitude, 'longitude' => $longitude, 'phone' => $_SESSION['FormData']['farmphone'], 'farmweburl' => $_SESSION['FormData']['farmweburl'], 'farmfacebookpage' => $_SESSION['FormData']['farmfacebookpage'], 'farmtwitterpage' => $_SESSION['FormData']['farmtwitterpage'], 'farmbrochureupload' => $_SESSION['farmbrochureupload'], 'farmcouponupload' => $_SESSION['FormData']['farmcouponupload']);
 } else {
     $array = array('post_ID' => $lastid, 'user_ID' => $user_id, 'boarding_provided' => $boarding, 'discipline_specific' => $discipline, 'trainer_provided' => $_SESSION['subFormData']['trainerprovided'], 'boarder_population' => $_SESSION['subFormData']['boarderpopulation'], 'Canworkforboard' => $_SESSION['subFormData']['Canworkforboard'], 'blanketingsheets' => $_SESSION['subFormData']['blanketingsheets'], 'boardingstallcost' => $_SESSION['subFormData']['boardingstallcost'], 'boardingpastureboardcost' => $_SESSION['subFormData']['boardingpastureboardcost'], 'layoverStayshorsehotel' => $_SESSION['subFormData']['layoverStayshorsehotel'], 'lessons_provided' => $_SESSION['subFormData']['lessonsprovided'], 'Owners_live_on_farm' => $_SESSION['subFormData']['ownersliveonfarm'], 'observation_room' => $_SESSION['subFormData']['observationroom'], 'inside_bathroom' => $_SESSION['subFormData']['insidebathroom'], 'grain_provided' => $_SESSION['subFormData']['grainprovided'], 'supplements_given' => $_SESSION['subFormData']['supplementsgiven'], 'indoor_arena' => $_SESSION['subFormData']['indoorarena'], 'outdoor_arena' => $_SESSION['subFormData']['outdoorarena'], 'round_pen' => $_SESSION['subFormData']['roundpen'], 'trails' => $trails, 'wash_rack' => $_SESSION['subFormData']['washrackwithhot'], 'turn_out1' => $_SESSION['FormData']['turnout'], 'turn_out2' => $_SESSION['subFormData']['turnouts'], 'fencing' => $fencing, 'stand_for_vet' => $_SESSION['subFormData']['standforvet'], 'trailer_parking' => $_SESSION['subFormData']['trailerparking'], 'main_image' => $file, 'images' => serialize(array($_SESSION['file_url_2'], $_SESSION['file_url_3'])), 'package' => 'top', 'type_of_facility' => $_SESSION['subFormData']['whattypeoffacility'], 'worming_schedule' => $_SESSION['subFormData']['wormingschedule'], 'Region' => $_SESSION['subFormData']['Region'], 'farmcity' => $_SESSION['FormData']['farmcity'], 'farmzip' => $_SESSION['FormData']['farmzip'], 'latitude' => $latitude, 'longitude' => $longitude, 'phone' => $_SESSION['FormData']['farmphone']);
 }
 $wpdb->insert('wp_bmee_question', $array);
 switch ($_SESSION['FormData']['subscriptionID']) {