From 04f357b4eb819e63d108d08c021b8f4268866cf4 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 25 Jul 2006 19:01:52 +0000 Subject: [PATCH] Admin AJAX tweaks from mdawaffe. fixes #2969 git-svn-id: http://svn.automattic.com/wordpress/trunk@4042 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 8 +------ wp-admin/list-manipulation-js.php | 36 ++++++++++++++++++++----------- wp-includes/script-loader.php | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 9c5ac65219..15b901d020 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -13,12 +13,6 @@ if ( !is_user_logged_in() ) function get_out_now() { exit; } add_action( 'shutdown', 'get_out_now', -1 ); -function wp_clean_ajax_input( $i ) { - global $wpdb; - $i = is_array($i) ? array_map('wp_clean_ajax_input', $i) : $wpdb->escape( rawurldecode(stripslashes($i)) ); - return $i; -} - function wp_ajax_echo_meta( $pid, $mid, $key, $value ) { $value = wp_specialchars($value, true); $key_js = addslashes(wp_specialchars($key, 'double')); @@ -35,7 +29,6 @@ function wp_ajax_echo_meta( $pid, $mid, $key, $value ) { return $r; } -$_POST = wp_clean_ajax_input( $_POST ); $id = (int) $_POST['id']; switch ( $_POST['action'] ) : case 'delete-comment' : @@ -224,6 +217,7 @@ case 'add-user' : die($r); break; default : + do_action( 'wp_ajax_' . $_POST['action'] ); die('0'); break; endswitch; diff --git a/wp-admin/list-manipulation-js.php b/wp-admin/list-manipulation-js.php index ef094676a0..b767a76df1 100644 --- a/wp-admin/list-manipulation-js.php +++ b/wp-admin/list-manipulation-js.php @@ -1,6 +1,7 @@ addLoadEvent(function(){theList=new listMan();}); function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="";if(confirm(message))return obj.ajaxDelete(what,id);else return false;} @@ -27,15 +28,15 @@ function WPAjax(file, responseEl){//class WPAjax extends sack } WPAjax.prototype=new sack; WPAjax.prototype.init=function(f,r){ this.encVar('cookie', document.cookie); - this.requestFile=f;this.getResponseElement(r);this.method='POST'; + this.requestFile=f?f:'';this.getResponseElement(r);this.method='POST'; this.onLoading=function(){this.myResponseElement.innerHTML="";}; this.onLoaded=function(){this.myResponseElement.innerHTML="";}; this.onInteractive=function(){this.myResponseElement.innerHTML="";}; } function listMan(theListId){ - this.theList=null; - this.ajaxRespEl=null; + this.theList=null;this.theListId=theListId; + this.ajaxRespEl=null;this.ajaxHandler=''; this.inputData='';this.clearInputs=new Array();this.showLink=1; this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1'; this.addComplete=null;this.delComplete=null;this.dimComplete=null; @@ -44,7 +45,7 @@ function listMan(theListId){ this.ajaxAdder=function(what,where,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300); - this.ajaxAdd=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); + this.ajaxAdd=new WPAjax(this.ajaxHandler,this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); if(this.ajaxAdd.failed)return true; this.grabInputs(where); var tempObj=this; @@ -53,7 +54,7 @@ function listMan(theListId){ var newItems=this.responseXML.getElementsByTagName(what); if(tempObj.topAdder)tempObj.recolorPos=0; if(newItems){for (c=0;cadd( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' ); if ( is_admin() ) { $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); - $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '3850' ); // Make changeset # the correct one + $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '4042' ); // Make changeset # the correct one $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '3684' ); $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' );