function updateAdvancedSecuritySettings($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf) { $arrFormAdvancedSecuritySettings = createFieldForm(); $oForm = new paloForm($smarty, $arrFormAdvancedSecuritySettings); //GET FIELDS $fpbx_password = ''; $fpbx_confir_password = ''; if (isset($_POST["fpbx_password"])) { $fpbx_password = getParameter("fpbx_password"); } if (isset($_POST["fpbx_confir_password"])) { $fpbx_confir_password = getParameter("fpbx_confir_password"); } //VALIDATIONS OF PASSWORD $msgValidationEmptyFields = ""; $msgValidationPassword = ""; $msgValidationConfirPassword = ""; //VALIDATION OF EMPTY FIELDS if ($fpbx_password == '') { $msgValidationEmptyFields .= _tr("Database and Web Administration FreePBX Password") . "<br/>"; } if ($fpbx_confir_password == '') { $msgValidationEmptyFields .= _tr("Password Confirmation") . "<br/>"; } //VALIDATION OF PASSWORD if (!validatePassword($fpbx_password)) { $msgValidationPassword = _tr("Password may only contain alphanumeric characters, spaces, or the following: .&-@=_!<>."); } //VALIDATION OF CONFIRMATION PASSWORD if (!validateConfirmationPassword($fpbx_password, $fpbx_confir_password)) { $msgValidationConfirPassword = _tr("Password and confirmation do not match!"); } //ERROR MESSAGE if ($msgValidationEmptyFields != '' || $msgValidationPassword != '' || $msgValidationConfirPassword != '') { $smarty->assign("mb_title", _tr("Validation Error")); if ($msgValidationEmptyFields != '') { $strErrorMsg = "<b>" . _tr("The following fields are required") . ":</b><br/>"; $strErrorMsg .= $msgValidationEmptyFields; } else { if ($msgValidationPassword != '') { $strErrorMsg = "<b>" . _tr("The following field contain errors") . ":</b><br/>"; $strErrorMsg .= $msgValidationPassword; } else { $strErrorMsg = "<b>" . _tr("The following field contain errors") . ":</b><br/>"; $strErrorMsg = $msgValidationConfirPassword; } } $smarty->assign("mb_message", $strErrorMsg); } else { //SAVE CONFIGURATIONS $pAdvancedSecuritySettings = new paloSantoAdvancedSecuritySettings($arrConf, $pDB); //Save configurations ChangePassword $resultChangePass = $pAdvancedSecuritySettings->changeFreePBXPassword($fpbx_password, $arrConf); if (is_array($resultChangePass) && isset($resultChangePass['result']) && $resultChangePass['result']) { $smarty->assign("mb_title", _tr("Information") . ":"); $messageChangePassword = "******" . _tr("Password has been updated."); $_POST["fpbx_password"] = ""; $_POST["fpbx_confir_password"] = ""; } else { $smarty->assign("mb_title", _tr("Error") . ":"); $messageChangePassword = "******" . _tr("Password has not been updated."); if (is_array($resultChangePass['arrUpdateFiles']) && count($resultChangePass['arrUpdateFiles']) > 0) { $messageChangePassword .= _tr(" But the following files have been modified: "); foreach ($resultChangePass['arrUpdateFiles'] as $updateFile) { $messageChangePassword .= $updateFile . " ,"; } } } $smarty->assign("mb_message", $messageChangePassword); } $content = viewFormAdvancedSecuritySettings($smarty, $module_name, $local_templates_dir, $arrConf); return $content; }
if (isset($_REQUEST['logout'])) { // logging out.. // remove the user unset($_SESSION['AMP_user']); // flag to prompt for pw again $_SESSION['logout'] = true; showview('loggedout'); exit; } $documentRoot = $_SERVER['DOCUMENT_ROOT']; if (file_exists("{$documentRoot}/modules/sec_advanced_settings/libs/paloSantoChangePassword.class.php")) { include_once "{$documentRoot}/modules/sec_advanced_settings/libs/paloSantoChangePassword.class.php"; include_once "{$documentRoot}/libs/misc.lib.php"; require_once "{$documentRoot}/configs/default.conf.php"; global $arrConf; $pAdvancedSecuritySettings = new paloSantoAdvancedSecuritySettings($arrConf); $fromDirectAccess = isset($_SERVER['REQUEST_URI']) && preg_match("/\\/admin\\/config.php/", $_SERVER['REQUEST_URI']) ? true : false; if (!$pAdvancedSecuritySettings->isActivatedFreePBXFrontend() && $fromDirectAccess) { unset($_SESSION['AMP_user']); $_SESSION['logout'] = true; $lang = get_language("{$documentRoot}/"); $lang_file = "{$documentRoot}/modules/sec_advanced_settings/lang/{$lang}.lang"; if (file_exists("{$lang_file}")) { include_once "{$lang_file}"; } else { include_once "{$documentRoot}/modules/sec_advanced_settings/lang/en.lang"; } global $arrLangModule; $advice = isset($arrLangModule['Unauthorized']) ? $arrLangModule['Unauthorized'] : 'Unauthorized'; $msg1 = isset($arrLangModule['You are not authorized to access this page.']) ? $arrLangModule['You are not authorized to access this page.'] : 'You are not authorized to access this page.'; $msg2 = isset($arrLangModule["Enable direct access (Non-embedded) to FreePBX in \"Security >> Advanced Security Settings\" menu."]) ? $arrLangModule["Enable direct access (Non-embedded) to FreePBX in \"Security >> Advanced Security Settings\" menu."] : "Enable direct access (Non-embedded) to FreePBX in \"Security >> Advanced Security Settings\" menu.";