CoreFiles by mySites.guru
edit-form-ajax-cat.php37 lines, 715 bytes, from wordpress-2.0.zip
Raw History Compare with 1.5.2
md5
371f576925d8eac4e00536fe76cdbf44
sha1
0806bce4024d337576de116f5961377ef5759cf1
sha256
9d8a78d33000d6c70873183f40078cd052ed013f3caafa19dd75a54db66488b6
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');

get_currentuserinfo();

if ( !current_user_can('manage_categories') )
	die('-1');

function get_out_now() { exit; }

add_action('shutdown', 'get_out_now', -1);

$names = explode(',', rawurldecode($_GET['ajaxnewcat']) );
$ids   = array();

foreach ($names as $cat_name) {
	$cat_name = trim( $cat_name );
	
	if ( !$category_nicename = sanitize_title($cat_name) )
		continue;
	if ( $already = category_exists($cat_name) ) {
		$ids[] = (string) $already;
		continue;
	}
	
	$new_cat_id = wp_create_category($cat_name);
	
	$ids[] = (string) $new_cat_id;
}

$return = join(',', $ids);

die( (string) $return );

?>

The same content is in 3 releases, WordPress 2.0 to 2.0.1. See them all, or every version of this file.