forked from GNUsocial/gnu-social
[COMPOSER] Remove some pre-composer remnants from the code
This commit is contained in:
parent
4903241e4b
commit
3f56459734
@ -1,38 +1,30 @@
|
||||
<?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)
|
||||
*
|
||||
* 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
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @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
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// We bundle the phpCAS library...
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/CAS');
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class CasAuthenticationPlugin extends AuthenticationPlugin
|
||||
{
|
||||
@ -44,68 +36,55 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
|
||||
public $takeOverLogin = false;
|
||||
public $user_whitelist = null;
|
||||
|
||||
function checkPassword($username, $password)
|
||||
public function checkPassword($username, $password)
|
||||
{
|
||||
global $casTempPassword;
|
||||
return ($casTempPassword == $password);
|
||||
}
|
||||
|
||||
function onAutoload($cls)
|
||||
public function onArgsInitialize(&$args)
|
||||
{
|
||||
switch ($cls)
|
||||
{
|
||||
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')
|
||||
{
|
||||
if ($this->takeOverLogin && $args['action'] === 'login') {
|
||||
$args['action'] = 'caslogin';
|
||||
}
|
||||
}
|
||||
|
||||
function onStartInitializeRouter($m)
|
||||
public function onStartInitializeRouter($m)
|
||||
{
|
||||
$m->connect('main/cas', array('action' => 'caslogin'));
|
||||
return true;
|
||||
}
|
||||
|
||||
function onEndLoginGroupNav($action)
|
||||
public function onEndLoginGroupNav($action)
|
||||
{
|
||||
$action_name = $action->trimmed('action');
|
||||
|
||||
$action->menuItem(common_local_url('caslogin'),
|
||||
// TRANS: Menu item. CAS is Central Authentication Service.
|
||||
_m('CAS'),
|
||||
// TRANS: Tooltip for menu item. CAS is Central Authentication Service.
|
||||
_m('Login or register with CAS.'),
|
||||
$action_name === 'caslogin');
|
||||
$action->menuItem(
|
||||
common_local_url('caslogin'),
|
||||
// TRANS: Menu item. CAS is Central Authentication Service.
|
||||
_m('CAS'),
|
||||
// TRANS: Tooltip for menu item. CAS is Central Authentication Service.
|
||||
_m('Login or register with CAS.'),
|
||||
($action_name === 'caslogin')
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onEndShowPageNotice($action)
|
||||
public function onEndShowPageNotice($action)
|
||||
{
|
||||
$name = $action->trimmed('action');
|
||||
|
||||
switch ($name)
|
||||
{
|
||||
case 'login':
|
||||
// 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: These two elements may not be separated.
|
||||
$instr = _m('(Have an account with CAS? ' .
|
||||
'Try our [CAS login](%%action.caslogin%%)!)');
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
switch ($name) {
|
||||
case 'login':
|
||||
// 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: These two elements may not be separated.
|
||||
$instr = _m('(Have an account with CAS? ' .
|
||||
'Try our [CAS login](%%action.caslogin%%)!)');
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
$output = common_markup_to_html($instr);
|
||||
@ -113,29 +92,29 @@ class CasAuthenticationPlugin extends AuthenticationPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
function onLoginAction($action, &$login)
|
||||
public function onLoginAction($action, &$login)
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
case 'caslogin':
|
||||
$login = true;
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
switch ($action) {
|
||||
case 'caslogin':
|
||||
$login = true;
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function onInitializePlugin(){
|
||||
public function onInitializePlugin()
|
||||
{
|
||||
parent::onInitializePlugin();
|
||||
if(!isset($this->server)){
|
||||
if (!isset($this->server)) {
|
||||
// TRANS: Exception thrown when the CAS Authentication plugin has been configured incorrectly.
|
||||
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.
|
||||
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.
|
||||
throw new Exception(_m("Specifying a path is required."));
|
||||
}
|
||||
|
@ -373,7 +373,6 @@ class EmbedPlugin extends Plugin
|
||||
case 'link':
|
||||
if (!empty($embed->html)
|
||||
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
|
||||
require_once INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php';
|
||||
$purifier = new HTMLPurifier();
|
||||
// FIXME: do we allow <object> and <embed> here? we did that when we used htmLawed,
|
||||
// but I'm not sure anymore...
|
||||
@ -638,12 +637,16 @@ class EmbedPlugin extends Plugin
|
||||
try {
|
||||
$imgData = HTTPClient::quickGet($url);
|
||||
if (isset($imgData)) {
|
||||
list($filename, $width, $height) = $this->validateAndWriteImage($imgData, $url, $headers,
|
||||
$thumbnail->file_id);
|
||||
list($filename, $width, $height) = $this->validateAndWriteImage(
|
||||
$imgData,
|
||||
$url,
|
||||
$headers,
|
||||
$thumbnail->file_id
|
||||
);
|
||||
} else {
|
||||
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
|
||||
common_debug("Embed was not able to find an image for URL `{$url}`: " . $e->getMessage());
|
||||
return false;
|
||||
|
@ -1,37 +1,32 @@
|
||||
<?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
|
||||
*
|
||||
* 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
|
||||
* @package Laconica
|
||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
||||
* @copyright 2009 Control Yourself, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://laconi.ca/
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
|
||||
require_once INSTALLDIR . '/plugins/Realtime/RealtimePlugin.php';
|
||||
|
||||
/**
|
||||
* 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
|
||||
* browser by the Orbited server.
|
||||
*
|
||||
* @category Plugin
|
||||
* @package Laconica
|
||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://laconi.ca/
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class OrbitedPlugin extends RealtimePlugin
|
||||
{
|
||||
@ -61,13 +55,13 @@ class OrbitedPlugin extends RealtimePlugin
|
||||
|
||||
protected $con = null;
|
||||
|
||||
function onStartShowHeadElements($action)
|
||||
public function onStartShowHeadElements($action)
|
||||
{
|
||||
// See http://orbited.org/wiki/Deployment#Cross-SubdomainDeployment
|
||||
$action->element('script', null, ' document.domain = document.domain; ');
|
||||
}
|
||||
|
||||
function _getScripts()
|
||||
public function _getScripts()
|
||||
{
|
||||
$scripts = parent::_getScripts();
|
||||
|
||||
@ -85,7 +79,7 @@ class OrbitedPlugin extends RealtimePlugin
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
function _updateInitialize($timeline, $user_id)
|
||||
public function _updateInitialize($timeline, $user_id)
|
||||
{
|
||||
$script = parent::_updateInitialize($timeline, $user_id);
|
||||
|
||||
@ -96,10 +90,8 @@ class OrbitedPlugin extends RealtimePlugin
|
||||
"\"{$timeline}\", \"{$this->webuser}\", \"{$this->webpass}\");";
|
||||
}
|
||||
|
||||
function _connect()
|
||||
public function _connect()
|
||||
{
|
||||
require_once(INSTALLDIR.'/extlib/Stomp.php');
|
||||
|
||||
$url = $this->_getStompUrl();
|
||||
|
||||
$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,
|
||||
json_encode($message));
|
||||
$result = $this->con->send($channel, json_encode($message));
|
||||
|
||||
return $result;
|
||||
// @todo Parse and deal with result.
|
||||
}
|
||||
|
||||
function _disconnect()
|
||||
public function _disconnect()
|
||||
{
|
||||
$this->con->disconnect();
|
||||
}
|
||||
|
||||
function _pathToChannel($path)
|
||||
public function _pathToChannel($path)
|
||||
{
|
||||
if (!empty($this->channelbase)) {
|
||||
array_unshift($path, $this->channelbase);
|
||||
@ -135,19 +126,19 @@ class OrbitedPlugin extends RealtimePlugin
|
||||
return '/' . implode('/', $path);
|
||||
}
|
||||
|
||||
function _getStompServer()
|
||||
public function _getStompServer()
|
||||
{
|
||||
return (!is_null($this->stompserver)) ? $this->stompserver :
|
||||
(!is_null($this->webserver)) ? $this->webserver :
|
||||
common_config('site', 'server');
|
||||
}
|
||||
|
||||
function _getStompPort()
|
||||
public function _getStompPort()
|
||||
{
|
||||
return (!is_null($this->stompport)) ? $this->stompport : 61613;
|
||||
}
|
||||
|
||||
function _getStompUrl()
|
||||
public function _getStompUrl()
|
||||
{
|
||||
$server = $this->_getStompServer();
|
||||
$port = $this->_getStompPort();
|
||||
|
@ -1,48 +1,39 @@
|
||||
<?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
|
||||
*
|
||||
* 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
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for XMPP
|
||||
*
|
||||
* @category Plugin
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class XmppPlugin extends ImPlugin
|
||||
{
|
||||
@ -59,13 +50,13 @@ class XmppPlugin extends ImPlugin
|
||||
|
||||
public $transport = 'xmpp';
|
||||
|
||||
function getDisplayName()
|
||||
public function getDisplayName()
|
||||
{
|
||||
// TRANS: Plugin display name.
|
||||
return _m('XMPP/Jabber');
|
||||
}
|
||||
|
||||
function daemonScreenname()
|
||||
public function daemonScreenname()
|
||||
{
|
||||
$ret = $this->user . '@' . $this->server;
|
||||
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'));
|
||||
}
|
||||
@ -156,7 +147,7 @@ class XmppPlugin extends ImPlugin
|
||||
$parts = explode("/", $jid, 2);
|
||||
if (count($parts) > 1) {
|
||||
$resource = $parts[1];
|
||||
// if ($resource == '') then
|
||||
// if ($resource == '') then
|
||||
// Warning: empty resource isn't legit.
|
||||
// But if we're normalizing, we may as well take it...
|
||||
} else {
|
||||
@ -167,7 +158,7 @@ class XmppPlugin extends ImPlugin
|
||||
if ((count($node) > 2) || (count($node) == 0)) {
|
||||
// TRANS: Exception thrown when using too many @ signs in a Jabber ID.
|
||||
throw new Exception(_m('Invalid JID: too many @s.'));
|
||||
} else if (count($node) == 1) {
|
||||
} elseif (count($node) == 1) {
|
||||
$domain = $node[0];
|
||||
$node = null;
|
||||
} else {
|
||||
@ -236,33 +227,14 @@ class XmppPlugin extends ImPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
public function onStartImDaemonIoManagers(&$classes)
|
||||
{
|
||||
parent::onStartImDaemonIoManagers($classes);
|
||||
$classes[] = new XmppManager($this); // handles pings/reconnects
|
||||
return true;
|
||||
}
|
||||
|
||||
function sendMessage($screenname, $body)
|
||||
public function sendMessage($screenname, $body)
|
||||
{
|
||||
$this->queuedConnection()->message($screenname, $body, 'chat');
|
||||
}
|
||||
@ -274,7 +246,7 @@ class XmppPlugin extends ImPlugin
|
||||
* @return QueuedXMPP
|
||||
* @throws Exception if server settings are invalid.
|
||||
*/
|
||||
function queuedConnection()
|
||||
public function queuedConnection()
|
||||
{
|
||||
if (!isset($this->server)) {
|
||||
// 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.'));
|
||||
}
|
||||
|
||||
return new QueuedXMPP($this, $this->host ?
|
||||
$this->host :
|
||||
$this->server,
|
||||
return new QueuedXMPP(
|
||||
$this,
|
||||
($this->host ?: $this->server),
|
||||
$this->port,
|
||||
$this->user,
|
||||
$this->password,
|
||||
$this->resource,
|
||||
$this->server,
|
||||
$this->debug ?
|
||||
true : false,
|
||||
$this->debug ?
|
||||
\XMPPHP\Log::LEVEL_VERBOSE : null
|
||||
($this->debug ? true : false),
|
||||
($this->debug ? \XMPPHP\Log::LEVEL_VERBOSE : null)
|
||||
);
|
||||
}
|
||||
|
||||
function sendNotice($screenname, Notice $notice)
|
||||
public function sendNotice($screenname, Notice $notice)
|
||||
{
|
||||
try {
|
||||
$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...?
|
||||
$xs->raw(str_replace("\t", "", $notice->getRendered()));
|
||||
$xs->text(" ");
|
||||
$xs->element('a', array(
|
||||
'href' => common_local_url('conversation',
|
||||
array('id' => $notice->conversation)) . '#notice-' . $notice->id),
|
||||
$xs->element(
|
||||
'a',
|
||||
[
|
||||
'href' => common_local_url(
|
||||
'conversation',
|
||||
['id' => $notice->conversation]
|
||||
) . '#notice-' . $notice->id,
|
||||
],
|
||||
// TRANS: Link description to notice in conversation.
|
||||
// TRANS: %s is a notice ID.
|
||||
sprintf(_m('[%u]'), $notice->id));
|
||||
sprintf(_m('[%u]'), $notice->id)
|
||||
);
|
||||
$xs->elementEnd('body');
|
||||
$xs->elementEnd('html');
|
||||
|
||||
@ -365,7 +341,7 @@ class XmppPlugin extends ImPlugin
|
||||
return $html . ' ' . $entry;
|
||||
}
|
||||
|
||||
function receiveRawMessage($pl)
|
||||
public function receiveRawMessage($pl)
|
||||
{
|
||||
$from = $this->normalize($pl['from']);
|
||||
|
||||
@ -390,7 +366,7 @@ class XmppPlugin extends ImPlugin
|
||||
* @param string $jid JID to check
|
||||
* @return string an equivalent JID in normalized (lowercase) form
|
||||
*/
|
||||
function normalize($jid)
|
||||
public function normalize($jid)
|
||||
{
|
||||
try {
|
||||
$parts = $this->splitJid($jid);
|
||||
@ -411,17 +387,15 @@ class XmppPlugin extends ImPlugin
|
||||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
function onGetValidDaemons(&$daemons)
|
||||
public function onGetValidDaemons(&$daemons)
|
||||
{
|
||||
if (isset($this->server) &&
|
||||
isset($this->port) &&
|
||||
isset($this->user) &&
|
||||
isset($this->password)) {
|
||||
|
||||
array_push(
|
||||
$daemons,
|
||||
INSTALLDIR
|
||||
. '/scripts/imdaemon.php'
|
||||
INSTALLDIR . '/scripts/imdaemon.php'
|
||||
);
|
||||
}
|
||||
|
||||
@ -478,4 +452,3 @@ class XmppPlugin extends ImPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,37 +1,30 @@
|
||||
<?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.
|
||||
*
|
||||
* 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
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Brion Vibber <brion@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once dirname(__DIR__) . '/extlib/XMPPHP/XMPP.php';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
use XMPPHP\XMPP;
|
||||
|
||||
@ -82,7 +75,7 @@ class QueuedXMPP extends XMPP
|
||||
* @param string $msg
|
||||
* @param null $timeout
|
||||
*/
|
||||
public function send($msg, $timeout = NULL)
|
||||
public function send($msg, $timeout = null)
|
||||
{
|
||||
@$this->plugin->enqueueOutgoingRaw($msg);
|
||||
}
|
||||
|
@ -1,46 +1,36 @@
|
||||
<?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 Jabber 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 Jabber
|
||||
* @package StatusNet
|
||||
* @category XMPP
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// 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';
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
use XMPPHP\XMPP;
|
||||
|
||||
class SharingXMPP extends XMPP
|
||||
{
|
||||
function getSocket()
|
||||
public function getSocket()
|
||||
{
|
||||
return $this->socket;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user