mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Options Management Administration Panel.
mp-wp_genesis 4 *
mp-wp_genesis 5 * Just allows for displaying of options.
mp-wp_genesis 6 *
mp-wp_genesis 7 * This isn't referenced or linked to, but will show all of the options and
mp-wp_genesis 8 * allow editing. The issue is that serialized data is not supported to be
mp-wp_genesis 9 * modified. Options can not be removed.
mp-wp_genesis 10 *
mp-wp_genesis 11 * @package WordPress
mp-wp_genesis 12 * @subpackage Administration
mp-wp_genesis 13 */
mp-wp_genesis 14
mp-wp_genesis 15 /** WordPress Administration Bootstrap */
mp-wp_genesis 16 require_once('admin.php');
mp-wp_genesis 17
mp-wp_genesis 18 $title = __('Settings');
mp-wp_genesis 19 $this_file = 'options.php';
mp-wp_genesis 20 $parent_file = 'options-general.php';
mp-wp_genesis 21
mp-wp_genesis 22 wp_reset_vars(array('action'));
mp-wp_genesis 23
mp-wp_genesis 24 $whitelist_options = array(
mp-wp_genesis 25 'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ),
mp-wp_genesis 26 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
mp-wp_genesis 27 'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
mp-wp_genesis 28 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
mp-wp_genesis 29 'privacy' => array( 'blog_public' ),
mp-wp_genesis 30 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
mp-wp_genesis 31 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
mp-wp_genesis 32 'options' => array( '' ) );
mp-wp_genesis 33 if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl';
mp-wp_genesis 34 if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home';
mp-wp_genesis 35
mp-wp_genesis 36 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
mp-wp_genesis 37
mp-wp_genesis 38 if ( !current_user_can('manage_options') )
mp-wp_genesis 39 wp_die(__('Cheatin’ uh?'));
mp-wp_genesis 40
mp-wp_genesis 41 switch($action) {
mp-wp_genesis 42
mp-wp_genesis 43 case 'update':
mp-wp_genesis 44 if ( isset($_POST[ 'option_page' ]) ) {
mp-wp_genesis 45 $option_page = $_POST[ 'option_page' ];
mp-wp_genesis 46 check_admin_referer( $option_page . '-options' );
mp-wp_genesis 47 } else {
mp-wp_genesis 48 // This is for back compat and will eventually be removed.
mp-wp_genesis 49 $option_page = 'options';
mp-wp_genesis 50 check_admin_referer( 'update-options' );
mp-wp_genesis 51 }
mp-wp_genesis 52
mp-wp_genesis 53 if ( !isset( $whitelist_options[ $option_page ] ) )
mp-wp_genesis 54 wp_die( __( 'Error! Options page not found.' ) );
mp-wp_genesis 55
mp-wp_genesis 56 if ( 'options' == $option_page ) {
mp-wp_genesis 57 $options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
mp-wp_genesis 58 } else {
mp-wp_genesis 59 $options = $whitelist_options[ $option_page ];
mp-wp_genesis 60 }
mp-wp_genesis 61
mp-wp_genesis 62 // Handle custom date/time formats
mp-wp_genesis 63 if ( 'general' == $option_page ) {
mp-wp_genesis 64 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
mp-wp_genesis 65 $_POST['date_format'] = $_POST['date_format_custom'];
mp-wp_genesis 66 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
mp-wp_genesis 67 $_POST['time_format'] = $_POST['time_format_custom'];
mp-wp_genesis 68 }
mp-wp_genesis 69
mp-wp_genesis 70 if ( $options ) {
mp-wp_genesis 71 foreach ( $options as $option ) {
mp-wp_genesis 72 $option = trim($option);
mp-wp_genesis 73 $value = null;
mp-wp_genesis 74 if ( isset($_POST[$option]) )
mp-wp_genesis 75 $value = $_POST[$option];
mp-wp_genesis 76 if ( !is_array($value) ) $value = trim($value);
mp-wp_genesis 77 $value = stripslashes_deep($value);
mp-wp_genesis 78 update_option($option, $value);
mp-wp_genesis 79 }
mp-wp_genesis 80 }
mp-wp_genesis 81
mp-wp_genesis 82 $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
mp-wp_genesis 83 wp_redirect( $goback );
mp-wp_genesis 84 break;
mp-wp_genesis 85
mp-wp_genesis 86 default:
mp-wp_genesis 87 include('admin-header.php'); ?>
mp-wp_genesis 88
mp-wp_genesis 89 <div class="wrap">
mp-wp_genesis 90 <?php screen_icon(); ?>
mp-wp_genesis 91 <h2><?php _e('All Settings'); ?></h2>
mp-wp_genesis 92 <form name="form" action="options.php" method="post" id="all-options">
mp-wp_genesis 93 <?php wp_nonce_field('options-options') ?>
mp-wp_genesis 94 <input type="hidden" name="action" value="update" />
mp-wp_genesis 95 <input type='hidden' name='option_page' value='options' />
mp-wp_genesis 96 <table class="form-table">
mp-wp_genesis 97 <?php
mp-wp_genesis 98 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
mp-wp_genesis 99
mp-wp_genesis 100 foreach ( (array) $options as $option) :
mp-wp_genesis 101 $disabled = '';
mp-wp_genesis 102 $option->option_name = attribute_escape($option->option_name);
mp-wp_genesis 103 if ( is_serialized($option->option_value) ) {
mp-wp_genesis 104 if ( is_serialized_string($option->option_value) ) {
mp-wp_genesis 105 // this is a serialized string, so we should display it
mp-wp_genesis 106 $value = maybe_unserialize($option->option_value);
mp-wp_genesis 107 $options_to_update[] = $option->option_name;
mp-wp_genesis 108 $class = 'all-options';
mp-wp_genesis 109 } else {
mp-wp_genesis 110 $value = 'SERIALIZED DATA';
mp-wp_genesis 111 $disabled = ' disabled="disabled"';
mp-wp_genesis 112 $class = 'all-options disabled';
mp-wp_genesis 113 }
mp-wp_genesis 114 } else {
mp-wp_genesis 115 $value = $option->option_value;
mp-wp_genesis 116 $options_to_update[] = $option->option_name;
mp-wp_genesis 117 $class = 'all-options';
mp-wp_genesis 118 }
mp-wp_genesis 119 echo "
mp-wp_genesis 120 <tr>
mp-wp_genesis 121 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
mp-wp_genesis 122 <td>";
mp-wp_genesis 123
mp-wp_genesis 124 if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
mp-wp_genesis 125 else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />";
mp-wp_genesis 126
mp-wp_genesis 127 echo "</td>
mp-wp_genesis 128 </tr>";
mp-wp_genesis 129 endforeach;
mp-wp_genesis 130 ?>
mp-wp_genesis 131 </table>
mp-wp_genesis 132 <?php $options_to_update = implode(',', $options_to_update); ?>
mp-wp_genesis 133 <p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p>
mp-wp_genesis 134 </form>
mp-wp_genesis 135 </div>
mp-wp_genesis 136
mp-wp_genesis 137
mp-wp_genesis 138 <?php
mp-wp_genesis 139 break;
mp-wp_genesis 140 } // end switch
mp-wp_genesis 141
mp-wp_genesis 142 include('admin-footer.php');
mp-wp_genesis 143 ?>