Fixed a problem where image names specified with quotes or half quotes would crash the macro.

This commit is contained in:
JT Smith 2002-07-11 00:27:22 +00:00
parent cbcb32922d
commit 944165ec57
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ sub _replacement {
my (@param, $temp, %data, $image);
tie %data, 'Tie::CPHash';
@param = WebGUI::Macro::getParams($_[0]);
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
%data = WebGUI::SQL->quickHash("select * from images where name=".quote($param[0]));
$image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$temp = '<img src="'.$image->getURL.'" '.$data{parameters}.'>';
return $temp;

View file

@ -22,7 +22,7 @@ sub _replacement {
my (@param, $image, %data);
tie %data, 'Tie::CPHash';
@param = WebGUI::Macro::getParams($_[0]);
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
%data = WebGUI::SQL->quickHash("select * from images where name=".quote($param[0]));
$image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
return $image->getURL;
}