From ec345f7a1343769abdf3f5920a0732b24726b733 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Fri, 13 May 2011 14:26:51 -0400
Subject: new privatekey2 branch with privatekey changes
---
www/index.php | 13 +++++++++++++
www/jsScuttle.php | 10 ++++++++++
www/profile.php | 32 +++++++++++++++++++++++++++++---
www/rss.php | 43 +++++++++++++++++++++++++++++++++++++++++--
4 files changed, 93 insertions(+), 5 deletions(-)
(limited to 'www')
diff --git a/www/index.php b/www/index.php
index f6704ae..0977923 100644
--- a/www/index.php
+++ b/www/index.php
@@ -45,6 +45,19 @@ $tplVars['rsschannels'] = array(
array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss').'?sort='.getSortOrder())
);
+if ($userservice->isLoggedOn()) {
+ $currentUsername = $currentUser->getUsername();
+ if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ array_push(
+ $tplVars['rsschannels'],
+ array(
+ filter($sitename . sprintf(T_(': (private) ')) . $currentUsername),
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ )
+ );
+ }
+}
+
if ($usecache) {
// Generate hash for caching on
$hashtext = $_SERVER['REQUEST_URI'];
diff --git a/www/jsScuttle.php b/www/jsScuttle.php
index c166755..76b49dc 100644
--- a/www/jsScuttle.php
+++ b/www/jsScuttle.php
@@ -89,6 +89,16 @@ function useAddress(ele) {
}
}
+function getNewPrivateKey(input, response){
+ var pk = document.getElementById('pPrivateKey');
+ if (response != null) {
+ pk.value = response.trim();
+ } else {
+ loadXMLDocProc('ajaxGetNewPrivateKey.php');
+ }
+ return false;
+}
+
function getTitle(input, response){
var title = document.getElementById('titleField');
if (title.value == '') {
diff --git a/www/profile.php b/www/profile.php
index ccdb7a8..e6894d0 100644
--- a/www/profile.php
+++ b/www/profile.php
@@ -25,10 +25,13 @@ require_once 'www-header.php';
// No specific services
/* Managing all possible inputs */
+isset($_POST['submittedPK']) ? define('POST_SUBMITTEDPK', $_POST['submittedPK']): define('POST_SUBMITTEDPK', '');
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['pPass']) ? define('POST_PASS', $_POST['pPass']): define('POST_PASS', '');
isset($_POST['pPassConf']) ? define('POST_PASSCONF', $_POST['pPassConf']): define('POST_PASSCONF', '');
isset($_POST['pName']) ? define('POST_NAME', $_POST['pName']): define('POST_NAME', '');
+isset($_POST['pPrivateKey']) ? define('POST_PRIVATEKEY', $_POST['pPrivateKey']): define('POST_PRIVATEKEY', '');
+isset($_POST['pEnablePrivateKey']) ? define('POST_ENABLEPRIVATEKEY', $_POST['pEnablePrivateKey']): define('POST_ENABLEPRIVATEKEY', '');
isset($_POST['pMail']) ? define('POST_MAIL', $_POST['pMail']): define('POST_MAIL', '');
isset($_POST['pPage']) ? define('POST_PAGE', $_POST['pPage']): define('POST_PAGE', '');
isset($_POST['pDesc']) ? define('POST_DESC', $_POST['pDesc']): define('POST_DESC', '');
@@ -61,10 +64,19 @@ if ($user) {
exit();
}
+$tplVars['privateKeyIsEnabled'] = '';
if ($userservice->isLoggedOn() && $user == $currentUser->getUsername()) {
- $title = T_('My Profile');
+ $title = T_('My Profile');
+ $tplVars['privateKey'] = $currentUser->getPrivateKey(true);
+
+ if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ $tplVars['privateKeyIsEnabled'] = 'checked="checked"';
+ } else {
+ $tplVars['privateKeyIsEnabled'] = '';
+ }
} else {
- $title = T_('Profile') .': '. $user;
+ $title = T_('Profile') .': '. $user;
+ $tplVars['privateKey'] = '';
}
$tplVars['pagetitle'] = $title;
$tplVars['subtitle'] = $title;
@@ -72,11 +84,19 @@ $tplVars['subtitle'] = $title;
$tplVars['user'] = $user;
$tplVars['userid'] = $userid;
+/* Update Private Key */
+if (POST_SUBMITTEDPK!='' && $currentUser->getId() == $userid) {
+ $userinfo = $userservice->getObjectUserByUsername($user);
+ $tplVars['privateKey'] = $userservice->getNewPrivateKey();
+}
+
if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) {
$error = false;
$detPass = trim(POST_PASS);
$detPassConf = trim(POST_PASSCONF);
$detName = trim(POST_NAME);
+ $detPrivateKey = trim(POST_PRIVATEKEY);
+ $detEnablePrivateKey = trim(POST_ENABLEPRIVATEKEY);
$detMail = trim(POST_MAIL);
$detPage = trim(POST_PAGE);
$detDesc = filter(POST_DESC);
@@ -102,13 +122,19 @@ if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) {
$tplVars['error'] = T_('E-mail address is not valid.');
}
if (!$error) {
- if (!$userservice->updateUser($userid, $detPass, $detName, $detMail, $detPage, $detDesc)) {
+ if (!$userservice->updateUser($userid, $detPass, $detName, $detMail, $detPage, $detDesc, $detPrivateKey, $detEnablePrivateKey)) {
$tplVars['error'] = T_('An error occurred while saving your changes.');
} else {
$tplVars['msg'] = T_('Changes saved.');
}
}
$userinfo = $userservice->getObjectUserByUsername($user);
+ $tplVars['privateKey'] = $userinfo->getPrivateKey(true);
+ if ($userservice->isPrivateKeyValid($userinfo->getPrivateKey())) {
+ $tplVars['privateKeyIsEnabled'] = 'checked="checked"';
+ } else {
+ $tplVars['privateKeyIsEnabled'] = '';
+ }
}
if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) {
diff --git a/www/rss.php b/www/rss.php
index 50240e5..8c81e0e 100644
--- a/www/rss.php
+++ b/www/rss.php
@@ -64,9 +64,14 @@ if (!isset($rssEntries) || $rssEntries <= 0) {
$rssEntries = $maxRssEntries;
}
+$privatekey = null;
+if (isset($_GET['privatekey'])) {
+ $privatekey = $_GET['privatekey'];
+}
$watchlist = null;
$pagetitle = '';
+$isTempLogin = false;
if ($user && $user != 'all') {
if ($user == 'watchlist') {
$user = $cat;
@@ -78,8 +83,24 @@ if ($user && $user != 'all') {
} else {
if ($userinfo = $userservice->getUserByUsername($user)) {
$userid =& $userinfo[$userservice->getFieldName('primary')];
+ /* if user is not logged in and has valid privatekey */
+ if (!$userservice->isLoggedOn()) {
+ if ($privatekey != null) {
+ if ($userservice->loginPrivateKey($privatekey)) {
+ $isTempLogin = true;
+ } else {
+ $tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
+ header('Content-type: text/html; charset=utf-8');
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ //throw a 404 error
+ exit();
+ }
+ }
+ }
+
} else {
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ header('Content-type: text/html; charset=utf-8');
$templateservice->loadTemplate('error.404.tpl', $tplVars);
//throw a 404 error
exit();
@@ -87,7 +108,19 @@ if ($user && $user != 'all') {
}
$pagetitle .= ": ". $user;
} else {
- $userid = null;
+ if ($privatekey != null) {
+ if ($userservice->loginPrivateKey($privatekey)) {
+ $isTempLogin = true;
+ } else {
+ $tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
+ header('Content-type: text/html; charset=utf-8');
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ //throw a 404 error
+ exit();
+ }
+ } else {
+ $userid = null;
+ }
}
if ($cat) {
@@ -100,7 +133,8 @@ $tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOB
$bookmarks = $bookmarkservice->getBookmarks(
0, $rssEntries, $userid, $cat,
- null, getSortOrder(), $watchlist
+ null, getSortOrder(), $watchlist,
+ null, null, null
);
$bookmarks_tmp = filter($bookmarks['bookmarks']);
@@ -134,6 +168,11 @@ $tplVars['feedlastupdate'] = date('r', strtotime($latestdate));
$templateservice->loadTemplate('rss.tpl', $tplVars);
+/* If temporary login, please log out */
+if ($isTempLogin) {
+ $userservice->logout();
+}
+
if ($usecache) {
// Cache output if existing copy has expired
$cacheservice->End($hash);
--
cgit v1.2.3-54-g00ecf
From 6ed90e647a0a513def828ec66f17df2b724c518e Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Sat, 14 May 2011 21:46:35 -0400
Subject: Fixed sql commands where resources were not freed
---
src/SemanticScuttle/Service/Bookmark.php | 1 +
src/SemanticScuttle/Service/User.php | 9 ++++---
www/ajaxGetNewPrivateKey.php | 42 ++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 4 deletions(-)
create mode 100644 www/ajaxGetNewPrivateKey.php
(limited to 'www')
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php
index e836cd8..57d0b2e 100644
--- a/src/SemanticScuttle/Service/Bookmark.php
+++ b/src/SemanticScuttle/Service/Bookmark.php
@@ -427,6 +427,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
$existence[$hashes[$row['bHash']]] = $row['count'] > 0;
}
+ $this->db->sql_freeresult($dbresult);
return $existence;
}
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index c3633de..01945ca 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -674,11 +674,12 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
return false;
}
- $arrWatch = array();
+ $retval = true;
if ($this->db->sql_numrows($dbresult) == 0)
- return false;
- else
- return true;
+ $retval = false;
+
+ $this->db->sql_freeresult($dbresult);
+ return $retval;
}
function setWatchStatus($subjectUserID) {
diff --git a/www/ajaxGetNewPrivateKey.php b/www/ajaxGetNewPrivateKey.php
new file mode 100644
index 0000000..59545a2
--- /dev/null
+++ b/www/ajaxGetNewPrivateKey.php
@@ -0,0 +1,42 @@
+';
+?>
+
+
+getNewPrivateKey
+
+
+getNewPrivateKey(); ?>
+
+
--
cgit v1.2.3-54-g00ecf
From 10214c43b51e99cc3f8f58a4c4e8893eb2480e62 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Mon, 16 May 2011 00:35:31 -0400
Subject: Updated 'Generate New Key' button to use ajax if javascript enabled.
---
data/templates/editprofile.tpl.php | 4 +++-
src/SemanticScuttle/Service/Bookmark.php | 11 ++++++-----
www/profile.php | 1 +
3 files changed, 10 insertions(+), 6 deletions(-)
(limited to 'www')
diff --git a/data/templates/editprofile.tpl.php b/data/templates/editprofile.tpl.php
index 76f608a..258e864 100644
--- a/data/templates/editprofile.tpl.php
+++ b/data/templates/editprofile.tpl.php
@@ -33,7 +33,9 @@ $this->includeTemplate($GLOBALS['top_include']);
/>
-
+
+
+
|
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php
index 57d0b2e..9a075be 100644
--- a/src/SemanticScuttle/Service/Bookmark.php
+++ b/src/SemanticScuttle/Service/Bookmark.php
@@ -728,14 +728,15 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
$privacy = ' AND B.bStatus = 0';
}
+ $tagcount = 0;
// Set up the tags, if need be.
- if (!is_array($tags) && !is_null($tags)) {
+ if (!is_array($tags) && !is_null($tags) && $tags<>"") {
$tags = explode('+', trim($tags));
- }
- $tagcount = count($tags);
- for ($i = 0; $i < $tagcount; $i ++) {
- $tags[$i] = trim($tags[$i]);
+ $tagcount = count($tags);
+ for ($i = 0; $i < $tagcount; $i ++) {
+ $tags[$i] = trim($tags[$i]);
+ }
}
// Set up the SQL query.
diff --git a/www/profile.php b/www/profile.php
index e6894d0..63f4da8 100644
--- a/www/profile.php
+++ b/www/profile.php
@@ -23,6 +23,7 @@ require_once 'www-header.php';
/* Service creation: only useful services are created */
// No specific services
+$tplVars['loadjs'] = true;
/* Managing all possible inputs */
isset($_POST['submittedPK']) ? define('POST_SUBMITTEDPK', $_POST['submittedPK']): define('POST_SUBMITTEDPK', '');
--
cgit v1.2.3-54-g00ecf
From 920f7fc623ecad4f1338ab68326f2817c12c4610 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Tue, 17 May 2011 00:24:43 -0400
Subject: Updated PrivateKey to include Tag searches
---
data/templates/editprofile.tpl.php | 4 +--
src/SemanticScuttle/Service/Bookmark.php | 37 ++++++++++++++++++----------
src/SemanticScuttle/Service/Bookmark2Tag.php | 2 +-
src/SemanticScuttle/Service/Tag.php | 4 +--
www/bookmarks.php | 17 ++++++++++++-
www/tags.php | 15 ++++++++++-
6 files changed, 58 insertions(+), 21 deletions(-)
(limited to 'www')
diff --git a/data/templates/editprofile.tpl.php b/data/templates/editprofile.tpl.php
index 258e864..25dc3a4 100644
--- a/data/templates/editprofile.tpl.php
+++ b/data/templates/editprofile.tpl.php
@@ -33,9 +33,7 @@ $this->includeTemplate($GLOBALS['top_include']);
/>
-
-
-
+
|
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php
index 9a075be..232f9d0 100644
--- a/src/SemanticScuttle/Service/Bookmark.php
+++ b/src/SemanticScuttle/Service/Bookmark.php
@@ -821,23 +821,34 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
// Handle the parts of the query that depend on any tags that are present.
$query_4 = '';
- for ($i = 0; $i < $tagcount; $i ++) {
- $query_2 .= ', '. $b2tservice->getTableName() .' AS T'. $i;
+ if ($tagcount > 0) {
+ $query_2 .= ', '. $b2tservice->getTableName() .' AS T0';
$query_4 .= ' AND (';
+
+ $tagArray = array();
+ for ($i = 0; $i < $tagcount; $i ++) {
+ $tmpTag = $this->db->sql_escape($tags[$i]);
+ $allLinkedTags = $tag2tagservice->getAllLinkedTags(
+ $tmpTag, '>', $user
+ );
- $allLinkedTags = $tag2tagservice->getAllLinkedTags(
- $this->db->sql_escape($tags[$i]), '>', $user
- );
+ while (is_array($allLinkedTags) && count($allLinkedTags)>0) {
+ $tmpValue = array_pop($allLinkedTags);
+ if (in_array($tmpValue, $tagArray) == false) {
+ $tagArray[] = $tmpValue;
+ }
+ }
- while (is_array($allLinkedTags) && count($allLinkedTags)>0) {
- $query_4 .= ' T'. $i .'.tag = "'. array_pop($allLinkedTags) .'"';
- $query_4 .= ' OR';
+ if (in_array($tmpTag, $tagArray) == false) {
+ $tagArray[] = $tmpTag;
+ }
}
-
- $query_4 .= ' T'. $i .'.tag = "'. $this->db->sql_escape($tags[$i]) .'"';
-
- $query_4 .= ') AND T'. $i .'.bId = B.bId';
- //die($query_4);
+ // loop through array of possible tags
+ foreach ($tagArray as $k => $v) {
+ $query_4 .= ' T0.tag = "'. $v .'" OR';
+ }
+ $query_4 = substr($query_4,0,-3);
+ $query_4 .= ') AND T0.bId = B.bId';
}
// Search terms
diff --git a/src/SemanticScuttle/Service/Bookmark2Tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php
index a10cb61..fc59a1c 100644
--- a/src/SemanticScuttle/Service/Bookmark2Tag.php
+++ b/src/SemanticScuttle/Service/Bookmark2Tag.php
@@ -99,7 +99,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
$tags_count = is_array($tags)?count($tags):0;
for ($i = 0; $i < $tags_count; $i++) {
- $tags[$i] = trim(strtolower($tags[$i]));
+ $tags[$i] = trim(utf8_strtolower($tags[$i]));
if ($fromApi) {
include_once 'SemanticScuttle/functions.php';
$tags[$i] = convertTag($tags[$i], 'in');
diff --git a/src/SemanticScuttle/Service/Tag.php b/src/SemanticScuttle/Service/Tag.php
index 25d3888..8325285 100644
--- a/src/SemanticScuttle/Service/Tag.php
+++ b/src/SemanticScuttle/Service/Tag.php
@@ -141,10 +141,10 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
//normalize
if(!is_array($tags)) {
- $tags = strtolower(trim($tags));
+ $tags = utf8_strtolower(trim($tags));
} else {
for($i=0; $iisLoggedOn()) {
+ $currentUsername = $currentUser->getUsername();
+ if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ array_push(
+ $tplVars['rsschannels'],
+ array(
+ filter($sitename . $rssTitle. sprintf(T_(': (private) ')) . $currentUsername),
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ )
+ );
+ }
+ }
+
$tplVars['page'] = $page;
$tplVars['start'] = $start;
$tplVars['bookmarkCount'] = $start + 1;
diff --git a/www/tags.php b/www/tags.php
index a4e6555..09725e4 100644
--- a/www/tags.php
+++ b/www/tags.php
@@ -67,9 +67,22 @@ if ($usecache) {
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
$tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array(
-array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
+array(filter($sitename .': Tags: '. $cat), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
);
+if ($userservice->isLoggedOn()) {
+ $currentUsername = $currentUser->getUsername();
+ if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ array_push(
+ $tplVars['rsschannels'],
+ array(
+ filter($sitename .': Tags: '. $cat . sprintf(T_(': (private) ')) . $currentUsername),
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ )
+ );
+ }
+}
+
// Pagination
$perpage = getPerPageCount($currentUser);
if (intval(GET_PAGE) > 1) {
--
cgit v1.2.3-54-g00ecf
From e0149e24e2b5fac3b875fda468b18fbe2b6b1218 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Sat, 21 May 2011 14:36:29 -0400
Subject: Resolve some failed bookmark and tag tests
---
data/templates/bookmarks.tpl.php | 4 ++--
tests/AllTests.php | 3 ++-
tests/Api/PostsAddTest.php | 4 ++--
tests/Bookmark2TagTest.php | 6 +++---
www/index.php | 2 +-
5 files changed, 10 insertions(+), 9 deletions(-)
(limited to 'www')
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 55d6a0f..42aaa95 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -220,8 +220,8 @@ if ($currenttag!= '') {
$size = count($rsschannels);
for ($i = 0; $i < $size; $i++) {
$brss = ''
- . '
'
+ . ' title="' . $rsschannels[$i][0] . '">'
+ . '
'
. '';
}
diff --git a/tests/AllTests.php b/tests/AllTests.php
index 9e825e8..92f8960 100644
--- a/tests/AllTests.php
+++ b/tests/AllTests.php
@@ -46,6 +46,7 @@ class AllTests extends PHPUnit_Framework_TestSuite
$suite->addTestFile($tdir . '/VoteTest.php');
$suite->addTestFile($tdir . '/UserTest.php');
$suite->addTestFile($tdir . '/Api/ExportCsvTest.php');
+ $suite->addTestFile($tdir . '/Api/OpenSearchTest.php');
$suite->addTestFile($tdir . '/Api/PostsAddTest.php');
$suite->addTestFile($tdir . '/Api/PostsDeleteTest.php');
$suite->addTestFile($tdir . '/Api/PostsUpdateTest.php');
@@ -58,4 +59,4 @@ class AllTests extends PHPUnit_Framework_TestSuite
{
}
}
-?>
\ No newline at end of file
+?>
diff --git a/tests/Api/PostsAddTest.php b/tests/Api/PostsAddTest.php
index 02e2b38..e6d0531 100644
--- a/tests/Api/PostsAddTest.php
+++ b/tests/Api/PostsAddTest.php
@@ -108,7 +108,7 @@ TXT;
$this->assertEquals($bmUrl, $bm['bAddress']);
$this->assertEquals($bmTitle, $bm['bTitle']);
- $this->assertEquals($bmDescription, $bm['bDescription']);
+ $this->assertEquals($bmDescription, stripslashes($bm['bDescription']));
$this->assertEquals($bmTags, $bm['tags']);
$this->assertEquals(
gmdate('Y-m-d H:i:s', strtotime($bmDatetime)),
@@ -170,7 +170,7 @@ TXT;
$this->assertEquals($bmUrl, $bm['bAddress']);
$this->assertEquals($bmTitle, $bm['bTitle']);
- $this->assertEquals($bmDescription, $bm['bDescription']);
+ $this->assertEquals($bmDescription, stripslashes($bm['bDescription']));
$this->assertEquals($bmTags, $bm['tags']);
$this->assertEquals(
gmdate('Y-m-d H:i:s', strtotime($bmDatetime)),
diff --git a/tests/Bookmark2TagTest.php b/tests/Bookmark2TagTest.php
index 789540f..66a6e1f 100644
--- a/tests/Bookmark2TagTest.php
+++ b/tests/Bookmark2TagTest.php
@@ -290,8 +290,8 @@ class Bookmark2TagTest extends TestBase
$arTags = $this->b2ts->getPopularTags(null, 10, null, 1);
$this->assertInternalType('array', $arTags);
$this->assertEquals(3, count($arTags));
- $this->assertContains(array('tag' => 'one', 'bCount' => '2'), $arTags);
- $this->assertContains(array('tag' => 'two', 'bCount' => '1'), $arTags);
+ $this->assertContains(array('tag' => 'one', 'bCount' => '3'), $arTags);
+ $this->assertContains(array('tag' => 'two', 'bCount' => '2'), $arTags);
$this->assertContains(array('tag' => 'thr', 'bCount' => '1'), $arTags);
$arTags = $this->b2ts->getPopularTags(null, 10, null, 2);
@@ -608,4 +608,4 @@ class Bookmark2TagTest extends TestBase
$this->assertContains(array('tag' => 'usable', 'bCount' => '2'), $arTags);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/www/index.php b/www/index.php
index 0977923..931d64d 100644
--- a/www/index.php
+++ b/www/index.php
@@ -42,7 +42,7 @@ if (GET_ACTION == "logout") {
// Header variables
$tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array(
-array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss').'?sort='.getSortOrder())
+array(sprintf(T_('%s: Recent bookmarks'), htmlspecialchars($sitename)), createURL('rss').'?sort='.getSortOrder())
);
if ($userservice->isLoggedOn()) {
--
cgit v1.2.3-54-g00ecf
From 84e603aa91a303a1419962ff3ff6086710a7b1a9 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Sat, 4 Jun 2011 00:29:04 -0400
Subject: Reverted changes of date() to gdate(), added tests to confirm
existence of private RSS feed, and finalized changes to the user session
usage with rss.php
---
src/SemanticScuttle/Service/Bookmark.php | 2 +-
src/SemanticScuttle/Service/Bookmark2Tag.php | 2 +-
src/SemanticScuttle/Service/User.php | 2 --
tests/Api/PostsAddTest.php | 4 ++--
tests/TestBaseApi.php | 21 ++++++++++++-------
tests/www/bookmarksTest.php | 27 ++++++++++++++++++++++++
www/ajaxGetNewPrivateKey.php | 31 +++++++++++-----------------
www/index.php | 2 +-
www/jsScuttle.php | 8 +++++++
www/rss.php | 14 ++-----------
10 files changed, 68 insertions(+), 45 deletions(-)
(limited to 'www')
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php
index f69b4d1..17ab7ba 100644
--- a/src/SemanticScuttle/Service/Bookmark.php
+++ b/src/SemanticScuttle/Service/Bookmark.php
@@ -486,7 +486,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
} else {
$time = strtotime($date);
}
- $datetime = date('Y-m-d H:i:s', $time);
+ $datetime = gmdate('Y-m-d H:i:s', $time);
if ($short === '') {
$short = null;
diff --git a/src/SemanticScuttle/Service/Bookmark2Tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php
index fc59a1c..04ee43d 100644
--- a/src/SemanticScuttle/Service/Bookmark2Tag.php
+++ b/src/SemanticScuttle/Service/Bookmark2Tag.php
@@ -584,7 +584,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
if (is_int($days)) {
$query .= ' AND B.bDatetime > "'
- . date('Y-m-d H:i:s', time() - (86400 * $days))
+ . gmdate('Y-m-d H:i:s', time() - (86400 * $days))
. '"';
}
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index 18d5a29..a4870b7 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -571,8 +571,6 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
$this->db->sql_freeresult($dbresult);
if ($row) {
- $id = $_SESSION[$this->getSessionKey()]
- = $row[$this->getFieldName('primary')];
return true;
} else {
return false;
diff --git a/tests/Api/PostsAddTest.php b/tests/Api/PostsAddTest.php
index 2613a87..e6d0531 100644
--- a/tests/Api/PostsAddTest.php
+++ b/tests/Api/PostsAddTest.php
@@ -111,7 +111,7 @@ TXT;
$this->assertEquals($bmDescription, stripslashes($bm['bDescription']));
$this->assertEquals($bmTags, $bm['tags']);
$this->assertEquals(
- date('Y-m-d H:i:s', strtotime($bmDatetime)),
+ gmdate('Y-m-d H:i:s', strtotime($bmDatetime)),
$bm['bDatetime']
);
}
@@ -173,7 +173,7 @@ TXT;
$this->assertEquals($bmDescription, stripslashes($bm['bDescription']));
$this->assertEquals($bmTags, $bm['tags']);
$this->assertEquals(
- date('Y-m-d H:i:s', strtotime($bmDatetime)),
+ gmdate('Y-m-d H:i:s', strtotime($bmDatetime)),
$bm['bDatetime']
);
}
diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php
index 20574f3..d8917aa 100644
--- a/tests/TestBaseApi.php
+++ b/tests/TestBaseApi.php
@@ -164,15 +164,16 @@ class TestBaseApi extends TestBase
*
* Useful for testing HTML pages or ajax URLs.
*
- * @param string $urlSuffix Suffix for the URL
- * @param mixed $auth If user authentication is needed (true/false)
- * or array with username and password
+ * @param string $urlSuffix Suffix for the URL
+ * @param mixed $auth If user authentication is needed (true/false)
+ * or array with username and password
+ * @param boolean $privateKey True if to add user with private key
*
* @return array(HTTP_Request2, integer) HTTP request object and user id
*
* @uses getRequest()
*/
- protected function getLoggedInRequest($urlSuffix = null, $auth = true)
+ protected function getLoggedInRequest($urlSuffix = null, $auth = true, $privateKey = false)
{
if (is_array($auth)) {
list($username, $password) = $auth;
@@ -180,7 +181,13 @@ class TestBaseApi extends TestBase
$username = 'testuser';
$password = 'testpassword';
}
- $uid = $this->addUser($username, $password);
+ //include privatekey if requested
+ if ($privateKey) {
+ $pKey = $this->us->getNewPrivateKey();
+ } else {
+ $pKey = null;
+ }
+ $uid = $this->addUser($username, $password, $pKey);
$req = new HTTP_Request2(
$GLOBALS['unittestUrl'] . '/login.php?unittestMode=1',
@@ -234,7 +241,7 @@ class TestBaseApi extends TestBase
*/
protected function setUnittestConfig($arConfig)
{
- $str = '<' . "?php\r\n";
+ $str = '<' . "?php\n";
foreach ($arConfig as $name => $value) {
$str .= '$' . $name . ' = '
. var_export($value, true) . ";\n";
@@ -253,4 +260,4 @@ class TestBaseApi extends TestBase
);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/tests/www/bookmarksTest.php b/tests/www/bookmarksTest.php
index df360cc..eaf78bf 100755
--- a/tests/www/bookmarksTest.php
+++ b/tests/www/bookmarksTest.php
@@ -76,5 +76,32 @@ class www_bookmarksTest extends TestBaseApi
$this->assertEquals(1, (string)$elements[0]['value']);
}//end testDefaultPrivacyBookmarksAdd
+
+ /**
+ * Test that the private RSS link exists when a user
+ * has a private key and is enabled
+ */
+ public function testVerifyPrivateRSSLinkExists()
+ {
+ list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1', true, true);
+
+ $user = $this->us->getUser($uId);
+ $reqUrl = $GLOBALS['unittestUrl'] . 'bookmarks.php/'
+ . $user['username'];
+ $req->setUrl($reqUrl);
+ $req->setMethod(HTTP_Request2::METHOD_GET);
+ $response = $req->send();
+ $response_body = $response->getBody();
+ $this->assertNotEquals('', $response_body, 'Response is empty');
+
+ $x = simplexml_load_string($response_body);
+ $ns = $x->getDocNamespaces();
+ $x->registerXPathNamespace('ns', reset($ns));
+
+ $elements = $x->xpath('//ns:link');
+ $this->assertEquals(5, count($elements), 'Number of Links in Head not correct');
+ $this->assertContains('privatekey=', (string)$elements[4]['href']);
+ }//end testVerifyPrivateRSSLinkExists
+
}//end class www_bookmarksTest
?>
diff --git a/www/ajaxGetNewPrivateKey.php b/www/ajaxGetNewPrivateKey.php
index 59545a2..eacebd8 100644
--- a/www/ajaxGetNewPrivateKey.php
+++ b/www/ajaxGetNewPrivateKey.php
@@ -1,23 +1,16 @@
+ * @author Mark Pemberton
+ * @license AGPL http://www.gnu.org/licenses/agpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-cache, must-revalidate");
diff --git a/www/index.php b/www/index.php
index 931d64d..fab235f 100644
--- a/www/index.php
+++ b/www/index.php
@@ -51,7 +51,7 @@ if ($userservice->isLoggedOn()) {
array_push(
$tplVars['rsschannels'],
array(
- filter($sitename . sprintf(T_(': (private) ')) . $currentUsername),
+ filter($sitename . sprintf(T_(': Recent bookmarks (private)')) . $currentUsername),
createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
)
);
diff --git a/www/jsScuttle.php b/www/jsScuttle.php
index 76b49dc..3ca41ec 100644
--- a/www/jsScuttle.php
+++ b/www/jsScuttle.php
@@ -89,6 +89,14 @@ function useAddress(ele) {
}
}
+/**
+ * Makes an ajax call to PHP script to generate an new Private Key
+ *
+ * @param input Calling object
+ * @param response Response object that returned value is placed
+ *
+ * @return boolean Returns false to halt execution after call
+ */
function getNewPrivateKey(input, response){
var pk = document.getElementById('pPrivateKey');
if (response != null) {
diff --git a/www/rss.php b/www/rss.php
index 8c81e0e..2927534 100644
--- a/www/rss.php
+++ b/www/rss.php
@@ -71,7 +71,6 @@ if (isset($_GET['privatekey'])) {
$watchlist = null;
$pagetitle = '';
-$isTempLogin = false;
if ($user && $user != 'all') {
if ($user == 'watchlist') {
$user = $cat;
@@ -86,9 +85,7 @@ if ($user && $user != 'all') {
/* if user is not logged in and has valid privatekey */
if (!$userservice->isLoggedOn()) {
if ($privatekey != null) {
- if ($userservice->loginPrivateKey($privatekey)) {
- $isTempLogin = true;
- } else {
+ if (!$userservice->loginPrivateKey($privatekey)) {
$tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
header('Content-type: text/html; charset=utf-8');
$templateservice->loadTemplate('error.404.tpl', $tplVars);
@@ -109,9 +106,7 @@ if ($user && $user != 'all') {
$pagetitle .= ": ". $user;
} else {
if ($privatekey != null) {
- if ($userservice->loginPrivateKey($privatekey)) {
- $isTempLogin = true;
- } else {
+ if (!$userservice->loginPrivateKey($privatekey)) {
$tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
header('Content-type: text/html; charset=utf-8');
$templateservice->loadTemplate('error.404.tpl', $tplVars);
@@ -168,11 +163,6 @@ $tplVars['feedlastupdate'] = date('r', strtotime($latestdate));
$templateservice->loadTemplate('rss.tpl', $tplVars);
-/* If temporary login, please log out */
-if ($isTempLogin) {
- $userservice->logout();
-}
-
if ($usecache) {
// Cache output if existing copy has expired
$cacheservice->End($hash);
--
cgit v1.2.3-54-g00ecf
From 1dc33f4416c940ee3b46d9fabf3a2b1a2d369bb0 Mon Sep 17 00:00:00 2001
From: Mark Pemberton
Date: Tue, 7 Jun 2011 22:42:21 -0400
Subject: Refined rss feed description
---
www/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'www')
diff --git a/www/index.php b/www/index.php
index fab235f..2fa21f8 100644
--- a/www/index.php
+++ b/www/index.php
@@ -51,7 +51,7 @@ if ($userservice->isLoggedOn()) {
array_push(
$tplVars['rsschannels'],
array(
- filter($sitename . sprintf(T_(': Recent bookmarks (private)')) . $currentUsername),
+ filter(sprintf(T_('%s: Recent bookmarks (+private) %s'), $sitename, $currentUsername)),
createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
)
);
--
cgit v1.2.3-54-g00ecf
From dd34ad34075e071795bcb18f09cd9699141bbc25 Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Thu, 9 Jun 2011 09:13:42 +0200
Subject: fix E_NOTICE
---
www/rss.php | 1 +
1 file changed, 1 insertion(+)
(limited to 'www')
diff --git a/www/rss.php b/www/rss.php
index 2927534..b8f6948 100644
--- a/www/rss.php
+++ b/www/rss.php
@@ -69,6 +69,7 @@ if (isset($_GET['privatekey'])) {
$privatekey = $_GET['privatekey'];
}
+$userid = null;
$watchlist = null;
$pagetitle = '';
if ($user && $user != 'all') {
--
cgit v1.2.3-54-g00ecf
From 3d11286cbcc3cb35efe11f6e4a4ef5ac81620bda Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Mon, 27 Jun 2011 22:31:24 +0200
Subject: privatekey -> privateKey everywhere
---
src/SemanticScuttle/Service/User.php | 20 ++++++++++----------
tests/TestBase.php | 2 +-
tests/UserTest.php | 24 ++++++++++++------------
tests/www/bookmarksTest.php | 4 ++--
tests/www/indexTest.php | 4 ++--
tests/www/rssTest.php | 6 +++---
www/bookmarks.php | 2 +-
www/index.php | 2 +-
www/rss.php | 16 ++++++++--------
www/tags.php | 2 +-
10 files changed, 41 insertions(+), 41 deletions(-)
(limited to 'www')
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index b5b053f..7550ed2 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -51,7 +51,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
'primary' => 'uId',
'username' => 'username',
'password' => 'password',
- 'privatekey' => 'privatekey'
+ 'privateKey' => 'privateKey'
);
protected $profileurl;
@@ -219,13 +219,13 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
/**
* Returns user row from database.
*
- * @param string $privatekey Private Key
+ * @param string $privateKey Private Key
*
* @return array User array from database, false if no user was found
*/
- public function getUserByPrivateKey($privatekey)
+ public function getUserByPrivateKey($privateKey)
{
- return $this->_getuser($this->getFieldName('privatekey'), $privatekey);
+ return $this->_getuser($this->getFieldName('privateKey'), $privateKey);
}
function getObjectUserByUsername($username) {
@@ -539,24 +539,24 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
}
/**
- * Try to authenticate via the privatekey
+ * Try to authenticate via the privateKey
*
- * @param string $privatekey Private Key
+ * @param string $privateKey Private Key
*
* @return boolean true if the user could be authenticated,
* false if not.
*/
- public function loginPrivateKey($privatekey)
+ public function loginPrivateKey($privateKey)
{
/* Check if private key valid and enabled */
- if (!$this->isPrivateKeyValid($privatekey)) {
+ if (!$this->isPrivateKeyValid($privateKey)) {
return false;
}
$query = 'SELECT '. $this->getFieldName('primary') .' FROM '
. $this->getTableName() .' WHERE '
- . $this->getFieldName('privatekey') .' = "'
- . $this->db->sql_escape($privatekey) .'"';
+ . $this->getFieldName('privateKey') .' = "'
+ . $this->db->sql_escape($privateKey) .'"';
if (!($dbresult = $this->db->sql_query($query))) {
message_die(
diff --git a/tests/TestBase.php b/tests/TestBase.php
index 2180d2d..2914749 100644
--- a/tests/TestBase.php
+++ b/tests/TestBase.php
@@ -99,7 +99,7 @@ class TestBase extends PHPUnit_Framework_TestCase
* @param string $password Password, may be null
* @param mixed $privateKey String private key or boolean true to generate one
*
- * @return array ID of user, Name of user, password of user, privatekey
+ * @return array ID of user, Name of user, password of user, privateKey
*/
protected function addUserData(
$username = null, $password = null, $privateKey = null
diff --git a/tests/UserTest.php b/tests/UserTest.php
index 230167d..6cd6786 100644
--- a/tests/UserTest.php
+++ b/tests/UserTest.php
@@ -40,7 +40,7 @@ class UserTest extends TestBase
public function testAddUserPrivateKey()
{
$name = substr(md5(uniqid()), 0, 6);
- $pkey = 'my-privatekey';
+ $pkey = 'my-privateKey';
$id = $this->us->addUser(
$name, uniqid(), 'foo@example.org', $pkey
);
@@ -413,17 +413,17 @@ class UserTest extends TestBase
$randKey2 = '-'.$this->us->getNewPrivateKey();
$this->assertFalse(
$this->us->isPrivateKeyValid($randKey2),
- 'disabled privatekey should return false'
+ 'disabled privateKey should return false'
);
}
public function testLoginPrivateKeyInvalid()
{
- /* normal user with enabled privatekey */
+ /* normal user with enabled privateKey */
$randKey = $this->us->getNewPrivateKey();
$uid1 = $this->addUser('testusername', 'passw0rd', $randKey);
- /* user that has disabled privatekey */
+ /* user that has disabled privateKey */
$randKey2 = '-'.$this->us->getNewPrivateKey();
$uid2 = $this->addUser('seconduser', 'passw0RD', $randKey2);
@@ -436,10 +436,10 @@ class UserTest extends TestBase
public function testLoginPrivateKeyValidEnabledKey()
{
- /* normal user with enabled privatekey */
+ /* normal user with enabled privateKey */
$randKey = $this->us->getNewPrivateKey();
$uid1 = $this->addUser('testusername', 'passw0rd', $randKey);
- /* user that has disabled privatekey */
+ /* user that has disabled privateKey */
$randKey2 = '-'.$this->us->getNewPrivateKey();
$uid2 = $this->addUser('seconduser', 'passw0RD', $randKey2);
@@ -453,10 +453,10 @@ class UserTest extends TestBase
public function testLoginPrivateKeyInvalidEnabledKey()
{
- /* normal user with enabled privatekey */
+ /* normal user with enabled privateKey */
$randKey = $this->us->getNewPrivateKey();
$uid1 = $this->addUser('testusername', 'passw0rd', $randKey);
- /* user that has disabled privatekey */
+ /* user that has disabled privateKey */
$randKey2 = '-'.$this->us->getNewPrivateKey();
$uid2 = $this->addUser('seconduser', 'passw0RD', $randKey2);
@@ -470,10 +470,10 @@ class UserTest extends TestBase
public function testLoginPrivateKeyValidDisabledKey()
{
- /* normal user with enabled privatekey */
+ /* normal user with enabled privateKey */
$randKey = $this->us->getNewPrivateKey();
$uid1 = $this->addUser('testusername', 'passw0rd', $randKey);
- /* user that has disabled privatekey */
+ /* user that has disabled privateKey */
$randKey2 = '-'.$this->us->getNewPrivateKey();
$uid2 = $this->addUser('seconduser', 'passw0RD', $randKey2);
@@ -491,10 +491,10 @@ class UserTest extends TestBase
public function testLoginPrivateKeyInvalidDisabled()
{
- /* normal user with enabled privatekey */
+ /* normal user with enabled privateKey */
$randKey = $this->us->getNewPrivateKey();
$uid1 = $this->addUser('testusername', 'passw0rd', $randKey);
- /* user that has disabled privatekey */
+ /* user that has disabled privateKey */
$randKey2 = '-'.$this->us->getNewPrivateKey();
$uid2 = $this->addUser('seconduser', 'passw0RD', $randKey2);
diff --git a/tests/www/bookmarksTest.php b/tests/www/bookmarksTest.php
index 1e1f4eb..ae82118 100755
--- a/tests/www/bookmarksTest.php
+++ b/tests/www/bookmarksTest.php
@@ -92,7 +92,7 @@ class www_bookmarksTest extends TestBaseApi
$this->assertEquals(
2, count($elements), 'Number of Links in Head not correct'
);
- $this->assertContains('privatekey=', (string)$elements[1]['href']);
+ $this->assertContains('privateKey=', (string)$elements[1]['href']);
}//end testVerifyPrivateRSSLinkExists
@@ -121,7 +121,7 @@ class www_bookmarksTest extends TestBaseApi
$this->assertEquals(
1, count($elements), 'Number of Links in Head not correct'
);
- $this->assertNotContains('privatekey=', (string)$elements[0]['href']);
+ $this->assertNotContains('privateKey=', (string)$elements[0]['href']);
}//end testVerifyPrivateRSSLinkDoesNotExist
}//end class www_bookmarksTest
diff --git a/tests/www/indexTest.php b/tests/www/indexTest.php
index 18cb75a..503fd1f 100644
--- a/tests/www/indexTest.php
+++ b/tests/www/indexTest.php
@@ -26,7 +26,7 @@ class www_indexTest extends TestBaseApi
$elements = $x->xpath('//ns:link[@rel="alternate" and @type="application/rss+xml"]');
$this->assertEquals(2, count($elements), 'Number of Links in Head not correct');
- $this->assertContains('privatekey=', (string)$elements[1]['href']);
+ $this->assertContains('privateKey=', (string)$elements[1]['href']);
}//end testVerifyPrivateRSSLinkExists
@@ -50,7 +50,7 @@ class www_indexTest extends TestBaseApi
$elements = $x->xpath('//ns:link[@rel="alternate" and @type="application/rss+xml"]');
$this->assertEquals(1, count($elements), 'Number of Links in Head not correct');
- $this->assertNotContains('privatekey=', (string)$elements[0]['href']);
+ $this->assertNotContains('privateKey=', (string)$elements[0]['href']);
}//end testVerifyPrivateRSSLinkDoesNotExist
diff --git a/tests/www/rssTest.php b/tests/www/rssTest.php
index 75e4363..71d0198 100644
--- a/tests/www/rssTest.php
+++ b/tests/www/rssTest.php
@@ -78,7 +78,7 @@ class www_rssTest extends TestBaseApi
null, 'private bookmark'
);
- $req = $this->getRequest('?privatekey=' . $privateKey);
+ $req = $this->getRequest('?privateKey=' . $privateKey);
$response_body = $req->send()->getBody();
$rss = simplexml_load_string($response_body);
@@ -103,7 +103,7 @@ class www_rssTest extends TestBaseApi
null, 'private bookmark'
);
- $req = $this->getRequest('/' . $username . '?privatekey=' . $privateKey);
+ $req = $this->getRequest('/' . $username . '?privateKey=' . $privateKey);
$response_body = $req->send()->getBody();
$rss = simplexml_load_string($response_body);
@@ -129,7 +129,7 @@ class www_rssTest extends TestBaseApi
null, 'private bookmark'
);
- $req = $this->getRequest('/' . $username . '?privatekey=' . $privateKey);
+ $req = $this->getRequest('/' . $username . '?privateKey=' . $privateKey);
$cookies = $req->setCookieJar()->getCookieJar();
$response_body = $req->send()->getBody();
diff --git a/www/bookmarks.php b/www/bookmarks.php
index 44119db..7056fa6 100644
--- a/www/bookmarks.php
+++ b/www/bookmarks.php
@@ -276,7 +276,7 @@ if ($templatename == 'editbookmark.tpl') {
$tplVars['rsschannels'],
array(
filter($sitename . $rssTitle. sprintf(T_(': (private) ')) . $currentUsername),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
)
);
}
diff --git a/www/index.php b/www/index.php
index 2fa21f8..f270f73 100644
--- a/www/index.php
+++ b/www/index.php
@@ -52,7 +52,7 @@ if ($userservice->isLoggedOn()) {
$tplVars['rsschannels'],
array(
filter(sprintf(T_('%s: Recent bookmarks (+private) %s'), $sitename, $currentUsername)),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
)
);
}
diff --git a/www/rss.php b/www/rss.php
index b8f6948..d888726 100644
--- a/www/rss.php
+++ b/www/rss.php
@@ -64,9 +64,9 @@ if (!isset($rssEntries) || $rssEntries <= 0) {
$rssEntries = $maxRssEntries;
}
-$privatekey = null;
-if (isset($_GET['privatekey'])) {
- $privatekey = $_GET['privatekey'];
+$privateKey = null;
+if (isset($_GET['privateKey'])) {
+ $privateKey = $_GET['privateKey'];
}
$userid = null;
@@ -83,10 +83,10 @@ if ($user && $user != 'all') {
} else {
if ($userinfo = $userservice->getUserByUsername($user)) {
$userid =& $userinfo[$userservice->getFieldName('primary')];
- /* if user is not logged in and has valid privatekey */
+ /* if user is not logged in and has valid privateKey */
if (!$userservice->isLoggedOn()) {
- if ($privatekey != null) {
- if (!$userservice->loginPrivateKey($privatekey)) {
+ if ($privateKey != null) {
+ if (!$userservice->loginPrivateKey($privateKey)) {
$tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
header('Content-type: text/html; charset=utf-8');
$templateservice->loadTemplate('error.404.tpl', $tplVars);
@@ -106,8 +106,8 @@ if ($user && $user != 'all') {
}
$pagetitle .= ": ". $user;
} else {
- if ($privatekey != null) {
- if (!$userservice->loginPrivateKey($privatekey)) {
+ if ($privateKey != null) {
+ if (!$userservice->loginPrivateKey($privateKey)) {
$tplVars['error'] = sprintf(T_('Failed to Autenticate User with username %s using private key'), $user);
header('Content-type: text/html; charset=utf-8');
$templateservice->loadTemplate('error.404.tpl', $tplVars);
diff --git a/www/tags.php b/www/tags.php
index 09725e4..fca8a04 100644
--- a/www/tags.php
+++ b/www/tags.php
@@ -77,7 +77,7 @@ if ($userservice->isLoggedOn()) {
$tplVars['rsschannels'],
array(
filter($sitename .': Tags: '. $cat . sprintf(T_(': (private) ')) . $currentUsername),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
+ createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
)
);
}
--
cgit v1.2.3-54-g00ecf
From 90b6e65b1193b780c9c363fee3b1e92a5d0fba30 Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Mon, 27 Jun 2011 23:03:31 +0200
Subject: escape feed links properly and fix some bugs in the feed link
parameters
---
data/templates/default/bookmarks.tpl.php | 12 ++++++------
data/templates/default/top.inc.php | 2 +-
www/bookmarks.php | 20 +++++++++++++++-----
www/index.php | 16 ++++++++++++----
www/tags.php | 17 +++++++++++++----
5 files changed, 47 insertions(+), 20 deletions(-)
(limited to 'www')
diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php
index 8753b7f..0ed9c1d 100644
--- a/data/templates/default/bookmarks.tpl.php
+++ b/data/templates/default/bookmarks.tpl.php
@@ -222,12 +222,12 @@ if ($currenttag!= '') {
$size = count($rsschannels);
for ($i = 0; $i < $size; $i++) {
$brss = ''
- . '
'
- . '';
+ . ' href="'. htmlspecialchars($rsschannels[$i][1]) . '"'
+ . ' title="' . htmlspecialchars($rsschannels[$i][0]) . '">'
+ . '
'
+ . '';
}
$pagesBanner = ''. $bfirst .' / '. $bprev .' / '. $bnext .' / '. $blast .' / '. sprintf(T_('Page %d of %d'), $page, $totalpages) ." ". $brss ."
\n";
diff --git a/data/templates/default/top.inc.php b/data/templates/default/top.inc.php
index 9eed6ff..0f67a17 100644
--- a/data/templates/default/top.inc.php
+++ b/data/templates/default/top.inc.php
@@ -13,7 +13,7 @@ if (isset($rsschannels)) {
for ($i = 0; $i < $size; $i++) {
echo ' ';
+ . ' href="'. htmlspecialchars($rsschannels[$i][1]) .'" />' . "\n";
}
}
?>
diff --git a/www/bookmarks.php b/www/bookmarks.php
index 7056fa6..72c063e 100644
--- a/www/bookmarks.php
+++ b/www/bookmarks.php
@@ -229,14 +229,14 @@ if ($templatename == 'editbookmark.tpl') {
$tplVars['sidebar_blocks'] = array('watchstatus');
if (!$cat) { //user page without tags
- $rssTitle = ": My Bookmarks";
+ $rssTitle = "My Bookmarks";
$cat = NULL;
$tplVars['currenttag'] = NULL;
//$tplVars['sidebar_blocks'][] = 'menu2';
$tplVars['sidebar_blocks'][] = 'linked';
$tplVars['sidebar_blocks'][] = 'popular';
} else { //pages with tags
- $rssTitle = ": Tags" . $catTitle;
+ $rssTitle = "Tags" . $catTitle;
$rssCat = '/'. filter($cat, 'url');
$tplVars['currenttag'] = $cat;
$tplVars['sidebar_blocks'][] = 'tagactions';
@@ -266,7 +266,11 @@ if ($templatename == 'editbookmark.tpl') {
// Set template vars
$tplVars['rsschannels'] = array(
- array(filter($sitename .$rssTitle), createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder()))
+ array(
+ sprintf(T_('%s: %s'), $sitename, $rssTitle),
+ createURL('rss', filter($user, 'url'))
+ . $rssCat . '?sort='.getSortOrder()
+ )
);
if ($userservice->isLoggedOn()) {
@@ -275,8 +279,14 @@ if ($templatename == 'editbookmark.tpl') {
array_push(
$tplVars['rsschannels'],
array(
- filter($sitename . $rssTitle. sprintf(T_(': (private) ')) . $currentUsername),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
+ sprintf(
+ T_('%s: %s (+private %s)'),
+ $sitename, $rssTitle, $currentUsername
+ ),
+ createURL('rss', filter($currentUsername, 'url'))
+ . $rssCat
+ . '?sort=' . getSortOrder()
+ . '&privateKey=' . $currentUser->getPrivateKey()
)
);
}
diff --git a/www/index.php b/www/index.php
index f270f73..7fbb84c 100644
--- a/www/index.php
+++ b/www/index.php
@@ -42,17 +42,25 @@ if (GET_ACTION == "logout") {
// Header variables
$tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array(
-array(sprintf(T_('%s: Recent bookmarks'), htmlspecialchars($sitename)), createURL('rss').'?sort='.getSortOrder())
+ array(
+ sprintf(T_('%s: Recent bookmarks'), $sitename),
+ createURL('rss') . '?sort=' . getSortOrder()
+ )
);
if ($userservice->isLoggedOn()) {
- $currentUsername = $currentUser->getUsername();
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ $currentUsername = $currentUser->getUsername();
array_push(
$tplVars['rsschannels'],
array(
- filter(sprintf(T_('%s: Recent bookmarks (+private) %s'), $sitename, $currentUsername)),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
+ sprintf(
+ T_('%s: Recent bookmarks (+private %s)'),
+ $sitename, $currentUsername
+ ),
+ createURL('rss')
+ . '?sort=' . getSortOrder()
+ . '&privateKey=' . $currentUser->getPrivateKey()
)
);
}
diff --git a/www/tags.php b/www/tags.php
index fca8a04..127f6c5 100644
--- a/www/tags.php
+++ b/www/tags.php
@@ -67,17 +67,26 @@ if ($usecache) {
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
$tplVars['loadjs'] = true;
$tplVars['rsschannels'] = array(
-array(filter($sitename .': Tags: '. $cat), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
+ array(
+ sprintf(T_('%s: tagged with "%s"'), $sitename, $cat),
+ createURL('rss', 'all/' . filter($cat, 'url'))
+ . '?sort='.getSortOrder()
+ )
);
if ($userservice->isLoggedOn()) {
- $currentUsername = $currentUser->getUsername();
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
+ $currentUsername = $currentUser->getUsername();
array_push(
$tplVars['rsschannels'],
array(
- filter($sitename .': Tags: '. $cat . sprintf(T_(': (private) ')) . $currentUsername),
- createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privateKey='.$currentUser->getPrivateKey())
+ sprintf(
+ T_('%s: tagged with "%s" (+private %s)'),
+ $sitename, $cat, $currentUsername
+ ),
+ createURL('rss', filter($currentUsername, 'url'))
+ . '?sort=' . getSortOrder()
+ . '&privateKey=' . $currentUser->getPrivateKey()
)
);
}
--
cgit v1.2.3-54-g00ecf
From ba6465e310a5cb537cc46c2ed483e55ea9949cd0 Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Sat, 23 Jul 2011 08:33:52 +0200
Subject: Fix bug #3375428: Forgot to remove some old dojo files
---
data/templates/default/dojo.inc.php | 35 -----------------
doc/ChangeLog | 1 +
www/js/jstree-1.0-rc2/MultiComboBox.js | 72 ----------------------------------
3 files changed, 1 insertion(+), 107 deletions(-)
delete mode 100644 data/templates/default/dojo.inc.php
delete mode 100644 www/js/jstree-1.0-rc2/MultiComboBox.js
(limited to 'www')
diff --git a/data/templates/default/dojo.inc.php b/data/templates/default/dojo.inc.php
deleted file mode 100644
index 366dcfe..0000000
--- a/data/templates/default/dojo.inc.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 417f4c6..229db55 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -6,6 +6,7 @@ ChangeLog for SemantiScuttle
0.98.1 - 2011-XX-XX
-------------------
- Fix bug #3375635: XML parsing problem in top.inc.php
+- Fix bug #3375428: Forgot to remove some old dojo files
0.98.0 - 2011-07-21
diff --git a/www/js/jstree-1.0-rc2/MultiComboBox.js b/www/js/jstree-1.0-rc2/MultiComboBox.js
deleted file mode 100644
index b263c8b..0000000
--- a/www/js/jstree-1.0-rc2/MultiComboBox.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
- Available via Academic Free License >= 2.1 OR the modified BSD license.
- see: http://dojotoolkit.org/license for details
-*/
-
-/* SemanticScuttle: This script is a light modification of dojox.form.MultiComboBox
-This fork allows specific use until DOJO 1.2.3 in Google CDN. */
-
-
-
-if(!dojo._hasResource["js.MultiComboBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["js.MultiComboBox"] = true;
-dojo.provide("js.MultiComboBox");
-dojo.experimental("js.MultiComboBox");
-dojo.require("dijit.form.ComboBox");
-dojo.require("dijit.form.ValidationTextBox");
-
-dojo.declare("js.MultiComboBox",
- [dijit.form.ValidationTextBox, dijit.form.ComboBoxMixin],{
- //
- // summary: A ComboBox that accpets multiple inputs on a single line?
- //
- // delimiter: String
- // The character to use to separate items in the ComboBox input
- delimiter: ",",
- _previousMatches: false,
-
- _setValueAttr: function(value){
- if (this.delimiter && value.length != 0){
- value = value+this.delimiter+" ";
- arguments[0] = this._addPreviousMatches(value);
- }
- this.inherited(arguments);
- },
-
- _addPreviousMatches: function(/* String */text){
- if(this._previousMatches){
- if(!text.match(new RegExp("^"+this._previousMatches))){
- text = this._previousMatches+text;
- }
- }
- text = this._cleanupDelimiters(text); // SScuttle: this line was moved
- return text; // String
- },
-
- _cleanupDelimiters: function(/* String */text){
- if(this.delimiter){
- text = text.replace(new RegExp(" +"), " ");
- text = text.replace(new RegExp("^ *"+this.delimiter+"* *"), "");
- text = text.replace(new RegExp(this.delimiter+" *"+this.delimiter), this.delimiter);
- }
- return text;
- },
-
- _autoCompleteText: function(/* String */text){
- arguments[0] = this._addPreviousMatches(text);
- this.inherited(arguments);
- },
-
- _startSearch: function(/* String */text){
- text = this._cleanupDelimiters(text);
- var re = new RegExp("^.*"+this.delimiter+" *");
-
- if((this._previousMatches = text.match(re))){
- arguments[0] = text.replace(re, "");
- }
- this.inherited(arguments);
- }
-});
-
-}
\ No newline at end of file
--
cgit v1.2.3-54-g00ecf