-<?
+<?php
/***************************************************************************
-Copyright (C) 2004 - 2006 Scuttle project
-http://sourceforge.net/projects/scuttle/
+Copyright (c) 2004 - 2006 Marcus Campbell
http://scuttle.org/
This program is free software; you can redistribute it and/or modify
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
-require_once('header.inc.php');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
+require_once 'header.inc.php';
+
+$sf = new ServiceFactory();
+$userservice =& $sf->getServiceInstance('UserService');
+$templateservice =& $sf->getServiceInstance('TemplateService');
+
$tplVars = array();
if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
$userinfo = $userservice->getCurrentUser();
if (isset($_POST['status']) && is_numeric($_POST['status'])) {
- $status = intval($_POST['status']);
- } else {
- $status = 2;
+ $status = intval($_POST['status']);
+ }
+ else {
+ $status = 2;
}
$depth = array();
}
xml_parser_free($xml_parser);
header('Location: '. createURL('bookmarks', $userinfo[$userservice->getFieldName('username')]));
-} else {
- $templatename = 'importDelicious.tpl';
- $tplVars['subtitle'] = T_('Import Bookmarks from del.icio.us');
- $tplVars['formaction'] = createURL('import');
- $templateservice->loadTemplate($templatename, $tplVars);
+}
+else {
+ $templatename = 'importDelicious.tpl';
+ $tplVars['subtitle'] = T_('Import Bookmarks from del.icio.us');
+ $tplVars['formaction'] = createURL('import');
+ $templateservice->loadTemplate($templatename, $tplVars);
}
function startElement($parser, $name, $attrs) {
global $depth, $status, $tplVars, $userservice;
- $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
- $userservice =& ServiceFactory::getServiceInstance('UserService');
+ $sf = new ServiceFactory();
+ $bookmarkservice =& $sf->getServiceInstance('BookmarkService');
+ $cacheservice =& $sf->getServiceInstance('CacheService');
if ($name == 'POST') {
while(list($attrTitle, $attrVal) = each($attrs)) {
case 'TIME':
$bDatetime = $attrVal;
break;
+ case 'PRIVATE':
+ $bStatus = (strcasecmp('yes', $attrVal) == 0) ? 2 : $status ;
+ break;
case 'TAG':
$tags = strtolower($attrVal);
break;
$bDatetime = gmdate('Y-m-d H:i:s');
}
- if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $tags, $bDatetime, true, true))
+ if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bStatus, $tags, $bDatetime, true, true))
$tplVars['msg'] = T_('Bookmark imported.');
else
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');