Make WordPress Core

Changeset 5099


Ignore:
Timestamp:
03/25/2007 11:06:28 PM (19 years ago)
Author:
ryan
Message:

Some int casts

Location:
branches/2.0
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-admin/admin-db.php

    r4365 r5099  
    111111    if (!$update) {
    112112        $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent')");
    113         $cat_ID = $wpdb->insert_id;
     113        $cat_ID = (int) $wpdb->insert_id;
    114114    } else {
    115115        $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'");
     
    208208        return 0;
    209209
    210     return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
     210    return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
    211211}
    212212
     
    270270    if ( !empty($link_id) )
    271271        $update = true;
     272
     273    $link_id = (int) $link_id;
    272274
    273275    if( trim( $link_name ) == '' )
     
    327329    } else {
    328330        $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
    329         $link_id = $wpdb->insert_id;
     331        $link_id = (int) $wpdb->insert_id;
    330332    }
    331333   
  • branches/2.0/wp-admin/edit-comments.php

    r4656 r5099  
    4545    foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
    4646        $comment = (int) $comment;
    47         $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
     47        $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
    4848        $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
    4949        if ( current_user_can('edit_post', $post_id) ) :
  • branches/2.0/wp-admin/import/dotclear.php

    r4239 r5099  
    431431               
    432432                // WordPressify Data
    433                 $comment_ID = ltrim($comment_id, '0');
    434                 $comment_post_ID = $postarr[$post_id];
     433                $comment_ID = (int) ltrim($comment_id, '0');
     434                $comment_post_ID = (int) $postarr[$post_id];
    435435                $comment_approved = "$comment_pub";
    436436                $name = $wpdb->escape(csc ($comment_auteur));
  • branches/2.0/wp-admin/import/livejournal.php

    r4239 r5099  
    8181           
    8282            if ( $comments ) {
    83                 $comment_post_ID = $post_id;
     83                $comment_post_ID = (int) $post_id;
    8484                $num_comments = 0;
    8585                foreach ($comments as $comment) {
  • branches/2.0/wp-admin/import/mt.php

    r4239 r5099  
    170170        }
    171171        $this->file = $file['file'];
    172         $this->id = $file['id'];
     172        $this->id = (int) $file['id'];
    173173
    174174        $this->get_entries();
     
    294294                }
    295295
    296                 $comment_post_ID = $post_id;
     296                $comment_post_ID = (int) $post_id;
    297297                $comment_approved = 1;
    298298
  • branches/2.0/wp-trackback.php

    r4677 r5099  
    8585    }
    8686
    87     $comment_post_ID = $tb_id;
     87    $comment_post_ID = (int) $tb_id;
    8888    $comment_author = $blog_name;
    8989    $comment_author_email = '';
  • branches/2.0/xmlrpc.php

    r5084 r5099  
    209209        $this->escape($args);
    210210
    211       $post_ID    = $args[1];
    212       $user_login = $args[2];
    213       $user_pass  = $args[3];
     211        $post_ID    = (int) $args[1];
     212        $user_login = $args[2];
     213        $user_pass  = $args[3];
    214214
    215215      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    244244        $this->escape($args);
    245245
    246       $blog_ID    = $args[1]; /* though we don't use it yet */
    247       $user_login = $args[2];
    248       $user_pass  = $args[3];
    249       $num_posts  = $args[4];
     246        $blog_ID    = (int) $args[1]; /* though we don't use it yet */
     247        $user_login = $args[2];
     248        $user_pass  = $args[3];
     249        $num_posts  = $args[4];
    250250
    251251      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    292292        $this->escape($args);
    293293
    294       $blog_ID    = $args[1];
     294      $blog_ID    = (int) $args[1];
    295295      $user_login = $args[2];
    296296      $user_pass  = $args[3];
     
    326326        $this->escape($args);
    327327
    328       $blog_ID    = $args[1];
     328      $blog_ID    = (int) $args[1];
    329329      $user_login = $args[2];
    330330      $user_pass  = $args[3];
     
    363363        $this->escape($args);
    364364
    365       $blog_ID    = $args[1]; /* though we don't use it yet */
     365      $blog_ID    = (int) $args[1]; /* though we don't use it yet */
    366366      $user_login = $args[2];
    367367      $user_pass  = $args[3];
     
    460460        $this->escape($args);
    461461
    462       $post_ID     = $args[1];
     462      $post_ID     = (int) $args[1];
    463463      $user_login  = $args[2];
    464464      $user_pass   = $args[3];
     
    501501        $this->escape($args);
    502502
    503       $blog_ID     = $args[0]; // we will support this in the near future
     503      $blog_ID     = (int) $args[0]; // we will support this in the near future
    504504      $user_login  = $args[1];
    505505      $user_pass   = $args[2];
     
    669669        $this->escape($args);
    670670
    671       $post_ID     = $args[0];
     671      $post_ID     = (int) $args[0];
    672672      $user_login  = $args[1];
    673673      $user_pass   = $args[2];
     
    724724        $this->escape($args);
    725725
    726       $blog_ID     = $args[0];
    727       $user_login  = $args[1];
    728       $user_pass   = $args[2];
    729       $num_posts   = $args[3];
     726        $blog_ID     = (int) $args[0];
     727        $user_login  = $args[1];
     728        $user_pass   = $args[2];
     729        $num_posts   = (int) $args[3];
    730730
    731731      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    790790        $this->escape($args);
    791791
    792       $blog_ID     = $args[0];
    793       $user_login  = $args[1];
    794       $user_pass   = $args[2];
     792        $blog_ID     = (int) $args[0];
     793        $user_login  = $args[1];
     794        $user_pass   = $args[2];
    795795
    796796      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    824824        global $wpdb;
    825825
    826         $blog_ID     = $wpdb->escape($args[0]);
     826        $blog_ID     = (int) $args[0];
    827827        $user_login  = $wpdb->escape($args[1]);
    828828        $user_pass   = $wpdb->escape($args[2]);
     
    864864        $this->escape($args);
    865865
    866       $blog_ID     = $args[0];
    867       $user_login  = $args[1];
    868       $user_pass   = $args[2];
    869       $num_posts   = $args[3];
     866        $blog_ID     = (int) $args[0];
     867        $user_login  = $args[1];
     868        $user_pass   = $args[2];
     869        $num_posts   = (int) $args[3];
    870870
    871871      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    909909        $this->escape($args);
    910910
    911       $blog_ID     = $args[0];
    912       $user_login  = $args[1];
    913       $user_pass   = $args[2];
     911        $blog_ID     = (int) $args[0];
     912        $user_login  = $args[1];
     913        $user_pass   = $args[2];
    914914
    915915      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    938938        $this->escape($args);
    939939
    940       $post_ID     = $args[0];
    941       $user_login  = $args[1];
    942       $user_pass   = $args[2];
     940        $post_ID     = (int) $args[0];
     941        $user_login  = $args[1];
     942        $user_pass   = $args[2];
    943943
    944944      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    968968        $this->escape($args);
    969969
    970       $post_ID     = $args[0];
    971       $user_login  = $args[1];
    972       $user_pass   = $args[2];
    973       $categories  = $args[3];
     970        $post_ID     = (int) $args[0];
     971        $user_login  = $args[1];
     972        $user_pass   = $args[2];
     973        $categories  = $args[3];
    974974
    975975      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    10511051        $this->escape($args);
    10521052
    1053       $post_ID     = $args[0];
    1054       $user_login  = $args[1];
    1055       $user_pass   = $args[2];
     1053        $post_ID     = (int) $args[0];
     1054        $user_login  = $args[1];
     1055        $user_pass   = $args[2];
    10561056
    10571057      if (!$this->login_pass_ok($user_login, $user_pass)) {
     
    11131113            // the path defines the post_ID (archives/p/XXXX)
    11141114            $blah = explode('/', $match[0]);
    1115             $post_ID = $blah[1];
     1115            $post_ID = (int) $blah[1];
    11161116            $way = 'from the path';
    11171117        } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
    11181118            // the querystring defines the post_ID (?p=XXXX)
    11191119            $blah = explode('=', $match[0]);
    1120             $post_ID = $blah[1];
     1120            $post_ID = (int) $blah[1];
    11211121            $way = 'from the querystring';
    11221122        } elseif (isset($urltest['fragment'])) {
     
    11241124            if (intval($urltest['fragment'])) {
    11251125                // ...an integer #XXXX (simpliest case)
    1126                 $post_ID = $urltest['fragment'];
     1126                $post_ID = (int) $urltest['fragment'];
    11271127                $way = 'from the fragment (numeric)';
    11281128            } elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
Note: See TracChangeset for help on using the changeset viewer.