WordPress.org

Ready to get started?Download WordPress

Forums

Pricing Table
is_dir error loading modules (3 posts)

  1. Brian JM
    Member
    Posted 2 years ago #

    The three load functions - load_styles, load_scripts, and load_modules produce errors on my server:

    Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(..) is not within the allowed path(s): (/var/www/<MY WEBSITE>/httpdocs:/tmp) in /var/www/<MY WEBSITE>/httpdocs/wp-content/plugins/pricing-table/libs/class.plugin.php on line 29
    [and also 27 and forty-something]

    It seems to me that the problem is that the function scours the directory and messes up is_dir when feeding it the .. directory.

    This error is actually extremely easy to fix. I just added if ($file == '..') continue; But I have a suspicion you could just switch the extension evaluation and the directory test:

    if( end(explode(".",$file))=='css' && !is_dir($file) )
    	wp_enqueue_style(uniqid(),$cssurl.$file);

    OR

    function load_styles(){
        $dir = is_admin()?'admin':'site';
        $cssdir = $this->plugin_dir.'/css/'.$dir.'/';
        $cssurl = $this->plugin_url.'/css/'.$dir.'/';
        $files = scandir($cssdir);
        foreach($files as $file){
    	if ($file == '..')   // * Added lines
    		continue;    // *
            if(!is_dir($file)&&end(explode(".",$file))=='css')
    		wp_enqueue_style(uniqid(),$cssurl.$file);
        }
    }

    Hope this helps y'all fix the problem.

    http://wordpress.org/extend/plugins/pricing-table/

  2. Brian JM
    Member
    Posted 2 years ago #

    BTW, All of those functions are the in the lib/class.plugin.php file in case there was unclear.

  3. Shaon
    Member
    Plugin Author

    Posted 2 years ago #

    Hello Brian, thanks for your your help. I'm clearing this and updating asap.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic