Skip to content

Commit

Permalink
Revert PLUGIN_ORDER_SIGNATURE_EXTENSION fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLvr committed Jan 20, 2025
1 parent f308de7 commit c93b9de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions front/signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@

// Avoid access to another directory or to files that does not match allowed extension
if (
preg_match('/[\\\\\/]/', $sign) !== 0
|| preg_match('/\.(' . implode('|', array_map(function ($ext) {
return preg_quote($ext, '/');
}, PLUGIN_ORDER_SIGNATURE_EXTENSION)) . ')$/', $sign) === 0
preg_match('/(\\\\|\/)/', $sign) !== 0
|| preg_match('/\.' . preg_quote(PLUGIN_ORDER_SIGNATURE_EXTENSION, '/') . '$/', $sign) === 0
) {
header('HTTP/1.1 403 Forbidden');
exit();
Expand Down
2 changes: 1 addition & 1 deletion inc/link.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ public static function processMassiveActionsForOneItemtype(
foreach ($ids as $id) {
$ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
}
break;
return;
}

$order_item = new PluginOrderOrder_Item();
Expand Down
4 changes: 2 additions & 2 deletions inc/preference.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ public static function getFiles($directory, $ext)
if ($filename == ".." or $filename == ".") {
echo "";
} else {
if ($filetype == 'file' && in_array($extension, $ext)) {
if (in_array($ext, PLUGIN_ORDER_SIGNATURE_EXTENSION)) {
if ($filetype == 'file' && $extension == $ext) {
if ($ext == PLUGIN_ORDER_SIGNATURE_EXTENSION) {
$name = array_shift($basename);
if (strtolower($name) == strtolower($_SESSION["glpiname"])) {
$array_file[] = [$filename, $filedate, $extension];
Expand Down
4 changes: 2 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
}

if (!defined('PLUGIN_ORDER_TEMPLATE_EXTENSION')) {
define("PLUGIN_ORDER_TEMPLATE_EXTENSION", ["odt"]);
define("PLUGIN_ORDER_TEMPLATE_EXTENSION", "odt");
}
if (!defined('PLUGIN_ORDER_SIGNATURE_EXTENSION')) {
define("PLUGIN_ORDER_SIGNATURE_EXTENSION", ["png"]);
define("PLUGIN_ORDER_SIGNATURE_EXTENSION", "png");
}
/** @var array $CFG_GLPI */
global $CFG_GLPI;
Expand Down

0 comments on commit c93b9de

Please sign in to comment.