Skip to content

Commit 25cbc21

Browse files
committed
SimpleRisk 20220909-001 Release
1 parent b877f65 commit 25cbc21

54 files changed

Lines changed: 301 additions & 115 deletions

Some content is hidden

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

simplerisk/admin/importexport.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,19 @@
121121
export_xls("users");
122122
}
123123

124-
// If the user selected to do a template groups export
124+
// If the user selected to do a template groups export
125125
if (isset($_POST['template_groups_export']))
126126
{
127127
// Export the XLSX file
128128
export_xls("template_groups");
129129
}
130+
131+
// If the user selected to do a control tests export
132+
if (isset($_POST['control_tests_export']))
133+
{
134+
// Export the XLSX file
135+
export_xls("control_tests");
136+
}
130137
}
131138

132139
/*********************

simplerisk/governance/document_exceptions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function wireActionButtons(tab) {
171171
$("#exception-update-form [name=type]").val(type);
172172

173173
$("#exception-update-form [name=exception_id]").val(exception_id);
174-
$("#exception-update-form [name=document_exceptions_status]").val(data.document_exceptions_status);
174+
$("#exception-update-form [name=document_exceptions_status]").val(data.document_exceptions_status);
175175
$("#exception-update-form [name=name]").val(data.name);
176176
$("#exception-update-form [name=policy]").val(data.policy_document_id);
177177
$("#exception-update-form [name=control]").val(data.control_framework_id);
@@ -227,7 +227,7 @@ function wireActionButtons(tab) {
227227
$("#exception--view #policy").parent().hide();
228228
}
229229

230-
$("#exception--view #document_exceptions_status").html(data.document_exceptions_status);
230+
$("#exception--view #document_exceptions_status").html(data.document_exceptions_status);
231231
$("#exception--view #owner").html(data.owner);
232232
$("#exception--view #additional_stakeholders").html(data.additional_stakeholders);
233233
$("#exception--view #associated_risks").html(data.associated_risks);
@@ -694,7 +694,7 @@ function displayFileSize(label, size) {
694694

695695
// Get any alert messages
696696
get_alert();
697-
$risks = get_risks(1);
697+
$risks = get_risks(0, "id", "asc");
698698
?>
699699

700700

simplerisk/includes/api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7362,7 +7362,7 @@ function assets_update_asset()
73627362

73637363
// If success for update
73647364
if($updated){
7365-
$asset = get_asset_by_id($id)[0];
7365+
$asset = get_asset_by_id($id);
73667366
set_alert(true, "good", $escaper->escapeHtml($lang['AssetWasUpdatedSuccessfully']));
73677367
if ($fieldName == "tags") {
73687368
$options = [];

simplerisk/includes/assets.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ function display_asset_detail($id)
507507
global $escaper;
508508
global $lang;
509509

510-
$asset = get_asset_by_id($id)[0];
510+
$asset = get_asset_by_id($id);
511511

512512
// If the IP address is not valid
513513
if (!preg_match('/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/', $asset['ip']))
@@ -889,7 +889,7 @@ function get_asset_by_id($id)
889889
$stmt->execute();
890890

891891
// Store the list in the assets array
892-
$asset = $stmt->fetchAll();
892+
$asset = $stmt->fetch(PDO::FETCH_ASSOC);
893893

894894
// Close the database connection
895895
db_close($db);
@@ -1255,6 +1255,7 @@ function import_asset($ip, $name, $value, $location, $teams, $details, $tags, $v
12551255
function get_asset_name( $asset_id )
12561256
{
12571257
$db = db_open();
1258+
$name = "";
12581259

12591260
$stmt = $db->prepare("SELECT name from assets where id = :id");
12601261
$stmt->bindParam(":id", $asset_id, PDO::PARAM_INT);

simplerisk/includes/display.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ function view_risk_details($id, $submission_date, $submitted_by, $subject, $refe
375375
{
376376
// Include the extra
377377
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
378-
if(!$template_group_id) {
378+
$template_group = get_custom_template_group_by_id($template_group_id);
379+
if(!$template_group_id || !$template_group) {
379380
$group = get_default_template_group("risk");
380381
$template_group_id = $group["id"];
381382
}
@@ -750,7 +751,8 @@ function edit_risk_details($id, $submission_date,$submitted_by, $subject, $refer
750751
{
751752
// Include the extra
752753
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
753-
if(!$template_group_id){
754+
$template_group = get_custom_template_group_by_id($template_group_id);
755+
if(!$template_group_id || !$template_group) {
754756
$group = get_default_template_group("risk");
755757
$template_group_id = $group["id"];
756758
}
@@ -866,7 +868,8 @@ function view_mitigation_details($risk_id, $mitigation_id, $mitigation_date, $pl
866868
{
867869
// Include the extra
868870
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
869-
if(!$template_group_id){
871+
$template_group = get_custom_template_group_by_id($template_group_id);
872+
if(!$template_group_id || !$template_group) {
870873
$group = get_default_template_group("risk");
871874
$template_group_id = $group["id"];
872875
}
@@ -1153,7 +1156,8 @@ function edit_mitigation_details($risk_id, $mitigation_id, $mitigation_date, $pl
11531156
{
11541157
// Include the extra
11551158
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
1156-
if(!$template_group_id){
1159+
$template_group = get_custom_template_group_by_id($template_group_id);
1160+
if(!$template_group_id || !$template_group) {
11571161
$group = get_default_template_group("risk");
11581162
$template_group_id = $group["id"];
11591163
}
@@ -1466,7 +1470,8 @@ function view_review_details($id, $review_id, $review_date, $reviewer, $review,
14661470
{
14671471
// Include the extra
14681472
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
1469-
if(!$template_group_id){
1473+
$template_group = get_custom_template_group_by_id($template_group_id);
1474+
if(!$template_group_id || !$template_group) {
14701475
$group = get_default_template_group("risk");
14711476
$template_group_id = $group["id"];
14721477
}
@@ -1621,7 +1626,8 @@ function edit_review_submission($id, $review_id, $review, $next_step, $next_revi
16211626
{
16221627
// Include the extra
16231628
require_once(realpath(__DIR__ . '/../extras/customization/index.php'));
1624-
if(!$template_group_id){
1629+
$template_group = get_custom_template_group_by_id($template_group_id);
1630+
if(!$template_group_id || !$template_group) {
16251631
$group = get_default_template_group("risk");
16261632
$template_group_id = $group["id"];
16271633
}

simplerisk/includes/functions.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5965,6 +5965,10 @@ function get_risks($sort_order=0, $order_field=false, $order_dir=false)
59655965
// If this is the default, sort by risk
59665966
if ($sort_order == 0)
59675967
{
5968+
// Set default sort field
5969+
if(empty($sort_query)){
5970+
$sort_query = " ORDER BY a.calculated_risk DESC ";
5971+
}
59685972
// If the team separation extra is not enabled
59695973
if (!team_separation_extra())
59705974
{
@@ -5983,8 +5987,7 @@ function get_risks($sort_order=0, $order_field=false, $order_dir=false)
59835987
WHERE
59845988
b.status != \"Closed\"
59855989
GROUP BY b.id
5986-
ORDER BY
5987-
a.calculated_risk DESC
5990+
{$sort_query}
59885991
");
59895992
}
59905993
else
@@ -6011,8 +6014,7 @@ function get_risks($sort_order=0, $order_field=false, $order_dir=false)
60116014
WHERE
60126015
b.status != \"Closed\" " . $separation_query . "
60136016
GROUP BY b.id
6014-
ORDER BY
6015-
a.calculated_risk DESC
6017+
{$sort_query}
60166018
");
60176019
}
60186020

simplerisk/includes/upgrade.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ function table_exists($table) {
163163
"20220527-001",
164164
"20220701-001",
165165
"20220823-001",
166+
"20220909-001",
166167
);
167168

168169
/*************************
@@ -6678,6 +6679,28 @@ function upgrade_from_20220701001($db)
66786679
echo "Finished SimpleRisk database upgrade from version " . $version_to_upgrade . " to version " . $version_upgrading_to . "<br />\n";
66796680
}
66806681

6682+
/***************************************
6683+
* FUNCTION: UPGRADE FROM 20220823-001 *
6684+
***************************************/
6685+
function upgrade_from_20220823001($db)
6686+
{
6687+
// Database version to upgrade
6688+
$version_to_upgrade = '20220823-001';
6689+
6690+
// Database version upgrading to
6691+
$version_upgrading_to = '20220909-001';
6692+
6693+
echo "Beginning SimpleRisk database upgrade from version " . $version_to_upgrade . " to version " . $version_upgrading_to . "<br />\n";
6694+
6695+
// To make sure page loads won't fail after the upgrade
6696+
// as this session variable is not set by the previous version of the login logic
6697+
$_SESSION['latest_version_app'] = latest_version('app');
6698+
6699+
// Update the database version
6700+
update_database_version($db, $version_to_upgrade, $version_upgrading_to);
6701+
echo "Finished SimpleRisk database upgrade from version " . $version_to_upgrade . " to version " . $version_upgrading_to . "<br />\n";
6702+
}
6703+
66816704
/******************************
66826705
* FUNCTION: UPGRADE DATABASE *
66836706
******************************/

simplerisk/includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

66
// Application Version Date
7-
define('APP_VERSION', '20220823-001');
7+
define('APP_VERSION', '20220909-001');
88

99
?>

simplerisk/languages/af/lang.af.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,10 @@
22682268
'ImportTemplateGroups' => 'Voer sjabloongroepe in',
22692269
'TemplateGroupID' => 'Sjabloongroep-ID',
22702270
'TemplateGroupName' => 'Sjabloongroepnaam',
2271+
'ExportControlTests' => 'Uitvoerbeheertoetse',
2272+
'ImportControlTests' => 'Invoerbeheertoetse',
2273+
'TestID' => 'Toets ID',
2274+
'IDNoEXitFailedToUpdate' => 'ID $id bestaan nie, so dit is nie ingevoer of opgedateer nie',
22712275

22722276
'' => '',
22732277
);

simplerisk/languages/ar/lang.ar.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,10 @@
22682268
'ImportTemplateGroups' => 'استيراد مجموعات القوالب',
22692269
'TemplateGroupID' => 'معرف مجموعة القالب',
22702270
'TemplateGroupName' => 'اسم مجموعة القالب',
2271+
'ExportControlTests' => 'اختبارات مراقبة الصادرات',
2272+
'ImportControlTests' => 'اختبارات التحكم في الاستيراد',
2273+
'TestID' => 'معرف الاختبار',
2274+
'IDNoEXitFailedToUpdate' => 'المعرف $id غير موجود ، لذا لم يتم استيراده أو تحديثه',
22712275

22722276
'' => '',
22732277
);

0 commit comments

Comments
 (0)