protected function __init()
{
$this->_globalVar = array('server' => $GLOBALS['server'], 'action' => $GLOBALS['action'], 'state' => $GLOBALS['state'], 'count' => $GLOBALS['count'], 'tube' => $GLOBALS['tube'], '_tplMain' => $GLOBALS['tplMain'], '_tplBlock' => $GLOBALS['tplBlock'], 'config' => $GLOBALS['config']);
$this->_tplVars = $this->_globalVar;
if (!in_array($this->_tplVars['_tplBlock'], array('allTubes', 'serversList'))) {
unset($this->_tplVars['_tplBlock']);
}
if (!in_array($this->_tplVars['_tplMain'], array('main', 'ajax'))) {
unset($this->_tplVars['_tplMain']);
}
if (empty($this->_tplVars['_tplMain'])) {
$this->_tplVars['_tplMain'] = 'main';
}
foreach ($GLOBALS['config']['servers'] as $key => $server) {
$this->serversConfig[$key] = $server;
}
if (null !== getenv('BEANSTALK_SERVERS')) {
foreach (explode(',', getenv('BEANSTALK_SERVERS')) as $key => $server) {
$this->serversEnv[$key] = $server;
}
}
if (isset($_COOKIE['beansServers'])) {
foreach (explode(';', $_COOKIE['beansServers']) as $key => $server) {
$this->serversCookie[$key] = $server;
}
}
try {
$storage = new Storage($GLOBALS['config']['storage']);
} catch (Exception $ex) {
$this->_errors[] = $ex->getMessage();
}
}