From feba70b519d70996ed09352dde7f8ab29c5e4842 Mon Sep 17 00:00:00 2001 From: bradymiller Date: Sat, 25 Oct 2014 13:09:26 -0700 Subject: [PATCH] Fix in prior commit when php mycrypt not installed.(MU2 stuff) Forcing enable_auditlog_encryption to be turned off if try to turn on in globals when php mycrypt not installed. Otherwise, it will break OpenEMR when turn this on. Need to either find a substitute for mycrypt or detail how to get it to work during intallation. --- interface/super/edit_globals.php | 24 ++++++++++++++++++------ library/globals.inc.php | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/interface/super/edit_globals.php b/interface/super/edit_globals.php index 4435baed6..0624ee58b 100644 --- a/interface/super/edit_globals.php +++ b/interface/super/edit_globals.php @@ -175,6 +175,13 @@ if ($_POST['form_download']) { // If we are saving main globals. // if ($_POST['form_save'] && $_GET['mode'] != "user") { + $force_off_enable_auditlog_encryption = true; + // Need to force enable_auditlog_encryption off if the php mycrypt module + // is not installed. + if (extension_loaded('mcrypt')) { + $force_off_enable_auditlog_encryption = false; + } + // Aug 22, 2014: Ensoftek: For Auditable events and tamper-resistance (MU2) // Check the current status of Audit Logging $auditLogStatusFieldOld = $GLOBALS['enable_auditlog']; @@ -207,12 +214,17 @@ if ($_POST['form_save'] && $_GET['mode'] != "user") { else { $fldvalue = ""; } - if($fldtype=='pwd') - $fldvalue = $fldvalue ? SHA1($fldvalue) : $fldvalueold; - if(fldvalue){ - sqlStatement("INSERT INTO globals ( gl_name, gl_index, gl_value ) " . - "VALUES ( '$fldid', '0', '$fldvalue' )"); - } + if($fldtype=='pwd') $fldvalue = $fldvalue ? SHA1($fldvalue) : $fldvalueold; + if(fldvalue){ + // Need to force enable_auditlog_encryption off if the php mycrypt module + // is not installed. + if ( $force_off_enable_auditlog_encryption && ($fldid == "enable_auditlog_encryption") ) { + error_log("OPENEMR ERROR: UNABLE to support auditlog encryption since the php mycrypt module is not installed",0); + $fldvalue=0; + } + sqlStatement("INSERT INTO globals ( gl_name, gl_index, gl_value ) " . + "VALUES ( '$fldid', '0', '$fldvalue' )"); + } } ++$i; diff --git a/library/globals.inc.php b/library/globals.inc.php index 4f7cd1783..fb4fd6435 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -1317,7 +1317,7 @@ $GLOBALS_METADATA = array( 'enable_auditlog_encryption' => array( xl('Enable Audit Log Encryption'), 'bool', // data type - '1', // default + '0', // default xl('Enable Audit Log Encryption') ), -- 2.11.4.GIT