Fixed Bug #10212: Missing files in sysext install
authorSteffen Kamper <info@sk-typo3.de>
Sat, 14 Feb 2009 15:31:55 +0000 (15:31 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sat, 14 Feb 2009 15:31:55 +0000 (15:31 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5018 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/install/ext_localconf.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/mod/class.tx_install_ajax.php [new file with mode: 0644]
typo3/sysext/install/mod/install.js [new file with mode: 0644]

index b6c4748..464ae71 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-02-14  Steffen Kamper  <info@sk-typo3.de> 
+
+       * Fixed Bug #10212: Missing files in sysext install
+
 2009-02-13  Jeff Segars  <jeff@webempoweredchurch.org>
 
        * Added feature #10374: Add helper functions for additional frontend editing controllers and views
index 6317bcc..d4458a0 100644 (file)
@@ -17,6 +17,6 @@ $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['installSystemExtensions
        // change tt_content.imagecols=0 to 1 for proper display in TCEforms since TYPO3 4.3
 $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['changeImagecolsValue'] = 'tx_coreupdates_imagecols';
 
-       // register eID script for ecryption key AJAX call
-$TYPO3_CONF_VARS['FE']['eID_include']['tx_install_eid'] = 'EXT:install/mod/class.tx_install_eid.php';
+       // register eID script for install tool AJAX calls
+$TYPO3_CONF_VARS['FE']['eID_include']['tx_install_ajax'] = 'EXT:install/mod/class.tx_install_ajax.php';
 ?>
index 744c2b9..419bbd7 100755 (executable)
@@ -2086,10 +2086,13 @@ From sub-directory:
                                $out.=$this->wrapInCells('', '<br />');
 
                                if ($this->mode!='123') {
+                                       $this->headerStyle .= chr(10) .
+                                               '<script type="text/javascript" src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'contrib/prototype/prototype.js"></script>
+                                                <script type="text/javascript" src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'sysext/install/mod/install.js"></script>';
+                                                
+                                       
                                        $out.=$this->wrapInCells('Site name:', '<input type="text" name="TYPO3_INSTALL[localconf.php][sitename]" value="'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'">');
                                        $out.=$this->wrapInCells('', '<br />');
-                                       $out.='<script type="text/javascript" src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'sysext/install/mod/install.js"></script>';
-                                       $out.='<script type="text/javascript" src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'contrib/prototype/prototype.js"></script>';
                                        $out.=$this->wrapInCells('Encryption key:', '<a name="set_encryptionKey"></a><input type="text" name="TYPO3_INSTALL[localconf.php][encryptionKey]" value="'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'"><br /><input type="button" onclick="EncryptionKey.load(this)" value="Generate random key">');
                                        $out.=$this->wrapInCells('', '<br />');
 
diff --git a/typo3/sysext/install/mod/class.tx_install_ajax.php b/typo3/sysext/install/mod/class.tx_install_ajax.php
new file mode 100644 (file)
index 0000000..b8c4d19
--- /dev/null
@@ -0,0 +1,133 @@
+<?php\r
+/***************************************************************\r
+*  Copyright notice\r
+*\r
+*  (c) 2009 Marcus Krause, Helmut Hummel (security@typo3.org)\r
+*  All rights reserved\r
+*\r
+*  This script is part of the TYPO3 project. The TYPO3 project is\r
+*  free software; you can redistribute it and/or modify\r
+*  it under the terms of the GNU General Public License as published by\r
+*  the Free Software Foundation; either version 2 of the License, or\r
+*  (at your option) any later version.\r
+*\r
+*  The GNU General Public License can be found at\r
+*  http://www.gnu.org/copyleft/gpl.html.\r
+*  A copy is found in the textfile GPL.txt and important notices to the license\r
+*  from the author is found in LICENSE.txt distributed with these scripts.\r
+*\r
+*\r
+*  This script is distributed in the hope that it will be useful,\r
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+*  GNU General Public License for more details.\r
+*\r
+*  This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+\r
+\r
+\r
+// *******************************\r
+// Set error reporting\r
+// *******************************\r
+error_reporting (E_ALL ^ E_NOTICE);\r
+\r
+\r
+// ***********************\r
+// Paths are setup\r
+// ***********************\r
+define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');\r
+define('TYPO3_MODE','FE');\r
+if (!defined('PATH_thisScript'))       define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));\r
+\r
+if (!defined('PATH_site'))                     define('PATH_site', dirname(PATH_thisScript).'/');\r
+if (!defined('PATH_t3lib'))            define('PATH_t3lib', PATH_site.'t3lib/');\r
+define('PATH_tslib', PATH_site.'tslib/');\r
+define('PATH_typo3conf', PATH_site.'typo3conf/');\r
+define('TYPO3_mainDir', 'typo3/');             // This is the directory of the backend administration for the sites of this TYPO3 installation.\r
+\r
+if (!@is_dir(PATH_typo3conf))  die('Cannot find configuration. This file is probably executed from the wrong location.');\r
+\r
+\r
+require_once(PATH_t3lib.'class.t3lib_div.php');\r
+\r
+/**\r
+ * This is the eID handler for install tool AJAX calls.\r
+ *\r
+ * @author     Marcus Krause <security@typo3.org>\r
+ */\r
+class tx_install_ajax {\r
+\r
+\r
+       /**\r
+        * Keeps content to be printed.\r
+        *\r
+        * @var string\r
+        */\r
+       var $content;\r
+\r
+       /**\r
+        * Keeps command to process.\r
+        *\r
+        * @var string\r
+        */\r
+       var $cmd = '';\r
+\r
+\r
+       /**\r
+        * Init function, setting the input vars in the class scope.\r
+        *\r
+        * @return      void\r
+        */\r
+       function init() {\r
+               $this->cmd = t3lib_div::_GP('cmd');\r
+       }\r
+\r
+       /**\r
+        * Main function which creates the AJAX call return string.\r
+        * It is stored in $this->content.\r
+        *\r
+        * @return      void\r
+        */\r
+       function main() {\r
+                       // Create output:\r
+               switch ($this->cmd) {\r
+                       case 'encryptionKey':\r
+                       default:\r
+                               $this->content = $this->createEncryptionKey();\r
+                               break;\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Outputs the content from $this->content\r
+        *\r
+        * @return      void\r
+        */\r
+       function printContent() {\r
+               echo $this->content;\r
+       }\r
+\r
+       /**\r
+        * Returns a newly created TYPO3 encryption key with a given length.\r
+        *\r
+        * @param  integer  $keyLength  desired key length\r
+        * @return string\r
+        */\r
+       function createEncryptionKey($keyLength = 96) {\r
+\r
+               $bytes = t3lib_div::generateRandomBytes($keyLength);\r
+               return substr(bin2hex($bytes), -96);\r
+       }\r
+}\r
+\r
+// Make instance:\r
+$SOBE = t3lib_div::makeInstance('tx_install_ajax');\r
+$SOBE->init();\r
+$SOBE->main();\r
+$SOBE->printContent();\r
+\r
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/sysext/install/mod/class.tx_install_ajax.php'])     {\r
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/sysext/install/mod/class.tx_install_ajax.php']);\r
+}\r
+?>\r
diff --git a/typo3/sysext/install/mod/install.js b/typo3/sysext/install/mod/install.js
new file mode 100644 (file)
index 0000000..c2e3abf
--- /dev/null
@@ -0,0 +1,49 @@
+/***************************************************************
+*
+*  Javascript functions to provide AJAX calls for install tool
+*
+*  Copyright notice
+*
+*  (c) 2009 Marcus Krause, Helmut Hummel <security@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 backend provided by
+*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
+*
+*  Released under GNU/GPL (see license file in /typo3/)
+*
+*  This script 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.
+*
+*  This copyright notice MUST APPEAR in all copies of this script
+*
+***************************************************************/
+
+
+/**
+ *
+ * @author     Marcus Krause
+ */
+var EncryptionKey = {
+       thisScript: '../../index.php',
+       eID: 'tx_install_ajax',
+       cmd: 'encryptionKey',
+
+               // loads the ecryption key by an AJAX call
+       load: function(obj) {
+                       // fallback if AJAX is not possible (e.g. IE < 6)
+               if (typeof Ajax.getTransport() != 'object') {
+                       window.location.href = this.thisScript + '?eID=' + this.eID + '&cmd=' + this.cmd;
+                       return;
+               }
+
+               new Ajax.Request(this.thisScript, {
+                       method: 'get',
+                       parameters: '?eID=' + this.eID + '&cmd=' + this.cmd,
+                       onComplete: function(xhr) {
+                               document.getElementsByName('TYPO3_INSTALL[localconf.php][encryptionKey]').item(0).value=xhr.responseText;
+                       }.bind(this)
+               });
+       }
+};