Example #1
0
 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();
 }
Example #2
0
 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();
 }
Example #3
0
 public static function start()
 {
     global $site_ways;
     if (class_exists('XenForo_Autoloader')) {
         return;
     }
     if (empty($site_ways['main_cms'])) {
         exit('[MCMS] Не проинициализирован путь до дирректории Xenforo, проверьте опцию $site_ways[\'main_cms\'] в настройках скрипта авторизации.');
     }
     if (!file_exists($site_ways['main_cms'] . 'library/XenForo/Autoloader.php')) {
         exit('[MCMS] Файл "' . $site_ways['main_cms'] . 'library/XenForo/Autoloader.php" отсутствует. Путь до дирректории Xenforo указан не верно, проверьте опцию $site_ways[\'main_cms\'] в настройках скрипта авторизации.');
     }
     require $site_ways['main_cms'] . '/library/XenForo/Autoloader.php';
     XenForo_Autoloader::getInstance()->setupAutoloader($site_ways['main_cms'] . 'library');
     XenForo_Application::initialize($site_ways['main_cms'] . 'library', $site_ways['main_cms']);
     XenForo_Application::set('page_start_time', microtime(true));
 }
Example #4
0
 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();*/
 }
Example #5
0
 /**
  * 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;
 }
Example #6
0
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__);
$rootPath = realpath($fileDir . '/..');
chdir($rootPath);
require $rootPath . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($rootPath . '/library');
XenForo_Application::initialize($rootPath . '/library', $rootPath, false);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Phrase::setPhrases(require $fileDir . '/language_en.php');
XenForo_Template_Install::setFilePath($fileDir . '/templates');
$fc = new XenForo_FrontController(new XenForo_Dependencies_Install());
$fc->run();
Example #7
0
 /**
  * Default consturctor, instalizes XenForo classes and models.
  */
 public function __construct()
 {
     $this->xfDir = dirname(__FILE__);
     require_once $this->xfDir . '/library/XenForo/Autoloader.php';
     XenForo_Autoloader::getInstance()->setupAutoloader($this->xfDir . '/library');
     XenForo_Application::initialize($this->xfDir . '/library', $this->xfDir);
     XenForo_Application::set('page_start_time', microtime(TRUE));
     $deps = new XenForo_Dependencies_Public();
     $deps->preLoadData();
     // Disable XenForo's PHP error handler.
     XenForo_Application::disablePhpErrorHandler();
     // Enable error logging for PHP.
     error_reporting(E_ALL & ~E_NOTICE);
     $this->models = new Models();
     // TODO: Don't create models on init, only create them if they're being used (see Models::checkModel($model_name, $model)).
     $this->getModels()->setUserModel(XenForo_Model::create('XenForo_Model_User'));
     $this->getModels()->setAlertModel(XenForo_Model::create('XenForo_Model_Alert'));
     $this->getModels()->setUserFieldModel(XenForo_Model::create('XenForo_Model_UserField'));
     $this->getModels()->setAvatarModel(XenForo_Model::create('XenForo_Model_Avatar'));
     $this->getModels()->setModel('addon', XenForo_Model::create('XenForo_Model_AddOn'));
     $this->getModels()->setModel('database', XenForo_Application::get('db'));
     if ($this->hasAddon('XenResource') && $this->hasModel('XenResource_Model_Resource')) {
         $this->getModels()->setModel('resource', XenForo_Model::create('XenResource_Model_Resource'));
     }
 }
Example #8
0
 * This file will hold all code and functions for hooking the theme in with XF
 */
//******************************************************************************
// Pull instantiate and pull the template from the Xenforo system
//******************************************************************************
if (!is_admin()) {
    $XenDynamic_container = true;
    $startTime = microtime(true);
    $XenDynamic_indexFile = "../../../.." . getThemeOption("xenforo_path");
    $fileDir = dirname(__FILE__) . "/{$XenDynamic_indexFile}";
    //    $fileDir = ABSPATH . getThemeOption("xenforo_path");
    //	$fileDir = dirname(__FILE__) . "/../../../.." . getThemeOption("xenforo_path");
    if (!class_exists("XenForo_Autoloader")) {
        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_Application::disablePhpErrorHandler();
        error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING);
    }
    ob_start();
    $XenDynamic_fc = new RCBD_XenDynamic_FrontController(new XenForo_Dependencies_Public());
    $xenforoOutput = $XenDynamic_fc->runXenDynamic(ob_get_clean());
    global $templateParts;
    $templateParts = getTemplateParts($xenforoOutput, getThemeOption("xenforo_path"));
}
//******************************************************************************
// This function takes the raw buffer from Xenforo and breaks it into the header
// and the rest of the file it also does some jquery replacements for elements
// that need to be changed on all wordpress templates.
// RCBD TODO: It's ugly and I'm going to try to find a better way to do it.
Example #9
0
<?php

/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license GNU Affero General Public License
 * @link https://blueimp.net/ajax/
 */
// Include custom libraries and initialization code here
// How to use XenForo Objects: Once initialized the below you can use XenForo objects
define('XF_ROOT', AJAX_CHAT_PATH . '../');
define('TIMENOW', time());
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::disablePhpErrorHandler();
// Loads class dependencies, initilizing XF code events listeners.
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
XenForo_Session::startPublicSession();
error_reporting(E_ALL & ~E_NOTICE);
// Turn off the strict error reporting.
Example #10
0
        }
        $filePath = $HELPER_DIR . '/' . $file;
        if (file_exists($filePath) and strtolower(substr($file, -4)) == '.php') {
            $HELPERS[substr($file, 0, -4)] = $filePath;
        }
    }
    closedir($dh);
}
// load XenForo
@(include $PWD . '/library/XenForo/Autoloader.php');
if (!class_exists('XenForo_Autoloader')) {
    echo "Could not detect XenForo\n";
    exit(-1);
}
XenForo_Autoloader::getInstance()->setupAutoloader($PWD . '/library');
XenForo_Application::initialize($PWD . '/library', $PWD);
// load our functions
@(include $DIR . '/helpers_includes/common.php');
if (!class_exists('Helper_Common')) {
    echo "Corrupted script\n";
    exit(-1);
}
function readline_completion_impl($string, $index)
{
    $readline_info = readline_info();
    $line = substr($readline_info['line_buffer'], 0, $readline_info['end']);
    $parts = Helper_Common::parseCommand($line);
    $candidates = array();
    if (empty($parts)) {
        // no input yet, just return list of helper functions
        $candidates += array_keys($GLOBALS['HELPERS']);
Example #11
0
<?php

header("Content-Type: text/plain; charset=UTF-8");
// Verify login and password
$login = $_GET['login'];
$password = $_GET['password'];
if (empty($login) || empty($password)) {
    exit('Empty login or password');
}
// Load XenForo core
$dir = dirname(__FILE__);
$libraryDir = $dir . '/library';
require_once $dir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($libraryDir);
XenForo_Application::initialize($libraryDir, $dir);
XenForo_Application::set('page_start_time', microtime(true));
$db = XenForo_Application::get('db');
// Resolve user_id by login
$result = $db->fetchRow('SELECT user_id, username FROM xf_user WHERE username='******' OR email=' . $db->quote($login));
if (!count($result)) {
    exit('Incorrect login');
}
$user_id = $result['user_id'];
$username = $result['username'];
// Get user data
$result = $db->fetchCol('SELECT data FROM xf_user_authenticate WHERE user_id=' . $db->quote($user_id));
if (!count($result)) {
    exit('Unable to get user data: ' . $user_id);
}
$data = $result[0];
// Select authentication core
Example #12
0
    return $contents[count($contents) - 1]->name;
}
if (php_sapi_name() !== "cli") {
    die("Oops. Please run this script at the command line");
}
$libDir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
$xfPath = $libDir . "XenForo" . DIRECTORY_SEPARATOR;
$autoloaderPath = $xfPath . DIRECTORY_SEPARATOR . "Autoloader.php";
if (!file_exists($autoloaderPath)) {
    ec("Checked " . $libDir . DIRECTORY_SEPARATOR . "Autoloader.php");
    die("This file should be inside the AssociationMc directory in the library directory of a XenForo installation.");
}
/** @noinspection PhpIncludeInspection */
require_once $autoloaderPath;
XenForo_Autoloader::getInstance()->setupAutoloader($libDir);
XenForo_Application::initialize($libDir, $libDir);
XenForo_Application::setDebugMode(true);
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
$db = XenForo_Application::getDb();
/** @var $db Zend_Db_Adapter_Abstract */
// Fun hack so we don't need a new function on the model :P
$records = $db->fetchAll('SELECT *, HEX(minecraft_uuid) FROM xf_association_mc');
$totalRecords = count($records);
ec("{$totalRecords} recoord(s) are to be processed." . PHP_EOL);
$i = 0;
foreach ($records as $record) {
    $hex = $record['HEX(minecraft_uuid)'];
    $xfId = $record['xenforo_id'];
    $lastUsername = $record['last_username'];
    ec("Processing user with id {$xfId}. Their last known username was {$lastUsername}. Their UUID is {$hex}.");
Example #13
0
$GROUP = 'dark_taigachat';
$PERM = 'post';
//MyLoli
$params = $_POST;
$xenAPI = new XenAPI($apiUrl, $apiKey);
$err = 0;
$errMsg = "Success!";
try {
    $message = $params['msg'];
    $login = $params['l'];
    $hash = $params['hash'];
    if (checkAuthHash($login, $hash, $xenAPI)) {
        $xfDir = dirname('../../');
        require_once $xfDir . '/library/XenForo/Autoloader.php';
        XenForo_Autoloader::getInstance()->setupAutoloader($xfDir . '/library');
        XenForo_Application::initialize($xfDir . '/library', $xfDir);
        XenForo_Application::set('page_start_time', microtime(TRUE));
        $uid = getUserID($DBH, $login);
        //print($uid);
        $user = XenForo_Visitor::setup($uid);
        //var_dump($user, true);
        if ($user->hasPermission($GROUP, $PERM)) {
            $time = time();
            //uid - 1
            //login - 2
            //time - 3,4
            //msg - 5
            $q = "INSERT INTO dark_taigachat (user_id, room_id, username, date, last_update, message, activity) VALUES (? 1, '?', ?, ?, '?', 0) ";
            $STH = $DBH->prepare($q);
            $STH->bindParam(1, $uid);
            $STH->bindParam(2, $login);