本文整理汇总了PHP中security::hasGrant方法的典型用法代码示例。如果您正苦于以下问题:PHP security::hasGrant方法的具体用法?PHP security::hasGrant怎么用?PHP security::hasGrant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::hasGrant方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$content .= "\n\t\t\t\t</table>\n\t\t\t\t<br />\n\t";
}
$content .= "\n\t\t\t</div>\n\t\t\t<div style=\"width: 350px; float: right;\">\n\t\t\t";
if (security::hasGrant('USER_SELECT')) {
$content .= "\t\t\t\n\t\t\t\t<h2 class=\"dark\">{$lang['infos']}</h2>\n\t\t\t\t<form action=\"/admin/users/update_action\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$user['id']}\" />\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"password\" name=\"pass\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['pass_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"password\" name=\"confirm\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['confirm_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"text\" name=\"date\" value=\"" . date($lang['dateformat'], $user['date']) . "\" disabled />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['date_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"text\" name=\"email\" value=\"{$user['email']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['email_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"text\" name=\"firstname\" value=\"{$user['firstname']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['firstname_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"text\" name=\"lastname\" value=\"{$user['lastname']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['lastname_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 300px;\" type=\"text\" name=\"organisation\" value=\"{$user['organisation']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['organisation_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<textarea style=\"width: 300px; height: 100px;\" name=\"postal_address\">{$user['postal_address']}</textarea>\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['postal_address_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<div style=\"float: left;\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 50px;\" type=\"text\" name=\"postal_code\" value=\"{$user['postal_code']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['postal_code_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style=\"float: left; padding-left: 30px;\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input style=\"width: 200px;\" type=\"text\" name=\"locality\" value=\"{$user['locality']}\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['locality_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t</div>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<select name=\"billing\" style=\"width: 320px\">\n\t\t\t\t\t\t\t<option value=\"3\" " . ($user['billing'] == 3 ? "selected" : "") . ">{$lang['billing_year']}</option>\n\t\t\t\t\t\t\t<option value=\"2\" " . ($user['billing'] == 2 ? "selected" : "") . ">{$lang['billing_month']}</option>\n\t\t\t\t\t\t\t<option value=\"1\" " . ($user['billing'] == 1 ? "selected" : "") . ">{$lang['billing_auto']}</option>\n\t\t\t\t\t\t\t<option value=\"0\" " . ($user['billing'] == 0 ? "selected" : "") . ">{$lang['nobilling']}</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['billing_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input type=\"submit\" value=\"{$lang['update']}\" />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>";
}
$content .= "\n\t\t\t\t<br />\n";
if (security::hasGrant('GROUP_USER_SELECT')) {
$usergroups = api::send('group/user/list', array('user' => $_GET['id']));
if (security::hasGrant('GROUP_SELECT')) {
$groups = api::send('group/list');
} else {
$groups = $usergroups;
}
$content .= "\n\t\t\t\t\t<h2 class=\"dark\">{$lang['groups']}</h2>\n\t\t\t\t\t<form action=\"/admin/users/join_action\" method=\"post\">\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>{$lang['groupname']}</th>\n\t\t\t\t\t\t\t\t<th>{$lang['member']}</th>\n\t\t\t\t\t\t\t</tr>\n\t";
if (security::hasGrant(array('GROUP_USER_INSERT', 'GROUP_USER_DELETE'))) {
$disabled = '';
} else {
$disabled = 'disabled';
}
foreach ($groups as $g) {
$checked = '';
foreach ($usergroups as $g2) {
if ($g['id'] == $g2['id']) {
$checked = 'checked';
break;
}
}
$content .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$g['name']}</td>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"group[]\" value=\"{$g['id']}\" {$disabled} {$checked} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t\t</table>\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$user['id']}\" />\n\t\t\t\t\t<br />\n\t\t\t\t\t<input type=\"submit\" value=\"{$lang['update']}\" {$disabled} />\n\t\t\t\t</form>";
示例2: array
}
$group = $group[0];
$content = "\n\t\t<div class=\"admin\">\n\t\t\t<div class=\"top\">\n\t\t\t\t<h1 class=\"dark\">{$lang['title']}</h1>\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div><br />\n\t\t\t<div class=\"container\">\n\t\t\t\t<div style=\"width: 380px; float: left;\">\n\t\t\t\t\t\t<h2 class=\"dark\">{$lang['grants']}</h3>\n";
if (security::hasGrant('GRANT_GROUP_SELECT')) {
$groupgrants = api::send('grant/group/list', array('group' => $_GET['id']));
if (security::hasGrant('GRANT_SELECT')) {
$grants = api::send('grant/list');
} else {
$grants = $groupgrants;
}
$content .= "\n\t\t\t\t\t<form action=\"/admin/groups/grant_action\" method=\"post\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$_GET['id']}\" />\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>{$lang['grantname']}</th>\n\t\t\t\t\t\t\t\t<th>{$lang['granted']}</th>\n\t\t\t\t\t\t\t</tr>";
if (security::hasGrant(array('GRANT_GROUP_INSERT', 'GRANT_GROUP_DELETE'))) {
$disabled = '';
} else {
$disabled = 'disabled';
}
foreach ($grants as $g) {
$checked = '';
foreach ($groupgrants as $k) {
if ($g['id'] == $k['id']) {
$checked = 'checked';
break;
}
}
$content .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>{$g['name']}</td>\n\t\t\t\t\t\t\t<td style=\"text-align: center;\">\n\t\t\t\t\t\t\t\t<input style=\"margin: 0 auto;\" type=\"checkbox\" name=\"grant[]\" value=\"{$g['id']}\" {$disabled} {$checked} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t\t</table>\n\t\t\t\t\t<br />\n\t\t\t\t\t<input type=\"submit\" value=\"{$lang['update']}\" {$disabled} />\n\t\t\t\t</form>\n\t";
}
$content .= "\n\t\t\t</div>\n\t\t\t<div style=\"width: 600px; float: right;\">\n\t\t\t\t<h2 class=\"dark\">{$lang['rename']}</h2>\n\t\t\t\t<form action=\"/admin/groups/update_action\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$group['id']}\" />\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input type=\"text\" name=\"name\" value=\"{$group['name']}\" style=\"width: 400px;\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['name']}</span>\n\t\t\t\t\t</fieldset>\t\t\t\t\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input type=\"submit\" value=\"{$lang['update']}\" " . (security::hasGrant('GROUP_UPDATE') ? '' : 'disabled') . " />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div><br /><br />\n\t\t</div>\n\t</div>";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);
示例3: header
<?php
if (!defined('PROPER_START')) {
header("HTTP/1.0 403 Forbidden");
exit;
}
$grants = api::send('grant/list');
$content = "\n\t\t<div class=\"admin\">\n\t\t\t<div class=\"top\">\n\t\t\t\t<div class=\"left\" style=\"padding-top: 5px;\">\n\t\t\t\t\t<h1 class=\"dark\">{$lang['title']}</h1>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"right\">\n\t\t\t\t\t<a class=\"button classic\" href=\"#\" onclick=\"\$('#new').dialog('open'); return false;\" style=\"width: 180px; height: 22px; float: right;\">\n\t\t\t\t\t\t<img style=\"float: left;\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/plus-white.png\" />\n\t\t\t\t\t\t<span style=\"display: block; padding-top: 3px;\">{$lang['add']}</span>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div>\n\t\t\t<div class=\"content\">\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>{$lang['name']}</th>\n\t\t\t\t\t\t<th style=\"width: 100px; text-align: center;\">{$lang['action']}</th>\n\t\t\t\t\t</tr>\n";
foreach ($grants as $g) {
$content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>{$g['name']}</td>\n\t\t\t\t\t\t<td style=\"width: 100px; text-align: center;\">\n\t\t\t\t\t\t\t<a href=\"/admin/grants/detail?id={$g['id']}\" title=\"{$lang['manage']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/preview.png\" alt=\"{$lang['manage']}\" /></a>";
if (security::hasGrant('GRANT_DELETE')) {
$content .= "\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"/admin/grants/del_action?id={$g['id']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/close.png\" alt=\"{$lang['delete']}\" /></a>";
}
$content .= "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</div>\n\t\t";
if (security::hasGrant('GRANT_INSERT')) {
$content .= "\n\t\t<div id=\"new\" class=\"floatingdialog\">\n\t\t\t<h3 class=\"center\">{$lang['add']}</h3>\n\t\t\t<p style=\"text-align: center;\">{$lang['add_text']}</p>\n\t\t\t<div class=\"form-small\">\t\t\n\t\t\t\t<form action=\"/admin/grants/add_action\" method=\"post\" class=\"center\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['name']}\" name=\"name\" onfocus=\"this.value = this.value=='{$lang['name']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['name']}' : this.value; this.value=='{$lang['name']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['name_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\t\n\t\t\t\t\t\t<input autofocus type=\"submit\" value=\"{$lang['create']}\" />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</div>";
}
$content .= "\n\t\t<script type=\"text/javascript\">\n\t\t\tnewFlexibleDialog('new', 550);\n\t\t</script>";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);
示例4: header
<?php
if (!defined('PROPER_START')) {
header("HTTP/1.0 403 Forbidden");
exit;
}
$quotas = api::send('quota/list');
$content = "\n\t<div class=\"admin\">\n\t\t\t<div class=\"top\">\n\t\t\t\t<div class=\"left\" style=\"padding-top: 5px;\">\n\t\t\t\t\t<h1 class=\"dark\">{$lang['title']}</h1>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"right\">\n\t\t\t\t\t<a class=\"button classic\" href=\"#\" onclick=\"\$('#new').dialog('open'); return false;\" style=\"width: 180px; height: 22px; float: right;\">\n\t\t\t\t\t\t<img style=\"float: left;\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/plus-white.png\" />\n\t\t\t\t\t\t<span style=\"display: block; padding-top: 3px;\">{$lang['add']}</span>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div>\n\t\t\t<div class=\"content\">\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>{$lang['name']}</th>\n\t\t\t\t\t\t<th style=\"width: 100px; text-align: center;\">{$lang['action']}</th>\n\t\t\t\t\t</tr>\n";
foreach ($quotas as $q) {
$content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>{$q['name']}</td>\n\t\t\t\t\t\t<td style=\"width: 100px; text-align: center;\">\n";
if (security::hasGrant('QUOTA_DELETE')) {
$content .= "\n\t\t\t\t\t\t<a href=\"/admin/quotas/del_action?id={$q['id']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/close.png\" alt=\"{$lang['delete']}\" /></a>";
}
$content .= "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</div>\n";
if (security::hasGrant('QUOTA_INSERT')) {
$content .= "\n\t\t<div id=\"new\" class=\"floatingdialog\">\n\t\t\t<h3 class=\"center\">{$lang['add']}</h3>\n\t\t\t<p style=\"text-align: center;\">{$lang['add_text']}</p>\n\t\t\t<div class=\"form-small\">\t\t\n\t\t\t\t<form action=\"/admin/quotas/add_action\" method=\"post\" class=\"center\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['name']}\" name=\"name\" onfocus=\"this.value = this.value=='{$lang['name']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['name']}' : this.value; this.value=='{$lang['name']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['name_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\t\n\t\t\t\t\t\t<input autofocus type=\"submit\" value=\"{$lang['create']}\" />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</div>";
}
$content .= "\n\t\t<script type=\"text/javascript\">\n\t\t\tnewFlexibleDialog('new', 550);\n\t\t</script>";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);
示例5: header
<?php
if (!defined('PROPER_START')) {
header("HTTP/1.0 403 Forbidden");
exit;
}
$userinfo = api::send('self/user/list');
$userinfo = $userinfo[0];
$quotas = api::send('self/quota/user/list');
if (security::hasGrant('SELF_APP_SELECT')) {
$apps = api::send('self/app/list');
}
foreach ($quotas as $q) {
if ($q['name'] == 'APPS') {
$aquota = $q;
}
if ($q['name'] == 'MEMORY') {
$mquota = $q;
}
}
if ($mquota['max'] == 0 && $aquota['max'] == 0) {
template::redirect('/panel/plans');
}
$domains = api::send('self/domain/list');
if (count($domains) == 0) {
template::redirect('/panel/domains');
}
if ($mquota['max'] > 0) {
$mpercent = $mquota['used'] * 100 / $mquota['max'];
}
if ($aquota['max'] > 0) {
示例6: header
<?php
if (!defined('PROPER_START')) {
header("HTTP/1.0 403 Forbidden");
exit;
}
$groups = api::send('group/list');
$content = "\n\t\t<div class=\"admin\">\n\t\t\t<div class=\"top\">\n\t\t\t\t<div class=\"left\" style=\"padding-top: 5px;\">\n\t\t\t\t\t<h1 class=\"dark\">{$lang['title']}</h1>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"right\">\n\t\t\t\t\t<a class=\"button classic\" href=\"#\" onclick=\"\$('#new').dialog('open'); return false;\" style=\"width: 180px; height: 22px; float: right;\">\n\t\t\t\t\t\t<img style=\"float: left;\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/plus-white.png\" />\n\t\t\t\t\t\t<span style=\"display: block; padding-top: 3px;\">{$lang['add']}</span>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div>\n\t\t\t<div class=\"content\">\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>{$lang['name']}</th>\n\t\t\t\t\t\t<th style=\"width: 100px; text-align: center;\">{$lang['action']}</th>\n\t\t\t\t\t</tr>";
foreach ($groups as $g) {
$content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>{$g['name']}</td>\n\t\t\t\t\t\t<td style=\"width: 100px; text-align: center;\">\n\t\t\t\t\t\t\t<a href=\"/admin/groups/detail?id={$g['id']}\" title=\"{$lang['manage']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/preview.png\" alt=\"{$lang['manage']}\" /></a>";
if (security::hasGrant('GROUP_DELETE')) {
$content .= "\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"/admin/groups/del_action?id={$g['id']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/close.png\" alt=\"{$lang['delete']}\" /></a>";
}
$content .= "\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</div>\n";
if (security::hasGrant('GROUP_INSERT')) {
$content .= "\n\t\t<div id=\"new\" class=\"floatingdialog\">\n\t\t\t<h3 class=\"center\">{$lang['add']}</h3>\n\t\t\t<p style=\"text-align: center;\">{$lang['add_text']}</p>\n\t\t\t<div class=\"form-small\">\t\t\n\t\t\t\t<form action=\"/admin/groups/add_action\" method=\"post\" class=\"center\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['name']}\" name=\"name\" onfocus=\"this.value = this.value=='{$lang['name']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['name']}' : this.value; this.value=='{$lang['name']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t\t<span class=\"help-block\">{$lang['name_help']}</span>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset>\t\n\t\t\t\t\t\t<input autofocus type=\"submit\" value=\"{$lang['create']}\" />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</div>";
}
$content .= "\n\t\t<script type=\"text/javascript\">\n\t\t\tnewFlexibleDialog('new', 550);\n\t\t</script>";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);