X-Git-Url: https://projects.mako.cc/source/scuttle/blobdiff_plain/c7f63c8b9b12efd7b3c10b9f80cda06eaf32068f..b35c59521deae7405997a24cefd523d9e3592665:/bookmarks.php diff --git a/bookmarks.php b/bookmarks.php index 7dd1f40..cbedbfd 100644 --- a/bookmarks.php +++ b/bookmarks.php @@ -1,7 +1,6 @@ getServiceInstance('BookmarkService'); +$templateservice =& $sf->getServiceInstance('TemplateService'); +$userservice =& $sf->getServiceInstance('UserService'); +$cacheservice =& $sf->getServiceInstance('CacheService'); $tplVars = array(); @@ -34,6 +34,7 @@ if (isset($_GET['action']) && ($_GET['action'] == "add") && !$userservice->isLog exit(); } +# it would probably be better to not supress the errors here @list($url, $user, $cat) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; $loggedon = false; @@ -96,11 +97,13 @@ if ($loggedon && isset($_POST['submitted'])) { $templatename = 'editbookmark.tpl'; } else { $address = trim($_POST['address']); + // If the bookmark exists already, edit the original if ($bookmarkservice->bookmarkExists($address, $currentUserID)) { $bookmark =& $bookmarkservice->getBookmarkByAddress($address); header('Location: '. createURL('edit', $bookmark['bId'])); exit(); + // If it's new, save it } else { $title = trim($_POST['title']); @@ -113,11 +116,6 @@ if ($loggedon && isset($_POST['submitted'])) { $tplVars['msg'] = ''; } else { $tplVars['msg'] = T_('Bookmark saved'); - // Redirection option - if ($GLOBALS['useredir']) { - $address = $GLOBALS['url_redir'] . $address; - } - header('Location: '. $address); } } else { $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); @@ -151,11 +149,16 @@ if ($templatename == 'editbookmark.tpl') { ); $tplVars['tags'] = $_POST['tags']; } else { + if (isset($_GET['tags'])) { + $raw_tags = $_GET['tags']; + } else { + $raw_tags = NULL; + } $tplVars['row'] = array( 'bTitle' => stripslashes($_GET['title']), 'bAddress' => stripslashes($_GET['address']), 'bDescription' => stripslashes($_GET['description']), - 'tags' => ($_GET['tags'] ? explode(',', stripslashes($_GET['tags'])) : array()) + 'tags' => ($raw_tags ? explode(',', stripslashes($raw_tags)) : array()) ); } $title = T_('Add a Bookmark'); @@ -206,7 +209,7 @@ if ($templatename == 'editbookmark.tpl') { $tplVars['start'] = $start; $tplVars['bookmarkCount'] = $start + 1; - $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, $terms, getSortOrder()); + $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, '', getSortOrder()); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('bookmarks', '%s/%s'); @@ -225,4 +228,3 @@ if ($usecache && $endcache) { // Cache output if existing copy has expired $cacheservice->End($hash); } -?>