diff --git a/importNetscape.php b/importNetscape.php index f4cf653..5e70387 100644 --- a/importNetscape.php +++ b/importNetscape.php @@ -1,23 +1,23 @@ isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) { - $userinfo = $userservice->getCurrentObjectUser(); + $userinfo = $userservice->getCurrentObjectUser(); - if (is_numeric(POST_STATUS)) { - $status = intval(POST_STATUS); - } else { - $status = 2; - } + if (is_numeric(POST_STATUS)) { + $status = intval(POST_STATUS); + } else { + $status = 2; + } - // File handle - $html = file_get_contents($_FILES['userfile']['tmp_name']); - - // Create link array - preg_match_all('/([^<]*)/si', $html, $matches); - $links = $matches[1]; - $titles = $matches[2]; - - $size = count($links); - for ($i = 0; $i < $size; $i++) { - $attributes = preg_split('/\s+/s', $links[$i]); - foreach ($attributes as $attribute) { - $att = preg_split('/\s*=\s*/s', $attribute, 2); - $attrTitle = $att[0]; - $attrVal = eregi_replace('"', '"', preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1])); - switch ($attrTitle) { - case "HREF": - $bAddress = $attrVal; - break; - case "ADD_DATE": - $bDatetime = gmdate('Y-m-d H:i:s', $attrVal); - break; - } - } - $bTitle = eregi_replace('"', '"', trim($titles[$i])); + // File handle + $html = file_get_contents($_FILES['userfile']['tmp_name']); - if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) { - $tplVars['error'] = T_('You have already submitted this bookmark.'); - } else { - // If bookmark is local (like javascript: or place: in Firefox3), do nothing - if(substr($bAddress, 0, 7) == "http://") { + // Create link array + preg_match_all('/([^<]*)/si', $html, $matches); + $links = $matches[1]; + $titles = $matches[2]; - // If bookmark claims to be from the future, set it to be now instead - if (strtotime($bDatetime) > time()) { - $bDatetime = gmdate('Y-m-d H:i:s'); - } + $size = count($links); + for ($i = 0; $i < $size; $i++) { - if ($bookmarkservice->addBookmark($bAddress, $bTitle, NULL, $status, NULL, $bDatetime, false, true)) { - $tplVars['msg'] = T_('Bookmark imported.'); - } else { - $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); - } - } - } - } - header('Location: '. createURL('bookmarks', $userinfo->getUsername())); + // echo "
"; + // echo $links[$i]."
"; + + 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); + $attrTitle = $att[0]; + + $attrVal = eregi_replace('"', '"', preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1])); + + switch ($attrTitle) { + case "HREF": + $bAddress = $attrVal; + break; + case "ADD_DATE": + $bDatetime = gmdate('Y-m-d H:i:s', $attrVal); + break; + case "TAGS": + $bCategories = $attrVal; + break; + } + } + $bTitle = eregi_replace('"', '"', trim($titles[$i])); + + if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) { + $tplVars['error'] = T_('You have already submitted this bookmark.'); + } else { + // If bookmark is local (like javascript: or place: in Firefox3), do nothing + if(substr($bAddress, 0, 7) == "http://") { + + // If bookmark claims to be from the future, set it to be now instead + if (strtotime($bDatetime) > time()) { + $bDatetime = gmdate('Y-m-d H:i:s'); + } + + if ($bookmarkservice->addBookmark($bAddress, $bTitle, NULL, $status, $bCategories, $bDatetime, false, true)) { + $tplVars['msg'] = T_('Bookmark imported.'); + } else { + $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); + } + } + } + } + header('Location: '. createURL('bookmarks', $userinfo->getUsername())); } else { - $templatename = 'importNetscape.tpl'; - $tplVars['subtitle'] = T_('Import Bookmarks from Browser File'); - $tplVars['formaction'] = createURL('importNetscape'); - $templateservice->loadTemplate($templatename, $tplVars); + $templatename = 'importNetscape.tpl'; + $tplVars['subtitle'] = T_('Import Bookmarks from Browser File'); + $tplVars['formaction'] = createURL('importNetscape'); + $templateservice->loadTemplate($templatename, $tplVars); } ?> diff --git a/services/userservice.php b/services/userservice.php index 241934e..ad79d34 100644 --- a/services/userservice.php +++ b/services/userservice.php @@ -462,9 +462,9 @@ class UserService { list($emailUser, $emailDomain) = split("@", $email); // Check if the email domain has a DNS record - if ($this->_checkdns($emailDomain)) { + //if ($this->_checkdns($emailDomain)) { return true; - } + //} } return false; } diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index 7ab54ab..05d3e1b 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -10,6 +10,7 @@ $cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService'); $currentObjectUser = $userservice->getCurrentObjectUser(); $pageName = isset($pageName)?$pageName:""; +$user = isset($user)?$user:""; $this->includeTemplate($GLOBALS['top_include']); diff --git a/templates/sidebar.block.related.php b/templates/sidebar.block.related.php index 88d42d6..81336f9 100644 --- a/templates/sidebar.block.related.php +++ b/templates/sidebar.block.related.php @@ -2,6 +2,9 @@ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); +if(!isset($user)) $user=""; + + $logged_on_userid = $userservice->getCurrentUserId(); if ($logged_on_userid === false) { $logged_on_userid = NULL; diff --git a/templates/top.inc.php b/templates/top.inc.php index 2039db2..633e3f8 100644 --- a/templates/top.inc.php +++ b/templates/top.inc.php @@ -23,12 +23,12 @@ if(isset($rsschannels)) { src="jsScuttle.php"> - + djConfig="parseOnLoad:true, isDebug:false, usePlainJson:true"> -->