From: Hypolite Petovan Date: Mon, 19 Mar 2018 03:17:31 +0000 (-0400) Subject: Move scripts/auth_ejabberd.php to bin/ X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=542ff9b0825bc2b21137f23026d61c2c9644ef13;p=friendica.git Move scripts/auth_ejabberd.php to bin/ --- diff --git a/bin/auth_ejabberd.php b/bin/auth_ejabberd.php new file mode 100644 index 0000000000..06d8488df8 --- /dev/null +++ b/bin/auth_ejabberd.php @@ -0,0 +1,66 @@ +#!/usr/bin/env php + + * modified for Friendica by Michael Vogel + * published under GPL + * + * Latest version of the original script for joomla is available at: + * http://87.230.15.86/~dado/ejabberd/joomla-login + * + * Installation: + * + * - Change it's owner to whichever user is running the server, ie. ejabberd + * $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php + * + * - Change the access mode so it is readable only to the user ejabberd and has exec + * $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php + * + * - Edit your ejabberd.cfg file, comment out your auth_method and add: + * {auth_method, external}. + * {extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}. + * + * - Restart your ejabberd service, you should be able to login with your friendica auth info + * + * Other hints: + * - 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)" + * + */ + +use Friendica\App; +use Friendica\BaseObject; +use Friendica\Core\Config; +use Friendica\Util\ExAuth; + +if (sizeof($_SERVER["argv"]) == 0) { + die(); +} + +$directory = dirname($_SERVER["argv"][0]); + +if (substr($directory, 0, 1) != DIRECTORY_SEPARATOR) { + $directory = $_SERVER["PWD"] . DIRECTORY_SEPARATOR . $directory; +} + +$directory = realpath($directory . DIRECTORY_SEPARATOR . ".."); + +chdir($directory); + +require_once "boot.php"; +require_once "include/dba.php"; + +$a = new App(dirname(__DIR__)); +BaseObject::setApp($a); + +@include ".htconfig.php"; +dba::connect($db_host, $db_user, $db_pass, $db_data); +unset($db_host, $db_user, $db_pass, $db_data); + +$oAuth = new ExAuth(); + +$oAuth->readStdin(); diff --git a/doc/install-ejabberd.md b/doc/install-ejabberd.md index 8f95069e63..dbdc0b975d 100644 --- a/doc/install-ejabberd.md +++ b/doc/install-ejabberd.md @@ -11,16 +11,16 @@ Installation - Change it's owner to whichever user is running the server, ie. ejabberd - $ chown ejabberd:ejabberd /path/to/friendica/include/auth_ejabberd.php + $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php - Change the access mode so it is readable only to the user ejabberd and has exec - $ chmod 700 /path/to/friendica/include/auth_ejabberd.php + $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php - Edit your ejabberd.cfg file, comment out your auth_method and add: {auth_method, external}. - {extauth_program, "/path/to/friendica/include/auth_ejabberd.php"}. + {extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}. - Disable the module "mod_register" and disable the registration: diff --git a/scripts/auth_ejabberd.php b/scripts/auth_ejabberd.php deleted file mode 100755 index 32aa30898c..0000000000 --- a/scripts/auth_ejabberd.php +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env php - - * modified for Friendica by Michael Vogel - * published under GPL - * - * Latest version of the original script for joomla is available at: - * http://87.230.15.86/~dado/ejabberd/joomla-login - * - * Installation: - * - * - Change it's owner to whichever user is running the server, ie. ejabberd - * $ chown ejabberd:ejabberd /path/to/friendica/scripts/auth_ejabberd.php - * - * - Change the access mode so it is readable only to the user ejabberd and has exec - * $ chmod 700 /path/to/friendica/scripts/auth_ejabberd.php - * - * - Edit your ejabberd.cfg file, comment out your auth_method and add: - * {auth_method, external}. - * {extauth_program, "/path/to/friendica/script/auth_ejabberd.php"}. - * - * - Restart your ejabberd service, you should be able to login with your friendica auth info - * - * Other hints: - * - 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)" - * - */ - -use Friendica\App; -use Friendica\BaseObject; -use Friendica\Core\Config; -use Friendica\Util\ExAuth; - -if (sizeof($_SERVER["argv"]) == 0) { - die(); -} - -$directory = dirname($_SERVER["argv"][0]); - -if (substr($directory, 0, 1) != DIRECTORY_SEPARATOR) { - $directory = $_SERVER["PWD"] . DIRECTORY_SEPARATOR . $directory; -} - -$directory = realpath($directory . DIRECTORY_SEPARATOR . ".."); - -chdir($directory); - -require_once "boot.php"; -require_once "include/dba.php"; - -$a = new App(dirname(__DIR__)); -BaseObject::setApp($a); - -@include ".htconfig.php"; -dba::connect($db_host, $db_user, $db_pass, $db_data); -unset($db_host, $db_user, $db_pass, $db_data); - -$oAuth = new ExAuth(); - -$oAuth->readStdin(); diff --git a/src/Util/ExAuth.php b/src/Util/ExAuth.php index a6851c3852..d4436e32af 100644 --- a/src/Util/ExAuth.php +++ b/src/Util/ExAuth.php @@ -13,14 +13,14 @@ * Installation: * * - Change it's owner to whichever user is running the server, ie. ejabberd - * $ chown ejabberd:ejabberd /path/to/friendica/scripts/auth_ejabberd.php + * $ chown ejabberd:ejabberd /path/to/friendica/bin/auth_ejabberd.php * * - Change the access mode so it is readable only to the user ejabberd and has exec - * $ chmod 700 /path/to/friendica/scripts/auth_ejabberd.php + * $ chmod 700 /path/to/friendica/bin/auth_ejabberd.php * * - Edit your ejabberd.cfg file, comment out your auth_method and add: * {auth_method, external}. - * {extauth_program, "/path/to/friendica/script/auth_ejabberd.php"}. + * {extauth_program, "/path/to/friendica/bin/auth_ejabberd.php"}. * * - Restart your ejabberd service, you should be able to login with your friendica auth info *