2017-11-23 14:46:04 +00:00
|
|
|
#!/usr/bin/env php
|
2013-06-22 15:34:52 +00:00
|
|
|
<?php
|
2020-02-09 15:34:23 +00:00
|
|
|
/**
|
2024-08-23 13:11:15 +00:00
|
|
|
* Copyright (C) 2010-2024, the Friendica project
|
|
|
|
* SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
2020-02-09 15:34:23 +00:00
|
|
|
*
|
2024-08-23 13:11:15 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2020-02-09 15:34:23 +00:00
|
|
|
*
|
2013-06-22 15:34:52 +00:00
|
|
|
* ejabberd extauth script for the integration with friendica
|
|
|
|
*
|
|
|
|
* Originally written for joomla by Dalibor Karlovic <dado@krizevci.info>
|
|
|
|
* modified for Friendica by Michael Vogel <icarus@dabo.de>
|
|
|
|
* published under GPL
|
|
|
|
*
|
|
|
|
* Latest version of the original script for joomla is available at:
|
|
|
|
* http://87.230.15.86/~dado/ejabberd/joomla-login
|
|
|
|
*
|
|
|
|
* Installation:
|
|
|
|
*
|
2017-11-23 14:46:04 +00:00
|
|
|
* - Change it's owner to whichever user is running the server, ie. ejabberd
|
2018-03-19 03:17:31 +00:00
|
|
|
* $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php
|
2013-06-22 15:34:52 +00:00
|
|
|
*
|
|
|
|
* - Change the access mode so it is readable only to the user ejabberd and has exec
|
2018-03-19 03:17:31 +00:00
|
|
|
* $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php
|
2013-06-22 15:34:52 +00:00
|
|
|
*
|
2020-03-29 16:46:16 +00:00
|
|
|
* - Edit your ejabberd.yml file and add after "shaper:":
|
|
|
|
*
|
|
|
|
* auth_method: [external]
|
|
|
|
* extauth_program: "/path/to/friendica/bin/auth_ejabberd.php"
|
|
|
|
* auth_use_cache: false
|
2013-06-22 15:34:52 +00:00
|
|
|
*
|
2017-11-23 14:46:04 +00:00
|
|
|
* - Restart your ejabberd service, you should be able to login with your friendica auth info
|
2013-06-22 15:34:52 +00:00
|
|
|
*
|
|
|
|
* Other hints:
|
2017-11-23 14:46:04 +00:00
|
|
|
* - if your users have a space or a @ in their nickname, they'll run into trouble
|
|
|
|
* registering with any client so they should be instructed to replace these chars
|
|
|
|
* " " (space) is replaced with "%20"
|
|
|
|
* "@" is replaced with "(a)"
|
2013-06-22 15:34:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-09-07 09:51:26 +00:00
|
|
|
if (php_sapi_name() !== 'cli') {
|
|
|
|
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2019-08-05 07:02:55 +00:00
|
|
|
use Dice\Dice;
|
2017-04-30 04:01:26 +00:00
|
|
|
|
2024-12-25 20:43:15 +00:00
|
|
|
chdir(dirname(__FILE__, 2));
|
2013-06-22 15:34:52 +00:00
|
|
|
|
2024-12-25 21:12:24 +00:00
|
|
|
require dirname(__FILE__, 2) . '/vendor/autoload.php';
|
2013-06-22 15:34:52 +00:00
|
|
|
|
2024-12-25 21:01:24 +00:00
|
|
|
$dice = (new Dice())->addRules(require(dirname(__FILE__, 2) . '/static/dependencies.config.php'));
|
2019-09-17 14:47:00 +00:00
|
|
|
|
2024-12-25 21:12:24 +00:00
|
|
|
$app = \Friendica\App::fromDice($dice);
|
2023-01-06 00:02:47 +00:00
|
|
|
|
2024-12-25 21:12:24 +00:00
|
|
|
$app->processEjabberd();
|