Skip to content

Commit

Permalink
Addressed other issues mainly related to Expiration, sessions, layout…
Browse files Browse the repository at this point in the history
… and languages (#545)

* Fixed Expiration issue and other minor issues

* Fixed quick installation section

* Improved import user procedure

* Minor fixes to language and layout. Also improved sessions and printTickets feature.
  • Loading branch information
filippolauria authored Jul 17, 2024
1 parent 3d6149d commit cc6eba0
Show file tree
Hide file tree
Showing 20 changed files with 446 additions and 983 deletions.
19 changes: 12 additions & 7 deletions app/common/includes/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
exit;
}

function fix_placeholder_text($text) {
$text = html_entity_decode($text, ENT_QUOTES | ENT_HTML5, 'UTF-8');
$text = str_replace('"', "'", strip_tags($text));
$text = preg_replace('/[\s\h\v\xA0]+/u', ' ', $text);
return trim($text);
}

const DEFAULT_COMMON_PROLOGUE_CSS = array(
"static/css/bootstrap.min.css",
"static/css/icons/bootstrap-icons.min.css",
Expand Down Expand Up @@ -777,8 +784,7 @@ function print_input_field($input_descriptor) {
}

if (array_key_exists('tooltipText', $input_descriptor) && !empty($input_descriptor['tooltipText'])) {
$tooltipText = str_replace('"', "'", strip_tags($input_descriptor['tooltipText']));

$tooltipText = fix_placeholder_text($input_descriptor['tooltipText']);
printf(' placeholder="%s"', $tooltipText);

if (array_key_exists('sidebar', $input_descriptor) && $input_descriptor['sidebar'] !== false) {
Expand Down Expand Up @@ -984,7 +990,7 @@ function print_select($select_descriptor) {


if (isset($select_descriptor['tooltipText'])) {
$tooltipText = str_replace('"', "'", strip_tags($select_descriptor['tooltipText']));
$tooltipText = fix_placeholder_text($select_descriptor['tooltipText']);

if (!empty($tooltipText)) {
printf(' placeholder="%s"', $tooltipText);
Expand Down Expand Up @@ -1177,8 +1183,7 @@ function print_form_component($descriptor) {
$tooltip_box_id = sprintf('%s-%d-tooltip', $descriptor['id'], rand());
$describedby_id = $descriptor['id'] . '-help';

$tooltipText = preg_replace('/\n/', '', strip_tags(html_entity_decode($descriptor['tooltipText'])));
$tooltipText = preg_replace('/\s+/', ' ', trim($tooltipText));
$tooltipText = fix_placeholder_text($descriptor['tooltipText']);

printf('<div id="%s" class="form-text">%s</div>', $describedby_id, $tooltipText);
}
Expand Down Expand Up @@ -1225,7 +1230,7 @@ function menu_print_select($select_descriptor) {
}

if (array_key_exists('tooltipText', $select_descriptor)) {
$tooltipText = str_replace('"', "'", strip_tags($select_descriptor['tooltipText']));
$tooltipText = fix_placeholder_text($select_descriptor['tooltipText']);
printf(' data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="%s"', $tooltipText);
printf(' placeholder="%s"', $tooltipText);
}
Expand Down Expand Up @@ -1416,7 +1421,7 @@ function menu_print_input_field($input_descriptor) {
}

if (array_key_exists('tooltipText', $input_descriptor)) {
$tooltipText = str_replace('"', "'", strip_tags($input_descriptor['tooltipText']));
$tooltipText = fix_placeholder_text($input_descriptor['tooltipText']);
printf(' data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="%s"', $tooltipText);
printf(' placeholder="%s"', $tooltipText);
}
Expand Down
4 changes: 3 additions & 1 deletion app/common/includes/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
// this regex allows input like (e.g.) 127, 127., 127.0, 127.0., 127.0.0, 127.0.0 and 127.0.0.1
define("LOOSE_IP_REGEX", '/^(((2(5[0-5]|[0-4][0-9]))|1[0-9]{2}|[1-9]?[0-9])\.?){1,4}$/');

define("ALL_PRINTABLE_CHARS_REGEX", '/^[ -~ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]+$/');
define("FIRST_LAST_NAME_REGEX", '/^[ -A-Za-zÀ-ÖØ-öø-ÿ0-9]+$/');
define("SAFE_PASSWORD_REGEX", '/^[\w!@#$^&*()\-_=+{};:.<>]+$/');
define("EMAIL_LIKE_USERNAME_REGEX", '/^[A-Za-z0-9][A-Za-z0-9_.-]*(?:@[A-Za-z0-9.-]+\.[A-Za-z]{2,})?$/');
define("LOG_FILEPATH_REGEX", '/^(\/[a-zA-Z0-9]+)+(\.log)?$/');

define("DB_TABLE_NAME_REGEX", '/^[a-zA-Z0-9_]+$/');
Expand Down
2 changes: 1 addition & 1 deletion app/operators/home-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function generateCard($title, $total, $linkText, $linkURL, $bgColor, $icon) {
echo <<<HTML
<span class="d-flex align-items-center justify-content-start mb-2">
<h1 class="fs-4 m-0">daloRADIUS</h1>
<a tabindex="0" class="ms-2 text-decoration-none btn btn-light" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-title="{$version}" data-bs-content="{$copyright}">
<a tabindex="0" class="ms-2 text-decoration-none btn btn-light" role="button" data-bs-trigger="focus" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-title="{$version}" data-bs-content="{$copyright}">
<i class="fs-6 bi bi-c-circle"></i>
</a>
</span>
Expand Down
Loading

0 comments on commit cc6eba0

Please sign in to comment.