diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-25 15:57:29 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-25 15:57:29 +0000 |
commit | 15b91c7e661d928d8b125ec9cfbda1702319c8b4 (patch) | |
tree | 092d474c05e414bb04a8c428b8ff6cb9ccab765d /tagdelete.php | |
parent | 9aafe7551eb5a73739709e72465031db7a1531b4 (diff) | |
download | semanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.gz semanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.bz2 |
Major refactoring: transform user into object, define parameters used into each file, ...
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@173 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tagdelete.php')
-rw-r--r-- | tagdelete.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tagdelete.php b/tagdelete.php index efdca16..8c4b1af 100644 --- a/tagdelete.php +++ b/tagdelete.php @@ -20,25 +20,36 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ require_once('header.inc.php'); + +/* Service creation: only useful services are created */ $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); $templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); $userservice = & ServiceFactory :: getServiceInstance('UserService'); -$logged_on_user = $userservice->getCurrentUser(); +/* Managing all possible inputs */ +isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); +isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', ''); +isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', ''); + +/* Managing current logged user */ +$currentUser = $userservice->getCurrentObjectUser(); +/* Managing path info */ list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); -if ($_POST['confirm']) { - if ($b2tservice->deleteTag($logged_on_user['uId'], $tag)) { + + +if (POST_CONFIRM) { + if ($b2tservice->deleteTag($currentUser->getId(), $tag)) { $tplVars['msg'] = T_('Tag deleted'); - header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')])); + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); } else { $tplVars['error'] = T_('Failed to delete the tag'); $templateservice->loadTemplate('error.500.tpl', $tplVars); exit(); } -} elseif ($_POST['cancel']) { - header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags)); +} elseif (POST_CANCEL) { + header('Location: '. POST_REFERRER); } $tplVars['subtitle'] = T_('Delete Tag') .': '. $tag; |