In the module using a XOOPS Comment function, post of a comment causes a fatal error.
This module passes extraparams to the XOOPS side.
The definition of xoops_version.php is as follows.
//****************************************************************/
// Comments
$modversion['hasComments'] = 1;
$modversion['comments']['itemName'] = 'xoops_imageid';
$modversion['comments']['pageName'] = 'view_photo.php';
$modversion['comments']['extraParams'] = array('albumName', 'id');
//****************************************************************/
This problem is caused by XC Legacy 2.1.1, but not caused by Xoops 2.0.16a JP.
The value of extraparams need to be embedded at 'hidden' of HTML_FORM in the stage which opened the comment_new screen.
When a comment screen is opened, this value is set in Xoops 2.0.16a JP but not set in XC Legacy 2.1.1.
In the case of Xoops 2.0.16a JP:
//*******************************************************************************/
<form name='commentform' id='commentform' action='comment_post.php'
method='post' onsubmit='return xoopsFormValidate_commentform();'>
......
<input type='hidden' name='albumName' id='albumName' value='album01' />
<input type='hidden' name='id' id='id' value='01_G' />
......
</form>
//*******************************************************************************/
The value (albumName & id) is set correctly.
It's right.
In the case of XC Legacy 2.1.1:
//*******************************************************************************/
<form action="comment_post.php" method="post">
......
<input name="com_exparams" id="legacy_xoopsform_com_exparams" type="hidden" />
......
</form>
//*******************************************************************************/
The value is not set correctly but is blank.
It is not right.
Logged In: YES
user_id=1102607
Originator: NO
This bug may be the same cause as #1779754.
Logged In: YES
user_id=1774907
Originator: NO
/include/comment_new.php Line 139-140
[code]
$extraParams = array();
if ('system' != $xoopsModule->getVar('dirname')) {
$comment_config = $xoopsModule->getInfo('comments');
if (isset($comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
$myts =& MyTextSanitizer::getInstance();
foreach ($comment_config['extraParams'] as $extra_param) {
// This routine is included from forms accessed via both GET and POST
if (isset($_POST[$extra_param])) {
$hidden_value = $myts->stripSlashesGPC($_POST[$extra_param]);
} elseif (isset($_GET[$extra_param])) {
$hidden_value = $myts->stripSlashesGPC($_GET[$extra_param]);
} else {
$hidden_value = '';
}
$extraParams[$extra_param] = $hidden_value;
}
}
}
$renderTarget->setAttribute('extraParams', $extraParams);
[/code]
/html/modules/legacy/templates/legacy_comment_edit.html Line 19-20
[code]
<{foreach from=$extraParams key='key' item='value'}>
<{xoops_input type='hidden' name=$key value=$value}>
<{/foreach}>
[/code]
Logged In: YES
user_id=1102607
Originator: NO
Thanks okuhiki! Nice patch!
I got to understand what this bug is.
Logged In: YES
user_id=1102607
Originator: NO
I did not fix this bug in 2.1.2, because I could not keep enough time to work this. This bug will be fixed in 2.1.3.
Logged In: YES
user_id=1102607
Originator: NO
Fixed at 2.1.4.