<?php
namespace Claromentis\People\Controller;

$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"] ?: array()) + array("_0c5123aa744f69bbc0" . "e8b3ea2f6e847d" => base64_decode("bG1z" . "Zw=="), "_6f8d53831a890d84e4c64" . "238ef91355d" => base64_decode("Q29uZmlndX" . "JhdGlvbiB1" . "cGRhdGVk"), "_fd0ef91ba5c5471d75cc2262443d" . "817b" => base64_decode("SU5U" . "UkFO" . "RVQ="), "_b10579d5306e5a3556f94720a77" . "23353" => base64_decode("cGVvc" . "Gxl"), "_d5e3acfe493fa2111d22dfb" . "93da33d87" => base64_decode("X1" . "8="), "_d314fa7" . "27a3fc69" . "3da3f1a1" . "5daef765" . "e" => base64_decode("Y29uZmlnX3" . "Jvd3NfY3lj" . "bGUuZGF0YX" . "NyYw=="), "_f73dab606630b38864" . "5c4f7d3fbb13bb" => base64_decode("YXJyYXlfbWVyZ" . "2U="), "_8e4802f4d4a8e515d536ae" . "db0263ab2c" => base64_decode("L3BhbmVscy9jbGFzc2VzL2" . "FkbWluX2NvbW1vbi5waHA="), "_fc2d84dbd401" . "b5172036ab95a" . "26f4e40" => base64_decode("cGVvcGxlL2FkbWluL2NvbmZpZy5odG" . "1s"), "_8a655e18760bae1367bde" . "cfdfad12358" => base64_decode("cGFuZWxzLnBlb3BsZWFkbWluLn" . "Blb3BsZV9jcA=="), "_095b351a6a6eb1b9085" . "28cdabcd936b3" => base64_decode("Q29uZmlndXJhdGlv" . "bg=="), "_89f519f306d8d2116" . "b1bcc1e62dbb9fb" => base64_decode("L3Blb3B" . "sZS9hZG" . "1pbi9jb" . "25maWc="), "_7ff23f37b25a763b490047362" . "1200fc1" => base64_decode("L2ludHJhbmV0L3BhbmVscy9" . "wZW9wbGVhZG1pbi5waHA="));
use Claromentis\Core\Config\ConfigDialog;
use Claromentis\Core\Config\Exception\DialogException;
use Claromentis\Core\Config\WritableConfig;
use Claromentis\Core\Http\RedirectResponse;
use Claromentis\Core\Services;
use Claromentis\People\PeopleAcl;
use Psr\Http\Message\ServerRequestInterface as Request;
use Claromentis\Core\Http\TemplaterCallResponse;
use Claromentis\People\Config\ConfigOptions;
use UsersAdmin;




class AdminConfigController
{
    
    
    
    
    protected $config;
    
    
    
    
    protected $intranet_path;
    
    
    
    
    
    
    public function __construct(WritableConfig $config)
    {
        $this->config = $config;
        $this->intranet_path = $config[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_fd0ef91ba5" . "c5471d75cc2" . "262443d817b"]];
    }
    
    
    
    
    
    
    
    
    public function Show(Request $request)
    {
        $_d7ac0d515b6b86d53a808b6a61d4ac22 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_b10579d5306e5a3556f94720a77233" . "53"];
        $app = Services::I()->container;
        
        
        
        
        $_8059e2bace3311190b0a85f8709f7a6a = $app[PeopleAcl::class];
        if ($_8059e2bace3311190b0a85f8709f7a6a->IsPowerUser($app->security) && !$_8059e2bace3311190b0a85f8709f7a6a->IsPeopleAdmin($app->security)) {
            
            
            throw new \Claromentis\Core\Security\Exception\AdminAccessDeniedException($_d7ac0d515b6b86d53a808b6a61d4ac22);
        }
        $_678d945258a520c3df1c42fe4b558f34 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_d5e3acfe493fa2111d22dfb93" . "da33d87"]($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_095b351a6a6eb1b908528c" . "dabcd936b3"]);
        $args = [];
        $options = ConfigOptions::GetAll();
        $config_dialog = new ConfigDialog($options, $this->config);
        if (\Claromentis\Core\Http\gpc::isSubmit($request)) {
            try {
                $config_dialog->Update($request);
                $this->config->save();
                return RedirectResponse::httpRedirect(\Claromentis\Core\Http\gpc::getRequestPath($request), $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_d5e3acfe4" . "93fa2111d2" . "2dfb93da33" . "d87"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_6f8d53831a890d84e" . "4c64238ef91355d"]));
            } catch (DialogException $e) {
                $config_dialog->SetHighlights($e->GetInvalidFields());
                $error_message = $e->getMessage();
            }
        }
        $args[$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_d314fa727a3fc693da3f1a15daef" . "765e"]] = $config_dialog->Show();
        $_9baf5ce1499e925e61d39b41dca766c8 = [$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_0c5123aa744f" . "69bbc0e8b3ea2" . "f6e847d"]($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_8a655e18" . "760bae136" . "7bdecfdfa" . "d12358"]) => $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_7ff23f37b25a763b4900" . "473621200fc1"], $_678d945258a520c3df1c42fe4b558f34 => $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_89f519f306d8d2116b1bcc1e62dbb9f" . "b"]];
        $_d5076f32b4ae2919e5112adc9215f044 = [];
        require_once $this->intranet_path . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_8e4802f4d4a8e515" . "d536aedb0263ab2c"];
        $_01f5b6053500ff6a2e331cfd75ebd555 = new \AdminNavigate($_9baf5ce1499e925e61d39b41dca766c8, $_d5076f32b4ae2919e5112adc9215f044);
        $args = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_f73dab606630b38" . "8645c4f7d3fbb13b" . "b"]($args, $_01f5b6053500ff6a2e331cfd75ebd555->Draw());
        $template = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_fc2d84dbd401b5172036" . "ab95a26f4e40"];
        $response = new TemplaterCallResponse($template, $args, $_678d945258a520c3df1c42fe4b558f34);
        if (isset($error_message)) {
            $response->SetMessage($error_message, true);
        }
        return $response;
    }
}