From 15b91c7e661d928d8b125ec9cfbda1702319c8b4 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 25 Nov 2008 15:57:29 +0000 Subject: 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 --- importNetscape.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'importNetscape.php') diff --git a/importNetscape.php b/importNetscape.php index 97f458f..f4cf653 100644 --- a/importNetscape.php +++ b/importNetscape.php @@ -20,16 +20,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ require_once('header.inc.php'); + +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); $templateservice =& ServiceFactory::getServiceInstance('TemplateService'); + + +/* Managing all possible inputs */ +// First input is $_FILES +// Other inputs +isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', ''); + + $tplVars = array(); if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) { - $userinfo = $userservice->getCurrentUser(); + $userinfo = $userservice->getCurrentObjectUser(); - if (isset($_POST['status']) && is_numeric($_POST['status'])) { - $status = intval($_POST['status']); + if (is_numeric(POST_STATUS)) { + $status = intval(POST_STATUS); } else { $status = 2; } @@ -79,7 +89,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si } } } - header('Location: '. createURL('bookmarks', $userinfo[$userservice->getFieldName('username')])); + header('Location: '. createURL('bookmarks', $userinfo->getUsername())); } else { $templatename = 'importNetscape.tpl'; $tplVars['subtitle'] = T_('Import Bookmarks from Browser File'); -- cgit v1.2.3