Ejemplo n.º 1
0
 public function add_set()
 {
     if ($this->token->validate('add_set')) {
         $gsName = trim($this->post('gsName'));
         if (!$gsName) {
             $this->error->add(t("Specify a name for your group set."));
         } else {
             if (preg_match('/[<>{};?"`]/i', $gsName)) {
                 $this->error->add(t('Invalid characters in group set name.'));
             }
         }
         if (!$this->error->has()) {
             $gs = GroupSet::add($gsName);
             if (is_array($_POST['gID'])) {
                 foreach ($_POST['gID'] as $gID) {
                     $g = Group::getByID($gID);
                     if (is_object($g)) {
                         $gs->addGroup($g);
                     }
                 }
             }
             $this->redirect('dashboard/users/group_sets', 'set_added');
         }
     } else {
         $this->error->add($this->token->getErrorMessage());
     }
 }
Ejemplo n.º 2
0
 public function add_set()
 {
     if ($this->token->validate('add_set')) {
         if (!trim($this->post('gsName'))) {
             $this->error->add(t("Specify a name for your group set."));
         }
         $gsName = trim($this->post('gsName'));
         if (!Loader::helper('validation/strings')->alphanum($gsName, true)) {
             $this->error->add(t('Set Names must only include alphanumerics and spaces.'));
         }
         if (!$this->error->has()) {
             $gs = GroupSet::add($gsName);
             if (is_array($_POST['gID'])) {
                 foreach ($_POST['gID'] as $gID) {
                     $g = Group::getByID($gID);
                     if (is_object($g)) {
                         $gs->addGroup($g);
                     }
                 }
             }
             $this->redirect('dashboard/users/group_sets', 'set_added');
         }
     } else {
         $this->error->add($this->token->getErrorMessage());
     }
 }