• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug XenForo_ControllerPublic_Search::actionMember()

Fuhrmann

Well-known member
#1
XenForo_ControllerPublic_Search::actionMember()

Line 311
PHP:
$searchModel = $this->_getSearchModel();
Then in the line 328 the same code, but the search model is already available in the $searchModel var.


Full code:

PHP:
public function actionMember()
    {
        $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
        $user = $this->_getUserModel()->getUserById($userId);
        if (!$user)
        {
            return $this->responseError(new XenForo_Phrase('requested_member_not_found'), 404);
        }
 
        $searchModel = $this->_getSearchModel();
 
        $content = $this->_input->filterSingle('content', XenForo_Input::STRING);
        if ($content)
        {
            $constraints = array(
                'user' => array($userId),
                'content' => $content
            );
 
            $searcher = new XenForo_Search_Searcher($searchModel);
            $results = $searcher->searchGeneral('', $constraints, 'date');
        }
        else
        {
            $maxDate = $this->_input->filterSingle('before', XenForo_Input::UINT);
 
            $searchModel = $this->_getSearchModel();
            $searcher = new XenForo_Search_Searcher($searchModel);
 
            $results = $searcher->searchUser($userId, $maxDate);
        }
 
        if (!$results)
        {
            return $this->getNoSearchResultsResponse($searcher);
        }
 
        $search = $searchModel->insertSearch($results, 'user', '', array('user_id' => $userId), 'date', false);
 
        return $this->responseRedirect(
            XenForo_ControllerResponse_Redirect::SUCCESS,
            XenForo_Link::buildPublicLink('search', $search),
            ''
        );
    }