public static function getUserByUsername($username)
 {
     $prefix = sfConfig::get('app_phpbb_prefix', 'Phpbb');
     $c = new Criteria();
     avrPropelTools::criteriaAdd($c, $prefix . 'Users', 'username', $username);
     return avrPropelTools::invokePeerMethod($prefix . 'Users', 'doSelectOne', $c);
 }
 public static function checkCookie($cookieName)
 {
     $prefix = sfConfig::get('app_phpbb_prefix', 'Phpbb');
     $request = sfContext::getInstance()->getRequest();
     $sessionKey = $request->getCookie($cookieName . '_k');
     $sessionId = $request->getCookie($cookieName . '_sid');
     $userId = $request->getCookie($cookieName . '_u');
     $c = new Criteria();
     avrPropelTools::criteriaAdd($c, $prefix . 'Sessions', 'session_id', $sessionId);
     avrPropelTools::criteriaAdd($c, $prefix . 'Sessions', 'session_user_id', $userId);
     $sessions = avrPropelTools::invokePeerMethod($prefix . 'Sessions', 'doCount', $c);
     return $sessions == 1;
 }
 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();
 }
 public static function setConfigValueFor($input, $value)
 {
     $prefix = sfConfig::get('app_phpbb_prefix', 'Phpbb');
     $c = new Criteria();
     avrPropelTools::criteriaAdd($c, $prefix . 'Config', 'config_name', $input);
     $newestUserConfig = avrPropelTools::invokePeerMethod($prefix . 'Config', 'doSelectOne', $c);
     $newestUserConfig->setConfigValue($value);
     $newestUserConfig->save();
     sfProcessCache::delete('config_values');
     sfProcessCache::delete('config_values_dynamic');
 }