<?php
require_once("inc/debug.php");
require_once("inc/db_connect.php");
require_once("inc/security.php");
require_once('class/domain.php');
function get_jabber_accounts() {
require_role(ROLE_CUSTOMER);
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$result = DB::query("SELECT id, `create`, created, lastactivity, local, domain FROM jabber.accounts WHERE customerno='$customerno' AND `delete`=0;");
$accounts = array();
if (@$result->num_rows > 0)
while ($acc = @$result->fetch_assoc())
array_push($accounts, $acc);
return $accounts;
}
function get_jabberaccount_details($id)
{
require_role(ROLE_CUSTOMER);
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$id = (int) $id;
$result = DB::query("SELECT id, local, domain FROM jabber.accounts WHERE customerno={$customerno} AND id={$id} LIMIT 1");
if ($result->num_rows != 1)
system_failure("Invalid account");
$data = $result->fetch_assoc();
if ($data['domain'] == NULL)
$data['domain'] = config('masterdomain');
else
{
$dom = new Domain((int) $data['domain']);