SOLVED!
I had the same problem when I tried to enter apostrophes in Photo descriptions, Album descriptions and Batch Manager descriptions. (Maybe the problem occurs elsewhere, but I didn't search them out.) It just appeared when I upgraded to pwg 12.x .
I found out the sources of the problems and here's what I did. It's pretty simple.
(I did this on pwg 12.3 running php 8.1):
For
Photo descriptions: edit
piwigo/admin/picture_modify.php.
Look for this section of original code:
if ($conf['allow_html_descriptions'])
{
$data['comment'] = @$_POST['description'];
}
else
{
$data['comment'] = strip_tags(@$_POST['description']);
}
Modify two lines by adding addslashes():
if ($conf['allow_html_descriptions'])
{
$data['comment'] = addslashes(@$_POST['description']);
}
else
{
$data['comment'] = addslashes(strip_tags(@$_POST['description']));
}
For
Album descriptions: edit
piwigo/admin/cat_modify.php.
Look for this section of original code:
if ($conf['activate_comments'])
{
$data['commentable'] = isset($_POST['commentable'])? 'true':'false';
}
single_update(
CATEGORIES_TABLE,
$data,
array('id' => $data['id'])
);
Insert one line with addslashes():
if ($conf['activate_comments'])
{
$data['commentable'] = isset($_POST['commentable'])? 'true':'false';
}
$data['comment'] = addslashes($data['comment']);
single_update(
CATEGORIES_TABLE,
$data,
array('id' => $data['id'])
);
For
Batch Manager descriptions: edit
piwigo/admin/batch_manager_unit.php.
Look for this section of original code:
if ($conf['allow_html_descriptions'])
{
$data['comment'] = @$_POST['description-'.$row['id']];
}
else
{
$data['comment'] = strip_tags(@$_POST['description-'.$row['id']]);
}
Modify two lines by adding addslashes():
if ($conf['allow_html_descriptions'])
{
$data['comment'] = addslashes(@$_POST['description-'.$row['id']]);
}
else
{
$data['comment'] = addslashes(strip_tags(@$_POST['description-'.$row['id']]));
}
It works for me; I hope it works for you.