本文整理汇总了PHP中Authority::can方法的典型用法代码示例。如果您正苦于以下问题:PHP Authority::can方法的具体用法?PHP Authority::can怎么用?PHP Authority::can使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authority
的用法示例。
在下文中一共展示了Authority::can方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Logs one user on the admin panel
*
*/
public function login()
{
$default_admin_lang = Settings::get_default_admin_lang();
// TODO :
// - Replace by : config_item('uri_lang_code');
// - Remove / Rewrite Settings::get_uri_lang()
$uri_lang = Settings::get_uri_lang();
// If the user is already logged and if he is in the correct minimum group, go to Admin
if (User()->logged_in() && Authority::can('access', 'admin')) {
redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
}
if (User()->logged_in() && !Authority::can('access', 'admin')) {
redirect(base_url());
}
if (!empty($_POST)) {
unset($_POST['submit']);
if ($this->_try_validate_login()) {
// User can log with email OR username
if (strpos($_POST['username'], '@') !== FALSE) {
$email = $_POST['username'];
unset($_POST['username']);
$_POST['email'] = $email;
}
try {
User()->login($_POST);
redirect(base_url() . $uri_lang . '/' . config_item('admin_url') . '/auth/login');
} catch (Exception $e) {
$this->login_errors = $e->getMessage();
}
} else {
$this->login_errors = lang('ionize_login_error');
}
} else {
if ($this->is_xhr()) {
$html = '
<script type="text/javascript">
var url = "' . config_item('admin_url') . '";
top.location.href = url;
</script>';
echo $html;
exit;
/*
// Save options : as callback
$this->callback[] = array(
'fn' => 'ION.reload',
'args' => array('url'=> config_item('admin_url'))
);
$this->response();
*/
} else {
if (!in_array($uri_lang, Settings::get('displayed_admin_languages')) or $uri_lang != $default_admin_lang) {
redirect(base_url() . $default_admin_lang . '/' . config_item('admin_url') . '/auth/login');
}
}
}
$this->output('auth/login');
}
示例2: index
/**
* Tree init.
* Displays the tree view, which will call each menu tree builder
*
*/
public function index()
{
// TODO : Limit the number of displayed articles in the tree
// $nb_elements = $this->page_model->count_all() + $this->article_model->count_all();
if (Authority::can('access', 'admin/tree')) {
// Menus : All menus
$menus = $this->menu_model->get_list(array('order_by' => 'ordering ASC'));
$this->template['menus'] = $menus;
$this->output('tree/tree');
}
}
示例3: update
/**
* Update one menu
*
*/
public function update()
{
$id = $this->input->post('id_menu');
if ($id) {
$this->menu_model->update($id, $this->input->post());
if (Authority::can('access', 'admin/menu/permissions/backend')) {
$resource = 'backend/menu/' . $id;
$this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule'));
}
}
// UI update panels
$this->_update_panels();
$this->success(lang('ionize_message_menu_updated'));
}
示例4: tag_authority_can
/**
* @param FTL_Binding $tag
*
* @return string
*/
public static function tag_authority_can(FTL_Binding $tag)
{
$action = $tag->getAttribute('action');
$resource = $tag->getAttribute('resource');
if (empty($action) && empty($resource)) {
return self::show_tag_error($tag, 'Feed the "action" and "resource" attributes');
}
if (Authority::can($action, $resource)) {
return $tag->expand();
} else {
// Else
self::$trigger_else++;
}
return '';
}
示例5: __construct
/**
* Constructor
*
*/
public function __construct()
{
parent::__construct();
// Check the database settings
if ($this->test_database_config() === FALSE) {
redirect(base_url() . 'install/');
die;
}
$this->load->database();
if (!$this->db->db_select()) {
$error =& load_class('Exceptions', 'core');
echo $error->show_error('Database Error', 'Unable to connect to the specified database : ' . $this->db->database, 'error_db');
exit;
}
// Models
$this->load->model(array('base_model', 'settings_model'), '', TRUE);
// Helpers
$this->load->helper('file');
$this->load->helper('trace');
// Get all the website languages from DB and store them into config file "languages" key
$languages = $this->settings_model->get_languages();
Settings::set_languages($languages);
// Settings : google analytics string, filemanager, etc.
// Each setting is accessible through Settings::get('setting_name');
Settings::set_settings_from_list($this->settings_model->get_settings(), 'name', 'content');
Settings::set_settings_from_list($this->settings_model->get_lang_settings(config_item('detected_lang_code')), 'name', 'content');
if (Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
Settings::set_all_languages_online();
}
// Try to find the installer class : No access if install folder is already there
$installer = glob(BASEPATH . '../*/class/installer' . EXT);
// If installer class is already here, avoid site access
if (!empty($installer)) {
// Get languages codes from available languages folder/translation file
$languages = $this->settings_model->get_admin_langs();
if (!in_array(config_item('detected_lang_code'), $languages)) {
$this->config->set_item('detected_lang_code', config_item('default_admin_lang'));
}
$this->lang->load('admin', config_item('detected_lang_code'));
Theme::set_theme('admin');
// Set the view to output
$this->output('system/delete_installer');
// Display the view directly
$this->output->_display();
// Don't do anything more
die;
}
}
示例6:
e.stop();
ION.contentUpdate({
'element': $('mainPanel'),
'loadMethod': 'xhr',
'url': admin_url + 'article/create/' + id,
'title': Lang.get('ionize_title_create_article')
});
});
<?php
}
?>
}
// Options column switcher
ION.initSideColumn('sideColumnSwitcher');
<?php
if (Authority::can('edit', 'admin/page')) {
?>
// Save with CTRL+s
ION.addFormSaveEvent('pageFormSubmit');
<?php
}
?>
</script>
示例7: lang
?>
<?php
if (Authority::can('access', 'admin/settings/website')) {
?>
<li class="divider"><a class="navlink" href="setting" title="<?php
echo lang('ionize_menu_site_settings');
?>
"><?php
echo lang('ionize_menu_site_settings');
?>
</a></li>
<?php
}
?>
<?php
if (Authority::can('access', 'admin/settings/technical')) {
?>
<li><a class="navlink" href="setting/technical" title="<?php
echo lang('ionize_menu_site_settings_technical');
?>
"><?php
echo lang('ionize_menu_site_settings_technical');
?>
</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
示例8: tag_languages
/**
* Languages tag
*
* @param FTL_Binding
*
* @return null|string
*
* @usage <ion:languages [helper="helper:helper_method"]>
* ...
* <ion:languages>
*
*/
public static function tag_languages(FTL_Binding $tag)
{
$languages = Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1 ? Settings::get_languages() : Settings::get_online_languages();
$page = self::registry('page');
$article = self::registry('article');
// Current active language class
$active_class = $tag->getAttribute('active_class', 'active');
// Ignore current language in output
$ignore_current = $tag->getAttribute('ignore_current');
// helper
$helper = $tag->getAttribute('helper');
$str = '';
$tag->set('count', count($languages));
foreach ($languages as $idx => &$lang) {
$lang_code = $lang['lang'];
$p_data = $page['languages'][$lang_code];
if ($ignore_current == TRUE && $lang_code == Settings::get_lang('current')) {
continue;
}
// Correct the Home page URL
if ($p_data['online'] == 1 or $p_data['online'] == 0 && Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
if ($page['home'] != 1) {
$lang['absolute_url'] = !empty($page['absolute_urls'][$lang_code]) ? $page['absolute_urls'][$lang_code] : base_url() . $lang_code;
} else {
$lang['absolute_url'] = base_url() . $lang_code;
}
} else {
$lang['absolute_url'] = NULL;
}
$lang['active_class'] = $lang_code == Settings::get_lang('current') ? $active_class : '';
$lang['is_active'] = $lang_code == Settings::get_lang('current');
$lang['id'] = $lang_code;
if (!is_null($article)) {
$a_data = $article['languages'][$lang_code];
if (!is_null($a_data['url']) && $a_data['online'] == 1 or $a_data['online'] == 0 && Authority::can('access', 'admin') && Settings::get('display_front_offline_content') == 1) {
if ($page['home'] != 1) {
$lang['absolute_url'] .= '/' . $a_data['url'];
} else {
$lang['absolute_url'] .= '/' . $page['urls'][$lang_code] . '/' . $a_data['url'];
}
} else {
$lang['absolute_url'] = NULL;
}
}
// Tag locals
$tag->set('language', $lang);
$tag->set('id', $lang_code);
$tag->set('absolute_url', $lang['absolute_url']);
$tag->set('active_class', $lang['active_class']);
$tag->set('is_active', $lang['is_active']);
$tag->set('index', $idx);
if (!is_null($lang['absolute_url'])) {
$str .= $tag->expand();
}
}
// Try to return the helper function result
if ($str != '' && !is_null($helper)) {
$helper_function = substr(strrchr($helper, ':'), 1) ? substr(strrchr($helper, ':'), 1) : 'get_language_navigation';
$helper = strpos($helper, ':') !== FALSE ? substr($helper, 0, strpos($helper, ':')) : $helper;
self::$ci->load->helper($helper);
if (function_exists($helper_function)) {
$nav = call_user_func($helper_function, $languages);
return self::wrap($tag, $nav);
}
}
return self::wrap($tag, $str);
}
示例9: lang
">
<p class="lite"><?php
echo lang('ionize_help_notify_user_account_updated');
?>
</p>
<textarea name="message" class="autogrow"></textarea>
</div>
</form>
<div class="buttons">
<?php
if (Authority::can('edit', 'admin/user')) {
?>
<button id="bSaveuser<?php
echo $user['id_user'];
?>
" type="button" class="button yes right"><?php
echo lang('ionize_button_save_close');
?>
</button>
<?php
}
?>
<button id="bCanceluser<?php
echo $user['id_user'];
?>
" type="button" class="button no right"><?php
示例10: function
</ul>
<script type="text/javascript">
/**
* Types list itemManager
*
*/
typesManager = new ION.ItemManager({ element: 'article_type', container: 'article_typeList' });
typesManager.makeSortable();
<?php
if (Authority::can('edit', 'admin/article/type')) {
?>
// Type editable
$$('#article_typeList .title').each(function(item, idx)
{
var id = item.getProperty('data-id');
item.addEvent('click', function(e){
ION.formWindow('article_type' + id, 'article_typeForm' + id, Lang.get('ionize_title_type_edit'), 'article_type/edit/' + id);
});
});
<?php
}
?>
</script>
示例11: foreach
">
<?php
foreach ($fields as $field) {
?>
<li class="sortme element_field" data-id="<?php
echo $field['id_extend_field'];
?>
" id="element_field<?php
echo $field['id_extend_field'];
?>
">
<span class="icon left drag"></span>
<?php
if (Authority::can('edit', 'admin/element')) {
?>
<a class="icon delete right" data-id="<?php
echo $field['id_extend_field'];
?>
"></a>
<?php
}
?>
<span class="lite right mr10" data-id="<?php
echo $field['id_extend_field'];
?>
">
<?php
echo $field['type_name'];
示例12: lang
<?php
if (Authority::can('create', 'admin/article/type')) {
?>
<div class="divider">
<a class="button light" id="newTypeToolbarButton">
<i class="icon-plus"></i><?php
echo lang('ionize_label_new_type');
?>
</a>
</div>
<div class="toolbox"></div>
<script type="text/javascript">
/**
* New type button
*
*/
$('newTypeToolbarButton').addEvent('click', function(e)
{
ION.formWindow(
'article_type',
'article_typeForm',
Lang.get('ionize_label_new_type'),
'article_type/get_form'
);
});
示例13: lang
echo lang('ionize_help_denied_action_404');
?>
"><?php
echo lang('ionize_label_denied_action_404');
?>
</a></label>
</dd>
</dl>
</div>
<?php
}
?>
<?php
if (Authority::can('access', 'admin/article/permissions/backend')) {
?>
<?php
if (!empty($backend_roles_resources)) {
?>
<dl class="x-small">
<dt><label><?php
echo lang('ionize_label_backend');
?>
</label></dt>
<dd>
<?php
foreach ($backend_roles_resources as $id_role => $role_resources) {
?>
<div id="roleRulesContainer<?php
示例14:
</td>
<td><a><?php
echo $role['role_code'];
?>
</a></td>
<td><?php
echo $role['role_name'];
?>
</td>
<td><?php
echo $role['role_description'];
?>
</td>
<td>
<?php
if (Authority::can('delete', 'admin/role')) {
?>
<a data-id="<?php
echo $role['id_role'];
?>
" class="icon delete"></a>
<?php
}
?>
</td>
</tr>
<?php
}
?>
示例15: lang
<?php
if (Authority::can('create', 'admin/extend')) {
?>
<div class="divider">
<a id="btnAddExtendField" class="button light">
<i class="icon-plus"></i>
<?php
echo lang('ionize_title_extend_field_new');
?>
</a>
</div>
<script type="text/javascript">
$('btnAddExtendField').addEvent('click', function(e)
{
// Does not limit to one parent
ION.formWindow(
'extendfield',
'extendfieldForm',
'ionize_title_extend_field_new',
'extend_field/edit',
{
width:450,
height:380
}
);
});