summaryrefslogtreecommitdiff
path: root/www/import.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-01-20 21:27:04 +0100
committerChristian Weiske <cweiske@cweiske.de>2012-01-20 21:27:04 +0100
commita9df65da0888233e66e35aa6fef3d5870db73d4f (patch)
treec9c1c11139135cd45562ef6cf9069fc2aa368c0f /www/import.php
parent22eaa812bfa27fe6d1662237c1908193f4637090 (diff)
downloadsemanticscuttle-a9df65da0888233e66e35aa6fef3d5870db73d4f.tar.gz
semanticscuttle-a9df65da0888233e66e35aa6fef3d5870db73d4f.tar.bz2
Fix bug #3468293: Delicious import does not preserve private links
Diffstat (limited to 'www/import.php')
-rw-r--r--www/import.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/www/import.php b/www/import.php
index 3aa2714..1293a2f 100644
--- a/www/import.php
+++ b/www/import.php
@@ -27,7 +27,9 @@ require_once 'www-header.php';
/* Managing all possible inputs */
// First input is $_FILES
// Other inputs
-isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', $GLOBALS['defaults']['privacy']);
+isset($_POST['status'])
+ ? define('POST_STATUS', $_POST['status'])
+ : define('POST_STATUS', $GLOBALS['defaults']['privacy']);
if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
@@ -54,6 +56,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
}
}
xml_parser_free($xml_parser);
+ //FIXME: show errors and warnings
header('Location: '. createURL('bookmarks', $userinfo->getUsername()));
} else {
$templatename = 'importDelicious.tpl';
@@ -70,7 +73,8 @@ function startElement($parser, $name, $attrs) {
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
if ($name == 'POST') {
- while(list($attrTitle, $attrVal) = each($attrs)) {
+ $newstatus = $status;
+ while (list($attrTitle, $attrVal) = each($attrs)) {
switch ($attrTitle) {
case 'HREF':
$bAddress = $attrVal;
@@ -87,6 +91,11 @@ function startElement($parser, $name, $attrs) {
case 'TAG':
$tags = strtolower($attrVal);
break;
+ case 'PRIVATE':
+ if ($attrVal == 'yes') {
+ $newstatus = 2;
+ }
+ break;
}
}
if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) {
@@ -100,12 +109,20 @@ function startElement($parser, $name, $attrs) {
$bDatetime = gmdate('Y-m-d H:i:s');
}
- if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, null, $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.');
+ $res = $bookmarkservice->addBookmark(
+ $bAddress, $bTitle, $bDescription, '', $newstatus, $tags,
+ null, $bDatetime, true, true
+ );
+ if ($res) {
+ $tplVars['msg'] = T_('Bookmark imported.');
+ } else {
+ $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
+ }
}
}
+ if (!isset($depth[$parser])) {
+ $depth[$parser] = 0;
+ }
$depth[$parser]++;
}