Exemplo n.º 1
0
function get_users_list()
{
    if (!defined('SESSIONMANAGER_HOST')) {
        return false;
    }
    global $sessionmanager_url;
    $ret = query_sm($sessionmanager_url . '/userlist.php');
    $dom = new DomDocument('1.0', 'utf-8');
    $buf = @$dom->loadXML($ret);
    if (!$buf) {
        return false;
    }
    if (!$dom->hasChildNodes()) {
        return false;
    }
    $users_node = $dom->getElementsByTagname('users')->item(0);
    if (is_null($users_node)) {
        return false;
    }
    $users = array();
    foreach ($users_node->childNodes as $user_node) {
        if ($user_node->hasAttribute('login')) {
            $users[$user_node->getAttribute('login')] = strlen($user_node->getAttribute('displayname')) > 32 ? substr($user_node->getAttribute('displayname'), 0, 32) . '...' : $user_node->getAttribute('displayname');
        }
    }
    natcasesort($users);
    if (count($users) == 0) {
        return false;
    }
    return $users;
}
Exemplo n.º 2
0
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
function return_error($errno_, $errstr_)
{
    $dom = new DomDocument('1.0', 'utf-8');
    $node = $dom->createElement('error');
    $node->setAttribute('id', $errno_);
    $node->setAttribute('message', $errstr_);
    $dom->appendChild($node);
    return $dom->saveXML();
}
header('Content-Type: text/xml; charset=utf-8');
$xml = query_sm($sessionmanager_url . '/news.php');
if (!$xml) {
    echo return_error(0, 'Invalid XML');
    die;
}
$dom = new DomDocument('1.0', 'utf-8');
$buf = @$dom->loadXML($xml);
if (!$buf) {
    echo return_error(0, 'Invalid XML');
    die;
}
if (!$dom->hasChildNodes()) {
    echo return_error(0, 'Invalid XML');
    die;
}
echo $xml;
Exemplo n.º 3
0
<?php

/**
 * Copyright (C) 2009-2010 Ulteo SAS
 * http://www.ulteo.com
 * Author Jeremy DESVAGES <*****@*****.**>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
header('Content-Type: image/png');
die(query_sm($sessionmanager_url . '/icon.php?id=' . $_GET['id']));
Exemplo n.º 4
0
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
$xml = query_sm($sessionmanager_url . '/applications.php?user='******'user']);
if (!$xml) {
    die($xml);
}
$dom = new DomDocument('1.0', 'utf-8');
$buf = @$dom->loadXML($xml);
if (!$buf) {
    die($xml);
}
$mime_type = NULL;
if (isset($_REQUEST['filter_extension'])) {
    require_once dirname(__FILE__) . '/includes/mime.inc.php';
    $mime_type = getMimeTypefromExtension($_REQUEST['filter_extension']);
} else {
    if (isset($_REQUEST['filter_mime'])) {
        $mime_type = $_REQUEST['filter_mime'];
Exemplo n.º 5
0
function wait_ready($tr, $sessionmanager_url, $cookie)
{
    add($tr['wait_aps']);
    flush();
    $count = 20;
    while ($count-- > 0) {
        $cookies = array('PHPSESSID' => $cookie);
        $xml = query_sm($sessionmanager_url . '/session_status', "", $cookies);
        if (!$xml) {
            error($tr['unable_to_reach_sm']);
        }
        $dom = new DomDocument('1.0', 'utf-8');
        $buf = @$dom->loadXML($xml);
        if (!$buf) {
            error($tr['internal_error']);
        }
        if (!$dom->hasChildNodes()) {
            error($tr['internal_error']);
        }
        $session_node = $dom->getElementsByTagName('session');
        if (count($session_node) != 1) {
            error($tr['internal_error']);
        }
        $session_node = $session_node->item(0);
        if (!is_object($session_node)) {
            error($tr['internal_error']);
        }
        $status = $session_node->getAttribute('status');
        if ($status == 'ready') {
            return;
        }
        sleep(2);
    }
    add('Result=' . $tr['session_end_unexpected']);
    die;
}
Exemplo n.º 6
0
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
function return_error($errno_, $errstr_)
{
    $dom = new DomDocument('1.0', 'utf-8');
    $node = $dom->createElement('error');
    $node->setAttribute('id', $errno_);
    $node->setAttribute('message', $errstr_);
    $dom->appendChild($node);
    return $dom->saveXML();
}
header('Content-Type: text/xml; charset=utf-8');
$dom = new DomDocument('1.0', 'utf-8');
$buf = @$dom->loadXML(query_sm($sessionmanager_url . '/session_status.php'));
if (!$buf) {
    echo return_error(0, 'Invalid XML');
    die;
}
if (!$dom->hasChildNodes()) {
    echo return_error(0, 'Invalid XML');
    die;
}
$session_nodes = $dom->getElementsByTagName('session');
if (count($session_nodes) != 1) {
    echo return_error(1, 'Invalid XML: No session node');
    die;
}
$session_node = $session_nodes->item(0);
if (!is_object($session_node)) {