本文整理汇总了PHP中getNameFromID函数的典型用法代码示例。如果您正苦于以下问题:PHP getNameFromID函数的具体用法?PHP getNameFromID怎么用?PHP getNameFromID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getNameFromID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildModuleToolbar
/**
* Builds the additional module menu for display
*
* @since 1.0
* @package facileManager
* @subpackage fmFirewall
*/
function buildModuleToolbar()
{
global $__FM_CONFIG;
if (isset($_GET['server_serial_no'])) {
$server_name = getNameFromID($_GET['server_serial_no'], 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name');
$domain_menu = sprintf('<div id="topheadpart">
<span class="single_line">%s: %s</span>
</div>', __('Firewall'), $server_name);
} else {
$domain_menu = null;
}
return array($domain_menu, null);
}
开发者ID:pclemot,项目名称:facileManager,代码行数:20,代码来源:functions.php
示例2: exit
case 'delete':
if (isset($id)) {
exit(parseAjaxOutput($post_class->delete(sanitize($id), $server_serial_no, $type)));
}
break;
case 'edit':
if (isset($_POST['item_status'])) {
if (!updateStatus('fm_' . $table, $id, $prefix, sanitize($_POST['item_status']), $field)) {
exit(sprintf(__('This item could not be set to %s.') . "\n", $_POST['item_status']));
} else {
if ($server_serial_no) {
setBuildUpdateConfigFlag($server_serial_no, 'yes', 'build');
}
$tmp_name = getNameFromID($id, 'fm_' . $table, $prefix, $field, $prefix . 'name');
if ($server_serial_no && $_POST['item_type'] == 'policies') {
$tmp_server = getNameFromID($server_serial_no, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name');
addLogEntry(sprintf(__('Set %s for %s status to %s.'), $object, $tmp_server, sanitize($_POST['item_status'])));
} else {
addLogEntry(sprintf(__('Set %s (%s) status to %s.'), $object, $tmp_name, sanitize($_POST['item_status'])));
}
exit('Success');
}
}
break;
case 'update_sort':
if (!empty($_POST)) {
$result = $post_class->update($_POST);
if ($result !== true) {
exit($result);
}
exit('Success');
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:processPost.php
示例3: getUserCapabilities
/**
* Gets the user capabilities
*
* @since 1.2
* @package facileManager
*
* @param integer $user_id User ID to retrieve.
* @param string $type User, group, or all
* @return array
*/
function getUserCapabilities($user_id, $type = 'user')
{
if ($type == 'all') {
if ($group_id = getNameFromID($user_id, 'fm_users', 'user_', 'user_id', 'user_group')) {
return getUserCapabilities($group_id, 'group');
}
}
$user_capabilities = getNameFromID($user_id, 'fm_' . $type . 's', $type . '_', $type . '_id', $type . '_caps');
if (isSerialized($user_capabilities)) {
$user_capabilities = unserialize($user_capabilities);
}
return $user_capabilities;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:23,代码来源:functions.php
示例4: resolveServerGroupMasters
/**
* Attempts to resolve the master servers for the group
*
* @since 2.0
* @package fmDNS
*
* @param array $zone_array The zone data
* @param integer $server_id The server id to check
* @return array
*/
function resolveServerGroupMasters($masters)
{
global $__FM_CONFIG;
if (!count($masters)) {
return null;
}
foreach ($masters as $server_id) {
$server_name = getNameFromID($server_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'server_', 'server_id', 'server_name');
$server_ip = gethostbyname($server_name);
$master_ips[] = $server_ip != $server_name ? $server_ip : sprintf(__('Cannot resolve %s'), $server_name);
}
return implode('; ', (array) $master_ips) . ';';
}
开发者ID:Vringe,项目名称:facileManager,代码行数:23,代码来源:class_buildconf.php
示例5: formatPolicyIDs
function formatPolicyIDs($ids)
{
global $__FM_CONFIG;
$names = null;
foreach (explode(';', trim($ids, ';')) as $temp_id) {
if ($temp_id[0] == 's') {
$names[] = getNameFromID(substr($temp_id, 1), 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'services', 'service_', 'service_id', 'service_name');
} elseif ($temp_id[0] == 'o') {
$names[] = getNameFromID(substr($temp_id, 1), 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'objects', 'object_', 'object_id', 'object_name');
} else {
$names[] = getNameFromID(substr($temp_id, 1), 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'groups', 'group_', 'group_id', 'group_name');
}
}
return implode("<br />\n", $names);
}
开发者ID:pclemot,项目名称:facileManager,代码行数:15,代码来源:class_policies.php
示例6: 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;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:40,代码来源:class_options.php
示例7: isLoggedIn
/**
* Checks if the user is authenticated
*
* @since 1.0
* @package facileManager
*
* @return boolean
*/
function isLoggedIn()
{
global $fm_name;
if (defined('INSTALL')) {
return false;
}
/** No auth_method defined */
if (getOption('fm_db_version') >= 18) {
if (!getOption('auth_method')) {
if (!isset($_COOKIE['myid'])) {
session_set_cookie_params(strtotime('+1 week'));
@session_start();
$_SESSION['user']['logged_in'] = true;
$_SESSION['user']['id'] = 1;
$_SESSION['user']['account_id'] = 1;
$modules = getActiveModules(true);
if (!isset($_SESSION['module'])) {
$_SESSION['module'] = is_array($modules) && count($modules) ? $modules[0] : $fm_name;
}
setcookie('myid', session_id(), strtotime('+1 week'));
}
session_set_cookie_params(strtotime('+1 week'));
if (!empty($_COOKIE['myid'])) {
@session_id($_COOKIE['myid']);
@session_start();
}
return true;
}
}
/** Auth method defined so let's validate */
if (isset($_COOKIE['myid'])) {
$myid = $_COOKIE['myid'];
/** Init the session. */
session_set_cookie_params(strtotime('+1 week'));
session_id($myid);
@session_start();
/** Check if they're logged in. */
if (isset($_SESSION['user']['logged_in']) && $_SESSION['user']['logged_in']) {
/** Set the last login info */
if (strtotime("-1 hour") > $_SESSION['user']['last_login']) {
$_SESSION['user']['last_login'] = strtotime("-15 minutes");
$_SESSION['user']['ipaddr'] = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR'];
}
/** Should the user be logged in? */
if (getNameFromID($_SESSION['user']['id'], 'fm_users', 'user_', 'user_id', 'user_status') != 'active') {
header('Location: ' . $GLOBALS['RELPATH'] . '?logout');
}
return true;
}
}
return false;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:60,代码来源:class_logins.php
示例8: getGroupServers
/**
* Gets all servers in a group
*
* @since 2.1
* @package facileManager
*/
function getGroupServers($id)
{
global $fmdb, $__FM_CONFIG;
basicGet('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'server_groups', sanitize($id), 'group_', 'group_id');
if (!$fmdb->num_rows) {
return sprintf(_('%d is not a valid group number.'), $id);
}
$group_details = $fmdb->last_result[0];
$group_masters = isset($group_details->group_masters) ? explode(';', $group_details->group_masters) : null;
$group_slaves = isset($group_details->group_slaves) ? explode(';', $group_details->group_slaves) : null;
$group_servers = array_merge($group_masters, $group_slaves);
foreach ($group_servers as $key => $id) {
$server_serial_nos[] = getNameFromID($id, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_id', 'server_serial_no');
}
return (array) $server_serial_nos;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:22,代码来源:class_servers.php
示例9: getZoneTemplateChildren
/**
* Builds an array of available zone templates
*
* @since 2.0
* @package facileManager
* @subpackage fmDNS
*
* @param int $domain_id Domain ID to get children
* @return array
*/
function getZoneTemplateChildren($domain_id)
{
global $fmdb, $__FM_CONFIG;
if (getNameFromID($domain_id, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_template') == 'yes') {
$children = array();
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'domains', 'domain_id', 'domain_', 'AND domain_template_id=' . $domain_id);
if ($fmdb->num_rows) {
for ($x = 0; $x < $fmdb->num_rows; $x++) {
$children[] = $fmdb->last_result[$x]->domain_id;
}
}
return $children;
}
return array($domain_id);
}
开发者ID:pclemot,项目名称:facileManager,代码行数:25,代码来源:class_zones.php
示例10: displayRow
function displayRow($row)
{
global $__FM_CONFIG;
$disabled_class = $row->server_status == 'disabled' ? ' class="disabled"' : null;
$timezone = date("T");
if (currentUserCan('manage_servers', $_SESSION['module'])) {
$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->server_status == 'active' ? 'disabled' : 'active';
$edit_status .= '">';
$edit_status .= $row->server_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;
}
/** Get some options */
$server_backup_credentials = getServerCredentials($_SESSION['user']['account_id'], $row->server_serial_no);
if (!empty($server_backup_credentials[0])) {
list($backup_username, $backup_password) = $server_backup_credentials;
} else {
$backup_username = getOption('backup_username', $_SESSION['user']['account_id'], $_SESSION['module']);
$backup_password = getOption('backup_password', $_SESSION['user']['account_id'], $_SESSION['module']);
}
/** Get group associations */
$groups_array = explode(';', $row->server_groups);
$groups = null;
foreach ($groups_array as $group_id) {
$group_name = getNameFromID($group_id, 'fm_' . $__FM_CONFIG['fmSQLPass']['prefix'] . 'groups', 'group_', 'group_id', 'group_name');
$groups .= "{$group_name}\n";
}
$groups = nl2br(trim($groups));
if (empty($groups)) {
$groups = 'None';
}
echo <<<HTML
\t\t<tr id="{$row->server_id}"{$disabled_class}>
\t\t\t<td>{$row->server_name}</td>
\t\t\t<td>{$row->server_type} (tcp/{$row->server_port})</td>
\t\t\t<td>{$groups}</td>
\t\t\t{$edit_status}
\t\t</tr>
HTML;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:46,代码来源:class_servers.php
示例11: buildServerConfig
//.........这里部分代码省略.........
$response = sprintf('<p>%s</p>' . "\n", __('This server will be updated on the next cron run.'));
} else {
$response = sprintf('<p>%s</p>' . "\n", __('This server receives updates via cron - please manage the server manually.'));
}
break;
case 'http':
case 'https':
/** Test the port first */
if (!socketTest($server_name, $server_update_port, 10)) {
return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port));
}
/** Remote URL to use */
$url = $server_update_method . '://' . $server_name . ':' . $server_update_port . '/' . $_SESSION['module'] . '/reload.php';
/** Data to post to $url */
$post_data = array('action' => $action, 'serial_no' => $server_serial_no, 'options' => implode(' ', $options));
$post_result = @unserialize(getPostData($url, $post_data));
if (!is_array($post_result)) {
/** Something went wrong */
if (empty($post_result)) {
return sprintf('<p class="error">%s</p>', sprintf(__('It appears %s does not have php configured properly within httpd or httpd is not running.'), $server_name));
}
return '<p class="error">' . $post_result . '</p>';
} else {
if (count($post_result) > 1) {
$response .= "<pre>\n";
/** Loop through and format the output */
foreach ($post_result as $line) {
$response .= "[{$server_name}] {$line}\n";
}
$response .= "</pre>\n";
} else {
$response = "<p>[{$server_name}] " . $post_result[0] . '</p>';
}
}
break;
case 'ssh':
/** Test the port first */
if (!socketTest($server_name, $server_update_port, 10)) {
return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port));
}
/** Get SSH key */
$ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']);
if (!$ssh_key) {
return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: SSH key is not <a href="%s">defined</a>.'), getMenuURL(__('General'))));
}
$temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa';
if (file_exists($temp_ssh_key)) {
@unlink($temp_ssh_key);
}
if (@file_put_contents($temp_ssh_key, $ssh_key) === false) {
return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not load SSH key into %s.'), $temp_ssh_key));
}
@chmod($temp_ssh_key, 0400);
$ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']);
if (!$ssh_user) {
return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: SSH user is not <a href="%s">defined</a>.'), getMenuURL(__('General'))));
}
/** Test SSH authentication */
exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$server_update_port} -l {$ssh_user} {$server_name} 'ls /usr/local/{$fm_name}/{$_SESSION['module']}/dns.php'", $post_result, $retval);
if ($retval) {
/** Something went wrong */
@unlink($temp_ssh_key);
return sprintf('<p class="error">%s</p>' . "\n", __('Failed: Could not login via SSH.'));
}
unset($post_result);
/** Run build */
exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$server_update_port} -l {$ssh_user} {$server_name} 'sudo php /usr/local/{$fm_name}/{$_SESSION['module']}/dns.php {$action} " . implode(' ', $options) . "'", $post_result, $retval);
@unlink($temp_ssh_key);
if ($retval) {
/** Something went wrong */
return '<p class="error">' . ucfirst($friendly_action) . ' failed.</p>' . "\n";
}
if (!count($post_result)) {
$post_result[] = ucfirst($friendly_action) . ' was successful.';
}
if (count($post_result) > 1) {
$response = "<pre>\n";
/** Loop through and format the output */
foreach ($post_result as $line) {
$response .= "[{$server_name}] {$line}\n";
}
$response .= "</pre>\n";
} else {
$response = "<p>[{$server_name}] " . $post_result[0] . '</p>';
}
break;
}
if ($action == 'buildconf') {
/* reset the server_build_config flag */
if (!strpos($response, strtolower('failed'))) {
setBuildUpdateConfigFlag($serial_no, 'no', 'build');
}
}
$tmp_name = getNameFromID($serial_no, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name');
addLogEntry(ucfirst($friendly_action) . " was performed on server '{$tmp_name}'.");
if (strpos($response, '<pre>') !== false) {
$response = buildPopup('header', $friendly_action . ' Results') . $response . $popup_footer;
}
return $response;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:101,代码来源:class_servers.php
示例12: delete
/**
* Deletes the selected template
*/
function delete($id, $table, $prefix)
{
global $fmdb, $__FM_CONFIG;
$tmp_name = getNameFromID($id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . $table, $prefix . '_', $prefix . '_id', $prefix . '_name');
if (updateStatus('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . $table, $id, $prefix . '_', 'deleted', $prefix . '_id') === false) {
return __('This template could not be deleted because a database error occurred.');
} else {
addLogEntry("Deleted {$prefix} template '{$tmp_name}'.");
return true;
}
}
开发者ID:pclemot,项目名称:facileManager,代码行数:14,代码来源:class_templates.php
示例13: save
/**
* Saves the options
*/
function save()
{
global $fmdb, $__FM_CONFIG, $fm_name;
if (!currentUserCan('manage_settings')) {
return _('You do not have permission to make these changes.');
}
$force_logout = false;
$exclude = array('save', 'item_type', 'gen_ssh');
$ports = array('ldap_port', 'ldap_port_ssl', 'fm_port_ssl');
$log_message = _('Set system settings to the following:') . "\n";
foreach ($_POST as $key => $data) {
if (!in_array($key, $exclude)) {
unset($data_array);
if (is_array($data)) {
$data_array = $data;
$account_id = $_SESSION['user']['account_id'];
$data = $data[$account_id];
} else {
$account_id = 0;
}
/** Check if the option has changed */
$current_value = getOption($key, $account_id);
unset($account_id);
if ($current_value == $data) {
continue;
}
if ($key == 'mail_from' && isEmailAddressValid($data) === false) {
return sprintf(_('%s is not a valid e-mail address.'), $data);
}
if (in_array($key, $ports)) {
if (!verifyNumber($data, 1, 65535, false)) {
return _('Invalid port number specified.');
}
}
if (isset($data_array)) {
$data = $data_array;
}
$new_array[$key] = $current_value === false ? array($data, 'insert') : array($data, 'update');
}
}
if (isset($new_array) && is_array($new_array)) {
foreach ($new_array as $option => $value) {
list($option_value, $command) = $value;
if (is_array($option_value)) {
$data_array = $option_value;
$account_id = $_SESSION['user']['account_id'];
$option_value = $option_value[$account_id];
} else {
$account_id = 0;
}
/** Update with the new value */
$result = setOption($option, $option_value, $command, false, $account_id);
unset($account_id);
if (!$result) {
return _('Could not save settings because a database error occurred.');
}
$log_value = trim($option_value);
$log_message .= ucwords(str_replace('_', ' ', $option)) . ': ';
if (@is_array($__FM_CONFIG['options'][$option][0])) {
foreach ($__FM_CONFIG['options'][$option] as $array) {
if ($log_value == $array[1]) {
$log_message .= $array[0];
break;
}
}
} elseif ($option == 'mail_smtp_pass') {
$log_message .= str_repeat('*', 8);
} elseif ($option == 'date_format' || $option == 'time_format') {
$log_message .= date($log_value);
} elseif ($option == 'ldap_user_template') {
$log_message .= getNameFromID($log_value, 'fm_users', 'user_', 'user_id', 'user_login');
} elseif ($option_value == '1') {
$log_message .= _('Yes');
} elseif ($option_value == '0') {
$log_message .= _('No');
} else {
$log_message .= $log_value;
}
$log_message .= "\n";
if ($option == 'auth_method') {
$force_logout = true;
}
if (isset($data_array)) {
$data = $data_array;
unset($data_array);
}
}
addLogEntry($log_message, $fm_name);
if ($force_logout) {
exit('force_logout');
}
return true;
}
return true;
}
开发者ID:pclemot,项目名称:facileManager,代码行数:98,代码来源:class_settings.php
示例14: sprintf
if ($_GET['type'] == 'servers') {
if (!updateStatus('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', $_GET['id'], 'server_', $_GET['status'], 'server_id')) {
$response = sprintf(__('This server could not be set to %s.') . "\n", $_GET['status']);
} else {
/* set the server_build_config flag */
$query = "UPDATE `fm_{$__FM_CONFIG['fmDNS']['prefix']}servers` SET `server_build_config`='yes' WHERE `server_id`=" . sanitize($_GET['id']);
$result = $fmdb->query($query);
$tmp_name = getNameFromID($_GET['id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'server_', 'server_id', 'server_name');
addLogEntry(sprintf(__('Set server (%s) status to %s.'), $tmp_name, $_GET['status']));
header('Location: ' . $GLOBALS['basename'] . '?type=' . $_GET['type']);
}
} elseif ($_GET['type'] == 'groups') {
if (!updateStatus('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'server_groups', $_GET['id'], 'group_', $_GET['status'], 'group_id')) {
$response = sprintf(__('This server group could not be set to %s.') . "\n", $_GET['status']);
} else {
$tmp_name = getNameFromID($_GET['id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'server_groups', 'group_', 'group_id', 'group_name');
addLogEntry(sprintf(__('Set server group (%s) status to %s.'), $tmp_name, $_GET['status']));
header('Location: ' . $GLOBALS['basename'] . '?type=' . $_GET['type']);
}
}
}
break;
}
}
printHeader();
@printMenu();
$avail_types = buildSubMenu($type);
echo printPageHeader($response, $display_type, currentUserCan('manage_servers', $_SESSION['module']), $type);
$sort_direction = null;
if (isset($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']])) {
extract($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']], EXTR_OVERWRITE);
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:config-servers.php
示例15: autoCreatePTR
function autoCreatePTR($domain_id, $record_type, $data)
{
if ($record_type == 'A' && isset($data['PTR']) && zoneAccessIsAllowed(array($data['PTR']))) {
global $__FM_CONFIG;
$domain = '.' . trimFullStop(getNameFromID($domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name')) . '.';
if ($data['record_name'][0] == '@') {
$data['record_name'] = null;
$domain = substr($domain, 1);
}
/** Get reverse zone */
if (!strrpos($data['record_value'], ':')) {
$rev_domain = trimFullStop(getNameFromID($data['PTR'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name'));
$domain_pieces = array_reverse(explode('.', $rev_domain));
$domain_parts = count($domain_pieces);
$subnet_ips = null;
for ($i = 2; $i < $domain_parts; $i++) {
$subnet_ips .= $domain_pieces[$i] . '.';
}
$record_octets = array_reverse(explode('.', str_replace($subnet_ips, '', $data['record_value'])));
$temp_record_value = null;
for ($j = 0; $j < count($record_octets); $j++) {
$temp_record_value .= $record_octets[$j] . '.';
}
$data['record_value'] = rtrim($temp_record_value, '.');
} else {
/** IPv6 not yet supported */
break;
}
$array = array('record_name' => $data['record_value'], 'record_value' => $data['record_name'] . $domain, 'record_comment' => $data['record_comment'], 'record_status' => $data['record_status']);
global $fm_dns_records;
$fm_dns_records->add($data['PTR'], 'PTR', $array, 'replace');
}
}
开发者ID:pclemot,项目名称:facileManager,代码行数:33,代码来源:zone-records-write.php
示例16: delete
/**
* Deletes the selected user
*
* @since 1.0
* @package facileManager
*/
function delete($id)
{
global $fm_name;
/** Ensure user is not current LDAP template user */
if (getOption('auth_method') == 2) {
$template_user_id = getOption('ldap_user_template');
if ($id == $template_user_id) {
return _('This user is the LDAP user template and cannot be deleted at this time.');
}
}
$tmp_name = getNameFromID($id, 'fm_users', 'user_', 'user_id', 'user_login');
if (!updateStatus('fm_users', $id, 'user_', 'deleted', 'user_id')) {
return _('This user could not be deleted.') . "\n";
} else {
addLogEntry(sprintf(_("Deleted user '%s'."), $tmp_name), $fm_name);
return true;
}
}
开发者ID:pclemot,项目名称:facileManager,代码行数:24,代码来源:class_users.php
示例17: unAuth
*/
if (!currentUserCan(array('manage_policies', 'view_all'), $_SESSION['module'])) {
unAuth();
}
/** Include module variables */
if (isset($_SESSION['module'])) {
include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/variables.inc.php';
}
$server_config_page = $GLOBALS['RELPATH'] . $menu[getParentMenuKey()][4];
$type = isset($_GET['type']) && array_key_exists(sanitize(strtolower($_GET['type'])), $__FM_CONFIG['policy']['avail_types']) ? sanitize(strtolower($_GET['type'])) : 'rules';
$server_serial_no = isset($_GET['server_serial_no']) ? sanitize($_GET['server_serial_no']) : header('Location: ' . $server_config_page);
if (!($server_id = getServerID($server_serial_no, $_SESSION['module']))) {
header('Location: ' . $server_config_page);
}
/** Should not be here if the client has not been installed */
if (getNameFromID($server_id, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_id', 'server_installed') != 'yes') {
header('Location: ' . $server_config_page);
}
include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_policies.php';
if (currentUserCan('manage_servers', $_SESSION['module'])) {
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'add';
switch ($action) {
case 'add':
if (!empty($_POST)) {
$result = $fm_module_policies->add($_POST);
if ($result !== true) {
$response = $result;
$form_data = $_POST;
} else {
header('Location: ' . $GLOBALS['basename'] . "?type={$type}&server_serial_no={$server_serial_no}");
}
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:config-policy.php
示例18: displayRow
function displayRow($row, $channel_category)
{
global $__FM_CONFIG;
$disabled_class = $row->cfg_status == 'disabled' ? ' class="disabled"' : null;
$edit_name = $row->cfg_parent ? ' ' : null;
if (currentUserCan('manage_servers', $_SESSION['module'])) {
$edit_status = '<td id="edit_delete_img">';
$edit_status .= '<a class="edit_form_link" name="' . $channel_category . '" 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>';
if ($channel_category == 'channel' && is_array($this->getAssocCategories($row->cfg_id))) {
$edit_status .= null;
} else {
$edit_status .= '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>';
}
$edit_status .= '</td>';
} else {
$edit_status = null;
}
$edit_name .= $row->cfg_data;
if ($channel_category == 'category') {
$channels = null;
$assoc_channels = $this->getAssocChannels($row->cfg_id);
foreach ($assoc_channels as $channel) {
if (is_numeric($channel)) {
$channel = getNameFromID($channel, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', 'cfg_', 'cfg_id', 'cfg_data');
}
$channels .= "{$channel}, ";
}
$channels = rtrim($channels, ', ');
$channels_row = '<td>' . $channels . '</td>';
} else {
$channels_row = null;
}
$comments = nl2br($row->cfg_comment);
echo <<<HTML
\t\t<tr id="{$row->cfg_id}"{$disabled_class}>
\t\t\t<td>{$edit_name}</td>
\t\t\t{$channels_row}
\t\t\t<td>{$comments}</td>
\t\t\t{$edit_status}
\t\t</tr>
HTML;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:47,代码来源:class_logging.php
示例19: delete
/**
* Deletes the selected group
*/
function delete($id)
{
global $fmdb, $__FM_CONFIG;
// Delete group
$tmp_name = getNameFromID($id, 'fm_' . $__FM_CONFIG['fmSQLPass']['prefix'] . 'groups', 'group_', 'group_id', 'group_name');
if (!updateStatus('fm_' . $__FM_CONFIG['fmSQLPass']['prefix'] . 'groups', $id, 'group_', 'deleted', 'group_id')) {
return __('This server group could not be deleted.') . "\n";
} else {
addLogEntry("Deleted server group '{$tmp_name}'.");
return true;
}
}
开发者ID:pclemot,项目名称:facileManager,代码行数:15,代码来源:class_groups.php
示例20: exit
exit('Success');
}
}
break;
case 'delete':
if (isset($id)) {
exit(parseAjaxOutput($post_class->delete(sanitize($id), $type, $server_serial_no)));
}
break;
case 'edit':
if (isset($_POST['item_status'])) {
if (!updateStatus('fm_' . $table, $id, $prefix, sanitize($_POST['item_status']), $prefix . 'id')) {
exit(sprintf(__('This item could not be set to %s.') . "\n", $_POST['item_status']));
} else {
setBuildUpdateConfigFlag($server_serial_no, 'yes', 'build');
$tmp_name = getNameFromID($id, 'fm_' . $table, $prefix, $prefix . 'id', $field_data);
addLogEntry(sprintf(__('Set %s (%s) status to %s.'), $object, $tmp_name, sanitize($_POST['item_status'])));
exit('Success');
}
}
break;
}
exit;
}
echo $unpriv_message;
/**
* Processes the array of domain ids for reload
*
* @since 2.0
* @package facileManager
* @subpackage fmDNS
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:processPost.php
注:本文中的getNameFromID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论