function prepare_items()
 {
     global $status, $themes, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     $themes = array('all' => apply_filters('all_themes', get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array());
     $site_allowed_themes = get_site_allowed_themes();
     if (!$this->is_site_themes) {
         $allowed_themes = $site_allowed_themes;
         $themes_per_page = $this->get_items_per_page('themes_network_per_page');
     } else {
         $allowed_themes = wpmu_get_blog_allowedthemes($this->site_id);
         $themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
     }
     $current = get_site_transient('update_themes');
     foreach ((array) $themes['all'] as $key => $theme) {
         $theme_key = $theme['Stylesheet'];
         if (isset($allowed_themes[$theme_key])) {
             $themes['all'][$key]['enabled'] = true;
             $themes['enabled'][$key] = $themes['all'][$key];
         } else {
             $themes['all'][$key]['enabled'] = false;
             $themes['disabled'][$key] = $themes['all'][$key];
         }
         if (isset($current->response[$theme['Template']])) {
             $themes['upgrade'][$key] = $themes['all'][$key];
         }
         if ($this->is_site_themes && isset($site_allowed_themes[$theme_key])) {
             unset($themes['all'][$key]);
             unset($themes['enabled'][$key]);
             unset($themes['disabled'][$key]);
         }
     }
     if (!current_user_can('update_themes') || $this->is_site_themes) {
         $themes['upgrade'] = array();
     }
     if ($s) {
         $status = 'search';
         $themes['search'] = array_filter($themes['all'], array(&$this, '_search_callback'));
     }
     $totals = array();
     foreach ($themes as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = $themes[$status];
     $total_this_page = $totals[$status];
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         uasort($this->items, array(&$this, '_order_callback'));
     }
     $start = ($page - 1) * $themes_per_page;
     if ($total_this_page > $themes_per_page) {
         $this->items = array_slice($this->items, $start, $themes_per_page);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
 }
Beispiel #2
0
<?php

require_once 'admin.php';
$themes = get_themes();
$ct = current_theme_info();
$allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes());
if ($allowed_themes == false) {
    $allowed_themes = array();
}
$blog_allowed_themes = wpmu_get_blog_allowedthemes();
if (is_array($blog_allowed_themes)) {
    $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
}
if ($blog_id != 1) {
    unset($allowed_themes["h3"]);
}
if (isset($allowed_themes[wp_specialchars($ct->stylesheet)]) == false) {
    $allowed_themes[wp_specialchars($ct->stylesheet)] = true;
}
reset($themes);
foreach ($themes as $key => $theme) {
    if (isset($allowed_themes[wp_specialchars($theme['Stylesheet'])]) == false) {
        unset($themes[$key]);
    }
}
reset($themes);
if (isset($_GET['action'])) {
    check_admin_referer('switch-theme_' . $_GET['template']);
    if ('activate' == $_GET['action']) {
        switch_theme($_GET['template'], $_GET['stylesheet']);
        wp_redirect('themes.php?activated=true');
/**
 * Get the allowed themes for the current blog.
 *
 * @since 3.0.0
 *
 * @uses get_themes()
 * @uses current_theme_info()
 * @uses get_site_allowed_themes()
 * @uses wpmu_get_blog_allowedthemes
 *
 * @return array $themes Array of allowed themes.
 */
function get_allowed_themes()
{
    if (!is_multisite()) {
        return get_themes();
    }
    $themes = get_themes();
    $ct = current_theme_info();
    $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes());
    if ($allowed_themes == false) {
        $allowed_themes = array();
    }
    $blog_allowed_themes = wpmu_get_blog_allowedthemes();
    if (is_array($blog_allowed_themes)) {
        $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
    }
    if (isset($allowed_themes[esc_html($ct->stylesheet)]) == false) {
        $allowed_themes[esc_html($ct->stylesheet)] = true;
    }
    reset($themes);
    foreach ($themes as $key => $theme) {
        if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) == false) {
            unset($themes[$key]);
        }
    }
    reset($themes);
    return $themes;
}
	 function cets_blog_defaults_management_page(){
	 	// Display the defaults that can be set by site admins
	 
	 	global $wpdb;
		
		// only allow site admins to come here.
		if( is_super_admin() == false ) {
			wp_die( __('You do not have permission to access this page.') );
		}
		
		/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
		$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
		
		
		// process form submission    	
    	if (isset($_POST['action']) && $_POST['action'] == 'update') {
			$this->update_defaults($_POST);
			$updated = true;
    	}
		
		// make sure we're using latest data
		$opt = get_site_option('cets_blog_defaults_options');
		
    	if (isset($updated) && $updated) { ?>
        <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
        <?php	} ?>
        
        <h1>New Blog Defaults</h1>
        <form name="blogdefaultsform" action="" method="post">
        <p>Set the defaults for new blog creation. Note that these defaults can still be over-ridden by blog owners.</p>
        <div class="wrap">
        <h2><?php _e('General Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Title') ?></th>
        <td><input name="blogname" type="text" id="blogname" value="<?php echo($opt['blogname']); ?>" size="40" /><br/>
        <input type="checkbox" name="blogname_flag" value="1" <?php checked('1', $opt[blogname_flag]) ?> /> <?php _e("I understand this will overwrite the user's chosen blog name from the setup page.") ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Tagline') ?></th>
        <td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php echo($opt['blogdescription']); ?>" size="45" />
        <br />
        <?php _e('In a few words, explain what this blog is about.') ?></td>
        </tr>
		
<!-- Begin Time Zone -->
		<tr>
		<?php
		$current_offset = $opt['gmt_offset'];
		$tzstring = $opt['timezone_string'];
		
		$check_zone_info = true;
		
		// Remove old Etc mappings.  Fallback to gmt_offset.
		if ( false !== strpos($tzstring,'Etc/GMT') )
			$tzstring = '';
		
		if (empty($tzstring)) { // set the Etc zone if no timezone string exists
			$check_zone_info = false;
			if ( 0 == $current_offset )
				$tzstring = 'UTC+0';
			elseif ($current_offset < 0)
				$tzstring = 'UTC' . $current_offset;
			else
				$tzstring = 'UTC+' . $current_offset;
		}
		
		?>
		<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
		<td>
		
		<select id="timezone_string" name="timezone_string">
		<?php echo wp_timezone_choice($tzstring); ?>
		</select>
		
		    <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
		<?php if ($opt['timezone_string']) : ?>
			<span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
		<?php endif; ?>
		<br />
		<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
		<br />
		<span>
		<?php if ($check_zone_info && $tzstring) : ?>
			<?php
			$now = localtime(time(),true);
			if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
			else _e('This timezone is currently in standard time.');
			?>
			<br />
			<?php
			
			if (function_exists('timezone_transitions_get')) {
				$dateTimeZoneSelected = new DateTimeZone($tzstring);
				foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
					if ($tr['ts'] > time()) {
					    $found = true;
						break;
					}
				}
		
				if ( isset($found) && $found === true ) {
					echo ' ';
					$message = $tr['isdst'] ?
						__('Daylight savings time begins on: <code>%s</code>.') :
						__('Standard time begins  on: <code>%s</code>.');
					printf( $message, date_i18n($opt['date_format'].' '. $opt['time_format'], $tr['ts'] ) );
				} else {
					_e('This timezone does not observe daylight savings time.');
				}
			}
			
			?>
			</span>
		<?php endif; ?>
		</td>
		
		
		</tr>

<!-- End Time Zone -->
	
	
	
		
        <tr>
        <th scope="row"><?php _e('Date Format') ?></th>
        <td>
			<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
<?php

	$date_formats = apply_filters( 'date_formats', array(
		__('F j, Y'),
		'Y/m/d',
		'm/d/Y',
		'd/m/Y',
	) );

	$custom = TRUE;

	foreach ( $date_formats as $format ) {
		echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
		if ( $opt['date_format'] === $format ) { // checked() uses "==" rather than "==="
			echo " checked='checked'";
			$custom = FALSE;
		}
		echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
	}

	echo '	<label><input type="radio" name="date_format" id="date_format_custom_radio" value="custom"';
	checked( $custom );
	echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( $opt['date_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['date_format'] ) . "\n";
	

	echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click &#8220;Save Changes&#8221; to update sample output.') . "</p>\n";
?>
	</fieldset>


		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Time Format') ?></th>
        <td>
		<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
		<?php
		 
			$time_formats = apply_filters( 'time_formats', array(
				__('g:i a'),
				'g:i A',
				'H:i',
			) );
		
			$custom = TRUE;
		
			foreach ( $time_formats as $format ) {
				echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
				if ( $opt['time_format'] === $format ) { // checked() uses "==" rather than "==="
					echo " checked='checked'";
					$custom = FALSE;
				}
				echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
			}
		
			echo '	<label><input type="radio" name="time_format" id="time_format_custom_radio" value="custom"';
			checked( $custom );
			echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( $opt['time_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['time_format'] ) . "\n";
		?>
			</fieldset>



		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Week Starts On') ?></th>
        <td>
        
        <select name="start_of_week" id="start_of_week">
        <?php
		global $wp_locale;
        for ($day_index = 0; $day_index <= 6; $day_index++) :
            $selected = ($opt['start_of_week'] == $day_index) ? 'selected="selected"' : '';
			
            echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
        endfor;
        ?>
        </select></td>
        </tr>
        </table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Writing Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"> <?php _e('Size of the post box') ?></th>
        <td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo($opt['default_post_edit_rows']); ?>" size="3" />
        <?php _e('lines') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Formatting') ?></th>
        <td>
        <label for="use_smilies">
        <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', $opt['use_smilies']); ?> />
        <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
        <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', $opt['use_balanceTags']); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
        </td>
        </tr>
        
        </table>
		
		<h3><?php _e('Remote Publishing') ?></h3>
		<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
		<table class="form-table">
		<tr valign="top">
		<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
		<label for="enable_app">
		<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', $opt['enable_app']); ?> />
		<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
		</fieldset></td>
		</tr>
		<tr valign="top">
		<th scope="row"><?php _e('XML-RPC') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
		<label for="enable_xmlrpc">
		<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', $opt['enable_xmlrpc']); ?> />
		<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
		</fieldset></td>
		</tr>
		</table>
      </div>
      
      <p>&nbsp;</p>
      <div class="wrap">
        <h2><?php _e('Reading Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog pages show at most') ?></th>
        <td>
        <input name="posts_per_page" type="text" id="posts_per_page" value="<?php echo($opt['posts_per_page']); ?>" size="3" /> <?php _e('posts') ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Syndication feeds show the most recent') ?></th>
        <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php echo($opt['posts_per_rss']); ?>" size="3" /> <?php _e('posts') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
        <td>
        <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, $opt['rss_use_excerpt']); ?>	/> <?php _e('Full text') ?></label><br />
        <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, $opt['rss_use_excerpt']); ?> /> <?php _e('Summary') ?></label></p>
        </td>
        </tr>
        
        <tr valign="top">
        <th scope="row"><?php _e('Encoding for pages and feeds') ?></th>
        <td><input name="blog_charset" type="text" id="blog_charset" value="<?php echo($opt['blog_charset']); ?>" size="20" class="code" /><br />
        <?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
        </tr>
        </table>
        
        </div>
        
        
        <p>&nbsp;</p>
        <div class="wrap">     
    	<h2>Discussion Settings</h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Default article settings') ?></th>
        <td>
         <label for="default_pingback_flag">
		 
       <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php  if ($opt['default_pingback_flag'] == 1) echo('checked="checked"'); ?> /> <?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?> </label>
       
        <br /> 
		<label for="default_ping_status">
		
        <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php if ($opt['default_ping_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
       
        <br />
        <label for="default_comment_status">
		
        <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php if ($opt['default_comment_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow people to post comments on the article') ?></label>
    
        <br />
        <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
        </td>
        </tr>
		<tr valign="top">
		<th scope="row"><?php _e('Other comment settings') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend>
		
		<label for="require_name_email">
		
        <input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php if ($opt['require_name_email'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
		<br />
		<label for="comment_registration">
		<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', $opt['comment_registration']); ?> />
		<?php _e('Users must be registered and logged in to comment') ?>
		</label>
		<br />
		
		<label for="close_comments_for_old_posts">
		<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', $opt['close_comments_for_old_posts']); ?> />
		<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . esc_attr($opt['close_comments_days_old']) . '" class="small-text" />') ?>
		<br />
		<label for="thread_comments">
		<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', $opt['thread_comments']); ?> />
		<?php
		
		$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
		
		
		
		$thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
		for ( $i = 1; $i <= $maxdeep; $i++ ) {
			$thread_comments_depth .= "<option value='$i'";
			if (isset($opt['thread_comments_depth']) && $opt['thread_comments_depth'] == $i ) $thread_comments_depth .= " selected='selected'";
			$thread_comments_depth .= ">$i</option>";
		}
		$thread_comments_depth .= '</select>';
		
		printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
		
		?><br />
		<label for="page_comments">
		<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', $opt['page_comments']); ?> />
		<?php
		
		
		$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
		if ( isset($opt['default_comments_page']) && 'newest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
		if ( 'oldest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('first') . '</option></select>';
		
		printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . esc_attr($opt['comments_per_page']) . '" class="small-text" />', $default_comments_page );
		
		?></label>
		<br />
		<label for="comment_order"><?php
		
		$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
		if ( 'asc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('older') . '</option><option value="desc"';
		if ( 'desc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('newer') . '</option></select>';
		
		printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
		
		?></label>
		</fieldset></td>
		</tr>
		
		
		
		
        <tr valign="top">
        <th scope="row"><?php _e('E-mail me whenever') ?></th>
        <td>
		<label for="comments_notify">
		
        <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php if ($opt['comments_notify'] == 1 ) echo('checked="checked"'); ?> /> <?php _e('Anyone posts a comment') ?> </label>
         
        <br />
		<label for="moderation_notify">
		
        <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php if ($opt['moderation_notify'] == 1) echo('checked="checked"'); ?> /> <?php _e('A comment is held for moderation') ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Before a comment appears') ?></th>
        <td>
		<label for="comment_moderation">
		
        <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php if ($opt['comment_moderation'] == 1) echo('checked="checked"'); ?> /> <?php _e('An administrator must always approve the comment') ?></label>
    
        
        
        <br />
		<label for="comment_whitelist">
        <input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php if ($opt['comment_whitelist'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
       
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Moderation') ?></th>
        <td>
        <p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . $opt['comment_max_links']. '" />' ) ?></p>
        
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['moderation_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Blacklist') ?></th>
        <td>
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['blacklist_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        </table>
        
        <h3><?php _e('Avatars') ?></h3>

        <p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p>
        
        <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Avatar display') ?></th>
        <td>
        <?php
            $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
            foreach ( $yesorno as $key => $value) {
                $selected = ($opt['show_avatars'] == $key) ? 'checked="checked"' : '';
                echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
            }
        ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Maximum Rating') ?></th>
        <td>
        
        <?php
        $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
        foreach ($ratings as $key => $rating) :
          	$selected = ($opt['avatar_rating'] == $key) ? 'checked="checked"' : '';
            echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
        endforeach;
        ?>
        
        </td>
        </tr>
		
		
		
		<tr valign="top">
		<th scope="row"><?php _e('Default Avatar') ?></th>
		<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
		
		<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
		
		<?php
		$avatar_defaults = array(
			'mystery' => __('Mystery Man'),
			'blank' => __('Blank'),
			'gravatar_default' => __('Gravatar Logo'),
			'identicon' => __('Identicon (Generated)'),
			'wavatar' => __('Wavatar (Generated)'),
			'monsterid' => __('MonsterID (Generated)')
		);
		$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
		$default = $opt['avatar_default'];
		if ( empty($default) )
			$default = 'mystery';
		$size = 32;
		$avatar_list = '';
		foreach ( $avatar_defaults as $default_key => $default_name ) {
			$selected = ($default == $default_key) ? 'checked="checked" ' : '';
			$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
		
			//$avatar = get_avatar( $user_email, $size, $default_key );
			//$avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
		
			$avatar_list .= ' ' . $default_name . '</label>';
			$avatar_list .= '<br />';
		}
		echo apply_filters('default_avatar_select', $avatar_list);
		?>
		
		</fieldset></td>
		</tr>
		
		
        
        </table>

        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Privacy Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Visibility') ?> </th>
        <td>
        <p>Warning: It can be confusing for users to have these settings override the setting they choose on the sign up form. If you do not want to override user settings, select "Allow User Choice".</p>
		
		<p><input id="blog-public-reset" type="radio" name="blog_public" value="" <?php checked('', $opt['blog_public']); ?> />
        <label for="blog-public-reset"><?php _e('Allow User Choice'); ?></label></p>
        <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', $opt['blog_public']); ?> />
        <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers and in public listings around this site.') ?></label></p>
        <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', $opt['blog_public']); ?> />
        <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
        <?php do_action('blog_privacy_selector'); ?>
        </td>
        </tr>
        </table>
        
       
        </div>
        <p>&nbsp;</p>
		<div class="wrap">
        <h2><?php _e('Customize Permalink Structure') ?></h2>
        <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
        
        <?php
        $prefix = '';
        
        if ( ! got_mod_rewrite() )
            $prefix = '/index.php';
        
        $structures = array(
            '',
            $prefix . '/%year%/%monthnum%/%day%/%postname%/',
            $prefix . '/%year%/%monthnum%/%postname%/',
            $prefix . '/archives/%post_id%'
            );
        ?>
        <h3><?php _e('Common settings'); ?></h3>
        
        <table class="form-table">
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="" class="tog" <?php checked('', $opt['permalink_structure']); ?> /> <?php _e('Default'); ?></label></th>
                <td>&nbsp;</td>
             </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $opt['permalink_structure']); ?> /> <?php _e('Day and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $opt['permalink_structure']); ?> /> <?php _e('Month and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $opt['permalink_structure']); ?> /> <?php _e('Numeric'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th>
                    <label><input name="permalink_choice" id="custom_selection" type="radio" value="custom" class="tog"
                    <?php if ( !in_array($opt['permalink_structure'], $structures) ) { ?>
                    checked="checked"
                    <?php } ?>
                     />
                    <?php _e('Custom Structure'); ?>
                    </label>
                </th>
                <td>
                    <?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $opt['permalink_structure'] ); }?>
                    <input name="permalink_structure" id="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo esc_attr($opt['permalink_structure']); ?>" size="50" />
                </td>
            </tr>
        </table>
        
        <h3><?php _e('Optional'); ?></h3>
        <?php if ($is_apache) : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php else : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php endif; ?>
        
        <table class="form-table">
            <tr>
                <th><?php _e('Category base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['category_base'] = str_replace( "/blog", "", $opt['category_base'] ); }?> <input name="category_base" type="text" class="code"  value="<?php echo esc_attr( $opt['category_base'] ); ?>" size="30" /></td>
            </tr>
            <tr>
                <th><?php _e('Tag base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['tag_base'] = str_replace( "/blog", "", $opt['tag_base'] ); }?> <input name="tag_base" id="tag_base" type="text" class="code"  value="<?php echo esc_attr($opt['tag_base']); ?>" size="30" /></td>
            </tr>
        </table>
        
        </div>
                
        
        <p>&nbsp;</p>
        
        <div class="wrap">
        <h2><?php _e('Media Settings'); ?></h2>
        <h3><?php _e('Image sizes') ?></h3>
        <p><?php _e('The sizes listed below determine the maximum dimensions to use when inserting an image into the body of a post.'); ?></p>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Thumbnail size') ?></th>
        <td>
        <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
        <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php echo($opt['thumbnail_size_w']); ?>" size="6" />
        <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
        <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php echo($opt['thumbnail_size_h']); ?>" size="6" /><br />
        <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', $opt['thumbnail_crop']); ?>/>
        <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Medium size') ?></th>
        <td>
        <label for="medium_size_w"><?php _e('Max Width'); ?></label>
        <input name="medium_size_w" type="text" id="medium_size_w" value="<?php echo($opt['medium_size_w']); ?>" size="6" />
        <label for="medium_size_h"><?php _e('Max Height'); ?></label>
        <input name="medium_size_h" type="text" id="medium_size_h" value="<?php echo($opt['medium_size_h']); ?>" size="6" />
        </td>
        </tr>
			<tr valign="top">
		<th scope="row"><?php _e('Large size') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend>
		<label for="large_size_w"><?php _e('Max Width'); ?></label>
		<input name="large_size_w" type="text" id="large_size_w" value="<?php echo($opt['large_size_w']); ?>" class="small-text" />
		<label for="large_size_h"><?php _e('Max Height'); ?></label>
		<input name="large_size_h" type="text" id="large_size_h" value="<?php echo($opt['large_size_h']); ?>" class="small-text" />
		</fieldset></td>
		</tr>
		</table>
        <h3><?php _e('Embeds') ?></h3>

		<table class="form-table">
		
		<tr valign="top">
		<th scope="row"><?php _e('Auto-embeds'); ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Attempt to automatically embed all plain text URLs'); ?></span></legend>
		<label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', $opt['embed_autourls'] ); ?>/> <?php _e('Attempt to automatically embed all plain text URLs'); ?></label>
		</fieldset></td>
		</tr>
		
		<tr valign="top">
		<th scope="row"><?php _e('Maximum embed size') ?></th>
		<td>
		<label for="embed_size_w"><?php _e('Width'); ?></label>
		<input name="embed_size_w" type="text" id="embed_size_w" value="<?php echo $opt['embed_size_w']; ?>" class="small-text" />
		<label for="embed_size_h"><?php _e('Height'); ?></label>
		<input name="embed_size_h" type="text" id="embed_size_h" value="<?php echo $opt['embed_size_h']; ?>" class="small-text" />
		<?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?>
		</td>
		</tr>
		
		
		</table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2>Default Theme</h2>
        <?php 
		$themes = get_themes();
		$ct = current_theme_info();
		$allowed_themes = get_site_allowed_themes();
		if( $allowed_themes == false )
			$allowed_themes = array();
		
		$blog_allowed_themes = wpmu_get_blog_allowedthemes();
		if( is_array( $blog_allowed_themes ) )
			$allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );
		
		if( $blog_id != 1 ) {
			unset( $allowed_themes[ "h3" ] );
		}
		
		if( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false )
			$allowed_themes[ esc_html( $ct->stylesheet ) ] = true;
		
		reset( $themes );
		foreach( $themes as $key => $theme ) {
			if( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false ) {
				unset( $themes[ $key ] );
			}
		}
		reset( $themes );
		
		// get the names of the themes & sort them
		$theme_names = array_keys($themes);
		natcasesort($theme_names);
		?>
        <table class="form-table">
        <tr valign="top">
        <th>Select the default theme:</th>
        <td><select name="theme" size="1">
        <?php
		foreach ($theme_names as $theme_name) {
		$template = $themes[$theme_name]['Template'];
		$stylesheet = $themes[$theme_name]['Stylesheet'];
		$title = $themes[$theme_name]['Title'];
		$selected = "";
		if($opt[theme] == $template . "|" . $stylesheet) {
			$selected = "selected = 'selected' ";
		}
		echo('<option value="' . $template . "|" . $stylesheet .  '"' . $selected . '>' . $title . "</option>");
		}
		?>
        </select>
        </td>
        </tr>
        </table>
        </div>
        
        <div class="wrap">
        <h2>Bonus Settings</h2>
		<table class="form-table">
        <tr valign="top">
        <th>From Email:</th>
		<td><input name="from_email" type="text" id="from_email" size="30" value="<?php echo($opt['from_email']); ?>"  /></td>
		</tr>
		  <tr valign="top">
        <th>From Email Name:<br/>(defaults to site name if left blank)</th>
		<td><input name="from_email_name" type="text" id="from_email_name" size="30" value="<?php echo($opt['from_email_name']); ?>"  /></td>
		</tr>
		<tr>
			<th>Delete Standard WordPress Blogroll Links</th>
			<td>
		<label for="delete_blogroll_links">
		
        <input name="delete_blogroll_links" type="checkbox" id="delete_blogroll_links" value="1" <?php if ($opt['delete_blogroll_links'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Default Link Category:<br/> (Overwrites "Blogroll")</th>
		<td><input name="default_link_cat" type="text" id="default_link_cat" size="30" value="<?php echo($opt['default_link_cat']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Links') ?></th>
        <td>
        <p><?php _e('Enter links one per line with the name followed by an equals sign and a greater than sign and then the fully qualified link. Example: Google=>http://www.google.com') ?></p>
        <p>
        <textarea name="default_links" cols="60" rows="10" id="default_links" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_links'])); ?></textarea>
        </p>
        </td>
        </tr>
		
		<tr valign="top">
        <th>Default Category:<br/> (Overwrites "Uncategorized")</th>
		<td><input name="default_cat_name" type="text" id="default_cat_name" size="30" value="<?php echo($opt['default_cat_name']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Categories') ?></th>
        <td>
        <p><?php _e('Enter categories one per line with the name followed by an equals sign and a greater than sign and then the description => Nice Name => parent name. Example: Plugins=>Find out out about my plugins=>plugins=>code') ?></p>
        <p>
        <textarea name="default_categories" cols="60" rows="10" id="default_categories" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_categories'])); ?></textarea>
        </p>
        </td>
        </tr>
		
    	<tr>
			<th>Delete Initial Comment</th>
			<td>
		<label for="delete_first_comment">
		
        <input name="delete_first_comment" type="checkbox" id="delete_first_comment" value="1" <?php if ($opt['delete_first_comment'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on Hello World Post</th>
			<td>
		<label for="close_comments_on_hello_world">
		
        <input name="close_comments_on_hello_world" type="checkbox" id="close_comments_on_hello_world" value="1" <?php if ($opt['close_comments_on_hello_world'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on About Page</th>
			<td>
		<label for="close_comments_on_about_page">
		
        <input name="close_comments_on_about_page" type="checkbox" id="close_comments_on_about_page" value="1" <?php if ($opt['close_comments_on_about_page'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Make First Post a Draft ("Hello World")</th>
			<td>
		<label for="delete_first_post">
		
        <input name="delete_first_post" type="checkbox" id="delete_first_post" value="1" <?php if ($opt['delete_first_post'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		
		<tr>
			<th>Delete Initial Widgets</th>
			<td>
			<input name="delete_initial_widgets" type="checkbox" id="delete_initial_widgets" value="1" <?php if ($opt['delete_initial_widgets'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?>
			</td>
		</tr>
		
		<tr>
			<th colspan="2">
				Sites that use a combination of BBPress and BuddyPress need all users to be subscribed to the blog on which BBPress is installed. The following section lets you do that. Note that you may add people to a comma-delimited list of blogs, but they will have the same role on each blog. 
			</td>
		</tr>
		<tr valign="top">
        <th>Add User to Other Blog(s):</th>
		<td><input name="add_user_to_blog" type="checkbox" id="add_user_to_blog" value="1" <?php if ($opt['add_user_to_blog'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Role on Other Blog (s)</th>
		<td>
			<select name="add_user_to_blog_role" id="add_user_to_blog_role">
			<option value="administrator"<?php if($opt['add_user_to_blog_role'] == 'administrator') echo ' selected="selected"';?>>Administator</option>
			<option value="editor"<?php if($opt['add_user_to_blog_role'] == 'editor') echo ' selected="selected"';?>>Editor</option>
			<option value="author"<?php if($opt['add_user_to_blog_role'] == 'author') echo ' selected="selected"';?>>Author</option>
			<option value="contributor"<?php if($opt['add_user_to_blog_role'] == 'contributor') echo ' selected="selected"';?>>Contributor</option>
			<option value="subscriber"<?php if($opt['add_user_to_blog_role'] == 'subscriber') echo ' selected="selected"';?>>Subscriber</option>				
		</select></td>
		</tr>
		<tr valign="top">
        <th>Blog ID's to add User To:</th>
		<td><input name="add_user_to_blog_id" type="text" id="add_user_to_blog_id" size="30" value="<?php echo($opt['add_user_to_blog_id']); ?>"  /><br/>Use Blog ID or comma-delimited list of ID's.</td>
		</tr>
		</table>
		</div>
        
        
         <p>  
         <input type="hidden" name="action" value="update" />
        <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
          </p> 
        
        <?php
	 }
function bp_groupblog_management_page()
{
    global $wpdb;
    // only allow site admins to come here.
    if (is_super_admin() == false) {
        wp_die(__('You do not have permission to access this page.', 'groupblog'));
    }
    // process form submission
    if (isset($_POST['action']) && $_POST['action'] == 'update') {
        bp_groupblog_update_defaults();
        $updated = true;
    } else {
        $updated = false;
    }
    // make sure we're using latest data
    $opt = get_site_option('bp_groupblog_blog_defaults_options');
    ?>

	<?php 
    if ($updated) {
        ?>
  	<div id="message" class="updated fade">
  		<p><?php 
        _e('Options saved.', 'groupblog');
        ?>
</p>
  	</div>
  <?php 
    }
    ?>

	<div class="wrap" style="position: relative">
		<h2><?php 
    _e('BuddyPress GroupBlog Settings', 'groupblog');
    ?>
</h2>

		<form name="bp-groupblog-setup" id="bp-groupblog-setup" action="" method="post">

			<div id="tabctnr">

				<ul class="tabnav">
	      	<li><a href="#groupblog_default_theme"><?php 
    _e('Theme', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_landing_page"><?php 
    _e('Redirect', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_template_layout"><?php 
    _e('Layout', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_default_blog_settings"><?php 
    _e('Defaults', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_validation_settings"><?php 
    _e('Validation', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_about"><?php 
    _e('About', 'groupblog');
    ?>
</a></li>
	      </ul>

				<div id='groupblog_default_theme'>
					<?php 
    $current_groupblog_theme = '';
    // get all themes
    if (function_exists('wp_get_themes')) {
        // get theme data the WP3.4 way...
        $themes = wp_get_themes(false, 'network', 0);
        $ct = wp_get_theme();
        $allowed_themes = WP_Theme::get_allowed_on_network();
        $blog_allowed_themes = WP_Theme::get_allowed_on_site();
    } else {
        // pre WP3.4 functions
        $themes = get_themes();
        $ct = current_theme_info();
        $allowed_themes = get_site_allowed_themes();
        $blog_allowed_themes = wpmu_get_blog_allowedthemes();
    }
    if ($allowed_themes == false) {
        $allowed_themes = array();
    }
    if (is_array($blog_allowed_themes)) {
        $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
    }
    if ($wpdb->blogid != 1) {
        unset($allowed_themes['h3']);
    }
    if (isset($allowed_themes[esc_html($ct->stylesheet)]) == false) {
        $allowed_themes[esc_html($ct->stylesheet)] = true;
    }
    reset($themes);
    foreach ($themes as $key => $theme) {
        if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) == false) {
            unset($themes[$key]);
        }
    }
    reset($themes);
    // get the names of the themes & sort them
    /* 
    Note: pre-WP3.4 the keys are the theme names. In 3.4, the keys are folder names
    Fortunately, the magic methods of the object retain backwards compatibility and allow
    array-style access to work
    */
    $theme_names = array_keys($themes);
    natcasesort($theme_names);
    ?>

					<h3><?php 
    _e('Default Theme', 'groupblog');
    ?>
</h3>

					<div id="select-theme">
						<label for="theme"><?php 
    _e('Select the default theme for new groupblogs:', 'groupblog');
    ?>
</label>
						<select id="theme" name="theme" size="1">

						<optgroup label="<?php 
    echo esc_attr(__('GroupBlog Themes:', 'groupblog'));
    ?>
">
					 	<?php 
    $groupblog_themes_options = '';
    foreach ($theme_names as $theme_name) {
        if (in_array('groupblog', (array) $themes[$theme_name]['Tags'])) {
            $template = $themes[$theme_name]['Template'];
            $stylesheet = $themes[$theme_name]['Stylesheet'];
            $title = $themes[$theme_name]['Title'];
            $selected = "";
            if ($opt['theme'] == $template . "|" . $stylesheet) {
                $selected = "selected = 'selected' ";
                $current_groupblog_theme = $theme_name;
            }
            $groupblog_themes_options .= '<option value="' . $template . "|" . $stylesheet . '"' . $selected . '>' . $title . "</option>";
        }
    }
    if (!empty($groupblog_themes_options)) {
        echo $groupblog_themes_options;
    } else {
        echo '<option value="" disabled="disabled">' . __('No groupblog-enabled themes available', 'groupblog') . '</option>';
    }
    ?>
						</optgroup>
						<optgroup label="<?php 
    echo esc_attr(__('Regular Themes:', 'groupblog'));
    ?>
">
						<?php 
    $non_groupblog_themes_options = '';
    foreach ($theme_names as $theme_name) {
        if (!in_array('groupblog', (array) $themes[$theme_name]['Tags'])) {
            $template = $themes[$theme_name]['Template'];
            $stylesheet = $themes[$theme_name]['Stylesheet'];
            $title = $themes[$theme_name]['Title'];
            $selected = "";
            if ($opt['theme'] == $template . "|" . $stylesheet) {
                $selected = "selected = 'selected' ";
                $current_groupblog_theme = $theme_name;
            }
            $non_groupblog_themes_options .= '<option value="' . $template . "|" . $stylesheet . '"' . $selected . '>' . $title . "</option>";
        }
    }
    if (!empty($non_groupblog_themes_options)) {
        echo $non_groupblog_themes_options;
    } else {
        echo '<option value="" disabled="disabled">' . __('No regular themes available', 'groupblog') . '</option>';
    }
    ?>
						</optgroup>

						<option value="" <?php 
    selected($current_groupblog_theme, '');
    ?>
><?php 
    _e('- None selected -', 'groupblog');
    ?>
</option>

						</select>
					</div>

					<?php 
    if (!empty($current_groupblog_theme)) {
        ?>

						<div id="current-theme">
							<?php 
        if (isset($themes[$current_groupblog_theme]['Screenshot'])) {
            ?>
								<img src="<?php 
            echo $themes[$current_groupblog_theme]['Theme Root URI'] . '/' . $themes[$current_groupblog_theme]['Stylesheet'] . '/' . $themes[$current_groupblog_theme]['Screenshot'];
            ?>
" alt="<?php 
            _e('Current theme preview');
            ?>
" />
							<?php 
        }
        ?>

							<div class="alt" id="current-theme-info">
								<h4><?php 
        /* translators: 1: theme title, 2: theme version, 3: theme author */
        printf(__('%1$s %2$s by %3$s'), $themes[$current_groupblog_theme]['Title'], $themes[$current_groupblog_theme]['Version'], $themes[$current_groupblog_theme]['Author']);
        ?>
</h4>
								<p class="theme-description"><?php 
        /*print_r ($themes[$current_groupblog_theme]);*/
        echo $themes[$current_groupblog_theme]['Description'];
        ?>
</p>
								</div>
						</div>

					<?php 
    }
    ?>

					<div class="clear"></div>

				</div>
				<div id='groupblog_landing_page'>

					<h3><?php 
    _e('Default Landing Page', 'groupblog');
    ?>
</h3>

					<p><?php 
    _e('The page that is linked to from the "Blog" tab of the Group navigation. Selecting "Disabled" will use the buddypress template included in the plugin, no redirect will take place. The "Home Page" setting will create a redirect to the blog front page. The "Template Page" setting will create a redirect to the blog template page, additionally when using this setting you can choose a specific page template layout in the next tab.', 'groupblog');
    ?>
</p>
					<table class="form-table">
						<tbody>
						<tr>
							<th><?php 
    _e('Redirect Enabled to:', 'groupblog');
    ?>
</th>
							<td>
								<label><input class="info-off" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="0" type="radio" <?php 
    if ($opt['redirectblog'] == 0) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Disabled', 'groupblog');
    ?>
</label>
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<label><input class="info-off" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="1" type="radio" <?php 
    if ($opt['redirectblog'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Home Page', 'groupblog');
    ?>
</label>
							</td>
						<tr>
							<th></th>
							<td>
								<label><input class="info-on" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="2" type="radio" <?php 
    if ($opt['redirectblog'] == 2) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Page Template Title: ', 'groupblog');
    ?>
</label>
								<input name="bp_groupblog_page_title" id="bp_groupblog_page_title" value="<?php 
    echo $opt['pagetitle'];
    ?>
" size="10" type="text" />
								<span class="notice" id="redirect_notice" style="display:none;"> <?php 
    _e('All existing Group Blogs will be automatically updated on each change.', 'groupblog');
    ?>
</span>
								<p class="info"><?php 
    _e('The "Template Page" option will create a page on group blogs and links to a template file within your theme. Don\'t worry about the name you choose, we\'ll make sure your page finds it way to the template file. For custom themes make sure to <a href="http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates">create</a> this template file manually.', 'groupblog');
    ?>
								</p>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Redirect Group Home:', 'groupblog');
    ?>
</th>
							<td>
								<label for="deep_group_integration"><input name="deep_group_integration" type="checkbox" id="deep_group_integration" value="1" <?php 
    if ($opt['deep_group_integration'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes, redirect Group Home to Blog Home', 'groupblog');
    ?>
</label><p><?php 
    _e('This option will take control of the GROUP home page and redirects it to the BLOG home page. This will enable posting from the group Home using P2 instead of the BuddyPress form.', 'groupblog');
    ?>
</p>
					  	</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_template_layout'>
				<?php 
    if ($opt['theme'] == 'p2|p2-buddypress') {
        ?>

					<h3><?php 
        _e('Template Page Layout', 'groupblog');
        ?>
</h3>

					<p class="disabled"><?php 
        _e('Please select the option "Template Page" on the Redirect tab in order to choose a layout.', 'groupblog');
        ?>
</p>

					<p class="enabled"><?php 
        _e('Please select a Layout which you would like to use for your Group Blog. Additionally, incombination with "Redirect Group Home" setting you can set this as your Group Home page.', 'groupblog');
        ?>
</p>

					<table class="enabled" id="availablethemes" cellspacing="0" cellpadding="0">
						<tbody>
						<tr class="alt">
							<td class="available-theme top left">
								<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-mag.png">';
        ?>
								<div class="clear"></div>
								<input name="page_template_layout" id="page_template_layout"  value="magazine" type="radio" <?php 
        if ($opt['page_template_layout'] == 'magazine') {
            echo 'checked="checked"';
        }
        ?>
  /><h3 style="display:inline;"> <?php 
        _e('Magazine', 'groupblog');
        ?>
</h3>
								<p class="description"><?php 
        _e('Balanced template for groups with diverse postings.', 'groupblog');
        ?>
</p>
							</td>
							<td class="available-theme top">
								<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-micro.png">';
        ?>
								<div class="clear"></div>
								<input name="page_template_layout" id="page_template_layout"  value="microblog" type="radio" <?php 
        if ($opt['page_template_layout'] == 'microblog') {
            echo 'checked="checked"';
        }
        ?>
 /><h3 style="display:inline;"> <?php 
        _e('Microblog', 'groupblog');
        ?>
</h3>
								<p class="description"><?php 
        _e('Great for simple listing of posts in a chronological order.', 'groupblog');
        ?>
</p>
							</td>
						</tr>
						</tbody>
					</table>

					<table class="form-table enabled">
					<tbody>
						<tr>
							<th><?php 
        _e('Group admin layout control:', 'groupblog');
        ?>
</th>
							<td>
								<label for="group_admin_layout"><input name="group_admin_layout" type="checkbox" id="group_admin_layout" value="1" <?php 
        if ($opt['group_admin_layout'] == 1) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        _e('Allow group admins to select the layout for their group themselves.', 'groupblog');
        ?>
</label>
					  	</td>
						</tr>
						</tbody>
					</table>
				<?php 
    } else {
        ?>
					<h3><?php 
        _e('Template Page Layout', 'groupblog');
        ?>
</h3>

					<p><?php 
        _e('Layout options are only available for the "P2 BuddyPress" Theme. Please select the "P2 Buddypress" theme on the "Theme" tab in order to choose a layout. Additionally the Redirect option needs to be set to "Template Page".', 'groupblog');
        ?>
</p>
				<?php 
    }
    ?>
				</div>
				<div id='groupblog_default_blog_settings'>

		      <h3><?php 
    _e('Default Blog Settings', 'groupblog');
    ?>
</h3>

					<table class="form-table">
						<tbody>
						<tr valign="top">
			        <th><?php 
    _e('Default Post Category:', 'groupblog');
    ?>
</th>
							<td>
								<input name="default_cat_name" type="text" id="default_cat_name" size="30" value="<?php 
    echo $opt['default_cat_name'];
    ?>
"  /> <?php 
    _e('(Overwrites "Uncategorized")', 'groupblog');
    ?>
							</td>
						</tr>
						<tr valign="top">
				    	<th><?php 
    _e('Default Link Category:', 'groupblog');
    ?>
</th>
							<td>
								<input name="default_link_cat" type="text" id="default_link_cat" size="30" value="<?php 
    echo $opt['default_link_cat'];
    ?>
"  /> <?php 
    _e('(Overwrites "Blogroll")', 'groupblog');
    ?>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Set First Post to Draft', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_first_post">
				       		<input name="delete_first_post" type="checkbox" id="delete_first_post" value="1" <?php 
    if ($opt['delete_first_post'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
 <?php 
    _e('(Default Post "Hello World")', 'groupblog');
    ?>
				       	</label>
							</td>
						</tr>
				    <tr>
							<th><?php 
    _e('Delete Initial Comment', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_first_comment">
					        <input name="delete_first_comment" type="checkbox" id="delete_first_comment" value="1" <?php 
    if ($opt['delete_first_comment'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
					       </label>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Delete Blogroll Links', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_blogroll_links">
									<input name="delete_blogroll_links" type="checkbox" id="delete_blogroll_links" value="1" <?php 
    if ($opt['delete_blogroll_links'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
								</label>
							</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_validation_settings'>

					<h3><?php 
    _e('Validation Settings', 'groupblog');
    ?>
</h3>

					<div><?php 
    _e('Change the default WordPress blog validation settings.', 'groupblog');
    ?>
</div>
					<table class="form-table">
						<tbody>
						<tr>
							<th><?php 
    _e('Allow:', 'groupblog');
    ?>
</th>
							<td>
								<label for="bp_groupblog_allowdashes">
				       		<input name="bp_groupblog_allowdashes" type="checkbox" id="bp_groupblog_allowdashes" value="1" <?php 
    if ($opt['allowdashes'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Dashes', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
				       	</label>
							</td>
						</tr>
				    <tr>
				    	<th></th>
							<td>
								<label for="bp_groupblog_allowunderscores">
					        <input name="bp_groupblog_allowunderscores" type="checkbox" id="bp_groupblog_allowunderscores" value="1" <?php 
    if ($opt['allowunderscores'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Underscores', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
					       </label>
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<label for="bp_groupblog_allownumeric">
									<input name="bp_groupblog_allownumeric" type="checkbox" id="bp_groupblog_allownumeric" value="1" <?php 
    if ($opt['allownumeric'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('All Numeric Names', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
								</label>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Minimum Length:', 'groupblog');
    ?>
</th>
							<td>
								<input name="bp_groupblog_minlength" style="width: 10%;" id="bp_groupblog_minlenth" value="<?php 
    echo $opt['minlength'];
    ?>
" size="10" type="text" /> <?php 
    _e('(Default: 4 Characters)', 'groupblog');
    ?>
							</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_about'>

					<h3><?php 
    _e('About This PLugin', 'groupblog');
    ?>
</h3>

			    <div>
			    	<span class="indent"><strong><?php 
    _e('Authors', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://oomsonline.com">Marius Ooms</a> & <a href="http://blevins.nl">Rodney Blevins</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Donate', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7374704"><?php 
    _e('PayPal', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Support', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://buddypress.org/forums/"><?php 
    _e('BuddyPress Forums', 'groupblog');
    ?>
</a> |
			    	<a href="http://wordpress.org/tags/bp-groupblog?forum_id=10"><?php 
    _e('WordPress Forums', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Trac', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://plugins.trac.wordpress.org/log/bp-groupblog"><?php 
    _e('Revision Log', 'groupblog');
    ?>
</a> | <a href="http://plugins.trac.wordpress.org/browser/bp-groupblog/"><?php 
    _e('Trac Browser', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Rate', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://wordpress.org/extend/plugins/bp-groupblog/"><?php 
    _e('Let everyone know! Only if you like it :)', 'groupblog');
    ?>
</a></span>
			    </div>
			    <hr />
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Acknowledgement', 'groupblog');
    ?>
</strong></span>
			    	<span><?php 
    _e('Thanks goes out to the following people:', 'groupblog');
    ?>
</span>
				    	<ul id="acknowledge">
				    		<li><a href="http://buddypress.org/developers/apeatling/">Andy Peatling</a></li>
				    		<li>Thijs Huijssoon</li>
				    		<li><a href="http://deannaschneider.wordpress.com/">Deanna Schneider</a></li>
				    		<li><a href="http://buddypress.org/developers/boonebgorges/">Boone Gorges</a></li>
				    		<li><a href="http://wordpress.org/support/profile/5499080">Luiz Armesto</a></li>
				    		<li><a href="http://buddypress.org/developers/burtadsit/">Burt Adsit</a></li>
				    	</ul>
			    </div>

				</div>

			</div>

	    <p class="submit">
	    	<input type="hidden" name="action" value="update" />
	      <input type="submit" name="Submit" class="button-primary" value="<?php 
    _e('Save Changes', 'groupblog');
    ?>
" />
	    </p>

 		</form>

	</div>

<?php 
}