Some patches

1. Quickcache openbase dir related issues , bad use of dirname

From: Thomas PIERSON <contact@thomaspierson.fr>
Date: Tue, 5 Jun 2012 09:36:22 +0200
Subject: [PATCH] fix: bad use of dirname in quickcache plugin

---
.../quick-cache/includes/classes/menu-pages.inc.php    |    6 +++---
.../quick-cache/includes/classes/wp-cache.inc.php      |   16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/wp-content/plugins/quick-cache/includes/classes/menu-pages.inc.php b/wp-content/plugins/quick-cache/includes/classes/menu-pages.inc.php
--- a/wp-content/plugins/quick-cache/includes/classes/menu-pages.inc.php
+++ b/wp-content/plugins/quick-cache/includes/classes/menu-pages.inc.php
@@ -326,9 +326,9 @@ if (!class_exists ("c_ws_plugin__qcache_menu_pages"))
            {
                c_ws_plugin__qcache_admin_notices::display_admin_notice ('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", ABSPATH . "wp-config.php")) . '</code>. Quick Cache needs write-access to this file. Permissions need to be <code>755</code> or higher.', true);
            }
-           else if (file_exists (dirname (ABSPATH) . "/wp-config.php") && !is_writable (dirname (ABSPATH) . "/wp-config.php"))
+           else if (file_exists (ABSPATH . "wp-config.php") && !is_writable (ABSPATH . "wp-config.php"))
            {
-               c_ws_plugin__qcache_admin_notices::display_admin_notice ('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", dirname (ABSPATH) . "/wp-config.php")) . '</code>. Quick Cache needs write-access to this file. Permissions need to be <code>755</code> or higher.', true);
+               c_ws_plugin__qcache_admin_notices::display_admin_notice ('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html (preg_replace ("/^" . preg_quote ($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", ABSPATH . "wp-config.php")) . '</code>. Quick Cache needs write-access to this file. Permissions need to be <code>755</code> or higher.', true);
            }
            if (is_dir (WP_CONTENT_DIR) && !is_writable (WP_CONTENT_DIR))
            {
@@ -360,4 +360,4 @@ if (!class_exists ("c_ws_plugin__qcache_menu_pages"))
        }
    }
}
-?>
\ No newline at end of file
+?>
diff --git a/wp-content/plugins/quick-cache/includes/classes/wp-cache.inc.php b/wp-content/plugins/quick-cache/includes/classes/wp-cache.inc.php
--- a/wp-content/plugins/quick-cache/includes/classes/wp-cache.inc.php
+++ b/wp-content/plugins/quick-cache/includes/classes/wp-cache.inc.php
@@ -39,16 +39,16 @@ if (!class_exists ("c_ws_plugin__qcache_wp_cache"))
                /**/
                return apply_filters ("ws_plugin__qcache_add_wp_cache", true, get_defined_vars ());
            }
-           else if (file_exists (dirname (ABSPATH) . "/wp-config.php") && is_writable (dirname (ABSPATH) . "/wp-config.php"))
+           else if (file_exists (ABSPATH . "wp-config.php") && is_writable (ABSPATH . "wp-config.php"))
            {
-               $config = file_get_contents (dirname (ABSPATH) . "/wp-config.php");
+               $config = file_get_contents (ABSPATH . "wp-config.php");
                $config = preg_replace ("/^([\r\n\t ]*)(\<\?)(php)?/i", "<?php define('WP_CACHE', true);", $config);
                /**/
                eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                do_action ("ws_plugin__qcache_during_add_wp_cache", get_defined_vars ());
                unset ($__refs, $__v); /* Unset defined __refs, __v. */
                /**/
-               file_put_contents (dirname (ABSPATH) . "/wp-config.php", $config);
+               file_put_contents (ABSPATH . "wp-config.php", $config);
                /**/
                return apply_filters ("ws_plugin__qcache_add_wp_cache", true, get_defined_vars ());
            }
@@ -77,16 +77,16 @@ if (!class_exists ("c_ws_plugin__qcache_wp_cache"))
                /**/
                return apply_filters ("ws_plugin__qcache_delete_wp_cache", true, get_defined_vars ());
            }
-           else if (file_exists (dirname (ABSPATH) . "/wp-config.php") && is_writable (dirname (ABSPATH) . "/wp-config.php"))
+           else if (file_exists (ABSPATH . "wp-config.php") && is_writable (ABSPATH . "wp-config.php"))
            {
-               $config = file_get_contents (dirname (ABSPATH) . "/wp-config.php");
+               $config = file_get_contents (ABSPATH . "wp-config.php");
                $config = preg_replace ("/( ?)(define)( ?)(\()( ?)(['\"])WP_CACHE(['\"])( ?)(,)( ?)(0|1|true|false)( ?)(\))( ?);/i", "", $config);
                /**/
                eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                do_action ("ws_plugin__qcache_during_delete_wp_cache", get_defined_vars ());
                unset ($__refs, $__v); /* Unset defined __refs, __v. */
                /**/
-               file_put_contents (dirname (ABSPATH) . "/wp-config.php", $config);
+               file_put_contents (ABSPATH . "wp-config.php", $config);
                /**/
                return apply_filters ("ws_plugin__qcache_delete_wp_cache", true, get_defined_vars ());
            }
@@ -94,7 +94,7 @@ if (!class_exists ("c_ws_plugin__qcache_wp_cache"))
            {
                return apply_filters ("ws_plugin__qcache_delete_wp_cache", false, get_defined_vars ());
            }
-           else if (file_exists (dirname (ABSPATH) . "/wp-config.php") && !is_writable (dirname (ABSPATH) . "/wp-config.php"))
+           else if (file_exists (ABSPATH . "wp-config.php") && !is_writable (ABSPATH . "wp-config.php"))
            {
                return apply_filters ("ws_plugin__qcache_delete_wp_cache", false, get_defined_vars ());
            }
@@ -105,4 +105,4 @@ if (!class_exists ("c_ws_plugin__qcache_wp_cache"))
        }
    }
}
-?>
\ No newline at end of file
+?>
-- 
1.7.10