本文整理汇总了PHP中user_has_permission函数的典型用法代码示例。如果您正苦于以下问题:PHP user_has_permission函数的具体用法?PHP user_has_permission怎么用?PHP user_has_permission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_has_permission函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_as_button
function login_as_button($uid, $upassword, $text = '', $attr = 'class="awesome small grey"')
{
if (user_has_permission('admin.accounts.can_login_as')) {
$text = !$text ? lang('admin_login_as') : $text;
return anchor(login_as_url($uid, $upassword), $text, $attr);
} else {
return '';
}
}
示例2: __construct
function __construct()
{
parent::__construct();
$this->load->library('session');
$this->config->load('permissions', TRUE);
$this->config->load('validations', TRUE);
if (!$this->session->userdata('loggedin')) {
redirect('sessions/login');
}
if (!user_has_permission($this->session->userdata('loggedin_user'), $this->router->class, $this->router->method)) {
redirect('/');
// show_error('Nu poti accesa pagina');
}
$this->current_user = $this->session->userdata('loggedin_user');
}
示例3: _groups_set_default
protected function _groups_set_default()
{
if (!user_has_permission('admin.accounts.can_set_default_group')) {
show_404();
}
// --------------------------------------------------------------------------
if ($this->user_group_model->set_as_default($this->uri->segment(5))) {
$this->session->set_flashdata('success', '<strong>Success!</strong> Group set as default successfully.');
} else {
$this->session->set_flashdata('error', '<strong>Sorry,</strong> I could not set that group as the default user group. ' . $this->user_group_model->last_error());
}
redirect('admin/accounts/groups');
}
示例4: number_format
?>
</td>
<td class="uses"><?php
echo number_format($voucher->use_count);
?>
</td>
<td class="actions">
<?php
$_buttons = array();
// --------------------------------------------------------------------------
if ($voucher->is_active) {
if (user_has_permission('admin.shop.vouchers_deactivate')) {
$_buttons[] = anchor('admin/shop/vouchers/deactivate/' . $voucher->id, 'Suspend', 'class="awesome small red confirm"');
}
} else {
if (user_has_permission('admin.shop.vouchers_activate')) {
$_buttons[] = anchor('admin/shop/vouchers/activate/' . $voucher->id, 'Activate', 'class="awesome small green"');
}
}
// --------------------------------------------------------------------------
if ($_buttons) {
foreach ($_buttons as $button) {
echo $button;
}
} else {
echo '<span class="blank">There are no actions you can do on this item.</span>';
}
?>
</td>
</tr>
<?php
示例5: anchor
echo '</td>';
} else {
echo '<td class="default error">';
echo '<span class="ion-close-circled"></span>';
echo '</td>';
}
?>
<td class="actions">
<?php
if (user_has_permission('admin.accounts.can_edit_group')) {
echo anchor('admin/accounts/groups/edit/' . $group->id, lang('action_edit'), 'class="awesome small"');
}
if (user_has_permission('admin.accounts.can_delete_group')) {
echo anchor('admin/accounts/groups/delete/' . $group->id, lang('action_delete'), 'class="awesome small red confirm" data-body="This action is also not undoable." data-title="Confirm Delete"');
}
if (user_has_permission('admin.accounts.can_set_default_group') && !$group->is_default) {
echo anchor('admin/accounts/groups/set_default/' . $group->id, lang('accounts_groups_index_action_set_default'), 'class="awesome green small"');
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
示例6: lang
if ($order->fulfilment_status == 'FULFILLED') {
echo '<td class="fulfilment yes">' . lang('yes') . '</td>';
} else {
echo '<td class="fulfilment no">' . lang('no') . '</td>';
}
?>
<td class="actions">
<?php
// Render buttons
$_buttons = array();
// --------------------------------------------------------------------------
if (user_has_permission('admin.shop.orders_view')) {
$_buttons[] = anchor('admin/shop/orders/view/' . $order->id, lang('action_view'), 'class="awesome small fancybox" data-fancybox-type="iframe"');
}
// --------------------------------------------------------------------------
if (user_has_permission('admin.shop.orders_reprocess')) {
$_buttons[] = anchor('admin/shop/orders/reprocess/' . $order->id, 'Process', 'class="awesome small confirm" data-title="Are you sure?" data-body="Processing the order again may result in multiple dispatch of items."');
}
// --------------------------------------------------------------------------
if ($_buttons) {
foreach ($_buttons as $button) {
echo $button;
}
} else {
echo '<span class="blank">There are no actions you can perform on this item.</span>';
}
?>
</td>
</tr>
<?php
}
示例7: url
retVal += charset.charAt(Math.floor(Math.random() * n));
}
return retVal;
}
</script>
</head>
<body>
<div id="header">
<div class="title"><a href="<?php
echo url('/');
?>
">WebMUM - Web Mailserver User Manager</a></div>
<div class="header-menu">
<?php
if (user_has_permission("admin")) {
?>
<div class="header-button">
<a href="<?php
echo url('admin');
?>
">[Admin Dashboard]</a>
</div>
<div class="header-button">
<a href="<?php
echo url('private');
?>
">[Personal Dashboard]</a>
</div>
<?php
}
示例8: anchor
if ($member->id == active_user('id') || user_has_permission('admin.accounts.can_edit_others')) {
$_buttons[] = anchor('admin/accounts/edit/' . $member->id . $_return, lang('action_edit'), 'data-fancybox-type="iframe" class="edit fancybox-max awesome small grey"');
}
// --------------------------------------------------------------------------
// Suspend user
if ($member->is_suspended) {
if (user_has_permission('admin.accounts.unsuspend')) {
$_buttons[] = anchor('admin/accounts/unsuspend/' . $member->id . $_return, lang('action_unsuspend'), 'class="awesome small green"');
}
} else {
if (user_has_permission('admin.accounts.suspend')) {
$_buttons[] = anchor('admin/accounts/suspend/' . $member->id . $_return, lang('action_suspend'), 'class="awesome small red"');
}
}
// --------------------------------------------------------------------------
if (user_has_permission('admin.accounts.delete') && $member->id != active_user('id') && $member->group_id != 1) {
$_buttons[] = anchor('admin/accounts/delete/' . $member->id . $_return, lang('action_delete'), 'class="confirm awesome small red" data-title="Delete user "' . $member->first_name . ' ' . $member->last_name . '"?" data-body="' . lang('admin_confirm_delete') . '"');
}
// --------------------------------------------------------------------------
// These buttons are variable between views
foreach ($actions as $button) {
$_buttons[] = anchor($button['url'] . $_return, $button['label'], 'class="awesome small ' . $button['class'] . '"');
}
// --------------------------------------------------------------------------
// Render all the buttons, if any
if ($_buttons) {
foreach ($_buttons as $button) {
echo $button;
}
} else {
echo '<span class="not-editable">' . lang('accounts_index_noactions') . '</span>';
示例9: login_as_button
if ($user_edit->id != active_user('id') && user_has_permission('admin.accounts.can_login_as')) {
$_buttons[] = login_as_button($user_edit->id, $user_edit->password, lang('admin_login_as') . ' ' . $user_edit->first_name, 'class="awesome" target="_parent"');
}
// --------------------------------------------------------------------------
// Edit
if ($user_edit->id != active_user('id') && user_has_permission('admin.accounts.delete')) {
$_buttons[] = anchor('admin/accounts/delete/' . $user_edit->id . '?return_to=' . urlencode('admin/accounts'), lang('action_delete'), 'class="awesome red confirm" data-title="' . lang('admin_confirm_delete_title') . '" data-body="' . lang('admin_confirm_delete_body') . '"');
}
// --------------------------------------------------------------------------
// Suspend
if ($user_edit->is_suspended) {
if (active_user('id') != $user_edit->id && user_has_permission('admin.accounts.unsuspend')) {
$_buttons[] = anchor('admin/accounts/unsuspend/' . $user_edit->id . $return_string, lang('action_unsuspend'), 'class="awesome"');
}
} else {
if (active_user('id') != $user_edit->id && user_has_permission('admin.accounts.suspend')) {
$_buttons[] = anchor('admin/accounts/suspend/' . $user_edit->id . $return_string, lang('action_suspend'), 'class="awesome red"');
}
}
?>
<?php
if ($_buttons) {
?>
<fieldset id="edit-user-actions">
<legend><?php
echo lang('accounts_edit_actions_legend');
?>
</legend>
<p>
<?php
示例10: foreach
if ($attributes) {
foreach ($attributes as $attribute) {
echo '<tr>';
echo '<td class="label">';
echo $attribute->label;
echo $attribute->description ? '<small>' . character_limiter(strip_tags($attribute->description), 225) . '</small>' : '<small>No Description</small>';
echo '</td>';
echo '<td class="count">';
echo !isset($attribute->product_count) ? 'Unknown' : $attribute->product_count;
echo '</td>';
echo $this->load->view('_utilities/table-cell-datetime', array('datetime' => $attribute->modified), TRUE);
echo '<td class="actions">';
if (user_has_permission('admin.shop.attribute_edit')) {
echo anchor('admin/shop/manage/attribute/edit/' . $attribute->id . $is_fancybox, lang('action_edit'), 'class="awesome small"');
}
if (user_has_permission('admin.shop.attribute_delete')) {
echo anchor('admin/shop/manage/attribute/delete/' . $attribute->id . $is_fancybox, lang('action_delete'), 'class="awesome small red confirm" data-title="Are you sure?" data-body="This action cannot be undone."');
}
echo '</td>';
echo '</tr>';
}
} else {
echo '<tr>';
echo '<td colspan="4" class="no-data">';
echo 'No Attributes, add one!';
echo '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
示例11: check_logged
<?php
require_once 'lib/header.php';
require_once 'lib/lib_ne.php';
require_once 'lib/lib_users.php';
// TODO: permissions?
check_logged();
$action = isset($_GET['act']) ? $_GET['act'] : '';
$tagset_id = get_current_tagset();
switch ($action) {
case 'manual':
$smarty->assign('content', get_wiki_page("nermanual/" . (int) $_GET['id']));
$smarty->display('static/doc/annotation.tpl');
break;
default:
$is_ner_mod = user_has_permission(PERM_NE_MODER);
$smarty->assign('possible_guidelines', array(1 => "Default (2014)", 2 => "Dialogue Eval (2016)"));
// TODO read from db
$smarty->assign('is_ner_mod', $is_ner_mod);
$smarty->assign('current_guideline', $tagset_id);
$smarty->assign('page', get_books_with_NE($tagset_id, !$is_ner_mod));
$smarty->display($is_ner_mod ? 'ner/main-moderator.tpl' : 'ner/main.tpl');
}
log_timing();
示例12: array
echo '</td>';
echo '<td class="max-po">';
echo $product_type->max_per_order ? $product_type->max_per_order : 'Unlimited';
echo '</td>';
echo '<td class="max-v">';
echo $product_type->max_variations ? $product_type->max_variations : 'Unlimited';
echo '</td>';
echo '<td class="count">';
echo !isset($product_type->product_count) ? 'Unknown' : $product_type->product_count;
echo '</td>';
echo $this->load->view('_utilities/table-cell-datetime', array('datetime' => $product_type->modified), TRUE);
echo '<td class="actions">';
if (user_has_permission('admin.shop.product_type_edit')) {
echo anchor('admin/shop/manage/product_type/edit/' . $product_type->id . $is_fancybox, lang('action_edit'), 'class="awesome small"');
}
if (user_has_permission('admin.shop.product_type_delete')) {
echo anchor('admin/shop/manage/product_type/delete/' . $product_type->id . $is_fancybox, lang('action_delete'), 'class="awesome small red confirm" data-title="Are you sure?" data-body="This action cannot be undone."');
}
echo '</td>';
echo '</tr>';
}
} else {
echo '<tr>';
echo '<td colspan="4" class="no-data">';
echo 'No Product_types, add one!';
echo '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
示例13: is_permitted
function is_permitted($type='activity') {
return user_has_permission($this->id, $type);
}
示例14: foreach
<tbody>
<?php
if ($menus) {
foreach ($menus as $menu) {
echo '<tr class="menu" data-label="' . $menu->label . '">';
echo '<td class="label">';
echo $menu->label;
echo $menu->description ? '<small>' . $menu->description . '</small>' : '';
echo '</td>';
$this->load->view('admin/_utilities/table-cell-user', $menu->modified_by);
$this->load->view('admin/_utilities/table-cell-datetime', array('datetime' => $menu->modified));
echo '<td class="actions">';
if (user_has_permission('admin.cms.can_edit_menu')) {
echo anchor('admin/cms/menus/edit/' . $menu->id, lang('action_edit'), 'class="awesome small"');
}
if (user_has_permission('admin.cms.can_delete_menu')) {
echo anchor('admin/cms/menus/delete/' . $menu->id, lang('action_delete'), 'data-title="Are you sure?" data-body="This will remove the menu from the site. This action cannot be undone." class="confirm awesome small red"');
}
echo '</td>';
echo '</tr>';
}
} else {
echo '<tr>';
echo '<td colspan="4" class="no-data">';
echo 'No editable menus found';
echo '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
示例15: get_book_page
function get_book_page($book_id, $full = false, $override_hidden = false)
{
if (!$override_hidden) {
check_book_hidden($book_id);
}
$res = sql_pe("SELECT * FROM `books` WHERE `book_id`=? LIMIT 1", array($book_id));
if (!sizeof($res)) {
throw new UnexpectedValueException();
}
$out = array('id' => $book_id, 'title' => $res[0]['book_name'], 'select' => get_books_for_select(), 'is_wikinews' => $res[0]['parent_id'] == 56, 'is_chaskor_news' => $res[0]['parent_id'] == 226);
get_book_tags($book_id, $out);
//sub-books
foreach (sql_pe("SELECT book_id, book_name FROM books WHERE parent_id=? ORDER BY book_name", array($book_id)) as $r) {
$out['children'][] = array('id' => $r['book_id'], 'title' => $r['book_name']);
}
//parents
$out['parents'] = array_reverse(get_book_parents($book_id));
//sentences
if ($full) {
$q = "SELECT p.`pos` ppos, par_id, s.sent_id, s.`pos` spos";
if (user_has_permission(PERM_ADDER)) {
$q .= ", ss.status";
}
$q .= "\nFROM paragraphs p\n LEFT JOIN sentences s\n USING (par_id)\n";
if (user_has_permission(PERM_ADDER)) {
$q .= "LEFT JOIN sentence_check ss ON (s.sent_id = ss.sent_id AND ss.status=1 AND ss.user_id=" . $_SESSION['user_id'] . ")\n";
}
$q .= "WHERE p.book_id = ?\n ORDER BY p.`pos`, s.`pos`";
$res = sql_pe($q, array($book_id));
$res1 = sql_prepare("SELECT tf_id, tf_text FROM tokens WHERE sent_id=? ORDER BY pos");
foreach ($res as $r) {
sql_execute($res1, array($r['sent_id']));
$tokens = array();
while ($r1 = sql_fetch_array($res1)) {
$tokens[] = array('text' => $r1['tf_text'], 'id' => $r1['tf_id']);
}
$new_a = array('id' => $r['sent_id'], 'pos' => $r['spos'], 'tokens' => $tokens);
if (user_has_permission(PERM_ADDER)) {
$new_a['checked'] = $r['status'];
}
$out['paragraphs'][$r['ppos']]['sentences'][] = $new_a;
$out['paragraphs'][$r['ppos']]['id'] = $r['par_id'];
}
} else {
$res = sql_pe("SELECT p.`pos` ppos, s.sent_id, s.`pos` spos FROM paragraphs p LEFT JOIN sentences s ON (p.par_id = s.par_id) WHERE p.book_id = ? ORDER BY p.`pos`, s.`pos`", array($book_id));
foreach ($res as $r) {
$r1 = sql_fetch_array(sql_query("SELECT source, SUBSTRING_INDEX(source, ' ', 6) AS `cnt` FROM sentences WHERE sent_id=" . $r['sent_id'] . " LIMIT 1"));
if ($r1['source'] === $r1['cnt']) {
$out['paragraphs'][$r['ppos']]['sentences'][] = array('pos' => $r['spos'], 'id' => $r['sent_id'], 'snippet' => $r1['source']);
continue;
}
$snippet = '';
$r1 = sql_fetch_array(sql_query("SELECT SUBSTRING_INDEX(source, ' ', 3) AS `start` FROM sentences WHERE sent_id=" . $r['sent_id'] . " LIMIT 1"));
$snippet = $r1['start'];
if ($snippet) {
$snippet .= '... ';
}
$r1 = sql_fetch_array(sql_query("SELECT SUBSTRING_INDEX(source, ' ', -3) AS `end` FROM sentences WHERE sent_id=" . $r['sent_id'] . " LIMIT 1"));
$snippet .= $r1['end'];
$out['paragraphs'][$r['ppos']]['sentences'][] = array('pos' => $r['spos'], 'id' => $r['sent_id'], 'snippet' => $snippet);
}
}
return $out;
}