Fix on permission test

This commit is contained in:
Laurent Destailleur 2024-09-06 16:47:50 +02:00
parent 1ee98df0d7
commit 0f979a31f3
4 changed files with 7 additions and 7 deletions

View file

@ -100,7 +100,7 @@ if (empty($conf->project->enabled)) {
*/
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
{
global $user, $conf, $langs, $mysoc;
global $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
@ -172,7 +172,7 @@ if ($reshook < 0) {
}
// Action called when page is submitted
if (empty($reshook) && $action == 'add') {
if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public ssubmission. Check is done the constant to enable feature + mitigation.
$error = 0;
$urlback = '';

View file

@ -124,7 +124,7 @@ if (empty($conf->eventorganization->enabled)) {
*/
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
{
global $user, $conf, $langs, $mysoc;
global $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
@ -196,7 +196,7 @@ if ($reshook < 0) {
}
// Action called when page is submitted
if (empty($reshook) && $action == 'add') {
if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public ssubmission. Check is done on the secureket + mitigation.
$error = 0;
$urlback = '';

View file

@ -125,7 +125,7 @@ if (empty($conf->eventorganization->enabled)) {
*/
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
{
global $user, $conf, $langs, $mysoc;
global $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
@ -197,7 +197,7 @@ if ($reshook < 0) {
}
// Action called when page is submitted
if (empty($reshook) && $action == 'add') {
if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public ssubmission. Check is done on the secureket + mitigation.
$error = 0;
$urlback = '';

View file

@ -662,7 +662,7 @@ class CodingPhpTest extends CommonClassTest
$filecontentaction = $filecontent;
}
preg_match_all('/if.*\(\s*\$action\s*==\s*[\'"][a-z]+[\'"].*/', $filecontentaction, $matches, PREG_SET_ORDER);
preg_match_all('/if.*\$action\s*==\s*[\'"][a-z\-]+[\'"].*/', $filecontentaction, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
if (!preg_match('/\$user->hasR/', $val[0])
&& !preg_match('/\$permission/', $val[0])