✏️ 正在编辑: Bootstrap.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/Bootstrap.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php require_once(APPLICATION_PATH . '/../vendor/autoload.php'); class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype(Zend_View_Helper_Doctype::HTML5); } protected function _initNamespace() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace(array( 'Validators', 'String', 'Core', 'PHPExcel', 'Yuppie', 'Realtime', 'Upload' )); } protected function _initNavigation() { $this->_bootstrap('db'); $role = isset(Yuppie_Auth::getIdentity()->grupo) ? Yuppie_Auth::getIdentity()->grupo : null; $navigation = APPLICATION_PATH . '/configs/navigation.xml'; $this->bootstrap('layout'); $layout = $this->getResource('layout'); if( $role == "Supervisor" ){ $navigation = APPLICATION_PATH . '/configs/navigation-supervisor.xml'; } elseif( $role == "Corretor" ){ $navigation = APPLICATION_PATH . '/configs/navigation-corretor.xml'; } elseif( $role == "Corretor Digitador" ){ $navigation = APPLICATION_PATH . '/configs/navigation-corretor.xml'; } elseif( $role == "Gerente" ){ } elseif( $role == "Callcenter" ){ $navigation = APPLICATION_PATH . '/configs/navigation-callcenter.xml'; } $view = $layout->getView(); if( isset(Yuppie_Auth::getIdentity()->corretor_id) && Yuppie_Auth::getIdentity()->corretor_id > 0 ){ $navCorretor = APPLICATION_PATH . '/configs/navigation-corretor.xml'; $configCorretor = new Zend_Config_Xml($navCorretor, 'nav'); $dadosCorretor = $configCorretor->toArray(); unset( $dadosCorretor['meus-contratos'], $dadosCorretor['chamados'], $dadosCorretor['propostas'], $dadosCorretor['meus-protocolos'], $dadosCorretor['relatorios'], $dadosCorretor['minhas-comissoes'] ); $config = new Zend_Config_Xml($navigation, 'nav'); $dadosUsuarioCorretor = $config->toArray(); unset( $dadosUsuarioCorretor['financeiro'], $dadosUsuarioCorretor['apoio-comercial'], $dadosUsuarioCorretor['protocolos'], $dadosUsuarioCorretor['relatorios']['pages']['sintetico-agrupado'], $dadosUsuarioCorretor['relatorios']['pages']['extrato-comissao'] ); $mergeNavigation = array_merge($dadosUsuarioCorretor, $dadosCorretor); $navigation = new Zend_Navigation($mergeNavigation); } else { $config = new Zend_Config_Xml($navigation, 'nav'); $navigation = new Zend_Navigation($config); } $acl = new Core_LibraryAcl($role); $view->navigation($navigation)->setAcl($acl)->setRole($role); } protected function _initViewHelpers() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); $view->addHelperPath('Yuppie/View/Helper/', 'Yuppie_View_Helper'); $view->addHelperPath('Core/View/Helper/', 'Core_View_Helper'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); } protected function _initPlugins() { // We're getting the Front Controller here $front = Zend_Controller_Front::getInstance(); // The plugins need to be registered with the Front Controller - or else they'll just be ignored $front->registerPlugin(new Plugin_Auth()); $front->registerPlugin(new Plugin_LiberacaoModulos()); // register_shutdown_function('Plugin_ErrorHandler::captureError'); } protected function _initTimeZone() { date_default_timezone_set('America/Recife'); } protected function _initPaginator() { Zend_Paginator::setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); } protected function _initUploadDirAndConstant() { $uploadPath = PUBLIC_PATH . '/../public/uploads'; if( !file_exists($uploadPath) ){ if( !mkdir($uploadPath) ){ throw new Exception('Cannot make the following directorry: ' . $uploadPath); } } // if $uploadPath was created than define a constant defined('UPLOAD_PATH') || define('UPLOAD_PATH', $uploadPath); } protected function _initDownloadDirAndConstant() { $downloadPath = PUBLIC_PATH . '/../public/downloads'; if( !file_exists($downloadPath) ){ if( !mkdir($downloadPath) ){ throw new Exception('Cannot make the following directorry: ' . $downloadPath); } } // if $uploadPath was created than define a constant defined('DOWNLOAD_PATH') || define('DOWNLOAD_PATH', $downloadPath); } protected function _initZFDebug() { $this->bootstrap('db'); $this->bootstrap('cachemanager'); $zfdebug = $this->getOption('zfdebug'); if( $zfdebug ){ $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('ZFDebug'); $cachemanager = $this->getResource('cachemanager'); $cache = $cachemanager ? $cachemanager->getCache('database') : null; $options = array( 'plugins' => array( 'Variables', 'Database' => array( 'adapter' => Zend_Db_Table::getDefaultAdapter() ), 'File' => array( 'basePath' => APPLICATION_PATH . '../' ), 'Memory', 'Time', 'Cache' => $cache ? array('backend' => $cache->getBackend()) : null, 'Exception' ) ); if (!$cache) { unset($options['plugins']['Cache']); } $debug = new ZFDebug_Controller_Plugin_Debug($options); $this->bootstrap('frontController'); $frontController = $this->getResource('frontController'); $frontController->registerPlugin($debug); } } public function _initBrowser() { $browser = new Core_Browser(); if( $browser->getBrowser() == Core_Browser::BROWSER_IE ){ die('O seu navegador é inválido. Por favor utilize o Google Chrome!'); } } }
💾 保存文件
← 返回文件管理器