diff --git a/index.php b/index.php index 8e41390..a61ea1a 100644 --- a/index.php +++ b/index.php @@ -1,144 +1,144 @@
createQuery( [
'action' => 'query',
'list' => 'categorymembers',
'cmtitle' => 'Category:' . $_POST['catname'],
] );
$options = [];
array_push($options, 'mode=' . $_POST['mode']);
if ($_POST['caption'] != "") {
- array_push($options, 'caption="' . $_POST['caption'] . '"');
+ array_push($options, 'caption="' . htmlentities($_POST['caption']) . '"');
}
if ($_POST['widths'] != "") {
- array_push($options, 'widths=' . $_POST['widths'] . 'px');
+ array_push($options, 'widths=' . htmlentities($_POST['widths']) . 'px');
}
if ($_POST['heights'] != "") {
- array_push($options, 'heights=' . $_POST['heights'] . 'px');
+ array_push($options, 'heights=' . htmlentities($_POST['heights']) . 'px');
}
if ($_POST['perrow'] != "") {
- array_push($options, 'perrow=' . $_POST['perrow']);
+ array_push($options, 'perrow=' . htmlentities($_POST['perrow']));
}
if (isset($_POST['showfilename'])) {
array_push($options, 'showfilename=yes');
}
if (isset($_POST['showthumbnails'])) {
array_push($options, 'showthumbnails');
}
echo('<gallery ' . implode(' ', $options) . "> \n");
foreach( $queries as $query ) {
if (sizeof($query->query->categorymembers) > 0) {
$files = $query->query->categorymembers;
foreach ($files as $file) {
if($file->ns == 6) {
echo($file->title . "\n");
}
}
} else {
echo('WARNING! The category you want to generate a gallery from is empty.');
}
}
echo('<gallery/>');
}
?>
Created by Ferdinando Traversa - Contact him at wiki@traversa.me - Source: on Github - v 1.0+
Created by Ferdinando Traversa - Contact him at wiki[at]traversa.me - Source: on Github - v 1.1 - Thanks to Valerio Bozzolan, especially for his glorious MediaWiki framework for PHP.\ No newline at end of file