Esempio n. 1
0
 public function onRemFromGroup($uid)
 {
     $uid = (int) $uid;
     $gid = $this->group->getID();
     if (false === GDO::table('GWF_UserGroup')->deleteWhere("ug_userid={$uid} AND ug_groupid={$gid}")) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::fixGroupMC()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_removed_from_grp', array(GWF_User::getByID($uid)->displayUsername(), $this->group->display('group_name')));
 }
Esempio n. 2
0
 private function createBoard(GWF_Group $group)
 {
     $name = $group->getName();
     $pid = $this->module->getForumBoard()->getID();
     //		$pid = Common::clamp($this->module->cfgBID(), 1);
     if (false === GWF_ForumBoard::getByID($pid)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $groupid = $group->getID();
     $options = GWF_ForumBoard::ALLOW_THREADS;
     if (false === ($board = GWF_ForumBoard::createBoard('Usergroup: ' . $name, 'Board for the ' . $name . ' group', $pid, $options, $groupid))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $group->saveVar('group_bid', $board->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false !== ($error = $this->module->adjustFlags($group))) {
         return $error;
     }
     return false;
 }
Esempio n. 3
0
 private function onInviteJoin(GWF_Group $group, GWF_User $user)
 {
     if (false === ($invite = GWF_UsergroupsInvite::getInviteRow($user->getID(), $group->getID()))) {
         return $this->module->error('err_not_invited');
     }
     if ($invite->getVar('ugi_type') !== 'invite') {
         return $this->module->error('err_not_invited');
     }
     if (false === $invite->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->onQuickJoin($group, $user);
 }
Esempio n. 4
0
 public function adjustFlags(GWF_Group $group)
 {
     if (false === ($mod_forum = GWF_Module::getModule('Forum'))) {
         return false;
     }
     $mod_forum->onInclude();
     if (false === ($board = GWF_ForumBoard::getByID($group->getBoardID()))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     # Adjust Board and Thread Flags
     $gid = 0;
     $guestview = true;
     switch ($group->getVisibleMode()) {
         case GWF_Group::VISIBLE:
             //				$board->saveVar('board_gid', 0);
             //				$board->saveGuestView(true);
             //				$board->saveOption(GWF_ForumBoard::GUEST_VIEW, true);
             //				$this->adjustThreads($board, 0, true);
             //				return false;
             break;
         case GWF_Group::COMUNITY:
             //				$board->saveVar('board_gid', 0);
             //				$board->saveGuestView(false);
             //				$board->saveOption(GWF_ForumBoard::GUEST_VIEW, false);
             $guestview = false;
             break;
         case GWF_Group::HIDDEN:
         case GWF_Group::SCRIPT:
             //				$board->saveVar('board_gid', $group->getID());
             //				$board->saveGuestView(false);
             //				$board->saveOption(GWF_ForumBoard::GUEST_VIEW, false);
             $gid = $group->getID();
             $guestview = false;
             break;
         default:
             return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     $board->saveGroupID($gid);
     $board->saveGuestView($guestview);
 }
Esempio n. 5
0
 public function onAccept(GWF_Group $group, $array)
 {
     if (!is_array($array)) {
         return '';
     }
     $username = key($array);
     //		foreach ($array as $username => $stub) { break; }
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === ($requst = GWF_UsergroupsInvite::getRequestRow($user->getID(), $group->getID()))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::addToGroup($user->getID(), $group->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $requst->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_accepted', array($user->displayUsername(), $group->display('group_name')));
 }