function amr_meta_overview_page()
{
    /* the main setting spage  - num of lists and names of lists */
    global $amain;
    global $aopt;
    if (empty($amain)) {
        $amain = ausers_get_option('amr-users-main');
    }
    //amr_meta_main_admin_header('Overview of configured user lists'.' '.AUSERS_VERSION);
    amr_meta_admin_headings($plugin_page = '');
    // does the nonce check etc
    if (isset($_POST['import-list'])) {
        amr_meta_handle_import();
    } elseif (isset($_POST['action']) and $_POST['action'] == "save") {
        if (!empty($_POST['reset'])) {
            amr_meta_reset();
            return;
        } elseif (isset($_POST['export-list'])) {
            amr_meta_handle_export();
        } else {
            amrmeta_validate_overview();
        }
    } else {
        amr_handle_copy_delete();
    }
    if (!ameta_cache_enable() or !ameta_cachelogging_enable()) {
        echo '<h2>' . __('Problem creating DB tables', 'amr-users') . '</h2>';
    }
    if (!isset($amain['checkedpublic'])) {
        echo '<input type="hidden" name="checkedpublic" value="true"/>';
    }
    echo '<h2>' . __('Overview &amp; tools', 'amr-users') . '</h2>';
    echo PHP_EOL . '<div class="wrap"><!-- one wrap -->' . PHP_EOL;
    if (!isset($amain['names'])) {
        echo '<h2>' . __('There is a problem - Some overview list settings got lost somehow.  Try reset options.', 'amr-users') . '</h2>';
    } else {
        amr_meta_overview_onelist_headings();
        amr_meta_overview_onelist_headings_middle();
        foreach ($amain['names'] as $i => $name) {
            //for ($i = 1; $i <= $amain['no-lists']; $i++)	{
            amr_meta_overview_onelist_settings($i);
            echo '</tr>';
        }
        amr_meta_overview_onelist_headings_end();
    }
    echo '</div><!-- end of one wrap --> <br />' . PHP_EOL;
    //echo '<div style="clear: both; float:right; padding-right:100px;" class="submit">';
    echo ausers_submit();
    echo '<input class="button-primary" type="submit" name="addnew" value="' . __('Add new', 'amr-users') . '" />';
    amr_list_export_form();
    echo ausers_form_end();
    amr_list_import_form();
    // different form
}
function amrmeta_configure_page()
{
    global $aopt;
    global $amr_nicenames;
    global $pluginpage;
    global $amain;
    ameta_options();
    // should handle emptiness etc
    if (isset($_POST['addnew']) and isset($_POST['copylist'])) {
        $copyfrom = intval($_REQUEST['copylist']);
        $amain['names'][] = __('New list copy of ') . $amain['names'][$copyfrom];
        $aopt['list'][] = $aopt['list'][$copyfrom];
        $ulist = array_pop(array_keys($amain['names']));
        $amain['names'][$ulist] .= ' #' . $ulist;
        ausers_update_option('amr-users', $aopt);
        ausers_update_option('amr-users-main', $amain);
        amr_users_message('Added list: ' . $ulist);
        $_REQUEST['ulist'] = $ulist;
    } else {
        if (!empty($_REQUEST['ulist'])) {
            $ulist = (int) $_REQUEST['ulist'];
        } else {
            $ulist = '1';
        }
    }
    amr_meta_main_admin_header('Configure a user list');
    amr_meta_admin_headings($plugin_page = '');
    // does the nonce check  and formstartetc
    //	else
    if (isset($_REQUEST['rebuild'])) {
        /* can only do one list at a time in realtime */
        amr_rebuild_in_realtime_with_info($ulist);
        echo ausers_form_end();
        return;
    } elseif (!empty($_REQUEST['rebuildback'])) {
        /*  */
        amr_request_cache_with_feedback();
        echo ausers_form_end();
        return;
    } elseif (!empty($_REQUEST['rebuildwarning'])) {
        /*  */
        amr_rebuildwarning($ulist);
        echo ausers_form_end();
        return;
    } elseif (isset($_REQUEST['custom_navigation'])) {
        if (function_exists('amrmeta_custom_navigation_page')) {
            amrmeta_custom_navigation_page($ulist);
            echo ausers_form_end();
            return;
        } else {
            echo 'Function not active';
        }
    } elseif (isset($_REQUEST['grouping'])) {
        if (function_exists('amr_grouping_admin_form')) {
            amr_grouping_admin_form($ulist);
            echo ausers_form_end();
            return;
        } else {
            _e('Grouping Function not active', 'amr-users');
        }
    } elseif (amr_users_can_edit('filtering')) {
        amrmeta_filtering_page($ulist);
    } elseif (isset($_POST['action']) and $_POST['action'] == "save") {
        if (isset($_POST['updateoverview'])) {
            amrmeta_validate_overview();
        } elseif (isset($_POST['update'])) {
            if (!amrmeta_validate_listfields($ulist)) {
                amr_users_message(__('List Fields Validation failed', 'amr-users'));
            }
        } elseif (isset($_POST['configure'])) {
            // ulist already set above, so will just configure
        }
    }
    list_configurable_lists();
    // to allow selection of which to configure
    amrmeta_listfields($ulist);
    echo ausers_form_end();
}