Automated response: Flagrant text randomisation not working
The is-active check (based on days booked) is not performed correctly, meaning nothing is being picked.
Also the system-message and current message are randomised 50:50, even if no system-message is set. Ideally it would just use the current message if the system-message is blank.
I uploaded the support.php file for 7.1.6 and the flagrant text message worked, but when navigating back to the home page, the Images and Video carousels (and maybe more blocks below) were out of wack and I got the error message, "1532: Uncaught SyntaxError: unexpected token ILLEGAL"
I'm not sure how this would happen, and can't see an error on your site currently (I think you probably reverted). However I can say the change made in sources/support.php was as follows...
Replace:
function get_flagrant()
{
...
}
with:
function get_flagrant()
{
if (!addon_installed('flagrant')) return new Tempcode();
$system=(mt_rand(0,1)==0);
$_flagrant=NULL;
if ((!$system) || (get_option('system_flagrant')==''))
{
$_flagrant=persistant_cache_get('FLAGRANT');
if (is_null($_flagrant))
{
$flagrant=$GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT the_message FROM '.get_table_prefix().'text WHERE active_now=1 AND activation_time+days*60*60*24>'.strval(time()),true/*in case tablemissing*/);
if (is_null($flagrant))
{
persistant_cache_set('FLAGRANT',false);
} else
{
$_flagrant=get_translated_tempcode($flagrant);
persistant_cache_set('FLAGRANT',$_flagrant);
}
}
if ($_flagrant===false) $_flagrant=NULL;
}
if (is_null($_flagrant))
{
return make_string_tempcode(get_option('system_flagrant'));
} else
{
return do_lang_tempcode('_COMMUNITY_MESSAGE',$_flagrant);
}
}
I did immediately revert to the old file because the front page looked so bad. I would upload a screenshot here, but there isn't attachment upload function.
After uploading the new one, I had emptied the template and block cache before checking things out
I'd be happy to upload for you. I know we have admin access to your site, but I can't remember off-hand if we have FTP access or not. Just open a free ticket with provision of FTP details if you'd like :).
The is-active check (based on days booked) is not performed correctly, meaning nothing is being picked.
Also the system-message and current message are randomised 50:50, even if no system-message is set. Ideally it would just use the current message if the system-message is blank.
support.php is back-ported to 7.1.6 (upload to sources/).
I uploaded the support.php file for 7.1.6 and the flagrant text message worked, but when navigating back to the home page, the Images and Video carousels (and maybe more blocks below) were out of wack and I got the error message, "1532: Uncaught SyntaxError: unexpected token ILLEGAL"
Replace:
function get_flagrant()
{
...
}
with:
function get_flagrant()
{
if (!addon_installed('flagrant')) return new Tempcode();
$system=(mt_rand(0,1)==0);
$_flagrant=NULL;
if ((!$system) || (get_option('system_flagrant')==''))
{
$_flagrant=persistant_cache_get('FLAGRANT');
if (is_null($_flagrant))
{
$flagrant=$GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT the_message FROM '.get_table_prefix().'text WHERE active_now=1 AND activation_time+days*60*60*24>'.strval(time()),true/*in case tablemissing*/);
if (is_null($flagrant))
{
persistant_cache_set('FLAGRANT',false);
} else
{
$_flagrant=get_translated_tempcode($flagrant);
persistant_cache_set('FLAGRANT',$_flagrant);
}
}
if ($_flagrant===false) $_flagrant=NULL;
}
if (is_null($_flagrant))
{
return make_string_tempcode(get_option('system_flagrant'));
} else
{
return do_lang_tempcode('_COMMUNITY_MESSAGE',$_flagrant);
}
}
After uploading the new one, I had emptied the template and block cache before checking things out
(Click to enlarge)
$PHP_REP_FROM=array('\\',"\n",'$','"');
$PHP_REP_TO=array('\\\\','\n','\$','\\"');
$PHP_REP_TO_TWICE=array('\\\\\\\\','\\n','\\\\$','\\\\\"');
If that was corrupted somehow, that might cause a problem like this.
The other blocks looked normal, except the side panels had disappeared. I have to go out for a bit now, will check back later