<?php
/**
 * VFM - veno file manager: admin-panel/view/admin-head-settings.php
 * main general settings setting process
 *
 * PHP version >= 5.3
 *
 * @category  PHP
 * @package   VenoFileManager
 * @author    Nicola Franchini <support@veno.it>
 * @copyright 2013 Nicola Franchini
 * @license   https://veno.es/shop/help Veno Commercial License
 * @link      http://filemanager.veno.it/
 */
if (!defined('VFM_APP') || !isset($gateKeeper) || !$gateKeeper->canSuperAdmin('superadmin_can_updates')) {
    die('Direct access not allowed or insufficient permissions.');
}

if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    /**
    * General Settings
    */
    $_CONFIG['license_key'] = filter_input(INPUT_POST, "license_key", FILTER_SANITIZE_URL);
    // Save settings.
    if (Utils::writePhpData(dirname(dirname(__DIR__)).'/config.php', '$_CONFIG', $_CONFIG)) {
        Utils::setSuccess($setUp->getString('settings_updated'));
        $updater->clearCache('config.php');
    } else {
        Utils::setError('Error saving config file');
    }
    header('Location:'.$script_url.'vfm-admin/?section=updates');
    exit();
}