Stronger typing and function access control in OStatus
This commit is contained in:
parent
30f4f5606c
commit
bbada781b7
|
@ -22,9 +22,7 @@
|
||||||
* @author James Walker <james@status.net>
|
* @author James Walker <james@status.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
class SalmonAction extends Action
|
class SalmonAction extends Action
|
||||||
{
|
{
|
||||||
|
@ -32,7 +30,7 @@ class SalmonAction extends Action
|
||||||
var $activity = null;
|
var $activity = null;
|
||||||
var $target = null;
|
var $target = null;
|
||||||
|
|
||||||
function prepare($args)
|
protected function prepare(array $args=array())
|
||||||
{
|
{
|
||||||
StatusNet::setApi(true); // Send smaller error pages
|
StatusNet::setApi(true); // Send smaller error pages
|
||||||
|
|
||||||
|
@ -78,9 +76,9 @@ class SalmonAction extends Action
|
||||||
* Check the posted activity type and break out to appropriate processing.
|
* Check the posted activity type and break out to appropriate processing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
protected function handle()
|
||||||
{
|
{
|
||||||
StatusNet::setApi(true); // Send smaller error pages
|
parent::handle();
|
||||||
|
|
||||||
common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
|
common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
|
||||||
if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) &&
|
if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) &&
|
||||||
|
|
|
@ -342,12 +342,13 @@ class Ostatus_profile extends Managed_DataObject
|
||||||
* @param Profile $actor
|
* @param Profile $actor
|
||||||
* @return boolean success
|
* @return boolean success
|
||||||
*/
|
*/
|
||||||
public function notifyActivity($entry, $actor)
|
public function notifyActivity($entry, Profile $actor)
|
||||||
{
|
{
|
||||||
if ($this->salmonuri) {
|
if ($this->salmonuri) {
|
||||||
$salmon = new Salmon();
|
$salmon = new Salmon();
|
||||||
return $salmon->post($this->salmonuri, $this->notifyPrepXml($entry), $actor);
|
return $salmon->post($this->salmonuri, $this->notifyPrepXml($entry), $actor);
|
||||||
}
|
}
|
||||||
|
common_debug(__CLASS__.' error: No salmonuri for Ostatus_profile uri: '.$this->uri);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Salmon
|
||||||
* @param Profile $actor local user profile whose keys to sign with
|
* @param Profile $actor local user profile whose keys to sign with
|
||||||
* @return boolean success
|
* @return boolean success
|
||||||
*/
|
*/
|
||||||
public function post($endpoint_uri, $xml, $actor)
|
public function post($endpoint_uri, $xml, Profile $actor)
|
||||||
{
|
{
|
||||||
if (empty($endpoint_uri)) {
|
if (empty($endpoint_uri)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user