Ejemplo n.º 1
0
 public function __set($param, $value)
 {
     if ($param == "label") {
         $group = new GroupObject();
         if ($group->load_by_label($value)) {
             throw new Exception_Database_Exists();
         }
     }
     parent::__set($param, $value);
 }
Ejemplo n.º 2
0
 public static function create($name, $id = null)
 {
     $g = new GroupObject();
     try {
         if ($id != null) {
             $g->gid = $id;
         }
         $g->label = $name;
         $g->save();
     } catch (Exception_Database_Exists $e) {
         return false;
     }
     $g->load_by_label($name);
     method_invoke_all("hook_group_create", array($g->gid));
     return true;
 }
Ejemplo n.º 3
0
 public function creategroup()
 {
     $forbidden = array("create");
     if (isset($_POST['group_name'])) {
         $cname = strtolower($_POST['group_name']);
         if (in_array($cname, $forbidden)) {
             header("Location:" . Page::url("/admin/groups?err=reserved"));
         }
         $group = new GroupObject();
         if ($group->load_by_label($cname)) {
             header("Location:" . Page::url("/admin/groups?err=exists"));
         } else {
             $group->label = $cname;
             $group->save();
             header("Location:" . Page::url("/admin/groups"));
         }
     }
     header("Location:" . Page::url("/admin/groups?err=unknown"));
 }