!! '.__('This site does not allow filetype .txt to be uploaded.','amr-ical-events-list'). ' ' .__('Please contact your wordpress administrator to request that it be added.','amr-ical-events-list').' ' .__('Alternatively, change the file suffix to an allowed type eg: .odt in order to upload it.','amr-ical-events-list').'
'; } echo ''.__('Imported settings must be from a compatible system.','amr-ical-events-list'); echo ' '.__('Ensure any fields used by the list are in your database and have been "found".','amr-ical-events-list').'
'; echo ''; if (WP_DEBUG and !$filetypeok) { echo '
'; foreach ($mimes as $type => $mime) { echo $type.', '; } echo '
'; } } function amr_ical_list_export_form () { global $amain; global $aopt; global $ausersadminurl; if (isset ($amain['names'])) { echo PHP_EOL.'".PHP_EOL; echo '
'; } } function amr_ical_main_to_export () { // define the list of overview settings to export return array( // we have a historically weird structure so we have to do it this way until we risk updating 'sortable', 'names', 'html_type', 'public' , 'list_avatar_size', 'list_rows_per_page', 'show_search', 'show_perpage', 'show_pagination', 'show_headings', 'show_csv', 'filterable', 'show_refresh', 'customnav' ); } function amr_ical_build_export($list) { global $amain, $aopt; if (empty ($aopt)) $aopt = ausers_get_option('amr-ical-events-list'); $data = array(); $data ['version'] = $amain['version']; // $toexport = amr_main_to_export (); foreach ($toexport as $text) { if (isset($amain[$text][$list])) $data[$text] = $amain[$text][$list]; } if (isset ($aopt['list'])) $data['list'] = $aopt['list'][$list]; $content = serialize($data); return($content); } function amr_ical_handle_export() { if ( isset( $_POST['export-list'] ) and isset( $_POST['export-list-text'] ) ) { check_admin_referer('amr-meta','amr-meta'); $filename = sanitize_title(get_bloginfo('name'))."-amr-users-list.txt"; if (amr_is_network_admin()) $filename = 'network-'.$filename; $content = htmlspecialchars_decode($_POST['export-list-text']); header("Content-Description: File Transfer"); header("Content-type: application/txt"); header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Pragma: no-cache"); header("Expires: 0"); echo $content; die(); } } function amr_ical_handle_import() { global $amain, $aopt; if ( isset( $_POST['import-list'] ) ) { // require_once(ABSPATH . 'wp-admin/includes/admin.php'); if (empty($_FILES) ) { amr_users_message('No file specified','amr-ical-events-list'); return; } if (empty($_FILES['importfile'])) { amr_users_message('Problem in upload','amr-ical-events-list'); return; } $file = $_FILES['importfile']; $uploaded = wp_handle_upload($file, array('test_form' => FALSE)); if ( is_wp_error($uploaded) ) { $errors['upload_error'] = $uploaded['error']; } if (!empty($errors)) { amr_users_message('There was an error uploading your file.','amr-ical-events-list'); return; } if (empty($uploaded['file'])) { amr_users_message('There was an error uploading your file.','amr-ical-events-list'); // could be file mime type is not allowed 20160207 return; } $content = file_get_contents($uploaded['file']); $data = unserialize(stripslashes($content)); //$data = unserialize($content); if ((!is_array($data)) or (!isset($data['version']) )) { echo ''; _e('Invalid data in settings file','amr-ical-events-list'); echo '