THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//#############Start#of#Config####################
/** The root of your owncloud installation. */
$oc_root = '/var/www/wolke.herberth.eu/';
/** Should we log the activity of this script? */
$debugging = true;
//#############End#of#config######################
error_reporting(E_ALL);
ini_set('error_log', '/var/log/ejabberd/oc.log');
$auth = new JabberAuth();
$auth->play();
// We simply start process !
class JabberAuth
{
    /** This is the jabber user passed to the script. filled by $this->command() */
    var $jabber_user;
    /** This is the jabber user password passed to the script. filled by $this->command() */
    var $jabber_pass;
    /** This is the jabber server passed to the script. filled by $this->command(). Useful for VirtualHosts */
    var $jabber_server;
    /** This is what SM component send to us. */
    var $data;
    /** This is the command sent ... */
    var $command;
    /** stdin file pointer */
#!/usr/bin/php
<?php 
error_reporting(0);
$auth = new JabberAuth();
$auth->setSecret("CHANGE_ME");
// Set the secret password to allow us access
$auth->setForumURL("http://your-webhost.com/forum");
// Set the location where the base phpBB forum can be found at ( without the trailing '/' )
$auth->startRun();
// We simply start process !
class JabberAuth
{
    private $_log = true;
    private $_debug = false;
    private $_logfile = "/var/log/ejabberd/exauth_phpbb.log";
    private $_rlog;
    private $_location = "";
    private $_secret = "";
    private $_stdin;
    private $_stdout;
    function __construct()
    {
        $this->_rlog = fopen($this->_logfile, "a") or die("Error opening log file: " . $this->_logfile);
        $this->log("Starting pipe-auth ...");
        // We notice that it's starting ...
        $this->_stdout = fopen("php://stdout", "w");
        // We open STDOUT so we can read
        $this->_stdin = fopen("php://stdin", "r");
        // and STDIN so we can talk !
    }
    public function startRun()
Example #3
0
<?php

require_once 'jabberauth.php';
$config = array('dbuser' => 'dbusr', 'dbpass' => 'dbpwd', 'dbhost' => 'localhost', 'dbname' => 'jabber');
$jauth = new JabberAuth($config);
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'register':
            if ($jauth->register()) {
                $msg = SUCCESS_REGISTER;
                $jauth->clear_session();
            } else {
                $jauth->clear_session();
                $_SESSION['formdata']['username'] = $_POST['username'];
                $_SESSION['formdata']['email'] = $_POST['email'];
            }
            break;
        case 'recover_password':
            if ($jauth->recover_password()) {
                $msg = SUCCESS_RECOVER;
                $jauth->clear_session();
            }
            break;
        case 'reset_password':
            if ($jauth->set_password(FALSE, $_POST['username'], $_POST['password'])) {
                $msg = SUCCESS_PASSWORD;
                $jauth->clear_session();
            } else {
                die(ERROR_RESET_PASSWORD);
            }
            break;