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
This commit is contained in:
mensonge 2008-12-09 17:03:14 +00:00
parent d6889066c0
commit c5fd601870
2 changed files with 11 additions and 11 deletions

View file

@ -66,9 +66,9 @@ class BookmarkService {
function getBookmarkByHash($hash) { function getBookmarkByHash($hash) {
return $this->_getbookmark('bHash', $hash, true); return $this->_getbookmark('bHash', $hash, true);
} }
function countBookmarks($uId) { function countBookmarks($uId) {
} }
function editAllowed($bookmark) { 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, // 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(). // it's expected to be a string that's interpretable by strtotime().
if (is_null($date)) if (is_null($date) || $date == '')
$time = time(); $time = time();
else else
$time = strtotime($date); $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 // if that user is on the logged-in user's watchlist, get the public AND contacts-only
// bookmarks; otherwise, just get the public bookmarks. // bookmarks; otherwise, just get the public bookmarks.
// - if the $user is set and IS the logged-in user, then get all bookmarks. // - if the $user is set and IS the logged-in user, then get all bookmarks.
$userservice =& ServiceFactory::getServiceInstance('UserService'); $userservice =& ServiceFactory::getServiceInstance('UserService');
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
@ -278,7 +278,7 @@ class BookmarkService {
} }
$query_3 .= ' AND ('. $query_3_1 .') AND B.bStatus IN (0, 1)'; $query_3 .= ' AND ('. $query_3_1 .') AND B.bStatus IN (0, 1)';
} }
$query_5 = ''; $query_5 = '';
if($hash == null) { if($hash == null) {
$query_5.= ' GROUP BY B.bHash'; $query_5.= ' GROUP BY B.bHash';
@ -286,7 +286,7 @@ class BookmarkService {
switch($sortOrder) { switch($sortOrder) {
case 'date_asc': case 'date_asc':
$query_5.= ' ORDER BY B.bDatetime ASC '; $query_5.= ' ORDER BY B.bModified ASC ';
break; break;
case 'title_desc': case 'title_desc':
$query_5.= ' ORDER BY B.bTitle DESC '; $query_5.= ' ORDER BY B.bTitle DESC ';
@ -301,7 +301,7 @@ class BookmarkService {
$query_5.= ' ORDER BY B.bAddress ASC '; $query_5.= ' ORDER BY B.bAddress ASC ';
break; break;
default: 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. // 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; return $this->db->sql_fetchfield(0, 0) - 1;
} }
function normalize($address) { function normalize($address) {
// If bookmark address doesn't contain ":", add "http://" to the start as a default protocol // If bookmark address doesn't contain ":", add "http://" to the start as a default protocol
if (strpos($address, ':') === false) { if (strpos($address, ':') === false) {
$address = 'http://'. $address; $address = 'http://'. $address;
} }
// Delete final / // Delete final /
if (substr($address, -1) == '/') { if (substr($address, -1) == '/') {
$address = substr($address, 0, count($address)-2); $address = substr($address, 0, count($address)-2);
} }
return $address; return $address;
} }

View file

@ -197,7 +197,7 @@ if(isset($currenttag) && $currenttag!= '') {
echo '<div class="address">'.shortenString($address).'</div>'; echo '<div class="address">'.shortenString($address).'</div>';
} }
echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n"; echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . $cats . $copy . $edit ."</div>\n";
echo '</div>'; echo '</div>';