function viewFormAdvancedSecuritySettings($smarty, $module_name, $local_templates_dir, $arrConf) { $pAdvancedSecuritySettings = new paloSantoAdvancedSecuritySettings($arrConf); $value_fpbx_frontend = $pAdvancedSecuritySettings->isActivatedFreePBXFrontend(); $value_anonymous_sip = $pAdvancedSecuritySettings->isActivatedAnonymousSIP(); $arrFormAdvancedSecuritySettings = createFieldForm(); $oForm = new paloForm($smarty, $arrFormAdvancedSecuritySettings); $smarty->assign("SAVE", _tr("Save")); $smarty->assign("subtittle1", _tr("Enable access")); $smarty->assign("subtittle2", _tr("Change Password")); $smarty->assign("value_fpbx_frontend", $value_fpbx_frontend); $smarty->assign("value_anonymous_sip", $value_anonymous_sip); $smarty->assign("icon", "modules/" . $module_name . "/images/security_advanced_settings.png"); $htmlForm = $oForm->fetchForm("{$local_templates_dir}/form.tpl", _tr("Advanced Security Settings"), $_POST); $content = "<form method='POST' style='margin-bottom:0;' action='?menu={$module_name}'>" . $htmlForm . "</form>"; return $content; }
// 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."; $title = isset($arrLangModule['Advice']) ? $arrLangModule['Advice'] : 'Advice'; $template['content']['msg'] = "<br /><b style='font-size:1.5em;'>{$advice}</b> <p>{$msg1}<br/>{$msg2}</p>";