Exemple #1
0
    }
    define(XMPP_HOST, $sess->get('vhost'));
    $rpc_host = check_rpc_server($vhosts[XMPP_HOST], $rpc_port);
    debug(DEBUG, "Active RPC host: {$rpc_host}");
    // in case no RPC servers are available stop jorge
    if ($rpc_host === false) {
        print "<br><center><b>Currently service is unavailable. Please try again later.</b><br>\n\t\t\t\t<a href=\"index.php?act=logout\">Please logout</a>\n\t\t\t</center>";
        exit;
    }
    // create rpc object
    $ejabberd_rpc = new rpc_connector("{$rpc_host}", "{$rpc_port}", XMPP_HOST);
    $xmpp_host = str_replace(".", "_", XMPP_HOST);
} else {
    // check if selected host exist in configuration
    if (array_key_exists($_POST['vhost'], $vhosts) === true) {
        $rpc_host = check_rpc_server($vhosts[$_POST['vhost']], $rpc_port);
        debug(DEBUG, "Selecting RPC server during login: {$rpc_host}");
        if ($rpc_host === false) {
            print "<br><center><b>Currently service is unavailable. Please try again later.<br>\n\t\t\t\t\t\t\t<a href=\"index.php?act=logout\">Please logout</a>\n\t\t\t\t\t\t</b></center>";
            exit;
        } else {
            define(XMPP_HOST, $_POST['vhost']);
            $ejabberd_rpc = new rpc_connector("{$rpc_host}", "{$rpc_port}", XMPP_HOST);
            $xmpp_host = str_replace(".", "_", XMPP_HOST);
        }
    } else {
        unset($_POST['inpLogin']);
        unset($_POST['inpPass']);
        // Try to recreate db object...
        if ($_GET['act'] === "logout") {
            if ($sess->get('vhost') != "") {
Exemple #2
0
        require 'lang/' . $sess->get('language') . '.php';
    } else {
        // In case of invalid session, overwrite value
        require 'lang/' . $language_support[default_language][0] . '.php';
        $sess->set('language', $language_support[default_language][0]);
    }
} else {
    // If no lang in sess, set it anyway...
    require 'lang/' . $language_support[default_language][0] . '.php';
    $sess->set('language', $language_support[default_language][0]);
}
// language
$lang = $sess->get('language');
define(XMPP_HOST, $sess->get('vhost'));
$xmpp_host = str_replace(".", "_", XMPP_HOST);
$rpc_host = check_rpc_server($vhosts[XMPP_HOST], $rpc_port);
// in case no RPC servers are available stop jorge
if ($rpc_host === false) {
    print "<br><center><b>Currently service is unavailable. Please try again later.</b></center>";
    exit;
}
// connect to xmpp server
$ejabberd_rpc = new rpc_connector("{$rpc_host}", "{$rpc_port}", XMPP_HOST);
// initialize encryption system
$enc = new url_crypt(ENC_KEY);
// authenticate
if (check_registered_user($sess, $ejabberd_rpc, $enc) !== true) {
    header("Location: index.php?act=logout");
    exit;
}
// create database object