Skip to content

Commit 8915545

Browse files
committed
SimpleRisk 20240923-001 Release
1 parent 91c6450 commit 8915545

2,966 files changed

Lines changed: 242548 additions & 496804 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

simplerisk/account/profile.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,14 @@
281281
if (isset($_SESSION['user_type']) && $_SESSION['user_type'] != "ldap") {
282282

283283
$html = "
284-
<div class='card-body border m-t-5 flex-grow-1'>
285-
<div>
284+
<div class='card-body border flex-grow-1'>
286285
";
287286

288287
$resetRequestMessages = getPasswordReqeustMessages();
289288
if(count($resetRequestMessages)) {
290289

291-
$html .= "
290+
$html .= "
291+
<div>
292292
<h4>" . $escaper->escapeHtml($lang['PasswordRequirements']) . "</h4>
293293
<ul>
294294
";
@@ -303,17 +303,15 @@
303303

304304
$html .= "
305305
</ul>
306+
</div>
306307
";
307308

308309
}
309310

310-
$html .= "
311-
</div>
312-
";
313311
echo $html;
314312

315313
?>
316-
<div class="m-t-30">
314+
<div>
317315
<form class="form-horizontal" action="" method="post">
318316
<h4><?= $escaper->escapeHtml($lang['ChangePassword']);?></h4>
319317
<div class="form-group">

simplerisk/admin/active_assessments.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
?>
3838
<div class="row bg-white">
3939
<div class="col-12">
40-
<div class="card-body my-2 border d-flex align-items-center">
41-
<label class="text-danger">Warning:</label>
42-
<div class="text-danger m-l-20">* Deleted Assessments Cannot Be Recovered</div>
40+
<div class="card-body my-2 border d-flex align-items-center alert alert-danger" role="alert">
41+
Deleted Assessments Cannot Be Recovered
4342
</div>
4443
<div class='card-body my-2 border'>
4544
<?php display_active_assessments(); ?>
@@ -60,6 +59,8 @@ function checkAll(bx) {
6059
$(function () {
6160
$('#questionaires_table').DataTable({
6261
serverSide: false,
62+
order: [[1, 'asc']],
63+
columnDefs: [{'targets': 0, 'orderable': false}],
6364
});
6465
$('.btn-delete').on('click', function () {
6566
confirm(_lang['GenericDeleteItemConfirmation'], () => $('#delete_active_assessments').trigger('submit'));

simplerisk/admin/add_remove_values.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@
347347
<input type="hidden" value="" name="id"/>
348348
<input type="hidden" value="" name="name"/>
349349
<div class="row" >
350-
<div class="col-md-6 form-group">
351-
<h4><?= $escaper->escapeHtml($lang['Select']); ?></h4>
350+
<div class="col-md-3 form-group pb-4">
352351
<select id="table-sections" class="form-select" name="table-sections">
353352
<?php
354353
foreach($tableConfig as $table => $config){
@@ -386,42 +385,42 @@
386385
$display = "display: none;";
387386
}
388387
}
389-
echo'
388+
echo '
390389
<div class="row">
391390
<div class="hero-unit" data-table_name="' . $table . '" style="' . $display . '">
392391
<h4>' . $escaper->escapeHtml($lang[$config['headerKey']]) . '</h4>
393392
<div class="row" style="align-items:flex-end">
394-
<div class="col-md-4 form-group">
393+
<div class="col-md-6 form-group">
395394
<label>' . $text_addItem . ':</label>
396395
<input id="' . $table . '_new" type="text" maxlength="' . $config['lengthLimit'] .'" size="20" class="form-control"/>
397396
</div>
398-
<div class="col-md-2 form-group">
397+
<div class="col-md-1 form-group">
399398
<input type="submit" value="' . $text_add . ' " data-action="add" class="btn btn-submit form-control"/>
400399
</div>
401400
</div>
402401
<div class="row" style="align-items:flex-end">
403-
<div class="col-md-2 form-group">
402+
<div class="col-md-3 form-group">
404403
<label>' . $text_change . ':</label>
405404
';
406405
create_dropdown($table, NULL, $table . "_update_from");
407406
echo'
408407
</div>
409-
<div class="col-md-2 form-group">
408+
<div class="col-md-3 form-group">
410409
<label>' . $text_to . ':</label>
411410
<input id="' . $table . '_update_to" type="text" maxlength="' . $config['lengthLimit'] . '" size="20" class="form-control"/>
412411
</div>
413-
<div class="col-md-2 form-group">
412+
<div class="col-md-1 form-group">
414413
<input type="submit" value="' . $text_update . '" data-action="update" class="btn btn-submit form-control"/>
415414
</div>
416415
</div>
417416
<div class="row" style="align-items:flex-end">
418-
<div class="col-md-4">
417+
<div class="col-md-6">
419418
<label>' . $text_deleteItem . ':</label>
420419
';
421420
create_dropdown($table, NULL, $table . "_delete");
422421
echo '
423422
</div>
424-
<div class="col-md-2">
423+
<div class="col-md-1">
425424
<input type="submit" value="' . $text_delete . '" data-action="delete" class="btn btn-submit form-control"/>
426425
</div>
427426
</div>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
// Render the header and sidebar
7+
require_once(realpath(__DIR__ . '/../includes/renderutils.php'));
8+
require_once(realpath(__DIR__ . '/../includes/functions.php'));
9+
require_once(realpath(__DIR__ . '/../includes/artificial_intelligence.php'));
10+
render_header_and_sidebar(['multiselect'], ['check_admin' => true]);
11+
12+
// Include the language file
13+
// Ignoring detections related to language files
14+
// @phan-suppress-next-line SecurityCheck-PathTraversal
15+
require_once(language_file());
16+
17+
// If the extra directory exists
18+
if (is_dir(realpath(__DIR__ . '/../extras/artificial_intelligence')))
19+
{
20+
// Include the Artificial Intelligence Extra
21+
require_once(realpath(__DIR__ . '/../extras/artificial_intelligence/index.php'));
22+
23+
// If the user wants to activate the extra
24+
if (isset($_POST['activate']))
25+
{
26+
// Enable the Artificial Intelligence Extra
27+
enable_artificial_intelligence_extra();
28+
}
29+
30+
// If the user wants to deactivate the extra
31+
if (isset($_POST['deactivate']))
32+
{
33+
// Disable the Artificial Intelligence Extra
34+
disable_artificial_intelligence_extra();
35+
}
36+
37+
// If the user updated the configuration
38+
if (isset($_POST['update_artificial_intelligence_settings']))
39+
{
40+
// Update the artificial intelligence settings
41+
update_artificial_intelligence_settings();
42+
}
43+
}
44+
45+
/*********************
46+
* FUNCTION: DISPLAY *
47+
*********************/
48+
function display($display = "")
49+
{
50+
global $lang;
51+
global $escaper;
52+
53+
// If the extra directory exists
54+
if (is_dir(realpath(__DIR__ . '/../extras/artificial_intelligence')))
55+
{
56+
// But the extra is not activated
57+
if (!artificial_intelligence_extra())
58+
{
59+
echo "<div class='card-body my-2 border'>";
60+
// If the extra is not restricted based on the install type
61+
if (!restricted_extra("artificial_intelligence"))
62+
{
63+
echo "
64+
<form id='activate_extra' name='activate' method='post' action=''>
65+
<input type='submit' value='" . $escaper->escapeHtml($lang['Activate']) . "' name='activate' class='btn btn-submit'/>
66+
</form>";
67+
}
68+
// The extra is restricted
69+
else echo $escaper->escapeHtml($lang['YouNeedToUpgradeYourSimpleRiskSubscription']);
70+
echo "</div>";
71+
}
72+
// Once it has been activated
73+
else
74+
{
75+
// Include the Notification Extra
76+
require_once(realpath(__DIR__ . '/../extras/artificial_intelligence/index.php'));
77+
78+
display_artificial_intelligence();
79+
}
80+
}
81+
// Otherwise, the Extra does not exist
82+
else
83+
{
84+
echo "
85+
<div class='card-body my-2 border'>
86+
<a href='https://www.simplerisk.com/extras' target='_blank' class='text-info'>Purchase the Extra</a>
87+
</div>";
88+
}
89+
}
90+
?>
91+
<div class="row bg-white">
92+
<div class="col-12">
93+
<?php display(); ?>
94+
95+
<div class='card-body my-2 border'>
96+
<form name='anthropic_settings' method='post' action=''>
97+
<div class='row'>
98+
<div class='form-group'>
99+
<label>Anthropic API Key:</label>
100+
<?php display_anthropic_api_key_input() ?>
101+
</div>
102+
</div>
103+
</form>
104+
</div>
105+
106+
<?php
107+
// If we have an Anthropic API key
108+
if (get_setting("anthropic_api_key") != false)
109+
{
110+
// Process the added/updated context
111+
$parameter_array = get_artificial_intelligence_context_parameter_array();
112+
$settings_prefix = "ai_context_";
113+
$parameter_array = update_posted_settings_values($parameter_array, $settings_prefix);
114+
115+
// If this was a POST to update the AI context
116+
if (isset($_POST['save_ai_context']))
117+
{
118+
// Update a setting for the last time this prefix was updated
119+
$setting_name = $settings_prefix . "last_saved";
120+
update_setting($setting_name, time());
121+
}
122+
123+
// Provide the user with the ability to add context
124+
display_artificial_intelligence_add_context($parameter_array);
125+
}
126+
?>
127+
</div>
128+
<script>
129+
<?php prevent_form_double_submit_script(['activate_extra', 'deactivate_extra']); ?>
130+
</script>
131+
</div>
132+
<?php
133+
// Render the footer of the page. Please don't put code after this part.
134+
render_footer();
135+
?>

simplerisk/admin/audit_trail.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

6-
// Render the header and sidebar
7-
require_once(realpath(__DIR__ . '/../includes/renderutils.php'));
8-
render_header_and_sidebar(permissions: ['check_admin' => true]);
6+
require_once(realpath(__DIR__ . '/../includes/functions.php'));
97

108
// If the days value is post
119
if (isset($_GET['days']))
@@ -17,6 +15,18 @@
1715

1816
if(isset($_POST['download_audit_log']))
1917
{
18+
global $escaper, $lang;
19+
// Include Laminas Escaper for HTML Output Encoding
20+
$escaper = new simpleriskEscaper();
21+
22+
// Add various security headers
23+
add_security_headers();
24+
25+
add_session_check(['check_admin' => true]);
26+
27+
// Include the SimpleRisk language file
28+
require_once(language_file());
29+
2030
if(is_admin())
2131
{
2232
// If extra is activated, download audit logs
@@ -38,6 +48,10 @@
3848
}
3949
}
4050

51+
// Render the header and sidebar
52+
require_once(realpath(__DIR__ . '/../includes/renderutils.php'));
53+
render_header_and_sidebar(permissions: ['check_admin' => true]);
54+
4155
/*********************
4256
* FUNCTION: DISPLAY *
4357
*********************/

simplerisk/admin/complianceforge.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ function display() {
114114
<?php display(); ?>
115115
</div>
116116
</div>
117-
<?php display_set_default_date_format_script(); ?>
118117
<?php
119118
// Render the footer of the page. Please don't put code after this part.
120119
render_footer();

0 commit comments

Comments
 (0)