aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-27 10:13:29 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-27 10:13:29 +0000
commited4760018fe8a60ab89e4bab58fde04faa4ccd0e (patch)
treecd55f19f1be08def278488f5d661111359b38346 /services
parent1958ddd8e1e74ef00849c78782656c0ba2995f07 (diff)
downloadsemanticscuttle-ed4760018fe8a60ab89e4bab58fde04faa4ccd0e.tar.gz
semanticscuttle-ed4760018fe8a60ab89e4bab58fde04faa4ccd0e.tar.bz2
Minor fix: improve import from Netscape files (now takes description into account)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@177 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services')
-rw-r--r--services/bookmark2tagservice.php2
-rw-r--r--services/bookmarkservice.php27
2 files changed, 17 insertions, 12 deletions
diff --git a/services/bookmark2tagservice.php b/services/bookmark2tagservice.php
index 26a05c1..347df9c 100644
--- a/services/bookmark2tagservice.php
+++ b/services/bookmark2tagservice.php
@@ -42,7 +42,7 @@ class Bookmark2TagService {
}
//clean tags from strange characters
- $tags = str_replace(array('"', '\''), "_", $tags);
+ $tags = str_replace(array('"', '\'', '/'), "_", $tags);
$tags_count = is_array($tags)?count($tags):0;
diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php
index 4c3cbca..ee7e169 100644
--- a/services/bookmarkservice.php
+++ b/services/bookmarkservice.php
@@ -92,10 +92,7 @@ class BookmarkService {
return;
}
- // If address doesn't contain ":", add "http://" as the default protocol
- if (strpos($address, ':') === false) {
- $address = 'http://'. $address;
- }
+ $address = $this->normalize($address);
$crit = array ('bHash' => md5($address));
if (isset ($uid)) {
@@ -117,13 +114,7 @@ class BookmarkService {
$sId = $userservice->getCurrentUserId();
}
- // If bookmark address doesn't contain ":", add "http://" to the start as a default protocol
- if (strpos($address, ':') === false) {
- $address = 'http://'. $address;
- }
- if (substr($address, -1) == '/') {
- $address = substr($address, 0, count($address)-2);
- }
+ $address = $this->normalize($address);
// Get the client's IP address and the date; note that the date is in GMT.
if (getenv('HTTP_CLIENT_IP'))
@@ -462,6 +453,20 @@ class BookmarkService {
}
return $this->db->sql_fetchfield(0, 0) - 1;
}
+
+ function normalize($address) {
+ // If bookmark address doesn't contain ":", add "http://" to the start as a default protocol
+ if (strpos($address, ':') === false) {
+ $address = 'http://'. $address;
+ }
+
+ // Delete final /
+ if (substr($address, -1) == '/') {
+ $address = substr($address, 0, count($address)-2);
+ }
+
+ return $address;
+ }
function deleteAll() {
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';