// GPL licensed (see end of file) * Use at your own risk!
//
// More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
///
include ('csrf.php');
session_start();
$modules_path = '/usr/local/etc/ncp-config.d/';
$l10nDir = "l10n";
ignore_user_abort( true );
require("L10N.php");
try {
$l = new L10N($_SERVER["HTTP_ACCEPT_LANGUAGE"], $l10nDir, $modules_path);
} catch (Exception $e) {
die(json_encode("
";
}
// return JSON
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
echo ' "table": ' . json_encode( $table ) . ' , ';
echo ' "suggestions": ' . json_encode( $suggestions ) . ' , ';
echo ' "ret": "' . $ret . '" }';
}
else if ( $_POST['action'] == "sidebar" )
{
require( "sidebar.php" );
// return JSON
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
echo ' "output": ' . json_encode( print_sidebar( $l, true ) ) . ' , ';
echo ' "ret": "0" }';
}
else if ( $_POST['action'] == "cfg-ui" )
{
$ret = $l->save( $_POST['value'] );
$ret = $ret !== FALSE ? 0 : 1;
// return JSON
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
echo ' "ret": "' . $ret . '" }';
}
}
// License
//
// This script is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This script is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this script; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA
?>