Ejemplo n.º 1
0
Archivo: vb.php Proyecto: Kheros/MMOver
 /**
  * Initializes the vB framework.
  * All framework level objects and services are created so that they are available
  * throughout the application.  This is only done once per actual request.
  *
  * Note: If the framework is used this way then there are several limitations.
  *  - If no vB_Bootstrap was created (ie, the admincp), then you cannot render any
  *    views created by the framework.
  *  - VB_ENTRY must be defined to a valid request script that runs the framework
  *    with vB::Main()
  *  - If you are rendering views, try to create all of the views that will be
  *    used before rendering any of them.  This optimises template and phrase
  *    fetching.
  */
 public static function init($relative_path = false)
 {
     global $vbulletin, $vbphrase;
     if (self::$initialized) {
         return;
     }
     // Reference legacy registry
     self::$vbulletin = $vbulletin;
     // Legacy DB
     self::$db = $vbulletin->db;
     // Set a top level exception handler
     set_exception_handler(array('vB', 'handleException'));
     // Set unserializer to use spl registered autoloader
     ini_set('unserialize_callback_func', 'spl_autoload_call');
     // Set class autoloader
     spl_autoload_register(array('vB', 'autoload'));
     // Legacy language
     vB_Phrase::setLanguage(!empty(self::$vbulletin->session->vars['languageid']) ? self::$vbulletin->session->vars['languageid'] : intval(self::$vbulletin->options['languageid']));
     vB_Phrase::preCache($vbphrase, $GLOBALS['phrasegroups']);
     // Ensure we have friendly url class
     require_once DIR . '/includes/class_friendly_url.php';
     if ($relative_path) {
         vB_Router::setRelativePath($relative_path);
     }
     // Done
     self::$initialized = true;
 }