mkdir($catches[1]); $db->cache = Zend\Cache\StorageFactory::factory($config->cache->toArray()); } else { throw $e; } } $db->config = $config; require __DIR__ . '/../lib/crm/Autoload.php'; crm\Autoload::getInstance(); $template = new Template(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, $config->template); $template->setBlock('head', 'general/head.phtml'); $template->setBlock('header', 'general/header.phtml'); $template->setBlock('breadcrumbs', 'general/breadcrumbs.phtml'); $template->setBlock('navigation', 'general/navigation.phtml'); $template->setBlock('footer', 'general/footer.phtml'); $control = $template->createControl(); $control->setBaseDir(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'control'); $connected = true; set_error_handler(create_function('', '')); try { $db->getDriver()->getConnection()->connect(); } catch (\Exception $e) { $connected = false; } restore_error_handler(); if (!$connected) { switch (php_sapi_name()) { case 'cli': throw new Exception('Db connection error', 2404150924); break; default: