Changeset 294

Show
Ignore:
Timestamp:
08/05/03 22:44:38 (5 years ago)
Author:
mikelittle
Message:

Changes for new geourl functionality.
Example added to index.php.
Install and update done.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/b2-include/b2functions.php

    r284 r294  
    512512        'Title' => $post->post_title,  
    513513        'Category' => $post->post_category, 
     514        'Lat' => $post->post_lat, 
     515        'Lon' => $post->post_lon, 
    514516        'post_status' => $post->post_status, 
    515517        'comment_status' => $post->comment_status, 
     
    530532        'Title' => $post->post_title, 
    531533        'Category' => $post->post_category, 
     534        'Lat' => $post->post_lat, 
     535        'Lon' => $post->post_lon, 
    532536        'post_status' => $post->post_status, 
    533537        'comment_status' => $post->comment_status, 
     
    12551259} 
    12561260 
     1261function doGeoUrlHeader($posts) { 
     1262    global $use_default_geourl,$default_geourl_lat,$default_geourl_lon; 
     1263    if (count($posts) == 1) { 
     1264        // there's only one result  see if it has a geo code 
     1265        $row = $posts[0]; 
     1266        $lat = $row->post_lat; 
     1267        $lon = $row->post_lon; 
     1268        $title = $row->post_title; 
     1269        if(($lon != null) && ($lat != null) ) { 
     1270            echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" >\n"; 
     1271            echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")." - ".$title."\">\n"; 
     1272            return; 
     1273        } 
     1274    } else { 
     1275        if($use_default_geourl) { 
     1276            // send the default here  
     1277            echo "<meta name=\"ICBM\" content=\"".$default_geourl_lat.", ".$default_geourl_lon."\" >\n"; 
     1278            echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")."\">\n"; 
     1279        } 
     1280    } 
     1281} 
     1282 
     1283function getRemoteFile($host,$path) { 
     1284    $fp = fsockopen($host, 80, &$errno, &$errstr); 
     1285    if ($fp) { 
     1286        fputs($fp,"GET $path HTTP/1.0\r\nHost: $host\r\n\r\n"); 
     1287        while ($line = fgets($fp, 4096)) { 
     1288            $lines[] = $line; 
     1289        } 
     1290        fclose($fp); 
     1291        return $lines; 
     1292    } else { 
     1293        return false; 
     1294    } 
     1295} 
     1296 
     1297function pingGeoURL($blog_ID) { 
     1298    global $blodotgsping_url; 
     1299 
     1300    $ourUrl = $blodotgsping_url."/index.php?p=".$blog_ID; 
     1301    $host="geourl.org"; 
     1302    $path="/ping/?p=".$ourUrl; 
     1303    getRemoteFile($host,$path);  
     1304} 
     1305 
     1306 
    12571307?> 
  • trunk/b2-include/b2template.functions.php

    r293 r294  
    230230/***** Date/Time tags *****/ 
    231231 
     232function the_date_xml() { 
     233    global $post; 
     234    echo mysql2date("Y-m-d",$post->post_date); 
     235    //echo ""+$post->post_date; 
     236} 
     237 
    232238function the_date($d='', $before='', $after='', $echo = true) { 
    233239    global $id, $post, $day, $previousday, $dateformat, $newday; 
     
    288294/***** // Date/Time tags *****/ 
    289295 
     296/**** // Geo Tags ****/ 
     297function get_Lat() { 
     298    global $post; 
     299    return $post->post_lat; 
     300} 
     301 
     302function get_Lon() { 
     303    global $post; 
     304    return $post->post_lon; 
     305} 
     306 
     307function print_Lat() { 
     308    if(get_settings('use_geo_positions')) { 
     309        if(get_Lat() > 0) { 
     310            echo "".get_Lat()."N"; 
     311        } else { 
     312            echo "".get_Lat()."S"; 
     313        } 
     314    } 
     315} 
     316 
     317function print_Lon() { 
     318    global $id, $postdata; 
     319    if(get_settings('use_geo_positions')) { 
     320        if(get_Lon() < 0) { 
     321            $temp = get_Lon() * -1; 
     322            echo "".$temp."W"; 
     323        } else { 
     324            echo "".get_Lon()."E"; 
     325        } 
     326    } 
     327} 
     328 
     329function print_PopUpScript() { 
     330    echo " 
     331<SCRIPT LANGUAGE=\"JavaScript\"> 
     332 
     333<!-- This script and many more are available free online at --> 
     334<!-- The JavaScript Source!! http://javascript.internet.com --> 
     335 
     336<!-- Begin 
     337function formHandler(form) { 
     338  var URL = form.site.options[form.site.selectedIndex].value; 
     339  if(URL != \".\") { 
     340    popup = window.open(URL,\"MenuPopup\"); 
     341  } 
     342} 
     343// End --> 
     344</script> "; 
     345} 
     346 
     347function print_UrlPopNav() { 
     348    $sites = array(  
     349                   array("http://www.acme.com/mapper/?lat=".get_Lat()."&long=".get_Lon()."&scale=11&theme=Image&width=3&height=2&dot=Yes","Acme Mapper"), 
     350                   array("http://geourl.org/near/?lat=".get_Lat()."&lon=".get_Lon()."&dist=500","GeoUrls near here"), 
     351                   array("http://www.geocaching.com/seek/nearest.aspx?origin_lat=".get_Lat()."&origin_long=".get_Lon()."&dist=5","Geocaches Near Nere"), 
     352                   array("http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=".get_Lat()."&longitude=".get_Lon(),"Mapquest map of this spot"), 
     353                   array("http://www.sidebit.com/ProjectGeoURLMap.php?lat=".get_Lat()."&lon=".get_Lon(),"SideBit URL Map of this spot"), 
     354                   array("http://confluence.org/confluence.php?lat=".get_Lat()."&lon=".get_Lon(),"Confluence.org near here"), 
     355                   array("http://www.topozone.com/map.asp?lat=".get_Lat()."&lon=".get_Lon(),"Topozone near here"), 
     356                   array("http://www.findu.com/cgi-bin/near.cgi?lat=".get_Lat()."&lon=".get_Lon(),"FindU near here"), 
     357                   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") 
     358                  ); 
     359    echo "<form name=form><select name=site SIZE=1 onchange=\"formHandler(this.form);\" >\n"; 
     360    echo "<option value=\".\">Sites referencing ".get_Lat()." x ".get_Lon()."\n"; 
     361    foreach($sites as $site) { 
     362        echo "<option value=\"".$site[0]."\">".$site[1]."\n"; 
     363    } 
     364    echo "</select></form>"; 
     365} 
     366 
     367function longitude_invalid() { 
     368    if (get_Lon() == null) return true; 
     369    if (get_Lon() > 360) return true; 
     370    if (get_Lon() < -360) return true; 
     371} 
     372 
     373function print_AcmeMap_Url() { 
     374    if (!get_settings('use_geo_positions')) return; 
     375    if (longitude_invalid()) return; 
     376    echo "http://www.acme.com/mapper/?lat=".get_Lat()."&long=".get_Lon()."&scale=11&theme=Image&width=3&height=2&dot=Yes"; 
     377} 
     378 
     379function print_GeoURL_Url() { 
     380    if (!get_settings('use_geo_positions')) return; 
     381    if (longitude_invalid()) return; 
     382    echo "http://geourl.org/near/?lat=".get_Lat()."&lon=".get_Lon()."&dist=500"; 
     383} 
     384 
     385function print_GeoCache_Url() { 
     386    if (!get_settings('use_geo_positions')) return; 
     387    if (longitude_invalid()) return; 
     388    echo "http://www.geocaching.com/seek/nearest.aspx?origin_lat=".get_Lat()."&origin_long=".get_Lon()."&dist=5"; 
     389} 
     390 
     391function print_MapQuest_Url() { 
     392    if (!get_settings('use_geo_positions')) return; 
     393    if (longitude_invalid()) return; 
     394    echo "http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=".get_Lat()."&longitude=".get_Lon(); 
     395} 
     396 
     397function print_SideBit_Url() { 
     398    if (!get_settings('use_geo_positions')) return; 
     399    if (longitude_invalid()) return; 
     400    echo "http://www.sidebit.com/ProjectGeoURLMap.php?lat=".get_Lat()."&lon=".get_Lon(); 
     401} 
     402 
     403function print_DegreeConfluence_Url() { 
     404    if (!get_settings('use_geo_positions')) return; 
     405    if (longitude_invalid()) return; 
     406    echo "http://confluence.org/confluence.php?lat=".get_Lat()."&lon=".get_Lon(); 
     407} 
    290408 
    291409 
  • trunk/b2mail.php

    r255 r294  
    157157        $blah = explode("\n", $content); 
    158158        $firstline = $blah[0]; 
     159        $secondline = $blah[1]; 
    159160 
    160161        if ($use_phoneemail) { 
     
    175176        } 
    176177 
     178        $flat = 999.0; 
     179        $flon = 999.0; 
     180        $secondlineParts = explode(':',$secondline); 
     181        if(strncmp($secondlineParts[0],"POS",3)==0) { 
     182            echo "Found POS:<br>\n"; 
     183            //echo "Second parts is:".$secondlineParts[1]; 
     184            // the second line is the postion listing line 
     185            $secLineParts = explode(',',$secondlineParts[1]); 
     186            $flatStr = $secLineParts[0]; 
     187            $flonStr = $secLineParts[1]; 
     188            //echo "String are ".$flatStr.$flonStr;  
     189            $flat = floatval($secLineParts[0]); 
     190            $flon = floatval($secLineParts[1]); 
     191            //echo "values are ".$flat." and ".$flon; 
     192            // ok remove that position... we should not have it in the final output 
     193            $content = str_replace($secondline,'',$content); 
     194        } 
     195 
    177196        $blah = explode(':', $userpassstring); 
    178197        $user_login = $blah[0]; 
     
    210229                $post_title = addslashes(trim($post_title)); 
    211230                $content = addslashes(trim($content)); 
    212                 $sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)"; 
     231                if($flat > 500) { 
     232                    $sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)"; 
     233                } else { 
     234                    $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)"; 
     235                } 
    213236                $result = $wpdb->query($sql); 
    214237                $post_ID = $wpdb->insert_id; 
     
    219242 
    220243                $blog_ID = 1; 
    221                 rss_update($blog_ID); 
     244                if($flat < 500) { 
     245                    pingGeoUrl($post_ID);    
     246                } 
     247                // HACK HACK HACK this next line is commented out because I don't know what the word-press replacement 
     248                // is.  right now it's undefined and does not work               
     249                //rss_update($blog_ID); 
    222250                pingWeblogs($blog_ID); 
    223251                pingCafelog($cafelogID, $post_title, $post_ID); 
  • trunk/index.php

    r266 r294  
    1 <?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; 
     1<?php /* Don't remove these lines, they call the b2 function files ! */ 
     2$blog=1; 
    23require_once('blog.header.php'); 
    34require_once($abspath.'wp-links/links.php'); 
    4 // not on by default require_once($abspath.'wp-links/links.weblogs.com.php'); 
     5// not on by default: require_once($abspath.'wp-links/links.weblogs.com.php'); 
    56     
    67?> 
     
    1415    <meta name="generator" content="WordPress .7" /> <!-- leave this for stats --> 
    1516 
     17    <?php if(get_settings('use_geo_positions')) { 
     18        doGeoUrlHeader($posts); 
     19    } ?> 
    1620    <style type="text/css" media="screen"> 
    1721        @import url( <?php echo $siteurl; ?>/layout2b.css ); 
     
    2226    <link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" /> 
    2327    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 
     28    <?php get_archives('monthly', '', 'link'); ?> 
    2429    <?php // comments_popup_script(); // off by default ?> 
     30    <?php if(get_settings('use_geo_positions')) { 
     31        print_PopUpScript(); 
     32    } ?> 
    2533</head> 
    2634 
     
    3038 
    3139<div id="content"> 
    32  
    3340<?php if ($posts) { foreach ($posts as $post) { start_b2(); ?> 
    3441<?php the_date('','<h2>','</h2>'); ?> 
    3542 
    3643 <h3 class="storytitle" id="post-<?php the_ID(); ?>"> 
    37   <a href="<?php permalink_link() ?>" rel="bookmark"><?php the_title(); ?></a>  
    38   <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() ?> 
     44  <a href="<?php permalink_link() ?>" rel="bookmark"><?php the_title(); ?></a> 
     45  <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 /> 
     46<?php 
     47    if(get_settings('use_geo_positions')) { 
     48        if((get_Lon() != null) && (get_Lon() < 360) &&(get_Lon() > -360)) {  ?> 
     49    from: &nbsp;<?php print_Lat(); echo " x "; print_Lon(); echo "&nbsp;&nbsp;"; print_UrlPopNav(); ?> 
     50<?php 
     51        } 
     52    } ?> 
    3953  </span> 
    4054 </h3> 
     
    5367<?php include('b2comments.php'); ?> 
    5468 
    55 <?php } } // end foreach, end if any posts ?>  
     69<?php } } // end foreach, end if any posts ?> 
    5670 
    5771</div> 
  • trunk/wp-admin/b2edit.form.php

    r289 r294  
    172172?> 
    173173<textarea rows="<?php echo $rows; ?>" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br /> 
     174<?php 
     175  if (get_settings('use_geo_positions')) { 
     176?> 
     177<label for="post_latf">Lat:</label><input size="8" type="text" value="<?php echo $edited_lat; ?>" name="post_latf">&nbsp; 
     178<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> 
     179<br> 
     180<? 
     181  } 
     182?> 
    174183 
    175184<?php echo $form_pingback ?> 
  • trunk/wp-admin/b2edit.php

    r243 r294  
    1212    } 
    1313    return $array; 
    14 }  
     14} 
    1515 
    1616if (!get_magic_quotes_gpc()) { 
     
    4141 
    4242            $standalone = 1; 
    43             require_once('b2header.php');   
     43            require_once('b2header.php'); 
    4444 
    4545            $post_pingback = intval($HTTP_POST_VARS['post_pingback']); 
     
    5050            $post_title = addslashes($HTTP_POST_VARS['post_title']); 
    5151            $post_category = intval($HTTP_POST_VARS['post_category']); 
     52            if(get_settings('use_geo_positions')) { 
     53                $latstr = $HTTP_POST_VARS['post_latf']; 
     54                $lonstr = $HTTP_POST_VARS['post_lonf']; 
     55                if((strlen($latstr) > 2) && (strlen($lonstr) > 2 ) ) { 
     56                    $post_latf = floatval($HTTP_POST_VARS['post_latf']); 
     57                    $post_lonf = floatval($HTTP_POST_VARS['post_lonf']); 
     58                } 
     59            } 
    5260            $post_status = $HTTP_POST_VARS['post_status']; 
    5361            $comment_status = $HTTP_POST_VARS['comment_status']; 
     
    7482        } 
    7583 
    76         $result = $wpdb->query(" 
    77           INSERT INTO $tableposts  
    78             (ID, post_author, post_date, post_content, post_title, post_category, post_excerpt,  post_status, comment_status, ping_status, post_password) 
    79           VALUES 
    80             ('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password') 
    81           "); 
     84        if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { 
     85        $postquery ="INSERT INTO $tableposts 
     86                (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) 
     87                VALUES 
     88                ('0','$user_ID','$now','$content','$post_title','$post_category',$post_latf,$post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password') 
     89                "; 
     90        } else { 
     91        $postquery ="INSERT INTO $tableposts 
     92                (ID, post_author, post_date, post_content, post_title, post_category,  post_excerpt,  post_status, comment_status, ping_status, post_password) 
     93                VALUES 
     94                ('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password') 
     95                "; 
     96        } 
     97        $postquery = 
     98        $result = $wpdb->query($postquery); 
    8299 
    83100        $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); 
     
    86103                sleep($sleep_after_edit); 
    87104        } 
    88          
     105 
    89106        if ($post_status == 'publish') { 
     107            if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) { 
     108                pingGeoUrl($post_ID); 
     109            } 
    90110            pingWeblogs($blog_ID); 
    91111            pingCafelog($cafelogID, $post_title, $post_ID); 
    92112            pingBlogs($blog_ID); 
    93          
     113 
    94114            if ($post_pingback) { 
    95115                pingback($content, $post_ID); 
     
    137157            if ($user_level < $authordata->user_level) 
    138158                die ('You don&#8217;t have the right to edit <strong>'.$authordata[1].'</strong>&#8217;s posts.'); 
    139              
     159 
    140160            $content = $postdata['Content']; 
    141161            $content = format_to_edit($content); 
     162            $edited_lat = $postdata["Lat"]; 
     163            $edited_lon = $postdata["Lon"]; 
    142164            $excerpt = $postdata['Excerpt']; 
    143165            $excerpt = format_to_edit($excerpt); 
     
    165187        $standalone = 1; 
    166188        require_once('./b2header.php'); 
    167          
     189 
    168190        if ($user_level == 0) 
    169191            die ('Cheatin&#8217; uh?'); 
     
    180202            $excerpt = format_to_post($excerpt); 
    181203            $post_title = addslashes($HTTP_POST_VARS['post_title']); 
     204            if(get_settings('use_geo_positions')) { 
     205                $latf = floatval($HTTP_POST_VARS["post_latf"]); 
     206                    $lonf = floatval($HTTP_POST_VARS["post_lonf"]); 
     207                    $latlonaddition = ""; 
     208                    if( ($latf != null) && ($latf <= 90 ) && ($latf >= -90) && ($lonf != null) && ($lonf <= 360) && ($lonf >= -360) ) { 
     209                            pingGeoUrl($post_ID); 
     210                    $latlonaddition = " post_lat=".$latf.", post_lon =".$lonf.", "; 
     211                    } else { 
     212                    $latlonaddition = " post_lat=null, post_lon=null, "; 
     213                } 
     214            } 
    182215            $post_status = $HTTP_POST_VARS['post_status']; 
    183216            $prev_status = $HTTP_POST_VARS['prev_status']; 
     
    203236 
    204237        $result = $wpdb->query(" 
    205             UPDATE $tableposts SET  
    206                 post_content = '$content',  
    207                 post_excerpt = '$excerpt',  
    208                 post_title = '$post_title',  
    209                 post_category = '$post_category'".$datemodif.",  
    210                 post_status = '$post_status',  
    211                 comment_status = '$comment_status',  
    212                 ping_status = '$ping_status',  
    213                 post_password = '$post_password'  
    214             WHERE ID = $post_ID 
    215 "); 
     238            UPDATE $tableposts SET 
     239                post_content = '$content', 
     240                post_excerpt = '$excerpt', 
     241                post_title = '$post_title', 
     242                post_category = '$post_category'".$datemodif.", 
     243                ".$latlonaddition." 
     244                post_status = '$post_status', 
     245                comment_status = '$comment_status', 
     246                ping_status = '$ping_status', 
     247               post_password = '$post_password' 
     248           WHERE ID = $post_ID "); 
    216249 
    217250        if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 
     
    224257            pingCafelog($cafelogID, $post_title, $post_ID); 
    225258            pingBlogs($blog_ID); 
    226          
     259 
    227260            if ($post_pingback) { 
    228261                pingback($content, $post_ID); 
     
    258291        if ($user_level < $authordata->user_level) 
    259292            die ('You don&#8217;t have the right to delete <strong>'.$authordata[1].'</strong>&#8217;s posts.'); 
     293 
     294        // send geoURL ping to "erase" from their DB 
     295        $query = "SELECT post_lat from $tableposts WHERE ID=$post"; 
     296        $rows = $wpdb->query($query);  
     297        $myrow = $rows[0]; 
     298        $latf = $myrow->post_lat; 
     299        if($latf != null ) { 
     300            pingGeoUrl($post); 
     301        } 
    260302 
    261303        $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post"); 
     
    349391 
    350392        $result = $wpdb->query(" 
    351             UPDATE $tablecomments SET  
    352                 comment_content = '$content',  
    353                 comment_author = '$newcomment_author',  
    354                 comment_author_email = '$newcomment_author_email',  
    355                 comment_author_url = '$newcomment_author_url'".$datemodif."  
     393            UPDATE $tablecomments SET 
     394                comment_content = '$content', 
     395                comment_author = '$newcomment_author', 
     396                comment_author_email = '$newcomment_author_email', 
     397                comment_author_url = '$newcomment_author_url'".$datemodif." 
    356398            WHERE comment_ID = $comment_ID" 
    357399            ); 
  • trunk/wp-admin/optionhandler.php

    r223 r294  
    1616        case 1: // integer 
    1717        case 3: // string 
     18        case 8: // float 
    1819        case 6:  // range -- treat same as integer for now! 
    1920            if (($option_result->option_type == 1) || ($option_result->option_type == 1)) { 
  • trunk/wp-admin/upgrade-071-to-072.php

    r290 r294  
    4444 
    4545    case 0: 
     46    { 
    4647?> 
    4748<p>Welcome to WordPress. You're already part of the family so this should be familiar  
     
    7071  you&#8217;re all ready, <a href="<?php echo $thisfile;?>?step=1">let's go</a>! </p> 
    7172<?php 
    72     break; 
     73        break; 
     74    } 
    7375 
    7476    case 1: 
     77    { 
    7578?> 
    7679<h1>Step 1</h1> 
     
    202205<?php 
    203206} 
    204     break; 
    205     case 2: 
     207        break; 
     208    } // end case 1 
     209 
     210    case 2: 
     211    { 
    206212?> 
    207213<h1>Step 2</h1> 
     214<p>There are some changes we need to make to the post table, we'll do those next.</p> 
     215<?php 
     216$error_count = 0; 
     217$tablename = $tableposts; 
     218 
     219$ddl = "ALTER TABLE $tableposts ADD COLUMN post_lon float "; 
     220maybe_add_column($tablename, 'post_lon', $ddl); 
     221if (check_column($tablename, 'post_lon', 'float')) { 
     222    $res .= $tablename . ' - ok <br />'."\n"; 
     223} else { 
     224    $res .= 'There was a problem with ' . $tablename . '<br />'."\n"; 
     225    ++$error_count; 
     226} 
     227 
     228$ddl = "ALTER TABLE $tableposts ADD COLUMN post_lat float "; 
     229maybe_add_column($tablename, 'post_lat', $ddl); 
     230if (check_column($tablename, 'post_lat', 'float')) { 
     231    $res .= $tablename . ' - ok <br />'."\n"; 
     232} else { 
     233    $res .= 'There was a problem with ' . $tablename . '<br />'."\n"; 
     234    ++$error_count; 
     235} 
     236 
     237 
     238if ($error_count > 0) { 
     239    echo("<p>$res</p>"); 
     240?> 
     241<p>Hmmm... there was some kind of error. If you cannot figure out 
     242   see from the output above how to correct the problems please 
     243   visit our <a href="http://wordpress.org/support/">support 
     244   forums</a> and report your problem.</p> 
     245<?php 
     246} else { 
     247?> 
     248<p>OK, another step completed. Let's move on to <a href="<?php echo $thisfile;?>?step=3">step 3</a>.</p> 
     249<?php 
     250} 
     251        break; 
     252    } // end case 2 
     253     
     254    case 3: 
     255    { 
     256?> 
     257<h1>Step 3</h1> 
    208258<p>There are a few new database tables with this version, so lets get those out of  
    209259  the way.</p> 
     
    524574 
    525575?> 
     576<?php 
     577$geo_option_data = array( 
     578// data for geo settings 
     579"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)", 
     580"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)", 
     581"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)", 
     582"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)", 
     583 
     584"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')", 
     585 
     586"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)", 
     587"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)", 
     588"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)", 
     589"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)", 
     590); 
     591 
     592foreach ($geo_option_data as $query) { 
     593    $q = $wpdb->query($query); 
     594} 
     595?> 
     596 
     597<p>Geo option data inserted okay.</p> 
     598 
    526599 
    527600<p>Good, the option data was inserted okay.</p> 
     
    742815<?php 
    743816    } // end else no b2config 
    744     break; 
     817        break; 
     818    } // end case 3 
    745819} 
    746820?> 
  • trunk/wp-admin/wp-install-helper.php

    r280 r294  
    11<?php 
    22require_once('../wp-config.php'); 
     3$debug = 0; 
    34 
    45/** 
     
    3334 */ 
    3435function maybe_add_column($table_name, $column_name, $create_ddl) { 
    35     global $wpdb
     36    global $wpdb, $debug
    3637    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { 
     38        if ($debug) echo("checking $column == $column_name<br />"); 
    3739        if ($column == $column_name) { 
    3840            return true; 
     
    9193 */ 
    9294function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { 
    93     global $wpdb
     95    global $wpdb, $debug
    9496    $diffs = 0; 
    9597    $results = $wpdb->get_results("DESC $table_name"); 
    9698     
    9799    foreach ($results as $row ) { 
    98         //print_r($row); 
     100        if ($debug > 1) print_r($row); 
    99101        if ($row->Field == $col_name) { 
    100102            // got our column, check the params 
    101             //echo ("checking $row->Type against $col_type\n"); 
     103            if ($debug) echo ("checking $row->Type against $col_type\n"); 
    102104            if (($col_type != null) && ($row->Type != $col_type)) { 
    103105                ++$diffs; 
     
    116118            } 
    117119            if ($diffs > 0) { 
    118                 //echo ("diffs = $diffs returning false\n"); 
     120                if ($debug) echo ("diffs = $diffs returning false\n"); 
    119121                return false; 
    120122            } 
  • trunk/wp-admin/wp-install.php

    r290 r294  
    193193  post_category int(4) NOT NULL default '0', 
    194194  post_excerpt text NOT NULL, 
     195  post_lat float, 
     196  post_lon float, 
    195197  post_status enum('publish','draft','private') NOT NULL default 'publish', 
    196198  comment_status enum('open','closed') NOT NULL default 'open', 
     
    359361"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')", 
    360362"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')", 
     363"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')", 
     364 
    361365//base options from b2cofig 
    362366"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)", 
     
    619623<p>Links option data inserted okay.</p> 
    620624 
     625<?php 
     626$geo_option_data = array( 
     627// data for geo settings 
     628"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)", 
     629"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)", 
     630"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)", 
     631"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)", 
     632 
     633"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options',Settings which control the posting and display of Geo Options')", 
     634 
     635"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)", 
     636"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)", 
     637"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)", 
     638"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)", 
     639 
     640); 
     641 
     642foreach ($geo_option_data as $query) { 
     643    $q = $wpdb->query($query); 
     644} 
     645?> 
     646 
     647<p>Geo option data inserted okay.</p> 
     648 
     649 
    621650<p>OK. We're nearly done now. We just need to ask you a couple of things:</p> 
    622651<form action="wp-install.php?step=3" method="post">