Skip to content

Instantly share code, notes, and snippets.

@blackswansolutions
Last active December 21, 2015 20:29
Show Gist options
  • Save blackswansolutions/6361909 to your computer and use it in GitHub Desktop.
Save blackswansolutions/6361909 to your computer and use it in GitHub Desktop.
PHP: Xenforo Loader
// Sets up XenForo App
define('XF_ROOT', '/home/victor/Workspace/candidatovaga/public/forum'); // set this (absolute path)!
define('TIMENOW', time());
$startTime = microtime(true);
define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed
require_once(XF_ROOT . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT . '/library');
XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
XenForo_Application::set('page_start_time', TIMENOW);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::disablePhpErrorHandler();
XenForo_Application::setDebugMode(false);
include("includes/functions.php");
$isOnline = $session->isOnline();
$avatarUrl = XenForo_Template_Helper_Core::callHelper('avatar', array($isOnline, 'm', null, false));
restore_error_handler();
restore_exception_handler();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment