forked from GNUsocial/gnu-social
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
This commit is contained in:
commit
dbb9957eea
@ -541,18 +541,39 @@ class NoticeListItem extends Widget
|
|||||||
{
|
{
|
||||||
$hasConversation = false;
|
$hasConversation = false;
|
||||||
if (!empty($this->notice->conversation)) {
|
if (!empty($this->notice->conversation)) {
|
||||||
$conversation = Notice::conversationStream($this->notice->conversation, 1, 1);
|
$conversation = Notice::conversationStream(
|
||||||
|
$this->notice->conversation,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
);
|
||||||
if ($conversation->N > 0) {
|
if ($conversation->N > 0) {
|
||||||
$hasConversation = true;
|
$hasConversation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($hasConversation) {
|
if ($hasConversation) {
|
||||||
|
$conv = Conversation::staticGet(
|
||||||
|
'id',
|
||||||
|
$this->notice->conversation
|
||||||
|
);
|
||||||
|
$convurl = $conv->uri;
|
||||||
|
if (!empty($convurl)) {
|
||||||
$this->out->text(' ');
|
$this->out->text(' ');
|
||||||
$convurl = common_local_url('conversation',
|
$this->out->element(
|
||||||
array('id' => $this->notice->conversation));
|
'a',
|
||||||
$this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,
|
array(
|
||||||
|
'href' => $convurl.'#notice-'.$this->notice->id,
|
||||||
'class' => 'response'),
|
'class' => 'response'),
|
||||||
_('in context'));
|
_('in context')
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$msg = sprintf(
|
||||||
|
"Couldn't find Conversation ID %d to make 'in context'"
|
||||||
|
. "link for Notice ID %d",
|
||||||
|
$this->notice->conversation,
|
||||||
|
$this->notice->id
|
||||||
|
);
|
||||||
|
common_log(LOG_WARNING, $msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,14 +181,15 @@ class Magicsig extends Memcached_DataObject
|
|||||||
switch ($this->alg) {
|
switch ($this->alg) {
|
||||||
|
|
||||||
case 'RSA-SHA256':
|
case 'RSA-SHA256':
|
||||||
return 'sha256';
|
return 'magicsig_sha256';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sign($bytes)
|
public function sign($bytes)
|
||||||
{
|
{
|
||||||
$sig = $this->_rsa->createSign($bytes, null, 'sha256');
|
$hash = $this->getHash();
|
||||||
|
$sig = $this->_rsa->createSign($bytes, null, $hash);
|
||||||
if ($this->_rsa->isError()) {
|
if ($this->_rsa->isError()) {
|
||||||
$error = $this->_rsa->getLastError();
|
$error = $this->_rsa->getLastError();
|
||||||
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
|
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
|
||||||
@ -200,7 +201,8 @@ class Magicsig extends Memcached_DataObject
|
|||||||
|
|
||||||
public function verify($signed_bytes, $signature)
|
public function verify($signed_bytes, $signature)
|
||||||
{
|
{
|
||||||
$result = $this->_rsa->validateSign($signed_bytes, $signature, null, 'sha256');
|
$hash = $this->getHash();
|
||||||
|
$result = $this->_rsa->validateSign($signed_bytes, $signature, null, $hash);
|
||||||
if ($this->_rsa->isError()) {
|
if ($this->_rsa->isError()) {
|
||||||
$error = $this->keypair->getLastError();
|
$error = $this->keypair->getLastError();
|
||||||
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
|
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
|
||||||
@ -213,7 +215,7 @@ class Magicsig extends Memcached_DataObject
|
|||||||
|
|
||||||
// Define a sha256 function for hashing
|
// Define a sha256 function for hashing
|
||||||
// (Crypt_RSA should really be updated to use hash() )
|
// (Crypt_RSA should really be updated to use hash() )
|
||||||
function sha256($bytes)
|
function magicsig_sha256($bytes)
|
||||||
{
|
{
|
||||||
return hash('sha256', $bytes);
|
return hash('sha256', $bytes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user