Forums

[Plugin: Pierre's Wordspew] wp-config fix (3 posts)

  1. Creative Slice
    Member
    Posted 2 years ago #

    There is a problem with a relative link to the wp-config file. To fix this modify line 8 in wordspew.php and line 19 in wordspew_admin.php

    BAD Code:
    $html = implode('', file("../../../wp-config.php"));

    GOOD Code:
    $html = implode('', file(get_bloginfo('wpurl')."/wp-config.php"));

    http://wordpress.org/extend/plugins/pierres-wordspew/

  2. jcow
    Member
    Posted 2 years ago #

    Plugin developers need to make sure to link to WP files using bloginfo('wpurl'). As WP gets more modular and configurable, it is important for developers to be sure they are using the provided modular, configurable variables.

    In this case if a user installs in a directory, the wp-config file was no longer available to the plugin since the path was hard-coded.

    Nice catch. Fixed it for me. :)

  3. Creative Slice
    Member
    Posted 2 years ago #

    Turns out the better way is to replace the if statement on both those files with this:

    if (!isset($table_prefix)) {
    	$html = file_get_contents("../../../wp-config.php");
    	$html = str_replace("require_once", "// ", $html);
    	$html = str_replace("<?php", "", $html);
    	eval($html);
    }

Topic Closed

This topic has been closed to new replies.

About this Topic