Remove unused code
- Remove commented code - Remove unused/immediately overwritten variables - Remove extraneous parameters - Remove unreachable code - Remove duplicate array keys
This commit is contained in:
parent
0c4f8277e6
commit
4a95ca280d
42 changed files with 43 additions and 218 deletions
|
@ -370,8 +370,6 @@ class OEmbed
|
||||||
*/
|
*/
|
||||||
private static function iframe($src, $width, $height)
|
private static function iframe($src, $width, $height)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
if (!$height || strstr($height, '%')) {
|
if (!$height || strstr($height, '%')) {
|
||||||
$height = '200';
|
$height = '200';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1683,7 +1683,7 @@ class BBCode extends BaseObject
|
||||||
|
|
||||||
// Replace non graphical smilies for external posts
|
// Replace non graphical smilies for external posts
|
||||||
if ($simple_html) {
|
if ($simple_html) {
|
||||||
$text = Smilies::replace($text, false, true);
|
$text = Smilies::replace($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unhide all [noparse] contained bbtags unspacefying them
|
// Unhide all [noparse] contained bbtags unspacefying them
|
||||||
|
|
|
@ -84,8 +84,6 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
||||||
|
|
||||||
public function set($cat, $k, $value)
|
public function set($cat, $k, $value)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
|
||||||
|
|
||||||
// We store our setting values in a string variable.
|
// We store our setting values in a string variable.
|
||||||
// So we have to do the conversion here so that the compare below works.
|
// So we have to do the conversion here so that the compare below works.
|
||||||
// The exception are array values.
|
// The exception are array values.
|
||||||
|
|
|
@ -73,7 +73,6 @@ HELP;
|
||||||
$this->out('Options: ' . var_export($this->options, true));
|
$this->out('Options: ' . var_export($this->options, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$showHelp = false;
|
|
||||||
$subHelp = false;
|
$subHelp = false;
|
||||||
$command = null;
|
$command = null;
|
||||||
|
|
||||||
|
@ -83,7 +82,6 @@ HELP;
|
||||||
return 0;
|
return 0;
|
||||||
} elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
|
} elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
|
||||||
) {
|
) {
|
||||||
$showHelp = true;
|
|
||||||
} elseif (count($this->args) >= 2 && $this->getArgument(0) == 'help') {
|
} elseif (count($this->args) >= 2 && $this->getArgument(0) == 'help') {
|
||||||
$command = $this->getArgument(1);
|
$command = $this->getArgument(1);
|
||||||
$subHelp = true;
|
$subHelp = true;
|
||||||
|
|
|
@ -47,8 +47,6 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$pofile = realpath($this->getArgument(0));
|
$pofile = realpath($this->getArgument(0));
|
||||||
|
|
||||||
if (!file_exists($pofile)) {
|
if (!file_exists($pofile)) {
|
||||||
|
@ -106,7 +104,6 @@ HELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inv) {
|
if ($inv) {
|
||||||
$inv = false;
|
|
||||||
$out .= '"' . $v . '"';
|
$out .= '"' . $v . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +176,6 @@ HELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inv) {
|
if ($inv) {
|
||||||
$inv = false;
|
|
||||||
$out .= '"' . $v . '"';
|
$out .= '"' . $v . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ HELP;
|
||||||
|
|
||||||
protected function doExecute()
|
protected function doExecute()
|
||||||
{
|
{
|
||||||
$a = \Friendica\BaseObject::getApp();
|
|
||||||
|
|
||||||
if ($this->getOption('v')) {
|
if ($this->getOption('v')) {
|
||||||
$this->out('Executable: ' . $this->executable);
|
$this->out('Executable: ' . $this->executable);
|
||||||
$this->out('Class: ' . __CLASS__);
|
$this->out('Class: ' . __CLASS__);
|
||||||
|
|
|
@ -224,8 +224,6 @@ class Installer
|
||||||
*/
|
*/
|
||||||
public function checkPHP($phppath = null, $required = false)
|
public function checkPHP($phppath = null, $required = false)
|
||||||
{
|
{
|
||||||
$passed = false;
|
|
||||||
$passed2 = false;
|
|
||||||
$passed3 = false;
|
$passed3 = false;
|
||||||
|
|
||||||
if (!isset($phppath)) {
|
if (!isset($phppath)) {
|
||||||
|
@ -394,7 +392,7 @@ class Installer
|
||||||
$help = '';
|
$help = '';
|
||||||
$status = true;
|
$status = true;
|
||||||
try {
|
try {
|
||||||
$xml = new DOMDocument();
|
new DOMDocument();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$help = L10n::t('Error, XML PHP module required but not installed.');
|
$help = L10n::t('Error, XML PHP module required but not installed.');
|
||||||
$status = false;
|
$status = false;
|
||||||
|
|
|
@ -229,7 +229,6 @@ class NotificationsManager extends BaseObject
|
||||||
*/
|
*/
|
||||||
private function formatNotifs(array $notifs, $ident = "")
|
private function formatNotifs(array $notifs, $ident = "")
|
||||||
{
|
{
|
||||||
$notif = [];
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
if (DBA::isResult($notifs)) {
|
if (DBA::isResult($notifs)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ class PConfig extends BaseObject
|
||||||
if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
|
if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
|
||||||
self::$adapter = new Config\PreloadPConfigAdapter($uid);
|
self::$adapter = new Config\PreloadPConfigAdapter($uid);
|
||||||
} else {
|
} else {
|
||||||
self::$adapter = new Config\JITPConfigAdapter($uid);
|
self::$adapter = new Config\JITPConfigAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ class System extends BaseObject
|
||||||
array_shift($trace);
|
array_shift($trace);
|
||||||
|
|
||||||
$callstack = [];
|
$callstack = [];
|
||||||
$counter = 0;
|
|
||||||
$previous = ['class' => '', 'function' => ''];
|
$previous = ['class' => '', 'function' => ''];
|
||||||
|
|
||||||
// The ignore list contains all functions that are only wrapper functions
|
// The ignore list contains all functions that are only wrapper functions
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ class DBA
|
||||||
if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) {
|
if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) {
|
||||||
foreach ($rel_def AS $rel_table => $rel_fields) {
|
foreach ($rel_def AS $rel_table => $rel_fields) {
|
||||||
foreach ($rel_fields AS $rel_field) {
|
foreach ($rel_fields AS $rel_field) {
|
||||||
$retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
|
self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We quit when this key already exists in the callstack.
|
// We quit when this key already exists in the callstack.
|
||||||
|
@ -1579,8 +1579,6 @@ class DBA
|
||||||
$ret = self::p("SHOW PROCESSLIST");
|
$ret = self::p("SHOW PROCESSLIST");
|
||||||
$data = self::toArray($ret);
|
$data = self::toArray($ret);
|
||||||
|
|
||||||
$s = [];
|
|
||||||
|
|
||||||
$processes = 0;
|
$processes = 0;
|
||||||
$states = [];
|
$states = [];
|
||||||
foreach ($data as $process) {
|
foreach ($data as $process) {
|
||||||
|
|
|
@ -885,8 +885,6 @@ class Contact extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function getDetailsByAddr($addr, $uid = -1)
|
public static function getDetailsByAddr($addr, $uid = -1)
|
||||||
{
|
{
|
||||||
static $cache = [];
|
|
||||||
|
|
||||||
if ($addr == '') {
|
if ($addr == '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -942,14 +940,9 @@ class Contact extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function photoMenu(array $contact, $uid = 0)
|
public static function photoMenu(array $contact, $uid = 0)
|
||||||
{
|
{
|
||||||
// @todo Unused, to be removed
|
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$contact_url = '';
|
|
||||||
$pm_url = '';
|
$pm_url = '';
|
||||||
$status_link = '';
|
$status_link = '';
|
||||||
$photos_link = '';
|
$photos_link = '';
|
||||||
$posts_link = '';
|
|
||||||
$contact_drop_link = '';
|
$contact_drop_link = '';
|
||||||
$poke_link = '';
|
$poke_link = '';
|
||||||
|
|
||||||
|
@ -1219,7 +1212,6 @@ class Contact extends BaseObject
|
||||||
$contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true);
|
$contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $data["url"];
|
|
||||||
if (!$contact_id) {
|
if (!$contact_id) {
|
||||||
$fields = [
|
$fields = [
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
|
|
|
@ -239,8 +239,6 @@ class Event extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function store($arr)
|
public static function store($arr)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
|
||||||
|
|
||||||
$event = [];
|
$event = [];
|
||||||
$event['id'] = intval(defaults($arr, 'id' , 0));
|
$event['id'] = intval(defaults($arr, 'id' , 0));
|
||||||
$event['uid'] = intval(defaults($arr, 'uid' , 0));
|
$event['uid'] = intval(defaults($arr, 'uid' , 0));
|
||||||
|
@ -418,7 +416,6 @@ class Event extends BaseObject
|
||||||
"February" => L10n::t("February"),
|
"February" => L10n::t("February"),
|
||||||
"March" => L10n::t("March"),
|
"March" => L10n::t("March"),
|
||||||
"April" => L10n::t("April"),
|
"April" => L10n::t("April"),
|
||||||
"May" => L10n::t("May"),
|
|
||||||
"June" => L10n::t("June"),
|
"June" => L10n::t("June"),
|
||||||
"July" => L10n::t("July"),
|
"July" => L10n::t("July"),
|
||||||
"August" => L10n::t("August"),
|
"August" => L10n::t("August"),
|
||||||
|
@ -643,7 +640,7 @@ class Event extends BaseObject
|
||||||
*
|
*
|
||||||
* @todo Implement timezone support
|
* @todo Implement timezone support
|
||||||
*/
|
*/
|
||||||
private static function formatListForExport(array $events, $format, $timezone)
|
private static function formatListForExport(array $events, $format)
|
||||||
{
|
{
|
||||||
if (!count($events)) {
|
if (!count($events)) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -795,19 +792,14 @@ class Event extends BaseObject
|
||||||
{
|
{
|
||||||
$process = false;
|
$process = false;
|
||||||
|
|
||||||
$user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
|
|
||||||
if (DBA::isResult($user)) {
|
|
||||||
$timezone = $user['timezone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all events which are owned by a uid (respects permissions).
|
// Get all events which are owned by a uid (respects permissions).
|
||||||
$events = self::getListByUserId($uid);
|
$events = self::getListByUserId($uid);
|
||||||
|
|
||||||
// We have the events that are available for the requestor.
|
// We have the events that are available for the requestor.
|
||||||
// Now format the output according to the requested format.
|
// Now format the output according to the requested format.
|
||||||
$res = self::formatListForExport($events, $format, $timezone);
|
$res = self::formatListForExport($events, $format);
|
||||||
|
|
||||||
// If there are results the precess was successfull.
|
// If there are results the precess was successful.
|
||||||
if (!empty($res)) {
|
if (!empty($res)) {
|
||||||
$process = true;
|
$process = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,8 +528,6 @@ class GContact
|
||||||
*/
|
*/
|
||||||
public static function updateSuggestions()
|
public static function updateSuggestions()
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$done = [];
|
$done = [];
|
||||||
|
|
||||||
/// @TODO Check if it is really neccessary to poll the own server
|
/// @TODO Check if it is really neccessary to poll the own server
|
||||||
|
|
|
@ -316,8 +316,6 @@ class Group extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function displayGroupSelection($uid, $gid = 0, $label = '')
|
public static function displayGroupSelection($uid, $gid = 0, $label = '')
|
||||||
{
|
{
|
||||||
$o = '';
|
|
||||||
|
|
||||||
$stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
|
$stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
|
||||||
|
|
||||||
$display_groups = [
|
$display_groups = [
|
||||||
|
|
|
@ -1236,12 +1236,16 @@ class Item extends BaseObject
|
||||||
// This function will finally cover most of the preparation functionality in mod/item.php
|
// This function will finally cover most of the preparation functionality in mod/item.php
|
||||||
public static function prepare(&$item)
|
public static function prepare(&$item)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* @TODO: Unused code triggering inspection errors
|
||||||
|
*
|
||||||
$data = BBCode::getAttachmentData($item['body']);
|
$data = BBCode::getAttachmentData($item['body']);
|
||||||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
|
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
|
||||||
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
||||||
$posttype = Item::PT_PAGE;
|
$posttype = Item::PT_PAGE;
|
||||||
$objecttype = ACTIVITY_OBJ_BOOKMARK;
|
$objecttype = ACTIVITY_OBJ_BOOKMARK;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
|
public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
|
||||||
|
@ -3040,7 +3044,6 @@ class Item extends BaseObject
|
||||||
// Contact-id is the uid-dependant author contact
|
// Contact-id is the uid-dependant author contact
|
||||||
if (local_user() == $uid) {
|
if (local_user() == $uid) {
|
||||||
$item_contact_id = $owner_self_contact['id'];
|
$item_contact_id = $owner_self_contact['id'];
|
||||||
$item_contact = $owner_self_contact;
|
|
||||||
} else {
|
} else {
|
||||||
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
|
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
|
||||||
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
|
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
|
||||||
|
@ -3167,8 +3170,6 @@ class Item extends BaseObject
|
||||||
$item["mention"] = 1;
|
$item["mention"] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "";
|
|
||||||
|
|
||||||
$fields = [];
|
$fields = [];
|
||||||
|
|
||||||
foreach ($item as $field => $data) {
|
foreach ($item as $field => $data) {
|
||||||
|
|
|
@ -172,7 +172,6 @@ class Photo extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function getImageForPhoto(array $photo)
|
public static function getImageForPhoto(array $photo)
|
||||||
{
|
{
|
||||||
$data = "";
|
|
||||||
if ($photo["backend-class"] == "") {
|
if ($photo["backend-class"] == "") {
|
||||||
// legacy data storage in "data" column
|
// legacy data storage in "data" column
|
||||||
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
|
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
|
||||||
|
@ -268,7 +267,6 @@ class Photo extends BaseObject
|
||||||
// if is an existing photo, reuse same backend
|
// if is an existing photo, reuse same backend
|
||||||
$data = "";
|
$data = "";
|
||||||
$backend_ref = "";
|
$backend_ref = "";
|
||||||
$backend_class = "";
|
|
||||||
|
|
||||||
if (DBA::isResult($existing_photo)) {
|
if (DBA::isResult($existing_photo)) {
|
||||||
$backend_ref = (string)$existing_photo["backend-ref"];
|
$backend_ref = (string)$existing_photo["backend-ref"];
|
||||||
|
@ -276,6 +274,7 @@ class Photo extends BaseObject
|
||||||
} else {
|
} else {
|
||||||
$backend_class = StorageManager::getBackend();
|
$backend_class = StorageManager::getBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($backend_class === "") {
|
if ($backend_class === "") {
|
||||||
$data = $Image->asString();
|
$data = $Image->asString();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -745,14 +745,8 @@ class Profile
|
||||||
|
|
||||||
public static function getAdvanced(App $a)
|
public static function getAdvanced(App $a)
|
||||||
{
|
{
|
||||||
$o = '';
|
|
||||||
$uid = $a->profile['uid'];
|
$uid = $a->profile['uid'];
|
||||||
|
|
||||||
$o .= Renderer::replaceMacros(
|
|
||||||
Renderer::getMarkupTemplate('section_title.tpl'),
|
|
||||||
['$title' => L10n::t('Profile')]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($a->profile['name']) {
|
if ($a->profile['name']) {
|
||||||
$tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');
|
$tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ class Filesystem implements IStorage
|
||||||
if (!mkdir($path, 0770, true)) {
|
if (!mkdir($path, 0770, true)) {
|
||||||
Logger::log('Failed to create dirs ' . $path);
|
Logger::log('Failed to create dirs ' . $path);
|
||||||
throw new StorageException(L10n::t('Filesystem storage failed to create "%s". Check you write permissions.', $path));
|
throw new StorageException(L10n::t('Filesystem storage failed to create "%s". Check you write permissions.', $path));
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +99,6 @@ class Filesystem implements IStorage
|
||||||
if ($r === FALSE) {
|
if ($r === FALSE) {
|
||||||
Logger::log('Failed to write data to ' . $file);
|
Logger::log('Failed to write data to ' . $file);
|
||||||
throw new StorageException(L10n::t('Filesystem storage failed to save data to "%s". Check your write permissions', $file));
|
throw new StorageException(L10n::t('Filesystem storage failed to save data to "%s". Check your write permissions', $file));
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
return $ref;
|
return $ref;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,7 +438,6 @@ class User
|
||||||
$return = ['user' => null, 'password' => ''];
|
$return = ['user' => null, 'password' => ''];
|
||||||
|
|
||||||
$using_invites = Config::get('system', 'invitation_only');
|
$using_invites = Config::get('system', 'invitation_only');
|
||||||
$num_invites = Config::get('system', 'number_invites');
|
|
||||||
|
|
||||||
$invite_id = !empty($data['invite_id']) ? Strings::escapeTags(trim($data['invite_id'])) : '';
|
$invite_id = !empty($data['invite_id']) ? Strings::escapeTags(trim($data['invite_id'])) : '';
|
||||||
$username = !empty($data['username']) ? Strings::escapeTags(trim($data['username'])) : '';
|
$username = !empty($data['username']) ? Strings::escapeTags(trim($data['username'])) : '';
|
||||||
|
@ -501,8 +500,6 @@ class User
|
||||||
$openid_url = '';
|
$openid_url = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$err = '';
|
|
||||||
|
|
||||||
// collapse multiple spaces in name
|
// collapse multiple spaces in name
|
||||||
$username = preg_replace('/ +/', ' ', $username);
|
$username = preg_replace('/ +/', ' ', $username);
|
||||||
|
|
||||||
|
@ -826,8 +823,6 @@ class User
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
Logger::log('Removing user: ' . $uid);
|
Logger::log('Removing user: ' . $uid);
|
||||||
|
|
||||||
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
|
||||||
|
|
|
@ -310,7 +310,7 @@ class Contact extends BaseModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
|
DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
|
||||||
|
|
||||||
// Update the entry in the contact table
|
// Update the entry in the contact table
|
||||||
Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
|
Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
|
||||||
|
@ -470,7 +470,6 @@ class Contact extends BaseModule
|
||||||
$_SESSION['return_path'] = $a->query_string;
|
$_SESSION['return_path'] = $a->query_string;
|
||||||
|
|
||||||
if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
|
if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
|
||||||
$contact_id = $a->data['contact']['id'];
|
|
||||||
$contact = $a->data['contact'];
|
$contact = $a->data['contact'];
|
||||||
|
|
||||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
|
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
|
||||||
|
@ -632,7 +631,6 @@ class Contact extends BaseModule
|
||||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
|
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
|
||||||
'$notify' => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
|
'$notify' => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
|
||||||
'$fetch_further_information' => $fetch_further_information,
|
'$fetch_further_information' => $fetch_further_information,
|
||||||
'$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
|
|
||||||
'$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
|
'$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
|
||||||
'$photo' => $contact['photo'],
|
'$photo' => $contact['photo'],
|
||||||
'$name' => $contact['name'],
|
'$name' => $contact['name'],
|
||||||
|
|
|
@ -101,13 +101,13 @@ class Proxy extends BaseModule
|
||||||
|
|
||||||
// If there is an error then return a blank image
|
// If there is an error then return a blank image
|
||||||
if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || (!$img_str)) {
|
if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || (!$img_str)) {
|
||||||
self::responseError($request);
|
self::responseError();
|
||||||
// stop.
|
// stop.
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = new Image($img_str, $mime);
|
$image = new Image($img_str, $mime);
|
||||||
if (!$image->isValid()) {
|
if (!$image->isValid()) {
|
||||||
self::responseError($request);
|
self::responseError();
|
||||||
// stop.
|
// stop.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,6 @@ class Proxy extends BaseModule
|
||||||
private static function getRequestInfo()
|
private static function getRequestInfo()
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
$url = '';
|
|
||||||
$size = 1024;
|
$size = 1024;
|
||||||
$sizetype = '';
|
$sizetype = '';
|
||||||
|
|
||||||
|
|
|
@ -1302,7 +1302,6 @@ class Probe
|
||||||
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
|
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pubkey = "";
|
|
||||||
if (is_array($webfinger["links"])) {
|
if (is_array($webfinger["links"])) {
|
||||||
// The array is reversed to take into account the order of preference for same-rel links
|
// The array is reversed to take into account the order of preference for same-rel links
|
||||||
// See: https://tools.ietf.org/html/rfc7033#section-4.4.4
|
// See: https://tools.ietf.org/html/rfc7033#section-4.4.4
|
||||||
|
|
|
@ -298,8 +298,6 @@ class Image
|
||||||
$width = $this->getWidth();
|
$width = $this->getWidth();
|
||||||
$height = $this->getHeight();
|
$height = $this->getHeight();
|
||||||
|
|
||||||
$dest_width = $dest_height = 0;
|
|
||||||
|
|
||||||
if ((! $width)|| (! $height)) {
|
if ((! $width)|| (! $height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -502,8 +500,6 @@ class Image
|
||||||
$width = $this->getWidth();
|
$width = $this->getWidth();
|
||||||
$height = $this->getHeight();
|
$height = $this->getHeight();
|
||||||
|
|
||||||
$dest_width = $dest_height = 0;
|
|
||||||
|
|
||||||
if ((!$width)|| (!$height)) {
|
if ((!$width)|| (!$height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -693,8 +689,6 @@ class Image
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$quality = false;
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
// Enable interlacing
|
// Enable interlacing
|
||||||
|
@ -736,7 +730,6 @@ class Image
|
||||||
Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG);
|
Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG);
|
||||||
$type = null;
|
$type = null;
|
||||||
if ($fromcurl) {
|
if ($fromcurl) {
|
||||||
$a = \get_app();
|
|
||||||
$headers=[];
|
$headers=[];
|
||||||
$h = explode("\n", $header);
|
$h = explode("\n", $header);
|
||||||
foreach ($h as $l) {
|
foreach ($h as $l) {
|
||||||
|
@ -835,8 +828,6 @@ class Image
|
||||||
*/
|
*/
|
||||||
public static function getScalingDimensions($width, $height, $max)
|
public static function getScalingDimensions($width, $height, $max)
|
||||||
{
|
{
|
||||||
$dest_width = $dest_height = 0;
|
|
||||||
|
|
||||||
if ((!$width) || (!$height)) {
|
if ((!$width) || (!$height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -967,8 +958,6 @@ class Image
|
||||||
|
|
||||||
$hash = Photo::newResource();
|
$hash = Photo::newResource();
|
||||||
|
|
||||||
$smallest = 0;
|
|
||||||
|
|
||||||
// Pictures are always public by now
|
// Pictures are always public by now
|
||||||
//$defperm = '<'.$default_cid.'>';
|
//$defperm = '<'.$default_cid.'>';
|
||||||
$defperm = "";
|
$defperm = "";
|
||||||
|
|
|
@ -789,7 +789,7 @@ class Post extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conv->isWritable() && $this->isWritable()) {
|
if ($conv->isWritable() && $this->isWritable()) {
|
||||||
$qc = $qcomment = null;
|
$qcomment = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hmmm, code depending on the presence of a particular addon?
|
* Hmmm, code depending on the presence of a particular addon?
|
||||||
|
|
|
@ -178,9 +178,7 @@ class Thread extends BaseObject
|
||||||
*/
|
*/
|
||||||
public function getTemplateData($conv_responses)
|
public function getTemplateData($conv_responses)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
|
||||||
$result = [];
|
$result = [];
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
foreach ($this->parents as $item) {
|
foreach ($this->parents as $item) {
|
||||||
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
|
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
|
||||||
|
|
|
@ -477,8 +477,6 @@ class Processor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
|
||||||
|
|
||||||
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
||||||
if (empty($cid)) {
|
if (empty($cid)) {
|
||||||
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
||||||
|
@ -513,8 +511,6 @@ class Processor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
|
||||||
|
|
||||||
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
$cid = Contact::getIdForURL($activity['actor'], $uid);
|
||||||
if (empty($cid)) {
|
if (empty($cid)) {
|
||||||
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
|
||||||
|
|
|
@ -379,15 +379,15 @@ class Receiver
|
||||||
if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
|
if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
|
||||||
ActivityPub\Processor::updateItem($object_data);
|
ActivityPub\Processor::updateItem($object_data);
|
||||||
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
|
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
|
||||||
ActivityPub\Processor::updatePerson($object_data, $body);
|
ActivityPub\Processor::updatePerson($object_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'as:Delete':
|
case 'as:Delete':
|
||||||
if ($object_data['object_type'] == 'as:Tombstone') {
|
if ($object_data['object_type'] == 'as:Tombstone') {
|
||||||
ActivityPub\Processor::deleteItem($object_data, $body);
|
ActivityPub\Processor::deleteItem($object_data);
|
||||||
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
|
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
|
||||||
ActivityPub\Processor::deletePerson($object_data, $body);
|
ActivityPub\Processor::deletePerson($object_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -354,8 +354,6 @@ class Transmitter
|
||||||
} else {
|
} else {
|
||||||
$receiver_list = Item::enumeratePermissions($item);
|
$receiver_list = Item::enumeratePermissions($item);
|
||||||
|
|
||||||
$mentioned = [];
|
|
||||||
|
|
||||||
foreach ($terms as $term) {
|
foreach ($terms as $term) {
|
||||||
$cid = Contact::getIdForURL($term['url'], $item['uid']);
|
$cid = Contact::getIdForURL($term['url'], $item['uid']);
|
||||||
if (!empty($cid) && in_array($cid, $receiver_list)) {
|
if (!empty($cid) && in_array($cid, $receiver_list)) {
|
||||||
|
|
|
@ -181,24 +181,19 @@ class DFRN
|
||||||
|
|
||||||
$owner = $r[0];
|
$owner = $r[0];
|
||||||
$owner_id = $owner['uid'];
|
$owner_id = $owner['uid'];
|
||||||
$owner_nick = $owner['nickname'];
|
|
||||||
|
|
||||||
$sql_post_table = "";
|
$sql_post_table = "";
|
||||||
|
|
||||||
if (! $public_feed) {
|
if (! $public_feed) {
|
||||||
$sql_extra = '';
|
|
||||||
switch ($direction) {
|
switch ($direction) {
|
||||||
case (-1):
|
case (-1):
|
||||||
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
|
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
|
||||||
$my_id = $dfrn_id;
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
|
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
|
||||||
$my_id = '1:' . $dfrn_id;
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
|
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
|
||||||
$my_id = '0:' . $dfrn_id;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -244,7 +239,6 @@ class DFRN
|
||||||
intval(TERM_CATEGORY),
|
intval(TERM_CATEGORY),
|
||||||
intval($owner_id)
|
intval($owner_id)
|
||||||
);
|
);
|
||||||
//$sql_extra .= FileTag::fileQuery('item',$category,'category');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($public_feed && ! $converse) {
|
if ($public_feed && ! $converse) {
|
||||||
|
@ -1179,8 +1173,6 @@ class DFRN
|
||||||
*/
|
*/
|
||||||
public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
|
public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
// At first try the Diaspora transport layer
|
// At first try the Diaspora transport layer
|
||||||
if (!$dissolve && !$legacy_transport) {
|
if (!$dissolve && !$legacy_transport) {
|
||||||
$curlResult = self::transmit($owner, $contact, $atom);
|
$curlResult = self::transmit($owner, $contact, $atom);
|
||||||
|
@ -1205,7 +1197,6 @@ class DFRN
|
||||||
Logger::log("Local rino version: ". $rino, Logger::DEBUG);
|
Logger::log("Local rino version: ". $rino, Logger::DEBUG);
|
||||||
|
|
||||||
$ssl_val = intval(Config::get('system', 'ssl_policy'));
|
$ssl_val = intval(Config::get('system', 'ssl_policy'));
|
||||||
$ssl_policy = '';
|
|
||||||
|
|
||||||
switch ($ssl_val) {
|
switch ($ssl_val) {
|
||||||
case SSL_POLICY_FULL:
|
case SSL_POLICY_FULL:
|
||||||
|
@ -1442,8 +1433,6 @@ class DFRN
|
||||||
*/
|
*/
|
||||||
public static function transmit($owner, $contact, $atom, $public_batch = false)
|
public static function transmit($owner, $contact, $atom, $public_batch = false)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
if (!$public_batch) {
|
if (!$public_batch) {
|
||||||
if (empty($contact['addr'])) {
|
if (empty($contact['addr'])) {
|
||||||
Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
||||||
|
@ -1708,7 +1697,6 @@ class DFRN
|
||||||
|
|
||||||
if (strtotime($value) < time()) {
|
if (strtotime($value) < time()) {
|
||||||
$value = str_replace($bdyear, $bdyear + 1, $value);
|
$value = str_replace($bdyear, $bdyear + 1, $value);
|
||||||
$bdyear = $bdyear + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$poco["bd"] = $value;
|
$poco["bd"] = $value;
|
||||||
|
@ -1920,8 +1908,6 @@ class DFRN
|
||||||
*/
|
*/
|
||||||
private static function processSuggestion($xpath, $suggestion, $importer)
|
private static function processSuggestion($xpath, $suggestion, $importer)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
Logger::log("Processing suggestions");
|
Logger::log("Processing suggestions");
|
||||||
|
|
||||||
/// @TODO Rewrite this to one statement
|
/// @TODO Rewrite this to one statement
|
||||||
|
@ -1995,7 +1981,7 @@ class DFRN
|
||||||
|
|
||||||
$hash = Strings::getRandomHex();
|
$hash = Strings::getRandomHex();
|
||||||
|
|
||||||
$r = q(
|
q(
|
||||||
"INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
|
"INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
|
||||||
VALUES(%d, %d, %d, '%s', '%s', '%s', %d)",
|
VALUES(%d, %d, %d, '%s', '%s', '%s', %d)",
|
||||||
intval($suggest["uid"]),
|
intval($suggest["uid"]),
|
||||||
|
@ -2408,8 +2394,6 @@ class DFRN
|
||||||
$item["plink"] = $href;
|
$item["plink"] = $href;
|
||||||
break;
|
break;
|
||||||
case "enclosure":
|
case "enclosure":
|
||||||
$enclosure = $href;
|
|
||||||
|
|
||||||
if (!empty($item["attach"])) {
|
if (!empty($item["attach"])) {
|
||||||
$item["attach"] .= ",";
|
$item["attach"] .= ",";
|
||||||
} else {
|
} else {
|
||||||
|
@ -2596,8 +2580,6 @@ class DFRN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$enclosure = "";
|
|
||||||
|
|
||||||
$links = $xpath->query("atom:link", $entry);
|
$links = $xpath->query("atom:link", $entry);
|
||||||
if ($links) {
|
if ($links) {
|
||||||
self::parseLinks($links, $item);
|
self::parseLinks($links, $item);
|
||||||
|
@ -2713,8 +2695,6 @@ class DFRN
|
||||||
|
|
||||||
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
||||||
$posted_id = Item::insert($item);
|
$posted_id = Item::insert($item);
|
||||||
$parent = 0;
|
|
||||||
|
|
||||||
if ($posted_id) {
|
if ($posted_id) {
|
||||||
Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
|
Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
|
||||||
|
|
||||||
|
|
|
@ -748,8 +748,6 @@ class Diaspora
|
||||||
Logger::log("Unknown message type ".$type);
|
Logger::log("Unknown message type ".$type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2354,8 +2352,6 @@ class Diaspora
|
||||||
*/
|
*/
|
||||||
private static function receiveRequestMakeFriend(array $importer, array $contact)
|
private static function receiveRequestMakeFriend(array $importer, array $contact)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
if ($contact["rel"] == Contact::SHARING) {
|
if ($contact["rel"] == Contact::SHARING) {
|
||||||
DBA::update(
|
DBA::update(
|
||||||
'contact',
|
'contact',
|
||||||
|
@ -2415,7 +2411,7 @@ class Diaspora
|
||||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||||
if (DBA::isResult($user)) {
|
if (DBA::isResult($user)) {
|
||||||
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
||||||
$ret = self::sendShare($user, $contact);
|
self::sendShare($user, $contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2449,7 +2445,7 @@ class Diaspora
|
||||||
|
|
||||||
$batch = (($ret["batch"]) ? $ret["batch"] : implode("/", array_slice(explode("/", $ret["url"]), 0, 3))."/receive/public");
|
$batch = (($ret["batch"]) ? $ret["batch"] : implode("/", array_slice(explode("/", $ret["url"]), 0, 3))."/receive/public");
|
||||||
|
|
||||||
$r = q(
|
q(
|
||||||
"INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`)
|
"INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`)
|
||||||
VALUES (%d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d)",
|
VALUES (%d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d)",
|
||||||
intval($importer["uid"]),
|
intval($importer["uid"]),
|
||||||
|
@ -2489,7 +2485,7 @@ class Diaspora
|
||||||
|
|
||||||
$hash = Strings::getRandomHex().(string)time(); // Generate a confirm_key
|
$hash = Strings::getRandomHex().(string)time(); // Generate a confirm_key
|
||||||
|
|
||||||
$ret = q(
|
q(
|
||||||
"INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
"INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
|
||||||
VALUES (%d, %d, %d, %d, '%s', '%s', '%s')",
|
VALUES (%d, %d, %d, %d, '%s', '%s', '%s')",
|
||||||
intval($importer["uid"]),
|
intval($importer["uid"]),
|
||||||
|
@ -2520,7 +2516,7 @@ class Diaspora
|
||||||
$new_relation = Contact::FOLLOWER;
|
$new_relation = Contact::FOLLOWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q(
|
q(
|
||||||
"UPDATE `contact` SET `rel` = %d,
|
"UPDATE `contact` SET `rel` = %d,
|
||||||
`name-date` = '%s',
|
`name-date` = '%s',
|
||||||
`uri-date` = '%s',
|
`uri-date` = '%s',
|
||||||
|
@ -2538,7 +2534,7 @@ class Diaspora
|
||||||
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
|
||||||
if (DBA::isResult($user)) {
|
if (DBA::isResult($user)) {
|
||||||
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
|
||||||
$ret = self::sendShare($user, $contact_record);
|
self::sendShare($user, $contact_record);
|
||||||
|
|
||||||
// Send the profile data, maybe it weren't transmitted before
|
// Send the profile data, maybe it weren't transmitted before
|
||||||
self::sendProfile($importer["uid"], [$contact_record]);
|
self::sendProfile($importer["uid"], [$contact_record]);
|
||||||
|
@ -3127,8 +3123,6 @@ class Diaspora
|
||||||
*/
|
*/
|
||||||
public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false)
|
public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$enabled = intval(Config::get("system", "diaspora_enabled"));
|
$enabled = intval(Config::get("system", "diaspora_enabled"));
|
||||||
if (!$enabled) {
|
if (!$enabled) {
|
||||||
return 200;
|
return 200;
|
||||||
|
@ -3871,15 +3865,14 @@ class Diaspora
|
||||||
// Remove the handle
|
// Remove the handle
|
||||||
$handle = array_pop($signed_parts);
|
$handle = array_pop($signed_parts);
|
||||||
|
|
||||||
// Glue the parts together
|
$message = [
|
||||||
$text = implode(";", $signed_parts);
|
"author" => $handle,
|
||||||
|
"guid" => $guid,
|
||||||
$message = ["author" => $handle,
|
"parent_guid" => $parent_guid,
|
||||||
"guid" => $guid,
|
"text" => implode(";", $signed_parts),
|
||||||
"parent_guid" => $parent_guid,
|
"author_signature" => $item['signature'],
|
||||||
"text" => implode(";", $signed_parts),
|
"parent_author_signature" => ""
|
||||||
"author_signature" => $item['signature'],
|
];
|
||||||
"parent_author_signature" => ""];
|
|
||||||
}
|
}
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
@ -3996,14 +3989,6 @@ class Diaspora
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$conv = [
|
|
||||||
"author" => $cnv["creator"],
|
|
||||||
"guid" => $cnv["guid"],
|
|
||||||
"subject" => $cnv["subject"],
|
|
||||||
"created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
|
|
||||||
"participants" => $cnv["recips"]
|
|
||||||
];
|
|
||||||
|
|
||||||
$body = BBCode::toMarkdown($item["body"]);
|
$body = BBCode::toMarkdown($item["body"]);
|
||||||
$created = DateTimeFormat::utc($item["created"], DateTimeFormat::ATOM);
|
$created = DateTimeFormat::utc($item["created"], DateTimeFormat::ATOM);
|
||||||
|
|
||||||
|
@ -4020,12 +4005,13 @@ class Diaspora
|
||||||
$type = "message";
|
$type = "message";
|
||||||
} else {
|
} else {
|
||||||
$message = [
|
$message = [
|
||||||
"author" => $cnv["creator"],
|
"author" => $cnv["creator"],
|
||||||
"guid" => $cnv["guid"],
|
"guid" => $cnv["guid"],
|
||||||
"subject" => $cnv["subject"],
|
"subject" => $cnv["subject"],
|
||||||
"created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
|
"created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
|
||||||
"participants" => $cnv["recips"],
|
"participants" => $cnv["recips"],
|
||||||
"message" => $msg];
|
"message" => $msg
|
||||||
|
];
|
||||||
|
|
||||||
$type = "conversation";
|
$type = "conversation";
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,8 +178,6 @@ class Email
|
||||||
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
|
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
|
||||||
global $htmlmsg,$plainmsg,$charset,$attachments;
|
global $htmlmsg,$plainmsg,$charset,$attachments;
|
||||||
|
|
||||||
//echo $partno."\n";
|
|
||||||
|
|
||||||
// DECODE DATA
|
// DECODE DATA
|
||||||
$data = ($partno)
|
$data = ($partno)
|
||||||
? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
|
? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
|
||||||
|
@ -247,9 +245,6 @@ class Email
|
||||||
$x = "";
|
$x = "";
|
||||||
foreach ($p->parts as $partno0 => $p2) {
|
foreach ($p->parts as $partno0 => $p2) {
|
||||||
$x .= self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
|
$x .= self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
|
||||||
//if ($x) {
|
|
||||||
// return $x;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
@ -559,26 +554,6 @@ class Email
|
||||||
$nextline = ltrim(substr($nextline, 1));
|
$nextline = ltrim(substr($nextline, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$firstword = strpos($nextline.' ', ' ');
|
|
||||||
|
|
||||||
$specialchars = ((substr(trim($nextline), 0, 1) == '-') ||
|
|
||||||
(substr(trim($nextline), 0, 1) == '=') ||
|
|
||||||
(substr(trim($nextline), 0, 1) == '*') ||
|
|
||||||
(substr(trim($nextline), 0, 1) == '·') ||
|
|
||||||
(substr(trim($nextline), 0, 4) == '[url') ||
|
|
||||||
(substr(trim($nextline), 0, 5) == '[size') ||
|
|
||||||
(substr(trim($nextline), 0, 7) == 'http://') ||
|
|
||||||
(substr(trim($nextline), 0, 8) == 'https://'));
|
|
||||||
|
|
||||||
if (!$specialchars) {
|
|
||||||
$specialchars = ((substr(rtrim($line), -1) == '-') ||
|
|
||||||
(substr(rtrim($line), -1) == '=') ||
|
|
||||||
(substr(rtrim($line), -1) == '*') ||
|
|
||||||
(substr(rtrim($line), -1) == '·') ||
|
|
||||||
(substr(rtrim($line), -6) == '[/url]') ||
|
|
||||||
(substr(rtrim($line), -7) == '[/size]'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($lines[$lineno])) {
|
if (!empty($lines[$lineno])) {
|
||||||
if (substr($lines[$lineno], -1) != ' ') {
|
if (substr($lines[$lineno], -1) != ' ') {
|
||||||
$lines[$lineno] .= ' ';
|
$lines[$lineno] .= ' ';
|
||||||
|
@ -625,13 +600,11 @@ class Email
|
||||||
}
|
}
|
||||||
|
|
||||||
$quotelevel = 0;
|
$quotelevel = 0;
|
||||||
$previousquote = 0;
|
|
||||||
$arrbodyquoted = [];
|
$arrbodyquoted = [];
|
||||||
|
|
||||||
for ($i = 0; $i < count($arrbody); $i++) {
|
for ($i = 0; $i < count($arrbody); $i++) {
|
||||||
$previousquote = $quotelevel;
|
$previousquote = $quotelevel;
|
||||||
$quotelevel = $arrlevel[$i];
|
$quotelevel = $arrlevel[$i];
|
||||||
$currline = $arrbody[$i];
|
|
||||||
|
|
||||||
while ($previousquote < $quotelevel) {
|
while ($previousquote < $quotelevel) {
|
||||||
$quote = "[quote]";
|
$quote = "[quote]";
|
||||||
|
|
|
@ -318,7 +318,6 @@ class Feed {
|
||||||
$href = "";
|
$href = "";
|
||||||
$length = "";
|
$length = "";
|
||||||
$type = "";
|
$type = "";
|
||||||
$title = "";
|
|
||||||
|
|
||||||
foreach ($enclosure->attributes AS $attribute) {
|
foreach ($enclosure->attributes AS $attribute) {
|
||||||
if (in_array($attribute->name, ["url", "href"])) {
|
if (in_array($attribute->name, ["url", "href"])) {
|
||||||
|
|
|
@ -398,8 +398,6 @@ class OStatus
|
||||||
$authordata = $xpath->query('//author')->item(0);
|
$authordata = $xpath->query('//author')->item(0);
|
||||||
$author = self::fetchAuthor($xpath, $authordata, $importer, $contact, $stored);
|
$author = self::fetchAuthor($xpath, $authordata, $importer, $contact, $stored);
|
||||||
|
|
||||||
$entry = $xpath->query('/atom:entry');
|
|
||||||
|
|
||||||
// Reverse the order of the entries
|
// Reverse the order of the entries
|
||||||
$entrylist = [];
|
$entrylist = [];
|
||||||
|
|
||||||
|
@ -528,7 +526,6 @@ class OStatus
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
$default_contact = 0;
|
$default_contact = 0;
|
||||||
$key = count(self::$itemlist);
|
|
||||||
for ($key = count(self::$itemlist) - 1; $key >= 0; $key--) {
|
for ($key = count(self::$itemlist) - 1; $key >= 0; $key--) {
|
||||||
if (empty(self::$itemlist[$key]['contact-id'])) {
|
if (empty(self::$itemlist[$key]['contact-id'])) {
|
||||||
self::$itemlist[$key]['contact-id'] = $default_contact;
|
self::$itemlist[$key]['contact-id'] = $default_contact;
|
||||||
|
@ -1191,7 +1188,6 @@ class OStatus
|
||||||
} else {
|
} else {
|
||||||
return "http://".$server[0]."/notice/".$conversation[1];
|
return "http://".$server[0]."/notice/".$conversation[1];
|
||||||
}
|
}
|
||||||
return $href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1287,8 +1283,6 @@ class OStatus
|
||||||
*/
|
*/
|
||||||
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
|
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$root = $doc->createElementNS(NAMESPACE_ATOM1, 'feed');
|
$root = $doc->createElementNS(NAMESPACE_ATOM1, 'feed');
|
||||||
$doc->appendChild($root);
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
@ -1699,7 +1693,7 @@ class OStatus
|
||||||
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
|
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
||||||
|
|
||||||
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
|
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
|
||||||
'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
|
'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
|
||||||
|
@ -1764,7 +1758,7 @@ class OStatus
|
||||||
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
|
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
self::entryHeader($doc, $entry, $owner, $item, $toplevel);
|
||||||
|
|
||||||
$verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
|
$verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
|
||||||
self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
|
self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
|
||||||
|
|
|
@ -63,8 +63,6 @@ class PortableContact
|
||||||
*/
|
*/
|
||||||
public static function load($cid, $uid, $zcid, $url)
|
public static function load($cid, $uid, $zcid, $url)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
if (!$url || !$uid) {
|
if (!$url || !$uid) {
|
||||||
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
|
||||||
|
@ -230,7 +228,6 @@ class PortableContact
|
||||||
$friendica = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $profile);
|
$friendica = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $profile);
|
||||||
if ($friendica != $profile) {
|
if ($friendica != $profile) {
|
||||||
$server_url = $friendica;
|
$server_url = $friendica;
|
||||||
$network = Protocol::DFRN;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +235,6 @@ class PortableContact
|
||||||
$diaspora = preg_replace("=(https?://)(.*)/u/(.*)=ism", "$1$2", $profile);
|
$diaspora = preg_replace("=(https?://)(.*)/u/(.*)=ism", "$1$2", $profile);
|
||||||
if ($diaspora != $profile) {
|
if ($diaspora != $profile) {
|
||||||
$server_url = $diaspora;
|
$server_url = $diaspora;
|
||||||
$network = Protocol::DIASPORA;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +242,6 @@ class PortableContact
|
||||||
$red = preg_replace("=(https?://)(.*)/channel/(.*)=ism", "$1$2", $profile);
|
$red = preg_replace("=(https?://)(.*)/channel/(.*)=ism", "$1$2", $profile);
|
||||||
if ($red != $profile) {
|
if ($red != $profile) {
|
||||||
$server_url = $red;
|
$server_url = $red;
|
||||||
$network = Protocol::DIASPORA;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +250,6 @@ class PortableContact
|
||||||
$mastodon = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
|
$mastodon = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
|
||||||
if ($mastodon != $profile) {
|
if ($mastodon != $profile) {
|
||||||
$server_url = $mastodon;
|
$server_url = $mastodon;
|
||||||
$network = Protocol::OSTATUS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +258,6 @@ class PortableContact
|
||||||
$ostatus = preg_replace("=(https?://)(.*)/user/(.*)=ism", "$1$2", $profile);
|
$ostatus = preg_replace("=(https?://)(.*)/user/(.*)=ism", "$1$2", $profile);
|
||||||
if ($ostatus != $profile) {
|
if ($ostatus != $profile) {
|
||||||
$server_url = $ostatus;
|
$server_url = $ostatus;
|
||||||
$network = Protocol::OSTATUS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +266,6 @@ class PortableContact
|
||||||
$base = preg_replace("=(https?://)(.*?)/(.*)=ism", "$1$2", $profile);
|
$base = preg_replace("=(https?://)(.*?)/(.*)=ism", "$1$2", $profile);
|
||||||
if ($base != $profile) {
|
if ($base != $profile) {
|
||||||
$server_url = $base;
|
$server_url = $base;
|
||||||
$network = Protocol::PHANTOM;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,8 +601,6 @@ class PortableContact
|
||||||
*/
|
*/
|
||||||
private static function detectPocoData(array $data)
|
private static function detectPocoData(array $data)
|
||||||
{
|
{
|
||||||
$server = false;
|
|
||||||
|
|
||||||
if (!isset($data['entry'])) {
|
if (!isset($data['entry'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,6 @@ class Network
|
||||||
*/
|
*/
|
||||||
public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
|
public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
|
||||||
{
|
{
|
||||||
$ret = ['return_code' => 0, 'success' => false, 'header' => '', 'info' => '', 'body' => ''];
|
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
|
|
||||||
$a = \get_app();
|
$a = \get_app();
|
||||||
|
@ -322,7 +320,6 @@ class Network
|
||||||
|
|
||||||
$s = @curl_exec($ch);
|
$s = @curl_exec($ch);
|
||||||
|
|
||||||
$base = $s;
|
|
||||||
$curl_info = curl_getinfo($ch);
|
$curl_info = curl_getinfo($ch);
|
||||||
|
|
||||||
$curlResponse = new CurlResult($url, $s, $curl_info, curl_errno($ch), curl_error($ch));
|
$curlResponse = new CurlResult($url, $s, $curl_info, curl_errno($ch), curl_error($ch));
|
||||||
|
|
|
@ -113,8 +113,6 @@ class ParseUrl
|
||||||
*/
|
*/
|
||||||
public static function getSiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1)
|
public static function getSiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$siteinfo = [];
|
$siteinfo = [];
|
||||||
|
|
||||||
// Check if the URL does contain a scheme
|
// Check if the URL does contain a scheme
|
||||||
|
|
|
@ -287,9 +287,6 @@ class XML
|
||||||
|
|
||||||
//Initializations
|
//Initializations
|
||||||
$xml_array = [];
|
$xml_array = [];
|
||||||
$parents = [];
|
|
||||||
$opened_tags = [];
|
|
||||||
$arr = [];
|
|
||||||
|
|
||||||
$current = &$xml_array; // Reference
|
$current = &$xml_array; // Reference
|
||||||
|
|
||||||
|
|
|
@ -143,13 +143,11 @@ class Cron
|
||||||
$manual_id = 0;
|
$manual_id = 0;
|
||||||
$generation = 0;
|
$generation = 0;
|
||||||
$force = false;
|
$force = false;
|
||||||
$restart = false;
|
|
||||||
|
|
||||||
if ($parameter == 'force') {
|
if ($parameter == 'force') {
|
||||||
$force = true;
|
$force = true;
|
||||||
}
|
}
|
||||||
if ($parameter == 'restart') {
|
if ($parameter == 'restart') {
|
||||||
$restart = true;
|
|
||||||
$generation = intval($generation);
|
$generation = intval($generation);
|
||||||
if (!$generation) {
|
if (!$generation) {
|
||||||
exit();
|
exit();
|
||||||
|
@ -167,8 +165,6 @@ class Cron
|
||||||
|
|
||||||
Addon::reload();
|
Addon::reload();
|
||||||
|
|
||||||
$d = DateTimeFormat::utcNow();
|
|
||||||
|
|
||||||
// Only poll from those with suitable relationships,
|
// Only poll from those with suitable relationships,
|
||||||
// and which have a polling address and ignore Diaspora since
|
// and which have a polling address and ignore Diaspora since
|
||||||
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
||||||
|
|
|
@ -60,8 +60,6 @@ class DBClean {
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
private static function removeOrphans($stage) {
|
private static function removeOrphans($stage) {
|
||||||
$count = 0;
|
|
||||||
|
|
||||||
// We split the deletion in many small tasks
|
// We split the deletion in many small tasks
|
||||||
$limit = Config::get('system', 'dbclean-expire-limit', 1000);
|
$limit = Config::get('system', 'dbclean-expire-limit', 1000);
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,7 @@ class OnePoll
|
||||||
|
|
||||||
Logger::log('Start for contact ' . $contact_id);
|
Logger::log('Start for contact ' . $contact_id);
|
||||||
|
|
||||||
$manual_id = 0;
|
|
||||||
$generation = 0;
|
|
||||||
$hub_update = false;
|
|
||||||
$force = false;
|
$force = false;
|
||||||
$restart = false;
|
|
||||||
|
|
||||||
if ($command == "force") {
|
if ($command == "force") {
|
||||||
$force = true;
|
$force = true;
|
||||||
|
@ -45,7 +41,6 @@ class OnePoll
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = DateTimeFormat::utcNow();
|
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
|
@ -580,7 +575,7 @@ class OnePoll
|
||||||
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
|
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stored_item = Item::insert($datarray);
|
Item::insert($datarray);
|
||||||
|
|
||||||
switch ($mailconf['action']) {
|
switch ($mailconf['action']) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -26,8 +26,6 @@ class PubSubPublish
|
||||||
|
|
||||||
private static function publish($id)
|
private static function publish($id)
|
||||||
{
|
{
|
||||||
$a = BaseObject::getApp();
|
|
||||||
|
|
||||||
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
|
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||||
if (!DBA::isResult($subscriber)) {
|
if (!DBA::isResult($subscriber)) {
|
||||||
return;
|
return;
|
||||||
|
@ -58,8 +56,6 @@ class PubSubPublish
|
||||||
$postResult = Network::post($subscriber['callback_url'], $params, $headers);
|
$postResult = Network::post($subscriber['callback_url'], $params, $headers);
|
||||||
$ret = $postResult->getReturnCode();
|
$ret = $postResult->getReturnCode();
|
||||||
|
|
||||||
$condition = ['id' => $subscriber['id']];
|
|
||||||
|
|
||||||
if ($ret >= 200 && $ret <= 299) {
|
if ($ret >= 200 && $ret <= 299) {
|
||||||
Logger::log('Successfully pushed to ' . $subscriber['callback_url']);
|
Logger::log('Successfully pushed to ' . $subscriber['callback_url']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue