/** * @todo Should probably be renamed to getUserGroups or getGroups. */ public static function getModeratorGroups($user) { $prefix = sfConfig::get('app_phpbb_prefix', 'Phpbb'); $c = new Criteria(); avrPropelTools::criteriaAdd($c, $prefix . 'UserGroup', 'user_id', $user->getUserId()); avrPropelTools::criteriaAddJoin($c, $prefix . 'UserGroup', 'group_id', $prefix . 'Groups', 'group_id'); $groups = array(); foreach (avrPropelTools::invokePeerMethod($prefix . 'Groups', 'doSelect', $c) as $group) { $groups[] = $group->getGroupName(); } return $groups; }
public function execute($filterChain) { $this->prefix = sfConfig::get('app_phpbb_prefix', 'Phpbb'); // We only want to invoke the remembering filter if the user is not already authenticated if ($this->isFirstCall() && !$this->getContext()->getUser()->isAuthenticated()) { if ($cookie = $this->getContext()->getRequest()->getCookie(sfConfig::get('app_phpbb_remember_cookie_name', 'avrPhpbbRememberKey'))) { $key = unserialize(base64_decode($cookie)); $c = new Criteria(); avrPropelTools::criteriaAdd($c, $this->prefix . 'ProfileFieldData', 'PF_REMEMBER_KEY', $key[0]); avrPropelTools::criteriaAdd($c, $this->prefix . 'ProfileFieldData', 'USER_ID', $key[1]); avrPropelTools::criteriaAddJoin($c, $this->prefix . 'ProfileFieldData', 'USER_ID', $this->prefix . 'User', 'USER_ID'); $user = avrPropelTools::invokePeerMethod($this->prefix . 'User', 'doSelectOne', $c); // If the user is found with the given key and user id, the user is logged in. Otherwise nothing happens. if ($user) { $this->getContext()->getUser()->signIn($user); } } } $filterChain->execute(); }