2 // Implements the del.icio.us API request to rename a user's tag.
4 // del.icio.us behavior:
5 // - oddly, returns an entirely different result (<result></result>) than the other API calls.
7 // Force HTTP authentication first!
8 require_once 'httpauth.inc.php';
9 require_once '../header.inc.php';
11 $tagservice =& ServiceFactory::getServiceInstance('TagService');
12 $userservice =& ServiceFactory::getServiceInstance('UserService');
15 if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != ''))
16 $old = trim($_REQUEST['old']);
20 if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != ''))
21 $new = trim($_REQUEST['new']);
25 if (is_null($old) || is_null($new)) {
30 $result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, TRUE);
34 // Set up the XML file and output the result.
35 header('Content-Type: text/xml');
36 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
37 echo '<result>'. ($renamed ? 'done' : 'something went wrong') .'</result>';