public function runScopes(TBGRequest $request)
 {
     if ($request->isMethod(TBGRequest::POST)) {
         $hostname = $request->getParameter('hostname');
         $scopename = $request->getParameter('name');
         if (!$hostname || TBGScopesTable::getTable()->getByHostname($hostname) instanceof TBGScope) {
             $this->scope_hostname_error = true;
         } elseif (!$scopename) {
             $this->scope_name_error = true;
         } else {
             $scope = new TBGScope();
             $scope->addHostname($hostname);
             $scope->setName($scopename);
             $scope->setEnabled();
             $scope->save();
             $this->forward(TBGContext::getRouting()->generate('configure_scopes'));
         }
     }
     $this->scope_deleted = TBGContext::getMessageAndClear('scope_deleted');
     $this->scopes = TBGScope::getAll();
 }
Beispiel #2
0
 public function runScopes(TBGRequest $request)
 {
     if ($request->isPost()) {
         $hostname = $request['hostname'];
         $hostname = str_replace(array('http://', 'https://'), array('', ''), $hostname);
         $scopename = $request['name'];
         if (!$hostname || TBGScopesTable::getTable()->getByHostname($hostname) instanceof TBGScope) {
             $this->scope_hostname_error = true;
         } elseif (!$scopename) {
             $this->scope_name_error = true;
         } else {
             $scope = new TBGScope();
             $scope->addHostname($hostname);
             $scope->setName($scopename);
             $scope->setEnabled();
             $scope->save();
             $this->forward(TBGContext::getRouting()->generate('configure_scopes'));
         }
     }
     $this->scope_deleted = TBGContext::getMessageAndClear('scope_deleted');
     $this->scopes = TBGScope::getAll();
 }