本文整理汇总了PHP中permissions::check_perms方法的典型用法代码示例。如果您正苦于以下问题:PHP permissions::check_perms方法的具体用法?PHP permissions::check_perms怎么用?PHP permissions::check_perms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permissions
的用法示例。
在下文中一共展示了permissions::check_perms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
/**
* Route all of the menus.
*/
function route()
{
global $theme;
// Get the current active path.
$current_path = get_current_path();
$permissions = new permissions();
$check_permissions = $permissions->check_perms();
// Setup some theme arguments.
$error = false;
$theme_args = array();
if ($check_permissions) {
// Now use it to route visitors :).
if (isset($current_path) && $current_path != 'index') {
// We need to parse all of the url files.
$urls = $this->parse_urls();
// Deal with wild cards in the URLs and return the active URL.
$active_url = build_urls($urls);
$current_path = $active_url['system'];
// Now we parse the correct URL.
// TODO: add some permission checks at some point.
if (isset($urls[$current_path])) {
// Now we need to get the callback.
$callback = $urls[$current_path]['callback'];
$callback_array = explode('.', $callback);
// Check to see if we are calling a custom file.
if (isset($urls[$current_path]['file'])) {
include_once serum_get_path('module', $urls[$current_path]['module']) . '/' . $urls[$current_path]['file'];
}
// Now we call the module class and invoke the menu item.
${$callback_array[0]} = new $callback_array[0]();
// Set the initial page title and description.
tpl_set('page_title', $urls[$current_path]['title']);
tpl_set('page_description', $urls[$current_path]['description']);
// Make sure that method does exist.
if (method_exists(${$callback_array[0]}, $callback_array[1])) {
${$callback_array[0]}->{$callback_array[1]}();
} else {
// Otherwise just return a 404.
four_oh_four();
$error = true;
$tpl = 'erorr.tpl';
}
} else {
// Return a 404 error.
$user->login();
$error = true;
$tpl = 'error.tpl';
}
} else {
// If there is nothing in the menu we need to render the index page.
$this->index();
}
} else {
// Return the login form. Silly me.
$permissions->login_form();
$error = true;
$tpl = 'login.tpl';
}
if (!$error) {
$theme_args = array('header' => true, 'footer' => true);
} else {
$theme_args = array('template' => $tpl);
}
// Render the theme.
$theme->engine->render($theme_args);
}