From 5a8327be1dc3cba69296dbf82c6b2320cc3a0e2f Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 19 Nov 2010 06:51:01 +0100 Subject: Fix bug #3111254: Search in my_watchlist results in error --- doc/ChangeLog | 1 + src/SemanticScuttle/Service/User.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 0a60bff..60401d4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -6,6 +6,7 @@ ChangeLog for SemantiScuttle - Fix bug in getTagsForBookmarks() that fetched all tags - Fix bug #3073215: Updating bookmark time does not work - Fix bug #3074816: French translation breaks edit javascript +- Fix bug #3111254: Search in my_watchlist results in error - Show error message on mysqli connection errors - Implement patch #3059829: update FR_CA translation - Update php-gettext library to 1.0.10 diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php index 6fc3bb7..091ea4d 100644 --- a/src/SemanticScuttle/Service/User.php +++ b/src/SemanticScuttle/Service/User.php @@ -356,7 +356,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService public function getCurrentUserId() { if (isset($_SESSION[$this->getSessionKey()])) { - return $_SESSION[$this->getSessionKey()]; + return (int)$_SESSION[$this->getSessionKey()]; } else if (isset($_COOKIE[$this->getCookieKey()])) { $cook = split(':', $_COOKIE[$this->getCookieKey()]); @@ -377,10 +377,10 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService if ($row = $this->db->sql_fetchrow($dbresult)) { $this->setCurrentUserId( - $row[$this->getFieldName('primary')] + (int)$row[$this->getFieldName('primary')] ); $this->db->sql_freeresult($dbresult); - return $_SESSION[$this->getSessionKey()]; + return (int)$_SESSION[$this->getSessionKey()]; } } return false; -- cgit v1.2.3 From 2c4bf8dacff87a1918c4f34d97bbdaff0a6b3f07 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 2 Feb 2011 23:08:43 +0100 Subject: make unittests run with phpunit 3.5.x --- tests/AllTests.php | 3 --- tests/TestBase.php | 4 ---- tests/TestBaseApi.php | 4 ---- 3 files changed, 11 deletions(-) diff --git a/tests/AllTests.php b/tests/AllTests.php index ded6824..4afcc6b 100644 --- a/tests/AllTests.php +++ b/tests/AllTests.php @@ -17,9 +17,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) { } require_once 'prepare.php'; -require_once 'PHPUnit/Framework/TestSuite.php'; - -PHPUnit_Util_Filter::addFileToFilter(__FILE__); /** * SemanticScuttle unit tests. diff --git a/tests/TestBase.php b/tests/TestBase.php index 402330b..8c1a934 100644 --- a/tests/TestBase.php +++ b/tests/TestBase.php @@ -11,10 +11,6 @@ * @link http://sourceforge.net/projects/semanticscuttle */ -require_once 'PHPUnit/Framework.php'; - -PHPUnit_Util_Filter::addFileToFilter(__FILE__); - /** * Base unittest class that provides several helper methods. * diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php index eb1457f..dacdecd 100644 --- a/tests/TestBaseApi.php +++ b/tests/TestBaseApi.php @@ -11,10 +11,6 @@ * @link http://sourceforge.net/projects/semanticscuttle */ -require_once 'PHPUnit/Framework.php'; - -PHPUnit_Util_Filter::addFileToFilter(__FILE__); - /** * Base unittest class for web API tests. * -- cgit v1.2.3 From 966fdf808ce9050fdbe28c86348b88117031675b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 9 Feb 2011 07:15:56 +0100 Subject: rename $range to $status as it is used in all other methods; add privacy to the parameter description so we find it again next time --- src/SemanticScuttle/Service/Bookmark.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 4e18d3f..6f8a172 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -253,18 +253,18 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService /** * Counts bookmarks for a user. * - * @param integer $uId User ID - * @param string $range Range of bookmarks: - * 'public', 'shared', 'private' - * or 'all' + * @param integer $uId User ID + * @param string $status Bookmark visibility/privacy settings: + * 'public', 'shared', 'private' + * or 'all' * * @return integer Number of bookmarks */ - public function countBookmarks($uId, $range = 'public') + public function countBookmarks($uId, $status = 'public') { $sql = 'SELECT COUNT(*) as "0" FROM '. $this->getTableName(); $sql.= ' WHERE uId = ' . intval($uId); - switch ($range) { + switch ($status) { case 'all': //no constraints break; @@ -439,7 +439,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService * @param string $title Bookmark title * @param string $description Long bookmark description * @param string $privateNote Private note for the user. - * @param string $status Bookmark visibility: + * @param string $status Bookmark visibility / privacy settings: * 0 - public * 1 - shared * 2 - private @@ -554,7 +554,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService * @param string $title Bookmark title * @param string $description Long bookmark description * @param string $privateNote Private note for the user. - * @param string $status Bookmark visibility: + * @param string $status Bookmark visibility / privacy setting: * 0 - public * 1 - shared * 2 - private -- cgit v1.2.3 From 6d752be4de3f08840d4453dfcfefd469fb79d45a Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Feb 2011 17:53:31 +0100 Subject: documentation todo --- doc/developers/doc-TODO | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/developers/doc-TODO diff --git a/doc/developers/doc-TODO b/doc/developers/doc-TODO new file mode 100644 index 0000000..69f6907 --- /dev/null +++ b/doc/developers/doc-TODO @@ -0,0 +1,4 @@ +- Which fields are searched? + title, description, private note, username, tags + +- What are [isbn] and so for? -- cgit v1.2.3 From a46146d01605624e8d8f040699f7c70f92c04773 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Feb 2011 18:13:59 +0100 Subject: Fix bug #3178597: Broken link to context in gsearch admin index page --- doc/ChangeLog | 5 +++++ www/gsearch/index.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 60401d4..ee74bc9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -13,6 +13,11 @@ ChangeLog for SemantiScuttle - api/posts/add respects the "replace" parameter now +0.97.2 - 2011-02-XX +------------------- +- Fix bug #3178597: Broken link to context in gsearch admin index page + + 0.97.1 - 2010-09-30 ------------------- This is a security release! We do highly recommend to update diff --git a/www/gsearch/index.php b/www/gsearch/index.php index 585536a..70be05e 100644 --- a/www/gsearch/index.php +++ b/www/gsearch/index.php @@ -31,7 +31,9 @@ if($GLOBALS['enableGoogleCustomSearch']==false) { echo '

'; echo T_('Admin tips: '); echo T_('To refresh manually Google Custom Search Engine, goes to: '); - echo 'http://www.google.com/coop/cse/cref
'; + echo 'http://www.google.com/coop/cse/cref' + . '
'; echo T_('If no result appears, check that all the urls are valid in the admin section.'); echo '

'; -- cgit v1.2.3 From 96f7172de0123a92cd635f6d8c38d267b73749c7 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 15 Feb 2011 07:56:20 +0100 Subject: move changes into 0.97.2 where I merged them --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index ee74bc9..2fa0f20 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -5,8 +5,6 @@ ChangeLog for SemantiScuttle ------------------- - Fix bug in getTagsForBookmarks() that fetched all tags - Fix bug #3073215: Updating bookmark time does not work -- Fix bug #3074816: French translation breaks edit javascript -- Fix bug #3111254: Search in my_watchlist results in error - Show error message on mysqli connection errors - Implement patch #3059829: update FR_CA translation - Update php-gettext library to 1.0.10 @@ -16,6 +14,8 @@ ChangeLog for SemantiScuttle 0.97.2 - 2011-02-XX ------------------- - Fix bug #3178597: Broken link to context in gsearch admin index page +- Fix bug #3074816: French translation breaks edit javascript +- Fix bug #3111254: Search in my_watchlist results in error 0.97.1 - 2010-09-30 -- cgit v1.2.3 From 4b6e2ea2bcddea9bfc28a7a2951002dbd70dfed1 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 15 Feb 2011 08:00:00 +0100 Subject: another merged bugfix --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2fa0f20..b205f2f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -4,7 +4,6 @@ ChangeLog for SemantiScuttle 0.9X.X - 2010-XX-XX ------------------- - Fix bug in getTagsForBookmarks() that fetched all tags -- Fix bug #3073215: Updating bookmark time does not work - Show error message on mysqli connection errors - Implement patch #3059829: update FR_CA translation - Update php-gettext library to 1.0.10 @@ -16,6 +15,7 @@ ChangeLog for SemantiScuttle - Fix bug #3178597: Broken link to context in gsearch admin index page - Fix bug #3074816: French translation breaks edit javascript - Fix bug #3111254: Search in my_watchlist results in error +- Fix bug #3073215: Updating bookmark time does not work 0.97.1 - 2010-09-30 -- cgit v1.2.3 From 525b509bd29090634ba45f8272e88ff0eadedc25 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 16 Feb 2011 00:42:45 +0100 Subject: remove svntag task from build file; we do not have svn anymore --- build.xml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/build.xml b/build.xml index 83341e0..9773a63 100644 --- a/build.xml +++ b/build.xml @@ -208,7 +208,7 @@ - @@ -307,17 +307,6 @@ - - - - - - @@ -327,4 +316,4 @@ - \ No newline at end of file + -- cgit v1.2.3 From 66ee4cbe40a56aa3c9b71427ee51c6b371eb3053 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 16 Feb 2011 00:45:06 +0100 Subject: set release date of 0.97.2 --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index b205f2f..212b4e3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -10,7 +10,7 @@ ChangeLog for SemantiScuttle - api/posts/add respects the "replace" parameter now -0.97.2 - 2011-02-XX +0.97.2 - 2011-02-17 ------------------- - Fix bug #3178597: Broken link to context in gsearch admin index page - Fix bug #3074816: French translation breaks edit javascript -- cgit v1.2.3 From 0dd5540bfbad7cd75a1eecd96a245aa512356338 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 16 Feb 2011 08:49:01 +0100 Subject: Fix bug #3065284: AjaxVote problem with Webkit browsers --- doc/ChangeLog | 1 + www/jsScuttle.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 212b4e3..acfce25 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -16,6 +16,7 @@ ChangeLog for SemantiScuttle - Fix bug #3074816: French translation breaks edit javascript - Fix bug #3111254: Search in my_watchlist results in error - Fix bug #3073215: Updating bookmark time does not work +- Fix bug #3065284: AjaxVote problem with Webkit browsers 0.97.1 - 2010-09-30 diff --git a/www/jsScuttle.php b/www/jsScuttle.php index f37da78..c166755 100644 --- a/www/jsScuttle.php +++ b/www/jsScuttle.php @@ -155,7 +155,10 @@ function processVotingResult() { var bmnode = document.getElementById('bmv-'+bookmark); bmnode.parentNode.replaceChild( - response.getElementsByTagName('html')[0].firstChild, + xmlhttp.responseXML.importNode( + response.getElementsByTagName('html')[0].firstChild, + true + ), bmnode ); } -- cgit v1.2.3 From 4cc46f268676d8df88ce6003df2a7bc9249fe7fb Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 18 Feb 2011 08:01:18 +0100 Subject: get rid of phpunits warnings about deprecated assertType usages --- tests/Bookmark2TagTest.php | 12 ++++++------ tests/BookmarkTest.php | 20 ++++++++++---------- tests/UserTest.php | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php index e6aaf1d..1823c60 100644 --- a/tests/Bookmark2TagTest.php +++ b/tests/Bookmark2TagTest.php @@ -120,7 +120,7 @@ class Bookmark2TagTest extends TestBase $this->b2ts->attachTags($bid, array('foo', 'bar', 'fuu')); $tags = $this->b2ts->getTagsForBookmark($bid); - $this->assertType('array', $tags); + $this->assertInternalType('array', $tags); $this->assertContains('foo', $tags); $this->assertContains('bar', $tags); $this->assertContains('fuu', $tags); @@ -141,10 +141,10 @@ class Bookmark2TagTest extends TestBase $alltags = $this->b2ts->getTagsForBookmarks( array($bid1, $bid2) ); - $this->assertType('array', $alltags); + $this->assertInternalType('array', $alltags); $this->assertEquals(2, count($alltags)); - $this->assertType('array', $alltags[$bid1]); - $this->assertType('array', $alltags[$bid2]); + $this->assertInternalType('array', $alltags[$bid1]); + $this->assertInternalType('array', $alltags[$bid2]); $this->assertEquals(0, count($alltags[$bid1])); $this->assertEquals(0, count($alltags[$bid2])); } @@ -179,9 +179,9 @@ class Bookmark2TagTest extends TestBase $alltags = $this->b2ts->getTagsForBookmarks( array($bid1, $bid2, $bid3, $bid4) ); - $this->assertType('array', $alltags); + $this->assertInternalType('array', $alltags); foreach ($alltags as $bid => $btags) { - $this->assertType('array', $btags); + $this->assertInternalType('array', $btags); if ($bid == $bid1) { $this->assertEquals(3, count($btags)); $this->assertContains('foo', $btags); diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 2a7c318..f54fe9a 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -263,7 +263,7 @@ class BookmarkTest extends TestBase $bookmark = $this->bs->getBookmark($bid); $ret = $this->bs->bookmarksExist(array($bookmark['bAddress'])); - $this->assertType('array', $ret); + $this->assertInternalType('array', $ret); $this->assertEquals(1, count($ret)); $this->assertTrue($ret[$bookmark['bAddress']]); } @@ -291,7 +291,7 @@ class BookmarkTest extends TestBase $bookmark2['bAddress'] ) ); - $this->assertType('array', $ret); + $this->assertInternalType('array', $ret); $this->assertEquals(2, count($ret)); $this->assertTrue($ret[$bookmark['bAddress']]); $this->assertTrue($ret[$bookmark2['bAddress']]); @@ -308,7 +308,7 @@ class BookmarkTest extends TestBase public function testBookmarksExistFalseSingle() { $ret = $this->bs->bookmarksExist(array('does-not-exist')); - $this->assertType('array', $ret); + $this->assertInternalType('array', $ret); $this->assertEquals(1, count($ret)); $this->assertFalse($ret['does-not-exist']); } @@ -329,7 +329,7 @@ class BookmarkTest extends TestBase 'does-not-exist-3', ); $ret = $this->bs->bookmarksExist($bms); - $this->assertType('array', $ret); + $this->assertInternalType('array', $ret); $this->assertEquals(3, count($ret)); $this->assertFalse($ret['does-not-exist']); $this->assertFalse($ret['does-not-exist-2']); @@ -366,7 +366,7 @@ class BookmarkTest extends TestBase 'does-not-exist-3' ) ); - $this->assertType('array', $ret); + $this->assertInternalType('array', $ret); $this->assertEquals(5, count($ret)); $this->assertTrue($ret[$bookmark['bAddress']]); $this->assertTrue($ret[$bookmark2['bAddress']]); @@ -475,7 +475,7 @@ class BookmarkTest extends TestBase foreach ($bms['bookmarks'] as $bm) { $this->assertArrayHasKey('tags', $bm); - $this->assertType('array', $bm['tags']); + $this->assertInternalType('array', $bm['tags']); if ($bm['bId'] == $bid) { $this->assertContains('foo', $bm['tags']); $this->assertContains('bar', $bm['tags']); @@ -756,7 +756,7 @@ class BookmarkTest extends TestBase $bm = $this->bs->getBookmark($bid, true); $this->assertArrayHasKey('tags', $bm); - $this->assertType('array', $bm['tags']); + $this->assertInternalType('array', $bm['tags']); $this->assertContains('foo', $bm['tags']); $this->assertContains('bar', $bm['tags']); } @@ -874,7 +874,7 @@ class BookmarkTest extends TestBase $bid = $this->addBookmark($uid, $url); $bm = $this->bs->getBookmarkByAddress($url); - $this->assertType('array', $bm); + $this->assertInternalType('array', $bm); $this->assertEquals($url, $bm['bAddress']); } @@ -900,7 +900,7 @@ class BookmarkTest extends TestBase $bid = $this->addBookmark($uid, $url); $bm = $this->bs->getBookmarkByAddress($incomplete); - $this->assertType('array', $bm); + $this->assertInternalType('array', $bm); $this->assertEquals($url, $bm['bAddress']); } @@ -951,7 +951,7 @@ class BookmarkTest extends TestBase $this->assertEquals('new description', $bm['bDescription']); $this->assertEquals('new private note', $bm['bPrivateNote']); $this->assertEquals(1, $bm['bStatus']); - $this->assertType('array', $bm['tags']); + $this->assertInternalType('array', $bm['tags']); $this->assertEquals(1, count($bm['tags'])); $this->assertContains('new', $bm['tags']); } diff --git a/tests/UserTest.php b/tests/UserTest.php index 6da7776..49f3730 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -143,7 +143,7 @@ class UserTest extends TestBase $uid = $this->addUser(); $users = $this->us->getObjectUsers(); $this->assertEquals(1, count($users)); - $this->assertType('SemanticScuttle_Model_User', reset($users)); + $this->assertInstanceOf('SemanticScuttle_Model_User', reset($users)); } @@ -160,7 +160,7 @@ class UserTest extends TestBase $uid3 = $this->addUser(); $users = $this->us->getObjectUsers(); $this->assertEquals(3, count($users)); - $this->assertType('SemanticScuttle_Model_User', reset($users)); + $this->assertInstanceOf('SemanticScuttle_Model_User', reset($users)); } -- cgit v1.2.3 From 3e9e2154a6ec7e4a1ab34b16f9e7ab9ea5c7f109 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 15 Mar 2011 07:59:03 +0100 Subject: Fix bug #3187177: Wrong URL / Export XML Bookmarks --- data/templates/editprofile.tpl.php | 2 +- doc/ChangeLog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/templates/editprofile.tpl.php b/data/templates/editprofile.tpl.php index b55d250..232b1d3 100644 --- a/data/templates/editprofile.tpl.php +++ b/data/templates/editprofile.tpl.php @@ -58,7 +58,7 @@ $this->includeTemplate($GLOBALS['top_include']); / - / + / diff --git a/doc/ChangeLog b/doc/ChangeLog index acfce25..6144a81 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,6 +8,7 @@ ChangeLog for SemantiScuttle - Implement patch #3059829: update FR_CA translation - Update php-gettext library to 1.0.10 - api/posts/add respects the "replace" parameter now +- Fix bug #3187177: Wrong URL / Export XML Bookmarks 0.97.2 - 2011-02-17 -- cgit v1.2.3 From 82ada0d75f249733936a0826b115b20cba0657ab Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 15 Mar 2011 19:13:14 +0100 Subject: Implement request #3054906: Show user's full name instead of nickname --- .../bookmarkcommondescriptionedit.tpl.php | 3 +- data/templates/bookmarks.tpl.php | 3 +- data/templates/sidebar.block.users.php | 2 +- data/templates/tagcommondescriptionedit.tpl.php | 3 +- data/templates/users.tpl.php | 9 ++++- doc/ChangeLog | 5 +-- src/SemanticScuttle/Model/UserArray.php | 41 ++++++++++++++++++++++ src/SemanticScuttle/Service/Bookmark.php | 3 +- src/SemanticScuttle/header.php | 1 + www/rss.php | 2 +- 10 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 src/SemanticScuttle/Model/UserArray.php diff --git a/data/templates/bookmarkcommondescriptionedit.tpl.php b/data/templates/bookmarkcommondescriptionedit.tpl.php index af5909a..807c58b 100644 --- a/data/templates/bookmarkcommondescriptionedit.tpl.php +++ b/data/templates/bookmarkcommondescriptionedit.tpl.php @@ -30,7 +30,8 @@ window.onload = function() { if(strlen($description['cdDatetime'])>0) { echo T_('Last modification:').' '.$description['cdDatetime'].', '; $lastUser = $userservice->getUser($description['uId']); - echo ''.$lastUser['username'].''; + echo '' + . SemanticScuttle_Model_UserArray::getName($lastUser) . ''; } ?> diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php index e32d3c9..c404358 100644 --- a/data/templates/bookmarks.tpl.php +++ b/data/templates/bookmarks.tpl.php @@ -309,7 +309,8 @@ if ($currenttag!= '') { $copy .= T_('you'); } else { $copy .= '' - . $row['username'] . ''; + . SemanticScuttle_Model_UserArray::getName($row) + . ''; } // Udders! diff --git a/data/templates/sidebar.block.users.php b/data/templates/sidebar.block.users.php index 3ad18bc..826871e 100644 --- a/data/templates/sidebar.block.users.php +++ b/data/templates/sidebar.block.users.php @@ -18,7 +18,7 @@ if ($lastUsers && count($lastUsers) > 0) { foreach ($lastUsers as $row) { echo ''; echo ''; - echo $row['username']; + echo SemanticScuttle_Model_UserArray::getName($row); echo ''; echo ' ('.T_('bookmarks').')'; echo ''; diff --git a/data/templates/tagcommondescriptionedit.tpl.php b/data/templates/tagcommondescriptionedit.tpl.php index d3a006a..f938f93 100644 --- a/data/templates/tagcommondescriptionedit.tpl.php +++ b/data/templates/tagcommondescriptionedit.tpl.php @@ -20,7 +20,8 @@ window.onload = function() { if(strlen($description['cdDatetime'])>0) { echo T_('Last modification:').' '.$description['cdDatetime'].', '; $lastUser = $userservice->getUser($description['uId']); - echo ''.$lastUser['username'].''; + echo '' + . SemanticScuttle_Model_UserArray::getName($lastUser) . ''; } ?> diff --git a/data/templates/users.tpl.php b/data/templates/users.tpl.php index c209f94..fa92bef 100644 --- a/data/templates/users.tpl.php +++ b/data/templates/users.tpl.php @@ -14,7 +14,14 @@ if ($users && count($users) > 0) { '.$row['username'].' ('.T_('profile').' '.T_('created in').' '.date('M Y',strtotime($row['uDatetime'])).') : '.T_('bookmarks').''; + echo '
  • ' + . SemanticScuttle_Model_UserArray::getName($row) . '' + . ' (' + . T_('profile') . ' ' + . T_('created in') . ' ' + . date('M Y', strtotime($row['uDatetime'])) . ')' + . ' : ' + . T_('bookmarks') . '
  • '; } ?> diff --git a/doc/ChangeLog b/doc/ChangeLog index 6144a81..4c93a9a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,12 +3,13 @@ ChangeLog for SemantiScuttle 0.9X.X - 2010-XX-XX ------------------- +- Fix bug #3187177: Wrong URL / Export XML Bookmarks - Fix bug in getTagsForBookmarks() that fetched all tags -- Show error message on mysqli connection errors +- Implement request #3054906: Show user's full name instead of nickname - Implement patch #3059829: update FR_CA translation +- Show error message on mysqli connection errors - Update php-gettext library to 1.0.10 - api/posts/add respects the "replace" parameter now -- Fix bug #3187177: Wrong URL / Export XML Bookmarks 0.97.2 - 2011-02-17 diff --git a/src/SemanticScuttle/Model/UserArray.php b/src/SemanticScuttle/Model/UserArray.php new file mode 100644 index 0000000..a0d9c9b --- /dev/null +++ b/src/SemanticScuttle/Model/UserArray.php @@ -0,0 +1,41 @@ + + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +/** + * Mostly static methods that help working with a user row array from database. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class SemanticScuttle_Model_UserArray +{ + /** + * Returns full user name as specified in the profile if it is set, + * otherwise the nickname/loginname is returned. + * + * @param array $row User row array from database + * + * @return string Full name or username + */ + public static function getName($row) + { + if (isset($row['name']) && $row['name']) { + return $row['name']; + } + return $row['username']; + } +} +?> \ No newline at end of file diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 6f8a172..a30ad5f 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -734,7 +734,8 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (SQL_LAYER == 'mysql4') { $query_1 .= 'SQL_CALC_FOUND_ROWS '; } - $query_1 .= 'B.*, U.'. $userservice->getFieldName('username'); + $query_1 .= 'B.*, U.'. $userservice->getFieldName('username') + . ', U.name'; $query_2 = ' FROM '. $userservice->getTableName() .' AS U' . ', '. $this->getTableName() .' AS B'; diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php index d1a5c29..4fecb8f 100644 --- a/src/SemanticScuttle/header.php +++ b/src/SemanticScuttle/header.php @@ -68,6 +68,7 @@ require_once 'SemanticScuttle/Service.php'; require_once 'SemanticScuttle/DbService.php'; require_once 'SemanticScuttle/Service/Factory.php'; require_once 'SemanticScuttle/functions.php'; +require_once 'SemanticScuttle/Model/UserArray.php'; if (count($GLOBALS['serviceoverrides']) > 0 && !defined('UNIT_TEST_MODE') diff --git a/www/rss.php b/www/rss.php index 6dcfb4c..298d9ba 100644 --- a/www/rss.php +++ b/www/rss.php @@ -116,7 +116,7 @@ foreach ($bookmarks_tmp as $key => $row) { 'title' => $row['bTitle'], 'link' => $_link, 'description' => $row['bDescription'], - 'creator' => $row['username'], + 'creator' => SemanticScuttle_Model_UserArray::getName($row), 'pubdate' => $_pubdate, 'tags' => $row['tags'] ); -- cgit v1.2.3 From 975809a8347929c9eae9c6a8bf3beb8d92af63ef Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 15 Mar 2011 19:18:57 +0100 Subject: unit test for the new SemanticScuttle_Model_UserArray class --- tests/UserArrayTest.php | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/UserArrayTest.php diff --git a/tests/UserArrayTest.php b/tests/UserArrayTest.php new file mode 100644 index 0000000..cb53f15 --- /dev/null +++ b/tests/UserArrayTest.php @@ -0,0 +1,68 @@ + + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +require_once 'prepare.php'; + +/** + * Unit tests for the SemanticScuttle user array model. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class UserArrayTest extends PHPUnit_Framework_TestCase +{ + + public function testGetNameLongName() + { + $this->assertEquals( + 'John Doe', + SemanticScuttle_Model_UserArray::getName( + array( + 'name' => 'John Doe', + 'username' => 'jdoe' + ) + ) + ); + } + + public function testGetNameUsernameIfNameIsEmpty() + { + $this->assertEquals( + 'jdoe', + SemanticScuttle_Model_UserArray::getName( + array( + 'name' => '', + 'username' => 'jdoe' + ) + ) + ); + } + + public function testGetNameUsernameIfNameIsNotSet() + { + $this->assertEquals( + 'jdoe', + SemanticScuttle_Model_UserArray::getName( + array( + 'username' => 'jdoe' + ) + ) + ); + } + +} + +?> \ No newline at end of file -- cgit v1.2.3