2005-08-09 10:16:29 +02:00
|
|
|
<?php
|
|
|
|
require_once('../wp-config.php');
|
|
|
|
require_once('admin-functions.php');
|
2005-10-12 19:04:27 +02:00
|
|
|
require_once('admin-db.php');
|
2005-08-09 10:16:29 +02:00
|
|
|
|
|
|
|
get_currentuserinfo();
|
|
|
|
|
|
|
|
if ( !current_user_can('manage_categories') )
|
|
|
|
die('-1');
|
|
|
|
|
2005-08-30 02:57:34 +02:00
|
|
|
function get_out_now() { exit; }
|
|
|
|
|
|
|
|
add_action('shutdown', 'get_out_now', -1);
|
2005-08-09 10:16:29 +02:00
|
|
|
|
2005-08-30 02:57:34 +02:00
|
|
|
$cat_name = rawurldecode($_GET['ajaxnewcat']);
|
2005-08-09 10:16:29 +02:00
|
|
|
|
|
|
|
if ( !$category_nicename = sanitize_title($cat_name) )
|
|
|
|
die('0');
|
2005-09-10 20:44:05 +02:00
|
|
|
if ( $already = category_exists($cat_name) )
|
2005-09-02 19:17:36 +02:00
|
|
|
die((string) $already);
|
2005-08-09 10:16:29 +02:00
|
|
|
|
2005-09-10 20:44:05 +02:00
|
|
|
$new_cat_id = wp_create_category($cat_name);
|
2005-09-02 19:17:36 +02:00
|
|
|
die((string) $new_cat_id);
|
|
|
|
?>
|