Exemplo n.º 1
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $platform = $this->getPlatform();
     $log = $this->getLog();
     $loaderFunction = function () use($platform, $log) {
         $loader = new \ArrayObject();
         $process = $platform->exec("/bin/rpm -qa --queryformat '%{NAME}\t%{VERSION}\t%{RELEASE}\t%{URL}\n'");
         if ($process->getExitCode() !== 0) {
             $log->error($process->getOutput());
             return $loader;
         }
         foreach ($process->getOutputArray() as $line) {
             list($name, $version, $release, $url) = explode("\t", trim($line, "\n"));
             if (!preg_match('/\\.ns6/', $release)) {
                 continue;
             }
             if ($url === '(none)') {
                 $url = '#';
             }
             $loader[] = array('name' => array($name, $url), 'version' => $version, 'release' => $release);
         }
         return $loader;
     };
     $this->adapter = new \Nethgui\Adapter\LazyLoaderAdapter($loaderFunction);
 }
Exemplo n.º 2
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     if (!$this->getRequest()->isMutation()) {
         $this->parameters['name'] = \Nethgui\array_head($request->getPath());
         $this->parameters['components'] = $this->getInstalledComponents();
     }
 }
Exemplo n.º 3
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     // Every 60 seconds the view sends a query to refresh its date
     // and time controls, adding "tsquery" argument:
     if (!$request->getParameter('tsonly') !== NULL) {
         $this->initTzInfos();
     }
 }
Exemplo n.º 4
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     /* @var $session \Nethgui\Utility\SessionInterface */
     $session = $this->getParent()->getSession();
     if ($this->fieldName && $this->returnPath && $this->resumeState) {
         $this->state->start($session, NULL, $this->returnPath, NULL, $this->resumeState);
         $session->store(__CLASS__, new \ArrayObject(array_keys($this->resumeState)));
     }
 }
Exemplo n.º 5
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $fileName = implode('/', $request->getPath());
     if (!$fileName) {
         $this->fileName = FALSE;
         return;
     }
     $this->fileName = $fileName . '.' . $request->getExtension();
     if (!$this->getPhpWrapper()->file_exists($this->getCachePath($this->fileName))) {
         throw new \Nethgui\Exception\HttpException('Not Found', 404, 1324373071);
     }
 }
Exemplo n.º 6
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $defaults = $this->getCertDefaults();
     foreach ($request->getParameterNames() as $p) {
         if (!isset($defaults[$p . '_default'])) {
             continue;
         }
         if (!$this->parameters[$p]) {
             $this->parameters[$p] = $defaults[$p . '_default'];
         }
     }
 }
Exemplo n.º 7
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     if (!$this->getRequest()->getUser()->isAuthenticated()) {
         return;
     }
     $taskId = \Nethgui\array_head($request->getPath());
     if ($taskId) {
         $this->bindTask($request, $taskId);
     }
     if ($request->isMutation() && count($this->systemTasks->getRunningTasks()) > 0) {
         throw new \Nethgui\Exception\HttpException('Service Unavailable', 503, 1405692423);
     }
 }
Exemplo n.º 8
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     if ($request->isMutation()) {
         $dataSource = $this->getDataSource();
         foreach ($request->getParameter('interfaces') as $key => $props) {
             if (isset($dataSource[$key])) {
                 $dataSource[$key]->set($props);
             } else {
                 $dataSource[$key] = new \Nethgui\Adapter\RecordAdapter($this->tableAdapter);
                 $dataSource[$key]->setKeyValue($key)->set($props);
             }
         }
     }
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $this->declareParameter('SrcRaw', Validate::ANYTHING, array('fwrules', $this->ruleId, 'Src'));
     $this->declareParameter('DstRaw', Validate::ANYTHING, array('fwrules', $this->ruleId, 'Dst'));
     $this->declareParameter('ServiceRaw', Validate::ANYTHING, array('fwrules', $this->ruleId, 'Service'));
     $this->declareParameter('status', Validate::SERVICESTATUS, array('fwrules', $this->ruleId, 'status'));
     $this->declareParameter('Description', Validate::ANYTHING, array('fwrules', $this->ruleId, 'Description'));
     $this->declareParameter('Position', Validate::POSITIVE_INTEGER, array('fwrules', $this->ruleId, 'Position'));
     $this->declareParameter('LogType', $this->createValidator()->memberOf('none', 'info'), array('fwrules', $this->ruleId, 'Log'));
     $this->declareParameter('Action', $this->createValidator()->memberOf('accept', 'reject', 'drop'), array('fwrules', $this->ruleId, 'Action'));
     $this->declareParameter('Source', Validate::ANYTHING);
     $this->declareParameter('Destination', Validate::ANYTHING);
     $this->declareParameter('Service', Validate::ANYTHING);
     parent::bind($request);
 }
Exemplo n.º 10
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $this->logFile = join('/', $request->getPath());
     // Prepend / to logFile path
     if ($this->logFile) {
         $this->logFile = '/' . $this->logFile;
     }
     // Obtain the innermost request values:
     $subrequest = $request;
     foreach ($request->getPath() as $path) {
         $subrequest = $subrequest->spawnRequest($path);
     }
     $this->offset = $subrequest->hasParameter('o') ? $subrequest->getParameter('o') : 0;
     $this->query = $subrequest->hasParameter('q') ? $subrequest->getParameter('q') : NULL;
 }
Exemplo n.º 11
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $fileName = \Nethgui\array_head($request->getPath());
     if (preg_match('/[a-z][a-z0-9]+(.rst)/i', $fileName) == 0 && preg_match('/[a-z][a-z0-9]+(.html)/i', $fileName) == 0) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148405);
     }
     // Now assuming a trailing ".rst" or ".html" suffix.
     if (substr($fileName, -3) == 'rst') {
         $this->module = $this->getModuleSet()->getModule(substr($fileName, 0, -4));
     } else {
         //html
         $this->module = $this->getModuleSet()->getModule(substr($fileName, 0, -5));
     }
     if (is_null($this->module)) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148406);
     }
     $this->module->setPlatform($this->getPlatform());
     if (!$this->module->isInitialized()) {
         $this->module->initialize();
     }
 }
Exemplo n.º 12
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $this->getValidator('IpAddress')->platform('dcipaddr', $this->parameters['force'] === 'yes' ? 1 : 0);
 }
Exemplo n.º 13
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $this->emitNotifications = $request->hasParameter('notifications');
 }
Exemplo n.º 14
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $this->query = $request->hasArgument('q') ? $request->getArgument('q') : NULL;
 }
Exemplo n.º 15
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     if ($this->forcedRedirect) {
         $this->parameters['path'] = '/' . $this->forcedRedirect;
     }
 }