PDA

View Full Version : Escort-Templates: Fatal Bug in Yes/No-Fields (bool)



Juergen Mainka
May 26, 2013, 01:39 AM
Hi Flynaxers,

I'd found a fatal bug in the templates of the Escort-Version (4.1):

I you create a Yes/No-Field than it won't be stored in the database!!!!

Class rlFields.class.php (subdir admin) around line 245:

$alter = "ALTER TABLE `" . RL_DBPREFIX . "{$this -> source_table}` ADD `{$key}` ENUM( '0', '1' ) DEFAULT '{$info['Default']}' NOT NULL";
You define here the database field as an ENUM. How ever that's o.k.

In the templates (for example the reg_account.tpl around line 222) this code:

{elseif $field.Type == 'bool'}
<label><input type="radio" value="on" name="account[{$field.Key}]" {if $fVal.$fKey == 'on'}checked="checked"{elseif $field.Default}checked="checked"{/if} /> {$lang.yes}</label>
<label><input type="radio" value="off" name="account[{$field.Key}]" {if $fVal.$fKey == 'off'}checked="checked"{elseif !$field.Default}checked="checked"{/if} /> {$lang.no}</label>

You can see that in the template-code are the words "on" and "off" defined.
Replace "on" ==> "1" and "off" ==> "0"

It should be looks like:

{elseif $field.Type == 'bool'}
<label><input type="radio" value="1" name="account[{$field.Key}]" {if $fVal.$fKey == '1'}checked="checked"{elseif $field.Default}checked="checked"{/if} /> {$lang.yes}</label>
<label><input type="radio" value="0" name="account[{$field.Key}]" {if $fVal.$fKey == '0'}checked="checked"{elseif !$field.Default}checked="checked"{/if} /> {$lang.no}</label>


This must be changed in ALL template files related with bool fields.

The same bug is also in the new "Escort Sun Cocktail"-templates!!

Please update the templates ASAP. Changing the core-code (classes etc.) will end in more work like database update etc.

Regards
J. Mainka

Steffen Buschkemper
May 26, 2013, 09:50 AM
Hi Juergen,

I've looked at my script. I have the Flynax General Classified 4.1.
I can find the same in my template. But is this really a bug?
If so, then i think that it affects all flynax scripts and their templates.
I think the basic structure will be the same for all flynax scripts.

Best regards
Steffen

Oslo
May 26, 2013, 11:15 AM
Thanks Juergen Mainka,

I updated it.

Steffen Buschkemper
May 26, 2013, 12:42 PM
Hi Oslo,

this is a lot of work... :D



This must be changed in ALL template files related with bool fields.


Best regards
Steffen

Juergen Mainka
May 26, 2013, 01:37 PM
Yes Steffen, it's a bug.

The field can be created normally, all fine.

But if a seller uses the fields, the values won't stored in the database. That is the Problem.

For an Escort-Script a Yes/No-Field is beside the images and checkboxes the most important one... :D

Regards

Steffen Buschkemper
May 26, 2013, 02:07 PM
You're right.
Especially with the pictures in escort-script... :D
That would be fatal... ;)

Nice weekend
Steffen