[COMPOSER] Remove some pre-composer remnants from the code

This commit is contained in:
Alexei Sorokin 2019-11-01 14:19:42 +03:00 committed by Diogo Peralta Cordeiro
parent c1bd59e243
commit ab020c7528
6 changed files with 185 additions and 256 deletions

View File

@ -1,38 +1,30 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet, the distributed open-source microblogging tool
*
* Plugin to enable Single Sign On via CAS (Central Authentication Service) * Plugin to enable Single Sign On via CAS (Central Authentication Service)
* *
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin * @category Plugin
* @package StatusNet * @package GNUsocial
* @author Craig Andrews <candrews@integralblue.com> * @author Craig Andrews <candrews@integralblue.com>
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { defined('GNUSOCIAL') || die();
exit(1);
}
// We bundle the phpCAS library...
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/CAS');
class CasAuthenticationPlugin extends AuthenticationPlugin class CasAuthenticationPlugin extends AuthenticationPlugin
{ {
@ -44,68 +36,55 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
public $takeOverLogin = false; public $takeOverLogin = false;
public $user_whitelist = null; public $user_whitelist = null;
function checkPassword($username, $password) public function checkPassword($username, $password)
{ {
global $casTempPassword; global $casTempPassword;
return ($casTempPassword == $password); return ($casTempPassword == $password);
} }
function onAutoload($cls) public function onArgsInitialize(&$args)
{ {
switch ($cls) if ($this->takeOverLogin && $args['action'] === 'login') {
{
case 'phpCAS':
require_once(INSTALLDIR.'/plugins/CasAuthentication/extlib/CAS.php');
return false;
}
// if it's not our exception, try standard places
return parent::onAutoload($cls);
}
function onArgsInitialize(&$args)
{
if($this->takeOverLogin && $args['action'] == 'login')
{
$args['action'] = 'caslogin'; $args['action'] = 'caslogin';
} }
} }
function onStartInitializeRouter($m) public function onStartInitializeRouter($m)
{ {
$m->connect('main/cas', array('action' => 'caslogin')); $m->connect('main/cas', array('action' => 'caslogin'));
return true; return true;
} }
function onEndLoginGroupNav($action) public function onEndLoginGroupNav($action)
{ {
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('caslogin'), $action->menuItem(
// TRANS: Menu item. CAS is Central Authentication Service. common_local_url('caslogin'),
_m('CAS'), // TRANS: Menu item. CAS is Central Authentication Service.
// TRANS: Tooltip for menu item. CAS is Central Authentication Service. _m('CAS'),
_m('Login or register with CAS.'), // TRANS: Tooltip for menu item. CAS is Central Authentication Service.
$action_name === 'caslogin'); _m('Login or register with CAS.'),
($action_name === 'caslogin')
);
return true; return true;
} }
function onEndShowPageNotice($action) public function onEndShowPageNotice($action)
{ {
$name = $action->trimmed('action'); $name = $action->trimmed('action');
switch ($name) switch ($name) {
{ case 'login':
case 'login': // TRANS: Invitation to users with a CAS account to log in using the service.
// TRANS: Invitation to users with a CAS account to log in using the service. // TRANS: "[CAS login]" is a link description. (%%action.caslogin%%) is the URL.
// TRANS: "[CAS login]" is a link description. (%%action.caslogin%%) is the URL. // TRANS: These two elements may not be separated.
// TRANS: These two elements may not be separated. $instr = _m('(Have an account with CAS? ' .
$instr = _m('(Have an account with CAS? ' . 'Try our [CAS login](%%action.caslogin%%)!)');
'Try our [CAS login](%%action.caslogin%%)!)'); break;
break; default:
default: return true;
return true;
} }
$output = common_markup_to_html($instr); $output = common_markup_to_html($instr);
@ -113,29 +92,29 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
return true; return true;
} }
function onLoginAction($action, &$login) public function onLoginAction($action, &$login)
{ {
switch ($action) switch ($action) {
{ case 'caslogin':
case 'caslogin': $login = true;
$login = true; return false;
return false; default:
default: return true;
return true;
} }
} }
function onInitializePlugin(){ public function onInitializePlugin()
{
parent::onInitializePlugin(); parent::onInitializePlugin();
if(!isset($this->server)){ if (!isset($this->server)) {
// TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly. // TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly.
throw new Exception(_m("Specifying a server is required.")); throw new Exception(_m("Specifying a server is required."));
} }
if(!isset($this->port)){ if (!isset($this->port)) {
// TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly. // TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly.
throw new Exception(_m("Specifying a port is required.")); throw new Exception(_m("Specifying a port is required."));
} }
if(!isset($this->path)){ if (!isset($this->path)) {
// TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly. // TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly.
throw new Exception(_m("Specifying a path is required.")); throw new Exception(_m("Specifying a path is required."));
} }

View File

@ -373,7 +373,6 @@ class EmbedPlugin extends Plugin
case 'link': case 'link':
if (!empty($embed->html) if (!empty($embed->html)
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) { && (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
require_once INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php';
$purifier = new HTMLPurifier(); $purifier = new HTMLPurifier();
// FIXME: do we allow <object> and <embed> here? we did that when we used htmLawed, // FIXME: do we allow <object> and <embed> here? we did that when we used htmLawed,
// but I'm not sure anymore... // but I'm not sure anymore...
@ -638,12 +637,16 @@ class EmbedPlugin extends Plugin
try { try {
$imgData = HTTPClient::quickGet($url); $imgData = HTTPClient::quickGet($url);
if (isset($imgData)) { if (isset($imgData)) {
list($filename, $width, $height) = $this->validateAndWriteImage($imgData, $url, $headers, list($filename, $width, $height) = $this->validateAndWriteImage(
$thumbnail->file_id); $imgData,
$url,
$headers,
$thumbnail->file_id
);
} else { } else {
throw new UnsupportedMediaException('HTTPClient returned an empty result'); throw new UnsupportedMediaException('HTTPClient returned an empty result');
} }
} catch(UnsupportedMediaException $e) { } catch (UnsupportedMediaException $e) {
// Couldn't find anything that looks like an image, nothing to do // Couldn't find anything that looks like an image, nothing to do
common_debug("Embed was not able to find an image for URL `{$url}`: " . $e->getMessage()); common_debug("Embed was not able to find an image for URL `{$url}`: " . $e->getMessage());
return false; return false;

View File

@ -1,37 +1,32 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* Laconica, the distributed open-source microblogging tool
*
* Plugin to do "real time" updates using Orbited + STOMP * Plugin to do "real time" updates using Orbited + STOMP
* *
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin * @category Plugin
* @package Laconica * @package GNUsocial
* @author Evan Prodromou <evan@controlyourself.ca> * @author Evan Prodromou <evan@status.net>
* @copyright 2009 Control Yourself, Inc. * @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://laconi.ca/
*/ */
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { defined('GNUSOCIAL') || die();
exit(1);
}
require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; require_once INSTALLDIR . '/plugins/Realtime/RealtimePlugin.php';
/** /**
* Plugin to do realtime updates using Orbited + STOMP * Plugin to do realtime updates using Orbited + STOMP
@ -39,11 +34,10 @@ require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
* This plugin pushes data to a STOMP server which is then served to the * This plugin pushes data to a STOMP server which is then served to the
* browser by the Orbited server. * browser by the Orbited server.
* *
* @category Plugin * @category Plugin
* @package Laconica * @package GNUsocial
* @author Evan Prodromou <evan@controlyourself.ca> * @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://laconi.ca/
*/ */
class OrbitedPlugin extends RealtimePlugin class OrbitedPlugin extends RealtimePlugin
{ {
@ -61,13 +55,13 @@ class OrbitedPlugin extends RealtimePlugin
protected $con = null; protected $con = null;
function onStartShowHeadElements($action) public function onStartShowHeadElements($action)
{ {
// See http://orbited.org/wiki/Deployment#Cross-SubdomainDeployment // See http://orbited.org/wiki/Deployment#Cross-SubdomainDeployment
$action->element('script', null, ' document.domain = document.domain; '); $action->element('script', null, ' document.domain = document.domain; ');
} }
function _getScripts() public function _getScripts()
{ {
$scripts = parent::_getScripts(); $scripts = parent::_getScripts();
@ -85,7 +79,7 @@ class OrbitedPlugin extends RealtimePlugin
return $scripts; return $scripts;
} }
function _updateInitialize($timeline, $user_id) public function _updateInitialize($timeline, $user_id)
{ {
$script = parent::_updateInitialize($timeline, $user_id); $script = parent::_updateInitialize($timeline, $user_id);
@ -96,10 +90,8 @@ class OrbitedPlugin extends RealtimePlugin
"\"{$timeline}\", \"{$this->webuser}\", \"{$this->webpass}\");"; "\"{$timeline}\", \"{$this->webuser}\", \"{$this->webpass}\");";
} }
function _connect() public function _connect()
{ {
require_once(INSTALLDIR.'/extlib/Stomp.php');
$url = $this->_getStompUrl(); $url = $this->_getStompUrl();
$this->con = new Stomp($url); $this->con = new Stomp($url);
@ -113,21 +105,20 @@ class OrbitedPlugin extends RealtimePlugin
} }
} }
function _publish($channel, $message) public function _publish($channel, $message)
{ {
$result = $this->con->send($channel, $result = $this->con->send($channel, json_encode($message));
json_encode($message));
return $result; return $result;
// @todo Parse and deal with result. // @todo Parse and deal with result.
} }
function _disconnect() public function _disconnect()
{ {
$this->con->disconnect(); $this->con->disconnect();
} }
function _pathToChannel($path) public function _pathToChannel($path)
{ {
if (!empty($this->channelbase)) { if (!empty($this->channelbase)) {
array_unshift($path, $this->channelbase); array_unshift($path, $this->channelbase);
@ -135,19 +126,19 @@ class OrbitedPlugin extends RealtimePlugin
return '/' . implode('/', $path); return '/' . implode('/', $path);
} }
function _getStompServer() public function _getStompServer()
{ {
return (!is_null($this->stompserver)) ? $this->stompserver : return (!is_null($this->stompserver)) ? $this->stompserver :
(!is_null($this->webserver)) ? $this->webserver : (!is_null($this->webserver)) ? $this->webserver :
common_config('site', 'server'); common_config('site', 'server');
} }
function _getStompPort() public function _getStompPort()
{ {
return (!is_null($this->stompport)) ? $this->stompport : 61613; return (!is_null($this->stompport)) ? $this->stompport : 61613;
} }
function _getStompUrl() public function _getStompUrl()
{ {
$server = $this->_getStompServer(); $server = $this->_getStompServer();
$port = $this->_getStompPort(); $port = $this->_getStompPort();

View File

@ -1,48 +1,39 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009, StatusNet, Inc.
*
* Send and receive notices using the XMPP network * Send and receive notices using the XMPP network
* *
* PHP version 7
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category IM * @category IM
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc. * @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
if (!defined('STATUSNET')) { defined('GNUSOCIAL') || die();
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
exit(1);
}
/** /**
* Plugin for XMPP * Plugin for XMPP
* *
* @category Plugin * @category Plugin
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc. * @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
class XmppPlugin extends ImPlugin class XmppPlugin extends ImPlugin
{ {
@ -59,13 +50,13 @@ class XmppPlugin extends ImPlugin
public $transport = 'xmpp'; public $transport = 'xmpp';
function getDisplayName() public function getDisplayName()
{ {
// TRANS: Plugin display name. // TRANS: Plugin display name.
return _m('XMPP/Jabber'); return _m('XMPP/Jabber');
} }
function daemonScreenname() public function daemonScreenname()
{ {
$ret = $this->user . '@' . $this->server; $ret = $this->user . '@' . $this->server;
if ($this->resource) { if ($this->resource) {
@ -75,7 +66,7 @@ class XmppPlugin extends ImPlugin
} }
} }
function validate($screenname) public function validate($screenname)
{ {
return $this->validateBaseJid($screenname, common_config('email', 'check_domain')); return $this->validateBaseJid($screenname, common_config('email', 'check_domain'));
} }
@ -156,7 +147,7 @@ class XmppPlugin extends ImPlugin
$parts = explode("/", $jid, 2); $parts = explode("/", $jid, 2);
if (count($parts) > 1) { if (count($parts) > 1) {
$resource = $parts[1]; $resource = $parts[1];
// if ($resource == '') then // if ($resource == '') then
// Warning: empty resource isn't legit. // Warning: empty resource isn't legit.
// But if we're normalizing, we may as well take it... // But if we're normalizing, we may as well take it...
} else { } else {
@ -167,7 +158,7 @@ class XmppPlugin extends ImPlugin
if ((count($node) > 2) || (count($node) == 0)) { if ((count($node) > 2) || (count($node) == 0)) {
// TRANS: Exception thrown when using too many @ signs in a Jabber ID. // TRANS: Exception thrown when using too many @ signs in a Jabber ID.
throw new Exception(_m('Invalid JID: too many @s.')); throw new Exception(_m('Invalid JID: too many @s.'));
} else if (count($node) == 1) { } elseif (count($node) == 1) {
$domain = $node[0]; $domain = $node[0];
$node = null; $node = null;
} else { } else {
@ -236,33 +227,14 @@ class XmppPlugin extends ImPlugin
return false; return false;
} }
/** public function onStartImDaemonIoManagers(&$classes)
* Load related Plugins when needed
*
* @param string $cls Name of the class to be loaded
*
* @return boolean hook value; true means continue processing, false means stop.
*/
function onAutoload($cls)
{
switch ($cls) {
case 'XMPPHP_XMPP':
require_once __DIR__ . '/extlib/XMPPHP/XMPP.php';
return false;
}
return parent::onAutoload($cls);
}
function onStartImDaemonIoManagers(&$classes)
{ {
parent::onStartImDaemonIoManagers($classes); parent::onStartImDaemonIoManagers($classes);
$classes[] = new XmppManager($this); // handles pings/reconnects $classes[] = new XmppManager($this); // handles pings/reconnects
return true; return true;
} }
function sendMessage($screenname, $body) public function sendMessage($screenname, $body)
{ {
$this->queuedConnection()->message($screenname, $body, 'chat'); $this->queuedConnection()->message($screenname, $body, 'chat');
} }
@ -274,7 +246,7 @@ class XmppPlugin extends ImPlugin
* @return QueuedXMPP * @return QueuedXMPP
* @throws Exception if server settings are invalid. * @throws Exception if server settings are invalid.
*/ */
function queuedConnection() public function queuedConnection()
{ {
if (!isset($this->server)) { if (!isset($this->server)) {
// TRANS: Exception thrown when the plugin configuration is incorrect. // TRANS: Exception thrown when the plugin configuration is incorrect.
@ -293,22 +265,20 @@ class XmppPlugin extends ImPlugin
throw new Exception(_m('You must specify a password in the configuration.')); throw new Exception(_m('You must specify a password in the configuration.'));
} }
return new QueuedXMPP($this, $this->host ? return new QueuedXMPP(
$this->host : $this,
$this->server, ($this->host ?: $this->server),
$this->port, $this->port,
$this->user, $this->user,
$this->password, $this->password,
$this->resource, $this->resource,
$this->server, $this->server,
$this->debug ? ($this->debug ? true : false),
true : false, ($this->debug ? \XMPPHP\Log::LEVEL_VERBOSE : null)
$this->debug ?
\XMPPHP\Log::LEVEL_VERBOSE : null
); );
} }
function sendNotice($screenname, Notice $notice) public function sendNotice($screenname, Notice $notice)
{ {
try { try {
$msg = $this->formatNotice($notice); $msg = $this->formatNotice($notice);
@ -351,12 +321,18 @@ class XmppPlugin extends ImPlugin
// FIXME: Why do we replace \t with ''? is it just to make it pretty? shouldn't whitespace be handled well...? // FIXME: Why do we replace \t with ''? is it just to make it pretty? shouldn't whitespace be handled well...?
$xs->raw(str_replace("\t", "", $notice->getRendered())); $xs->raw(str_replace("\t", "", $notice->getRendered()));
$xs->text(" "); $xs->text(" ");
$xs->element('a', array( $xs->element(
'href' => common_local_url('conversation', 'a',
array('id' => $notice->conversation)) . '#notice-' . $notice->id), [
'href' => common_local_url(
'conversation',
['id' => $notice->conversation]
) . '#notice-' . $notice->id,
],
// TRANS: Link description to notice in conversation. // TRANS: Link description to notice in conversation.
// TRANS: %s is a notice ID. // TRANS: %s is a notice ID.
sprintf(_m('[%u]'), $notice->id)); sprintf(_m('[%u]'), $notice->id)
);
$xs->elementEnd('body'); $xs->elementEnd('body');
$xs->elementEnd('html'); $xs->elementEnd('html');
@ -365,7 +341,7 @@ class XmppPlugin extends ImPlugin
return $html . ' ' . $entry; return $html . ' ' . $entry;
} }
function receiveRawMessage($pl) public function receiveRawMessage($pl)
{ {
$from = $this->normalize($pl['from']); $from = $this->normalize($pl['from']);
@ -390,7 +366,7 @@ class XmppPlugin extends ImPlugin
* @param string $jid JID to check * @param string $jid JID to check
* @return string an equivalent JID in normalized (lowercase) form * @return string an equivalent JID in normalized (lowercase) form
*/ */
function normalize($jid) public function normalize($jid)
{ {
try { try {
$parts = $this->splitJid($jid); $parts = $this->splitJid($jid);
@ -411,17 +387,15 @@ class XmppPlugin extends ImPlugin
* *
* @return boolean hook return * @return boolean hook return
*/ */
function onGetValidDaemons(&$daemons) public function onGetValidDaemons(&$daemons)
{ {
if (isset($this->server) && if (isset($this->server) &&
isset($this->port) && isset($this->port) &&
isset($this->user) && isset($this->user) &&
isset($this->password)) { isset($this->password)) {
array_push( array_push(
$daemons, $daemons,
INSTALLDIR INSTALLDIR . '/scripts/imdaemon.php'
. '/scripts/imdaemon.php'
); );
} }
@ -478,4 +452,3 @@ class XmppPlugin extends ImPlugin
} }
} }
} }

View File

@ -1,37 +1,30 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet, the distributed open-source microblogging tool
*
* Queue-mediated proxy class for outgoing XMPP messages. * Queue-mediated proxy class for outgoing XMPP messages.
* *
* PHP version 7
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Network * @category Network
* @package StatusNet * @package GNUsocial
* @author Brion Vibber <brion@status.net> * @author Brion Vibber <brion@status.net>
* @copyright 2010 StatusNet, Inc. * @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { defined('GNUSOCIAL') || die();
exit(1);
}
require_once dirname(__DIR__) . '/extlib/XMPPHP/XMPP.php';
use XMPPHP\XMPP; use XMPPHP\XMPP;
@ -82,7 +75,7 @@ class QueuedXMPP extends XMPP
* @param string $msg * @param string $msg
* @param null $timeout * @param null $timeout
*/ */
public function send($msg, $timeout = NULL) public function send($msg, $timeout = null)
{ {
@$this->plugin->enqueueOutgoingRaw($msg); @$this->plugin->enqueueOutgoingRaw($msg);
} }

View File

@ -1,46 +1,36 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet - the distributed open-source microblogging tool * Send and receive notices using the XMPP network
* Copyright (C) 2009, StatusNet, Inc.
* *
* Send and receive notices using the Jabber network * @category XMPP
* * @package GNUsocial
* PHP version 7
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Jabber
* @package StatusNet
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2009 StatusNet, Inc. * @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
if (!defined('STATUSNET')) { defined('GNUSOCIAL') || die();
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
exit(1);
}
require_once dirname(__DIR__) . '/extlib/XMPPHP/XMPP.php';
use XMPPHP\XMPP; use XMPPHP\XMPP;
class SharingXMPP extends XMPP class SharingXMPP extends XMPP
{ {
function getSocket() public function getSocket()
{ {
return $this->socket; return $this->socket;
} }