aboutsummaryrefslogtreecommitdiff
path: root/tag2tagedit.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-25 15:57:29 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-25 15:57:29 +0000
commit15b91c7e661d928d8b125ec9cfbda1702319c8b4 (patch)
tree092d474c05e414bb04a8c428b8ff6cb9ccab765d /tag2tagedit.php
parent9aafe7551eb5a73739709e72465031db7a1531b4 (diff)
downloadsemanticscuttle-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 'tag2tagedit.php')
-rw-r--r--tag2tagedit.php38
1 files changed, 20 insertions, 18 deletions
diff --git a/tag2tagedit.php b/tag2tagedit.php
index 6dd7b51..e75553f 100644
--- a/tag2tagedit.php
+++ b/tag2tagedit.php
@@ -20,12 +20,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
+/* Managing all possible inputs */
+isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', '');
+
+/* Managing current logged user */
$logged_on_user = $userservice->getCurrentUser();
+
//permissions
if($logged_on_user == null) {
$tplVars['error'] = T_('Permission denied.');
@@ -33,23 +40,18 @@ if($logged_on_user == null) {
exit();
}
-list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
-
-/*if ($_POST['confirm']) {
- $tag = $_POST['tag1'];
- $linkType = $_POST['linkType'];
- $newTag = $_POST['tag2'];
- if ($tag2tagservice->removeLinkedTags($_POST['tag1'], $_POST['tag2'], $linkType, $userservice->getCurrentUserId())) {
- $tplVars['msg'] = T_('Tag link deleted');
- header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
- } else {
- $tplVars['error'] = T_('Failed to delete the link');
- $templateservice->loadTemplate('error.500.tpl', $tplVars);
- exit();
- }
-} elseif ($_POST['cancel']) {
- header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags));
-}*/
+/* Managing path info */
+if(isset($_SERVER['PATH_INFO'])) {
+ $exploded = explode('/', $_SERVER['PATH_INFO']);
+ if(count($exploded) == 3) {
+ list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
+ } else {
+ list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
+ $tag2 = '';
+ }
+} else {
+ $url = $tag1 = $tag2 = '';
+}
$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
@@ -58,6 +60,6 @@ $tplVars['tag2'] = $tag2;
$tplVars['subtitle'] = T_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2;
$tplVars['formaddaction'] = createUrl('tag2tagadd');
$tplVars['formdeleteaction'] = createUrl('tag2tagdelete');
-$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+$tplVars['referrer'] = HTTP_REFERER;
$templateservice->loadTemplate('tag2tagedit.tpl', $tplVars);
?>