Skip to content

Commit

Permalink
Merge pull request #4507 from corentin-soriano/disable_drag_drop
Browse files Browse the repository at this point in the history
Add setting to disable drag and drop.
  • Loading branch information
nilsteampassnet authored Nov 30, 2024
2 parents c1f479b + ef27d19 commit dc96d97
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions includes/language/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@
'disable_user_edit_language' => 'Users can no longer change language',
'disable_user_edit_timezone' => 'Users can no longer change time zones',
'disable_user_edit_tree_load_strategy' => 'Users can no longer change tree loading strategy',
'disable_drag_drop' => 'Disable item drag and drop',
'encrypt_key' => 'Encryption key',
'errors' => 'errors',
'error_group_exist' => 'This folder already exists!',
Expand Down
1 change: 1 addition & 0 deletions includes/language/french.php
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@
'disable_user_edit_language' => 'Les utilisateurs ne peuvent plus changer de langue',
'disable_user_edit_timezone' => 'Les utilisateurs ne peuvent plus changer de fuseau horaire',
'disable_user_edit_tree_load_strategy' => 'Les utilisateurs ne peuvent plus changer de stratégie de chargement',
'disable_drag_drop' => 'Désactiver le glisser-déposer d'objets',
'bruteforce_wait' => 'Trop de tentatives échouées, votre compte est bloqué jusqu'à : ',

);
9 changes: 9 additions & 0 deletions pages/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,15 @@
</div>
</div>

<div class='row mb-2 option' data-keywords="tree load strategy">
<div class='col-10'>
<?php echo $lang->get('disable_drag_drop'); ?>
</div>
<div class='col-2'>
<div class='toggle toggle-modern' id='disable_drag_drop' data-toggle-on='<?php echo isset($SETTINGS['disable_drag_drop']) === true && $SETTINGS['disable_drag_drop'] === '1' ? 'true' : 'false'; ?>'></div><input type='hidden' id='disable_drag_drop_input' value='<?php echo isset($SETTINGS['disable_drag_drop']) && $SETTINGS['disable_drag_drop'] === '1' ? '1' : '0'; ?>' />
</div>
</div>

<div class='row mb-2 option' data-keywords="tree load strategy">
<div class='col-10'>
<?php echo $lang->get('disable_user_edit_tree_load_strategy'); ?>
Expand Down
2 changes: 0 additions & 2 deletions sources/identify.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ function identifyUser(string $sentData, array $SETTINGS): bool
if (empty($userInitialData['skip_anti_bruteforce'])
|| !$userInitialData['skip_anti_bruteforce']) {

error_log('test');

// Add failed authentication log
addFailedAuthentication($username, getClientIpServer());
}
Expand Down
5 changes: 4 additions & 1 deletion sources/items.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -4359,13 +4359,16 @@
}
}

// Is drag and drop enabled?
$dragDrop = (int) $SETTINGS['disable_drag_drop'] !== 1;

// Now finalize the data to send back
$html_json[$record['id']]['rights'] = $right;
$html_json[$record['id']]['perso'] = 'fa-tag mi-red';
$html_json[$record['id']]['sk'] = $itemIsPersonal === true ? 1 : 0;
$html_json[$record['id']]['display'] = $right > 0 ? 1 : 0;
$html_json[$record['id']]['open_edit'] = in_array($right, array(40, 50, 60, 70)) === true ? 1 : 0;
$html_json[$record['id']]['canMove'] = in_array($right, array(30, 60, 70)) === true ? 1 : 0;
$html_json[$record['id']]['canMove'] = in_array($right, array(30, 60, 70)) === true ? (int) $dragDrop : 0;

//*************** */

Expand Down

0 comments on commit dc96d97

Please sign in to comment.