Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

JQThickBox

135

Comments

  • stash can you share "JQSpoiler" with us?
  • Ahhh!!! I don't understand. I'm not getting the loading image at all. Everything else about it works. I am using a new installation of Vanilla and a new install of this plugin.
  • And a link to your forum where this is failing is...? Have you tried emptying your cache and forcing a full page reload? (Ctrl+F5)
  • ALERT, somehow my /conf/settings.php got corrupted with this extention.
    After using it for about an hour the site was not reachable, after figuring out what happend i noticed the settings.php only contained the following:
    $Configuration['JQTHICKBOX_VERSION_EXT'] = '1.1.3'; $Configuration['JQTHICKBOX_VERSION_JS'] = '2.1.1'; ?>
    All the rest was gone. Don't know why this happend, i didn't even changed any settings.
  • same thing happened to me. it killed my whole conf/settings.php.
  • Hmm, I'm very sorry about this guys - anyone who knows more about Vanilla than me got ideas on this? It doesn't happen for me (obviously), but I'd like to get it fixed if it's happening to others...
  • It happend again, just after a few hours use.
    I was not even logged in, so it happens if a user is using the extention.
    I disabled the extention, but i still think it is very cool and want to enable it again.

    I will walk through the code and let you know if i find something that worries me that can be the reson for this. Get back to you on this one.
  • I just noticed something in the ThankfulPeople add-on:
    if (!AppendToConfigurationFile($Configuration['APPLICATION_PATH'].'conf/database.php', $Structure)) $Errors = 1; if ($Errors == 0) { AddConfigurationSetting($Context, 'THANKFULPEOPLE_VERSION', '1.0'); } else { // Could not save configuration $NoticeCollector->AddNotice($Context->GetDefinition('ErrCreateConfig')); }
    When we develop add-ons and add settings, should we be doing something like this? Does this mean there is a setting to either append to the config file or create a new one?
  • Thanks little_peet - I'm not sure what I've done wrong on this one - all help greatly appreciated.

    jimw - that looks like it should make sense. Can we get an answer on this from Mark please?
  • I think the problem is the following:

    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.1.3');
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1.1');

    Those 2 lines are called every single time the default is loading.
    The same is happening in the jquery addon.
    So for every page load the settings.php is changed 2 times. On a heavily used system the settings.php will be rewritten several times in a short time span.

    When several processes try to rewrite the same file at the same time this can be a problem with the vanilla code.
    read the thread http://lussumo.com/community/discussion/6428/ about the problem with the race-conditions in the vanilla function:SaveSettingsToFile

    This is a bug in Vanilla, So i ask you are those lines for the settings realy nessecary? or can i just remove them.
  • little_peet: I never thought of that. We need some type of IF check to see if the Setting already exists and maybe check the version number. If not the same, then update it or replace it.
  • this will do the trick i think not tested yet!:

    if (!array_key_exists('JQTHICKBOX_VERSION_EXT', $Configuration))
    {
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.1.3');
    }
    else if ($Configuration['JQTHICKBOX_VERSION_EXT'] != '1.1.3'){
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.1.3');
    }
    if (!array_key_exists('JQTHICKBOX_VERSION_JS', $Configuration))
    {
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1.1');
    }
    else if ($Configuration['JQTHICKBOX_VERSION_JS'] != '2.1.1'){
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1.1');
    }
  • Btw another question, is this the latest thickbox script, i see on the thickbox page its version 3. Is there a way to use that one, since it appears to be smallerand has a few bug fixes. Or is it already using that version?
  • It's currently running on a hacked version of 2.1 with fixes from various people. I haven't updated it to TB3 just yet for the following reasons:
    1. people are reporting issues with TB3 on Cody's TB forums that they didn't have with TB2
    2. My one's already highly optimised, so you won't actually gain all that much by going to TB3
    3. I've already got most of the fixes in TB3 (there are a couple that aren't in there yet, but most are)
    4. My wife gave birth to our first child nearly 4 weeks ago and I've not had time to think abut anything else just yet.
    I'm planning on updating the plugin with an admin section where you can pick and choose which version of TB you use via a simple drop down. If you desperately want TB3 now, then just drop in the .js file and overwrite the current one - it should work just fine.

    Those settings aren't essential just yet, so you can probably remove them without any problems. Has anyone given those if statements a go? Do they stop the problem from happening? If someone can confirm this to me I'll get the extension updated, only I don't have time to test at the moment.

    Thanks for everyone's help :)
  • My wife gave birth to our first child nearly 4 weeks ago and I've not had time to think abut anything else just yet.

    Not like you need it, but you have my permission to selfishly attend to your family. :) Congratulations!
  • Heh, thanks ;) But if those changes can be tested and proven to work I'll gladly update the extension - just not enough time to actually do the testing myself - also, since I don't get the problem, I can't really test it anyhow ;) If little_peet and ithcy could give those changes a test that would be great.
  • if (!array_key_exists('JQTHICKBOX_VERSION_EXT', $Configuration))
    {
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.1.3');
    }
    if (!array_key_exists('JQTHICKBOX_VERSION_JS', $Configuration))
    {
    AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1.1');
    }

    This code will stop it from adding it every single page call, the version check above does not work.

    btw this is not the only extention with this problem, extention with this problem found:
    JQthickbox
    Jquery
    Discussion view counters
    zip2mail

    The best solution for this problem is to fix the vanilla framework code to check in the "AddConfigurationSetting" functions a check if it already exists and if so if the value is different. But hey, the site clearly tells us we can not modify any code in there :)

    But if you don't care about that replace the function "AddConfigurationSetting" in the \library\framework\framework.functions.php I have tested it briefly on my test server and didn't encounter any problems. Maybe if there is some one out there that has a test server also it can be tested some more.

    function AddConfigurationSetting(&$Context, $SettingName, $SettingValue = '1') { if ((!array_key_exists($SettingName, $Context->Configuration))|($Context->Configuration[$SettingName]!=$SettingValue)){ $Context->Configuration[$SettingName] = ''; $SettingsManager = $Context->ObjectFactory->NewContextObject($Context, 'ConfigurationManager'); $SettingsFile = $Context->Configuration['APPLICATION_PATH'].'conf/settings.php'; $SettingsManager->DefineSetting($SettingName, $SettingValue, 1); $SettingsManager->SaveSettingsToFile($SettingsFile); } }

    Is there some one that knows how to contact the vanilla theme. I think this should go in to the new version, or a variant of this, this drastically reduces file writes on the server.
  • OK, you've given me some stuff to think about and I've come up with a possible fix that seems to work for me. I'm using this to learn PHP so please be kind :)

    I think the following will work, but does anyone who knows what they're doing with PHP see any problems with it?

    $JQTBext = '1.1.4'; $JQTBjs = '2.1.1'; // Set the Extension and JavaScript version numbers. if (!array_key_exists('JQTHICKBOX_VERSION_EXT', $Configuration) || ($Configuration['JQTHICKBOX_VERSION_EXT'] != $JQTBext)) { AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', $JQTBext); } if (!array_key_exists('JQTHICKBOX_VERSION_JS', $Configuration) || ($Configuration['JQTHICKBOX_VERSION_JS'] != $JQTBjs)) { AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', $JQTBjs); }
  • i have my code modification of the AddConfigurationSetting function in the forum framework now running for 3 days on my production server, the config file has not been cleared anymore. Best of all if you change that function in the core it will fix all addons that are "badly" programmed with now check.
  • Uploaded version 1.1.4 of JQThickBox.
This discussion has been closed.