$name) {
$next = max($next,$j);
}
$next = $next +1;
//
foreach($amain as $j=>$setting) {
if (is_array($setting)) { echo '
copying '.$j.' from list '.$source;
if (!empty($amain[$j][$source]) )
$amain[$j][$next] = $amain[$j][$source];
}
}
$amain['names'][$next] .= __(' - copy','amr-users');
$amain['no-lists'] = count($amain['names']);
if (!empty($aopt['list'][$source]) ) {
echo '
copying settings from list '.$source;
$aopt['list'][$next] = $aopt['list'][$source];
}
ausers_update_option ('amr-users-main', $amain);
ausers_update_option ('amr-users', $aopt);
}
elseif (isset($_GET['deletelist'])) {
$source = (int) $_REQUEST['deletelist'];
if (!isset($amain['names'][$source]))
amr_users_message ( sprintf(__('Error deleting list %S','amr-users'),$source));
else {
foreach($amain as $j=>$setting) {
if (is_array($setting)) {
//if (WP_DEBUG) echo '
deleting '.$j.' from list '.$source;
if (isset($amain[$j][$source]) )
unset ($amain[$j][$source]);
}
}
}
$amain['no-lists'] = count($amain['names']);
if (!empty($aopt['list'][$source]) ) {
unset($aopt['list'][$source]);
}
$acache = new adb_cache();
$acache->clear_cache ($acache->reportid($source) );
ausers_update_option ('amr-users-main', $amain);
ausers_update_option ('amr-users', $aopt);
amr_users_message(__('List and the cache deleted.','amr-users'));
}
}
function amrmeta_validate_overview() {
global $amain;
global $aopt;
if (isset($_REQUEST['addnew'])) {
if ((count ($amain['names'])) < 1)
$amain['names'][1] = __('New list','amr-users');
else
$amain['names'][] = __('New list','amr-users');
$amain['no-lists'] = count ($amain['names']);
}
if (isset($_POST['name'])) {
$return = amrmeta_validate_names();
if ( is_wp_error($return) ) echo $return->get_error_message();
}
if (isset($_POST['checkedpublic'])) { /* admin has seen the message and navigated to the settings screen and saved */
$amain['checkedpublic'] = true;
}
// unset($amain['public']);
// unset($amain['sortable']);
// unset($amain['customnav']);
//
if (isset($_POST['list_avatar_size'])) {
if (is_array($_POST['list_avatar_size'])) {
foreach ($_POST['list_avatar_size'] as $i=>$value)
$amain['list_avatar_size'][$i] = ( int) $value;
}
}
if (isset($_POST['list_rows_per_page'])) {
if (is_array($_POST['list_rows_per_page'])) {
foreach ($_POST['list_rows_per_page'] as $i=>$value)
$amain['list_rows_per_page'][$i] = ( int) $value;
}
}
if (isset($_POST['html_type'])) {
if (is_array($_POST['html_type'])) {
foreach ($_POST['html_type'] as $i=>$value) {
if (in_array( $value, array('table','simple'))) {
$amain['html_type'][$i] = $value;
}
}
}
}
if (isset($_POST['filter_html_type'])) {
if (is_array($_POST['filter_html_type'])) {
foreach ($_POST['filter_html_type'] as $i=>$value) {
if (in_array( $value, array('intableheader','above','none'))) {
$amain['filter_html_type'][$i] = $value;
}
}
}
}
//
$addon_settings = apply_filters('amr-users-addon-settings', array()); //20150820
if (!empty($addon_settings)) { //20150820
foreach ($addon_settings as $setting) {
foreach ($amain['names'] as $i=>$n) {
$amain[$setting['name']][$i] = false;
}
//if ((!isset($_REQUEST['ulist'])) or ($_REQUEST['ulist'] == $i)) { // in case we are only doing 1 list - insingle view // do we need this ??
// $amain[$setting['name']][$i] = $setting['default'];
//}
}
}
foreach ($amain['names'] as $i=>$n) { // clear booleans in case not set
if ((!isset($_REQUEST['ulist'])) or ($_REQUEST['ulist'] == $i)) { // in case we are only doing 1 list - insingle view
$amain['show_search'][$i] = false;
$amain['show_perpage'][$i] = false;
$amain['show_pagination'][$i] = false;
$amain['show_headings'][$i] = false;
$amain['show_csv'][$i] = false;
$amain['show_refresh'][$i] = false;
$amain['public'][$i] = false;
$amain['customnav'][$i] = false;
$amain['sortable'][$i] = false;
}
}
if (isset($_POST['sortable'])) {
if (is_array($_POST['sortable'])) {
foreach ($_POST['sortable'] as $i=>$y)
$amain['sortable'][$i] = true;
}
}
if (isset($_POST['public'])) {
if (is_array($_POST['public'])) {
foreach ($_POST['public'] as $i=>$y)
$amain['public'][$i] = true;
}
}
amr_users_clear_all_public_csv ($amain['public']);
amr_users_message(__('Csv lists privacy check done. Any no longer public lists deleted. ','amr-users'));
if (!empty($addon_settings)) { //20150820
foreach ($addon_settings as $setting) {
if (isset($_POST[$setting['name']])) { // else all unticked
foreach ($_POST[$setting['name']] as $i=>$y)
$amain[$setting['name']][$i] =true;
}
else $amain[$setting['name']] = array();
}
}
if (isset($_POST['show_search'])) {
if (is_array($_POST['show_search'])) {
foreach ($_POST['show_search'] as $i=>$y)
$amain['show_search'][$i] = true;
}
}
if (isset($_POST['customnav'])) {
if (is_array($_POST['customnav'])) {
foreach ($_POST['customnav'] as $i=>$y)
$amain['customnav'][$i] = true;
}
}
if (isset($_POST['show_perpage'])) {
if (is_array($_REQUEST['show_perpage'])) {
foreach ($_REQUEST['show_perpage'] as $i=>$y)
$amain['show_perpage'][$i] = true;
}
}
if (isset($_POST['show_pagination'])) {
if (is_array($_REQUEST['show_pagination'])) {
foreach ($_REQUEST['show_pagination'] as $i=>$y)
$amain['show_pagination'][$i] = true;
}
}
if (isset($_POST['show_headings'])) {
if (is_array($_REQUEST['show_headings'])) {
foreach ($_REQUEST['show_headings'] as $i=>$y)
$amain['show_headings'][$i] = true;
}
}
if (isset($_POST['show_csv'])) {
if (is_array($_REQUEST['show_csv'])) {
foreach ($_REQUEST['show_csv'] as $i=>$y)
$amain['show_csv'][$i] = true;
}
}
if (isset($_POST['show_refresh'])) {
if (is_array($_REQUEST['show_refresh'])) {
foreach ($_REQUEST['show_refresh'] as $i=>$y)
$amain['show_refresh'][$i] = true;
}
}
$amain['version'] = AUSERS_VERSION;
if (isset($_POST)) {
ausers_update_option ('amr-users-main', $amain);
//ausers_update_option ('amr-users', $aopt);
}
amr_users_message(__('Options Updated', 'amr-users'));
return;
}
function amr_echo_setting_html($setting_name, $i, $status, $available='') { // 20150820
//$i=list number, status is input field status
echo '
| [userlist list='.$i.'] | '; } echo '
'; echo au_copy_link(__('Copy','amr-users'),$i,$amain['names'][$i]); echo ' | '.au_delete_link(__('Delete','amr-users'),$i,$amain['names'][$i]) .' |'.au_view_link(' '.__('View','amr-users'),$i,$amain['names'][$i]); if (!is_network_admin()) { echo ' | '.au_add_userlist_page(__('Add page','amr-users'), $i,$amain['names'][$i]); echo ' | ';
}
}
echo '
| '; } //------- public echo ' |
| '; echo ''; } echo ' | '; } //------- html type echo '
| '; if (empty($amain['html_type'][$i])) $amain['html_type'][$i] = 'table'; foreach (array('table','simple') as $type) { echo ''; _e($type); echo ' '; } echo ' | '; } //------- rows pp echo '
| '; } echo ' |
| ';
if (empty($amain['filter_html_type'][$i]))
$amain['filter_html_type'][$i] = 'none';
foreach (array(
'intableheader' => __('in table','amr-users'),
'above' => __('above','amr-users'),
'none' => __('none','amr-users')) as $val => $type) {
echo '';
echo $type;
echo ' '; } echo ' | ';
}
//
echo '