Guest User

Untitled

a guest
Jul 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?php
  2.  
  3. // Define path to application directory
  4. defined('APPLICATION_PATH')
  5. || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  6.  
  7. // Define path to application directory
  8. defined('PUBLIC_PATH')
  9. || define('PUBLIC_PATH', dirname($_SERVER['SCRIPT_NAME']));
  10.  
  11. // Define application environment
  12. defined('APPLICATION_ENV')
  13. || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
  14.  
  15. // Ensure library/ is on include_path
  16. set_include_path(implode(PATH_SEPARATOR, array(
  17. realpath(APPLICATION_PATH . '/../library'),
  18. get_include_path(),
  19. )));
  20.  
  21. /** Zend_Application */
  22. require_once 'Zend/Application.php';
  23.  
  24. // create application, bootstrap, and run
  25. $application = new Zend_Application(
  26. APPLICATION_ENV,
  27. APPLICATION_PATH . '/configs/application.ini'
  28. );
  29.  
  30. $bootstrap = $application->getBootstrap();
  31. $configIni = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini',
  32. 'development');
  33.  
  34. // set the connection to the database
  35. $dbAdapter = new Zend_Db_Adapter_Pdo_Mysql(array(
  36. 'host' => $configIni->resources->db->params->host,
  37. 'username' => $configIni->resources->db->params->username,
  38. 'password' => $configIni->resources->db->params->password,
  39. 'dbname' => $configIni->resources->db->params->dbname,
  40. 'profiler' => true
  41. ));
  42.  
  43. // set the authentification adapter
  44. $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
  45. $authAdapter->setTableName('users')
  46. ->setIdentityColumn('login')
  47. ->setCredentialColumn('pass')
  48. ->setCredentialTreatment('MD5(?)');
  49.  
  50. // set the user language
  51. $locale = new Zend_Locale('en');
  52.  
  53. // set variables in registry
  54. Zend_Registry::set('dbAdapter', $dbAdapter);
  55. Zend_Registry::set('bootstrap', $bootstrap);
  56. Zend_Registry::set('configIni', $configIni);
  57. Zend_Registry::set('authAdapter', $authAdapter);
  58.  
  59. $application->bootstrap()
  60. ->run();
Add Comment
Please, Sign In to add comment