Beispiel #1
0
function insert_matched_data() {
	global $wpdb;

	$ctr=0;
	foreach ($_POST[field_map] as $value) {
		if($value!="") {
			$selected_fields.="$value,";
			$column_number[]=$ctr;
		}
		$ctr++;
	}
	$selected_fields=substr($selected_fields,0, strlen($selected_fields)-1);

	
	for ($entry_number=0; $entry_number<$_POST[total_entries]; $entry_number++) { 
		for ($ctr2=0; $ctr2<count($column_number); $ctr2++) {
			//print "'".$_POST["column{$column_number[$ctr2]}"][$entry_number]."',";
			//die();
			$value_string.="'".trim($_POST["column{$column_number[$ctr2]}"][$entry_number])."',";
			//die($value_string);
		}
		$value_string=substr($value_string,0, strlen($value_string)-1);
		//print "INSERT INTO ".$wpdb->prefix."store_locator ($selected_fields) VALUES ($value_string) <br>"; die();
		$wpdb->query("INSERT INTO ".$wpdb->prefix."store_locator ($selected_fields) VALUES ($value_string)");
		$for_geo=$wpdb->get_results("SELECT CONCAT(sl_address, ', ', sl_city, ', ', sl_state, ' ', sl_zip) as the_address FROM ".$wpdb->prefix."store_locator WHERE sl_id='".mysql_insert_id()."'", ARRAY_A);
		//var_dump($for_geo);  
		//exit();
		do_geocoding($for_geo[0][the_address]);
		$value_string="";

		}
}
Beispiel #2
0
//Inserting addresses by manual input
if ($_POST[sl_store] && $_GET[mode]!="pca") {
	foreach ($_POST as $key=>$value) {
		if (ereg("sl_", $key)) {
			$fieldList.="$key,";
			$value=comma($value);
			$valueList.="\"".stripslashes($value)."\",";
		}
	}
	$fieldList=substr($fieldList, 0, strlen($fieldList)-1);
	$valueList=substr($valueList, 0, strlen($valueList)-1);
	//$wpdb->query("INSERT into ". $wpdb->prefix . "store_locator (sl_store, sl_address, sl_city, sl_state, sl_zip) VALUES ('$_POST[sl_store]', '$_POST[sl_address]', '$_POST[sl_city]', '$_POST[sl_state]', '$_POST[sl_zip]')");
	//print "INSERT into ". $wpdb->prefix . "store_locator ($fieldList) VALUES ($valueList)"; exit;
	$wpdb->query("INSERT into ". $wpdb->prefix . "store_locator ($fieldList) VALUES ($valueList)");
	$address="$_POST[sl_address], $_POST[sl_city], $_POST[sl_state] $_POST[sl_zip]";
	do_geocoding($address);
	print "<div class='updated fade'>".__("Successful Addition",$text_domain).". $view_link</div> <!--meta http-equiv='refresh' content='0'-->"; //header("location:$_SERVER[HTTP_REFERER]");
}

//Importing addresses from an local or remote database
if ($_POST[remote] && trim($_POST[query])!="" || $_POST[finish_import]) {
	
	if (ereg(".*\..{2,}", $_POST[server])) {
		include($sl_upload_path."/addons/db-importer/remoteConnect.php");
	}
	else {
		/*if (file_exists("addons/db-importer/localImport.php")) {
			include($sl_upload_path."/addons/db-importer/localImport.php");
		}
		else {*/
			include($sl_path."/localImport.php");
Beispiel #3
0
                 $address['sl_address'] = '';
                 print 'BLANK<br/>';
             }
             if (!isset($address['sl_address2'])) {
                 $address['sl_address2'] = '';
             }
             if (!isset($address['sl_city'])) {
                 $address['sl_city'] = '';
             }
             if (!isset($address['sl_state'])) {
                 $address['sl_state'] = '';
             }
             if (!isset($address['sl_zip'])) {
                 $address['sl_zip'] = '';
             }
             do_geocoding("{$address['sl_address']} {$address['sl_address2']}, {$address['sl_city']}, {$address['sl_state']} {$address['sl_zip']}", $thisLocation);
         }
     }
     // Create Store Page(s)
     //
 } elseif ($_REQUEST['act'] == 'createpage') {
     if (isset($_REQUEST['sl_id'])) {
         if (!is_array($_REQUEST['sl_id'])) {
             $theLocations = array($_REQUEST['sl_id']);
         } else {
             $theLocations = $_REQUEST['sl_id'];
         }
         // Setup Store Pages Objects
         //
         if (!isset($slplus_plugin->StorePages) || !is_object($slplus_plugin->StorePages)) {
             require_once SLPLUS_PLUGINDIR . '/slp-pages/slp-pages.php';
Beispiel #4
0
				$key=ereg_replace("\-$_GET[edit]", "", $key); // stripping off number at the end (giving problems when constructing address string below)
				$_POST["$key"]=$value; 
			}
		}
		//var_dump($_POST); exit;
		$field_value_str=substr($field_value_str, 0, strlen($field_value_str)-2);
		$edit=$_GET[edit]; extract($_POST);
		$the_address="$address $address2, $city, $state $zip";
		
		$old_address=$wpdb->get_results("SELECT * FROM ".$wpdb->prefix."store_locator WHERE sl_id=$_GET[edit]", ARRAY_A);
		//print "address: $the_address<br>";
		//print "UPDATE ".$wpdb->prefix."store_locator SET $field_value_str WHERE sl_id='$_GET[edit]'"; exit;
		//print "UPDATE ".$wpdb->prefix."store_locator SET $field_value_str WHERE sl_id='$_GET[edit]'"; exit;
		$wpdb->query("UPDATE ".$wpdb->prefix."store_locator SET $field_value_str WHERE sl_id=$_GET[edit]");
		if ($the_address!="$old_address[sl_address] $old_address[sl_address2], $old_address[sl_city], $old_address[sl_state] $old_address[sl_zip]" || ($old_address[sl_latitude]=="" || $old_address[sl_longitutde]=="")) {
			do_geocoding($the_address,$_GET[edit]);
		}
		print "<script>location.replace('".ereg_replace("&edit=$_GET[edit]", "", $_SERVER[REQUEST_URI])."');</script>";
		//header("location:".ereg_replace("&edit=$_GET[edit]", "", $_SERVER[REQUEST_URI]));
	}
	
	if ($_POST[act]=="delete") {
		//If bulk delete is used
		include("deleteLocations.php");
	}
	if (eregi("tag", $_POST[act])) {
		//if bulk tagging is used
		include("tagLocations.php");
	}
	if (eregi("multi", $_POST[act])) {
		//if bulk updating is used