Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.7.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace App;
  15.  
  16.  
  17. class Bootstrap extends \Cube\Application\Bootstrap
  18. {
  19. protected $_settings = array( );
  20. protected $_sitePath = null;
  21. protected $_acl = null;
  22. protected $_role = 'Guest';
  23. protected $_user = null;
  24. protected $_connected = false;
  25.  
  26. protected function _initConnected()
  27. {
  28. $this->bootstrap( 'db' );
  29. $db = $this->getResource( 'db' );
  30.  
  31. if ($db instanceof \Cube\Db\Adapter\AbstractAdapter) {
  32. try {
  33. $this->_connected = $db->canConnect( );
  34. }
  35. catch (Exception $e) {
  36. $config = $db->getConfig( );
  37.  
  38. if (array_key_exists( 'host', $config )) {
  39. if (strcmp( $config['host'], '%DB_HOST%' ) !== 0) {
  40. exit( 'Error establishing a database connection.' );
  41. }
  42. }
  43.  
  44. $this->_redirect( 'no-config' );
  45. }
  46. }
  47.  
  48. return $this->_connected;
  49. }
  50.  
  51. protected function _initSettings()
  52. {
  53. $this->bootstrap( 'connected' );
  54. $settingsService = new \Ppb\Service\Settings( );
  55.  
  56. try {
  57. $this->_settings = $settingsService->get( );
  58. date_default_timezone_set( $this->_settings['timezone'] );
  59. $timeZone = $this->_getTimeOffset( new DateTimeZone( $this->_settings['timezone'] ) );
  60.  
  61. if (!(empty( $this->_settings['site_path'] ))) {
  62. $this->_sitePath = $this->_settings['site_path'];
  63. }
  64.  
  65. $settingsService->getTable( )->getAdapter( )->query( 'SET time_zone=\'' . $timeZone . '\'' );
  66. }
  67. catch (Exception $e) {
  68. }
  69.  
  70. return $this->_settings;
  71. }
  72.  
  73. protected function _initSitePath()
  74. {
  75. if (strcmp( $this->_sitePath, '%SITE_PATH%' ) !== 0) {
  76. $httpHost = rtrim( sprintf( '%s://%s%s', (isset( $_SERVER['HTTPS'] ) && ($_SERVER['HTTPS'] != 'off') ? 'https' : 'http'), $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] ) );
  77. $request = $this->getResource( 'FrontController' )->getRequest( );
  78.  
  79. if (!(stristr( $httpHost, $this->_sitePath ))) {
  80. $baseUrl = $request->getBaseUrl( );
  81. $redirectUri = $this->_sitePath . str_replace( $baseUrl, '', $_SERVER['REQUEST_URI'] );
  82. $this->getResource( 'FrontController' )->getResponse( )->setRedirect( $redirectUri, 301 )->sendHeaders( );
  83. exit( );
  84. }
  85. }
  86. }
  87.  
  88. protected final function _initLicensing()
  89. {
  90. $serverName = filter_input( INPUT_SERVER, 'SERVER_NAME', FILTER_UNSAFE_RAW );
  91.  
  92. if (empty( $serverName ) && empty( $_SERVER['SERVER_NAME'] )) {
  93. $serverName = '';
  94.  
  95. if (!(empty( $this->_sitePath ))) {
  96. ..........................................................
  97. .................................
  98. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement