public static function tpr_callback($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template) { if ($templateName == 'xenforo.css') { XenForo_Session::startPublicSession(); $nid = 0; #default $visitor = XenForo_Visitor::getInstance(); if ($visitor['user_id']) { if ($visitor->hasPermission('backgroundchanginggroup', 'canchangebkg')) { $uid = $visitor['user_id']; $r = customBackgroundChooser_sharedStatic::getFromDB($nid, $uid); $f = null; if (customBackgroundChooser_sharedStatic::startsWith($r, 'url')) { $u = substr($r, 3); $i = 'rgb(0, 0, 0) url(\'' . $u . '\') no-repeat fixed 50% 0 / cover'; $f = $i; } else { if (customBackgroundChooser_sharedStatic::startsWith($r, 'sug')) { $u = substr($r, 3); $i = 'rgb(0, 0, 0) url(\'styles/kiror/customBackgroundChooser/defaultImages/' . $u . '.jpg\') no-repeat fixed 50% 0 / cover'; $f = $i; } else { if (customBackgroundChooser_sharedStatic::startsWith($r, 'clr')) { $u = substr($r, 3); $f = $u; } } } if ($f) { $content .= "\nbody\n{\n\tbackground: " . $f . ";\n}\n"; } } } } }
public static function userLoad() { global $site_ways; XenForo_Session::startPublicSession(); $visitor = XenForo_Visitor::getInstance(); return $visitor->getUserId(); }
public function __construct() { $startTime = microtime(true); $fileDir = XF_ROOT; require $fileDir . '/library/XenForo/Autoloader.php'; XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir); XenForo_Application::set('page_start_time', $startTime); XenForo_Session::startPublicSession(); }
public function __construct($root = XF_ROOT) { $startTime = microtime(true); $fileDir = $root; require $fileDir . '/library/XenForo/Autoloader.php'; XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir, true, array('resetOutputBuffering' => false)); XenForo_Application::set('page_start_time', $startTime); XenForo_Session::startPublicSession(); }
protected function _setupSession($action) { if (!XenForo_Application::isRegistered('session')) { if ($this->_noRedirect() && $this->_routeMatch->getResponseType() === 'json' && $this->_input->filterSingle('_layoutEditor', XenForo_Input::BOOLEAN)) { // use public session if the page is being requested within layout editor // this poses a slight security risk but UX benefit is tremendous // TODO: keep an eye on it XenForo_Session::startPublicSession($this->_request); } } parent::_setupSession($action); }
public function __construct() { $startTime = microtime(true); $xf_path = Yii::getPathOfAlias('webroot') . '/forum'; Yii::registerAutoloader(array('XenforeLoader', 'autoload'), true); XenForo_Autoloader::getInstance()->setupAutoloader($xf_path . '/library'); XenForo_Application::initialize($xf_path . '/library', $xf_path); XenForo_Application::set('page_start_time', $startTime); XenForo_Application::disablePhpErrorHandler(); error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING); $dependencies = new XenForo_Dependencies_Public(); $dependencies->preLoadData(); XenForo_Session::startPublicSession(); $this->visitor = XenForo_Visitor::getInstance(); /*$fc = new XenForo_FrontController(new XenForo_Dependencies_Public()); ob_start(); $fc->run(); $content = ob_get_clean();*/ }
/** * Uses the XenForo_Autoloader to initialize and startPublicSession to get * and instance of the Visitor, if there is one. * * @return int */ function authenticateSession() { /** * Get the xenForo Autoloader */ if (is_dir($this->fileDir)) { require $this->fileDir . '/library/XenForo/Autoloader.php'; XenForo_Autoloader::getInstance()->setupAutoloader($this->fileDir . '/library'); /** * initialize */ XenForo_Application::initialize($this->fileDir . '/library', $this->fileDir); XenForo_Session::startPublicSession(); $this->xfUser = XenForo_Visitor::getInstance(); return $this->xfUser->getUserId(); } die('no path'); // TODO: CI error log return false; }
public function login($user_id, $username, $ip_address) { $session = XenForo_Session::startPublicSession(); $session->set('user_id', $user_id); $session->set('username', $username); $session->set('ip', XenForo_Helper_Ip::convertIpStringToBinary($ip_address)); //$session->set('userAgent', $user_agent); $session->saveSessionToSource($session->getSessionId(), false); return $session; }
/** * Setup the session. * * @param string $action */ protected function _setupSession($action) { if (XenForo_Application::isRegistered('session')) { return; } $session = XenForo_Session::startPublicSession($this->_request); }
public function actionComplete() { $session = XenForo_Session::startPublicSession(); $worldId = $session->get('gw2_world'); $session->set('gw2_world', ''); if (!$worldId) { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink(''), ''); } $viewParams = array('world' => $worldId); return $this->responseView('Moturdrn_TS3GW2Auth_ViewPublic_Complete', 'Moturdrn_TS3GW2Auth_Complete', $viewParams); }
$nav = array(); require HR_INC . 'logging.php'; require HR_INC . 'std.php'; // Load up the XenForo system Log::add('Begin initialising XenForo...'); $startTime = microtime(true); //$fileDir = realpath('./../forums/'); $fileDir = '/home2/bukkit/public_html/forums/'; require $fileDir . '/library/XenForo/Autoloader.php'; XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library'); XenForo_Application::initialize($fileDir . '/library', $fileDir); XenForo_Application::set('page_start_time', $startTime); // Not required if you are not using any of the preloaded data $dependencies = new XenForo_Dependencies_Public(); $dependencies->preLoadData(); XenForo_Session::startPublicSession(); Log::add('XF initialisation complete!'); // End XenForo inc('db.php'); inc('content.php'); inc('sidebar.php'); inc('user.php'); inc('template.php'); inc('message.php'); inc('plugin.php'); // Mandatory include-everywhere libraries inclib('phpmailer/class.phpmailer.php'); // because then we can set defaults here $mailer = new PHPMailer(); $mailer->SetFrom('*****@*****.**', 'hRepo System'); $mailer->IsSendmail();
/** * Intercept a request for a link redirect * * @param string|bool $error If non-false, an error that occurred when validating the request */ protected function _outputLinkRedirect($error) { if ($error === 'invalid_url') { header('Content-Type: text/html; utf-8', true, 500); die('Invalid URL'); } if (empty(XenForo_Application::getOptions()->imageLinkProxy['links'])) { $error = 'disabled'; } if (!$error) { /* @var $proxyModel XenForo_Model_LinkProxy */ $proxyModel = XenForo_Model::create('XenForo_Model_LinkProxy'); $proxyModel->logVisit($this->_url); header('Location: ' . $this->_url, true, 302); exit; } $request = new Zend_Controller_Request_Http(); XenForo_Session::startPublicSession($request); $this->_dependencies->preRenderView(); if (!preg_match('#^https?://#i', $this->_url)) { throw new Exception('Unsafe proxy URL: ' . $this->_url); } $printable = urldecode($this->_url); if (!preg_match('/./u', $printable)) { $printable = $this->_url; } $renderer = new XenForo_ViewRenderer_HtmlPublic($this->_dependencies, $this->_response, $request); $contents = $renderer->createTemplateObject('link_redirect', array('url' => $this->_url, 'printable' => $printable, 'parts' => parse_url($this->_url))); $containerParams = $this->_dependencies->getEffectiveContainerParams(array(), $request); $output = $renderer->renderContainer($contents, $containerParams); $extraHeaders = XenForo_Application::gzipContentIfSupported($output); foreach ($extraHeaders as $extraHeader) { $this->_response->setHeader($extraHeader[0], $extraHeader[1], $extraHeader[2]); } $this->_response->setHeader('X-Proxy-Error', $error); $this->_response->sendHeaders(); echo $output; }