Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ajax/planning.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
exit;
}

/** @var array $CFG_GLPI */
/** @var \DBmysql $DB */
global $DB, $CFG_GLPI;

if ($_REQUEST["action"] == "add_tickettask") {
Expand Down Expand Up @@ -151,7 +153,6 @@

echo json_encode($event);
} elseif ($_REQUEST["action"] == "update_task") {

$div = PluginTaskdropCalendar::addTask();
$div .= PluginTaskdropCalendar::addReminder();
echo $div;
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-deprecation-rules": "^2.0"
"phpstan/phpstan-deprecation-rules": "^2.0",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"optimize-autoloader": true,
Expand Down
15 changes: 8 additions & 7 deletions inc/calendar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static function getTypeName($nb = 0)

public static function addTask()
{
/** @var \DBmysql $DB */
global $DB;

$div = "<h3>" . __('Plan this task') . "</h3>";
Expand Down Expand Up @@ -74,8 +75,7 @@ public static function addTask()
$rand = rand();
$div .= "<div id ='task_" . $rand . "' class='overflow-auto fc-event-external event_type text-break' style='max-width:400px;max-height:150px;cursor:grab;padding:2px;margin:2px;background-color: ";
$div .= $value['color'] . ";' tid=" . $row['task_id'] . " action='add_tickettask'>";
$div .= Toolbox::addslashes_deep(Toolbox::stripTags($row['task_content'])) . "</div>";
//$div .= Html::showToolTip($row['task_content'], ['linkid' => 'task_'.$rand, 'display' => false]);
$div .= htmlspecialchars(Toolbox::stripTags($row['task_content'])) . "</div>";
}
$query = [
'FROM' => 'glpi_changetasks',
Expand All @@ -87,7 +87,7 @@ public static function addTask()
];
foreach ($DB->request($query) as $id => $row) {
Toolbox::logInFile('taskndrop2', print_r($row, true));
$div .= "<div class='overflow-auto fc-event-external event_type text-break' style='max-width:400px;max-height:150px;cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_changetask'>" . Toolbox::addslashes_deep(Toolbox::stripTags($row['content'])) . "</div>";
$div .= "<div class='overflow-auto fc-event-external event_type text-break' style='max-width:400px;max-height:150px;cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_changetask'>" . htmlspecialchars(Toolbox::stripTags($row['content'])) . "</div>";
}
}
} else {
Expand Down Expand Up @@ -115,7 +115,7 @@ public static function addTask()
foreach ($DB->request($query) as $id => $row) {
$div .= "<div class='overflow-auto fc-event-external text-break' style='max-height:150px;max-width:400px;cursor:grab;padding:2px;margin:2px;background-color: ";
$div .= $value['color'] . ";' tid=" . $row['task_id'] . " action='add_tickettask'>";
$div .= Toolbox::addslashes_deep(Toolbox::stripTags($row['task_content'])) . "</div>";
$div .= htmlspecialchars(Toolbox::stripTags($row['task_content'])) . "</div>";
}
$query = [
'FROM' => 'glpi_changetasks',
Expand All @@ -126,7 +126,7 @@ public static function addTask()
],
];
foreach ($DB->request($query) as $id => $row) {
$div .= "<div class='overflow-auto fc-event-external text-break' style='max-width:400px;max-height:150px;cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_changetask'>" . Toolbox::addslashes_deep(Toolbox::stripTags($row['content'])) . "</div>";
$div .= "<div class='overflow-auto fc-event-external text-break' style='max-width:400px;max-height:150px;cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_changetask'>" . htmlspecialchars(Toolbox::stripTags($row['content'])) . "</div>";
}
}
}
Expand All @@ -135,9 +135,9 @@ public static function addTask()
return $div;
}


public static function addReminder()
{
/** @var \DBmysql $DB */
global $DB;

$div = "<h3>" . __('Planning reminder') . "</h3>";
Expand All @@ -154,7 +154,7 @@ public static function addReminder()
],
];
foreach ($DB->request($query) as $id => $row) {
$div .= "<div class='fc-event-external' style='cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_reminder'>" . Toolbox::addslashes_deep(Toolbox::stripTags($row['name'])) . "</div>";
$div .= "<div class='fc-event-external' style='cursor:grab;padding:2px;margin:2px;background-color: " . $value['color'] . ";' tid=" . $row['id'] . " action='add_reminder'>" . htmlspecialchars(Toolbox::stripTags($row['name'])) . "</div>";
}
}
}
Expand All @@ -164,6 +164,7 @@ public static function addReminder()

public static function listTask($params)
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;

$options = $params['options'];
Expand Down
1 change: 1 addition & 0 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function plugin_taskdrop_check_config($verbose = false)

function plugin_init_taskdrop()
{
/** @var array $PLUGIN_HOOKS */
global $PLUGIN_HOOKS;

$PLUGIN_HOOKS['csrf_compliant']['taskdrop'] = true;
Expand Down
10 changes: 10 additions & 0 deletions tools/codesniffer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

TOOL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

# if exist vendor/bin/phpcbf, use it
if [ -f "$TOOL_DIR/../vendor/bin/phpcbf" ]; then
cd "$TOOL_DIR/.."
vendor/bin/phpcbf
exit 0
fi
18 changes: 12 additions & 6 deletions tools/migrate_accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ function plugin_accounts_AddRoundKey($state, $w, $rnd, $Nb)
function plugin_accounts_SubBytes($s, $Nb)
{
// apply SBox to state S
$Sbox = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
$Sbox = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
Expand All @@ -203,7 +204,8 @@ function plugin_accounts_SubBytes($s, $Nb)
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16];
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16,
];
for ($r = 0; $r < 4; $r++) {
for ($c = 0; $c < $Nb; $c++) {
$s[$r][$c] = $Sbox[$s[$r][$c]];
Expand Down Expand Up @@ -267,7 +269,8 @@ function plugin_accounts_MixColumns($s, $Nb)
function plugin_accounts_KeyExpansion($key)
{
// generate Key Schedule from Cipher Key
$Rcon = [[0x00, 0x00, 0x00, 0x00],
$Rcon = [
[0x00, 0x00, 0x00, 0x00],
[0x01, 0x00, 0x00, 0x00],
[0x02, 0x00, 0x00, 0x00],
[0x04, 0x00, 0x00, 0x00],
Expand All @@ -277,7 +280,8 @@ function plugin_accounts_KeyExpansion($key)
[0x40, 0x00, 0x00, 0x00],
[0x80, 0x00, 0x00, 0x00],
[0x1b, 0x00, 0x00, 0x00],
[0x36, 0x00, 0x00, 0x00]];
[0x36, 0x00, 0x00, 0x00],
];
$Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
$Nk = count($key) / 4; // key length (in words): 4/6/8 for 128/192/256-bit keys
$Nr = $Nk + 6; // no of rounds: 10/12/14 for 128/192/256-bit keys
Expand Down Expand Up @@ -316,7 +320,8 @@ function plugin_accounts_KeyExpansion($key)
*/
function plugin_accounts_SubWord($w)
{
$Sbox = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
$Sbox = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
Expand All @@ -331,7 +336,8 @@ function plugin_accounts_SubWord($w)
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16];
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16,
];
for ($i = 0; $i < 4; $i++) {
$w[$i] = $Sbox[$w[$i]];
}
Expand Down
Loading