[wp-cvs] wordpress/wp-admin admin-functions.php, 1.31, 1.32 link-categories.php, 1.11, 1.12 link-manager.php, 1.28, 1.29 menu.php, 1.18, 1.19 options.php, 1.26, 1.27 profile.php, 1.25, 1.26 upgrade-functions.php, 1.61, 1.62 users.php, 1.29, 1.30

Ryan Boren rboren at users.sourceforge.net
Fri Jun 18 00:22:11 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19297/wp-admin

Modified Files:
	admin-functions.php link-categories.php link-manager.php 
	menu.php options.php profile.php upgrade-functions.php 
	users.php 
Log Message:
stripslashes() elimination. Remove extra slashes during upgrade.  Bugs 0000059 and 0000018

Index: options.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** options.php	15 Jun 2004 23:24:35 -0000	1.26
--- options.php	18 Jun 2004 00:22:08 -0000	1.27
***************
*** 76,80 ****
              // should we even bother checking?
              if ($user_level >= $option->option_admin_level) {
!                 $old_val = stripslashes($option->option_value);
                  $new_val = $_POST[$option->option_name];
  				if (!$new_val) {
--- 76,80 ----
              // should we even bother checking?
              if ($user_level >= $option->option_admin_level) {
!                 $old_val = $option->option_value;
                  $new_val = $_POST[$option->option_name];
  				if (!$new_val) {

Index: admin-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-functions.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** admin-functions.php	16 Jun 2004 16:40:40 -0000	1.31
--- admin-functions.php	18 Jun 2004 00:22:03 -0000	1.32
***************
*** 81,85 ****
     $result[$cat]['cat_ID'] = $cat;
     $result[$cat]['checked'] = in_array($cat, $checked_categories);
!    $result[$cat]['cat_name'] = stripslashes(get_the_category_by_ID($cat));
   }
  
--- 81,85 ----
     $result[$cat]['cat_ID'] = $cat;
     $result[$cat]['checked'] = in_array($cat, $checked_categories);
!    $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
   }
  

Index: upgrade-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/upgrade-functions.php,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** upgrade-functions.php	15 Jun 2004 23:24:35 -0000	1.61
--- upgrade-functions.php	18 Jun 2004 00:22:08 -0000	1.62
***************
*** 91,94 ****
--- 91,111 ----
  }
  
+ function deslash($content) {
+     // Note: \\\ inside a regex denotes a single backslash.
+ 
+     // Replace one or more backslashes followed by a single quote with
+     // a single quote.
+     $content = preg_replace("/\\\+'/", "'", $content);
+ 
+     // Replace one or more backslashes followed by a double quote with
+     // a double quote.
+     $content = preg_replace('/\\\+"/', '"', $content);
+ 
+     // Replace one or more backslashes with one backslash.
+     $content = preg_replace("/\\\+/", "\\", $content);
+ 
+     return $content;
+ }
+ 
  // .71 stuff
  
***************
*** 872,875 ****
--- 889,913 ----
  		$wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
  	endforeach;
+ 
+     // Remove extraneous backslashes.
+ 	$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt FROM $wpdb->posts");
+ 	if ($posts) {
+ 		foreach($posts as $post) {
+             $post_content = addslashes(deslash($post->post_content));
+             $post_title = addslashes(deslash($post->post_title));
+             $post_excerpt = addslashes(deslash($post->post_excerpt));
+             $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt' WHERE ID = '$post->ID'");
+ 		}
+ 	}
+ 
+     // Remove extraneous backslashes.
+ 	$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
+ 	if ($comments) {
+ 		foreach($comments as $comment) {
+             $comment_content = addslashes(deslash($comment->comment_content));
+             $comment_author = addslashes(deslash($comment->comment_author));
+             $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
+ 		}
+ 	}
  }
  

Index: link-manager.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/link-manager.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** link-manager.php	11 Jun 2004 22:53:52 -0000	1.28
--- link-manager.php	18 Jun 2004 00:22:08 -0000	1.29
***************
*** 313,326 ****
  
      if ($row) {
!       $link_url = stripslashes($row->link_url);
!       $link_name = stripslashes($row->link_name);
        $link_image = $row->link_image;
        $link_target = $row->link_target;
        $link_category = $row->link_category;
!       $link_description = stripslashes($row->link_description);
        $link_visible = $row->link_visible;
        $link_rating = $row->link_rating;
!       $link_rel = stripslashes($row->link_rel);
!       $link_notes = stripslashes($row->link_notes);
  	  $link_rss_uri = $row->link_rss;
      }
--- 313,326 ----
  
      if ($row) {
!       $link_url = $row->link_url;
!       $link_name = $row->link_name;
        $link_image = $row->link_image;
        $link_target = $row->link_target;
        $link_category = $row->link_category;
!       $link_description = $row->link_description;
        $link_visible = $row->link_visible;
        $link_rating = $row->link_rating;
!       $link_rel = $row->link_rel;
!       $link_notes = $row->link_notes;
  	  $link_rss_uri = $row->link_rss;
      }
***************
*** 691,695 ****
      if ($links) {
          foreach ($links as $link) {
!             $short_url = str_replace('http://', '', stripslashes($link->link_url));
              $short_url = str_replace('www.', '', $short_url);
              if ('/' == substr($short_url, -1))
--- 691,695 ----
      if ($links) {
          foreach ($links as $link) {
!             $short_url = str_replace('http://', '', $link->link_url);
              $short_url = str_replace('www.', '', $short_url);
              if ('/' == substr($short_url, -1))
***************
*** 698,705 ****
                  $short_url =  substr($short_url, 0, 32).'...';
  
-             $link->link_name = stripslashes($link->link_name);
-             $link->category = stripslashes($link->category);
-             $link->link_rel = stripslashes($link->link_rel);
-             $link->link_description = stripslashes($link->link_description);
              $image = ($link->link_image != null) ? __('Yes') : __('No');
              $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
--- 698,701 ----

Index: menu.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/menu.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** menu.php	15 Jun 2004 23:24:35 -0000	1.18
--- menu.php	18 Jun 2004 00:22:08 -0000	1.19
***************
*** 41,44 ****
      <li><a href="<?php echo get_settings('home') . '/' . get_settings('blogfilename'); ?>" title="<?php _e('View your site') ?>"><?php _e('View site') ?> &raquo;</a></li>
  	<li class="last"><a href="<?php echo get_settings('siteurl')
! 	 ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), stripslashes($user_nickname)) ?></a></li>
  </ul>
--- 41,44 ----
      <li><a href="<?php echo get_settings('home') . '/' . get_settings('blogfilename'); ?>" title="<?php _e('View your site') ?>"><?php _e('View site') ?> &raquo;</a></li>
  	<li class="last"><a href="<?php echo get_settings('siteurl')
! 	 ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), $user_nickname) ?></a></li>
  </ul>

Index: profile.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/profile.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** profile.php	14 Jun 2004 14:58:09 -0000	1.25
--- profile.php	18 Jun 2004 00:22:08 -0000	1.26
***************
*** 84,100 ****
  	}
  
! 	$newuser_firstname=addslashes(stripslashes($_POST['newuser_firstname']));
! 	$newuser_lastname=addslashes(stripslashes($_POST['newuser_lastname']));
! 	$newuser_nickname=addslashes(stripslashes($_POST['newuser_nickname']));
      $newuser_nicename=sanitize_title($newuser_nickname);
! 	$newuser_icq=addslashes(stripslashes($_POST['newuser_icq']));
! 	$newuser_aim=addslashes(stripslashes($_POST['newuser_aim']));
! 	$newuser_msn=addslashes(stripslashes($_POST['newuser_msn']));
! 	$newuser_yim=addslashes(stripslashes($_POST['newuser_yim']));
! 	$newuser_email=addslashes(stripslashes($_POST['newuser_email']));
! 	$newuser_url=addslashes(stripslashes($_POST['newuser_url']));
  	$newuser_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $newuser_url) ? $newuser_url : 'http://' . $newuser_url; 
! 	$newuser_idmode=addslashes(stripslashes($_POST['newuser_idmode']));
! 	$user_description = addslashes(stripslashes($_POST['user_description']));
  
  	$query = "UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID";
--- 84,100 ----
  	}
  
! 	$newuser_firstname=$_POST['newuser_firstname'];
! 	$newuser_lastname=$_POST['newuser_lastname'];
! 	$newuser_nickname=$_POST['newuser_nickname'];
      $newuser_nicename=sanitize_title($newuser_nickname);
! 	$newuser_icq=$_POST['newuser_icq'];
! 	$newuser_aim=$_POST['newuser_aim'];
! 	$newuser_msn=$_POST['newuser_msn'];
! 	$newuser_yim=$_POST['newuser_yim'];
! 	$newuser_email=$_POST['newuser_email'];
! 	$newuser_url=$_POST['newuser_url'];
  	$newuser_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $newuser_url) ? $newuser_url : 'http://' . $newuser_url; 
! 	$newuser_idmode=$_POST['newuser_idmode'];
! 	$user_description = $_POST['user_description'];
  
  	$query = "UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID";

Index: users.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/users.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** users.php	14 Jun 2004 14:58:10 -0000	1.29
--- users.php	18 Jun 2004 00:22:09 -0000	1.30
***************
*** 71,81 ****
  	}
  
- 	$user_login = addslashes(stripslashes($user_login));
- 	$pass1 = addslashes(stripslashes($pass1));
- 	$user_nickname = addslashes(stripslashes($user_nickname));
      $user_nicename = sanitize_title($user_nickname);
- 	$user_firstname = addslashes(stripslashes($user_firstname));
- 	$user_lastname = addslashes(stripslashes($user_lastname));
- 	$user_uri = addslashes(stripslashes($user_uri));
  	$user_uri = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $user_uri) ? $user_uri : 'http://' . $user_uri;
  	$now = gmdate('Y-m-d H:i:s');
--- 71,75 ----
***************
*** 96,99 ****
--- 90,94 ----
  	}
  
+     $user_login = stripslashes($user_login);
  	$message  = 'New user registration on your blog ' . get_settings('blogname') . ":\r\n\r\n";
  	$message .= "Login: $user_login\r\n\r\nE-mail: $user_email";
***************
*** 205,209 ****
  		$email = $user_data->user_email;
  		$url = $user_data->user_url;
! 		$short_url = str_replace('http://', '', stripslashes($url));
  		$short_url = str_replace('www.', '', $short_url);
  		if ('/' == substr($short_url, -1))
--- 200,204 ----
  		$email = $user_data->user_email;
  		$url = $user_data->user_url;
! 		$short_url = str_replace('http://', '', $url);
  		$short_url = str_replace('www.', '', $short_url);
  		if ('/' == substr($short_url, -1))
***************
*** 256,260 ****
  		$email = $user_data->user_email;
  		$url = $user_data->user_url;
! 		$short_url = str_replace('http://', '', stripslashes($url));
  		$short_url = str_replace('www.', '', $short_url);
  		if ('/' == substr($short_url, -1))
--- 251,255 ----
  		$email = $user_data->user_email;
  		$url = $user_data->user_url;
! 		$short_url = str_replace('http://', '', $url);
  		$short_url = str_replace('www.', '', $short_url);
  		if ('/' == substr($short_url, -1))

Index: link-categories.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/link-categories.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** link-categories.php	15 Jun 2004 23:24:35 -0000	1.11
--- link-categories.php	18 Jun 2004 00:22:08 -0000	1.12
***************
*** 88,92 ****
      $cat_id = $_GET['cat_id'];
      $cat_name=get_linkcatname($cat_id);
-     $cat_name=addslashes($cat_name);
  
      if ($cat_id=="1")
--- 88,91 ----
***************
*** 133,137 ****
  <tr>
  	<th width="33%" scope="row"><?php _e('Name:') ?></th>
! 	<td width="67%"><input name="cat_name" type="text" value="<?php echo stripslashes($row->cat_name)?>" size="30" /></td>
  </tr>
  <tr>
--- 132,136 ----
  <tr>
  	<th width="33%" scope="row"><?php _e('Name:') ?></th>
! 	<td width="67%"><input name="cat_name" type="text" value="<?php echo $row->cat_name?>" size="30" /></td>
  </tr>
  <tr>
***************
*** 191,203 ****
  <tr>
  	<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
! 	<td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo htmlspecialchars(stripslashes($row->text_before_link))?>" /></td>
  </tr>
  <tr>
  <th scope="row"><?php _e('Between Link and Description:') ?></th>
! <td><input type="text" name="text_after_link" size="45" value="<?php echo htmlspecialchars(stripslashes($row->text_after_link))?>" /></td>
  </tr>
  <tr>
  <th scope="row"><?php _e('After Link:') ?></th>
! <td><input type="text" name="text_after_all" size="45" value="<?php echo htmlspecialchars(stripslashes($row->text_after_all))?>"/></td>
  </tr>
  </table>
--- 190,202 ----
  <tr>
  	<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
! 	<td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo htmlspecialchars($row->text_before_link)?>" /></td>
  </tr>
  <tr>
  <th scope="row"><?php _e('Between Link and Description:') ?></th>
! <td><input type="text" name="text_after_link" size="45" value="<?php echo htmlspecialchars($row->text_after_link)?>" /></td>
  </tr>
  <tr>
  <th scope="row"><?php _e('After Link:') ?></th>
! <td><input type="text" name="text_after_all" size="45" value="<?php echo htmlspecialchars($row->text_after_all)?>"/></td>
  </tr>
  </table>
***************
*** 224,228 ****
      $cat_id=$_POST["cat_id"];
  
!     $cat_name=addslashes(stripslashes($_POST["cat_name"]));
      $auto_toggle = $_POST["auto_toggle"];
      if ($auto_toggle != 'Y') {
--- 223,227 ----
      $cat_id=$_POST["cat_id"];
  
!     $cat_name= $_POST["cat_name"];
      $auto_toggle = $_POST["auto_toggle"];
      if ($auto_toggle != 'Y') {
***************
*** 334,338 ****
  ?>
                <tr valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
!                 <td><?php echo stripslashes($row->cat_name)?></td>
  				<td ><?php echo $row->cat_id?></td>
                  <td><?php echo $row->auto_toggle?></td>
--- 333,337 ----
  ?>
                <tr valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
!                 <td><?php echo $row->cat_name?></td>
  				<td ><?php echo $row->cat_id?></td>
                  <td><?php echo $row->auto_toggle?></td>




More information about the cvs mailing list