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 process() { parent::process(); if ($this->getRequest()->isMutation()) { if ($this->parameters['Action'] === 'poweroff') { $cmd = '/sbin/poweroff'; } else { $cmd = '/sbin/reboot'; } $this->process = $this->getPlatform()->exec('/usr/bin/sudo ${1}', array($cmd)); sleep(1); } elseif ($this->getRequest()->hasParameter('wait')) { // parse /sbin/runlevel output to get the current runlevel value: $this->process = $this->getPlatform()->exec('/sbin/runlevel'); $runlevel = \Nethgui\array_end(explode(' ', $this->process->getOutput())); NETHGUI_DEBUG && $this->getLog()->notice('RUNLEVEL ' . $runlevel . ' ' . join(', ', $this->getRequest()->getParameterNames())); // runlevel validation: if ($runlevel === '0' || $runlevel === '6') { NETHGUI_DEBUG && $this->getLog()->notice('Sleeping 10 seconds..'); sleep(10); } else { // wait argument is allowed only on reboot and halt runlevels! sleep(2); throw new \Nethgui\Exception\HttpException('Forbidden', 403, 1355301177); } } }
public function __construct($identifier = NULL) { $this->php = new \Nethgui\Utility\PhpWrapper(get_class($this)); $this->viewTemplate = NULL; if (isset($identifier)) { $this->identifier = $identifier; } else { $this->identifier = \Nethgui\array_end(explode('\\', get_class($this))); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { $this->declareParameter('service', Validate::ANYTHING); parent::bind($request); $service = \Nethgui\array_end($request->getPath()); if (!$service) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1454344500); } $this->parameters['service'] = $service; }
public function bind(\Nethgui\Controller\RequestInterface $request) { $this->declareParameter('username', Validate::USERNAME); parent::bind($request); $username = \Nethgui\array_end($request->getPath()); if (!$username) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148400); } $this->parameters['username'] = $username; }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); if ($request->isMutation()) { $keyValue = $request->getParameter('hostname'); } else { $keyValue = \Nethgui\array_end($this->getRequest()->getPath()); } $this->getAdapter()->setKeyValue($keyValue); }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); $this->key = \Nethgui\array_end($request->getPath()); /* @var $tableAdapter \ArrayInterface */ $tableAdapter = $this->getAdapter(); // Check if the ibay identifier is set: if (!isset($tableAdapter[$this->key])) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1353949626); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { parent::bind($request); if ($this->getIdentifier() !== 'create') { $this->parameters['Name'] = \Nethgui\array_end($request->getPath()); } if ($this->getRequest()->isMutation()) { $this->parameters['NewName'] = $this->getRequest()->getParameter('Name'); $this->parameters['pseudonym'] = trim($this->getRequest()->getParameter('localAddress')) . '@' . $this->getRequest()->getParameter('domainAddress'); } }
/** * * @param \Nethgui\Controller\Table\AbstractAction $action * @param string $pluginsPath */ public function __construct(\Nethgui\Controller\Table\AbstractAction $action, $pluginsPath = NULL) { if (is_null($pluginsPath)) { $id = \Nethgui\array_end(explode('\\', get_class($action))); } else { $id = \Nethgui\array_end(explode('/', $pluginsPath)); } parent::__construct(); // empty identifier $this->innerAction = $action; $this->plugins = new \Nethgui\Controller\Table\PluginCollector($id); $this->plugins->setParent($action); $this->pluginsPath = $pluginsPath; }
public function process() { parent::process(); if (!$this->getRequest()->isMutation()) { return; } $domain = \Nethgui\array_end(\explode('.', \gethostname(), 2)); $ph = popen('/usr/bin/sudo /usr/sbin/realm join ' . $domain, 'w'); fwrite($ph, $this->parameters['password'] . "\n"); $err = pclose($ph); if ($err === 0) { $this->getPlatform()->getDatabase('configuration')->setProp('sssd', array('status' => 'enabled')); $this->getPlatform()->signalEvent('nethserver-sssd-save'); } else { $this->joinError = TRUE; $this->getLog()->error("[ERROR] exit code from realm join operation is {$err}"); } }
public function write($value) { $arr = $this->data; $currentValue = $this->read(); if ($currentValue === $value) { return; } $this->arr[\Nethgui\array_end($this->subscriptList)] = $value; }
/** * Get the js types required by this widget class. * * Each element of the returned array is a string <namespace>:<widgetType> * * @api * @return array An array of required js widget types */ protected function getJsWidgetTypes() { return array('Nethgui:' . strtolower(\Nethgui\array_end(explode('\\', get_class($this))))); }
public function bind(\Nethgui\Controller\RequestInterface $request) { $this->setUserName(\Nethgui\array_end($request->getPath())); parent::bind($request); }