Преглед изворни кода

#35 - finish page, check for install folder

Alex Trofimov пре 12 година
родитељ
комит
53e23c2ffd

+ 23 - 2
install/classes/BxDolInstallController.php

@@ -89,11 +89,32 @@ class BxDolInstallController
 
     function actionFinish () 
     {
+        require_once(BX_INSTALL_PATH_HEADER);
+
         $this->_oView->pageStart();
 
-        $s = 'TODO: finish page';
+        $sPathToPhp = "/replace/it/with/path/to/php/binary";
+        $a = array(
+            '/usr/local/bin/php', 
+            '/usr/bin/php',
+            '/opt/local/bin/php',
+        );
+        foreach ($a as $sPath)
+            if (file_exists($sPath))
+                $sPathToPhp = $sPath;
+
+        $this->_oView->out('finish.php', compact('sPathToPhp'));
+
+        $this->_oView->pageEnd($this->_getTitle());
+    }
+
+    function actionRemoveInstall () 
+    {
+        require_once(BX_INSTALL_PATH_HEADER);
+
+        $this->_oView->pageStart();
 
-        $this->_oView->out('finish.php', compact('s'));
+        $this->_oView->out('remove_install.php', array());
 
         $this->_oView->pageEnd($this->_getTitle());
     }

+ 3 - 0
install/classes/BxDolInstallSiteConfig.php

@@ -341,6 +341,9 @@ EOF;
             }            
         } 
 
+        bx_import('BxDolAccount');
+        bx_login(BxDolAccount::getInstance($a['admin_email'])->id());
+
         return array();
     }
 

+ 6 - 0
install/css/styles.css

@@ -60,3 +60,9 @@ html, body {
 .bx-install-site-config .bx-form-input-wrapper-submit button {
     display:inline-block;
 } 
+
+.bx-install-finish textarea {
+    display:block;
+    width:70%;
+    height:60px;
+}

+ 6 - 37
install/patterns/header.inc.php

@@ -89,19 +89,16 @@ define('BX_DOL_SECRET', '%SECRET%');
 
 define('CHECK_DOLPHIN_REQUIREMENTS', 1);
 if (defined('CHECK_DOLPHIN_REQUIREMENTS')) {
-    //check requirements
     $aErrors = array();
-
     $aErrors[] = (ini_get('register_globals') == 0) ? '' : '<font color="red">register_globals is On (warning, you should have this param in Off state, or your site will unsafe)</font>';
     $aErrors[] = (ini_get('safe_mode') == 0) ? '' : '<font color="red">safe_mode is On, disable it</font>';
     $aErrors[] = (version_compare(PHP_VERSION, '5.2.0', '<')) ? '<font color="red">PHP version too old, please update to PHP 5.2.0 at least</font>' : '';
     $aErrors[] = (!extension_loaded( 'mbstring')) ? '<font color="red">mbstring extension not installed. <b>Warning!</b> Dolphin cannot work without <b>mbstring</b> extension.</font>' : '';
-
     if (version_compare(phpversion(), "5.2", ">") == 1) {
         $aErrors[] = (ini_get('allow_url_include') == 0) ? '' : '<font color="red">allow_url_include is On (warning, you should have this param in Off state, or your site will unsafe)</font>';
     };
 
-    $aErrors = array_diff($aErrors, array('')); //delete empty
+    $aErrors = array_diff($aErrors, array('')); // delete empty
     if (count($aErrors)) {
         $sErrors = implode(" <br /> ", $aErrors);
         echo <<<EOF
@@ -114,7 +111,7 @@ EOF;
     }
 }
 
-//check correct hostname
+// check correct hostname
 $aUrl = parse_url( BX_DOL_URL_ROOT );
 if (isset($_SERVER['HTTP_HOST']) and 0 != strcasecmp($_SERVER['HTTP_HOST'], $aUrl['host']) and 0 != strcasecmp($_SERVER['HTTP_HOST'], $aUrl['host'] . ':80')) {
     header( "Location:http://{$aUrl['host']}{$_SERVER['REQUEST_URI']}" );
@@ -123,45 +120,17 @@ if (isset($_SERVER['HTTP_HOST']) and 0 != strcasecmp($_SERVER['HTTP_HOST'], $aUr
 
 // check if install folder exists
 if (!defined ('BX_SKIP_INSTALL_CHECK') && file_exists(BX_DIRECTORY_PATH_ROOT . 'install')) {
-    $ret = <<<EOJ
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
-        <head>
-            <title>Dolphin Smart Community Builder Installed</title>
-            <link href="install/general.css" rel="stylesheet" type="text/css" />
-            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-        </head>
-        <body>
-            <div id="main">
-            <div id="header">
-                <img src="install/images/boonex-logo.png" alt="" /></div>
-            <div id="content">
-                <div class="installed_pic">
-                    <img alt="Dolphin Installed" src="install/images/dolphin_installed.jpg" />
-            </div>
-
-            <div class="installed_text">
-                Please, remove INSTALL directory from your server and reload this page to activate your community site.
-            </div>
-            <div class="installed_text">
-                NOTE: Once you remove this page you can safely <a href="administration/modules.php">install modules via Admin Panel</a>.
-            </div>
-        </body>
-    </html>
-EOJ;
-    echo $ret;
-    exit();
+    header('Location:' . BX_DOL_URL_ROOT . 'install/index.php?action=remove_install');
+    exit;
 }
 
-// set some PHP options
+// set PHP options
 error_reporting(E_ALL);
-
 ini_set('magic_quotes_sybase', 0);
-
 mb_internal_encoding('UTF-8');
 mb_regex_encoding('UTF-8');
 
-// include files needed for basic functionality
+// include files necessary for basic functionality
 require_once(BX_DIRECTORY_PATH_CLASSES . "BxDol.php");
 require_once(BX_DIRECTORY_PATH_INC . "utils.inc.php");
 require_once(BX_DIRECTORY_PATH_INC . "security.inc.php");

+ 23 - 2
install/templates/finish.php

@@ -1,7 +1,28 @@
-<div class="bx-install-site-config">
+<div class="bx-install-finish">
 
     <h1><?php echo _t('_sys_inst_finish'); ?></h1>
 
-   <?=$s; ?>
+    <p class="bx-def-font-large" style="font-weight:bold;"><?php echo _t('_sys_inst_msg_finish'); ?></p>
+
+    <ol>
+        <!--
+        <li>
+            change permissions back
+        <li>
+        -->
+        <li>
+            <?php echo _t('_sys_inst_msg_finish_cron_jobs'); ?>
+            <textarea class="bx-form-input-textarea bx-def-font-inputs bx-def-margin-sec-top">
+MAILTO=<?php echo getParam('site_email') . "\n"; ?>
+* * * * * <?=$sPathToPhp; ?> -q <?=BX_DIRECTORY_PATH_ROOT; ?>periodic/cron.php
+            </textarea>
+        </li>
+        <li class="bx-def-margin-top">
+            <?php echo _t('_sys_inst_msg_finish_delete_install_folder'); ?>
+        </li>
+        <li class="bx-def-margin-top">
+            <?php echo _t('_sys_inst_msg_finish_goto_studio', BX_DOL_URL_ROOT); ?>
+        </li>
+    </ol>
 
 </div>

+ 5 - 0
install/templates/remove_install.php

@@ -0,0 +1,5 @@
+<div class="bx-install-remove-install">
+
+    <p class="bx-def-font-large" style="font-weight:bold;"><?php echo _t('_sys_inst_msg_remove_install'); ?></p>
+
+</div>

+ 6 - 1
modules/boonex/english/data/langs/system.xml

@@ -3816,8 +3816,13 @@ If you don't know how to do it by yourself you can submit <a target="_blank" hre
     <string name="_sys_inst_msg_db_err_select"><![CDATA[Database select failed]]></string>
     <string name="_sys_inst_msg_file_read_failed"><![CDATA[File read failed: {0}]]></string>
     <string name="_sys_inst_msg_file_write_failed"><![CDATA[File write failed: {0}]]></string>
+    <string name="_sys_inst_msg_finish"><![CDATA[But there are some additional manual steps are required:]]></string>
+    <string name="_sys_inst_msg_finish_cron_jobs"><![CDATA[Setup the following cron jobs command:]]></string>
+    <string name="_sys_inst_msg_finish_delete_install_folder"><![CDATA[Remove <b>/install/</b> folder from Dolphin root folder.]]></string>
+    <string name="_sys_inst_msg_finish_goto_studio"><![CDATA[<a href="{0}studio/">Go to Studio</a> to add additional modules and customize the site.]]></string>
+    <string name="_sys_inst_msg_remove_install"><![CDATA[Please, remove INSTALL directory from your server and reload this page to activate your site.<br />NOTE: Once you remove this page you can safely <a href="../studio/store.php">install modules in Studio.]]></string>
 
-	<string name="_sys_inst_finish"><![CDATA[Installation completed]]></string>
+	<string name="_sys_inst_finish"><![CDATA[Installation has been successfully completed]]></string>
 	<string name="_sys_inst_site_config"><![CDATA[Site configuration]]></string>
     <string name="_sys_inst_title"><![CDATA[Dolphin {0} Installation]]></string>
     <string name="_sys_inst_start_installation"><![CDATA[Start installation]]></string>