public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         $this->getPlatform()->exec('/usr/bin/sudo /usr/bin/yum clean all');
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['tableClass'] = 'small-dataTable';
     $view['columns'] = array(array('name' => 'Name'), array('name' => 'Issuer'), array('name' => 'ExpireDate'), array('name' => 'Actions'));
     $view['rows'] = $this->fetchCertificatesDatabase();
 }
Exemple #3
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['domain'] = \Nethgui\array_end(explode('.', \gethostname(), 2));
     $view['Provider'] = $this->provider;
     $view['Details'] = $this->details;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['logFile'] = '';
     if ($this->getRequest()->isValidated()) {
         $view['logFile'] = $this->logFile;
         $args = array($this->logFile);
         if ($this->offset) {
             array_unshift($args, '-o', $this->offset);
         }
         if ($this->query) {
             array_unshift($args, '-p', $this->query);
         }
         if ($this->isRegexp) {
             array_unshift($args, '-r');
         }
         $command = $this->prepareCommand('/usr/bin/sudo /sbin/e-smith/logviewer', $args);
         //$this->getLog()->notice($command);
         $view->getCommandList('/Main')->setDecoratorTemplate(function (\Nethgui\View\ViewInterface $view) use($command) {
             // Discard any output buffer:
             while (ob_get_level() > 0) {
                 ob_end_clean();
             }
             header(sprintf('Content-Type: %s', 'text/plain; charset=UTF-8'));
             passthru($command);
             exit(0);
         });
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getRequest()->isValidated()) {
         $view->getCommandList()->show();
     }
 }
Exemple #6
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName');
     $system = $this->getPlatform()->getDatabase('configuration')->getType('SystemName');
     $view['FQDN'] = "{$system}.{$domain}";
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $h = self::getQuotaUiFunction($this->getPlatform()->getDatabase('configuration'));
     $view['QuotaDefaultSizeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($h);
     $view['SpamRetentionTimeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('1d' => $view->translate('${0} day', array(1)), '2d' => $view->translate('${0} days', array(2)), '4d' => $view->translate('${0} days', array(4)), '7d' => $view->translate('${0} days', array(7)), '15d' => $view->translate('${0} days', array(15)), '30d' => $view->translate('${0} days', array(30)), '60d' => $view->translate('${0} days', array(60)), '90d' => $view->translate('${0} days', array(90)), '180d' => $view->translate('${0} days', array(180)), 'infinite' => $view->translate('ever')));
 }
Exemple #8
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->parameters['switch']) {
         $view->getCommandList()->httpHeader('HTTP/1.1 302 Found')->httpHeader('Location: ' . $view->getSiteUrl() . $view->getPathUrl() . $this->parameters['switch'] . '/' . implode('/', $this->getRequest()->getOriginalPath()));
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['MaxPassAgeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('30' => $view->translate('${0} days', array(30)), '60' => $view->translate('${0} days', array(60)), '90' => $view->translate('${0} days', array(90)), '180' => $view->translate('${0} days', array(180)), '365' => $view->translate('${0} days', array(365))));
     $view['MinPassAgeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('0' => $view->translate('${0} days', array(0)), '30' => $view->translate('${0} days', array(30)), '60' => $view->translate('${0} days', array(60)), '90' => $view->translate('${0} days', array(90)), '180' => $view->translate('${0} days', array(180)), '365' => $view->translate('${0} days', array(365))));
     $view['PassWarningDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('7' => $view->translate('${0} days', array(7)), '15' => $view->translate('${0} days', array(15)), '30' => $view->translate('${0} days', array(30))));
 }
Exemple #10
0
 public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         $this->getPlatform()->signalEvent('nethserver-squidguard-downloadlists &');
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->isAuthNeeded === TRUE && $this->getRequest()->isMutation()) {
         $view->getCommandList('/Notification')->showMessage($view->translate('Join_failed_message'), \Nethgui\Module\Notification\AbstractNotification::NOTIFY_ERROR);
     }
 }
 public function initialize()
 {
     parent::initialize();
     $this->declareParameter('status', Validate::SERVICESTATUS, array('configuration', 'snmpd', 'status'));
     $this->declareParameter('Community', Validate::NOTEMPTY, array('configuration', 'snmpd', 'Community'));
     $this->declareParameter('SysContact', Validate::ANYTHING, array('configuration', 'snmpd', 'SysContact'));
     $this->declareParameter('SysLocation', Validate::ANYTHING, array('configuration', 'snmpd', 'SysLocation'));
 }
Exemple #13
0
 public function process()
 {
     parent::process();
     if ($this->getRequest()->hasParameter('Clear_cache')) {
         // Signal nethserver-squid-clear-cache
         $this->getPlatform()->signalEvent('nethserver-squid-clear-cache &');
     }
 }
 public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         // Signal nethserver-duc-save event
         $this->getPlatform()->signalEvent('nethserver-duc-save &');
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['statusDatasource'] = array(array('enabled', $view->translate('enabled_label')), array('disabled', $view->translate('disabled_label')));
     $view['externalFreqDatasource'] = array_map(function ($fmt) use($view) {
         return array((string) $fmt, $view->translate($fmt . '_label'));
     }, array(5, 10, 15, 30, 60));
 }
 public function nextPath()
 {
     if ($this->getRequest()->hasParameter('skip') || $this->getRequest()->isMutation()) {
         $successor = $this->getParent()->getSuccessor($this);
         return $successor ? $successor->getIdentifier() : 'Review';
     }
     return parent::nextPath();
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['username'] = $this->userName;
     $view['FullName'] = $this->getPlatform()->getDatabase('NethServer::Database::Passwd')->getProp($this->userName, 'gecos');
     $provider = new \NethServer\Tool\UserProvider($this->getPlatform());
     $view['readOnly'] = $provider->isReadOnly();
     $view['ChangePassword'] = $view->getModuleUrl('../ChangePassword');
 }
 public function initialize()
 {
     parent::initialize();
     $this->declareParameter('status', Validate::SERVICESTATUS, array(array('configuration', 'ipsec', 'ServerStatus'), array('configuration', 'xl2tpd', 'status')));
     $this->declareParameter('KeyType', $this->createValidator()->memberOf(array('rsa', 'psk')), array('configuration', 'ipsec', 'KeyType'));
     $this->declareParameter('KeyPskSecret', Validate::NOTEMPTY, array('configuration', 'ipsec', 'KeyPskSecret'));
     $this->declareParameter('L2tpNetwork', Validate::IPv4, array('configuration', 'ipsec', 'L2tpNetwork'));
     $this->declareParameter('L2tpNetmask', Validate::IPv4_NETMASK, array('configuration', 'ipsec', 'L2tpNetmask'));
 }
Exemple #19
0
 public function nextPath()
 {
     if ($this->isAuthNeeded) {
         return 'Authenticate';
     } elseif ($this->reloadPage) {
         return FALSE;
     }
     return parent::nextPath();
 }
 public function initialize()
 {
     parent::initialize();
     $this->declareParameter('City', Validate::ANYTHING, array('configuration', 'OrganizationContact', 'City'));
     $this->declareParameter('Company', Validate::NOTEMPTY, array('configuration', 'OrganizationContact', 'Company'));
     $this->declareParameter('Department', Validate::ANYTHING, array('configuration', 'OrganizationContact', 'Department'));
     $this->declareParameter('PhoneNumber', Validate::ANYTHING, array('configuration', 'OrganizationContact', 'PhoneNumber'));
     $this->declareParameter('Street', Validate::ANYTHING, array('configuration', 'OrganizationContact', 'Street'));
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $port = $this->getPlatform()->getDatabase('configuration')->getProp('cups', 'TCPPort');
     $hostname = $this->getPlatform()->getDatabase('configuration')->getType('SystemName');
     $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName');
     // redirect to CUPS web interface
     $view->getCommandList()->httpHeader("Location: https://{$hostname}.{$domain}:{$port}");
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     $sz = array('10' => '10 MB', '20' => '20 MB', '50' => '50 MB', '100' => '100 MB', '200' => '200 MB', '500' => '500 MB', '1000' => '1 GB', $this->parameters['MessageSizeMax'] => sprintf('%s MB', $this->parameters['MessageSizeMax']));
     ksort($sz, SORT_NUMERIC);
     $view['MessageSizeMaxDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($sz);
     $lt = array('1' => $view->translate('${0} day', array(1)), '2' => $view->translate('${0} days', array(2)), '4' => $view->translate('${0} days', array(4)), '7' => $view->translate('${0} days', array(7)), '15' => $view->translate('${0} days', array(15)), '30' => $view->translate('${0} days', array(30)), $this->parameters['MessageQueueLifetime'] => $view->translate('${0} days', array($this->parameters['MessageQueueLifetime'])));
     ksort($lt, SORT_NUMERIC);
     $view['MessageQueueLifetimeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($lt);
     parent::prepareView($view);
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getRequest()->isValidated()) {
         $view->getCommandList()->show();
         if ($view['LetsEncryptDomains'] === '') {
             $view['LetsEncryptDomains'] = \gethostname();
         }
     }
 }
Exemple #24
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $ips = array();
     foreach ($this->getPlatform()->getDatabase('networks')->getAll() as $key => $values) {
         if (isset($values['role']) && $values['role'] == 'green') {
             $ips[] = $values['ipaddr'];
         }
     }
     $view['ips'] = $ips;
 }
 public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         if ($this->parameters['Action'] === 'poweroff') {
             $this->getPlatform()->signalEvent('system-shutdown@post-response', array('poweroff'));
         } else {
             $this->getPlatform()->signalEvent('system-shutdown@post-response', array('reboot'));
         }
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if (!$this->templates) {
         $this->templates = $this->readTemplates();
     }
     $view['TemplateDatasource'] = array_map(function ($fmt) use($view) {
         $lang = substr($fmt, 19, 2);
         return array($fmt, $view->translate('lang_' . $lang . '_label'));
     }, $this->templates);
 }
 public function validate(\Nethgui\Controller\ValidationReportInterface $report)
 {
     parent::validate($report);
     $itemValidator = $this->getPlatform()->createValidator(\Nethgui\System\PlatformInterface::IP);
     foreach (self::splitLines($this->parameters['AccessBypassList']) as $v) {
         if (!$itemValidator->evaluate($v)) {
             $report->addValidationErrorMessage($this, 'AccessBypassList', 'IP address list', array($v));
             break;
         }
     }
 }
Exemple #28
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName');
     $system = $this->getPlatform()->getDatabase('configuration')->getType('SystemName');
     $view['FQDN'] = "{$system}.{$domain}";
     $ds = array();
     foreach ($this->getNetworkInterfaces() as $key => $props) {
         $ds[] = array($key, $key . ' - ' . $props['role']);
     }
     $view['InterfacesDatasource'] = $ds;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getRequest()->isMutation()) {
         if ($this->joinError === TRUE) {
             $this->notifications->error('Invalid credentials');
         } else {
             $view->getCommandList('/Main')->sendQuery($view->getModuleUrl('/Account'));
         }
     } elseif (!$view['login']) {
         $view['login'] = '******';
     }
 }
Exemple #30
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->adapter instanceof \Nethgui\Adapter\AdapterInterface) {
         $view['packages'] = array();
         $values = iterator_to_array($this->adapter);
         usort($values, function ($a, $b) {
             return strcmp($a['name'][0], $b['name'][0]);
         });
         $view['packages'] = $values;
         $view->getCommandList()->show();
     }
 }