remove realpath check on abspath, messes up on badly-behaved webhosts

This commit is contained in:
John Bintz 2009-12-31 08:36:06 -05:00
parent 4f4c0e8810
commit 87fedb04c7
4 changed files with 67 additions and 104 deletions

View File

@ -83,7 +83,7 @@ class ComicPressMediaHandling {
// @codeCoverageIgnoreStart
function _abspath() {
return trailingslashit($this->_resolve_regex_path(realpath(ABSPATH)));
return trailingslashit($this->_resolve_regex_path(ABSPATH));
}
// @codeCoverageIgnoreEnd

View File

@ -15,22 +15,22 @@ function comicpress_admin_page_head() { ?>
function comicpress_admin() {
global $upload_path, $blogcat;
$comicpress_options = get_option('comicpress_options'); ?>
<div class="wrap">
<div id="cpadmin-headericon" style="background: url('<?php echo get_template_directory_uri(); ?>/images/options/comicpress_icon.png') no-repeat;"></div>
<h2 class="alignleft"><?php _e('ComicPress Options','comicpress'); ?></h2>
<div class="clear"></div>
<?php
<?php
$tab = '';
if ( wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) {
if ($_REQUEST['action'] == 'comicpress_save_layout') {
if ($_REQUEST['action'] == 'comicpress_save_layout') {
$comicpress_options['cp_theme_layout'] = $_REQUEST['cp_theme_layout'];
$tab = 'themestyle';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_general') {
$comicpress_options['disable_page_restraints'] = (bool)( $_REQUEST['disable_page_restraints'] == 1 ? true : false );
$comicpress_options['rascal_says'] = (bool)($_REQUEST['rascal_says'] == 1 ? true : false );
@ -42,53 +42,54 @@ function comicpress_admin() {
$comicpress_options['enable_widgetarea_use_sidebar_css'] = (bool)($_REQUEST['enable_widgetarea_use_sidebar_css'] == 1 ? true : false );
$comicpress_options['disable_lrsidebars_frontpage'] = (bool)($_REQUEST['disable_lrsidebars_frontpage'] == 1 ? true : false );
$comicpress_options['disable_footer_text'] = (bool)($_REQUEST['disable_footer_text'] == 1 ? true : false );
$comicpress_options['disable_blogheader'] = (bool)($_REQUEST['disable_blogheader'] == 1 ? true : false );
$comicpress_options['disable_blogheader'] = (bool)($_REQUEST['disable_blogheader'] == 1 ? true : false );
$comicpress_options['disable_rss_comments_count'] = (bool)($_REQUEST['disable_rss_comments_count'] == 1 ? true : false );
$comicpress_options['enable_comicpress_debug'] = (bool)($_REQUEST['enable_comicpress_debug'] == 1 ? true : false );
$comicpress_options['enable_full_post_check'] = (bool)($_REQUEST['enable_full_post_check'] == 1 ? true : false );
$tab = 'general';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_index') {
$comicpress_options['disable_comic_frontpage'] = (bool)($_REQUEST['disable_comic_frontpage'] == 1 ? true : false );
$comicpress_options['disable_comic_blog_frontpage'] = (bool)($_REQUEST['disable_comic_blog_frontpage'] == 1 ? true : false );
$comicpress_options['disable_comic_blog_single'] = (bool)($_REQUEST['disable_comic_blog_single'] == 1 ? true : false );
$comicpress_options['disable_blog_frontpage'] = (bool)($_REQUEST['disable_blog_frontpage'] == 1 ? true : false );
$tab = 'index';
update_option('comicpress_options',$comicpress_options);
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_post') {
$comicpress_options['transcript_in_posts'] = (bool)($_REQUEST['transcript_in_posts'] == 1 ? true : false );
$comicpress_options['enable_related_comics'] = (bool)($_REQUEST['enable_related_comics'] == 1 ? true : false );
$comicpress_options['enable_related_posts'] = (bool)($_REQUEST['enable_related_posts'] == 1 ? true : false );
$comicpress_options['remove_wptexturize'] = (bool)($_REQUEST['remove_wptexturize'] == 1 ? true : false );
$comicpress_options['split_column_in_two'] = (bool)($_REQUEST['split_column_in_two'] == 1 ? true : false );
$comicpress_options['author_column_one'] = wp_filter_nohtml_kses($_REQUEST['author_column_one']);
$comicpress_options['author_column_two'] = wp_filter_nohtml_kses($_REQUEST['author_column_two']);
$comicpress_options['enable_comic_post_author_gravatar'] = (bool)($_REQUEST['enable_comic_post_author_gravatar'] == 1 ? true : false );
$comicpress_options['enable_post_author_gravatar'] = (bool)($_REQUEST['enable_post_author_gravatar'] == 1 ? true : false );
$comicpress_options['avatar_directory'] = wp_filter_nohtml_kses($_REQUEST['avatar_directory']);
$comicpress_options['moods_directory'] = wp_filter_nohtml_kses($_REQUEST['moods_directory']);
$comicpress_options['calendar_directory'] = wp_filter_nohtml_kses($_REQUEST['calendar_directory']);
$comicpress_options['enable_comic_post_calendar'] = (bool)($_REQUEST['enable_comic_post_calendar'] == 1 ? true : false );
$comicpress_options['enable_post_calendar'] = (bool)($_REQUEST['enable_post_calendar'] == 1 ? true : false );
$comicpress_options['disable_tags_in_posts'] = (bool)($_REQUEST['disable_tags_in_posts'] == 1 ? true : false );
$comicpress_options['disable_categories_in_posts'] = (bool)($_REQUEST['disable_categories_in_posts'] == 1 ? true : false );
$comicpress_options['blogposts_with_comic'] = (bool)($_REQUEST['blogposts_with_comic'] == 1 ? true : false );
$comicpress_options['static_blog'] = (bool)($_REQUEST['static_blog'] == 1 ? true : false );
$comicpress_options['disable_page_titles'] = (bool)($_REQUEST['disable_page_titles'] == 1 ? true : false );
$tab = 'post';
update_option('comicpress_options',$comicpress_options);
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_archivesearch') {
if ($_REQUEST['action'] == 'comicpress_save_archivesearch') {
$comicpress_options['archive_display_order'] = $_REQUEST['archive_display_order'];
$comicpress_options['excerpt_or_content_archive'] = $_REQUEST['excerpt_or_content_archive'];
$comicpress_options['excerpt_or_content_search'] = $_REQUEST['excerpt_or_content_search'];
@ -96,7 +97,7 @@ function comicpress_admin() {
$tab = 'archivesearch';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_menubar') {
$comicpress_options['enable_search_in_menubar'] = (bool)($_REQUEST['enable_search_in_menubar'] == 1 ? true : false );
$comicpress_options['enable_rss_in_menubar'] = (bool)($_REQUEST['enable_rss_in_menubar'] == 1 ? true : false );
@ -104,11 +105,11 @@ function comicpress_admin() {
$comicpress_options['contact_in_menubar'] = (bool)($_REQUEST['contact_in_menubar'] == 1 ? true : false );
$comicpress_options['disable_dynamic_menubar_links'] = (bool)($_REQUEST['disable_dynamic_menubar_links'] == 1 ? true : false );
$comicpress_options['disable_default_menubar'] = (bool)($_REQUEST['disable_default_menubar'] == 1 ? true : false );
$comicpress_options['enable_blogroll_off_links'] = (bool)($_REQUEST['enable_blogroll_off_links'] == 1 ? true : false );
$comicpress_options['enable_blogroll_off_links'] = (bool)($_REQUEST['enable_blogroll_off_links'] == 1 ? true : false );
$tab = 'menubar';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_customheader') {
$comicpress_options['enable_custom_image_header'] = (bool)($_REQUEST['enable_custom_image_header'] == 1 ? true : false );
$comicpress_options['custom_image_header_width'] = wp_filter_nohtml_kses($_REQUEST['custom_image_header_width']);
@ -116,7 +117,7 @@ function comicpress_admin() {
$tab = 'customheader';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_buyprint') {
$comicpress_options['buy_print_email'] = wp_filter_nohtml_kses($_REQUEST['buy_print_email']);
$comicpress_options['buy_print_url'] = wp_filter_nohtml_kses($_REQUEST['buy_print_url']);
@ -128,7 +129,7 @@ function comicpress_admin() {
$tab = 'buyprint';
update_option('comicpress_options',$comicpress_options);
}
if ($_REQUEST['action'] == 'comicpress_save_members') {
$comicpress_options['members_post_category'] = wp_filter_nohtml_kses($_REQUEST['members_post_category']);
$tab = 'members';
@ -138,7 +139,7 @@ function comicpress_admin() {
?>
<div id="message" class="updated fade"><p><strong><?php _e('ComicPress Settings SAVED!','comicpress'); ?></strong></p></div>
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php }
<?php }
}
if ($_REQUEST['action'] == 'comicpress_reset') {
delete_option('comicpress_options');
@ -148,9 +149,9 @@ function comicpress_admin() {
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php
}
?>
<div id="poststuff" class="metabox-holder">
<div id="cpadmin" onclick="hidemessage();">
@ -174,12 +175,12 @@ function comicpress_admin() {
<?php include(get_template_directory() . '/options/buyprintoptions.php'); ?>
<?php include(get_template_directory() . '/options/membersoptions.php'); ?>
</div>
</div>
<?php
<?php
}
add_action('admin_menu', 'options');
?>
?>

View File

@ -4,62 +4,9 @@
* Author: Philip M. Hofer (Frumph)
* In Testing
*/
/*
function cp_add_to_feed_count_rss() {
$feedcount = get_option('comicpress_feed_count_rss');
if (!empty($feedcount)) {
$feedcount = $feedcount + 1;
update_option('comicpress_feed_count_rss', $feedcount);
} else {
add_option('comicpress_feed_count_rss', 1, ' ', 'yes');
}
}
add_action('do_feed_rss', 'cp_add_to_feed_count_rss',5);
function cp_add_to_feed_count_rdf() {
$feedcount = get_option('comicpress_feed_count_rdf');
if (!empty($feedcount)) {
$feedcount = $feedcount + 1;
update_option('comicpress_feed_count_rdf', $feedcount);
} else {
add_option('comicpress_feed_count_rdf', 1, ' ', 'yes');
}
}
add_action('do_feed_rdf', 'cp_add_to_feed_count_rdf',5);
function cp_add_to_feed_count_atom() {
$feedcount = get_option('comicpress_feed_count_atom');
if (!empty($feedcount)) {
$feedcount = $feedcount + 1;
update_option('comicpress_feed_count_atom', $feedcount);
} else {
add_option('comicpress_feed_count_atom', 1, ' ', 'yes');
}
}
add_action('do_feed_atom', 'cp_add_to_feed_count_atom',5);
function cp_add_to_feed_count_rss2() {
$feedcount = get_option('comicpress_feed_count_rss2');
if (!empty($feedcount)) {
$feedcount = $feedcount + 1;
update_option('comicpress_feed_count_rss2', $feedcount);
} else {
add_option('comicpress_feed_count_rss2', 1, ' ', 'yes');
}
}
add_action('do_feed_rss2', 'cp_add_to_feed_count_rss2',5);
*/
/**
* Add the number of post comments to the title of the RSS feed items.
* TODO Make this togglable via options.
* @param string $title The title of the post.
* @return string The filtered title of the post.
*/
@ -86,5 +33,12 @@ function comicpress_export_wp() {
remove_filter('the_title_rss', 'comicpress_the_title_rss');
}
add_filter('the_title_rss', 'comicpress_the_title_rss');
add_action('export_wp', 'comicpress_export_wp');
function comicpress_init_rss() {
$comicpress_options = comicpress_load_options();
if ($comicpress_options['disable_rss_comments_count']) {
add_filter('the_title_rss', 'comicpress_the_title_rss');
add_action('export_wp', 'comicpress_export_wp');
}
}
add_action('init', 'comicpress_init_rss');

View File

@ -2,7 +2,7 @@
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>
<div id="comicpress-options">
<table class="widefat">
@ -41,14 +41,23 @@
<tr>
<th scope="row"><label for="disable_blogheader"><?php _e('Disable blog header','comicpress'); ?></label></th>
<td>
<input id="disable_blogheader" name="disable_blogheader" type="checkbox" value="1" <?php checked(true, $comicpress_options['disable_blogheader']); ?> />
<input id="disable_blogheader" name="disable_blogheader" type="checkbox" value="1" <?php checked(true, $comicpress_options['disable_blogheader']); ?> />
</td>
<td>
<?php _e('Checkmark this and your site will not display the contents of #blogheader.','comicpress'); ?>
</td>
</tr>
</tr>
<tr>
<th scope="row"><label for="disable_rss_comments_count"><?php _e('Disable RSS comments count','comicpress'); ?></label></th>
<td>
<input id="disable_rss_comments_count" name="disable_rss_comments_count" type="checkbox" value="1" <?php checked(true, $comicpress_options['disable_rss_comments_count']); ?> />
</td>
<td>
<?php _e('Enable this option to not show comment counts in RSS feed post titles.','comicpress'); ?>
</td>
</tr>
</table>
<table class="widefat">
<thead>
<tr>
@ -82,34 +91,34 @@
<?php _e('The default comic post navigation is above each comic blog post.','comicpress'); ?>
</td>
</tr>
<?php
<?php
$current_gnav_directory = $comicpress_options['graphicnav_directory'];
if (empty($current_gnav_directory)) $current_gnav_directory = 'default';
$dirs_to_search = array_unique(array(get_template_directory(),get_stylesheet_directory()));
$gnav_directories = array();
foreach ($dirs_to_search as $dir) { $gnav_directories = array_merge($gnav_directories,glob("${dir}/images/nav/*")); }
?>
?>
<tr>
<th scope="row" colspan="2"><label for="graphicnav_directory"><?php _e('Graphic Navigation Directory','comicpress'); ?></label>
<th scope="row" colspan="2"><label for="graphicnav_directory"><?php _e('Graphic Navigation Directory','comicpress'); ?></label>
<select name="graphicnav_directory" id="graphicnav_directory">
<?php
foreach ($gnav_directories as $gnav_dirs) {
if (is_dir($gnav_dirs)) {
if (is_dir($gnav_dirs)) {
$gnav_dir_name = basename($gnav_dirs); ?>
<option class="level-0" value="<?php echo $gnav_dir_name; ?>" <?php if ($current_gnav_directory == $gnav_dir_name) { ?>selected="selected"<?php } ?>><?php echo $gnav_dir_name; ?></option>
<?php }
}
?>
</select>
</th>
<td>
<?php _e('Choose a directory to get the graphic navigation styling from. To create your own custom graphic navigation menu buttons just create a directory under <i>images/nav/</i> and place your image files inside of it and create a navstyle.css file to determine the style of your navigation display.','comicpress'); ?>
</td>
</tr>
</table>
<table class="widefat">
<thead>
<tr>
@ -133,9 +142,9 @@
<td>
<?php _e('Your home page will not display the default left/right sidebars. Minimalists dream. WARNING: Not recommended for use with Graphic Novel layouts.','comicpress'); ?>
</td>
</tr>
</tr>
</table>
<table class="widefat">
<thead>
<tr>
@ -152,7 +161,7 @@
</td>
</tr>
</table>
<table class="widefat">
<thead>
<tr>
@ -178,7 +187,7 @@
</td>
</tr>
</table>
</div>
<div id="comicpress-options-save">
@ -190,8 +199,7 @@
<div class="clear"></div>
</div>
</div>
</form>
</div>