'primary' => 'uId',
'username' => 'username',
'password' => 'password',
- 'privatekey' => 'privatekey'
+ 'privateKey' => 'privateKey'
);
protected $profileurl;
/**
* 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) {
}
/**
- * 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(
* @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
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
);
$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);
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);
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);
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);
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);
$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
$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
$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
$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
null, 'private bookmark'
);
- $req = $this->getRequest('?privatekey=' . $privateKey);
+ $req = $this->getRequest('?privateKey=' . $privateKey);
$response_body = $req->send()->getBody();
$rss = simplexml_load_string($response_body);
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);
null, 'private bookmark'
);
- $req = $this->getRequest('/' . $username . '?privatekey=' . $privateKey);
+ $req = $this->getRequest('/' . $username . '?privateKey=' . $privateKey);
$cookies = $req->setCookieJar()->getCookieJar();
$response_body = $req->send()->getBody();
$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())
)
);
}
$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())
)
);
}
$rssEntries = $maxRssEntries;
}
-$privatekey = null;
-if (isset($_GET['privatekey'])) {
- $privatekey = $_GET['privatekey'];
+$privateKey = null;
+if (isset($_GET['privateKey'])) {
+ $privateKey = $_GET['privateKey'];
}
$userid = null;
} 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);
}
$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);
$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())
)
);
}