setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir); XenForo_Application::set('page_start_time', $startTime); $inputHandler = new XenForo_Input(new Zend_Controller_Request_Http()); $input = $inputHandler->filter(array( 'p' => XenForo_Input::UINT, 'showtopic' => XenForo_Input::UINT, 'showforum' => XenForo_Input::UINT, 'showuser' => XenForo_Input::UINT, 'attach_id' => XenForo_Input::UINT, 'app' => XenForo_Input::STRING, 'module' => XenForo_Input::STRING, 'section' => XenForo_Input::STRING, )); if ($input['p']) { $input['type'] = '__p__'; $input['id'] = $input['p']; } else if ($input['showtopic']) { $input['type'] = 'topic'; $input['id'] = $input['showtopic']; } else if ($input['showforum']) { $input['type'] = 'forum'; $input['id'] = $input['showforum']; } else if ($input['showuser']) { $input['type'] = 'user'; $input['id'] = $input['showuser']; } else if ($input['attach_id'] && $input['app'] == 'core' && $input['module'] == 'attach' && $input['section'] = 'attach') { $input['type'] = 'attachment'; $input['id'] = $input['attach_id']; } else if (!preg_match('#(?P__p__)(?P\d+)#s', $_SERVER['REQUEST_URI'], $input)) // posts { preg_match('#/(?Ptopic|forum|user)/(?P\d+)#s', $_SERVER['REQUEST_URI'], $input); // threads, forums, users } if (!empty($input['id'])) { /* @var $importModel XenForo_Model_Import */ $importModel = XenForo_Model::create('XenForo_Model_Import'); $target = false; switch ($input['type']) { case 'forum': { if ($newId = $importModel->mapNodeId($input['id'])) { $target = XenForo_Link::buildPublicLink('canonical:forums', array('node_id' => $newId)); } break; } case 'topic': // threads { if ($newId = $importModel->mapThreadId($input['id'])) { $target = XenForo_Link::buildPublicLink('canonical:threads', array('thread_id' => $newId)); } break; } case '__p__': // posts { if ($newId = $importModel->mapPostId($input['id'])) { $target = XenForo_Link::buildPublicLink('canonical:posts', array('post_id' => $newId)); } break; } case 'attachment': { if ($newId = $importModel->mapAttachmentId($input['id'])) { $target = XenForo_Link::buildPublicLink('canonical:attachments', array('attachment_id' => $newId)); } break; } case 'user': { if ($newId = $importModel->mapUserId($input['id'])) { $target = XenForo_Link::buildPublicLink('canonical:members', array('user_id' => $newId)); } break; } } } if (empty($target)) { $target = XenForo_Link::buildPublicLink('canonical:index'); } $response = new Zend_Controller_Response_Http(); $response->setRedirect(XenForo_Link::convertUriToAbsoluteUri($target), 301); $response->sendResponse();