AuthShield = $AuthShield; $this->container=(null!==$container) ? $container : $AuthShield->getAppShield()->getContainer(); } /** public function auth(\UMA\JsonRpc\Request $request){ return 'admin' === $this->container->get('webfan.app.fsm.user')->getCurrentState()->getName(); } * {@inheritdoc} */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { $params = $request->params(); $config = $this->AuthShield->getAppShield()->config->export(); if(!file_exists($params->file)){ return new \UMA\JsonRpc\Error($request->id(), sprintf('File `%s` not found', $params->file)); } try{ $file2 = str_replace('config.xml', 'config.custom.xml', $params->file); $file_p = dirname($params->file).\DIRECTORY_SEPARATOR.'preferences.json'; //$file = (file_exists($file2)) ? $file2 : $params->file; // if(file_exists($file2)){ // unlink($file2); // } // if(file_exists($file_p)){ // unlink($file_p); // } $WidgetConfig = new \webfan\hps\Widget\Config($params->file); file_put_contents(str_replace('config.xml', 'config.custom.xml', $params->file), $WidgetConfig->saveXML()); $cnf = []; $context = \frdl\Context::create($cnf); $preferences = $WidgetConfig->getPreferences(); foreach($preferences as $k => $v){ $context->set($k, $v); } file_put_contents($file_p, json_encode($context->all())); }catch(\Exception $e){ return new \UMA\JsonRpc\Error($request->id(), $e->getMessage()); } return new \UMA\JsonRpc\Success($request->id(), 'Config reseted'); } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "file" : { type : ["string"] } }, "required" : ["file"], "additionalProperties": false } JSON ); } } __halt_compiler();----SIGNATURE:----utlDsu6dfVuNZJ/81T4h+DcgfUJL6ncZh0Ft4EwnoI4QPPOhlB2hIVM4bVSZwDWQPnK+mZ+Ds9tlqA3/0/UzhfcJ7hRXttI6JEItvaGJhnVyNqOZ8EEEaqbcbTRVGrck1rhdvYIzD3+bEpTCDVrfQq3CTH/T/kgiaI5AMOacakk7NqEExBgZVTHKkGVqxnsOyzOKMKOD3KEA6fvWD1UrE/79ZcNrV44mWnxCy0CSo+JRUUumkHBMRS93wk3n/zRUpT3UWcVI9AAasjRtKIT5fs73sP/8kA3fSS4LcUTOFGVFfzQzj15JCGB+KSl57X1WnjMAJoeyMdS8xFkUEbXyUFGk2BLyffuuFNIst0Wv3HQ6ex7A9SzZKxSToIH3OK30HgmBUXHlruE+KHcSVH52Hdg082Q9HUWdz+J762t6jXMGuscgpmd4RdXuVBu0+w8AezD0VnCTn96V4aZgusaE1eDZV2QFgR1FwU0Vyh687jnrl15xnxYWe+neMVXUppQL+SB1IO9yOHkXtwI+R5VNaNqD0RRT/LP2GuJCl/ABdCnhf4+3ao5SSr9Gs+XEf9a1hEoYUl4/yul7NaI7tBG5aiVspeajKSRTlW3r7/F1399HRobEDwMDi3sIYf8Cksf8SWytfdExAwnTAqLt9+sf4CMS21dDzQuXgE18L0K14A0=----ATTACHMENT:----Mzg0NzYzMjMzNzI3MDAwOSA0NjU1ODg3MDA0OTI2OTQ2IDk4NTExMzk4MDEyNDcyMTc=