BxDolInstallController.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinInstall Dolphin Install
  7. * @{
  8. */
  9. class BxDolInstallController
  10. {
  11. protected $_oView;
  12. function __construct()
  13. {
  14. $this->_oView = new BxDolInstallView();
  15. }
  16. function run ($sAction = '')
  17. {
  18. $sMethod = 'action' . str_replace(' ', '', ucwords(str_replace('_', ' ', $sAction)));
  19. if ($sAction && method_exists($this, $sMethod))
  20. $this->$sMethod ();
  21. else
  22. $this->actionInitial ();
  23. }
  24. function actionAudit ()
  25. {
  26. $this->_oView->pageStart();
  27. $oAudit = new BxDolStudioToolsAudit();
  28. $sAuditOutput = $oAudit->generate();
  29. $this->_oView->out('audit.php', compact('sAuditOutput'));
  30. $this->_oView->pageEnd($this->_getTitle());
  31. }
  32. function actionInitial ()
  33. {
  34. $this->_oView->pageStart();
  35. $aLangs = BxDolInstallLang::getInstance()->getAvailableLanguages();
  36. $oAudit = new BxDolStudioToolsAudit();
  37. $aErrors = $oAudit->checkRequirements(BX_DOL_AUDIT_FAIL);
  38. $aWarnings = $oAudit->checkRequirements(BX_DOL_AUDIT_WARN);
  39. $oAudit->generateStyles();
  40. if (empty($aErrors))
  41. $this->_oView->out('initial.php', compact('aLangs', 'aWarnings'));
  42. else
  43. $this->_oView->out('initial_fail.php', compact('aLangs', 'aErrors'));
  44. $this->_oView->pageEnd($this->_getTitle());
  45. }
  46. function actionPermissions ()
  47. {
  48. $this->_oView->pageStart();
  49. $oAdmTools = new BxDolStudioTools();
  50. $sPermissionsStyles = $oAdmTools->generateStyles();
  51. ob_start();
  52. $bPermissionsOk = $oAdmTools->checkPermissions();
  53. $sPermissionsTable = ob_get_clean();
  54. $this->_oView->out('permissions.php', compact('sPermissionsStyles', 'sPermissionsTable', 'bPermissionsOk'));
  55. $this->_oView->setToolbarItem('question', 'http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#InstallScript-Step1-Permissions', _t('_sys_inst_help_permissions'), '_blank');
  56. $this->_oView->pageEnd($this->_getTitle());
  57. }
  58. function actionSiteConfig ()
  59. {
  60. $this->_oView->pageStart();
  61. $oSiteConfig = new BxDolInstallSiteConfig();
  62. $sForm = $oSiteConfig->getFormHtml();
  63. $this->_oView->out('site_config.php', compact('sForm'));
  64. $this->_oView->setToolbarItem('question', 'http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#Part2:CreateaDatabaseandaUser', _t('_sys_inst_help_site_config'), '_blank');
  65. $this->_oView->pageEnd($this->_getTitle());
  66. }
  67. function actionFinish ()
  68. {
  69. require_once(BX_INSTALL_PATH_HEADER);
  70. $this->_oView->pageStart();
  71. $sPathToPhp = "/replace/it/with/path/to/php/binary";
  72. $a = array(
  73. '/usr/local/bin/php',
  74. '/usr/bin/php',
  75. '/opt/local/bin/php',
  76. );
  77. foreach ($a as $sPath)
  78. if (file_exists($sPath))
  79. $sPathToPhp = $sPath;
  80. $this->_oView->out('finish.php', compact('sPathToPhp'));
  81. $this->_oView->setToolbarItem('question', 'http://www.boonex.com/trac/dolphin/wiki/DetailedInstall#InstallScript-Step5-CronJobs', _t('_sys_inst_help_finish'), '_blank');
  82. $this->_oView->pageEnd($this->_getTitle());
  83. }
  84. function actionRemoveInstall ()
  85. {
  86. require_once(BX_INSTALL_PATH_HEADER);
  87. $this->_oView->pageStart();
  88. $this->_oView->out('remove_install.php', array());
  89. $this->_oView->pageEnd($this->_getTitle());
  90. }
  91. protected function _getTitle() {
  92. return _t('_sys_inst_title', BX_DOL_VER);
  93. }
  94. }
  95. /** @} */