From c5fd6018702a3450469f1f3e815105123b75af7d Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 9 Dec 2008 17:03:14 +0000 Subject: [PATCH] Bug fix: correct date problems and now use bModifed field instead of former bDatetime one (in bookmarks table) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@200 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/bookmarkservice.php | 20 ++++++++++---------- templates/bookmarks.tpl.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php index ee7e169..7eeed7c 100644 --- a/services/bookmarkservice.php +++ b/services/bookmarkservice.php @@ -66,9 +66,9 @@ class BookmarkService { function getBookmarkByHash($hash) { return $this->_getbookmark('bHash', $hash, true); } - + function countBookmarks($uId) { - + } function editAllowed($bookmark) { @@ -127,7 +127,7 @@ class BookmarkService { // Note that if date is NULL, then it's added with a date and time of now, and if it's present, // it's expected to be a string that's interpretable by strtotime(). - if (is_null($date)) + if (is_null($date) || $date == '') $time = time(); else $time = strtotime($date); @@ -222,7 +222,7 @@ class BookmarkService { // if that user is on the logged-in user's watchlist, get the public AND contacts-only // bookmarks; otherwise, just get the public bookmarks. // - if the $user is set and IS the logged-in user, then get all bookmarks. - + $userservice =& ServiceFactory::getServiceInstance('UserService'); $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); @@ -278,7 +278,7 @@ class BookmarkService { } $query_3 .= ' AND ('. $query_3_1 .') AND B.bStatus IN (0, 1)'; } - + $query_5 = ''; if($hash == null) { $query_5.= ' GROUP BY B.bHash'; @@ -286,7 +286,7 @@ class BookmarkService { switch($sortOrder) { case 'date_asc': - $query_5.= ' ORDER BY B.bDatetime ASC '; + $query_5.= ' ORDER BY B.bModified ASC '; break; case 'title_desc': $query_5.= ' ORDER BY B.bTitle DESC '; @@ -301,7 +301,7 @@ class BookmarkService { $query_5.= ' ORDER BY B.bAddress ASC '; break; default: - $query_5.= ' ORDER BY B.bDatetime DESC '; + $query_5.= ' ORDER BY B.bModified DESC '; } // Handle the parts of the query that depend on any tags that are present. @@ -453,18 +453,18 @@ 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; } diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index efec240..70e4c64 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -197,7 +197,7 @@ if(isset($currenttag) && $currenttag!= '') { echo '
'.shortenString($address).'
'; } - echo '
'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."
\n"; + echo '
'. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . $cats . $copy . $edit ."
\n"; echo '';