static public function getUrlFromNotice(Notice $notice, $anchor=true)
{
- $conv = self::getKV('id', $notice->conversation);
+ $conv = new Conversation();
+ $conv->id = $notice->conversation;
+ $conv->find(true);
+ if (!$conv instanceof Conversation) {
+ common_debug('Conversation does not exist for notice ID: '.$notice->id);
+ throw new NoResultException($conv);
+ }
return $conv->getUrl($anchor ? $notice->id : null);
}
public function getProfile()
{
- $group = $this->getGroup();
- if (!$group instanceof User_group) {
- return null; // TODO: Throw exception when other code is ready
- }
- return $group->getProfile();
+ return $this->getGroup()->getProfile();
}
public function getGroup()
{
- return User_group::getKV('id', $this->group_id);
+ $group = new User_group();
+ $group->id = $this->group_id;
+ $group->find(true);
+ if (!$group instanceof User_group) {
+ common_log(LOG_ERR, 'User_group does not exist for Local_group: '.$this->group_id);
+ throw new NoResultException($group);
+ }
+ return $group;
}
function setNickname($nickname)
</IfModule>
<FilesMatch "\.(ini)">
- # For mod_access_compat in Apache <2.4
- #Order allow,deny
-
- # Use this instead for Apache >2.4 (mod_authz_host)
- # Require all denied
+ <IfVersion < 2.3>
+ Order allow,deny
+ Deny from all
+ </IfVersion>
+ <IfVersion >= 2.3>
+ Require all denied
+ </IfVersion>
</FilesMatch>
$this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
+ $group = Local_group::getKV('nickname', $nickname);
+ if ($group instanceof Local_group) {
+ common_redirect($group->getProfile()->getUrl());
+ }
// TRANS: Client error displayed when calling a profile action without specifying a user.
$this->clientError(_('No such user.'), 404);
}