- Enforce minimum elapsed time on registration form
[scuttle] / api / tags_rename.php
1 <?php
2 // Implements the del.icio.us API request to rename a user's tag.
3
4 // del.icio.us behavior:
5 // - oddly, returns an entirely different result (<result></result>) than the other API calls.
6
7 // Force HTTP authentication first!
8 require_once 'httpauth.inc.php';
9 require_once '../header.inc.php';
10
11 $tagservice  =& ServiceFactory::getServiceInstance('TagService');
12 $userservice =& ServiceFactory::getServiceInstance('UserService');
13
14 // Get the tag info.
15 if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != ''))
16   $old = trim($_REQUEST['old']);
17 else
18   $old = NULL;
19
20 if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != ''))
21   $new = trim($_REQUEST['new']);
22 else
23   $new = NULL;
24
25 if (is_null($old) || is_null($new)) {
26   $renamed = FALSE;
27 }
28 else {
29   // Rename the tag.
30   $result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, TRUE);
31   $renamed = $result;
32 }
33
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>';

Benjamin Mako Hill || Want to submit a patch?