| [ Root ] [ Search ] [ Index ] |
PHP Cross Reference of WordPress MU 2.9.2Provided by Yoast |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Options Management Administration Panel. 4 * 5 * Just allows for displaying of options. 6 * 7 * This isn't referenced or linked to, but will show all of the options and 8 * allow editing. The issue is that serialized data is not supported to be 9 * modified. Options can not be removed. 10 * 11 * @package WordPress 12 * @subpackage Administration 13 */ 14 15 /** WordPress Administration Bootstrap */ 16 require_once ('admin.php'); 17 18 $title = __('Settings'); 19 $this_file = 'options.php'; 20 $parent_file = 'options-general.php'; 21 22 wp_reset_vars(array('action')); 23 24 $whitelist_options = array( 25 'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ), 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' ), 27 'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 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', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), 29 'privacy' => array( 'blog_public' ), 30 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 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' ), 32 'options' => array( '' ) ); 33 if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; 34 if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; 35 36 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); 37 38 if ( !current_user_can('manage_options') ) 39 wp_die(__('Cheatin’ uh?')); 40 41 if( $_GET[ 'adminhash' ] ) { 42 $new_admin_details = get_option( 'adminhash' ); 43 if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) { 44 update_option( "admin_email", $new_admin_details[ 'newemail' ] ); 45 delete_option( "adminhash" ); 46 delete_option( "new_admin_email" ); 47 wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=true" ); 48 exit; 49 } else { 50 wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=false" ); 51 exit; 52 } 53 } 54 55 switch($action) { 56 57 case 'update': 58 if ( isset($_POST[ 'option_page' ]) ) { 59 $option_page = $_POST[ 'option_page' ]; 60 check_admin_referer( $option_page . '-options' ); 61 } 62 63 if ( !isset( $whitelist_options[ $option_page ] ) ) 64 wp_die( __( 'Error! Options page not found.' ) ); 65 66 if ( 'options' == $option_page ) { 67 $options = explode(',', stripslashes( $_POST[ 'page_options' ] )); 68 if( false == is_site_admin() ) { 69 wp_die( __( 'Not allowed here' ) ); 70 } 71 } else { 72 $options = $whitelist_options[ $option_page ]; 73 } 74 75 // Handle custom date/time formats 76 if ( 'general' == $option_page ) { 77 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) ) 78 $_POST['date_format'] = $_POST['date_format_custom']; 79 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) 80 $_POST['time_format'] = $_POST['time_format_custom']; 81 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. 82 if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { 83 $_POST['gmt_offset'] = $_POST['timezone_string']; 84 $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); 85 $_POST['timezone_string'] = ''; 86 } 87 } 88 89 if ( $options ) { 90 foreach ( $options as $option ) { 91 $option = trim($option); 92 $value = null; 93 if ( isset($_POST[$option]) ) 94 $value = $_POST[$option]; 95 if ( !is_array($value) ) $value = trim($value); 96 $value = stripslashes_deep($value); 97 update_option($option, $value); 98 } 99 } 100 101 $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); 102 wp_redirect( $goback ); 103 break; 104 105 default: 106 if (!is_site_admin()) 107 wp_die( __( 'Not admin' ) ); 108 109 include ('admin-header.php'); ?> 110 111 <div class="wrap"> 112 <?php screen_icon(); ?> 113 <h2><?php _e('All Settings'); ?></h2> 114 <form name="form" action="options.php" method="post" id="all-options"> 115 <?php wp_nonce_field('options-options') ?> 116 <input type="hidden" name="action" value="update" /> 117 <input type='hidden' name='option_page' value='options' /> 118 <p class="submit submit-top"> 119 <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" class="button-primary" /> 120 </p> 121 <table class="form-table"> 122 <?php 123 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); 124 125 foreach ( (array) $options as $option) : 126 $disabled = ''; 127 $option->option_name = esc_attr($option->option_name); 128 if( $option->option_name == '' ) 129 continue; 130 if ( is_serialized($option->option_value) ) { 131 if ( is_serialized_string($option->option_value) ) { 132 // this is a serialized string, so we should display it 133 $value = maybe_unserialize($option->option_value); 134 $options_to_update[] = $option->option_name; 135 $class = 'all-options'; 136 } else { 137 $value = 'SERIALIZED DATA'; 138 $disabled = ' disabled="disabled"'; 139 $class = 'all-options disabled'; 140 } 141 } else { 142 $value = $option->option_value; 143 $options_to_update[] = $option->option_name; 144 $class = 'all-options'; 145 } 146 echo " 147 <tr> 148 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th> 149 <td>"; 150 151 if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . esc_html($value) . "</textarea>"; 152 else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . esc_attr($value) . "'$disabled />"; 153 154 echo "</td> 155 </tr>"; 156 endforeach; 157 ?> 158 </table> 159 <?php $options_to_update = implode(',', $options_to_update); ?> 160 <p class="submit"><input type="hidden" name="page_options" value="<?php echo esc_attr($options_to_update); ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p> 161 </form> 162 </div> 163 164 165 <?php 166 include ('admin-footer.php'); 167 break; 168 } // end switch 169 170 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon May 3 12:25:32 2010 | Cross-referenced by PHPXref 0.7 |