Advertisement
Vodkaholic

Untitled

Apr 27th, 2011
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.00 KB | None | 0 0
  1. <?php
  2.     //error_reporting(E_ALL &~ E_NOTICE);
  3.     //ini_set('display_errors', 1);
  4.  
  5.  
  6. require(XENFORO_PATH . '/library/XenForo/Autoloader.php');
  7. //require(XENFORO_PATH . '/library/Zend/Registry.php');
  8. XenForo_Autoloader::getInstance()->setupAutoloader(XENFORO_PATH . '/library');
  9.  
  10. //XenForo_Application::initialize(XENFORO_PATH . '/library', XENFORO_PATH);
  11. XenForo_Application::setClassName('XenForo_Application');
  12.  
  13. XenForo_Application::$time = time();
  14.  
  15. XenForo_Application::$host = (empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']);
  16.  
  17. XenForo_Application::$secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on');
  18.  
  19. $app = XenForo_Application::getInstance();
  20. require(XenForo_Autoloader::getInstance()->autoloaderClassToFile('Lgpl_utf8'));
  21. $app->_configDir = XENFORO_PATH . '/library';
  22.  
  23. $defaultConfig = $app->loadDefaultConfig();
  24.  
  25. $config = array();
  26. require($app->_configDir . '/config.php');
  27. $outconfig = new Zend_Config(array(), true);
  28. $outconfig->merge($defaultConfig)
  29.              ->merge(new Zend_Config($config))
  30.              ->setReadOnly();
  31. $config = $outconfig;
  32.              
  33. //var_dump($app->_configDir);
  34. $app->_rootDir = XENFORO_PATH;
  35. $app->addLazyLoader('requestPaths', array($app, 'loadRequestPaths'));
  36. //var_Dump(file_exists($app->_configDir . '/config.php'));
  37. //$config = $app->loadConfig();
  38. XenForo_Application::set('config', $config);
  39. $app->addLazyLoader('db', array($app, 'loadDb'), $config->db);
  40. $app->addLazyLoader('cache', array($app, 'loadCache'), $config->cache);
  41. $app->addLazyLoader('options', array($app, 'loadOptions'));
  42. $app->addLazyLoader('simpleCache', array($app, 'loadSimpleCache'));
  43.  
  44. //$app->loadDefaultData();
  45. $app->_initialized = true;
  46.         //var_Dump("derp"); exit;
  47. XenForo_Application::set('page_start_time', microtime(true));
  48.  
  49.    
  50. class Bridge extends XenForo_ControllerPublic_Abstract {
  51.    
  52.     private static $_instance; 
  53.     public $_request;    
  54.     protected $_dependencies;    
  55.     private $_action;  
  56.     private $_session_timeout; 
  57.     protected $_view;
  58.    
  59.    
  60.     public function __construct(){    
  61.         $this->_dependencies = new XenForo_Dependencies_Public();
  62.         $this->_dependencies->preLoadData();
  63.        
  64.         $this->_request = new Zend_Controller_Request_Http();  
  65.         $this->_response = new Zend_Controller_Response_Http();
  66.        
  67.         $this->_request->setBasePath(XENFORO_PATH);        
  68.        
  69.         $requestPaths = XenForo_Application::getRequestPaths($this->_request);
  70.        
  71.         XenForo_Application::set('requestPaths', $requestPaths);                
  72.     }
  73.    
  74.    
  75.    
  76.     public function init(){
  77.         $this->_preDispatchFirst($this->_action);
  78.        
  79.         $this->_setupSession($this->_action);
  80.         $this->_handlePost($this->_action);  
  81.          
  82.         $this->_preDispatchType($this->_action);
  83.         $this->_preDispatch($this->_action);      
  84.        
  85.         XenForo_CodeEvent::fire('controller_pre_dispatch', array($this, $this->_action));        
  86.        
  87.         $this->_dependencies->preRenderView();      
  88.        
  89.         $this->_view = new XenForo_ViewPublic_Base(
  90.          new XenForo_ViewRenderer_HtmlPublic($this->_dependencies, new Zend_Controller_Response_Http(), $this->_request),
  91.          new Zend_Controller_Response_Http());    
  92.          
  93.     }
  94.    
  95.    
  96.     public function shutdown(){
  97.         $this->postDispatch(new XenForo_ControllerResponse_Message(), 'Tapatalk_ControllerPublic_Tapatalk', $this->_action);
  98.         $this->_response->sendHeaders();
  99.     }
  100.    
  101.     public function renderTemplate($templateName){                  
  102.         $template = $this->_view->createTemplateObject($templateName);
  103.         $params = $this->_dependencies->getEffectiveContainerParams(array(), $this->_request);
  104.         $params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
  105.         $template->setParams($params);
  106.         return $template->render();
  107.     }
  108.    
  109.     /*    
  110.     * Bridge instance manager
  111.     * @return Bridge
  112.     */
  113.     public static final function getInstance()
  114.     {
  115.         if (!self::$_instance)
  116.         {
  117.             self::$_instance = new Bridge();
  118.             self::$_instance->init();
  119.         }
  120.  
  121.         return self::$_instance;
  122.     }
  123.    
  124.     /**
  125.     * @return Shimmie_Dependencies_Public
  126.     */
  127.     public function getDependencies(){
  128.         return $this->_dependencies;
  129.     }
  130.    
  131.    
  132.    
  133.    
  134.    
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement