<commit_before><?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* Settings module interface
*
* @link https://github.com/loadavg/loadavg
* @author <NAME>
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
?>


<?php
/*
 * Security wrapper for private pages
 *
 */

if (!$loadavg->isLoggedIn() && !LoadAvg::checkInstall()) {
  include('login.php');
}
else {
?>

<?php

if (isset($_POST['update_settings'])) {


	/////////////////////////////////////////////////////////////////////
	//updates the general settings here as api settings are stored there

	//we clean input here for items with checkbox values for some reason not sure if we still need to
	$_POST['formsettings']['apiserver'] = ( !isset($_POST['formsettings']['apiserver']) ) ? "false" : "true";

	// Loop throught settings
	$settings_file = APP_PATH . '/config/' . LoadAvg::$settings_ini;
	
	$settings = LoadAvg::$_settings->general;

	$postsettings = $_POST['formsettings'];

  //$mergedsettings = LoadAvg::ini_merge ($settings, $postsettings);
  $replaced_settings = array_replace($settings, $postsettings);

  //LoadAvg::write_php_ini($mergedsettings, $settings_file);
  LoadAvg::write_php_ini($replaced_settings, $settings_file);

  //dont work only page reload work
  //$settings = LoadAvg::$_settings->general;


    /////////////////////////////////////////////////////////////////////
    //test api connection done inline on reload for now need AJAX

  if (isset($_POST['Test_Settings'])) 
    header('Location: '. strtok($_SERVER["REQUEST_URI"],'&') . '&test=true' );
  else
    header('Location: '. strtok($_SERVER["REQUEST_URI"],'&') );

}

?>

<form action="" method="post">

	<input type="hidden" name="update_settings" value="1" />

  <div class="innerAll">
<commit_msg>fixed setting save bug<commit_after><?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* Settings module interface
*
* @link https://github.com/loadavg/loadavg
* @author <NAME>
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
?>


<?php
/*
 * Security wrapper for private pages
 *
 */

if (!$loadavg->isLoggedIn() && !LoadAvg::checkInstall()) {
  include('login.php');
}
else {
?>

<?php

if (isset($_POST['update_settings'])) {


	/////////////////////////////////////////////////////////////////////
	//updates the general settings here as api settings are stored there

	//we clean input here for items with checkbox values for some reason not sure if we still need to
	$_POST['formsettings']['apiserver'] = ( !isset($_POST['formsettings']['apiserver']) ) ? "false" : "true";

    // Loop throught settings
    $settings_file = APP_PATH . '/config/' . LoadAvg::$settings_ini;
    
    $settings = LoadAvg::$_settings->general;

    $postsettings = $_POST['formsettings'];

    $replaced_settings = LoadAvg::ini_merge ($settings, $postsettings);

    LoadAvg::write_php_ini($replaced_settings, $settings_file);

    $settings = LoadAvg::$_settings->general;


    /////////////////////////////////////////////////////////////////////
    //test api connection done inline on reload for now need AJAX

  if (isset($_POST['Test_Settings'])) 
    header('Location: '. strtok($_SERVER["REQUEST_URI"],'&') . '&test=true' );
  else
    header('Location: '. strtok($_SERVER["REQUEST_URI"],'&') );

}

?>

<form action="" method="post">

	<input type="hidden" name="update_settings" value="1" />

  <div class="innerAll">

{'fraction_non_alphanumeric': 0.2299044406970208, 'fraction_numerical': 0.0039347948285553686, 'mean_word_length': 3.058152793614595, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2233543', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1024, 'n_words': 264}