本文整理汇总了PHP中currentUserCan函数的典型用法代码示例。如果您正苦于以下问题:PHP currentUserCan函数的具体用法?PHP currentUserCan怎么用?PHP currentUserCan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentUserCan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBuildUpdateConfigFlag
setBuildUpdateConfigFlag($server_serial_no, 'yes', 'build');
header('Location: ' . $GLOBALS['basename'] . $uri_params);
}
}
}
}
printHeader();
@printMenu();
$avail_types = buildSubMenu(strtolower($option_type));
$avail_servers = buildServerSubMenu($server_serial_no);
$sort_direction = null;
$sort_field = 'cfg_name';
if (isset($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']])) {
extract($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']], EXTR_OVERWRITE);
}
echo printPageHeader($response, $display_option_type . ' ' . getPageTitle(), currentUserCan('manage_servers', $_SESSION['module']), $name, $rel);
echo <<<HTML
<div id="pagination_container" class="submenus">
\t<div>
\t<div class="stretch"></div>
\t{$avail_types}
\t{$avail_servers}
\t</div>
</div>
HTML;
$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', array('domain_id', $sort_field, 'cfg_name'), 'cfg_', "AND cfg_type='{$display_option_type_sql}' AND server_serial_no='{$server_serial_no}'", null, false, $sort_direction);
$fm_module_options->rows($result);
printFooter();
function buildSubMenu($option_type = 'global')
{
示例2: buildRecordTypes
function buildRecordTypes($record_type = null, $all_domain_ids = null, $map = 'forward', $supported_record_types, $search_query = null)
{
global $fmdb, $__FM_CONFIG;
$menu_selects = $menu_sub_selects = null;
$q = isset($_GET['q']) ? '&q=' . sanitize($_GET['q']) : null;
if (isset($record_type) && $all_domain_ids != null) {
$domain_id = $all_domain_ids[0];
$query = "SELECT DISTINCT `record_type` FROM fm_{$__FM_CONFIG['fmDNS']['prefix']}records WHERE `record_status`!='deleted' AND\n\t\t\t`account_id`={$_SESSION['user']['account_id']} AND `domain_id` IN (" . implode(',', $all_domain_ids) . ") {$search_query}";
$fmdb->get_results($query);
$used_record_types = array();
if ($fmdb->num_rows) {
$type_result = $fmdb->last_result;
for ($i = 0; $i < $fmdb->num_rows; $i++) {
$used_record_types[] = $type_result[$i]->record_type;
}
}
@sort($used_record_types);
$used_record_types[] = 'SOA';
foreach ($used_record_types as $type) {
if (empty($type)) {
continue;
}
if (in_array($type, $__FM_CONFIG['records']['require_zone_rights']) && !currentUserCan('manage_zones', $_SESSION['module'])) {
continue;
}
if ($type == 'SOA') {
/** Skip clones */
if (getNameFromID($domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_clone_domain_id')) {
continue;
}
/** Skip templates */
if (getNameFromID($domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_template_id')) {
continue;
}
}
$select = $record_type == $type ? ' class="selected"' : '';
$menu_selects .= "<span{$select}><a{$select} href=\"zone-records.php?map={$map}&domain_id={$domain_id}&record_type={$type}{$q}\">{$type}</a></span>\n";
}
/** More record types menu */
if (count($used_record_types) < count($supported_record_types)) {
foreach ($supported_record_types as $type) {
if (!in_array($type, $used_record_types)) {
if ($record_type == $type) {
$menu_selects .= "<span class=\"selected\"><a class=\"selected\" href=\"zone-records.php?map={$map}&domain_id={$domain_id}&record_type={$type}\">{$type}</a></span>\n";
} else {
$menu_sub_selects .= "<li><a href=\"zone-records.php?map={$map}&domain_id={$domain_id}&record_type={$type}{$q}\"><span>{$type}</span></a></li>\n";
}
}
}
$menu_selects = <<<MENU
\t\t\t{$menu_selects}
\t\t\t</div>
\t\t\t<div id="configtypesmenu" class="nopadding dropdown">
\t\t\t\t<div id="recordmenu">
\t\t\t\t<ul>
\t\t\t\t\t<li class="has-sub"><a href="#"><span>...</span></a>
\t\t\t\t\t\t<ul>
\t\t\t\t\t\t{$menu_sub_selects}
\t\t\t\t\t\t</ul>
\t\t\t\t\t</li>
\t\t\t\t</ul>
\t\t\t\t</div>
MENU;
}
}
return '<div id="configtypesmenu" class="submenus">' . $menu_selects . '</div>';
}
示例3: countServerUpdates
/**
* Gets the count for servers requiring a config build
*
* @since 2.0
* @package facileManager
*
* @return integer Record count
*/
function countServerUpdates()
{
global $fmdb, $__FM_CONFIG;
if (currentUserCan('manage_servers', $_SESSION['module'])) {
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_id', 'server_', 'AND (server_build_config!="no" OR server_client_version!="' . getOption('client_version', 0, $_SESSION['module']) . '") AND server_status="active" AND server_installed="yes"', null, false, null, true);
if ($fmdb->num_rows) {
return $fmdb->last_result[0]->count;
}
}
return 0;
}
示例4: define
| Displays module forms |
| Author: Jon LaBass |
+-------------------------------------------------------------------------+
*/
if (!defined('AJAX')) {
define('AJAX', true);
}
require_once '../../../fm-init.php';
include ABSPATH . 'fm-modules/fmSQLPass/classes/class_groups.php';
include ABSPATH . 'fm-modules/fmSQLPass/classes/class_servers.php';
if (is_array($_GET) && array_key_exists('action', $_GET) && ($_GET['action'] = 'display-process-all')) {
echo 0;
exit;
}
/** Edits */
if (is_array($_POST) && count($_POST) && currentUserCan('manage_servers', $_SESSION['module'])) {
if (array_key_exists('add_form', $_POST)) {
$id = isset($_POST['item_id']) ? sanitize($_POST['item_id']) : null;
$add_new = true;
} elseif (array_key_exists('item_id', $_POST)) {
$id = sanitize($_POST['item_id']);
$view_id = isset($_POST['view_id']) ? sanitize($_POST['view_id']) : null;
$add_new = false;
} else {
returnError();
}
$table = $__FM_CONFIG['fmSQLPass']['prefix'] . $_POST['item_type'];
$item_type = $_POST['item_type'];
$prefix = substr($item_type, 0, -1) . '_';
$field = $prefix . 'id';
$type_map = null;
示例5: or
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| facileManager: Easy System Administration |
| fmSQLPass: Change database user passwords across multiple servers. |
+-------------------------------------------------------------------------+
| http://www.facilemanager.com/modules/fmsqlpass/ |
+-------------------------------------------------------------------------+
| Processes password management page |
| Author: Jon LaBass |
+-------------------------------------------------------------------------+
*/
if (!currentUserCan(array('manage_passwords', 'view_all'), $_SESSION['module'])) {
unAuth();
}
$response = isset($response) ? $response : null;
printHeader();
@printMenu();
include ABSPATH . 'fm-modules/fmSQLPass/classes/class_passwords.php';
include ABSPATH . 'fm-modules/facileManager/classes/class_users.php';
echo printPageHeader($response);
$result = basicGetList('fm_' . $__FM_CONFIG['fmSQLPass']['prefix'] . 'groups', 'group_name', 'group_', 'active');
$fm_sqlpass_passwords->rows($result);
printFooter();
示例6: backupDatabase
/**
* Backs up the database
*
* @since 1.0
* @package facileManager
*/
function backupDatabase()
{
global $__FM_CONFIG, $fm_name;
if (!currentUserCan('run_tools')) {
return sprintf('<p class="error">%s</p>', _('You are not authorized to run these tools.'));
}
/** Temporary fix for MySQL 5.6 warnings */
$exclude_warnings = array('Warning: Using a password on the command line interface can be insecure.' . "\n");
$curdate = date("Y-m-d_H.i.s");
$sql_file = sys_get_temp_dir() . '/' . $__FM_CONFIG['db']['name'] . '_' . $curdate . '.sql';
$error_log = str_replace('.sql', '.err', $sql_file);
$mysqldump = findProgram('mysqldump');
if (!$mysqldump) {
return sprintf('<p class="error">' . _('mysqldump is not found on %s.') . '</p>', php_uname('n'));
}
$command_string = "{$mysqldump} --opt -Q -h {$__FM_CONFIG['db']['host']} -u {$__FM_CONFIG['db']['user']} -p{$__FM_CONFIG['db']['pass']} {$__FM_CONFIG['db']['name']} > " . sys_get_temp_dir() . "/{$__FM_CONFIG['db']['name']}_{$curdate}.sql 2>{$error_log}";
@system($command_string, $retval);
$retarr = @file_get_contents($error_log);
if ($retval) {
@unlink($error_log);
@unlink($sql_file);
return '<p class="error">' . nl2br(str_replace($exclude_warnings, '', $retarr)) . '</p>';
}
compressFile($sql_file, @file_get_contents($sql_file));
@unlink($error_log);
@unlink($sql_file);
addLogEntry(_('Backed up the database.'), $fm_name);
sendFileToBrowser($sql_file . '.gz');
}
示例7: displayRow
function displayRow($row, $type)
{
global $__FM_CONFIG;
$disabled_class = $row->policy_status == 'disabled' ? ' class="disabled"' : null;
$edit_status = $edit_actions = null;
if (currentUserCan('manage_servers', $_SESSION['module'])) {
$edit_status = '<a class="edit_form_link" name="' . $type . '" href="#">' . $__FM_CONFIG['icons']['edit'] . '</a>';
$edit_status .= '<a class="status_form_link" href="#" rel="';
$edit_status .= $row->policy_status == 'active' ? 'disabled' : 'active';
$edit_status .= '">';
$edit_status .= $row->policy_status == 'active' ? $__FM_CONFIG['icons']['disable'] : $__FM_CONFIG['icons']['enable'];
$edit_status .= '</a>';
$edit_status .= '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>';
$edit_status = '<td id="edit_delete_img">' . $edit_status . '</td>';
}
$log = $row->policy_options & $__FM_CONFIG['fw']['policy_options']['log']['bit'] ? str_replace(array('__action__', '__Action__'), array('log', 'Log'), $__FM_CONFIG['icons']['action'][$row->policy_status]) : null;
$action = str_replace(array('__action__', '__Action__'), array($row->policy_action, ucfirst($row->policy_action)), $__FM_CONFIG['icons']['action'][$row->policy_status]);
$source = $row->policy_source ? $this->formatPolicyIDs($row->policy_source) : 'any';
$destination = $row->policy_destination ? $this->formatPolicyIDs($row->policy_destination) : 'any';
$services = $row->policy_services ? $this->formatPolicyIDs($row->policy_services) : 'any';
$interface = $row->policy_interface ? $row->policy_interface : 'any';
$policy_time = $row->policy_time ? getNameFromID($row->policy_time, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'time', 'time_', 'time_id', 'time_name') : 'any';
$source_not = $row->policy_source_not ? '!' : null;
$destination_not = $row->policy_destination_not ? '!' : null;
$service_not = $row->policy_services_not ? '!' : null;
$comments = nl2br($row->policy_comment);
echo <<<HTML
\t\t<tr id="{$row->policy_id}"{$disabled_class}>
\t\t\t<td style="white-space: nowrap; text-align: right;">{$log} {$action}</td>
\t\t\t<td>{$source_not} {$source}</td>
\t\t\t<td>{$destination_not} {$destination}</td>
\t\t\t<td>{$service_not} {$services}</td>
\t\t\t<td>{$interface}</td>
\t\t\t<td>{$row->policy_direction}</td>
\t\t\t<td>{$policy_time}</td>
\t\t\t<td>{$comments}</td>
\t\t\t{$edit_status}
\t\t</tr>
HTML;
}
示例8: or
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| facileManager: Easy System Administration |
+-------------------------------------------------------------------------+
| http://www.facilemanager.com/ |
+-------------------------------------------------------------------------+
| Processes admin logs page |
| Author: Jon LaBass |
+-------------------------------------------------------------------------+
*/
if (!currentUserCan('view_logs')) {
unAuth();
}
printHeader();
@printMenu();
$response = isset($response) ? $response : null;
$search_sql = $list = $log_search_query = $log_search_date_b = $log_search_date_e = null;
extract($_POST);
/** Module search */
if (isset($log_search_module) && is_array($log_search_module) && !in_array('All Modules', $log_search_module)) {
foreach ($log_search_module as $search_module) {
$list .= "'{$search_module}',";
}
$search_sql .= 'AND log_module IN (' . rtrim($list, ',') . ') ';
}
/** User search */
示例9: zoneImportWizard
/**
* Imports records from a zone file and presents a confirmation
*/
function zoneImportWizard()
{
global $__FM_CONFIG, $fm_name;
if (!currentUserCan('manage_records', $_SESSION['module'])) {
return $this->unAuth('zone');
}
if (!zoneAccessIsAllowed(array($_POST['domain_id']))) {
return $this->unAuth('zone');
}
$raw_contents = file_get_contents($_FILES['import-file']['tmp_name']);
/** Strip commented lines */
$clean_contents = preg_replace('/^;.*\\n?/m', '', $raw_contents);
/** Strip blank lines */
$clean_contents = preg_replace('/^\\n?/m', '', $clean_contents);
/** Strip $GENERATE lines */
$clean_contents = preg_replace('/^\\$GENERATE.*\\n?/m', '', $clean_contents, -1, $generate_count);
/** Strip $ORIGIN lines */
$clean_contents = preg_replace('/^\\$ORIGIN.*\\n?/m', '', $clean_contents, -1, $origin_count);
/** Handle unsupported message */
if ($generate_count || $origin_count) {
$unsupported[] = sprintf('<h4>%s:</h4>', __('Unsupported Entries'));
$unsupported[] = '<p class="soa_import">' . sprintf(__('%s currently does not support importing $GENERATE and $ORIGIN entries which were found in your zone file.'), $fm_name) . '</p>';
$unsupported = implode("\n", $unsupported);
} else {
$unsupported = null;
}
$domain_name = getNameFromID($_POST['domain_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name');
$domain_map = getNameFromID($_POST['domain_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_mapping');
$count = 1;
/** Detect SOA */
if (!getSOACount($_POST['domain_id']) && strpos($clean_contents, ' SOA ') !== false && (in_array('SOA', $__FM_CONFIG['records']['require_zone_rights']) && currentUserCan('manage_zones', $_SESSION['module']))) {
$raw_soa = preg_replace("/SOA(.+?)\\)/esim", "str_replace(PHP_EOL, ' ', '\\1')", $clean_contents);
preg_match("/SOA(.+?)\\)/esim", $clean_contents, $raw_soa);
preg_match("/TTL(.+?)\$/esim", $clean_contents, $raw_ttl);
if (is_array($raw_ttl)) {
$soa_array['soa_ttl'] = trim(preg_replace('/;(.+?)+/', '', $raw_ttl[1]));
}
if (is_array($raw_soa)) {
$raw_soa = preg_replace('/;(.+?)+/', '', $raw_soa[1]);
$soa = str_replace(array("\n", "\t", '(', ')', ' '), ' ', preg_replace('/\\s\\s+/', ' ', $raw_soa));
$soa = str_replace(' ', '|', trim($soa));
$soa_fields = explode('|', str_replace('||', '|', $soa));
list($soa_array['soa_master_server'], $soa_array['soa_email_address'], $tmp_serial, $soa_array['soa_refresh'], $soa_array['soa_retry'], $soa_array['soa_expire'], $tmp_neg_cache) = $soa_fields;
if (strpos($soa_array['soa_master_server'], $domain_name) !== false) {
$soa_array['soa_master_server'] = str_replace('.' . trimFullStop($domain_name) . '.', '', $soa_array['soa_master_server']);
$soa_array['soa_email_address'] = str_replace('.' . trimFullStop($domain_name) . '.', '', $soa_array['soa_email_address']);
$soa_array['soa_append'] = 'yes';
} else {
$soa_array['soa_append'] = 'no';
}
}
$soa_row = '<h4>SOA:</h4><p class="soa_import">' . trimFullStop($domain_name) . '. IN SOA ' . $soa_array['soa_master_server'];
if ($soa_array['soa_append'] == 'yes') {
$soa_row .= '.' . trimFullStop($domain_name) . '.';
}
$soa_row .= ' ' . $soa_array['soa_email_address'];
if ($soa_array['soa_append'] == 'yes') {
$soa_row .= '.' . trimFullStop($domain_name) . '.';
}
$soa_row .= ' ( <autogen_serial> ' . $soa_array['soa_refresh'] . ' ' . $soa_array['soa_retry'] . ' ' . $soa_array['soa_expire'] . ' ' . $soa_array['soa_ttl'] . ' )';
$soa_row = <<<HTML
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_master_server]" value="{$soa_array['soa_master_server']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_email_address]" value="{$soa_array['soa_email_address']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_refresh]" value="{$soa_array['soa_refresh']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_retry]" value="{$soa_array['soa_retry']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_expire]" value="{$soa_array['soa_expire']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_ttl]" value="{$soa_array['soa_ttl']}" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][record_type]" value="SOA" />
\t\t\t\t\t\t<input type="hidden" name="create[{$count}][soa_append]" value="{$soa_array['soa_append']}" />
\t\t\t\t\t\t{$soa_row}
\t\t\t\t\t\t<span><label><input type="checkbox" name="create[{$count}][record_skip]" />Skip Import</label></span>
\t\t\t\t\t\t</p>
\t\t\t\t\t\t
\t\t\t\t\t\t<h4>Records:</h4>
HTML;
$count++;
} else {
$soa_row = null;
}
$clean_contents = str_replace('.' . trimFullStop($domain_name) . '.', '', $clean_contents);
$clean_contents = str_replace(trimFullStop($domain_name) . '.', '', $clean_contents);
$available_record_types = array_filter(enumMYSQLSelect('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records', 'record_type'), 'removeRestrictedRR');
sort($available_record_types);
/** Loop through the lines */
$lines = explode(PHP_EOL, $clean_contents);
$failed = 0;
$rows = null;
$valid_hashes = array(';', '//', '#');
foreach ($lines as $line) {
$null_keys = array('record_ttl', 'record_priority', 'record_weight', 'record_port');
foreach ($null_keys as $key) {
$array[$key] = null;
}
if (!strlen(trim($line))) {
continue;
}
//.........这里部分代码省略.........
示例10: buildPopup
include_once ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_templates.php';
if (is_array($_POST) && array_key_exists('action', $_POST) && $_POST['action'] == 'bulk' && array_key_exists('bulk_action', $_POST) && in_array($_POST['bulk_action'], array('reload'))) {
$popup_footer = buildPopup('footer', __('OK'), array('cancel_button' => 'cancel'), getMenuURL(ucfirst(getNameFromID($_POST['item_id'][0], 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_mapping'))));
echo buildPopup('header', 'Reload Results') . '<pre>';
echo processBulkDomainIDs($_POST['item_id']);
echo "\n" . ucfirst($_POST['bulk_action']) . ' is complete.</pre>' . $popup_footer;
exit;
/** Handle mass updates */
} elseif (is_array($_POST) && array_key_exists('action', $_POST) && $_POST['action'] == 'process-all-updates') {
$result .= processBulkDomainIDs(getZoneReloads('ids'));
return;
}
$unpriv_message = __('You do not have sufficient privileges.');
$checks_array = array('servers' => 'manage_servers', 'views' => 'manage_servers', 'acls' => 'manage_servers', 'keys' => 'manage_servers', 'options' => 'manage_servers', 'logging' => 'manage_servers', 'controls' => 'manage_servers', 'domains' => 'manage_zones', 'domain' => 'manage_zones', 'soa' => 'manage_zones');
$allowed_capabilities = array_unique($checks_array);
if (is_array($_POST) && count($_POST) && currentUserCan($allowed_capabilities, $_SESSION['module'])) {
if (!checkUserPostPerms($checks_array, $_POST['item_type'])) {
echo $unpriv_message;
exit;
}
$table = $__FM_CONFIG[$_SESSION['module']]['prefix'] . sanitize($_POST['item_type']);
$id = sanitize($_POST['item_id']);
$server_serial_no = isset($_POST['server_serial_no']) ? sanitize($_POST['server_serial_no']) : null;
$type = isset($_POST['item_sub_type']) ? sanitize($_POST['item_sub_type']) : null;
$table = $__FM_CONFIG[$_SESSION['module']]['prefix'] . $_POST['item_type'];
$item_type = $_POST['item_type'];
$prefix = substr($item_type, 0, -1) . '_';
/* Determine which class we need to deal with */
switch ($_POST['item_type']) {
case 'servers':
$post_class = $fm_module_servers;
示例11: displayRow
function displayRow($row)
{
global $__FM_CONFIG;
$disabled_class = $row->object_status == 'disabled' ? ' class="disabled"' : null;
$edit_status = null;
if (currentUserCan('manage_objects', $_SESSION['module'])) {
$edit_status = '<a class="edit_form_link" name="' . $row->object_type . '" href="#">' . $__FM_CONFIG['icons']['edit'] . '</a>';
if (!isItemInPolicy($row->object_id, 'object')) {
$edit_status .= '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>';
}
$edit_status = '<td id="edit_delete_img">' . $edit_status . '</td>';
}
$edit_name = $row->object_name;
$netmask = $row->object_type != 'address' ? "<td>{$row->object_mask}</td>" : null;
$comments = nl2br($row->object_comment);
echo <<<HTML
\t\t\t<tr id="{$row->object_id}"{$disabled_class}>
\t\t\t\t<td>{$row->object_name}</td>
\t\t\t\t<td>{$row->object_address}</td>
\t\t\t\t{$netmask}
\t\t\t\t<td>{$comments}</td>
\t\t\t\t{$edit_status}
\t\t\t</tr>
HTML;
}
示例12: define
| Author: Jon LaBass |
+-------------------------------------------------------------------------+
*/
define('AJAX', true);
require_once '../../../fm-init.php';
$response = null;
include ABSPATH . 'fm-modules/facileManager/classes/class_tools.php';
$shared_tools_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . 'shared' . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'processTools.php';
if (file_exists($shared_tools_file) && $_SESSION['module'] != $fm_name) {
include $shared_tools_file;
}
$module_tools_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $_SESSION['module'] . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'processTools.php';
if (file_exists($module_tools_file) && $_SESSION['module'] != $fm_name) {
include $module_tools_file;
}
if (is_array($_POST) && count($_POST) && currentUserCan('run_tools')) {
if (isset($_POST['task']) && !empty($_POST['task'])) {
switch ($_POST['task']) {
case 'module_install':
$module_name = isset($_POST['item']) ? sanitize($_POST['item']) : null;
$response = buildPopup('header', _('Installing Module'));
$response .= $fm_tools->installModule($module_name);
if ($fmdb->last_error) {
$response .= $fmdb->last_error;
}
$response .= buildPopup('footer', _('OK'), array('cancel_button' => 'cancel'), getMenuURL(_('Modules')));
echo $response;
exit;
break;
case 'module_upgrade':
$module_name = isset($_POST['item']) ? sanitize($_POST['item']) : null;
示例13: displayRow
function displayRow($row)
{
global $__FM_CONFIG;
$disabled_class = $row->time_status == 'disabled' ? ' class="disabled"' : null;
$edit_status = null;
if (currentUserCan('manage_time', $_SESSION['module'])) {
$edit_status = '<a class="edit_form_link" href="#">' . $__FM_CONFIG['icons']['edit'] . '</a>';
$edit_status .= '<a class="status_form_link" href="#" rel="';
$edit_status .= $row->time_status == 'active' ? 'disabled' : 'active';
$edit_status .= '">';
$edit_status .= $row->time_status == 'active' ? $__FM_CONFIG['icons']['disable'] : $__FM_CONFIG['icons']['enable'];
$edit_status .= '</a>';
if (!isItemInPolicy($row->time_id, 'time')) {
$edit_status .= '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>';
}
$edit_status = '<td id="edit_delete_img">' . $edit_status . '</td>';
}
/** Format date range */
$date_range = $this->formatDates($row->time_start_date, $row->time_end_date);
/** Format weekdays */
$weekdays = $this->formatDays($row->time_weekdays);
$comments = nl2br($row->time_comment);
echo <<<HTML
\t\t\t<tr id="{$row->time_id}"{$disabled_class}>
\t\t\t\t<td>{$row->time_name}</td>
\t\t\t\t<td>{$date_range}</td>
\t\t\t\t<td>{$row->time_start_time} → {$row->time_end_time}</td>
\t\t\t\t<td>{$weekdays}</td>
\t\t\t\t<td>{$comments}</td>
\t\t\t\t{$edit_status}
\t\t\t</tr>
HTML;
}
示例14: getUserInfo
$user_info = getUserInfo($_GET['id']);
if ($user_info) {
if ($user_info['user_template_only'] == 'no') {
if (updateStatus('fm_users', $_GET['id'], 'user_', $_GET['status'], 'user_id')) {
addLogEntry(sprintf(_("Set user '%s' status to %s."), $user_info['user_login'], $_GET['status']), $fm_name);
header('Location: ' . $GLOBALS['basename'] . '?type=' . $_POST['type']);
}
}
}
$response = sprintf(_('This user could not be set to %s.') . "\n", $_GET['status']);
}
}
printHeader();
@printMenu();
$avail_types = buildSubMenu($type);
echo printPageHeader($response, $display_type, currentUserCan('manage_users'), $type);
$sort_field = $type == 'users' ? 'user_login' : 'group_name';
$sort_direction = null;
if (isset($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']])) {
extract($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']], EXTR_OVERWRITE);
}
echo <<<HTML
<div id="pagination_container" class="submenus">
\t<div>
\t<div class="stretch"></div>
\t{$avail_types}
\t</div>
</div>
HTML;
$result = $type == 'users' ? basicGetList('fm_users', $sort_field, 'user_', null, null, false, $sort_direction) : basicGetList('fm_groups', $sort_field, 'group_', null, null, false, $sort_direction);
示例15: displayRow
function displayRow($row)
{
global $fmdb, $__FM_CONFIG, $fm_dns_acls;
if (!class_exists('fm_dns_acls')) {
include ABSPATH . 'fm-modules/fmDNS/classes/class_acls.php';
}
$disabled_class = $row->cfg_status == 'disabled' ? ' class="disabled"' : null;
if (currentUserCan('manage_servers', $_SESSION['module'])) {
$edit_uri = strpos($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'] . '&' : $_SERVER['REQUEST_URI'] . '?';
$edit_status = '<td id="edit_delete_img">';
$edit_status .= '<a class="edit_form_link" href="#">' . $__FM_CONFIG['icons']['edit'] . '</a>';
$edit_status .= '<a class="status_form_link" href="#" rel="';
$edit_status .= $row->cfg_status == 'active' ? 'disabled' : 'active';
$edit_status .= '">';
$edit_status .= $row->cfg_status == 'active' ? $__FM_CONFIG['icons']['disable'] : $__FM_CONFIG['icons']['enable'];
$edit_status .= '</a>';
$edit_status .= '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>';
$edit_status .= '</td>';
} else {
$edit_status = null;
}
$comments = nl2br($row->cfg_comment);
/** Parse address_match_element configs */
$cfg_data = $this->parseDefType($row->cfg_name, $row->cfg_data);
$zone_row = null;
if (isset($_GET['option_type']) && sanitize($_GET['option_type']) == 'ratelimit') {
$domain_name = $row->domain_id ? getNameFromID($row->domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name') : '<span>All Zones</span>';
$zone_row = '<td>' . $domain_name . '</td>';
unset($domain_name);
}
echo <<<HTML
\t\t<tr id="{$row->cfg_id}"{$disabled_class}>
\t\t\t{$zone_row}
\t\t\t<td>{$row->cfg_name}</td>
\t\t\t<td>{$cfg_data}</td>
\t\t\t<td>{$comments}</td>
\t\t\t{$edit_status}
\t\t</tr>
HTML;
}