aboutsummaryrefslogtreecommitdiff
path: root/services/bookmarkservice.php
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/bookmarkservice.php
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/bookmarkservice.php')
-rw-r--r--services/bookmarkservice.php27
1 files changed, 16 insertions, 11 deletions
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() .'`';