diff --git a/classes/Conversation.php b/classes/Conversation.php index 343668cc49..537c214a4c 100644 --- a/classes/Conversation.php +++ b/classes/Conversation.php @@ -108,7 +108,13 @@ class Conversation extends Managed_DataObject 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); } diff --git a/classes/Local_group.php b/classes/Local_group.php index c0dcf02e4b..9e95102d85 100644 --- a/classes/Local_group.php +++ b/classes/Local_group.php @@ -40,16 +40,19 @@ class Local_group extends Managed_DataObject 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) diff --git a/htaccess.sample b/htaccess.sample index f7513cc0c7..af6e19784d 100644 --- a/htaccess.sample +++ b/htaccess.sample @@ -45,9 +45,11 @@ - # For mod_access_compat in Apache <2.4 - #Order allow,deny - - # Use this instead for Apache >2.4 (mod_authz_host) - # Require all denied + + Order allow,deny + Deny from all + + = 2.3> + Require all denied + diff --git a/lib/profileaction.php b/lib/profileaction.php index 5923640097..bd5bb5a148 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -66,6 +66,10 @@ abstract class ProfileAction extends ManagedAction $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); }