Make WordPress Core


Ignore:
Timestamp:
08/05/2003 10:44:38 PM (23 years ago)
Author:
mikelittle
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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            );
Note: See TracChangeset for help on using the changeset viewer.