setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir); XenForo_Application::set('page_start_time', $startTime); $http = new Zend_Controller_Request_Http(); $inputHandler = new XenForo_Input($http); $input = $inputHandler->filter(array( 'p' => XenForo_Input::UINT )); if(preg_match('/showpost\.php(?:\/|\?)([0-9]+)(?:-[^\/]+)?/', $http->getRequestUri(), $matches) && count($matches) >= 1){ $input['p'] = intval($matches[1]); } $target = false; if ($input['p']) { $importModel = XenForo_Model::create('XenForo_Model_Import'); if ($newId = $importModel->mapPostId($input['p'])) { $target = XenForo_Link::buildPublicLink('canonical:posts', array('post_id' => $newId)); } } if (!$target) { $target = XenForo_Link::buildPublicLink('canonical:index'); } $response = new Zend_Controller_Response_Http(); $response->setRedirect(XenForo_Link::convertUriToAbsoluteUri($target), 301); $response->sendResponse();