本文整理汇总了PHP中admin::get_permission方法的典型用法代码示例。如果您正苦于以下问题:PHP admin::get_permission方法的具体用法?PHP admin::get_permission怎么用?PHP admin::get_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admin
的用法示例。
在下文中一共展示了admin::get_permission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Template
// Create new template object
$template = new Template(dirname($admin->correct_theme_source('admintools.htt')));
// $template->debug = true;
$template->set_file('page', 'admintools.htt');
$template->set_block('page', 'main_block', 'main');
// Insert required template variables
$template->set_var('ADMIN_URL', ADMIN_URL);
$template->set_var('THEME_URL', THEME_URL);
$template->set_var('HEADING_ADMINISTRATION_TOOLS', $HEADING['ADMINISTRATION_TOOLS']);
// Insert tools into tool list
$template->set_block('main_block', 'tool_list_block', 'tool_list');
$sql = 'SELECT * FROM `' . TABLE_PREFIX . 'addons` WHERE `type` = \'module\' AND `function` = \'tool\' order by `name`';
$results = $database->query($sql);
if ($results->numRows() > 0) {
while ($tool = $results->fetchRow()) {
if ($admin->get_permission($tool['directory'], 'module')) {
$template->set_var('TOOL_NAME', $tool['name']);
$template->set_var('TOOL_DIR', $tool['directory']);
// check if a module description exists for the displayed backend language
$tool_description = false;
if (function_exists('file_get_contents') && file_exists(WB_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php')) {
// read contents of the module language file into string
$data = @file_get_contents(WB_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php');
$tool_description = get_variable_content('module_description', $data, true, false);
}
$template->set_var('TOOL_DESCRIPTION', $tool_description === False ? $tool['description'] : $tool_description);
$template->parse('tool_list', 'tool_list_block', true);
}
}
} else {
$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
示例2: addslashes
}
$filetype_url = THEME_URL . '/images/files/' . $filetypeicon . '.png';
$template->set_var(array('NAME' => $name, 'NAME_SLASHED' => addslashes($name), 'TEMP_ID' => $admin->getIDKEY($temp_id), 'LINK' => WB_URL . MEDIA_DIRECTORY . $directory . '/' . $name, 'LINK_TARGET' => '_blank', 'ROW_BG_COLOR' => $row_bg_color, 'FT_ICON' => empty($icon) ? $filetype_url : $icon, 'FILETYPE_ICON' => $filetype_url, 'MOUSEOVER' => $tooltip, 'IMAGEDETAIL' => $imgdetail, 'SIZE' => $bytes, 'DATE' => $date, 'PREVIEW' => $preview, 'IMAGE_TITLE' => $name, 'IMAGE_EXIST' => 'blank_16.gif'));
$template->parse('list', 'list_block', true);
// Code to alternate row colors
if ($row_bg_color == 'FFF') {
$row_bg_color = 'ECF1F3';
} else {
$row_bg_color = 'FFF';
}
}
}
}
// If no files are in the media folder say so
if ($temp_id == 0) {
$template->set_var('DISPLAY_LIST_TABLE', 'hide');
} else {
$template->set_var('DISPLAY_NONE_FOUND', 'hide');
}
// Insert permissions values
if ($admin->get_permission('media_rename') != true) {
$template->set_var('DISPLAY_RENAME', 'hide');
}
if ($admin->get_permission('media_delete') != true) {
$template->set_var('DISPLAY_DELETE', 'hide');
}
// Insert language text and messages
$template->set_var(array('MEDIA_DIRECTORY' => MEDIA_DIRECTORY, 'TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'], 'TEXT_RELOAD' => $TEXT['RELOAD'], 'TEXT_RENAME' => $TEXT['RENAME'], 'TEXT_DELETE' => $TEXT['DELETE'], 'TEXT_SIZE' => $TEXT['SIZE'], 'TEXT_DATE' => $TEXT['DATE'], 'TEXT_NAME' => $TEXT['NAME'], 'TEXT_TYPE' => $TEXT['TYPE'], 'TEXT_UP' => $TEXT['UP'], 'NONE_FOUND' => $MESSAGE['MEDIA']['NONE_FOUND'], 'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'], 'CONFIRM_DELETE' => $MESSAGE['MEDIA']['CONFIRM_DELETE']));
// Parse template object
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
示例3: realpath
<?php
/**
* CMS module: Download Gallery 3
* Copyright and more information see file info.php
**/
require realpath(dirname(__FILE__) . '/../../config.php');
// check permissions
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Modules', 'module_view', false, false);
$dlgmodname = str_replace(str_replace('\\', '/', WB_PATH) . '/modules/', '', str_replace('\\', '/', dirname(__FILE__)));
if (!($admin->is_authenticated() && $admin->get_permission($dlgmodname, 'module'))) {
header('Location: ../../index.php');
}
require_once WB_PATH . '/framework/class.order.php';
// if there's no item_id, it should be a group
if (!isset($_POST['item_id'])) {
if (!isset($_POST['group_id'])) {
} else {
$group_id = is_numeric($_POST['group_id']) ? $_POST['group_id'] : NULL;
$prev_id = is_numeric($_POST['prev_id']) ? $_POST['prev_id'] : NULL;
// new position
$o = new order(TABLE_PREFIX . $tablename . '_groups', 'position', 'group_id', 'section_id');
if ($group_id) {
if ($prev_id) {
$pos = $database->get_one('SELECT `position` FROM `' . TABLE_PREFIX . $tablename . "_groups` WHERE `group_id` = '" . $prev_id . "'");
} else {
$pos = 0;
}
$database->query("UPDATE `" . TABLE_PREFIX . $tablename . "_groups` SET `position` = '" . $pos++ . "' WHERE `group_id` = '" . $group_id . "'");
$section_id = $database->get_one('SELECT `section_id` FROM `' . TABLE_PREFIX . $tablename . "_groups` WHERE `group_id` = '" . $group_id . "'");
示例4: elseif
if (in_array($cur_gid, $old_admin_groups)) {
$in_group = true;
}
}
if (!$in_group && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
print $admin->get_group_id() . $admin->get_user_id();
// print_r ($old_admin_groups);
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
}
// some additional security checks:
// Check whether the section_id belongs to the page_id at all
if (!is_numeric($section_id)) {
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
} elseif ($section_id > 0) {
$section = $admin->get_section_details($section_id, ADMIN_URL . '/pages/index.php');
if (!$admin->get_permission($section['module'], 'module')) {
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS'], ADMIN_URL);
}
}
// Workout if the developer wants to show the info banner
if (isset($print_info_banner) && $print_info_banner == true) {
// Get page details already defined
// Get display name of person who last modified the page
$user = $admin->get_user_details($page['modified_by']);
// Convert the unix ts for modified_when to human a readable form
$modified_ts = 'Unknown';
if ($page['modified_when'] != 0) {
$modified_ts = gmdate(TIME_FORMAT . ', ' . DATE_FORMAT, $page['modified_when'] + TIMEZONE);
}
// Setup template object, parse vars to it, then parse it
// Create new template object
示例5: admin
$admin = new admin('Start', 'start');
// Setup template object
$tpl = new Template(THEME_PATH . '/templates');
$tpl->debug = false;
$tpl->set_file('page', 'start.htt');
$tpl->set_block('page', 'main_block', 'main');
$tpl->set_block('main_block', 'show_preferences_block', 'show_preferences');
// first set all blocks to visible
$tpl->parse('show_preferences', 'show_preferences_block', true);
// Check register_globals:
$warning = ini_get('register_globals') ? 'This PHP installation is insecure because register_globals is on! Please contact your administrator.' : '';
// Insert values into the template object
$tpl->set_var(array('WELCOME_MESSAGE' => $MESSAGE['START_WELCOME_MESSAGE'], 'CURRENT_USER' => $MESSAGE['START_CURRENT_USER'], 'DISPLAY_NAME' => $admin->get_display_name(), 'ADMIN_URL' => ADMIN_URL, 'LEPTON_URL' => LEPTON_URL, 'THEME_URL' => THEME_URL, 'NO_CONTENT' => '<p> </p>', 'WARNING' => $warning));
// Insert permission values into the template object
$tpl->set_block('main_block', 'show_pages_block', 'show_pages');
if ($admin->get_permission('pages') != true) {
$tpl->set_var('DISPLAY_PAGES', 'display:none;');
$tpl->set_block('show_pages', '');
} else {
$tpl->parse('show_pages', 'show_pages_block', true);
}
$tpl->set_block('main_block', 'show_media_block', 'show_media');
if ($admin->get_permission('media') != true) {
$tpl->set_var('DISPLAY_MEDIA', 'display:none;');
$tpl->set_block('show_media', '');
} else {
$tpl->parse('show_media', 'show_media_block', true);
}
$tpl->set_block('main_block', 'show_addons_block', 'show_addons');
if ($admin->get_permission('addons') != true) {
$tpl->set_var('DISPLAY_ADDONS', 'display:none;');
示例6: Template
$template = new Template(dirname($admin->correct_theme_source('languages.htt')));
// $template->debug = true;
$template->set_file('page', 'languages.htt');
$template->set_block('page', 'main_block', 'main');
// Insert values into language list
$template->set_block('main_block', 'language_list_block', 'language_list');
$result = $database->query("SELECT * FROM " . TABLE_PREFIX . "addons WHERE type = 'language' order by directory");
if ($result->numRows() > 0) {
while ($addon = $result->fetchRow()) {
$template->set_var('VALUE', $addon['directory']);
$template->set_var('NAME', $addon['name'] . ' (' . $addon['directory'] . ')');
$template->parse('language_list', 'language_list_block', true);
}
}
// Insert permissions values
if ($admin->get_permission('languages_install') != true) {
$template->set_var('DISPLAY_INSTALL', 'hide');
}
if ($admin->get_permission('languages_uninstall') != true) {
$template->set_var('DISPLAY_UNINSTALL', 'hide');
}
if ($admin->get_permission('languages_view') != true) {
$template->set_var('DISPLAY_LIST', 'hide');
}
// Insert language headings
$template->set_var(array('HEADING_INSTALL_LANGUAGE' => $HEADING['INSTALL_LANGUAGE'], 'HEADING_UNINSTALL_LANGUAGE' => $HEADING['UNINSTALL_LANGUAGE'], 'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS']));
// insert urls
$template->set_var(array('ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL, 'FTAN' => $admin->getFTAN()));
// Insert language text and messages
$template->set_var(array('URL_MODULES' => $admin->get_permission('modules') ? '<a href="' . ADMIN_URL . '/modules/index.php">' . $MENU['MODULES'] . '</a>' : '', 'URL_ADVANCED' => '          ', 'URL_TEMPLATES' => $admin->get_permission('templates') ? '<a href="' . ADMIN_URL . '/templates/index.php">' . $MENU['TEMPLATES'] . '</a>' : '', 'TEXT_INSTALL' => $TEXT['INSTALL'], 'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], 'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], 'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT']));
// Parse template object
示例7: header
if (!file_exists(WB_PATH . '/modules/foldergallery/languages/' . LANGUAGE . '.php')) {
// no module language file exists for the language set by the user, include default module language file DE.php
require_once WB_PATH . '/modules/foldergallery/languages/DE.php';
} else {
// a module language file exists for the language defined by the user, load it
require_once WB_PATH . '/modules/foldergallery/languages/' . LANGUAGE . '.php';
}
// First we prevent direct access and check for variables
if (!isset($_POST['action']) or !isset($_POST['recordsArray'])) {
// now we redirect to index, if you are in subfolder use ../index.php
header('Location: ../../index.php');
} else {
// check if user has permissions to access the module
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Modules', 'module_view', false, false);
if (!($admin->is_authenticated() && $admin->get_permission('foldergallery', 'module'))) {
die(header('Location: ../../index.php'));
}
// Sanitized variables
$action = $admin->add_slashes($_POST['action']);
$updateRecordsArray = isset($_POST['recordsArray']) ? $_POST['recordsArray'] : array();
// This line verifies that in &action is not other text than "updateRecordsListings", if something else is inputed (to try to HACK the DB), there will be no DB access..
if ($action == "updateRecordsListings") {
$listingCounter = 1;
$output = "";
foreach ($updateRecordsArray as $recordIDValue) {
$database->query("UPDATE `" . TABLE_PREFIX . "mod_foldergallery_categories` SET position = " . $listingCounter . " WHERE `id` = " . $recordIDValue);
$listingCounter++;
}
echo '<img src="' . WB_URL . '/modules/jsadmin/images/success.gif" style="vertical-align:middle;"/> <span style="font-size: 80%">' . $MOD_FOLDERGALLERY['REORDER_INFO_SUCESS'] . '</span>';
}
示例8: basename
$template->set_var('NAME', basename($path));
$template->parse('upgrade_list', 'upgrade_list_block', true);
}
if (file_exists($path . '/uninstall.php')) {
$show_block = true;
$template->set_var('UNINSTALL_VISIBLE', '');
$template->set_var('VALUE', basename($path));
$template->set_var('NAME', basename($path));
$template->parse('uninstall_list', 'uninstall_list_block', true);
}
} else {
unset($module_files[$index]);
}
}
// Insert permissions values
if ($admin->get_permission('modules_install') != true) {
$template->set_var('DISPLAY_INSTALL', 'hide');
}
if ($admin->get_permission('modules_uninstall') != true) {
$template->set_var('DISPLAY_UNINSTALL', 'hide');
}
if ($admin->get_permission('modules_view') != true) {
$template->set_var('DISPLAY_LIST', 'hide');
}
// only show block if there is something to show
if (!$show_block || count($module_files) == 0 || !isset($_GET['advanced']) || $admin->get_permission('admintools') != true) {
$template->set_var('DISPLAY_MANUAL_INSTALL', 'hide');
}
// Insert language headings
$template->set_var(array('HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'], 'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'], 'OVERWRITE_NEWER_FILES' => $MESSAGE['ADDON_OVERWRITE_NEWER_FILES'], 'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS'], 'HEADING_INVOKE_MODULE_FILES' => $HEADING['INVOKE_MODULE_FILES']));
// insert urls
示例9: htmlspecialchars
} else {
$title = htmlspecialchars($title, ENT_COMPAT, DEFAULT_CHARSET);
}
$module = $admin->get_post('type');
$parent = $admin->get_post('parent');
$visibility = $admin->get_post('visibility');
$admin_groups = $admin->get_post('admin_groups');
$viewing_groups = $admin->get_post('viewing_groups');
// add Admin and view groups
$admin_groups[] = 1;
$viewing_groups[] = 1;
if ($parent != 0) {
if (!$admin->get_page_permission($parent, 'admin')) {
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
}
} elseif (!$admin->get_permission('pages_add_l0', 'system')) {
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
}
// Validate data
if ($title == '' || substr($title, 0, 1) == '.') {
$admin->print_error($MESSAGE['PAGES_BLANK_PAGE_TITLE']);
}
// Check to see if page created has needed permissions
if (!in_array(1, $admin->get_groups_id())) {
$admin_perm_ok = false;
foreach ($admin_groups as $adm_group) {
if (in_array($adm_group, $admin->get_groups_id())) {
$admin_perm_ok = true;
}
}
if ($admin_perm_ok == false) {
示例10:
// Insert values into the template object
$tpl->set_var(array('ADMIN_URL' => ADMIN_URL, 'THEME_URL' => THEME_URL, 'LEPTON_URL' => LEPTON_URL));
/**
* Setting up the blocks
*/
$tpl->set_block('main_block', "modules_block", "modules");
$tpl->set_block('main_block', "templates_block", "templates");
$tpl->set_block('main_block', "languages_block", "languages");
$tpl->set_block('main_block', "reload_block", "reload");
$tpl->set_block('main_block', 'show_advanced_block', 'show_advanced');
/**
* Insert permission values into the template object
* Obsolete as we are using blocks ... see "parsing the blocks" section
*/
$display_none = "style=\"display: none;\"";
if ($admin->get_permission('modules') != true) {
$tpl->set_var('DISPLAY_MODULES', $display_none);
}
if ($admin->get_permission('templates') != true) {
$tpl->set_var('DISPLAY_TEMPLATES', $display_none);
}
if ($admin->get_permission('languages') != true) {
$tpl->set_var('DISPLAY_LANGUAGES', $display_none);
}
if ($admin->get_permission('admintools') != true) {
$tpl->set_var('DISPLAY_ADVANCED', $display_none);
}
if ($admin->get_permission('admintools') != true) {
$tpl->set_var('DISPLAY_ALL', $display_none);
}
$tpl->parse('show_advanced', 'show_advanced_block', true);
示例11:
</tr>
</table>
</li>
<?php
// Get subs
make_list($page['page_id'], $editable_pages);
}
}
?>
</ul>
<?php
return $editable_pages;
}
// Generate pages list
if ($admin->get_permission('pages_view') == true) {
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td>
<h2><?php
echo $HEADING['DELETED_PAGES'];
?>
</h2>
</td>
<td align="right">
<a href="<?php
echo ADMIN_URL;
?>
/pages/empty_trash.php">
<img src="<?php
示例12:
$template->set_var('FILE', $addon['directory']);
$template->set_var('NAME', $addon['name']);
$template->set_var('SELECTED', $addon['directory'] == $search_template ? ' selected="selected"' : '');
$template->parse('search_template_list', 'search_template_list_block', true);
}
}
// Insert default error reporting values
require ADMIN_PATH . '/interface/er_levels.php';
foreach ($ER_LEVELS as $value => $title) {
$template->set_var('VALUE', $value);
$template->set_var('NAME', $title);
$template->set_var('SELECTED', ER_LEVEL == $value ? ' selected="selected"' : '');
$template->parse('error_reporting_list', 'error_reporting_list_block', true);
}
// Insert permissions values
if ($admin->get_permission('settings_advanced') != true) {
$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
}
// Insert page level limits
$template->set_var('PAGE_LEVEL_LIMIT', $settings['page_level_limit']);
// if select list
for ($i = 1; $i <= 10; $i++) {
$template->set_var('NUMBER', $i);
$template->set_var('SELECTED', PAGE_LEVEL_LIMIT == $i ? ' selected="selected"' : '');
$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
}
// Work-out if multiple menus feature is enabled
if (defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == true) {
$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
} else {
$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
示例13: dirname
// load outputfilter-functions
require_once dirname(dirname(__FILE__)) . "/functions.php";
$aJsonRespond = array();
$aJsonRespond['success'] = false;
$aJsonRespond['message'] = '';
$aJsonRespond['icon'] = '';
if (!isset($_POST['action']) || !isset($_POST['id'])) {
$aJsonRespond['message'] = 'one of the parameters does not exist';
exit(json_encode($aJsonRespond));
} else {
$aRows = $_POST['id'];
require_once '../../../config.php';
// check if user has permissions to access the outputfilter_dashboard module
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('admintools', 'admintools', false, false);
if (!($admin->is_authenticated() && $admin->get_permission('outputfilter_dashboard', 'module'))) {
$aJsonRespond['message'] = 'insuficcient rights';
exit(json_encode($aJsonRespond));
}
// Sanitize variables
$action = $admin->add_slashes($_POST['action']);
if ($action == "updatePosition") {
$i = array();
$i_keys = array();
foreach (opf_get_types() as $type => $typename) {
$i[$type] = 1;
$i_keys[] = $type;
}
foreach ($aRows as $recID) {
$id = $admin->checkIDKEY($recID, 0, 'key', true);
$filter = opf_get_data($id);
示例14: die
*
* @platform CMS WebsiteBaker 2.8.x
* @package addonMonitor
* @author Christian M. Stefan (Stefek)
* @copyright Christian M. Stefan
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
// Direct access prevention
defined('WB_PATH') or die(header('Location: ../index.php'));
if (!class_exists('admin', false)) {
$admin_header = FALSE;
include WB_PATH . '/framework/class.admin.php';
$admin = new admin('admintools', 'admintools');
}
// check for permission
if (!$admin->get_permission('admintools')) {
die(header('Location: ../../index.php'));
}
require_once dirname(__FILE__) . '/info.php';
// get functions file for this AdminTool
require_once dirname(__FILE__) . '/functions.php';
$sAddonDir = $module_directory;
// register TWIG autoloader if not done already
// this is of importance for WebsiteBaker Versions prior to 2.8.4. or derivate systems
if (!class_exists('Twig_Autoloader')) {
$sTwigAutoloader = dirname(__FILE__) . '/TwigTE/Twig/Autoloader.php';
if (file_exists($sTwigAutoloader)) {
include $sTwigAutoloader;
Twig_Autoloader::register();
}
}
示例15: elseif
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
$list_next_level = false;
} elseif ($can_modify != true) {
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"');
} else {
$template->set_var('SELECTED', '');
}
$template->parse('page_list2', 'page_list_block2', true);
}
if ($list_next_level) {
parent_list($page['page_id']);
}
}
}
$template->set_block('main_block', 'page_list_block2', 'page_list2');
if ($admin->get_permission('pages_add_l0') == true or $results_array['level'] == 0) {
if ($results_array['parent'] == 0) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$template->set_var(array('ID' => '0', 'TITLE' => $TEXT['NONE'], 'SELECTED' => $selected));
$template->parse('page_list2', 'page_list_block2', true);
}
parent_list(0);
if ($modified_ts == 'Unknown') {
$template->set_var('DISPLAY_MODIFIED', 'hide');
} else {
$template->set_var('DISPLAY_MODIFIED', '');
}
// Templates list