/** * Returns the path to system file configurated to log errors. If no paramter * is passed, tries to load bootstrap from Agana_Util_Bootstrap, else, loads * from parameter variable. * * @param Bootstrap $bootsrap * @return string System error file path */ public static function getSystemLogPath($bootsrap = null) { if ($bootsrap) { $options = $bootsrap->getOption('agana'); } else { $options = Agana_Util_Bootstrap::getOption('agana'); } if (isset($options['app']['syserrorfile'])) { $sysLogFile = $options['app']['syserrorfile']; } else { $sysLogFile = APPLICATION_DATA_PATH . '/app.error.log.xml'; } return $sysLogFile; }
/** * The constructor instantiate connections params from agana.ini config application */ private function __construct() { $c = Agana_Util_Bootstrap::getOption('agana'); if (isset($c['pdo']['params'])) { $p = $c['pdo']['params']; $this->_driver = $p['driver']; $this->_user = $p['user']; $this->_pwd = $p['password']; $this->_host = $p['host']; $this->_dbName = $p['dbname']; } else { throw new Agana_Exception("No AGANA.PDO configuration founded !"); } }
/** * Appends Debug output html and scripts to the original page * * @param string $html * @return void */ protected function _displayAganaDebug($html) { // $front = Agana_Util_Bootstrap::getResource('FrontController'); // $router = $front->getRouter(); // Zend_Registry::get('Agana_Debug')->add($router, 'ROUTER'); // Zend_Debug::dump($router->getRoute('default')); // Zend_Debug::dump($router); $html = "<div id='Agana_Debug'>"; $html .= Zend_Registry::get('Agana_Debug')->getAll(); $html .= "</div>\n</body>"; $response = $this->getResponse(); $response->setBody(str_ireplace('</body>', $html, $response->getBody())); $libPath = Agana_Util_Bootstrap::getOption('includePaths'); $libPath = $libPath['library']; $js = file_get_contents($libPath . '/Agana/Api/Debug/js/debug.js'); $js = '<script>' . $js . '</script>'; $response->appendBody($js); }
/** * executes the defult url if it is configured at agana.ini file * with agana.defaulturl parameter */ public function indexAction() { $options = Agana_Util_Bootstrap::getOption('agana'); //Zend_Debug::dump(Agana_Api_Util_Bootstrap::getBootstrap()->getOptions()); if (isset($options['defaultdispatch'])) { if (strtolower(trim($options['defaultdispatch'])) == 'redirect') { if (trim($options['defaulturl']) != '') { $this->_redirect($options['defaulturl']); } else { $redirect = new Zend_Controller_Action_Helper_Redirector(); $redirect->gotoSimpleAndExit($options['defaultaction'], $options['defaultcontroller'], $options['defaultmodule']); } } else { if (strtolower(trim($options['defaultdispatch'])) == 'forward') { $this->_forward($options['defaultaction'], $options['defaultcontroller'], $options['defaultmodule']); } } } }