Index: Sewar/WordPress/SVN/wp-admin/admin-functions.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/admin-functions.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/admin-functions.php	(working copy)
@@ -1953,4 +1953,20 @@
 		return array((int) ($width / $height * 96), 96);
 }
 
+function wp_reset_vars($vars) {
+	for ($i=0; $i<count($vars); $i += 1) {
+		$var = $vars[$i];
+		global $$var;
+
+		if (!isset($$var)) {
+			if (empty($_REQUEST["$var"])) {
+				$$var = '';
+			} else {
+				$$var = $_REQUEST["$var"];
+				unset($_REQUEST["$wpvar"]);
+			}
+		}
+	}
+}
+
 ?>
Index: Sewar/WordPress/SVN/wp-admin/admin.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/admin.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/admin.php	(working copy)
@@ -24,21 +24,7 @@
 $date_format = get_settings('date_format');
 $time_format = get_settings('time_format');
 
-$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-    $wpvar = $wpvarstoreset[$i];
-    if (!isset($$wpvar)) {
-        if (empty($_POST["$wpvar"])) {
-            if (empty($_GET["$wpvar"])) {
-                $$wpvar = '';
-            } else {
-                $$wpvar = $_GET["$wpvar"];
-            }
-        } else {
-            $$wpvar = $_POST["$wpvar"];
-        }
-    }
-}
+wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
 
 wp_enqueue_script( 'fat' );
 
Index: Sewar/WordPress/SVN/wp-admin/categories.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/categories.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/categories.php	(working copy)
@@ -4,21 +4,7 @@
 $title = __('Categories');
 $parent_file = 'edit.php';
 
-$wpvarstoreset = array('action','cat');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-    $wpvar = $wpvarstoreset[$i];
-    if (!isset($$wpvar)) {
-        if (empty($_POST["$wpvar"])) {
-            if (empty($_GET["$wpvar"])) {
-                $$wpvar = '';
-            } else {
-                $$wpvar = $_GET["$wpvar"];
-            }
-        } else {
-            $$wpvar = $_POST["$wpvar"];
-        }
-    }
-}
+wp_reset_vars(array('action', 'cat'));
 
 switch($action) {
 
Index: Sewar/WordPress/SVN/wp-admin/comment.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/comment.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/comment.php	(working copy)
@@ -3,22 +3,8 @@
 
 $parent_file = 'edit.php';
 $submenu_file = 'edit-comments.php';
-$wpvarstoreset = array('action');
 
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-			$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action'));
 
 if ( isset( $_POST['deletecomment'] ) )
 	$action = 'deletecomment';
Index: Sewar/WordPress/SVN/wp-admin/inline-uploading.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/inline-uploading.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/inline-uploading.php	(working copy)
@@ -7,23 +7,8 @@
 if (!current_user_can('upload_files'))
 	die(__('You do not have permission to upload files.'));
 
-$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment');
+wp_reset_vars(array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment'));
 
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-			$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
-
 $post = (int) $post;
 $images_width = 1;
 
Index: Sewar/WordPress/SVN/wp-admin/link-add.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/link-add.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/link-add.php	(working copy)
@@ -6,24 +6,10 @@
 $parent_file = 'link-manager.php';
 
 
-$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
+wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
                        'description', 'visible', 'target', 'category', 'link_id',
                        'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
-                       'notes', 'linkcheck[]');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-    $wpvar = $wpvarstoreset[$i];
-    if (!isset($$wpvar)) {
-        if (empty($_POST["$wpvar"])) {
-            if (empty($_GET["$wpvar"])) {
-                $$wpvar = '';
-            } else {
-                $$wpvar = $_GET["$wpvar"];
-            }
-        } else {
-            $$wpvar = $_POST["$wpvar"];
-        }
-    }
-}
+                       'notes', 'linkcheck[]'));
 
 wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
 if ( current_user_can( 'manage_categories' ) )
Index: Sewar/WordPress/SVN/wp-admin/link-manager.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/link-manager.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/link-manager.php	(working copy)
@@ -10,23 +10,8 @@
 $this_file = $parent_file = 'link-manager.php';
 wp_enqueue_script( 'listman' );
 
-$wpvarstoreset = array ('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]');
+wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 
-for ($i = 0; $i < count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset ($$wpvar)) {
-		if (empty ($_POST["$wpvar"])) {
-			if (empty ($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
-
 if (empty ($cat_id))
 	$cat_id = 'all';
 
Index: Sewar/WordPress/SVN/wp-admin/link.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/link.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/link.php	(working copy)
@@ -1,23 +1,8 @@
 <?php
 require_once ('admin.php');
 
-$wpvarstoreset = array ('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]');
+wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 
-for ($i = 0; $i < count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset ($$wpvar)) {
-		if (empty ($_POST["$wpvar"])) {
-			if (empty ($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
-
 if ('' != $_POST['deletebookmarks'])
 	$action = 'deletebookmarks';
 if ('' != $_POST['move'])
Index: Sewar/WordPress/SVN/wp-admin/moderation.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/moderation.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/moderation.php	(working copy)
@@ -5,21 +5,7 @@
 $parent_file = 'edit.php';
 wp_enqueue_script( 'admin-comments' );
 
-$wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));
 
 $comment = array();
 if (isset($_POST["comment"])) {
Index: Sewar/WordPress/SVN/wp-admin/options-head.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/options-head.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/options-head.php	(working copy)
@@ -1,22 +1,5 @@
-<?php
+<?php wp_reset_vars(array('action', 'standalone', 'option_group_id')); ?>
 
-$wpvarstoreset = array('action','standalone', 'option_group_id');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
-?>
-
 <br clear="all" />
 
 <?php if (isset($_GET['updated'])) : ?>
Index: Sewar/WordPress/SVN/wp-admin/options.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/options.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/options.php	(working copy)
@@ -5,21 +5,7 @@
 $this_file = 'options.php';
 $parent_file = 'options-general.php';
 
-$wpvarstoreset = array('action');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action'));
 
 if ( !current_user_can('manage_options') )
 	die ( __('Cheatin&#8217; uh?') );
Index: Sewar/WordPress/SVN/wp-admin/page.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/page.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/page.php	(working copy)
@@ -3,22 +3,8 @@
 
 $parent_file = 'edit.php';
 $submenu_file = 'edit-pages.php';
-$wpvarstoreset = array('action');
 
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-			$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action'));
 
 if (isset($_POST['deletepost'])) {
 $action = "delete";
Index: Sewar/WordPress/SVN/wp-admin/plugin-editor.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/plugin-editor.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/plugin-editor.php	(working copy)
@@ -4,21 +4,7 @@
 $title = __("Edit Plugins");
 $parent_file = 'plugins.php';
 
-$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
 
 $plugins = get_plugins();
 $plugin_files = array_keys($plugins);
Index: Sewar/WordPress/SVN/wp-admin/post.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/post.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/post.php	(working copy)
@@ -3,22 +3,8 @@
 
 $parent_file = 'edit.php';
 $submenu_file = 'edit.php';
-$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder' );
 
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-			$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
 
 if ( isset( $_POST['deletepost'] ) )
 	$action = 'delete';
Index: Sewar/WordPress/SVN/wp-admin/templates.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/templates.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/templates.php	(working copy)
@@ -3,21 +3,7 @@
 $title = __('Template &amp; File Editing');
 $parent_file = 	'edit.php';
 
-$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
 
 $recents = get_option('recently_edited');
 
Index: Sewar/WordPress/SVN/wp-admin/theme-editor.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/theme-editor.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/theme-editor.php	(working copy)
@@ -4,21 +4,7 @@
 $title = __("Edit Themes");
 $parent_file = 'themes.php';
 
-$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
 
 $themes = get_themes();
 
Index: Sewar/WordPress/SVN/wp-admin/user-edit.php
===================================================================
--- Sewar/WordPress/SVN/wp-admin/user-edit.php	(revision 3923)
+++ Sewar/WordPress/SVN/wp-admin/user-edit.php	(working copy)
@@ -8,21 +8,7 @@
 	$parent_file = 'profile.php';
 $submenu_file = 'users.php';
 
-$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-	$wpvar = $wpvarstoreset[$i];
-	if (!isset($$wpvar)) {
-		if (empty($_POST["$wpvar"])) {
-			if (empty($_GET["$wpvar"])) {
-				$$wpvar = '';
-			} else {
-				$$wpvar = $_GET["$wpvar"];
-			}
-		} else {
-			$$wpvar = $_POST["$wpvar"];
-		}
-	}
-}
+wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
 
 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
 
