当前位置: 首页>>代码示例>>PHP>>正文


PHP basicGet函数代码示例

本文整理汇总了PHP中basicGet函数的典型用法代码示例。如果您正苦于以下问题:PHP basicGet函数的具体用法?PHP basicGet怎么用?PHP basicGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了basicGet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: verify

 /**
  * Verifies server account
  *
  * @since 1.0
  * @package facileManager
  */
 function verify($data)
 {
     global $fmdb, $__FM_CONFIG;
     if (!isset($data['AUTHKEY'])) {
         return _('Account is not found.') . "\n";
     }
     extract($data);
     include ABSPATH . 'fm-modules/' . $module_name . '/variables.inc.php';
     /** Check account key */
     $account_status = $this->verifyAccount($AUTHKEY);
     if ($account_status !== true) {
         return $account_status;
     }
     /** Check serial number */
     if (isset($data['SERIALNO'])) {
         basicGet('fm_' . $__FM_CONFIG[$module_name]['prefix'] . 'servers', sanitize($SERIALNO), 'server_', 'server_serial_no', "AND server_installed='yes'", getAccountID($AUTHKEY));
         if (!$fmdb->num_rows) {
             return _('Server is not found.') . "\n";
         }
     }
     return _('Success');
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:28,代码来源:class_accounts.php

示例2: reloadAllowed

/**
 * Returns if a zone reload is allowed or not
 *
 * @since 1.0
 * @package facileManager
 * @subpackage fmDNS
 *
 * @param id $domain_id Domain ID to check
 * @return boolean
 */
function reloadAllowed($domain_id = null)
{
    global $fmdb, $__FM_CONFIG;
    basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'active', 'server_', 'server_status');
    if ($fmdb->num_rows) {
        if ($domain_id) {
            $query = 'SELECT domain_id FROM `fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'track_builds` WHERE domain_id=' . $domain_id . ' LIMIT 1';
            $result = $fmdb->get_results($query);
            $reload_allowed = $fmdb->num_rows ? true : false;
        } else {
            $reload_allowed = true;
        }
    } else {
        $reload_allowed = false;
    }
    return $reload_allowed;
}
开发者ID:Vringe,项目名称:facileManager,代码行数:27,代码来源:functions.php

示例3: getServerID

/**
 * Returns the server ID
 *
 * @since 1.0
 * @package facileManager
 *
 * @param int $server_serial_no Server serial number to process
 * @param string $module Module to use
 * @return string
 */
function getServerID($server_serial_no, $module = null)
{
    global $fmdb, $__FM_CONFIG;
    if ($module) {
        basicGet('fm_' . $__FM_CONFIG[$module]['prefix'] . 'servers', $server_serial_no, 'server_', 'server_serial_no');
        if ($fmdb->num_rows) {
            $result = $fmdb->last_result;
            return $result[0]->server_id;
        }
    }
}
开发者ID:Vringe,项目名称:facileManager,代码行数:21,代码来源:functions.php

示例4: processServerGroups

 /**
  * Processes the server groups to determine master/slave arrangement
  *
  * @since 2.0
  * @package fmDNS
  *
  * @param array $zone_array The zone data
  * @param integer $server_id The server id to check
  * @return array
  */
 function processServerGroups($zone_array, $server_id)
 {
     global $fmdb, $__FM_CONFIG;
     extract(get_object_vars($zone_array), EXTR_OVERWRITE);
     $domain_name_servers = explode(';', $domain_name_servers);
     if (!count($domain_name_servers) || in_array('0', $domain_name_servers) || $domain_type != 'master' || in_array('s_' . $server_id, $domain_name_servers)) {
         return array($domain_type, null);
     }
     foreach ($domain_name_servers as $ids) {
         if ($ids == '0' || strpos($ids, 's_') !== false) {
             continue;
         }
         if (strpos($ids, 'g_') !== false) {
             basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'server_groups', preg_replace('/\\D/', null, $ids), 'group_', 'group_id');
             if ($fmdb->num_rows) {
                 extract(get_object_vars($fmdb->last_result[0]));
                 $group_masters = explode(';', $group_masters);
                 $group_slaves = explode(';', $group_slaves);
                 if (in_array($server_id, $group_masters)) {
                     return array($domain_type, null);
                 }
                 if (in_array($server_id, $group_slaves)) {
                     return array('slave', sprintf("\tmasters { %s };\n", $this->resolveServerGroupMasters($group_masters)));
                 }
             }
         }
     }
     return array($domain_type, null);
 }
开发者ID:Vringe,项目名称:facileManager,代码行数:39,代码来源:class_buildconf.php

示例5: switch

    switch ($_POST['item_type']) {
        case 'groups':
            $post_class = $fm_sqlpass_groups;
            break;
        case 'servers':
            $post_class = $fm_module_servers;
            break;
    }
    if ($add_new) {
        if ($_POST['item_type'] == 'logging') {
            $edit_form = $post_class->printForm(null, $action, $_POST['item_sub_type']);
        } else {
            $edit_form = $post_class->printForm(null, $action, $type_map, $id);
        }
    } else {
        basicGet('fm_' . $table, $id, $prefix, $field);
        $results = $fmdb->last_result;
        if (!$fmdb->num_rows) {
            returnError();
        }
        $edit_form_data[] = $results[0];
        if ($_POST['item_type'] == 'logging') {
            $edit_form = $post_class->printForm($edit_form_data, 'edit', $_POST['item_sub_type']);
        } else {
            $edit_form = $post_class->printForm($edit_form_data, 'edit', $type_map, $view_id);
        }
    }
    echo $edit_form;
} else {
    returnUnAuth();
}
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:getData.php

示例6: validatePost

 function validatePost($post)
 {
     global $fmdb, $__FM_CONFIG;
     /** Process weekdays */
     if (@is_array($post['policy_options'])) {
         $decimals = 0;
         foreach ($post['policy_options'] as $dec) {
             $decimals += $dec;
         }
         $post['policy_options'] = $decimals;
     } else {
         $post['policy_options'] = 0;
     }
     $post['server_serial_no'] = isset($post['server_serial_no']) ? $post['server_serial_no'] : $_REQUEST['server_serial_no'];
     $post['policy_source'] = implode(';', $post['source_items']);
     $post['policy_destination'] = implode(';', $post['destination_items']);
     $post['policy_services'] = implode(';', $post['services_items']);
     unset($post['source_items']);
     unset($post['destination_items']);
     unset($post['services_items']);
     /** Get policy_order_id */
     if (!isset($post['policy_order_id']) || $post['policy_order_id'] == 0) {
         basicGet('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'policies', $post['server_serial_no'], 'policy_', 'server_serial_no', 'ORDER BY policy_order_id DESC LIMIT 1');
         if ($fmdb->num_rows) {
             $result = $fmdb->last_result[0];
             $post['policy_order_id'] = $result->policy_order_id + 1;
         } else {
             $post['policy_order_id'] = 1;
         }
     }
     /** ipfilter does not support reject */
     if (getNameFromID($post['server_serial_no'], 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_type') == 'ipfilter' && $post['policy_action'] == 'reject') {
         $post['policy_action'] = 'block';
     }
     return $post;
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:36,代码来源:class_policies.php

示例7: update

 /**
  * Updates the selected option
  */
 function update($post)
 {
     global $fmdb, $__FM_CONFIG;
     /** Validate post */
     $post = $this->validatePost($post);
     if (!is_array($post)) {
         return $post;
     }
     if (isset($post['cfg_id']) && !isset($post['cfg_name'])) {
         $post['cfg_name'] = getNameFromID($post['cfg_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', 'cfg_', 'cfg_id', 'cfg_name');
     }
     /** Does the record already exist for this account? */
     basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', sanitize($post['cfg_name']), 'cfg_', 'cfg_name', "AND cfg_id!={$post['cfg_id']} AND cfg_type='{$post['cfg_type']}' AND server_serial_no='{$post['server_serial_no']}' AND view_id='{$post['view_id']}' AND domain_id='{$post['domain_id']}'");
     if ($fmdb->num_rows) {
         $result = $fmdb->last_result;
         if ($result[0]->cfg_id != $post['cfg_id']) {
             $num_same_config = $fmdb->num_rows;
             $query = "SELECT def_max_parameters FROM fm_{$__FM_CONFIG['fmDNS']['prefix']}functions WHERE def_option='" . sanitize($post['cfg_name']) . "' AND def_option_type='{$post['cfg_type']}'";
             $fmdb->get_results($query);
             if ($num_same_config > $fmdb->last_result[0]->def_max_parameters - 1) {
                 return __('This record already exists.');
             }
         }
     }
     $exclude = array('submit', 'action', 'cfg_id');
     $sql_edit = null;
     foreach ($post as $key => $data) {
         if (!in_array($key, $exclude)) {
             $clean_data = sanitize($data);
             if (!strlen($clean_data) && $key != 'cfg_comment') {
                 return false;
             }
             if ($key == 'cfg_name' && !isDNSNameAcceptable($clean_data)) {
                 return false;
             }
             $sql_edit .= $key . "='" . $clean_data . "',";
         }
     }
     $sql = rtrim($sql_edit, ',');
     // Update the config
     $old_name = getNameFromID($post['cfg_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', 'cfg_', 'cfg_id', 'cfg_name');
     $query = "UPDATE `fm_{$__FM_CONFIG['fmDNS']['prefix']}config` SET {$sql} WHERE `cfg_id`={$post['cfg_id']} AND `account_id`='{$_SESSION['user']['account_id']}'";
     $result = $fmdb->query($query);
     if (!$fmdb->result) {
         return __('Could not update the option because a database error occurred.');
     }
     /** Return if there are no changes */
     if (!$fmdb->rows_affected) {
         return true;
     }
     $tmp_server_name = $post['server_serial_no'] ? getNameFromID($post['server_serial_no'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name') : 'All Servers';
     $tmp_view_name = $post['view_id'] ? getNameFromID($post['view_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'views', 'view_', 'view_id', 'view_name') : 'All Views';
     $tmp_domain_name = isset($post['domain_id']) ? "\nZone: " . displayFriendlyDomainName(getNameFromID($post['domain_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_name')) : null;
     include_once ABSPATH . 'fm-modules/fmDNS/classes/class_acls.php';
     $cfg_data = strpos($post['cfg_data'], 'acl_') !== false ? $fm_dns_acls->parseACL($post['cfg_data']) : $post['cfg_data'];
     addLogEntry("Updated option '{$old_name}' to:\nName: {$post['cfg_name']}\nValue: {$cfg_data}\nServer: {$tmp_server_name}\nView: {$tmp_view_name}{$tmp_domain_name}\nComment: {$post['cfg_comment']}");
     return true;
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:61,代码来源:class_options.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: manageCache

 function manageCache($server_id, $action)
 {
     global $fmdb, $__FM_CONFIG;
     /** Check serial number */
     basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'servers', sanitize($server_id), 'server_', 'server_id');
     if (!$fmdb->num_rows) {
         return __('This server is not found.');
     }
     $server_details = $fmdb->last_result;
     extract(get_object_vars($server_details[0]), EXTR_SKIP);
     $response[] = $server_name;
     if ($server_installed != 'yes') {
         $response[] = ' --> ' . __('Failed: Client is not installed.');
     }
     if (count($response) == 1 && $server_status != 'active') {
         $response[] = ' --> ' . sprintf(__('Failed: Server is %s.'), $server_status);
     }
     if (count($response) == 1) {
         foreach (makePlainText($this->buildServerConfig($server_serial_no, $action, ucfirst(str_replace('-', ' ', $action))), true) as $line) {
             $response[] = ' --> ' . $line;
         }
     }
     return implode("\n", $response);
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:24,代码来源:class_servers.php

示例10: displayRow

    function displayRow($row, $prefix)
    {
        global $__FM_CONFIG, $fmdb, $fm_dns_zones;
        if (currentUserCan('manage_zones', $_SESSION['module'])) {
            $edit_status = '<td id="edit_delete_img">';
            $edit_status .= '<a class="edit_form_link" href="#">' . $__FM_CONFIG['icons']['edit'] . '</a>';
            $show_delete = true;
            /** Cannot delete templates in use */
            if ($prefix == 'soa') {
                basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', $row->soa_id, 'domain_', 'soa_id');
            }
            if ($prefix == 'domain') {
                basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', $row->domain_id, 'domain_', 'domain_template_id');
            }
            if ($fmdb->num_rows) {
                $show_delete = false;
            }
            $edit_status .= $show_delete ? '<a href="#" class="delete">' . $__FM_CONFIG['icons']['delete'] . '</a>' : null;
            $edit_status .= '</td>';
        } else {
            $edit_status = null;
        }
        $field_name = $prefix . '_name';
        if ($prefix == 'domain') {
            if (!getSOACount($row->domain_id) && $row->domain_type == 'master' && currentUserCan('manage_zones', $_SESSION['module'])) {
                $type = 'SOA';
            } elseif (!getNSCount($row->domain_id) && $row->domain_type == 'master' && currentUserCan('manage_zones', $_SESSION['module'])) {
                $type = 'NS';
            } else {
                $type = $row->domain_mapping == 'forward' ? 'A' : 'PTR';
            }
            $edit_name = $row->domain_type == 'master' ? "<a href=\"zone-records.php?map={$row->domain_mapping}&domain_id={$row->domain_id}&record_type={$type}\" title=\"" . __('Edit zone records') . '">' . displayFriendlyDomainName($row->{$field_name}) . "</a>" : displayFriendlyDomainName($row->{$field_name});
        } else {
            $edit_name = $row->{$field_name};
        }
        $field_name = $prefix . '_default';
        $star = $row->{$field_name} == 'yes' ? str_replace(__('Super Admin'), __('Default Template'), $__FM_CONFIG['icons']['star']) : null;
        $field_id = $prefix . '_id';
        echo <<<HTML
\t\t<tr id="{$row->{$field_id}}">
\t\t\t<td>{$star}</td>
\t\t\t<td>{$edit_name}</td>
HTML;
        $row = get_object_vars($row);
        $excluded_fields = array($prefix . '_id', 'account_id', $prefix . '_template', $prefix . '_default', $prefix . '_name', $prefix . '_status', $prefix . '_template_id');
        if ($prefix == 'soa') {
            $excluded_fields = array_merge($excluded_fields, array($prefix . '_append'));
        }
        if ($prefix == 'domain') {
            $excluded_fields = array_merge($excluded_fields, array('soa_serial_no', 'soa_id', $prefix . '_clone_domain_id', $prefix . '_reload', $prefix . '_clone_dname'));
        }
        foreach ($row as $key => $val) {
            if (in_array($key, $excluded_fields)) {
                continue;
            }
            if ($prefix == 'domain') {
                /** Friendly servers and view names */
                if (in_array($key, array($prefix . '_view', $prefix . '_name_servers'))) {
                    if (!isset($fm_dns_zones)) {
                        include_once ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/classes/class_zones.php';
                    }
                    if ($key == $prefix . '_view') {
                        $val = $fm_dns_zones->IDs2Name($val, 'view');
                    } elseif ($key == $prefix . '_name_servers') {
                        $val = $fm_dns_zones->IDs2Name($val, 'server');
                    }
                }
            }
            echo '<td>' . $val;
            if ($prefix == 'soa') {
                if (in_array($key, array('soa_master_server', 'soa_email_address')) && $row['soa_append'] == 'yes') {
                    echo '<span class="grey">.mydomain.tld</span>';
                }
            }
            echo '</td>';
        }
        echo $edit_status . "</tr>\n";
    }
开发者ID:pclemot,项目名称:facileManager,代码行数:78,代码来源:class_templates.php

示例11: array

            $form_data[0]->user_login = null;
            $form_data[0]->user_template_only = false;
        }
        $edit_form = $fm_users->printUsersForm($form_data, 'add', $form_bits, $_POST['item_sub_type']);
    } else {
        if ($_POST['item_sub_type'] == 'users') {
            if (currentUserCan('manage_users')) {
                $form_bits = $edit_form_data[0]->user_auth_type == 2 ? array('user_login', 'user_email', 'user_perms', 'user_module', 'user_groups') : array('user_login', 'user_email', 'user_options', 'user_perms', 'user_module', 'user_groups');
            } else {
                $form_bits = array('user_password');
            }
            basicGet('fm_users', $id, 'user_', 'user_id');
        } elseif ($_POST['item_sub_type'] == 'groups') {
            if (currentUserCan('manage_users')) {
                $form_bits = array('group_name', 'comment', 'group_users', 'user_perms');
                basicGet('fm_groups', $id, 'group_', 'group_id');
            } else {
                return returnUnAuth();
            }
        }
        $results = $fmdb->last_result;
        if (!$fmdb->num_rows) {
            returnError();
        }
        $edit_form_data[] = $results[0];
        $edit_form = $fm_users->printUsersForm($edit_form_data, 'edit', $form_bits, $_POST['item_sub_type']);
    }
    echo $edit_form;
} elseif (isset($_SESSION['module']) && $_SESSION['module'] != $fm_name) {
    $include_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $_SESSION['module'] . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'getData.php';
    if (file_exists($include_file)) {
开发者ID:Vringe,项目名称:facileManager,代码行数:31,代码来源:getData.php

示例12: getSkippedRecordIDs

 /**
  * Builds an array of skipped record IDs
  *
  * @since 1.2
  * @package facileManager
  * @subpackage fmDNS
  *
  * @param id $domain_id Domain ID to check
  * @return array
  */
 function getSkippedRecordIDs($domain_id)
 {
     global $fmdb, $__FM_CONFIG;
     $skipped_records = null;
     basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'records_skipped', $domain_id, 'record_', 'domain_id');
     if ($fmdb->num_rows) {
         $result = $fmdb->last_result;
         for ($i = 0; $i < $fmdb->num_rows; $i++) {
             $skipped_records[] = $result[$i]->record_id;
         }
     }
     return $skipped_records;
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:23,代码来源:class_records.php

示例13: currentUserCan

        $form_bits = currentUserCan('manage_users') ? array('user_login', 'user_email', 'user_auth_method', 'user_password', 'user_options', 'user_perms', 'user_module') : array('user_password');
        $form_data = null;
        if ($id) {
            basicGet('fm_users', $id, 'user_', 'user_id');
            $results = $fmdb->last_result;
            if (!$fmdb->num_rows) {
                returnError();
            }
            $form_data[] = $results[0];
            $form_data[0]->user_login = null;
            $form_data[0]->user_template_only = false;
        }
        $edit_form = $fm_users->printUsersForm($form_data, 'add', $form_bits);
    } else {
        $form_bits = currentUserCan('manage_users') ? array('user_login', 'user_email', 'user_options', 'user_perms', 'user_module') : array('user_password');
        basicGet('fm_users', $id, 'user_', 'user_id');
        $results = $fmdb->last_result;
        if (!$fmdb->num_rows) {
            returnError();
        }
        $edit_form_data[] = $results[0];
        if (currentUserCan('manage_users') && $edit_form_data[0]->user_auth_type == 2) {
            $form_bits = array('user_login', 'user_email', 'user_perms', 'user_module');
        }
        $edit_form = $fm_users->printUsersForm($edit_form_data, 'edit', $form_bits);
    }
    echo $edit_form;
} elseif (isset($_SESSION['module']) && $_SESSION['module'] != $fm_name) {
    $include_file = ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . $_SESSION['module'] . DIRECTORY_SEPARATOR . 'ajax' . DIRECTORY_SEPARATOR . 'getData.php';
    if (file_exists($include_file)) {
        include $include_file;
开发者ID:pclemot,项目名称:facileManager,代码行数:31,代码来源:getData.php

示例14: update

 /**
  * Updates the selected key
  */
 function update($post)
 {
     global $fmdb, $__FM_CONFIG;
     if (empty($post['key_name']) || empty($post['key_secret'])) {
         return __('No key defined.');
     }
     $post['key_comment'] = trim($post['key_comment']);
     /** Check name field length */
     $field_length = getColumnLength('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'keys', 'key_name');
     if ($field_length !== false && strlen($post['key_name']) > $field_length) {
         return sprintf(dngettext($_SESSION['module'], 'Key name is too long (maximum %d character).', 'Key name is too long (maximum %d characters).', $field_length), $field_length);
     }
     /** Does the key already exist for this account? */
     basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'keys', sanitize($post['key_name']), 'key_', 'key_name');
     if ($fmdb->num_rows) {
         $result = $fmdb->last_result;
         if ($result[0]->key_id != $post['key_id']) {
             return __('This key already exists.');
         }
     }
     $exclude = array('submit', 'action', 'key_id');
     $sql_edit = null;
     foreach ($post as $key => $data) {
         if (!in_array($key, $exclude)) {
             $sql_edit .= $key . "='" . sanitize($data) . "',";
         }
     }
     $sql = rtrim($sql_edit, ',');
     // Update the key
     $old_name = getNameFromID($post['key_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'keys', 'key_', 'key_id', 'key_name');
     $query = "UPDATE `fm_{$__FM_CONFIG['fmDNS']['prefix']}keys` SET {$sql} WHERE `key_id`={$post['key_id']} AND `account_id`='{$_SESSION['user']['account_id']}'";
     $result = $fmdb->query($query);
     if (!$fmdb->result) {
         return __('Could not update the key because a database error occurred.');
     }
     /** Return if there are no changes */
     if (!$fmdb->rows_affected) {
         return true;
     }
     $view_name = $post['key_view'] ? getNameFromID($post['key_view'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'views', 'view_', 'view_id', 'view_name') : 'All Views';
     addLogEntry("Updated key '{$old_name}' to the following:\nName: {$post['key_name']}\nAlgorithm: {$post['key_algorithm']}\nSecret: {$post['key_secret']}\nView: {$view_name}\nComment: {$post['key_comment']}");
     return true;
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:46,代码来源:class_keys.php

示例15: update

 /**
  * Updates the selected acl
  */
 function update($post)
 {
     global $fmdb, $__FM_CONFIG;
     /** Check name field length */
     $field_length = getColumnLength('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'acls', 'acl_name');
     if ($field_length !== false && strlen($post['acl_name']) > $field_length) {
         return sprintf(dngettext($_SESSION['module'], 'ACL name is too long (maximum %d character).', 'ACL name is too long (maximum %d characters).', $field_length), $field_length);
     }
     /** Does the record already exist for this account? */
     basicGet('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'acls', sanitize($post['acl_name']), 'acl_', 'acl_name');
     if ($fmdb->num_rows) {
         $result = $fmdb->last_result;
         if ($result[0]->acl_id != $post['acl_id']) {
             return __('This ACL already exists.');
         }
     }
     if (empty($post['acl_name'])) {
         return __('No ACL name defined.');
     }
     /** Cleans up acl_addresses for future parsing **/
     $post['acl_addresses'] = verifyAndCleanAddresses($post['acl_addresses']);
     if (strpos($post['acl_addresses'], 'not valid') !== false) {
         return $post['acl_addresses'];
     }
     if ($post['acl_predefined'] != 'as defined:') {
         $post['acl_addresses'] = null;
     }
     $post['acl_comment'] = trim($post['acl_comment']);
     $post['account_id'] = $_SESSION['user']['account_id'];
     $exclude = array('submit', 'action', 'server_id');
     $sql_edit = null;
     foreach ($post as $key => $data) {
         if (!in_array($key, $exclude)) {
             $sql_edit .= $key . "='" . sanitize($data) . "',";
         }
     }
     $sql = rtrim($sql_edit, ',');
     // Update the acl
     $old_name = getNameFromID($post['acl_id'], 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'acls', 'acl_', 'acl_id', 'acl_name');
     $query = "UPDATE `fm_{$__FM_CONFIG['fmDNS']['prefix']}acls` SET {$sql} WHERE `acl_id`={$post['acl_id']}";
     $result = $fmdb->query($query);
     if (!$fmdb->result) {
         return __('Could not update the ACL because a database error occurred.');
     }
     /** Return if there are no changes */
     if (!$fmdb->rows_affected) {
         return true;
     }
     $acl_addresses = $post['acl_predefined'] == 'as defined:' ? $post['acl_addresses'] : $post['acl_predefined'];
     addLogEntry("Updated ACL '{$old_name}' to the following:\nName: {$post['acl_name']}\nAddresses: {$acl_addresses}\nComment: {$post['acl_comment']}");
     return true;
 }
开发者ID:pclemot,项目名称:facileManager,代码行数:55,代码来源:class_acls.php


注:本文中的basicGet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。