summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
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() .'`';