Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
4c320872d9
|
@ -147,14 +147,16 @@ class Profile extends Memcached_DataObject
|
||||||
return ($this->fullname) ? $this->fullname : $this->nickname;
|
return ($this->fullname) ? $this->fullname : $this->nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get latest notice on or before date; default now
|
/**
|
||||||
function getCurrentNotice($dt=null)
|
* Get the most recent notice posted by this user, if any.
|
||||||
|
*
|
||||||
|
* @return mixed Notice or null
|
||||||
|
*/
|
||||||
|
function getCurrentNotice()
|
||||||
{
|
{
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
$notice->profile_id = $this->id;
|
$notice->profile_id = $this->id;
|
||||||
if ($dt) {
|
// @fixme change this to sort on notice.id only when indexes are updated
|
||||||
$notice->whereAdd('created < "' . $dt . '"');
|
|
||||||
}
|
|
||||||
$notice->orderBy('created DESC, notice.id DESC');
|
$notice->orderBy('created DESC, notice.id DESC');
|
||||||
$notice->limit(1);
|
$notice->limit(1);
|
||||||
if ($notice->find(true)) {
|
if ($notice->find(true)) {
|
||||||
|
|
|
@ -132,13 +132,18 @@ class User extends Memcached_DataObject
|
||||||
return !in_array($nickname, $blacklist);
|
return !in_array($nickname, $blacklist);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentNotice($dt=null)
|
/**
|
||||||
|
* Get the most recent notice posted by this user, if any.
|
||||||
|
*
|
||||||
|
* @return mixed Notice or null
|
||||||
|
*/
|
||||||
|
function getCurrentNotice()
|
||||||
{
|
{
|
||||||
$profile = $this->getProfile();
|
$profile = $this->getProfile();
|
||||||
if (!$profile) {
|
if (!$profile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $profile->getCurrentNotice($dt);
|
return $profile->getCurrentNotice();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCarrier()
|
function getCarrier()
|
||||||
|
|
|
@ -59,7 +59,11 @@ class MagicEnvelope
|
||||||
}
|
}
|
||||||
if ($xrd->links) {
|
if ($xrd->links) {
|
||||||
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
|
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
|
||||||
list($type, $keypair) = explode(';', $link['href']);
|
list($type, $keypair) = explode(',', $link['href']);
|
||||||
|
if (empty($keypair)) {
|
||||||
|
// Backwards compatibility check for separator bug in 0.9.0
|
||||||
|
list($type, $keypair) = explode(';', $link['href']);
|
||||||
|
}
|
||||||
return $keypair;
|
return $keypair;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +74,7 @@ class MagicEnvelope
|
||||||
public function signMessage($text, $mimetype, $keypair)
|
public function signMessage($text, $mimetype, $keypair)
|
||||||
{
|
{
|
||||||
$signature_alg = Magicsig::fromString($keypair);
|
$signature_alg = Magicsig::fromString($keypair);
|
||||||
$armored_text = base64_encode($text);
|
$armored_text = base64_url_encode($text);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'data' => $armored_text,
|
'data' => $armored_text,
|
||||||
|
@ -108,7 +112,7 @@ class MagicEnvelope
|
||||||
public function unfold($env)
|
public function unfold($env)
|
||||||
{
|
{
|
||||||
$dom = new DOMDocument();
|
$dom = new DOMDocument();
|
||||||
$dom->loadXML(base64_decode($env['data']));
|
$dom->loadXML(base64_url_decode($env['data']));
|
||||||
|
|
||||||
if ($dom->documentElement->tagName != 'entry') {
|
if ($dom->documentElement->tagName != 'entry') {
|
||||||
return false;
|
return false;
|
||||||
|
@ -165,7 +169,7 @@ class MagicEnvelope
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = base64_decode($env['data']);
|
$text = base64_url_decode($env['data']);
|
||||||
$signer_uri = $this->getAuthor($text);
|
$signer_uri = $this->getAuthor($text);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -193,11 +197,12 @@ class MagicEnvelope
|
||||||
|
|
||||||
public function fromDom($dom)
|
public function fromDom($dom)
|
||||||
{
|
{
|
||||||
if ($dom->documentElement->tagName == 'entry') {
|
$env_element = $dom->getElementsByTagNameNS(MagicEnvelope::NS, 'env')->item(0);
|
||||||
|
if (!$env_element) {
|
||||||
$env_element = $dom->getElementsByTagNameNS(MagicEnvelope::NS, 'provenance')->item(0);
|
$env_element = $dom->getElementsByTagNameNS(MagicEnvelope::NS, 'provenance')->item(0);
|
||||||
} else if ($dom->documentElement->tagName == 'me:env') {
|
}
|
||||||
$env_element = $dom->documentElement;
|
|
||||||
} else {
|
if (!$env_element) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class XrdAction extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL,
|
$xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL,
|
||||||
'href' => 'data:application/magic-public-key;'. $magickey->toString(false));
|
'href' => 'data:application/magic-public-key,'. $magickey->toString(false));
|
||||||
|
|
||||||
// TODO - finalize where the redirect should go on the publisher
|
// TODO - finalize where the redirect should go on the publisher
|
||||||
$url = common_local_url('ostatussub') . '?profile={uri}';
|
$url = common_local_url('ostatussub') . '?profile={uri}';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user