当前位置: 首页>>代码示例>>PHP>>正文


PHP popup_error函数代码示例

本文整理汇总了PHP中popup_error函数的典型用法代码示例。如果您正苦于以下问题:PHP popup_error函数的具体用法?PHP popup_error怎么用?PHP popup_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了popup_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public static function save($type_, $element_, $group_)
 {
     Logger::debug('main', "Abstract_Liaison_sql::save ({$type_},{$element_},{$group_})");
     $sql2 = SQL::getInstance();
     $table = $sql2->prefix . 'liaison';
     $res = $sql2->DoQuery('SELECT @3,@4 FROM @1 WHERE @2=%5 AND @3=%6 AND @4=%7', $table, 'type', 'element', 'group', $type_, $element_, $group_);
     if ($sql2->NumRows() > 0) {
         Logger::error('main', 'Abstract_Liaison_sql::save Liaison(type=' . $type_ . ',element=' . $element_ . ',group=' . $group_ . ') already exists');
         popup_error('liaison(type=' . $type_ . ',element=' . $element_ . ',group=' . $group_ . ') already exists');
         return false;
     }
     $res = $sql2->DoQuery('INSERT INTO @1 ( @2,@3,@4 ) VALUES ( %5,%6,%7)', $table, 'type', 'element', 'group', $type_, $element_, $group_);
     return $res !== false;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:14,代码来源:Abstract_Liaison_sql.class.php

示例2: __call

 public function __call($name, $arguments)
 {
     try {
         $res = $this->service->__call($name, $arguments);
     } catch (Exception $e) {
         if ($e->faultcode == 'not_authorized') {
             popup_error(_('You are not allowed to perform this action'));
         } else {
             popup_error(self::format_soap_error_message($e));
         }
         return null;
     }
     if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
         popup_info('soap Call ' . $name);
     }
     return $res;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:17,代码来源:SessionManager.class.php

示例3: do_save

function do_save($prefs, $name)
{
    $obj = new $name();
    if (!$obj->form_valid($_POST)) {
        popup_error('Invalid form');
        return False;
    }
    $flag = $obj->form_read($_POST, $prefs);
    if ($flag === False) {
        popup_error('form_read return an error');
        return False;
    }
    if (!$prefs->backup()) {
        popup_error('Unable to save configuration');
        return False;
    }
    return True;
}
开发者ID:bloveing,项目名称:openulteo,代码行数:18,代码来源:configuration-profile.php

示例4: adminAuthenticate

function adminAuthenticate($login_, $password_)
{
    if (array_key_exists('no_ssl', $_SESSION)) {
        unset($_SESSION['no_ssl']);
    }
    try {
        $service = new SessionManager($login_, $password_, true);
        $ret = $service->test_link_connected();
    } catch (Exception $e) {
        if ($e->faultcode == 'auth_failed') {
            $_SESSION['admin_error'] = _('There was an error with your authentication');
            return false;
        }
        if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
            popup_error('Unable to login the Session Manager using HTTPS method, retry with HTTP');
        }
        try {
            $service = new SessionManager($login_, $password_, false);
            $ret = $service->test_link_connected();
        } catch (Exception $e) {
            if ($e->faultcode == 'auth_failed') {
                $_SESSION['admin_error'] = _('There was an error with your authentication');
                return false;
            }
            if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
                popup_error($service->format_soap_error_message($e));
            }
            die_error(_('Unable to initialize communication with Session Manager'));
        }
        $_SESSION['no_ssl'] = true;
        if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
            popup_info('Succefully connected the Session Manager using HTTP method, will alwais use HTTP for this session');
        }
    }
    $_SESSION['admin_login'] = $login_;
    $_SESSION['admin_password'] = $password_;
    $_SESSION['service'] = $service;
    return true;
}
开发者ID:bloveing,项目名称:openulteo,代码行数:39,代码来源:login.php

示例5: init

 public function init()
 {
     $server = Abstract_Server::load($this->server);
     if (!is_object($server)) {
         Logger::error('apt-get', 'TASK::init for task ' . $this->id . ' returned an error (unknown server ' . $this->server . ')');
         return false;
     }
     $dom = new DomDocument('1.0', 'utf-8');
     $node = $dom->createElement('debian');
     $node->setAttribute('request', $this->getRequest());
     foreach ($this->getPackages() as $package) {
         $buf = $dom->createElement('package');
         $buf->setAttribute('name', $package);
         $node->appendChild($buf);
     }
     $dom->appendChild($node);
     $xml = $dom->saveXML();
     $xml = query_url_post_xml($server->getBaseURL() . '/aps/debian', $xml);
     if (!$xml) {
         popup_error(sprintf(_("Unable to submit Task to server '%s'"), $server->fqdn));
         return false;
     }
     $dom = new DomDocument('1.0', 'utf-8');
     $buf = @$dom->loadXML($xml);
     if (!$buf) {
         return false;
     }
     if (!$dom->hasChildNodes()) {
         return false;
     }
     $node = $dom->getElementsByTagname('debian_request')->item(0);
     if (is_null($node)) {
         return false;
     }
     $this->job_id = $node->getAttribute('id');
     $this->status = $node->getAttribute('status');
     return true;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:38,代码来源:Task.class.php

示例6: add

 public function add($user_)
 {
     Logger::debug('main', 'UserDB::sql::add');
     if ($this->isOK($user_)) {
         // user already exists ?
         $user_from_db = $this->exists($user_->getAttribute('login'));
         if ($user_from_db === true) {
             Logger::error('main', 'UserDB_sql::add user (login=' . $user_->getAttribute('login') . ') already exists');
             popup_error(_('User already exists'));
             return false;
         }
         $query_keys = "";
         $query_values = "";
         $attributes = $user_->getAttributesList();
         foreach ($attributes as $key) {
             if ($key == 'password') {
                 $value = crypt($user_->getAttribute($key), md5($user_->getAttribute('login')));
             } else {
                 $value = $user_->getAttribute($key);
             }
             $query_keys .= '`' . $key . '`,';
             $query_values .= '"' . mysql_escape_string($value) . '",';
         }
         $query_keys = substr($query_keys, 0, -1);
         // del the last ,
         $query_values = substr($query_values, 0, -1);
         // del the last ,
         $SQL = SQL::getInstance();
         $query = 'INSERT INTO `' . $this->table . '` ( ' . $query_keys . ' ) VALUES (' . $query_values . ' )';
         $ret = $SQL->DoQuery($query);
         $id = $SQL->InsertId();
         $user_->setAttribute('id', $id);
         return $ret;
     } else {
         if ($user_->hasAttribute('login')) {
             Logger::debug('main', 'UserDB::sql::add failed (user \'' . $user_->getAttribute('login') . '\' not ok)');
         } else {
             Logger::debug('main', 'UserDB::sql::add failed (user not ok)');
         }
         return false;
     }
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:42,代码来源:sql.php

示例7: show_manage

function show_manage($sharedfolder_id_)
{
    $sharedfolder = $group = $_SESSION['service']->shared_folder_info($sharedfolder_id_);
    if (is_null($sharedfolder)) {
        popup_error(sprintf(_("Failed to import shared folder '%s'"), $sharedfolder_id_));
        redirect('sharedfolders.php');
    }
    $server_displayname = $sharedfolder->server;
    $server = $_SESSION['service']->server_info($sharedfolder->server);
    if (!is_null($server)) {
        $server_displayname = $server->getDisplayName();
    }
    $usersgroupsList = new UsersGroupsList($_REQUEST);
    $all_groups = $usersgroupsList->search();
    if (!is_array($all_groups)) {
        $all_groups = array();
        popup_error(_("Failed to get User Group data"));
    }
    uasort($all_groups, "usergroup_cmp");
    $searchDiv = $usersgroupsList->getForm();
    $available_groups = array();
    $used_groups = array();
    if ($sharedfolder->hasAttribute('groups')) {
        $used_groups = array();
        $mods_by_group = array();
        $groups2 = $sharedfolder->getAttribute('groups');
        foreach ($groups2 as $mode => $groups3) {
            foreach ($groups3 as $group_id => $group_name) {
                $used_groups[$group_id] = $group_name;
                $mods_by_group[$group_id] = $mode;
            }
        }
    }
    foreach ($all_groups as $group) {
        if (array_key_exists($group->id, $used_groups) === false) {
            $available_groups[$group->id] = $group;
        }
    }
    $can_manage_sharedfolders = isAuthorized('manageSharedFolders');
    page_header();
    echo '<div id="sharedfolders_div">';
    echo '<h1>' . $sharedfolder->name . '</h1>';
    echo '<div>';
    echo '<h2>' . _('Server') . '</h2>';
    echo '<a href="servers.php?action=manage&id=' . $sharedfolder->server . '"> ' . $server_displayname . '</a>';
    echo '</div>';
    echo '<br />';
    echo '<div>';
    echo '<h2>' . _('Configuration') . '</h2>';
    echo '<table>';
    echo '<tr><td>';
    echo _('Name') . ': ';
    echo '</td><td>';
    if ($can_manage_sharedfolders) {
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="SharedFolder" />';
        echo '<input type="hidden" name="action" value="rename" />';
        echo '<input type="hidden" name="id" value="' . $sharedfolder->id . '" />';
    }
    echo '<input type="text" name="sharedfolder_name" value="' . $sharedfolder->name . '" />';
    if ($can_manage_sharedfolders) {
        echo ' <input type="submit" value="' . _('Rename') . '" />';
        echo '</form>';
    }
    echo '</td></tr>';
    echo '</table>';
    echo '</div>';
    echo '<br />';
    echo '<div>';
    echo '<h2>' . _('Publications') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($used_groups as $group_id => $group_name) {
        echo '<tr>';
        echo '<td><a href="usersgroup.php?action=manage&amp;id=' . $group_id . '">' . $group_name . '</a></td>';
        echo '<td>' . $mods_by_group[$group_id] . '</td>';
        if ($can_manage_sharedfolders) {
            echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this shared folder access?') . '\');">';
            echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder->id . '" />';
            echo '<input type="hidden" name="usergroup_id" value="' . $group_id . '" />';
            echo '<input type="submit" value="' . _('Delete access to this shared folder') . '" />';
            echo '</form></td>';
        }
        echo '</tr>';
    }
    if (count($available_groups) > 0 and $can_manage_sharedfolders) {
        echo '<tr><form action="actions.php" method="post"><td>';
        echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder->id . '" />';
        echo '<select name="usergroup_id">';
        foreach ($available_groups as $group) {
            echo '<option value="' . $group->id . '" >' . $group->name . '</option>';
        }
        echo '</select>';
        echo '</td><td>';
        echo '<select name="mode">';
        echo '<option value="rw" >' . _('Read-write') . '</option>';
        echo '<option value="ro" >' . _('Read only') . '</option>';
//.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:101,代码来源:sharedfolders.php

示例8: disable_hostDB

function disable_hostDB($SQL, $table, $id_host)
{
    $query = 'SELECT * FROM `' . $table . '` WHERE register="yes" AND id_host=' . $id_host;
    $res = $SQL->DoQuery($query);
    $nb = $SQL->NumRows();
    if (!$nb) {
        popup_error(_('Cannot disable host because it is not enabled!'));
    }
    $query = 'DELETE FROM `' . $table . '` WHERE id_host=' . $id_host;
    $res = $SQL->DoQuery($query);
    $nb = $SQL->NumRows();
    if ($nb) {
        popup_info(_('Host has been disabled!'));
    } else {
        popup_error(_('An error occured during disabling host, cannot disable host!'));
    }
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:17,代码来源:configuration.php

示例9: show_manage

function show_manage($id_)
{
    // 	$session = Abstract_ReportSession::load($id_);
    $session = get_session_reporting($id_);
    if (!$session) {
        popup_error(sprintf(_('Unknown session %s'), $id_));
        redirect();
    }
    $userDB = UserDB::getInstance();
    $user = $userDB->import($session['user']);
    $applicationDB = ApplicationDB::getInstance();
    $applications = array();
    $dom = new DomDocument('1.0', 'utf-8');
    $ret = @$dom->loadXML($session['data']);
    if ($ret) {
        foreach ($dom->getElementsByTagName('application') as $node) {
            $application = array();
            foreach ($node->childNodes as $child_node) {
                $name = $child_node->nodeName;
                if ($name == '#text') {
                    continue;
                }
                $application[$name] = $child_node->nodeValue;
            }
            $applications[] = $application;
        }
    }
    for ($i = 0; $i < count($applications); $i++) {
        $app_buf = $applicationDB->import($applications[$i]['id']);
        if (is_object($app_buf)) {
            $applications[$i]["obj"] = $app_buf;
        }
    }
    page_header();
    echo '<h1>' . str_replace('%ID%', $session['id'], _('Archived session - %ID%')) . '</h1>';
    echo '<ul>';
    echo '<li><strong>' . _('User:') . '</strong> ';
    if (is_object($user)) {
        echo '<a href="users.php?action=manage&id=' . $user->getAttribute('login') . '">' . $user->getAttribute('displayname') . '</a>';
    } else {
        echo $session['user'] . ' <span><em>' . _('Not existing anymore') . '</em></span>';
    }
    echo '</li>';
    echo '<li><strong>' . _('Started:') . '</strong> ';
    echo $session['start_stamp'];
    echo '</li>';
    echo '<li><strong>' . _('Stopped:') . '</strong> ';
    echo $session['stop_stamp'];
    if (isset($session['stop_why']) && strlen($session['stop_why']) > 0) {
        echo '&nbsp<em>(' . $session['stop_why'] . ')</em>';
    }
    echo '</li>';
    echo '</ul>';
    if (count($applications) > 0) {
        echo '<div>';
        echo '<h2>' . _('Used applications') . '</h2>';
        echo '<ul>';
        foreach ($applications as $application) {
            echo '<li>';
            if (isset($application['obj'])) {
                echo '<img src="media/image/cache.php?id=' . $application['obj']->getAttribute('id') . '" alt="" title="" /> ';
                echo '<a href="applications.php?action=manage&id=' . $application['obj']->getAttribute('id') . '">' . $application['obj']->getAttribute('name') . '</a>';
            } else {
                echo $application['id'] . '&nbsp;<span><em>' . _('not existing anymore') . '</em></span>';
            }
            if ($application['start'] - $application['start'] > 0) {
                echo '  - (' . ($application['start'] - $application['start']) / 60 . 'm)';
            }
            echo '</li>';
        }
        echo '</ul>';
        echo '</div>';
    }
    page_footer();
    die;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:76,代码来源:session-reporting.php

示例10: die_error

function die_error($msg_)
{
    popup_error($msg_);
    redirect('error.php');
}
开发者ID:bloveing,项目名称:openulteo,代码行数:5,代码来源:misc.inc.php

示例11: checkAuthorization

function checkAuthorization($policy_)
{
    if (isAuthorized($policy_)) {
        return true;
    }
    popup_error(_('You are not allowed to perform this action'));
    return false;
}
开发者ID:bloveing,项目名称:openulteo,代码行数:8,代码来源:functions.inc.php

示例12: show_manage

function show_manage($fqdn)
{
    $server = Abstract_Server::load($fqdn);
    if (!$server || $server->getAttribute('registered') === false) {
        redirect('servers.php');
    }
    $server_online = $server->isOnline();
    if ($server_online) {
        $buf = $server->getMonitoring();
        if ($buf === false) {
            popup_error(sprintf(_('Cannot get server monitoring for \'%s\''), $server->getAttribute('fqdn')));
        }
        Abstract_Server::save($server);
    }
    $buf_status = $server->getAttribute('status');
    if ($buf_status == 'down') {
        $status_error_msg = _('Warning: server is offline');
    } elseif ($buf_status == 'broken') {
        $status_error_msg = _('Warning: server is broken');
    }
    $server_lock = $server->getAttribute('locked');
    if ($server_lock) {
        $switch_button = _('Switch to production');
        $switch_value = 0;
    } else {
        $switch_button = _('Switch to maintenance');
        $switch_value = 1;
    }
    ksort($server->roles);
    $var = array();
    foreach ($server->roles as $role => $bool) {
        $ret = server_display_role_preparation($role, $server);
        if (!is_bool($ret)) {
            $var[$role] = $ret;
        } else {
            Logger::debug('main', 'server_display_role_preparation failed for server ' . $server->fqdn . ' role ' . $role);
        }
    }
    $can_do_action = isAuthorized('manageServers');
    page_header();
    echo '<script type="text/javascript" src="media/script/ajax/servers.js" charset="utf-8"></script>';
    echo '<div id="servers_div">';
    echo '<h1>' . $server->fqdn . '</h1>';
    //   if ($server_online === false)
    //     echo '<h2><p class="msg_error centered">'.$status_error_msg.'</p></h2>';
    echo '<div class="section">';
    echo '<h2>' . _('Monitoring') . '</h2>';
    echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3">';
    echo '<tr class="title">';
    echo '<th>' . _('Type') . '</th><th>' . _('Version') . '</th><th>' . _('Status') . '</th>';
    echo '<th>' . _('Details') . '</th>';
    if ($server_online) {
        echo '<th>' . _('Monitoring') . '</th>';
    }
    echo '</tr>';
    echo '<tr class="content1">';
    echo '<td style="text-align: center;"><img src="media/image/server-' . $server->stringType() . '.png" alt="' . $server->stringType() . '" title="' . $server->stringType() . '" /><br />' . $server->stringType() . '</td>';
    echo '<td>' . $server->stringVersion() . '</td>';
    echo '<td>' . $server->stringStatus() . '</td>';
    echo '<td>' . _('CPU') . '; : ' . $server->getAttribute('cpu_model') . '  (' . $server->getAttribute('cpu_nb_cores') . ' ';
    echo $server->getAttribute('cpu_nb_cores') > 1 ? _('cores') : _('core');
    echo ')<br />' . _('RAM') . ' : ' . round($server->getAttribute('ram_total') / 1024) . ' ' . _('MB') . '</td>';
    if ($server_online) {
        echo '<td>';
        echo _('CPU usage') . ': ' . $server->getCpuUsage() . '%<br />';
        echo display_loadbar($server->getCpuUsage());
        echo _('RAM usage') . ': ' . $server->getRamUsage() . '%<br />';
        echo display_loadbar($server->getRamUsage());
        foreach ($server->roles as $role => $enabled) {
            if ($enabled === false) {
                continue;
            }
            switch ($role) {
                case 'aps':
                    echo _('Sessions usage') . ': ' . $server->getSessionUsage() . '%<br />';
                    echo display_loadbar($server->getSessionUsage() > 100 ? 100 : $server->getSessionUsage());
                    break;
                case 'fs':
                    echo _('Disk usage') . ': ' . $server->getDiskUsage() . '%<br />';
                    echo display_loadbar($server->getDiskUsage() > 100 ? 100 : $server->getDiskUsage());
                    break;
            }
        }
        echo '</td>';
    }
    echo '</tr>';
    echo '</table>';
    echo '</div>';
    echo '<div class="section">';
    echo '<h2>' . _('Configuration') . '</h2>';
    echo '<table>';
    echo '<tr><td>';
    echo _('Redirection name for this server') . ': ';
    echo '</td><td>';
    if ($can_do_action) {
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Server" />';
        echo '<input type="hidden" name="fqdn" value="' . $server->fqdn . '" />';
        echo '<input type="hidden" name="action" value="external_name" />';
    }
//.........这里部分代码省略.........
开发者ID:skdong,项目名称:nfs-ovd,代码行数:101,代码来源:servers.php

示例13: server_display_role_preparation_aps

function server_display_role_preparation_aps($server)
{
    $ret = array();
    $server_online = $server->isOnline();
    $applications_all = $_SESSION['service']->applications_list();
    $applications = array();
    foreach ($server->applications as $application_id => $application_name) {
        if (array_key_exists($application_id, $applications_all)) {
            $applications[] = $applications_all[$application_id];
        }
    }
    uasort($applications, 'application_cmp');
    $applications_available = array();
    $static_applications_available = array();
    if (!$server_online && count($applications) == 0) {
        $applications_all = array();
    }
    $servers_replication = $_SESSION['service']->servers_list('online');
    if (is_null($servers_replication)) {
        $servers_replication = array();
    }
    foreach ($servers_replication as $k => $v) {
        if ($v->id == $server->id) {
            unset($servers_replication[$k]);
        }
        if ($v->type != $server->getAttribute('type')) {
            unset($servers_replication[$k]);
        }
        if (!array_key_exists(Server::SERVER_ROLE_APS, $v->roles)) {
            unset($servers_replication[$k]);
        }
        if ($server->hasAttribute('ulteo_system') == false || $server->getAttribute('ulteo_system') == 0) {
            unset($servers_replication[$k]);
        }
    }
    $sessions = array();
    $total = 0;
    if ($server->hasAttribute('sessions_number')) {
        $total = $server->getAttribute('sessions_number');
    }
    if ($total > 0) {
        $has_sessions = true;
        $search_limit = $_SESSION['configuration']['max_items_per_page'];
        if ($total > $search_limit) {
            if (!isset($_GET['start']) || (!is_numeric($_GET['start']) || $_GET['start'] >= $total)) {
                $start = 0;
            } else {
                $start = $_GET['start'];
            }
            $pagechanger = get_pagechanger('servers.php?action=manage&id=' . $server->id . '&', $search_limit, $total);
            $sessions = $_SESSION['service']->sessions_list_by_server($server->id, $start);
        } else {
            $sessions = $_SESSION['service']->sessions_list_by_server($server->id);
        }
    } else {
        $has_sessions = false;
    }
    $external_name_checklist = array('localhost', '127.0.0.1');
    if (in_array($server->getExternalName(), $external_name_checklist)) {
        popup_error(sprintf(_('Server "%s": redirection name may be invalid!'), $server->getDisplayName()));
    }
    if ($server_online) {
        $apps_in_remove = array();
        $apps_in_install = array();
        $tasks = array();
        if ($server_online) {
            $all_tasks = $_SESSION['service']->tasks_list();
            if (is_null($all_tasks)) {
                $all_tasks = array();
            }
            foreach ($all_tasks as $task) {
                if ($task->getAttribute('server') != $server->id) {
                    continue;
                }
                if (!$task->succeed()) {
                    $tasks[] = $task;
                }
            }
            foreach ($tasks as $task) {
                if ($task->hasAttribute('applications')) {
                    continue;
                }
                if ($task->getAttribute('type') == 'Task_install') {
                    foreach ($task->getAttribute('applications') as $app) {
                        if (!in_array($app, $apps_in_install)) {
                            $apps_in_install[] = $app;
                        }
                    }
                }
                if ($task->getAttribute('type') == 'Task_remove') {
                    foreach ($task->getAttribute('applications') as $app) {
                        if (!in_array($app, $apps_in_remove)) {
                            $apps_in_remove[] = $app;
                        }
                    }
                }
            }
            foreach ($applications_all as $app) {
                if (in_array($app, $applications)) {
                    continue;
//.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:101,代码来源:template_server.inc.php

示例14: get_html

function get_html($id_)
{
    $session = $_SESSION['service']->session_report_info($id_);
    if (!$session) {
        popup_error(sprintf(_('Unknown session %s'), $id_));
        return false;
    }
    $user = $_SESSION['service']->user_info($session->getUser());
    $mode = '<em>' . _('unknown') . '</em>';
    $servers = array();
    $published_applications = array();
    $applications_instances = array();
    $storages = array();
    $dom = new DomDocument('1.0', 'utf-8');
    $ret = @$dom->loadXML($session->getData());
    if ($ret) {
        $root_node = $dom->documentElement;
        if ($root_node->hasAttribute('mode')) {
            $mode = $root_node->getAttribute('mode');
        }
        foreach ($dom->getElementsByTagName('server') as $node) {
            if (!($node->hasAttribute('id') && $node->hasAttribute('role'))) {
                // Not enough information to continue ...
                continue;
            }
            $server = array();
            $server['id'] = $node->getAttribute('id');
            if ($node->hasAttribute('fqdn')) {
                $server['fqdn'] = $node->getAttribute('fqdn');
                $server['name'] = $server['fqdn'];
            } else {
                $server['name'] = $server['id'];
            }
            $server['role'] = $node->getAttribute('role');
            $server['desktop_server'] = $node->hasAttribute('desktop_server');
            if ($node->hasAttribute('type')) {
                $server['type'] = $node->getAttribute('type');
            }
            $server['dump'] = array();
            foreach ($node->childNodes as $child_node) {
                if ($child_node->nodeName != 'dump') {
                    continue;
                }
                if (!$child_node->hasAttribute('name')) {
                    continue;
                }
                $name = $child_node->getAttribute('name');
                $server['dump'][$name] = base64_decode($child_node->textContent);
            }
            $server_obj = $_SESSION['service']->server_info($server['id']);
            if (is_object($server_obj)) {
                $server['obj'] = $server_obj;
            }
            $servers[] = $server;
            // can be the same server twice with different role ... ToDO: fix that on backend side
        }
        foreach ($dom->getElementsByTagName('storage') as $node) {
            $s = nodeattrs2array($node);
            $storages[$s['rid']] = $s;
        }
        foreach ($dom->getElementsByTagName('application') as $node) {
            if (!$node->hasAttribute('id')) {
                // Not enough information to continue ...
                continue;
            }
            $application = array('id' => $node->getAttribute('id'));
            if ($node->hasAttribute('name')) {
                $application['name'] = $node->getAttribute('name');
            }
            $app_buf = $_SESSION['service']->application_info($application['id']);
            if (is_object($app_buf)) {
                $application['obj'] = $app_buf;
            }
            $published_applications[$application['id']] = $application;
        }
        foreach ($dom->getElementsByTagName('instance') as $node) {
            if (!($node->hasAttribute('id') && $node->hasAttribute('application') && $node->hasAttribute('server') && $node->hasAttribute('start') && $node->hasAttribute('stop'))) {
                // Not enough information to continue ...
                continue;
            }
            $instance = array('id' => $node->getAttribute('id'));
            $instance['application'] = $node->getAttribute('application');
            $instance['server'] = $node->getAttribute('server');
            $instance['start'] = $node->getAttribute('start');
            $instance['stop'] = $node->getAttribute('stop');
            if (!array_key_exists($instance['application'], $published_applications)) {
                continue;
            }
            $applications_instances[] = $instance;
        }
    }
    $ret = '';
    $ret .= '<ul>';
    $ret .= '<li><strong>User:</strong> ';
    if (is_object($user)) {
        $ret .= '' . $user->getAttribute('displayname') . ' (login: ' . $user->getAttribute('login') . ')';
    } else {
        $ret .= $session->getUser() . ' <span><em>' . _('does not exist') . '</em></span>';
    }
    $ret .= '</li>';
//.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:101,代码来源:session-reporting.php

示例15: isOnline

 public function isOnline()
 {
     if ($this->getAttribute('status') != 'ready') {
         Logger::debug('main', 'Server::isOnline server "' . $this->fqdn . ':' . $this->web_port . '" is not "ready"');
         return false;
     }
     $warn = false;
     if (!$this->hasAttribute('status') || !$this->uptodateAttribute('status')) {
         $warn = true;
         $this->getStatus();
     }
     if ($this->hasAttribute('status') && $this->getAttribute('status') == 'ready') {
         return true;
     }
     if ($warn === true && $this->getAttribute('locked') == 0) {
         popup_error('"' . $this->fqdn . '": ' . _('is NOT online!'));
         Logger::error('main', '"' . $this->fqdn . '": is NOT online!');
     }
     $this->isNotReady();
     return false;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:21,代码来源:Server.class.php


注:本文中的popup_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。