Minor fix: improve import from Netscape files (taking tags into account)

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@176 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
mensonge 2008-11-27 07:27:36 +00:00
parent df984f2666
commit 1958ddd8e1
5 changed files with 90 additions and 72 deletions

View file

@ -54,11 +54,22 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$size = count($links); $size = count($links);
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
$attributes = preg_split('/\s+/s', $links[$i]);
foreach ($attributes as $attribute) { // echo "<hr/>";
// echo $links[$i]."<br/>";
preg_match_all('/(\w*\s*=\s*"[^"]*")/', $links[$i], $attributes);
//$attributes = $attributes[0]; // we keep just one row
$bDatetime = ""; //bDateTime optional
$bCategories = ""; //bCategories optional
foreach ($attributes[0] as $attribute) {
$att = preg_split('/\s*=\s*/s', $attribute, 2); $att = preg_split('/\s*=\s*/s', $attribute, 2);
$attrTitle = $att[0]; $attrTitle = $att[0];
$attrVal = eregi_replace('"', '&quot;', preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1])); $attrVal = eregi_replace('"', '&quot;', preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1]));
switch ($attrTitle) { switch ($attrTitle) {
case "HREF": case "HREF":
$bAddress = $attrVal; $bAddress = $attrVal;
@ -66,6 +77,9 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
case "ADD_DATE": case "ADD_DATE":
$bDatetime = gmdate('Y-m-d H:i:s', $attrVal); $bDatetime = gmdate('Y-m-d H:i:s', $attrVal);
break; break;
case "TAGS":
$bCategories = $attrVal;
break;
} }
} }
$bTitle = eregi_replace('"', '&quot;', trim($titles[$i])); $bTitle = eregi_replace('"', '&quot;', trim($titles[$i]));
@ -81,7 +95,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si
$bDatetime = gmdate('Y-m-d H:i:s'); $bDatetime = gmdate('Y-m-d H:i:s');
} }
if ($bookmarkservice->addBookmark($bAddress, $bTitle, NULL, $status, NULL, $bDatetime, false, true)) { if ($bookmarkservice->addBookmark($bAddress, $bTitle, NULL, $status, $bCategories, $bDatetime, false, true)) {
$tplVars['msg'] = T_('Bookmark imported.'); $tplVars['msg'] = T_('Bookmark imported.');
} else { } else {
$tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');

View file

@ -462,9 +462,9 @@ class UserService {
list($emailUser, $emailDomain) = split("@", $email); list($emailUser, $emailDomain) = split("@", $email);
// Check if the email domain has a DNS record // Check if the email domain has a DNS record
if ($this->_checkdns($emailDomain)) { //if ($this->_checkdns($emailDomain)) {
return true; return true;
} //}
} }
return false; return false;
} }

View file

@ -10,6 +10,7 @@ $cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService');
$currentObjectUser = $userservice->getCurrentObjectUser(); $currentObjectUser = $userservice->getCurrentObjectUser();
$pageName = isset($pageName)?$pageName:""; $pageName = isset($pageName)?$pageName:"";
$user = isset($user)?$user:"";
$this->includeTemplate($GLOBALS['top_include']); $this->includeTemplate($GLOBALS['top_include']);

View file

@ -2,6 +2,9 @@
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService'); $userservice =& ServiceFactory::getServiceInstance('UserService');
if(!isset($user)) $user="";
$logged_on_userid = $userservice->getCurrentUserId(); $logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) { if ($logged_on_userid === false) {
$logged_on_userid = NULL; $logged_on_userid = NULL;

View file

@ -23,12 +23,12 @@ if(isset($rsschannels)) {
src="<?php echo ROOT ?>jsScuttle.php"></script> src="<?php echo ROOT ?>jsScuttle.php"></script>
<link rel="stylesheet" type="text/css" <!-- link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css"> href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css">
<script type="text/javascript" <script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js" src="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dojo/dojo.xd.js"
djConfig="parseOnLoad:true, isDebug:false, usePlainJson:true"></script> djConfig="parseOnLoad:true, isDebug:false, usePlainJson:true"></script> -->
<script type="text/javascript"> <script type="text/javascript">
dojo.require("dojo.parser"); dojo.require("dojo.parser");