• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isAuthorized函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkAuth

 private function checkAuth($method)
 {
     $auth = "";
     if ($this->input->server('HTTP_X_AUTHORIZATION')) {
         $auth = $this->input->server('HTTP_X_AUTHORIZATION');
     }
     $request_date = "";
     if ($this->input->server('HTTP_DATE')) {
         $request_date = $this->input->server('HTTP_DATE');
     }
     $query_string = "";
     if ($this->input->server('QUERY_STRING')) {
         $query_string = $this->input->server('QUERY_STRING');
     }
     if (empty($request_date) || !$this->checkDate($request_date)) {
         $error_code = "403";
         $error_message = $error_code . " Date is invalid";
         show_error($error_message, $error_code);
         exit;
     }
     if (empty($auth) || !isAuthorized($auth, $request_date, $method, $query_string)) {
         $error_code = "401";
         $error_message = $error_code . " Unauthorized";
         show_error($error_message, $error_code);
         exit;
     }
 }
开发者ID:syfy,项目名称:REST_Service,代码行数:27,代码来源:rest_service.php


示例2: show_default

function show_default()
{
    $profiledb = ProfileDB::getInstance();
    $profiles = $profiledb->getList();
    if (is_array($profiles) == false) {
        $profiles = array();
    }
    $can_manage_profiles = isAuthorized('manageSharedFolders');
    $can_manage_configuration = isAuthorized('manageConfiguration');
    page_header();
    echo '<div id="profiles_div">';
    echo '<h1>' . _('Profiles') . '</h1>';
    echo '<div id="profiles_list_div">';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($profiles as $profile) {
        echo '<tr>';
        echo '<td><a href="profiles.php?action=manage&amp;id=' . $profile->id . '">' . $profile->id . '</a></td>';
        if ($can_manage_profiles) {
            echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this profile?') . '\');">';
            echo '<input type="hidden" name="name" value="Profile" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="ids[]" value="' . $profile->id . '" />';
            echo '<input type="submit" value="' . _('Delete this profile') . '" />';
            echo '</form></td>';
        }
        echo '</tr>';
    }
    echo '</table>';
    echo '</div>';
    echo '</div>';
    page_footer();
    die;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:33,代码来源:profiles.php


示例3: getMyPermissionsHash

function getMyPermissionsHash()
{
    $permissionsList = "";
    if (isAuthorized()) {
        if (isset(Reg::get('usr')->perms) and !empty(Reg::get('usr')->perms)) {
            if (is_array(Reg::get('usr')->perms->permissionsList)) {
                foreach (Reg::get('usr')->perms->permissionsList as $perm) {
                    $permissionsList .= $perm->id . ':';
                }
            }
        }
    }
    return md5($permissionsList);
}
开发者ID:Welvin,项目名称:stingle,代码行数:14,代码来源:functions.inc.php


示例4: grantAccess

function grantAccess()
{
    $MM_restrictGoTo = "index.php";
    if (!(isset($_SESSION['MM_Username']) && isAuthorized("", $MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup']))) {
        $MM_qsChar = "?";
        $MM_referrer = $_SERVER['PHP_SELF'];
        if (strpos($MM_restrictGoTo, "?")) {
            $MM_qsChar = "&";
        }
        if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) {
            $MM_referrer .= "?" . $QUERY_STRING;
        }
        $MM_restrictGoTo = $MM_restrictGoTo . $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
        header("Location: " . $MM_restrictGoTo);
        exit;
    }
}
开发者ID:seLuFerrando,项目名称:padelPrivee,代码行数:17,代码来源:functions.php


示例5: Twig_Loader_Filesystem

<?php

require_once "../subs.php";
require_once "../conf.inc.php";
require_once "../lib/dblayer.php";
require_once "./subs.php";
require_once "../vendor/autoload.php";
// Twig инициализация
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates");
// Twig папка с шаблонами
$twig = new Twig_Environment($loader, array("cache" => "../cache", "auto_reload" => 1));
// Twig no cache
$template = 'tools.twig';
if ($admin_login = isAuthorized()) {
    $c['nojs'] = true;
    $users = getUsers();
    $permissions = getPermissions($admin_login["uid"], $users);
    if ($permissions["bills"] == 'deny') {
        unset($TITLE["bills"]);
    }
    if ($permissions["users"] == 'deny') {
        unset($TITLE["users"]);
    }
    $c['dir'] = basename(__DIR__);
    $TITLE['helpdesk/reports'] = "Отчёты";
    $c['sections'] = $TITLE;
    $categories = getCategories();
    $c["cat"] = $_cat = checkRequest("cat");
    if ($_cat) {
        $c['current_cat'] = getCategory($_cat);
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:index.php


示例6: pageClearence

 function pageClearence($secLevel, $AUTH_redirectTo)
 {
     if (!isAuthorized($secLevel)) {
         header("Location: " . $AUTH_redirectTo);
     }
 }
开发者ID:hackdracko,项目名称:Facturacion-Kio,代码行数:6,代码来源:utils.php


示例7: ini_set

<?php

/*
 * index.php
 * general page
 *
 */
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
require 'subs.php';
require 'conf.inc.php';
require_once "lib/dblayer.php";
$stage = isset($_REQUEST['stage']) ? check_string($_REQUEST['stage'], 'string') : null;
// Стадия
if (isAuthorized()) {
    header("Location: home");
} else {
    //    echo 2;
    authorize();
}
if ($db_err["error_no"] != null) {
    print_r($db_err);
}
// DB-errors
开发者ID:progervlad,项目名称:utils,代码行数:24,代码来源:index.php


示例8: 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


示例9: show_default

function show_default()
{
    $tasks = $_SESSION['service']->tasks_list();
    if (is_null($tasks)) {
        popup_error(_('Internal error requestings tasks'));
        redirect();
    }
    $servers_ = $_SESSION['service']->getOnlineServersList();
    if (is_null($servers_)) {
        $servers_ = array();
    }
    $servers = array();
    foreach ($servers_ as $server) {
        if (isset($server->ulteo_system) && $server->ulteo_system == 1) {
            $servers[] = $server;
        }
    }
    $can_do_action = isAuthorized('manageServers');
    page_header();
    echo '<div id="tasks_div">';
    echo '<h1>' . _('Tasks') . '</h1>';
    if (count($tasks) > 0) {
        echo '<div id="tasks_list_div">';
        echo '<h2>' . _('List of tasks') . '</h2>';
        echo '<table class="main_sub sortable" id="tasks_list_table" border="0" cellspacing="1" cellpadding="5">';
        echo '<thead>';
        echo '<tr class="title">';
        echo '<th>' . _('ID') . '</th>';
        echo '<th>' . _('Creation time') . '</th>';
        echo '<th>' . _('Type') . '</th>';
        echo '<th>' . _('Server') . '</th>';
        echo '<th>' . _('Status') . '</th>';
        echo '<th>' . _('Details') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($tasks as $task) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            if (array_key_exists($task->server, $servers_)) {
                $server_name = $servers_[$task->server]->getDisplayName();
            } else {
                $server_name = $task->server;
            }
            $can_remove = $task->succeed() || $task->failed();
            if ($task->succeed()) {
                $status = '<span class="msg_ok">' . _('Finished') . '</span>';
            } elseif ($task->failed()) {
                $status = '<span class="msg_error">' . _('Error') . '</span>';
            } elseif ($task->status == 'in progress') {
                $status = '<span class="msg_warn">' . _('In progress') . '</span>';
            } else {
                $status = $task->status;
            }
            echo '<tr class="' . $content . '">';
            echo '<td><a href="?action=manage&id=' . $task->id . '">' . $task->id . '</a></td>';
            echo '<td>' . date('Y-m-d H:i:s', $task->t_begin) . '</td>';
            echo '<td>' . $task->getAttribute('type') . '</td>';
            echo '<td><a href="servers.php?action=manage&id=' . $task->server . '">' . $server_name . '</a></td>';
            echo '<td>' . $status . '</td>';
            echo '<td>' . $task->getAttribute('request') . '</td>';
            // todo !!!
            if ($can_do_action) {
                echo '<td>';
                if ($can_remove) {
                    echo '<form action="actions.php" method="post">';
                    echo '<input type="hidden" name="name" value="Task" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="checked_tasks[]" value="' . $task->id . '" />';
                    echo '<input type="submit" value="' . _('Delete') . '" />';
                    echo '</form>';
                }
                echo '</td>';
            }
            echo '</tr>';
        }
        echo '</tbody>';
        echo '</table>';
        echo '</div>';
    }
    $can_do_action = False;
    if (count($servers) > 0 && $can_do_action) {
        echo '<h2>' . _('Install an application from a package name') . '</h2>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Task" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<select name="server">';
        foreach ($servers as $server) {
            echo '<option value="' . $server->id . '">' . $server->getDisplayName() . '</option>';
        }
        echo '</select> &nbsp; ';
        echo '<input type="text" name="request" value="" /> &nbsp; ';
        echo '<input type="hidden" name="type" value="install_from_line" />';
        echo '<input type="submit" name="submit" value="' . _('Install') . '" />';
        echo '</form>';
        echo '<h2>' . _('Upgrade the internal system and applications') . '</h2>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Task" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="type" value="upgrade" />';
//.........这里部分代码省略.........
开发者ID:bloveing,项目名称:openulteo,代码行数:101,代码来源:tasks.php


示例10: footer_static

            footer_static();
        }
    } else {
        // conf not valid
        if ($setup) {
            popup_error('Error : ' . $ret);
            redirect('configuration.php?action=init');
        } else {
            header_static(_('Configuration'));
            echo '<p class="msg_error centered">' . $ret . '</p>';
            print_prefs($prefs);
            footer_static();
        }
    }
} else {
    $can_manage_configuration = isAuthorized('manageConfiguration');
    if (isset($_GET['action']) && $_GET['action'] == 'init') {
        try {
            $prefs = new Preferences_admin();
        } catch (Exception $e) {
        }
        $prefs->initialize();
        require_once dirname(__FILE__) . '/includes/page_template.php';
        page_header();
        // printing of preferences
        if ($can_manage_configuration) {
            echo '<form method="post" action="configuration.php">';
            echo '<input type="hidden" name="setup" value="setup" />';
        }
        print_prefs5($prefs, 'general', 'sql');
        if ($can_manage_configuration) {
开发者ID:skdong,项目名称:nfs-ovd,代码行数:31,代码来源:configuration.php


示例11:

                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td><div align="right">Observaciones:</div></td>
                      <td><label>
                        <textarea name="observaciones" cols="50" rows="5" id="observaciones"></textarea>
                      </label></td>
                      <td>&nbsp;</td>
                    </tr>
                    <?php 
if ($row_empleado['idunidadnegocio'] == $TYE_UNIDADNEGOCIO_DANONE || isAuthorized($FWK_PRIV_CONFIGURACION)) {
    ?>
							<tr>
                              <td><div align="right">Refacturar:</div></td>

								<td><select name="refacturar" id="refacturar">
                          <option value="0" selected>No refacturar</option>
                          <option value="4">Bonafont Themis</option>
						  <option value="5">Bonafont Training</option>
						  <option value="6">Bonafont IT</option>
						  <option value="7">Bonafont Compensaciones</option>
                          <option value="1">Colombia</option>
                          <option value="2">Guatemala</option>
                          <option value="3">El Salvador</option>
                        </select>                             </td>
                              <td>&nbsp;</td>
开发者ID:hackdracko,项目名称:envasadoras,代码行数:31,代码来源:comprobacion_tc.php


示例12: header

//防止直接登入
if (!$_SESSION['MM_Username'] || !$_SESSION['MM_UserGroup']) {
    header("Location: " . $MM_redirectLoginFailed1);
}
//防止管理员进入
function isAuthorized($UserName, $UserGroup)
{
    $isValid = False;
    if (!empty($UserGroup)) {
        if ($UserGroup['authority'] == 1) {
            $isValid = true;
        }
    }
    return $isValid;
}
if (isAuthorized($_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])) {
    header("Location: " . $MM_redirectLoginFailed2);
}
//get data from the database of user's informaiton
$id_quest = sprintf("SELECT id,username FROM admin  WHERE username='" . $_SESSION['MM_Username'] . "' AND password='" . $_SESSION['MM_UserGroup']['password'] . "'");
$id_set = mysqli_query($connect, $id_quest) or die(mysql_error());
$id = mysqli_fetch_assoc($id_set);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0047)http://thechoose.phpnet.us/hushi2014070801.html -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">

<title>教育交流协会</title>
<meta name="keywords" content="个人留学直通车,中日人才交流援助平台,出国,留学,留日,人才交流,援助平台,培训,IPA,对外汉语">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta name="description" content="个人留学直通车,中日人才交流援助平台,出国,留学,留日,人才交流,援助平台,培训,IPA">
开发者ID:jaean1993,项目名称:education_website,代码行数:31,代码来源:newfang_userhome.php


示例13: Explode

        $arrGroups = Explode(",", $strGroups);
        if (in_array($UserName, $arrUsers)) {
            $isValid = true;
        }
        // Or, you may restrict access to only certain users based on their username.
        if (in_array($UserGroup, $arrGroups)) {
            $isValid = true;
        }
        if ($strUsers == "" && true) {
            $isValid = true;
        }
    }
    return $isValid;
}
$MM_restrictGoTo = "../index.php?error=2";
if (!(isset($_SESSION['MM_arica']) && isAuthorized("5,4,2", $MM_authorizedUsers, $_SESSION['MM_arica'], $_SESSION['MM_UserGroup']))) {
    $MM_qsChar = "?";
    $MM_referrer = $_SERVER['PHP_SELF'];
    if (strpos($MM_restrictGoTo, "?")) {
        $MM_qsChar = "&";
    }
    if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) {
        $MM_referrer .= "?" . $QUERY_STRING;
    }
    $MM_restrictGoTo = $MM_restrictGoTo . $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
    header("Location: " . $MM_restrictGoTo);
    exit;
}
?>

<?php 
开发者ID:sebasotelo,项目名称:Arica.cl,代码行数:31,代码来源:index.php


示例14: isAuthorizedW

 public function isAuthorizedW($user)
 {
     // All registered users can add posts
     if ($this->action === 'add' || $this->action === 'index' || $this->action === 'dashboard_user') {
         return true;
     }
     // The owner of a post can edit and delete it
     if (in_array($this->action, array('edit', 'delete'))) {
         $postId = (int) $this->request->params['pass'][0];
         if ($this->Wallet->isOwnedBy($postId, $user['id'])) {
             return true;
         }
     }
     return isAuthorized($user);
 }
开发者ID:yenchuchu,项目名称:MoneyLover,代码行数:15,代码来源:WalletsController.php


示例15: isAuthorized

<?php

function isAuthorized()
{
    return isset($_SESSION['userId']);
}
function getUserData($id = null, Mysql $mysql)
{
    $user = ['companyId' => 0, 'companyPrivs' => 0];
    if (!$id) {
        return $user;
    }
    $query = $mysql->mq('
								SELECT
									`companyId`,
									`companyPrivs`
								FROM
									`company`
								WHERE 
									`companyId` = ' . (int) $id . '
								LIMIT 1
									
						');
    return $mysql->assoc($query);
}
$userInfo = getUserData(isAuthorized() ? $_SESSION['userId'] : null, $mysql);
开发者ID:Zzepish,项目名称:CMS-for-phone,代码行数:26,代码来源:authorizationAjax.php


示例16: redirect

<?php

$_documentTitle = _KEYWORDS;
// Show "Page not found" for a non-administrator user.
if (!atLeastModerator()) {
    include INCLUDES . "p_notfound.php";
    return;
}
if (!isAuthorized('isKeywordsAdmin')) {
    include INCLUDES . "p_notfound.php";
    return;
}
if ($_cmd[1] == "build") {
    // rebuild keywords cache
    include INCLUDES . "mod_keywords_build.php";
    redirect(url("keywords", array("updated" => 1)));
}
?>
<div class="header">
	<div class="header_title">
		<?php 
echo _ADMINISTRATION;
?>
		<div class="subheader"><?php 
echo _KEYWORDS_SUBTITLE;
?>
</div>
	</div>
	<?php 
$active = 2;
include INCLUDES . "mod_adminmenu.php";
开发者ID:brocococonut,项目名称:yGallery,代码行数:31,代码来源:p_keywords.php


示例17: ini_set

<?php

ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
session_start();
require_once "./subs.php";
require_once "./conf.php";
require_once "../subs.php";
require_once "../conf.inc.php";
require_once "../lib/dblayer.php";
$result['msg'] = "Unknown error";
$result['success'] = false;
if ($admin_login = isKnownUser($_SESSION['username']) or $admin_login = isAuthorized()) {
    /*  Получаем параметры в виде JSON-объекта и преобразуем в асс.массив
     *  Обязательный параметр - 'action'
     * */
    $action = $_REQUEST['action'];
    $c['admin_id'] = $admin_login["uid"];
    $users = getUsers();
    switch ($action) {
        // Сохраняем пользовательский фильтр
        case 'saveNewFilter':
            $global = check_string($_REQUEST['global'], 'digits');
            $user_id = $global != 1 ? $admin_login['uid'] : '0';
            $name = check_string($_REQUEST['name'], 'text');
            $filter = check_string($_REQUEST['filter'], 'json');
            if ($filter != '' and $user_id != '' and $name != '' and $global != '') {
                $query_save = $db->query("INSERT INTO helpdesk_filter (`name`, `user`, `filter`)\r\n                                                                     VALUES ('{$name}', '{$user_id}', '{$filter}')");
                if ($query_save) {
                    $result['success'] = true;
                    $result['msg'] = "Фильтр {$name} успешно сохранён";
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:ajax.php


示例18: str_replace

                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "defined":
                $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
                break;
        }
        return $theValue;
    }
}
$url = str_replace('/' . $config['project_folder'], '', $_SERVER['PHP_SELF']);
mysql_select_db($database_dares_conn, $dares_conn);
$query_get_prem_by_self_page = sprintf("SELECT prem_role_ids FROM sys_permission WHERE prem_url = %s", GetSQLValueString($url, "text"));
$get_prem_by_self_page = mysql_query($query_get_prem_by_self_page, $dares_conn) or die(mysql_error());
$row_get_prem_by_self_page = mysql_fetch_assoc($get_prem_by_self_page);
$totalRows_get_prem_by_self_page = mysql_num_rows($get_prem_by_self_page);
$MM_authorizedUsers = $row_get_prem_by_self_page['prem_role_ids'];
$MM_donotCheckaccess = "false";
$MM_restrictGoTo = $config['http_base_url'] . "index.php";
if (!(isset($_SESSION['User_name']) && isAuthorized("", $MM_authorizedUsers, $_SESSION['User_name'], $_SESSION['User_roles']))) {
    $MM_qsChar = "?";
    $MM_referrer = $_SERVER['PHP_SELF'];
    if (strpos($MM_restrictGoTo, "?")) {
        $MM_qsChar = "&";
    }
    if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) {
        $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
    }
    $MM_restrictGoTo = $MM_restrictGoTo . $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
    header("Location: " . $MM_restrictGoTo);
    exit;
}
开发者ID:hisambahaa,项目名称:Ecss,代码行数:31,代码来源:perm.php


示例19: show_manage

function show_manage($news_id_)
{
    $news = $_SESSION['service']->news_info($news_id_);
    if (!is_object($news)) {
        redirect('news.php');
    }
    $can_manage_news = isAuthorized('manageNews');
    page_header();
    echo '<div id="news_div">';
    echo '<h1>' . $news->title . '</h1>';
    echo '<div>';
    echo '<h2>' . _('Modify') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    if ($can_manage_news) {
        echo '<form action="news.php" method="post">';
        echo '<input type="hidden" name="action" value="rename" />';
        echo '<input type="hidden" name="id" value="' . $news->id . '" />';
        echo '<tr><td><strong>Title:</strong></td><td><input type="text" name="news_title" value="' . $news->title . '" /></td></tr>';
        echo '<tr><td><strong>Content:</strong></td><td><textarea name="news_content" cols="40" rows="4">' . $news->content . '</textarea></td></tr>';
        echo '<tr><td colspan="2"><input type="submit" value="' . _('Modify') . '" /></td></tr>';
        echo '</form>';
    }
    echo '</table>';
    echo '</div>';
    echo '</div>';
    page_footer();
}
开发者ID:bloveing,项目名称:openulteo,代码行数:27,代码来源:news.php


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isBannedEmail函数代码示例发布时间:2022-05-15
下一篇:
PHP isAuthenticated函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap