Summary:
multiple "Notice: Undefined index: " errors in class.GuestbookFrontend.php
Detailed Description:
After upgrading to CMSMS 1.11.7 I am getting multiple errors:
Notice: Undefined index: show_entry in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 124
Notice: Undefined index: showaddform in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 579
Notice: Undefined index: hide_insertbutton_after_post in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 580
Notice: Undefined index: show_entry in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 124
Notice: Undefined index: sortasc in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 841
Notice: Undefined index: sortasc in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 847
And after adding a message even more:
Notice: Undefined index: timespan in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 478
Notice: Undefined index: sender_email in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 505
Notice: Undefined index: shownow in
../modules/Guestbook/lib/classes/module/class.GuestbookFrontend.php on line 361
Solution is very easy. Check all incoming parameters with isset:
from:
if ($params['show_entry'] != '')
{
$mode = 'entry';
}
to:
if (isset($params['show_entry']))
{
$mode = 'entry';
}
from:
$this->SetHideInsertButtonAfterPost($params['hide_insertbutton_after_post'] ==
'1' ? true : false);
to:
$this->SetHideInsertButtonAfterPost((isset($params['hide_insertbutton_after_post'])
&& $params['hide_insertbutton_after_post']) == '1' ? true : false);
etc
If a add all parameters there are no errors:
{cms_module module='Guestbook' smiley='0' shownow='1' captcha='0' sortasc='0'
show_entry='' showaddform='0' hide_insertbutton_after_post='0' timespan='60'}
but then it will fail in the search results. So better to fix it in the source
:)
If you add me as developer to the project I will fix it and check it in.