示例#1
0
 public function do_execute()
 {
     $scopes = \thebuggenie\core\entities\Scope::getAll();
     $this->cliEcho("The ID for the default scope has an asterisk next to it\n\n");
     $this->cliEcho("ID", 'white', 'bold');
     $this->cliEcho(" - hostname(s)\n", 'white', 'bold');
     foreach ($scopes as $scope_id => $scope) {
         $this->cliEcho($scope_id, 'white', 'bold');
         if ($scope->isDefault()) {
             $this->cliEcho('*', 'white', 'bold');
             $this->cliEcho(" - all unspecified hostnames\n");
         } else {
             $this->cliEcho(" - " . join(', ', $scope->getHostnames()) . "\n");
         }
     }
     $this->cliEcho("\n");
 }
示例#2
0
 public function runScopes(framework\Request $request)
 {
     if ($request->isPost()) {
         $hostname = $request['hostname'];
         $hostname = str_replace(array('http://', 'https://'), array('', ''), $hostname);
         $scopename = $request['name'];
         if (!$hostname || tables\Scopes::getTable()->getByHostname($hostname) instanceof entities\Scope) {
             $this->scope_hostname_error = true;
         } elseif (!$scopename) {
             $this->scope_name_error = true;
         } else {
             $scope = new entities\Scope();
             $scope->addHostname($hostname);
             $scope->setName($scopename);
             $scope->setEnabled();
             $scope->save();
             $this->forward(framework\Context::getRouting()->generate('configure_scopes'));
         }
     }
     $this->scope_deleted = framework\Context::getMessageAndClear('scope_deleted');
     $this->scope_saved = framework\Context::getMessageAndClear('scope_saved');
     $this->scopes = entities\Scope::getAll();
 }
示例#3
0
 public function componentUserscopes()
 {
     $this->scopes = entities\Scope::getAll();
 }