Theme colors cannot be set

When i go in 'options > theme options' i can see the 'theme colors' setting, but it appears empty when i select the arrow. BTW, it is a fresh install, and i have this issue for all themes which have a changeable color scheme. Does anyone have or had that problem? Thanks in advance for the help.

Another thing which is not related to the above problem: chililight2 theme (downloaded from theme section) has to be named Chili-Light2 in the ftp tree, otherwise, the images such as 'prev', 'next', 'loading', etc. cannot be displayed. If some admin passing by can take the point.

Comments

  • Check the files in the theme. If you have not uploaded the css folder of the theme, there will be no colors to select.
  • Styles folder containing css files is present for default theme, as well as for other themes with color scheme.

    Here is a screenshot to show the issue :
    http://img85.imageshack.us/img85/310/zp1nh1.gif
  • Perhaps there is some server configuration that is preventing PHP from browsing your folder for files. The dropdown is populated by the list of files ending in .css that are found in the theme's css folder.

    BTW, thanks for the note on chililight2 it is now fixed.
  • I found out that it is the same problem for spam filter selection and also for image and video watermark, the dropdown is empty. As you said it might be because of my ISP's server configuration.

    Is there an easy work around to solve that issue ? (except changing ISP :-p )
  • No, the data for all these dropdowns is obtained by browsing the folders.

    This is essentially the code we are using to get the file lists. `$root` is the full server path to the folder. `$suffix` is the filter (.css, .php, .png). $currentValue does not matter for testing.

    `function generateListFromFiles($currentValue, $root, $suffix) {

    chdir($root);

    $filelist = glob('*'.$suffix);

    sort($filelist);

    $list = array();

    foreach($filelist as $file) {

    $list[] = str_replace($suffix, '', $file);

    }

    print_r($list);

    }`

    The `print_r` replaced the code for generating the drop-down. You might try it stand-a-lone and see what it does. It also may give you talking points with your ISP.

    You could also add a `print_r($filelist);` to see what the glob call got returned.
  • I found out that for security reasons, glob function is not allowed on my ISP server. I tried to use the function safe_glob given here http://fr.php.net/manual/en/function.glob.php#71083 by adding it above function generateListFromFiles in admin-functions.php and replacing `$filelist = glob('*'.$suffix);` by `$filelist = safe_glob('*'.$suffix);` but no success so far. Since I don't know much about php, I'm stuck here. My ISP server version is 5.0.45 if it can help.
  • Did the safe_glob function cause any cgi errors? Or did it just not return the filelist?

    You have two options as I see it. (Assuming that there is not a correctable error in safe_glob.)

    1. Talk to your ISP and get them to enable the glob function for your installation.

    2. Manally set the options you want directly to the options table in the database.

    The rows you want are:

    name=Theme_colors
    value=css (without the .css suffix)

    name=spam_filter
    value=filter (without the .php suffix)

    name=watermark_image
    value=images/watermark.png

    name=video_watermark_image
    value=images/watermark-video.png
  • Update:

    I have tried the safe_glob code from the PHP manual. I think it is not looking in the correct directory. I will see if I can fix it to work. Let you know.
  • I have fixed the `safe_glop` function:

    `function safe_glob($pattern, $flags=0) {

    $split=explode('/',$pattern);

    $match=array_pop($split);

    $path=implode('/',$split);

    if (empty($path)) { $path = '.'; };

    if (($dir=opendir($path))!==false) {

    $glob=array();

    while(($file=readdir($dir))!==false) {

    if (fnmatch($match,$file)) {

    if ((is_dir("$path/$file"))||(!($flags&GLOB_ONLYDIR))) {

    if ($flags&GLOB_MARK) $file.='/';

    $glob[]=$file;

    }

    }

    }

    closedir($dir);

    if (!($flags&GLOB_NOSORT)) sort($glob);

    return $glob;

    } else {

    return false;

    }

    }`
  • I have found a solution in the meantime : replace `generateListFromFiles($currentValue, $themeroot , '.css');` by `generateListFromArray($currentValue, array('light', 'dark', 'sterile-light', 'sterile-dark'));` in the handleOption function of themeoption.php. The major drawback, is that you have to do it every time the generateListFromFiles function is called.

    I've tested the updated safe_glob function you did, it is working well and it is much better than my workaround. Thanks a lot. It is saving me the trouble of editing a lot of files.

    Thanks again for the help.
  • No problem. I just wish there were a reasonable way of testing for your situation. Until someone finds a way to figure out of glob works without generating an error message we will just have to deal with the people who run into this.

    I have added the save_glob function to the hacks section in trak. You should know that the next revision of zenpoto will be using glob in the class-albums.php file in the deleteAlbum function.
  • I have the same problem whith on my Free webhoster.
    I'm sure of what I have to do to "solve" the problem.
    Should I have to add the given code in the admin-functions.php file ?

    Thank you for helping me (and others for sure).
  • OK I understood how to do. It's working now. Thanks !
  • Seems like more and more people are seeing this restriction. The 1.1.4 release will make enabling this hack more convienient. There will be a define at the front of functions.php that can be changed to enable the code.

    Damino:

    I notice that there are several more calls on `glob()` than existed when the track article was written. You might want to do a search to find the places that need changing.
  • froggy Member
    i have the same problem with french ISP : free
    can you indicate what file i should modify ?

    thanks
Sign In or Register to comment.