|
From: <rgr...@us...> - 2014-01-20 16:42:43
|
Revision: 12270
http://sourceforge.net/p/xoops/svn/12270
Author: rgriffith
Date: 2014-01-20 16:42:38 +0000 (Mon, 20 Jan 2014)
Log Message:
-----------
Fix #1271 - styles, scripts and images missing on last page of install
Move install cleanup from php shutdown function to end of page load using ajax call.
Disable previous button on last page of installer (code was no longer there!)
Also, add change from 2.6.0 to eliminate dummy mainfile.php in the distribution.
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/index.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/install/class/pathcontroller.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/install/include/install_tpl.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/install/page_end.php
Added Paths:
-----------
XoopsCore/branches/2.5.x/2.5.7/htdocs/install/cleanup.php
Removed Paths:
-------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/mainfile.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/index.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/index.php 2014-01-17 19:53:51 UTC (rev 12269)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/index.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -19,7 +19,13 @@
* @version $Id$
*/
-include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
+$mainfile = dirname(__FILE__) . '/mainfile.php';
+if (file_exists($mainfile)) {
+ include $mainfile;
+} elseif (file_exists(dirname(__FILE__) . '/install/index.php')) {
+ header('Location: install/index.php');
+ exit;
+}
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.index.start');
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/install/class/pathcontroller.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/install/class/pathcontroller.php 2014-01-17 19:53:51 UTC (rev 12269)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/install/class/pathcontroller.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -72,7 +72,7 @@
if ( substr( $path, -1 ) == '/' ) {
$path = substr( $path, 0, -1 );
}
- if ( file_exists( "$path/mainfile.php" ) ) {
+ if ( file_exists( "$path/mainfile.dist.php" ) ) {
$this->xoopsPath['root'] = $path;
}
// Firstly, locate XOOPS lib folder out of XOOPS root folder
@@ -165,7 +165,7 @@
$path = 'root';
if ( is_dir( $this->xoopsPath[$path] ) && is_readable( $this->xoopsPath[$path] ) ) {
@include_once "{$this->xoopsPath[$path]}/include/version.php";
- if ( file_exists( "{$this->xoopsPath[$path]}/mainfile.php" ) && defined( 'XOOPS_VERSION' ) ) {
+ if ( file_exists( "{$this->xoopsPath[$path]}/mainfile.dist.php" ) && defined( 'XOOPS_VERSION' ) ) {
$this->validPath[$path] = 1;
}
}
Added: XoopsCore/branches/2.5.x/2.5.7/htdocs/install/cleanup.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/install/cleanup.php (rev 0)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/install/cleanup.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -0,0 +1,38 @@
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+/**
+ * Cleanup from install
+ *
+ * This is intended to be called using Ajax after the page_end.php script has loaded.
+ * This eliminates the problem of assets (.js, .css, .png, etc.) not being available
+ * because the install folder has been renamed. All assets should be loaded by this
+ * point, and no further installer action is expected.
+ *
+ * @copyright The XOOPS project http://www.xoops.org/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
+ * @package installer
+ * @since 2.5.7
+ * @author Richard Griffith <ri...@ge...>
+ * @version $Id: page_end.php 12051 2013-09-15 01:45:10Z beckmi $
+ */
+
+require_once './include/common.inc.php';
+defined('XOOPS_INSTALL') or die('XOOPS Installation wizard die');
+
+$install_rename_suffix = $_POST['instsuffix'];
+if (preg_match('/^[a-z0-9]{23}$/', $install_rename_suffix)) {
+ $installer_modified = "install_remove_" . $install_rename_suffix;
+ install_finalize($installer_modified);
+ echo "OK";
+} else {
+ echo "FAILED";
+}
+exit;
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/install/include/install_tpl.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/install/include/install_tpl.php 2014-01-17 19:53:51 UTC (rev 12269)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/install/include/install_tpl.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -132,7 +132,8 @@
</div>
<div id="buttons">
- <?php if ($wizard->pageIndex != 0) { ?>
+ <?php if ($wizard->pageIndex != 0
+ && $wizard->pageIndex != array_search('end', array_keys($wizard->pages))) { ?>
<button type="button" onclick="history.back()">
<?php echo BUTTON_PREVIOUS; ?>
</button>
@@ -154,48 +155,20 @@
</body>
</html>
<script type="text/javascript">
+ function ajaxCleanup()
+ {
+ new Ajax.Request(<?php echo "'".XOOPS_URL."/install/cleanup.php'"; ?>, {
+ method: 'post',
+ parameters: {instsuffix: <?php echo isset($install_rename_suffix)?"'".$install_rename_suffix."'":"''"; ?> }
+ });
+ }
+
/**
- * Checking url in browser
- * if page is install/page_end.php
- * use folder rename variables from
- * page_end.php to fetch js and css
+ * Check url in browser to see if it is for 'page_end.php'
+ * If it is, launch the cleanup via ajax.
**/
- var pathArray = window.location.pathname.split( '/' );
var filename = location.pathname.substring(location.pathname.lastIndexOf('/')+1);
- var chkUrl = pathArray[2]+"/"+filename;
- if (chkUrl === 'install/page_end.php') {
- //window.location = newinstallurl;
- loadjscssfile(newPro, 'js');
- loadjscssfile(newINST, 'js');
- loadjscssfile(newCSSDeflt, 'css');
- loadjscssfile(newCSS, 'css');
- } else {
- // Do nothing
+ if (filename === 'page_end.php') {
+ Event.observe(window,"load",ajaxCleanup);
}
-
-/**
- * Load js and css files to header
- *
- * @param filename Filename based on var using $installer_modified if folder is renamed
- *
- * @param filetype js=javascript css=cascading style sheat
- *
- * @return boolean always true
- */
-function loadjscssfile(filename, filetype)
-{
- if (filetype == "js") { //if filename is a external JavaScript file
- // alert('called');
- var fileref = document.createElement('script');
- fileref.setAttribute("type", "text/javascript");
- fileref.setAttribute("src", filename);
- } elseif (filetype == "css") { //if filename is an external CSS file
- var fileref = document.createElement("link");
- fileref.setAttribute("rel", "stylesheet");
- fileref.setAttribute("type", "text/css");
- fileref.setAttribute("href", filename);
- }
- if (typeof fileref != "undefined")
- document.getElementsByTagName("head")[0].appendChild(fileref);
- }
</script>
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/install/page_end.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/install/page_end.php 2014-01-17 19:53:51 UTC (rev 12269)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/install/page_end.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -28,35 +28,13 @@
require_once './include/common.inc.php';
$_SESSION = array();
-setcookie( 'xo_install_user', '', null, null, null );
+setcookie('xo_install_user', '', null, null, null);
defined('XOOPS_INSTALL') or die('XOOPS Installation wizard die');
-$installer_modified = "install_remove_" . uniqid(mt_rand());
-register_shutdown_function('install_finalize', $installer_modified);
+$install_rename_suffix = uniqid(mt_rand());
+$installer_modified = "install_remove_" . $install_rename_suffix;
+//register_shutdown_function('install_finalize', $installer_modified);
-/**
- * Placing folder renamed in $_SESSION
- * and echoing to document for use in install_tpl.php
- **/
-
-$_SESSION['newinstallPRO'] = XOOPS_URL.'/'.$installer_modified.'/js/prototype-1.6.0.3.js';
-$_SESSION['newinstallINST'] = XOOPS_URL.'/'.$installer_modified.'/js/xo-installer.js';
-if (file_exists('language/' . $wizard->language . '/style.css')) {
-$_SESSION['newinstallCSSDeflt'] = XOOPS_URL.'/'.$installer_modified.'/css/style.css';
-$_SESSION['newinstallCSS'] = XOOPS_URL.'/'.$installer_modified.'/language/' . $wizard->language . '/style.css';
-} else {
-$_SESSION['newinstallCSSDeflt'] = XOOPS_URL.'/'.$installer_modified.'/css/style.css';
-$_SESSION['newinstallCSS'] = '';
-}
-
-$js = '<script type="text/javascript">';
-$js .= 'var newPro = '.json_encode($_SESSION["newinstallPRO"]).';';
-$js .= 'var newINST = '.json_encode($_SESSION["newinstallINST"]).';';
-$js .= 'var newCSS = '.json_encode($_SESSION["newinstallCSS"]).';';
-$js .= 'var newCSS = '.json_encode($_SESSION["newinstallCSSDeflt"]).';';
-$js .= '</script>';
-echo $js;
-
$pageHasForm = false;
$content = "";
Deleted: XoopsCore/branches/2.5.x/2.5.7/htdocs/mainfile.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/mainfile.php 2014-01-17 19:53:51 UTC (rev 12269)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/mainfile.php 2014-01-20 16:42:38 UTC (rev 12270)
@@ -1,19 +0,0 @@
-<?php
-/**
- * XOOPS main configuration file
- *
- * You may not change or alter any portion of this comment or credits
- * of supporting developers from this source code or any supporting source code
- * which is considered copyrighted (c) material of the original comment or credit authors.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
- * @version $Id$
- */
-
-if (! defined('XOOPS_INSTALL')) {
- header('Location: install/index.php');
-}
|