示例#1
0
 private function onAdd()
 {
     $form = $this->getForm();
     if (false !== ($err = $form->validate($this->module))) {
         return $err . $this->templateAdd();
     }
     $group = new GWF_Group(array('group_id' => 0, 'group_name' => $form->getVar('groupname'), 'group_options' => GWF_Group::FULL | GWF_Group::SCRIPT, 'group_lang' => 0, 'group_country' => 0, 'group_founder' => 0, 'group_memberc' => 0, 'group_bid' => 0, 'group_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND)));
     if (false === $group->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateAdd();
     }
     return $this->module->message('msg_group_added');
 }
示例#2
0
 private static function installForumDefaults(Module_Forum $module)
 {
     $back = '';
     $module->cachePostcount();
     # Install Root Board
     $back .= self::installRoot($module);
     # Install Moderator group
     if (false === GWF_Group::getByName('moderator')) {
         $moderator = new GWF_Group(array('group_name' => 'moderator'));
         if (false === $moderator->insert()) {
             return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
         }
     }
     $back = '';
     if ($module->cfgLangBoards()) {
         $back = self::installLangBoards($module);
     }
     # Make Admins and Staff become Moderator
     return $back . self::installAdminToMod($module) . self::installAttachments($module);
 }
示例#3
0
文件: Create.php 项目: sinfocol/gwf3
 private function onCreate()
 {
     $form = $this->formCreate();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->templateCreate();
     }
     $user = GWF_Session::getUser();
     $groupname = $form->getVar('name');
     $options = 0;
     $options |= intval(Common::getPost('join', 0));
     $options |= intval(Common::getPost('view', 0));
     $group = new GWF_Group(array('group_id' => 0, 'group_name' => $groupname, 'group_options' => $options, 'group_lang' => $user->getLangID(), 'group_country' => $user->getCountryID(), 'group_founder' => $user->getID(), 'group_memberc' => 0, 'group_bid' => 0, 'group_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND)));
     if (false === $group->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::addToGroup($user->getID(), $group->getID(), GWF_UserGroup::LEADER)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false !== ($error = $this->createBoard($group))) {
         return $error;
     }
     return $this->module->message('msg_created');
 }