Changes for new geourl functionality.

Example added to index.php.
Install and update done.


git-svn-id: https://develop.svn.wordpress.org/trunk@294 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Little 2003-08-05 22:44:38 +00:00
parent 7274da6d08
commit b5701a52a3
11 changed files with 450 additions and 46 deletions

View File

@ -511,6 +511,8 @@ function get_postdata($postid) {
'Excerpt' => $post->post_excerpt, 'Excerpt' => $post->post_excerpt,
'Title' => $post->post_title, 'Title' => $post->post_title,
'Category' => $post->post_category, 'Category' => $post->post_category,
'Lat' => $post->post_lat,
'Lon' => $post->post_lon,
'post_status' => $post->post_status, 'post_status' => $post->post_status,
'comment_status' => $post->comment_status, 'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status, 'ping_status' => $post->ping_status,
@ -529,6 +531,8 @@ function get_postdata2($postid=0) { // less flexible, but saves DB queries
'Excerpt' => $post->post_excerpt, 'Excerpt' => $post->post_excerpt,
'Title' => $post->post_title, 'Title' => $post->post_title,
'Category' => $post->post_category, 'Category' => $post->post_category,
'Lat' => $post->post_lat,
'Lon' => $post->post_lon,
'post_status' => $post->post_status, 'post_status' => $post->post_status,
'comment_status' => $post->comment_status, 'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status, 'ping_status' => $post->ping_status,
@ -1254,4 +1258,50 @@ function balanceTags($text, $is_comment = 0) {
return $newtext; return $newtext;
} }
function doGeoUrlHeader($posts) {
global $use_default_geourl,$default_geourl_lat,$default_geourl_lon;
if (count($posts) == 1) {
// there's only one result see if it has a geo code
$row = $posts[0];
$lat = $row->post_lat;
$lon = $row->post_lon;
$title = $row->post_title;
if(($lon != null) && ($lat != null) ) {
echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" >\n";
echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")." - ".$title."\">\n";
return;
}
} else {
if($use_default_geourl) {
// send the default here
echo "<meta name=\"ICBM\" content=\"".$default_geourl_lat.", ".$default_geourl_lon."\" >\n";
echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")."\">\n";
}
}
}
function getRemoteFile($host,$path) {
$fp = fsockopen($host, 80, &$errno, &$errstr);
if ($fp) {
fputs($fp,"GET $path HTTP/1.0\r\nHost: $host\r\n\r\n");
while ($line = fgets($fp, 4096)) {
$lines[] = $line;
}
fclose($fp);
return $lines;
} else {
return false;
}
}
function pingGeoURL($blog_ID) {
global $blodotgsping_url;
$ourUrl = $blodotgsping_url."/index.php?p=".$blog_ID;
$host="geourl.org";
$path="/ping/?p=".$ourUrl;
getRemoteFile($host,$path);
}
?> ?>

View File

@ -229,6 +229,12 @@ function get_archives($type='', $limit='', $format='html') {
/***** Date/Time tags *****/ /***** Date/Time tags *****/
function the_date_xml() {
global $post;
echo mysql2date("Y-m-d",$post->post_date);
//echo ""+$post->post_date;
}
function the_date($d='', $before='', $after='', $echo = true) { function the_date($d='', $before='', $after='', $echo = true) {
global $id, $post, $day, $previousday, $dateformat, $newday; global $id, $post, $day, $previousday, $dateformat, $newday;
$the_date = ''; $the_date = '';
@ -287,6 +293,118 @@ function the_weekday_date($before='',$after='') {
/***** // Date/Time tags *****/ /***** // Date/Time tags *****/
/**** // Geo Tags ****/
function get_Lat() {
global $post;
return $post->post_lat;
}
function get_Lon() {
global $post;
return $post->post_lon;
}
function print_Lat() {
if(get_settings('use_geo_positions')) {
if(get_Lat() > 0) {
echo "".get_Lat()."N";
} else {
echo "".get_Lat()."S";
}
}
}
function print_Lon() {
global $id, $postdata;
if(get_settings('use_geo_positions')) {
if(get_Lon() < 0) {
$temp = get_Lon() * -1;
echo "".$temp."W";
} else {
echo "".get_Lon()."E";
}
}
}
function print_PopUpScript() {
echo "
<SCRIPT LANGUAGE=\"JavaScript\">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function formHandler(form) {
var URL = form.site.options[form.site.selectedIndex].value;
if(URL != \".\") {
popup = window.open(URL,\"MenuPopup\");
}
}
// End -->
</script> ";
}
function print_UrlPopNav() {
$sites = array(
array("http://www.acme.com/mapper/?lat=".get_Lat()."&long=".get_Lon()."&scale=11&theme=Image&width=3&height=2&dot=Yes","Acme Mapper"),
array("http://geourl.org/near/?lat=".get_Lat()."&lon=".get_Lon()."&dist=500","GeoUrls near here"),
array("http://www.geocaching.com/seek/nearest.aspx?origin_lat=".get_Lat()."&origin_long=".get_Lon()."&dist=5","Geocaches Near Nere"),
array("http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=".get_Lat()."&longitude=".get_Lon(),"Mapquest map of this spot"),
array("http://www.sidebit.com/ProjectGeoURLMap.php?lat=".get_Lat()."&lon=".get_Lon(),"SideBit URL Map of this spot"),
array("http://confluence.org/confluence.php?lat=".get_Lat()."&lon=".get_Lon(),"Confluence.org near here"),
array("http://www.topozone.com/map.asp?lat=".get_Lat()."&lon=".get_Lon(),"Topozone near here"),
array("http://www.findu.com/cgi-bin/near.cgi?lat=".get_Lat()."&lon=".get_Lon(),"FindU near here"),
array("http://mapserver.maptech.com/api/espn/index.cfm?lat=".get_Lat()."&lon=".get_Lon()."&scale=100000&zoom=50&type=1&icon=0&&scriptfile=http://mapserver.maptech.com/api/espn/index.cfm","Maptech near here")
);
echo "<form name=form><select name=site SIZE=1 onchange=\"formHandler(this.form);\" >\n";
echo "<option value=\".\">Sites referencing ".get_Lat()." x ".get_Lon()."\n";
foreach($sites as $site) {
echo "<option value=\"".$site[0]."\">".$site[1]."\n";
}
echo "</select></form>";
}
function longitude_invalid() {
if (get_Lon() == null) return true;
if (get_Lon() > 360) return true;
if (get_Lon() < -360) return true;
}
function print_AcmeMap_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://www.acme.com/mapper/?lat=".get_Lat()."&long=".get_Lon()."&scale=11&theme=Image&width=3&height=2&dot=Yes";
}
function print_GeoURL_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://geourl.org/near/?lat=".get_Lat()."&lon=".get_Lon()."&dist=500";
}
function print_GeoCache_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://www.geocaching.com/seek/nearest.aspx?origin_lat=".get_Lat()."&origin_long=".get_Lon()."&dist=5";
}
function print_MapQuest_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=".get_Lat()."&longitude=".get_Lon();
}
function print_SideBit_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://www.sidebit.com/ProjectGeoURLMap.php?lat=".get_Lat()."&lon=".get_Lon();
}
function print_DegreeConfluence_Url() {
if (!get_settings('use_geo_positions')) return;
if (longitude_invalid()) return;
echo "http://confluence.org/confluence.php?lat=".get_Lat()."&lon=".get_Lon();
}

View File

@ -156,6 +156,7 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
$blah = explode("\n", $content); $blah = explode("\n", $content);
$firstline = $blah[0]; $firstline = $blah[0];
$secondline = $blah[1];
if ($use_phoneemail) { if ($use_phoneemail) {
$btpos = strpos($firstline, $phoneemail_separator); $btpos = strpos($firstline, $phoneemail_separator);
@ -174,6 +175,24 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
$contentfirstline = ''; $contentfirstline = '';
} }
$flat = 999.0;
$flon = 999.0;
$secondlineParts = explode(':',$secondline);
if(strncmp($secondlineParts[0],"POS",3)==0) {
echo "Found POS:<br>\n";
//echo "Second parts is:".$secondlineParts[1];
// the second line is the postion listing line
$secLineParts = explode(',',$secondlineParts[1]);
$flatStr = $secLineParts[0];
$flonStr = $secLineParts[1];
//echo "String are ".$flatStr.$flonStr;
$flat = floatval($secLineParts[0]);
$flon = floatval($secLineParts[1]);
//echo "values are ".$flat." and ".$flon;
// ok remove that position... we should not have it in the final output
$content = str_replace($secondline,'',$content);
}
$blah = explode(':', $userpassstring); $blah = explode(':', $userpassstring);
$user_login = $blah[0]; $user_login = $blah[0];
$user_pass = $blah[1]; $user_pass = $blah[1];
@ -209,7 +228,11 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
if (!$thisisforfunonly) { if (!$thisisforfunonly) {
$post_title = addslashes(trim($post_title)); $post_title = addslashes(trim($post_title));
$content = addslashes(trim($content)); $content = addslashes(trim($content));
$sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)"; if($flat > 500) {
$sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)";
} else {
$sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category, post_lat, post_lon) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category, $flat, $flon)";
}
$result = $wpdb->query($sql); $result = $wpdb->query($sql);
$post_ID = $wpdb->insert_id; $post_ID = $wpdb->insert_id;
@ -218,7 +241,12 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
} }
$blog_ID = 1; $blog_ID = 1;
rss_update($blog_ID); if($flat < 500) {
pingGeoUrl($post_ID);
}
// HACK HACK HACK this next line is commented out because I don't know what the word-press replacement
// is. right now it's undefined and does not work
//rss_update($blog_ID);
pingWeblogs($blog_ID); pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID); pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID); pingBlogs($blog_ID);

View File

@ -1,7 +1,8 @@
<?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; <?php /* Don't remove these lines, they call the b2 function files ! */
$blog=1;
require_once('blog.header.php'); require_once('blog.header.php');
require_once($abspath.'wp-links/links.php'); require_once($abspath.'wp-links/links.php');
// not on by default require_once($abspath.'wp-links/links.weblogs.com.php'); // not on by default: require_once($abspath.'wp-links/links.weblogs.com.php');
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -13,6 +14,9 @@ require_once($abspath.'wp-links/links.php');
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="WordPress .7" /> <!-- leave this for stats --> <meta name="generator" content="WordPress .7" /> <!-- leave this for stats -->
<?php if(get_settings('use_geo_positions')) {
doGeoUrlHeader($posts);
} ?>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import url( <?php echo $siteurl; ?>/layout2b.css ); @import url( <?php echo $siteurl; ?>/layout2b.css );
</style> </style>
@ -21,7 +25,11 @@ require_once($abspath.'wp-links/links.php');
<link rel="alternate" type="text/xml" title="RDF" href="<?php bloginfo('rdf_url'); ?>" /> <link rel="alternate" type="text/xml" title="RDF" href="<?php bloginfo('rdf_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php get_archives('monthly', '', 'link'); ?>
<?php // comments_popup_script(); // off by default ?> <?php // comments_popup_script(); // off by default ?>
<?php if(get_settings('use_geo_positions')) {
print_PopUpScript();
} ?>
</head> </head>
<body> <body>
@ -29,13 +37,19 @@ require_once($abspath.'wp-links/links.php');
<h1 id="header"><a href="<?php echo $siteurl; ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1> <h1 id="header"><a href="<?php echo $siteurl; ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
<div id="content"> <div id="content">
<?php if ($posts) { foreach ($posts as $post) { start_b2(); ?> <?php if ($posts) { foreach ($posts as $post) { start_b2(); ?>
<?php the_date('','<h2>','</h2>'); ?> <?php the_date('','<h2>','</h2>'); ?>
<h3 class="storytitle" id="post-<?php the_ID(); ?>"> <h3 class="storytitle" id="post-<?php the_ID(); ?>">
<a href="<?php permalink_link() ?>" rel="bookmark"><?php the_title(); ?></a> <a href="<?php permalink_link() ?>" rel="bookmark"><?php the_title(); ?></a>
<span class="meta"><a href="?cat=<?php the_category_ID() ?>" title="Category: <?php the_category() ?>">[<?php the_category() ?>]</a> &#8212; <?php the_author() ?> @ <?php the_time() ?> <span class="meta"><a href="?cat=<?php the_category_ID() ?>" title="Category: <?php the_category() ?>">[<?php the_category() ?>]</a> &#8212; <?php the_author() ?> @ <?php the_time() ?><br />
<?php
if(get_settings('use_geo_positions')) {
if((get_Lon() != null) && (get_Lon() < 360) &&(get_Lon() > -360)) { ?>
from: &nbsp;<?php print_Lat(); echo " x "; print_Lon(); echo "&nbsp;&nbsp;"; print_UrlPopNav(); ?>
<?php
}
} ?>
</span> </span>
</h3> </h3>
@ -52,7 +66,7 @@ require_once($abspath.'wp-links/links.php');
<?php include('b2comments.php'); ?> <?php include('b2comments.php'); ?>
<?php } } // end foreach, end if any posts ?> <?php } } // end foreach, end if any posts ?>
</div> </div>

View File

@ -171,6 +171,15 @@ if ($action != 'editcomment') {
} }
?> ?>
<textarea rows="<?php echo $rows; ?>" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br /> <textarea rows="<?php echo $rows; ?>" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br />
<?php
if (get_settings('use_geo_positions')) {
?>
<label for="post_latf">Lat:</label><input size="8" type="text" value="<?php echo $edited_lat; ?>" name="post_latf">&nbsp;
<label for="post_lonf">Lon:</label><input size="8" type="text" value="<?php echo $edited_lon; ?>" name="post_lonf">&nbsp; <A href="http://www.geourl.org/resources.html" target="_blank" >click for Geo Info</A>
<br>
<?
}
?>
<?php echo $form_pingback ?> <?php echo $form_pingback ?>
<?php echo $form_prevstatus ?> <?php echo $form_prevstatus ?>

View File

@ -11,7 +11,7 @@ function add_magic_quotes($array) {
} }
} }
return $array; return $array;
} }
if (!get_magic_quotes_gpc()) { if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS); $HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
@ -40,7 +40,7 @@ switch($action) {
case 'post': case 'post':
$standalone = 1; $standalone = 1;
require_once('b2header.php'); require_once('b2header.php');
$post_pingback = intval($HTTP_POST_VARS['post_pingback']); $post_pingback = intval($HTTP_POST_VARS['post_pingback']);
$content = balanceTags($HTTP_POST_VARS['content']); $content = balanceTags($HTTP_POST_VARS['content']);
@ -49,6 +49,14 @@ switch($action) {
$excerpt = format_to_post($excerpt); $excerpt = format_to_post($excerpt);
$post_title = addslashes($HTTP_POST_VARS['post_title']); $post_title = addslashes($HTTP_POST_VARS['post_title']);
$post_category = intval($HTTP_POST_VARS['post_category']); $post_category = intval($HTTP_POST_VARS['post_category']);
if(get_settings('use_geo_positions')) {
$latstr = $HTTP_POST_VARS['post_latf'];
$lonstr = $HTTP_POST_VARS['post_lonf'];
if((strlen($latstr) > 2) && (strlen($lonstr) > 2 ) ) {
$post_latf = floatval($HTTP_POST_VARS['post_latf']);
$post_lonf = floatval($HTTP_POST_VARS['post_lonf']);
}
}
$post_status = $HTTP_POST_VARS['post_status']; $post_status = $HTTP_POST_VARS['post_status'];
$comment_status = $HTTP_POST_VARS['comment_status']; $comment_status = $HTTP_POST_VARS['comment_status'];
$ping_status = $HTTP_POST_VARS['ping_status']; $ping_status = $HTTP_POST_VARS['ping_status'];
@ -73,24 +81,36 @@ switch($action) {
$now = date('Y-m-d H:i:s', (time() + ($time_difference * 3600))); $now = date('Y-m-d H:i:s', (time() + ($time_difference * 3600)));
} }
$result = $wpdb->query(" if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
INSERT INTO $tableposts $postquery ="INSERT INTO $tableposts
(ID, post_author, post_date, post_content, post_title, post_category, post_excerpt, post_status, comment_status, ping_status, post_password) (ID, post_author, post_date, post_content, post_title, post_category, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password)
VALUES VALUES
('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password') ('0','$user_ID','$now','$content','$post_title','$post_category',$post_latf,$post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password')
"); ";
} else {
$postquery ="INSERT INTO $tableposts
(ID, post_author, post_date, post_content, post_title, post_category, post_excerpt, post_status, comment_status, ping_status, post_password)
VALUES
('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password')
";
}
$postquery =
$result = $wpdb->query($postquery);
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
if (isset($sleep_after_edit) && $sleep_after_edit > 0) { if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit); sleep($sleep_after_edit);
} }
if ($post_status == 'publish') { if ($post_status == 'publish') {
if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) {
pingGeoUrl($post_ID);
}
pingWeblogs($blog_ID); pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID); pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID); pingBlogs($blog_ID);
if ($post_pingback) { if ($post_pingback) {
pingback($content, $post_ID); pingback($content, $post_ID);
} }
@ -136,9 +156,11 @@ switch($action) {
$authordata = get_userdata($postdata['Author_ID']); $authordata = get_userdata($postdata['Author_ID']);
if ($user_level < $authordata->user_level) if ($user_level < $authordata->user_level)
die ('You don&#8217;t have the right to edit <strong>'.$authordata[1].'</strong>&#8217;s posts.'); die ('You don&#8217;t have the right to edit <strong>'.$authordata[1].'</strong>&#8217;s posts.');
$content = $postdata['Content']; $content = $postdata['Content'];
$content = format_to_edit($content); $content = format_to_edit($content);
$edited_lat = $postdata["Lat"];
$edited_lon = $postdata["Lon"];
$excerpt = $postdata['Excerpt']; $excerpt = $postdata['Excerpt'];
$excerpt = format_to_edit($excerpt); $excerpt = format_to_edit($excerpt);
$edited_post_title = format_to_edit($postdata['Title']); $edited_post_title = format_to_edit($postdata['Title']);
@ -164,7 +186,7 @@ switch($action) {
$standalone = 1; $standalone = 1;
require_once('./b2header.php'); require_once('./b2header.php');
if ($user_level == 0) if ($user_level == 0)
die ('Cheatin&#8217; uh?'); die ('Cheatin&#8217; uh?');
@ -179,6 +201,17 @@ switch($action) {
$excerpt = balanceTags($HTTP_POST_VARS['excerpt']); $excerpt = balanceTags($HTTP_POST_VARS['excerpt']);
$excerpt = format_to_post($excerpt); $excerpt = format_to_post($excerpt);
$post_title = addslashes($HTTP_POST_VARS['post_title']); $post_title = addslashes($HTTP_POST_VARS['post_title']);
if(get_settings('use_geo_positions')) {
$latf = floatval($HTTP_POST_VARS["post_latf"]);
$lonf = floatval($HTTP_POST_VARS["post_lonf"]);
$latlonaddition = "";
if( ($latf != null) && ($latf <= 90 ) && ($latf >= -90) && ($lonf != null) && ($lonf <= 360) && ($lonf >= -360) ) {
pingGeoUrl($post_ID);
$latlonaddition = " post_lat=".$latf.", post_lon =".$lonf.", ";
} else {
$latlonaddition = " post_lat=null, post_lon=null, ";
}
}
$post_status = $HTTP_POST_VARS['post_status']; $post_status = $HTTP_POST_VARS['post_status'];
$prev_status = $HTTP_POST_VARS['prev_status']; $prev_status = $HTTP_POST_VARS['prev_status'];
$comment_status = $HTTP_POST_VARS['comment_status']; $comment_status = $HTTP_POST_VARS['comment_status'];
@ -202,17 +235,17 @@ switch($action) {
} }
$result = $wpdb->query(" $result = $wpdb->query("
UPDATE $tableposts SET UPDATE $tableposts SET
post_content = '$content', post_content = '$content',
post_excerpt = '$excerpt', post_excerpt = '$excerpt',
post_title = '$post_title', post_title = '$post_title',
post_category = '$post_category'".$datemodif.", post_category = '$post_category'".$datemodif.",
post_status = '$post_status', ".$latlonaddition."
comment_status = '$comment_status', post_status = '$post_status',
ping_status = '$ping_status', comment_status = '$comment_status',
post_password = '$post_password' ping_status = '$ping_status',
WHERE ID = $post_ID post_password = '$post_password'
"); WHERE ID = $post_ID ");
if (isset($sleep_after_edit) && $sleep_after_edit > 0) { if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit); sleep($sleep_after_edit);
@ -223,7 +256,7 @@ switch($action) {
pingWeblogs($blog_ID); pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID); pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID); pingBlogs($blog_ID);
if ($post_pingback) { if ($post_pingback) {
pingback($content, $post_ID); pingback($content, $post_ID);
} }
@ -258,6 +291,15 @@ switch($action) {
if ($user_level < $authordata->user_level) if ($user_level < $authordata->user_level)
die ('You don&#8217;t have the right to delete <strong>'.$authordata[1].'</strong>&#8217;s posts.'); die ('You don&#8217;t have the right to delete <strong>'.$authordata[1].'</strong>&#8217;s posts.');
// send geoURL ping to "erase" from their DB
$query = "SELECT post_lat from $tableposts WHERE ID=$post";
$rows = $wpdb->query($query);
$myrow = $rows[0];
$latf = $myrow->post_lat;
if($latf != null ) {
pingGeoUrl($post);
}
$result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post"); $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post");
if (!$result) if (!$result)
die('Error in deleting... contact the <a href="mailto:$admin_email">webmaster</a>.'); die('Error in deleting... contact the <a href="mailto:$admin_email">webmaster</a>.');
@ -348,11 +390,11 @@ switch($action) {
$content = format_to_post($content); $content = format_to_post($content);
$result = $wpdb->query(" $result = $wpdb->query("
UPDATE $tablecomments SET UPDATE $tablecomments SET
comment_content = '$content', comment_content = '$content',
comment_author = '$newcomment_author', comment_author = '$newcomment_author',
comment_author_email = '$newcomment_author_email', comment_author_email = '$newcomment_author_email',
comment_author_url = '$newcomment_author_url'".$datemodif." comment_author_url = '$newcomment_author_url'".$datemodif."
WHERE comment_ID = $comment_ID" WHERE comment_ID = $comment_ID"
); );

View File

@ -15,6 +15,7 @@ function get_option_widget($option_result, $editable, $between)
switch ($option_result->option_type) { switch ($option_result->option_type) {
case 1: // integer case 1: // integer
case 3: // string case 3: // string
case 8: // float
case 6: // range -- treat same as integer for now! case 6: // range -- treat same as integer for now!
if (($option_result->option_type == 1) || ($option_result->option_type == 1)) { if (($option_result->option_type == 1) || ($option_result->option_type == 1)) {
$width = 6; $width = 6;

View File

@ -43,6 +43,7 @@ if (!$step) $step = 0;
switch($step) { switch($step) {
case 0: case 0:
{
?> ?>
<p>Welcome to WordPress. You're already part of the family so this should be familiar <p>Welcome to WordPress. You're already part of the family so this should be familiar
to you now. We think you'll find to like in this latest version, here are some to you now. We think you'll find to like in this latest version, here are some
@ -69,9 +70,11 @@ switch($step) {
<p><code></code>Have you looked at the <a href="../readme.html">readme</a>? If <p><code></code>Have you looked at the <a href="../readme.html">readme</a>? If
you&#8217;re all ready, <a href="<?php echo $thisfile;?>?step=1">let's go</a>! </p> you&#8217;re all ready, <a href="<?php echo $thisfile;?>?step=1">let's go</a>! </p>
<?php <?php
break; break;
}
case 1: case 1:
{
?> ?>
<h1>Step 1</h1> <h1>Step 1</h1>
<p>There are some changes we need to make to the links tables with this version, so lets get those out of <p>There are some changes we need to make to the links tables with this version, so lets get those out of
@ -201,10 +204,57 @@ if ($error_count > 0) {
<p>OK, that wasn't too bad was it? Let's move on to <a href="<?php echo $thisfile;?>?step=2">step 2</a>!</p> <p>OK, that wasn't too bad was it? Let's move on to <a href="<?php echo $thisfile;?>?step=2">step 2</a>!</p>
<?php <?php
} }
break; break;
case 2: } // end case 1
case 2:
{
?> ?>
<h1>Step 2</h1> <h1>Step 2</h1>
<p>There are some changes we need to make to the post table, we'll do those next.</p>
<?php
$error_count = 0;
$tablename = $tableposts;
$ddl = "ALTER TABLE $tableposts ADD COLUMN post_lon float ";
maybe_add_column($tablename, 'post_lon', $ddl);
if (check_column($tablename, 'post_lon', 'float')) {
$res .= $tablename . ' - ok <br />'."\n";
} else {
$res .= 'There was a problem with ' . $tablename . '<br />'."\n";
++$error_count;
}
$ddl = "ALTER TABLE $tableposts ADD COLUMN post_lat float ";
maybe_add_column($tablename, 'post_lat', $ddl);
if (check_column($tablename, 'post_lat', 'float')) {
$res .= $tablename . ' - ok <br />'."\n";
} else {
$res .= 'There was a problem with ' . $tablename . '<br />'."\n";
++$error_count;
}
if ($error_count > 0) {
echo("<p>$res</p>");
?>
<p>Hmmm... there was some kind of error. If you cannot figure out
see from the output above how to correct the problems please
visit our <a href="http://wordpress.org/support/">support
forums</a> and report your problem.</p>
<?php
} else {
?>
<p>OK, another step completed. Let's move on to <a href="<?php echo $thisfile;?>?step=3">step 3</a>.</p>
<?php
}
break;
} // end case 2
case 3:
{
?>
<h1>Step 3</h1>
<p>There are a few new database tables with this version, so lets get those out of <p>There are a few new database tables with this version, so lets get those out of
the way.</p> the way.</p>
<?php <?php
@ -523,6 +573,29 @@ $option_data = array(
//} //}
?> ?>
<?php
$geo_option_data = array(
// data for geo settings
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(84,'use_geo_positions', 2, '1', 'Turns on the geo url features of WordPress', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)",
);
foreach ($geo_option_data as $query) {
$q = $wpdb->query($query);
}
?>
<p>Geo option data inserted okay.</p>
<p>Good, the option data was inserted okay.</p> <p>Good, the option data was inserted okay.</p>
@ -741,7 +814,8 @@ foreach ($links_option_data as $query) {
<p>You can now go play with your <a href="<?php echo $siteurl ? $siteurl : '../index.php'; ?>">updated blog</a> </p> <p>You can now go play with your <a href="<?php echo $siteurl ? $siteurl : '../index.php'; ?>">updated blog</a> </p>
<?php <?php
} // end else no b2config } // end else no b2config
break; break;
} // end case 3
} }
?> ?>
</body> </body>

View File

@ -1,5 +1,6 @@
<?php <?php
require_once('../wp-config.php'); require_once('../wp-config.php');
$debug = 0;
/** /**
** maybe_create_table() ** maybe_create_table()
@ -32,8 +33,9 @@ function maybe_create_table($table_name, $create_ddl) {
** false on error ** false on error
*/ */
function maybe_add_column($table_name, $column_name, $create_ddl) { function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb; global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) { if ($column == $column_name) {
return true; return true;
} }
@ -90,15 +92,15 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
** Extra ** Extra
*/ */
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
global $wpdb; global $wpdb, $debug;
$diffs = 0; $diffs = 0;
$results = $wpdb->get_results("DESC $table_name"); $results = $wpdb->get_results("DESC $table_name");
foreach ($results as $row ) { foreach ($results as $row ) {
//print_r($row); if ($debug > 1) print_r($row);
if ($row->Field == $col_name) { if ($row->Field == $col_name) {
// got our column, check the params // got our column, check the params
//echo ("checking $row->Type against $col_type\n"); if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) { if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs; ++$diffs;
} }
@ -115,7 +117,7 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
++$diffs; ++$diffs;
} }
if ($diffs > 0) { if ($diffs > 0) {
//echo ("diffs = $diffs returning false\n"); if ($debug) echo ("diffs = $diffs returning false\n");
return false; return false;
} }
return true; return true;

View File

@ -192,6 +192,8 @@ $query = "CREATE TABLE $tableposts (
post_title text NOT NULL, post_title text NOT NULL,
post_category int(4) NOT NULL default '0', post_category int(4) NOT NULL default '0',
post_excerpt text NOT NULL, post_excerpt text NOT NULL,
post_lat float,
post_lon float,
post_status enum('publish','draft','private') NOT NULL default 'publish', post_status enum('publish','draft','private') NOT NULL default 'publish',
comment_status enum('open','closed') NOT NULL default 'open', comment_status enum('open','closed') NOT NULL default 'open',
ping_status enum('open','closed') NOT NULL default 'open', ping_status enum('open','closed') NOT NULL default 'open',
@ -358,6 +360,8 @@ $option_data = array(
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')", "INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')", "INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')", "INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')",
//base options from b2cofig //base options from b2cofig
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, 'http://example.com', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)", "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, 'http://example.com', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)",
@ -618,6 +622,31 @@ foreach ($links_option_data as $query) {
<p>Links option data inserted okay.</p> <p>Links option data inserted okay.</p>
<?php
$geo_option_data = array(
// data for geo settings
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(84,'use_geo_positions', 2, '1', 'Turns on the geo url features of WordPress', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options',Settings which control the posting and display of Geo Options')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)",
);
foreach ($geo_option_data as $query) {
$q = $wpdb->query($query);
}
?>
<p>Geo option data inserted okay.</p>
<p>OK. We're nearly done now. We just need to ask you a couple of things:</p> <p>OK. We're nearly done now. We just need to ask you a couple of things:</p>
<form action="wp-install.php?step=3" method="post"> <form action="wp-install.php?step=3" method="post">
<input type="hidden" name="step" value="3" /> <input type="hidden" name="step" value="3" />

37
wp-locations.php Normal file
View File

@ -0,0 +1,37 @@
<?php $blog = 1; // enter your blog's ID
header('Content-type: text/xml');
include('blog.header.php');
?><?php echo "<?xml version=\"1.0\"?".">\n"; ?>
<travels>
<?php
$start = count($posts)-1;
for ($i = $start; $i >= 0; $i--) {
$post = $posts[$i];
start_b2();
if ((get_Lon() != null) && (get_Lon > -360) && (get_Lon() < 360 )) {
?>
<location arrival="<?php the_date_xml() ?>">
<name><?php the_title_rss() ?></name>
<latitude><?php print_Lat() ?></latitude>
<longitude><?php print_Lon() ?></longitude>
<?php
if ($rss_use_excerpt) {
?>
<note><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?>
</note>
<?php
} else { // use content
?>
<note><?php the_excerpt_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></note>
<?php
} // end else use content
?>
<url><?php permalink_single_rss() ?></url>
</location>
<?php
} // end if lon valid
?>
<?php
} // end loop
?>
</travels>