本文整理汇总了PHP中basicGetList函数的典型用法代码示例。如果您正苦于以下问题:PHP basicGetList函数的具体用法?PHP basicGetList怎么用?PHP basicGetList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了basicGetList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildModuleDashboard
/**
* Builds the dashboard for display
*
* @since 1.0
* @package facileManager
* @subpackage fmSQLPass
*/
function buildModuleDashboard()
{
global $fmdb, $__FM_CONFIG;
/** Server stats */
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_id', 'server_');
$summary = '<li>You have <b>' . $fmdb->num_rows . '</b> database server';
if ($fmdb->num_rows != 1) {
$summary .= 's';
}
$summary .= ' configured.</li>' . "\n";
/** Group stats */
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'groups', 'group_id', 'group_');
$summary .= '<li>You have <b>' . $fmdb->num_rows . '</b> group';
if ($fmdb->num_rows != 1) {
$summary .= 's';
}
$summary .= ' defined.</li>' . "\n";
$dashboard = <<<DASH
\t<div class="fm-half">
\t<div id="shadow_box">
\t\t<div id="shadow_container">
\t\t<h3>Summary</h3>
\t\t{$summary}
\t\t</div>
\t</div>
\t</div>
DASH;
return $dashboard;
}
示例2: connectTests
/**
* Tests server connectivity
*/
function connectTests()
{
global $fmdb, $__FM_CONFIG;
$return = null;
/** Get server list */
$result = basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_name', 'server_');
if (!$fmdb->num_rows) {
return __('There are no servers defined.');
}
/** Process server list */
$num_rows = $fmdb->num_rows;
$results = $fmdb->last_result;
for ($x = 0; $x < $num_rows; $x++) {
$return .= sprintf(__("Running tests for %s\n"), $results[$x]->server_name);
/** ping tests */
$return .= "\t" . str_pad(__('Ping:'), 15);
if (pingTest($results[$x]->server_name)) {
$return .= __('success');
} else {
$return .= __('failed');
}
$return .= "\n";
/** SQL tests */
$return .= "\t" . str_pad($results[$x]->server_type . ':', 15);
$port = $results[$x]->server_port ? $results[$x]->server_port : $__FM_CONFIG['fmSQLPass']['default']['ports'][$results[$x]->server_type];
if (socketTest($results[$x]->server_name, $port, 10)) {
$return .= __('success') . ' (tcp/' . $port . ')';
} else {
$return .= __('failed') . ' (tcp/' . $port . ')';
}
$return .= "\n\n";
}
return $return;
}
示例3: printfmDNSUsersForm
/**
* Checks if an email address is valid
*
* @since 1.0
* @package facileManager
*
* @param string $address Email address to validate
* @return boolean
*/
function printfmDNSUsersForm($user_module_perms, $module_name)
{
global $__FM_CONFIG, $fmdb;
if (!array_key_exists($module_name, $__FM_CONFIG)) {
/** Include module variables */
@(include dirname(__FILE__) . '/variables.inc.php');
}
$available_zones_perms = 0;
if (isSerialized($user_module_perms)) {
$user_module_perms = unserialize($user_module_perms);
}
$available_zones_perms = isset($user_module_perms[$module_name]['access_specific_zones']) ? $user_module_perms[$module_name]['access_specific_zones'] : 0;
/** Get available zones */
$available_zones[0][] = 'All Zones';
$available_zones[0][] = '0';
basicGetList('fm_' . $__FM_CONFIG[$module_name]['prefix'] . 'domains', 'domain_mapping`,`domain_name', 'domain_', 'AND domain_clone_domain_id=0');
if ($fmdb->num_rows) {
$results = $fmdb->last_result;
for ($i = 0; $i < $fmdb->num_rows; $i++) {
$available_zones[$i + 1][] = !function_exists('displayFriendlyDomainName') ? $results[$i]->domain_name : displayFriendlyDomainName($results[$i]->domain_name);
$available_zones[$i + 1][] = $results[$i]->domain_id;
}
}
$zones_list = buildSelect("user_caps[{$module_name}][access_specific_zones]", 1, $available_zones, $available_zones_perms, 5, null, true, null, 'wide_select', __('Select one or more zones'));
return sprintf('
<tr class="user_permissions">
<th></th>
<td><strong>%s</strong><br />%s</td>
</tr>
', __('Limit access to the following zones:'), $zones_list);
}
示例4: buildServerConfig
/**
* Generates the server config and updates the firewall server
*
* @since 1.0
* @package fmFirewall
*/
function buildServerConfig($post_data)
{
global $fmdb, $__FM_CONFIG;
/** Get datetime formatting */
$date_format = getOption('date_format', $_SESSION['user']['account_id']);
$time_format = getOption('time_format', $_SESSION['user']['account_id']);
setTimezone();
$files = array();
$server_serial_no = sanitize($post_data['SERIALNO']);
extract($post_data);
$data->server_build_all = true;
basicGet('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', $server_serial_no, 'server_', 'server_serial_no');
if ($fmdb->num_rows) {
$server_result = $fmdb->last_result;
$data = $server_result[0];
extract(get_object_vars($data), EXTR_SKIP);
/** Disabled server */
if ($server_status != 'active') {
$error = "Server is {$server_status}.\n";
if ($compress) {
echo gzcompress(serialize($error));
} else {
echo serialize($error);
}
exit;
}
include ABSPATH . 'fm-includes/version.php';
$config = '# This file was built using ' . $_SESSION['module'] . ' ' . $__FM_CONFIG[$_SESSION['module']]['version'] . ' on ' . date($date_format . ' ' . $time_format . ' e') . "\n\n";
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'policies', 'policy_order_id', 'policy_', "AND server_serial_no={$server_serial_no} AND policy_status='active'");
if ($fmdb->num_rows) {
$policy_count = $fmdb->num_rows;
$policy_result = $fmdb->last_result;
$function = $server_type . 'BuildConfig';
$config .= $this->{$function}($policy_result, $policy_count);
}
$data->files[$server_config_file] = $config;
if (is_array($files)) {
$data->files = array_merge($data->files, $files);
}
return array(get_object_vars($data), null);
}
/** Bad server */
$error = "Server is not found.\n";
if ($compress) {
echo gzcompress(serialize($error));
} else {
echo serialize($error);
}
}
示例5: setBuildUpdateConfigFlag
}
break;
case 'edit':
if (!empty($_POST)) {
$result = $fm_dns_controls->update($_POST);
if ($result !== true) {
$response = $result;
$form_data = $_POST;
} else {
setBuildUpdateConfigFlag($server_serial_no, 'yes', 'build');
header('Location: ' . $GLOBALS['basename'] . $server_serial_no_uri);
}
}
}
}
printHeader();
@printMenu();
$avail_servers = buildServerSubMenu($server_serial_no);
echo printPageHeader($response, null, currentUserCan('manage_servers', $_SESSION['module']));
echo <<<HTML
<div id="pagination_container" class="submenus">
\t<div>
\t<div class="stretch"></div>
\t{$avail_servers}
\t</div>
</div>
HTML;
$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'controls', 'control_id', 'control_', "AND server_serial_no='{$server_serial_no}'");
$fm_dns_controls->rows($result);
printFooter();
示例6: header
+-------------------------------------------------------------------------+
| http://www.facilemanager.com/modules/fmdns/ |
+-------------------------------------------------------------------------+
| Processes server keys management page |
| Author: Jon LaBass |
+-------------------------------------------------------------------------+
*/
if (!isset($template_type)) {
header('Location: ' . $GLOBALS['RELPATH']);
}
$tpl_perms = array('manage_zones', 'view_all');
if (isset($tpl_extra_perm)) {
$tpl_perms[] = $tpl_extra_perm;
}
if (!currentUserCan($tpl_perms, $_SESSION['module'])) {
unAuth();
}
include ABSPATH . 'fm-modules/fmDNS/classes/class_templates.php';
$response = isset($response) ? $response : null;
printHeader();
@printMenu();
echo printPageHeader($response, null, currentUserCan('manage_zones', $_SESSION['module']));
$sort_direction = null;
$sort_field = $template_type . '_name';
$table = !isset($table) ? $template_type : $table;
if (isset($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']])) {
extract($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']], EXTR_OVERWRITE);
}
$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . $table, array($sort_field, $template_type . '_name'), $template_type . '_', "AND {$template_type}_template='yes' " . (string) $limited_domain_ids, null, false, $sort_direction);
$fm_module_templates->rows($result, $template_type);
printFooter();
示例7: buildPopup
$classes = 'wide';
}
}
break;
case 'dump-cache':
case 'clear-cache':
$response = buildPopup('header', __('Cache Management Results'));
if (!currentUserCan('manage_servers')) {
$_POST = array();
break;
}
if (!empty($_POST['domain_name_servers'])) {
include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_servers.php';
/** All servers */
if (in_array(0, $_POST['domain_name_servers'])) {
basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'server_name', 'server_');
if ($fmdb->num_rows) {
$result = $fmdb->last_result;
for ($i = 0; $i < $fmdb->num_rows; $i++) {
$all_servers[] = $result[$i]->server_id;
}
$_POST['domain_name_servers'] = $all_servers;
} else {
global $menu;
$response = buildPopup('header', 'Error');
$response .= sprintf(__('<p>You currently have no active name servers defined. <a href="%s">Click here</a> to define one or more to manage.</p>'), $menu[getParentMenuKey(__('Servers'))][4]);
break;
}
}
foreach ($_POST['domain_name_servers'] as $server_id) {
$response .= '<pre>' . $fm_module_servers->manageCache($server_id, $_POST['task']) . '</pre>';
示例8: buildSubMenu
$avail_types = buildSubMenu($type, $server_serial_no_uri);
$avail_servers = buildServerSubMenu($server_serial_no);
echo printPageHeader($response, getPageTitle() . ' ' . $display_type, currentUserCan('manage_servers', $_SESSION['module']), $type);
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;
$sort_direction = null;
$sort_field = 'cfg_data';
if (isset($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']])) {
extract($_SESSION[$_SESSION['module']][$GLOBALS['path_parts']['filename']], EXTR_OVERWRITE);
}
$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', array($sort_field, 'cfg_data'), 'cfg_', 'AND cfg_type="logging" AND cfg_name="' . $channel_category . '" AND server_serial_no="' . $server_serial_no . '"', null, false, $sort_direction);
$fm_module_logging->rows($result, $channel_category);
printFooter();
function buildSubMenu($option_type = 'channel', $server_serial_no_uri = null)
{
global $__FM_CONFIG;
$menu_selects = null;
foreach ($__FM_CONFIG['logging']['avail_types'] as $general => $type) {
$select = $option_type == $general ? ' class="selected"' : '';
$menu_selects .= "<span{$select}><a{$select} href=\"{$GLOBALS['basename']}?type={$general}{$server_serial_no_uri}\">{$type}</a></span>\n";
}
return '<div id="configtypesmenu">' . $menu_selects . '</div>';
}
示例9: update
/**
* Updates the selected policy
*/
function update($post)
{
global $fmdb, $__FM_CONFIG;
/** Update sort order */
if ($post['action'] == 'update_sort') {
/** Make new order in array */
$new_sort_order = explode(';', rtrim($post['sort_order'], ';'));
/** Get policy listing for server */
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'policies', 'policy_order_id', 'policy_', 'AND server_serial_no=' . $post['server_serial_no']);
$count = $fmdb->num_rows;
$policy_result = $fmdb->last_result;
for ($i = 0; $i < $count; $i++) {
$order_id = array_search($policy_result[$i]->policy_id, $new_sort_order);
if ($order_id === false) {
return __('The sort order could not be updated due to an invalid request.');
}
$query = "UPDATE `fm_{$__FM_CONFIG[$_SESSION['module']]['prefix']}policies` SET `policy_order_id`={$order_id} WHERE `policy_id`={$policy_result[$i]->policy_id} AND `server_serial_no`={$post['server_serial_no']} AND `account_id`='{$_SESSION['user']['account_id']}'";
$result = $fmdb->query($query);
if ($result === false) {
return __('Could not update the policy order because a database error occurred.');
}
}
setBuildUpdateConfigFlag($post['server_serial_no'], 'yes', 'build');
addLogEntry('Updated firewall policy order for ' . getNameFromID($post['server_serial_no'], 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name'));
return true;
}
/** Validate entries */
$post = $this->validatePost($post);
if (!is_array($post)) {
return $post;
}
$exclude = array('submit', 'action', 'policy_id', 'compress', 'AUTHKEY', 'module_name', 'module_type', 'config', 'SERIALNO');
$sql_edit = null;
$log_message = "Updated a firewall policy for " . getNameFromID($post['server_serial_no'], 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name') . " with the following details:\n";
foreach ($post as $key => $data) {
if (!in_array($key, $exclude)) {
$clean_data = sanitize($data);
$sql_edit .= $key . "='" . $clean_data . "',";
if ($clean_data && !in_array($key, array('account_id', 'server_serial_no'))) {
if (in_array($key, array('policy_source', 'policy_destination', 'policy_services'))) {
$clean_data = str_replace("<br />\n", ', ', $this->formatPolicyIDs($clean_data));
}
$log_message .= formatLogKeyData('policy_', $key, $clean_data);
}
}
}
$sql = rtrim($sql_edit, ',');
/** Update the policy */
$query = "UPDATE `fm_{$__FM_CONFIG[$_SESSION['module']]['prefix']}policies` SET {$sql} WHERE `policy_id`={$post['policy_id']} AND `account_id`='{$_SESSION['user']['account_id']}'";
$result = $fmdb->query($query);
if (!$fmdb->result) {
return __('Could not update the firewall policy because a database error occurred.');
}
/** Return if there are no changes */
if (!$fmdb->rows_affected) {
return true;
}
setBuildUpdateConfigFlag($post['server_serial_no'], 'yes', 'build');
addLogEntry($log_message);
return true;
}
示例10: buildSQLRecords
function buildSQLRecords($record_type, $domain_id)
{
global $fmdb, $__FM_CONFIG;
if ($record_type == 'SOA') {
$soa_query = "SELECT * FROM `fm_{$__FM_CONFIG['fmDNS']['prefix']}soa` WHERE `account_id`='{$_SESSION['user']['account_id']}' AND\n\t\t\t`soa_id`=(SELECT `soa_id` FROM `fm_{$__FM_CONFIG['fmDNS']['prefix']}domains` WHERE `domain_id`='{$domain_id}') AND \n\t\t\t`soa_template`='no' AND `soa_status`='active'";
$fmdb->get_results($soa_query);
if ($fmdb->num_rows) {
$result = $fmdb->last_result;
} else {
return null;
}
foreach (get_object_vars($result[0]) as $key => $val) {
$sql_results[$result[0]->soa_id][$key] = $val;
}
array_shift($sql_results[$result[0]->soa_id]);
array_shift($sql_results[$result[0]->soa_id]);
return $sql_results;
} else {
$valid_domain_ids = 'IN (' . join(',', getZoneParentID($domain_id)) . ')';
if (in_array($record_type, array('A', 'AAAA'))) {
$record_sql = "AND domain_id {$valid_domain_ids} AND record_type IN ('A', 'AAAA')";
} else {
$record_sql = "AND domain_id {$valid_domain_ids} AND record_type='{$record_type}'";
}
$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records', 'record_name', 'record_', $record_sql);
if ($result) {
$results = $fmdb->last_result;
for ($i = 0; $i < $result; $i++) {
$static_array = array('record_name', 'record_ttl', 'record_class', 'record_value', 'record_comment', 'record_status');
$optional_array = array('record_priority', 'record_weight', 'record_port', 'record_os', 'record_cert_type', 'record_key_tag', 'record_algorithm', 'record_flags', 'record_text', 'record_append');
foreach ($static_array as $field) {
$sql_results[$results[$i]->record_id][$field] = $results[$i]->{$field};
}
foreach ($optional_array as $field) {
if ($results[$i]->{$field} != null) {
$sql_results[$results[$i]->record_id][$field] = $results[$i]->{$field};
}
}
/** Skipped record? */
basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records_skipped', $results[$i]->record_id, 'record_', 'record_id', "AND domain_id={$domain_id}");
$sql_results[$results[$i]->record_id]['record_skipped'] = $fmdb->num_rows ? 'on' : 'off';
}
}
return $sql_results;
}
}
示例11: _
if (!is_int($result)) {
$output .= $result . "\n";
}
}
}
if (isset($output)) {
$output = "<pre>{$output}</pre>\n";
}
$output .= "<p class=\"complete\">" . _('Complete') . '.</p>';
echo buildPopup('header', ucwords($_POST['bulk_action']) . ' Results') . $output . buildPopup('footer', _('OK'), array('cancel_button' => 'cancel'), getMenuURL($page));
/** Handle mass updates */
} elseif (is_array($_POST) && array_key_exists('action', $_POST) && $_POST['action'] == 'process-all-updates') {
$result = "<pre>\n";
/** Server config builds */
if (currentUserCan('build_server_configs', $_SESSION['module'])) {
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_id', 'server_', 'AND server_status="active" AND server_installed="yes"');
$server_count = $fmdb->num_rows;
$server_results = $fmdb->last_result;
for ($i = 0; $i < $server_count; $i++) {
if (isset($server_results[$i]->server_client_version) && $server_results[$i]->server_client_version != getOption('client_version', 0, $_SESSION['module'])) {
$result .= $fm_shared_module_servers->doClientUpgrade($server_results[$i]->server_serial_no);
$result .= "\n";
} elseif ($server_results[$i]->server_build_config != 'no') {
$result .= $fm_shared_module_servers->doBulkServerBuild($server_results[$i]->server_serial_no);
$result .= "\n";
}
}
}
/** Module mass updates */
$include_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $_SESSION['module'] . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'processPost.php';
if (file_exists($include_file)) {
示例12: getModuleBadgeCounts
/**
* Gets the menu badge counts
*
* @since 1.0
* @package facileManager
* @subpackage fmFirewall
*
* @return boolean
*/
function getModuleBadgeCounts($type)
{
global $fmdb, $__FM_CONFIG;
if ($type == 'servers') {
$badge_counts = null;
$server_builds = array();
/** Servers */
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_id', 'server_', "AND `server_installed`!='yes' OR (`server_status`='active' AND `server_build_config`='yes')");
$server_count = $fmdb->num_rows;
$server_results = $fmdb->last_result;
for ($i = 0; $i < $server_count; $i++) {
$server_builds[] = $server_results[$i]->server_name;
}
if (version_compare(getOption('version', 0, $_SESSION['module']), '1.0-b3', '>=')) {
basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_id', 'server_', "AND `server_client_version`!='" . getOption($_SESSION['module'] . '_client_version') . "'");
$server_count = $fmdb->num_rows;
$server_results = $fmdb->last_result;
for ($i = 0; $i < $server_count; $i++) {
$server_builds[] = $server_results[$i]->server_name;
}
}
$servers = array_unique($server_builds);
$badge_counts = count($servers);
unset($server_builds, $servers, $server_count, $server_results);
}
return $badge_counts;
}
示例13: connectTests
/**
* Tests server connectivity
*/
function connectTests()
{
global $fmdb, $__FM_CONFIG;
$return = null;
/** Load ssh key for use */
$ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']);
$temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa';
if ($ssh_key) {
if (file_exists($temp_ssh_key)) {
@unlink($temp_ssh_key);
}
$ssh_key_loaded = @file_put_contents($temp_ssh_key, $ssh_key);
@chmod($temp_ssh_key, 0400);
}
$ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']);
/** Get server list */
$result = basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_name', 'server_');
/** Process server list */
$num_rows = $fmdb->num_rows;
$results = $fmdb->last_result;
for ($x = 0; $x < $num_rows; $x++) {
$return .= sprintf(__("Running tests for %s\n"), $results[$x]->server_name);
/** ping tests */
$return .= "\t" . str_pad(__('Ping:'), 15);
if (pingTest($results[$x]->server_name)) {
$return .= __('success');
} else {
$return .= __('failed');
}
$return .= "\n";
/** remote port tests */
$return .= "\t" . str_pad(__('Remote Port:'), 15);
if ($results[$x]->server_update_method != 'cron') {
if (socketTest($results[$x]->server_name, $results[$x]->server_update_port, 10)) {
$return .= __('success') . ' (tcp/' . $results[$x]->server_update_port . ")\n";
if ($results[$x]->server_update_method == 'ssh') {
$return .= "\t" . str_pad(__('SSH Login:'), 15);
if (!$ssh_key) {
$return .= __('no SSH key defined');
} elseif ($ssh_key_loaded === false) {
$return .= sprintf(__('could not load SSH key into %s'), $temp_ssh_key);
} elseif (!$ssh_user) {
$return .= __('no SSH user defined');
} else {
exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$results[$x]->server_update_port} -l {$ssh_user} {$results[$x]->server_name} uptime", $post_result, $retval);
if ($retval) {
$return .= __('ssh key login failed');
} else {
$return .= __('success');
}
}
} else {
/** php tests */
$return .= "\t" . str_pad(__('http page:'), 15);
$php_result = getPostData($results[$x]->server_update_method . '://' . $results[$x]->server_name . '/' . $_SESSION['module'] . '/reload.php', null);
if ($php_result == 'Incorrect parameters defined.') {
$return .= __('success');
} else {
$return .= __('failed');
}
}
} else {
$return .= __('failed') . ' (tcp/' . $results[$x]->server_update_port . ')';
}
} else {
$return .= __('skipping (host updates via cron)');
}
$return .= "\n";
/** dns tests */
$return .= "\t" . str_pad(__('DNS:'), 15);
$port = 53;
if (socketTest($results[$x]->server_name, $port, 10)) {
$return .= __('success') . ' (tcp/' . $port . ')';
} else {
$return .= __('failed') . ' (tcp/' . $port . ')';
}
$return .= "\n";
$return .= "\n";
}
@unlink($temp_ssh_key);
return $return;
}
示例14: switch
if (currentUserCan('manage_servers', $_SESSION['module'])) {
switch ($action) {
case 'add':
if (!empty($_POST)) {
$result = $fm_module_servers->add($_POST);
if ($result !== true) {
$response = $result;
$form_data = $_POST;
} else {
header('Location: ' . $GLOBALS['basename']);
}
}
break;
case 'edit':
if (!empty($_POST)) {
$result = $fm_module_servers->update($_POST);
if ($result !== true) {
$response = $result;
$form_data = $_POST;
} else {
header('Location: ' . $GLOBALS['basename']);
}
}
}
}
printHeader();
@printMenu();
echo printPageHeader($response, null, currentUserCan('manage_servers', $_SESSION['module']));
$result = basicGetList('fm_' . $__FM_CONFIG['fmSQLPass']['prefix'] . 'servers', 'server_name', 'server_');
$fm_module_servers->rows($result);
printFooter();
示例15: printPageHeader
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);
$fm_users->rows($result, $type);
printFooter();
function buildSubMenu($option_type = 'users')
{
global $__FM_CONFIG;
$menu_selects = $uri_params = null;
foreach ($GLOBALS['URI'] as $param => $val) {
if (in_array($param, array('type', 'action', 'id', 'status'))) {
continue;
}
$uri_params .= "&{$param}={$val}";
}
foreach ($__FM_CONFIG['users']['avail_types'] as $general => $type) {
$select = $option_type == $general ? ' class="selected"' : '';
$menu_selects .= "<span{$select}><a{$select} href=\"{$GLOBALS['basename']}?type={$general}{$uri_params}\">" . ucfirst($type) . "</a></span>\n";