. // //#################################################################### //### configuration ################################################## //#################################################################### // Copy dmarcts-report-viewer-config.php.sample to // dmarcts-report-viewer-config.php and edit with the appropriate info // for your database authentication and location. // // Edit the configuration variables in dmarcts-report-viewer.js with your preferences. // //#################################################################### //### functions ###################################################### //#################################################################### function html ($domains = array(), $orgs = array(), $dmarc_result_select = array(), $report_status_select = array(), $report_list_columns = array(), $cssfiles = array() ) { global $dmarc_result; global $options; global $cookie_options; global $html; $html[] = ""; $html[] = ""; $html[] = " "; $html[] = " DMARC Report Viewer"; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = " "; // if ($_SERVER["REQUEST_METHOD"] == "POST") { // $html[] = "
"; // $html[] = "
"; // $html[] = "Your settings have been saved to the database.

"; // $html[] = " "; // $html[] = ""; // $html[] = "
"; // $html[] = "
"; // $filter = "style='filter: blur(3px);opacity: 50%;'"; // } // Note: If the above is implemented, and a blur effect behind the dialog is wanted, instead of using the $filter method, simply use backdrop-filter/-webkit-backdrop-filter on screen_overlay (see https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter) $html[] = "
DMARCTS Options
"; $html[] = "
"; $html[] = " "; $option = array_keys($options); foreach ($option as $option_name) { foreach($options[$option_name] as $key=>$value) { switch ($options[$option_name]['option_type']) { case "heading": create_heading($options[$option_name]['option_label']); break 2; case "text": case "number": create_input_text($option_name, $options[$option_name]); break 2; case "radio": case "checkbox": create_input_radio($option_name); break 2; case "select": // For a select option, the option_values column contains the name of an array variable, e.g.$org, that is built in dmarcts-report-viewer.php $var = str_replace("$", "", $options[$option_name]['option_values']); // Remove the '$', so e.g. '$org' becomes 'org' create_select($option_name, $options[$option_name], $$var); // Double $$ explanation: $var = org, so $$var = ${$var} = ${org} = $org break 2; default: break 2; } } } $html[] = "
"; $html[] = "
"; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = "
"; $html[] = "
"; $html[] = "

"; // Page Footer // -------------------------------------------------------------------------- $html[] = " "; $html[] = " "; $html[] = ""; return implode("\n",$html); } function create_heading($option_label) { global $html; $html[] = " "; $html[] = " "; $html[] = " " . $option_label . ""; $html[] = " "; $html[] = " "; } function create_input_text($option_name, $option = array()) { global $html; global $cookie_options; $extra_options = ""; $after = ""; $values = $option["option_values"]; if (isset($cookie_options[$option_name]) ) { $value = "value='" . preg_replace("/'/", "'", $cookie_options[$option_name]). "'"; } else { $value = ""; } $html[] = " "; $html[] = " "; $html[] = " "; $html[] = "
"; $html[] = " " . $option["option_description"] . ""; $html[] = " "; $html[] = " "; switch ($option["option_type"]) { case "number": if ( $values['min'] != "" && $values['max'] != "" ) { $extra_options = " min='" . $values['min'] . "' max='" . $values['max'] . "'"; } if ( $values['units'] != "" ) { $after = " " . $values['units']; } break; default: break; } $html[] = " " . $after . "
"; $html[] = " "; $html[] = " "; } function create_input_radio($option_name) { global $html; global $options; global $cookie_options; $values = $options[$option_name]["option_values"]; $html[] = " "; $html[] = " "; $html[] = " " . $options[$option_name]["option_label"] . ""; $html[] = "
"; $html[] = " " . $options[$option_name]["option_description"] . ""; $html[] = " "; $html[] = " "; $html[] = "
"; for ($i = 0; $i < sizeof($values); $i+=2) { $html[] = " "; $html[] = " "; } $html[] = "
"; $html[] = " "; $html[] = " "; } function checked($option_name, $values) { global $options; global $cookie_options; $option_values = $options[$option_name]["option_values"]; if ( is_array($cookie_options[$option_name]) ) { foreach ( $cookie_options[$option_name] as $cookie_option_value ) { if ( $cookie_option_value == $values ) { return " checked=\"checked\""; } } } else { if ( $cookie_options[$option_name] == $values ) { return " checked=\"checked\""; } } } function create_select($option_name, $option = array(), $var) { global $html; global $cookie_options; // $ var is the array variable, e.g. $org $values = $option["option_values"]; $selected = ""; $js = ""; $html[] = " "; $html[] = " "; $html[] = " "; $html[] = "
"; $html[] = " " . $option["option_description"] . ""; $html[] = " "; $html[] = " "; if ( $option_name == "cssfile" ) { $js = " onchange='change_stylesheet();'"; } $html[] = "