CSS/Theme support broken after upgrade

@arubtsov So at that point phplist thinks that it does not have any themes available. Can you now add some lines to file connect.php
First try changing line 107 from

while ($th = readdir($d)) {

to

while (false !== ($th = readdir($d))) {

Then see if that has any effect.
If not then add these lines

line 106 is

$d = opendir($themedir);

Add this immediately before

var_dump($themedir);

Then line 108 is

if (!in_array($th,

add this line before line 108

var_dump($th);

string(70) “/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui/” string(9) “dressprow” string(10) “.gitignore” string(2) “…” string(19) “phplist-ui-bootlist” string(1) “.” string(7) “default” array(0) { }

array(0) {} comes from index.php i think

@arubtsov Can you try changing line 104 from

$themedir = dirname(__FILE__).'/ui/';

to

$themedir = dirname(__FILE__).'/ui';

i.e. just remove the trailing / character.

string(69) “/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui” string(9) “dressprow” string(10) “.gitignore” string(2) “…” string(19) “phplist-ui-bootlist” string(1) “.” string(7) “default” array(0) { }

Same result exept first var is 69 chars

@arubtsov Ok. Can you replace the whole while loop by this, to save you adding individual lines

while ($th = readdir($d)) {
    var_dump($th);
    var_dump(is_dir($themedir.'/'.$th));
    var_dump(is_file($themedir.'/'.$th.'/theme_info'));
    if (!in_array($th,
            array_keys($THEMES)) && is_dir($themedir.'/'.$th) && is_file($themedir.'/'.$th.'/theme_info')
    ) {
        $themeData = parse_ini_file($themedir.'/'.$th.'/theme_info');
        var_dump($themeData);
        if (!empty($themeData['name']) && !empty($themeData['dir']) && !isset($themeNames[$themeData['name']])) {
            var_dump($themeData);
            $THEMES[$th] = $themeData;
            $themeNames[$themeData['name']] = $th;
        }
    }
}
var_dump($THEMES);

string(69) “/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui” string(9) “dressprow” bool(true) bool(true) NULL string(10) “.gitignore” bool(false) bool(false) string(2) “…” bool(true) bool(false) string(19) “phplist-ui-bootlist” bool(true) bool(true) NULL string(1) “.” bool(true) bool(false) string(7) “default” bool(true) bool(true) NULL array(0) { } array(0) { }

@arubtsov I didn’t ask before what your web server environment is?

Can you try changing one of the theme_info files, say ui/dressprow/theme_info from

name=Dressprow
dir=phplist-ui-dressprow

to

name=Dressprow
dir="phplist-ui-dressprow"

i.e. put the characters after the = in double quotes

Same. Nothing changes

@arubtsov Can you give me ftp access to your web server? send me a private message with the access details if that is ok.

Can you change this

var_dump(is_file($themedir.'/'.$th.'/theme_info'));

to
var_dump(is_readable($themedir.’/’.$th.’/theme_info’));

string(69) “/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui” string(9) “dressprow” bool(true) bool(true) NULL string(10) “.gitignore” bool(false) bool(false) string(2) “…” bool(true) bool(false) string(19) “phplist-ui-bootlist” bool(true) bool(true) NULL string(1) “.” bool(true) bool(false) string(7) “default” bool(true) bool(true) NULL array(0) { } array(0) { }

How to send private message? I don’t find. So I send ftp details via your page http://www.dcameron.me.uk

@arubtsov Just click my photo/name, then there is a button to send a private message. I will also need access to phplist.

OK i have the ftp details, but your web site does not seem to be accessible - ruby-project.com

Looks strange. I just have test it again - it works.
I also send you admin access details
site http://ruby-project.com/lists331/admin/

@arubtsov It must be blocking external access in some way

I enabled error reporting. When you go to the login page is there any extra output?

Please try again. There was some restrictions.

And there are some errors in access log file:

[Fri Feb 24 15:53:35.532573 2017] [:error] [pid 26823] [client 93.80.31.199:60054] PHP Warning: parse_ini_file() has been disabled for security reasons in /var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/connect.php on line 131, referer: http://ruby-project.com/lists331/admin/?page=home&tk=143f4141ad7a912c2858766b0e1c4d9c
[Fri Feb 24 15:53:35.532687 2017] [:error] [pid 26823] [client 93.80.31.199:60054] PHP Warning: is_readable(): open_basedir restriction in effect. File(/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui/.gitignore/theme_info) is not within the allowed path(s): (/var/www/ruby-project-com/data:.) in /var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/connect.php on line 127, referer: http://ruby-project.com/lists331/admin/?page=home&tk=143f4141ad7a912c2858766b0e1c4d9c

… and many others. Maybe problem in open_basedir restriction?

It works!!!

string(69) “/var/www/ruby-project-com/data/www/ruby-project.com/lists331/admin/ui” string(9) “dressprow” bool(true) bool(true) array(2) { [“name”]=> string(9) “Dressprow” [“dir”]=> string(20) “phplist-ui-dressprow” } array(2) { [“name”]=> string(9) “Dressprow” [“dir”]=> string(20) “phplist-ui-dressprow” } string(10) “.gitignore” bool(false) bool(false) string(2) “…” bool(true) bool(false) string(19) “phplist-ui-bootlist” bool(true) bool(true) array(3) { [“name”]=> string(8) “Trevelin” [“dir”]=> string(19) “phplist-ui-bootlist” [“deployrm”]=> string(21) “bootstrap less vendor” } array(3) { [“name”]=> string(8) “Trevelin” [“dir”]=> string(19) “phplist-ui-bootlist” [“deployrm”]=> string(21) “bootstrap less vendor” } string(1) “.” bool(true) bool(false) string(7) “default” bool(true) bool(true) array(2) { [“name”]=> string(15) “phpList Default” [“dir”]=> string(7) “default” } array(2) { [“name”]=> string(15) “phpList Default” [“dir”]=> string(7) “default” } array(3) { [“dressprow”]=> array(2) { [“name”]=> string(9) “Dressprow” [“dir”]=> string(20) “phplist-ui-dressprow” } [“phplist-ui-bootlist”]=> array(3) { [“name”]=> string(8) “Trevelin” [“dir”]=> string(19) “phplist-ui-bootlist” [“deployrm”]=> string(21) “bootstrap less vendor” } [“default”]=> array(2) { [“name”]=> string(15) “phpList Default” [“dir”]=> string(7) “default” } } array(2) { [“dressprow”]=> array(2) { [“name”]=> string(9) “Dressprow” [“dir”]=> string(20) “phplist-ui-dressprow” } [“phplist-ui-bootlist”]=> array(3) { [“name”]=> string(8) “Trevelin” [“dir”]=> string(19) “phplist-ui-bootlist” [“deployrm”]=> string(21) “bootstrap less vendor” } }

Yes, it was the parse_ini_file function. I have replaced that with two functions:
file_get_contents and parse_ini_string

I don’t know why that function has been disabled, maybe you can ask.

Thank you very much! And what changes I have to do in new installation?

You need to replace line 111 in connect.php

    $themeData = parse_ini_file($themedir.'/'.$th.'/theme_info');

by

    $themeData = file_get_contents($themedir.'/'.$th.'/theme_info');
    $themeData = parse_ini_string($themeData);

Also, in your config.php file this line

$pageroot = 'lists331';

should be

$pageroot = '/lists331';

Otherwise phplist will not generate the correct urls.

Ok! Thank you so much!

Will this fix be included in the next version?

1 Like