Salmon move to src
Salmon class, update function name and function calls. Some standards as well.
This commit is contained in:
parent
b5d24b5ac3
commit
2b121779a6
11 changed files with 250 additions and 230 deletions
39
mod/post.php
39
mod/post.php
|
@ -1,54 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zot endpoint
|
||||
* @file mod/post.php
|
||||
* @brief Zot endpoint
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Database\DBM;
|
||||
use dba;
|
||||
|
||||
require_once('include/salmon.php');
|
||||
require_once('include/crypto.php');
|
||||
require_once 'include/crypto.php';
|
||||
// not yet ready for prime time
|
||||
//require_once('include/zot.php');
|
||||
|
||||
function post_post(App $a) {
|
||||
|
||||
/**
|
||||
* @param object $a App
|
||||
* @return void
|
||||
*/
|
||||
function post_post(App $a)
|
||||
{
|
||||
$bulk_delivery = false;
|
||||
|
||||
if ($a->argc == 1) {
|
||||
$bulk_delivery = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$nickname = $a->argv[2];
|
||||
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s'
|
||||
AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
$r = dba::select('user', array(), array('nickname' => $nickname, 'account_expired' => 0, 'account_removed' => 0), array('limit' => 1));
|
||||
if (! DBM::is_result($r)) {
|
||||
http_status_exit(500);
|
||||
}
|
||||
|
||||
$importer = $r[0];
|
||||
$importer = $r;
|
||||
}
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
|
||||
logger('mod-post: new zot: ' . $xml, LOGGER_DATA);
|
||||
|
||||
if(! $xml)
|
||||
if (! $xml) {
|
||||
http_status_exit(500);
|
||||
}
|
||||
|
||||
$msg = zot_decode($importer,$xml);
|
||||
$msg = zot_decode($importer, $xml);
|
||||
|
||||
logger('mod-post: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
|
||||
logger('mod-post: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
|
||||
|
||||
if(! is_array($msg))
|
||||
if (! is_array($msg)) {
|
||||
http_status_exit(500);
|
||||
}
|
||||
|
||||
$ret = 0;
|
||||
$ret = zot_incoming($bulk_delivery, $importer,$msg);
|
||||
$ret = zot_incoming($bulk_delivery, $importer, $msg);
|
||||
http_status_exit(($ret) ? $ret : 200);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Diaspora endpoint
|
||||
* @file mod/receive.php
|
||||
* @brief Diaspora endpoint
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
@ -9,10 +9,14 @@ use Friendica\Core\Config;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
||||
require_once('include/salmon.php');
|
||||
require_once('include/crypto.php');
|
||||
require_once 'include/crypto.php';
|
||||
|
||||
function receive_post(App $a) {
|
||||
/**
|
||||
* @param object $a App
|
||||
* @return void
|
||||
*/
|
||||
function receive_post(App $a)
|
||||
{
|
||||
$enabled = intval(Config::get('system', 'diaspora_enabled'));
|
||||
if (!$enabled) {
|
||||
logger('mod-diaspora: disabled');
|
||||
|
@ -44,7 +48,7 @@ function receive_post(App $a) {
|
|||
|
||||
if (!$xml) {
|
||||
$postdata = file_get_contents("php://input");
|
||||
if ($postdata == '') {
|
||||
if ($postdata == '') {
|
||||
http_status_exit(500);
|
||||
}
|
||||
|
||||
|
@ -80,4 +84,3 @@ function receive_post(App $a) {
|
|||
http_status_exit(($ret) ? 200 : 500);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ use Friendica\App;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Salmon;
|
||||
|
||||
require_once 'include/salmon.php';
|
||||
require_once 'include/crypto.php';
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/follow.php';
|
||||
|
@ -103,7 +103,7 @@ function salmon_post(App $a) {
|
|||
|
||||
logger('mod-salmon: Fetching key for ' . $author_link);
|
||||
|
||||
$key = get_salmon_key($author_link,$keyhash);
|
||||
$key = Salmon::getKey($author_link, $keyhash);
|
||||
|
||||
if(! $key) {
|
||||
logger('mod-salmon: Could not retrieve author key.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue