mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Подключение от ZF1 заменяем на ZF2
Исправление несоответствия подключения от ZF1 и самого ZF2.
This commit is contained in:
parent
0387f38d7f
commit
449b519f72
3 changed files with 3 additions and 99 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,6 +10,7 @@ internal_data/captcha/**/
|
||||||
internal_data/log/
|
internal_data/log/
|
||||||
internal_data/sitemap/*.xml
|
internal_data/sitemap/*.xml
|
||||||
internal_data/triggers/
|
internal_data/triggers/
|
||||||
|
library/config.local.php
|
||||||
|
|
||||||
### Archives ###
|
### Archives ###
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -20,8 +20,8 @@ header('X-Frame-Options: SAMEORIGIN');
|
||||||
require(BB_ROOT . 'library/config.php');
|
require(BB_ROOT . 'library/config.php');
|
||||||
|
|
||||||
// Load Zend Framework
|
// Load Zend Framework
|
||||||
require(CLASS_DIR . 'zendLoader.php');
|
require_once(BB_ROOT . 'library/Zend/Loader/AutoloaderFactory.php');
|
||||||
ZendLoader::getInstance()->setupAutoloader(BB_ROOT . '/library');
|
Zend\Loader\AutoloaderFactory::factory(array());
|
||||||
|
|
||||||
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
||||||
$server_port = (in_array($bb_cfg['server_port'], array(80, 443))) ? '' : ':' . $bb_cfg['server_port'];
|
$server_port = (in_array($bb_cfg['server_port'], array(80, 443))) ? '' : ':' . $bb_cfg['server_port'];
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
class ZendLoader
|
|
||||||
{
|
|
||||||
|
|
||||||
protected static $_instance;
|
|
||||||
protected $_rootDir = '.';
|
|
||||||
protected $_setup = false;
|
|
||||||
|
|
||||||
protected function __construct() {}
|
|
||||||
|
|
||||||
public function setupAutoloader($rootDir)
|
|
||||||
{
|
|
||||||
if ($this->_setup)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_rootDir = $rootDir;
|
|
||||||
$this->_setupAutoloader();
|
|
||||||
|
|
||||||
$this->_setup = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _setupAutoloader()
|
|
||||||
{
|
|
||||||
if (@ini_get('open_basedir'))
|
|
||||||
{
|
|
||||||
set_include_path($this->_rootDir . PATH_SEPARATOR . '.');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_include_path($this->_rootDir . PATH_SEPARATOR . '.' . PATH_SEPARATOR . get_include_path());
|
|
||||||
}
|
|
||||||
|
|
||||||
spl_autoload_register(array($this, 'autoload'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function autoload($class)
|
|
||||||
{
|
|
||||||
if (class_exists($class, false) || interface_exists($class, false))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($class == 'utf8_entity_decoder')
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = $this->autoloaderClassToFile($class);
|
|
||||||
if (!$filename)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($filename))
|
|
||||||
{
|
|
||||||
include($filename);
|
|
||||||
return (class_exists($class, false) || interface_exists($class, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function autoloaderClassToFile($class)
|
|
||||||
{
|
|
||||||
if (preg_match('#[^a-zA-Z0-9_\\\\]#', $class))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->_rootDir . '/' . str_replace(array('_', '\\'), '/', $class) . '.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRootDir()
|
|
||||||
{
|
|
||||||
return $this->_rootDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final function getInstance()
|
|
||||||
{
|
|
||||||
if (!self::$_instance)
|
|
||||||
{
|
|
||||||
self::$_instance = new self();
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function setInstance(ZendLoader $loader = null)
|
|
||||||
{
|
|
||||||
self::$_instance = $loader;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue