/4.6/administrator/components/com_installer/admin.installer.html.php
PHP | 193 lines | 157 code | 14 blank | 22 comment | 7 complexity | 874276df509d0c158a882f109c069d81 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, LGPL-2.0
- <?php
- /**
- * @package MiaCMS
- * @subpackage Installer
- * @author MiaCMS see README.php
- * @copyright see README.php
- * See COPYRIGHT.php for copyright notices and details.
- * @license GNU/GPL Version 2, see LICENSE.php
- * MiaCMS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2 of the License.
- */
- /** ensure this file is being included by a parent file */
- defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
- function writableCell( $folder ) {
- echo '<tr>';
- echo '<td class="item">' . $folder . '/</td>';
- echo '<td align="left">';
- echo is_writable( $GLOBALS['mosConfig_absolute_path'] . '/' . $folder ) ? '<strong><span class="green">'.T_('Writeable').'</span></strong></td>' : '<strong><span class="red">'.T_('Unwriteable').'</span></strong>' . '</td>';
- echo '</tr>';
- }
- /**
- * @package MiaCMS
- */
- class HTML_installer {
- function showInstallForm( $title, $option, $element, $client = "", $p_startdir = "", $backLink="" ) {
- ?>
- <form enctype="multipart/form-data" action="index2.php" method="post" name="filename">
- <table class="adminheading">
- <tr>
- <th class="install">
- <?php echo $title;?>
- </th>
- <td align="right" nowrap="nowrap">
- <?php echo $backLink;?>
- </td>
- </tr>
- </table>
- <table class="adminform">
- <tr>
- <th>
- <?php echo T_('Upload Package File'); ?>
- </th>
- </tr>
- <tr>
- <td align="left">
- <?php echo T_('Package File:')?>
- <input class="text_area" id="userfile" name="userfile" type="file" size="70"/>
- <input class="button" type="submit" value="<?php echo T_('Upload File & Install')?>" />
- </td>
- </tr>
- </table>
- <input type="hidden" name="task" value="uploadfile"/>
- <input type="hidden" name="option" value="<?php echo $option;?>"/>
- <input type="hidden" name="element" value="<?php echo $element;?>"/>
- <input type="hidden" name="client" value="<?php echo $client;?>"/>
- </form>
- <br />
- <?php
- if (ini_get('allow_url_fopen')) HTML_installer::showUrlForm('http://', $option, $element, $client);
- ?>
-
- <form action="index2.php" method="post" id="adminForm_dir" name="adminForm_dir">
- <table class="adminform">
- <tr>
- <th>
- <?php echo T_('Install from directory')?>
- </th>
- </tr>
- <tr>
- <td align="left">
- <?php echo T_('Install directory:')?>
- <input type="text" name="userfile" class="text_area" size="65" value="<?php echo $p_startdir; ?>"/>
- <input id="install_dir_button" type="button" class="button" value="<?php echo T_('Install')?>" />
- </td>
- </tr>
- </table>
- <input type="hidden" name="task" value="installfromdir" />
- <input type="hidden" name="option" value="<?php echo $option;?>"/>
- <input type="hidden" name="element" value="<?php echo $element;?>"/>
- <input type="hidden" name="client" value="<?php echo $client;?>"/>
- </form>
- <br />
- <script type="text/javascript">
- YAHOO.miacms.base.submitbutton3 = function(pressbutton) {
- var form = YAHOO.util.Dom.get("adminForm_dir") || document.adminForm_dir;
- //Do field validation
- if (YAHOO.miacms.base.trim(form.userfile.value) === ""){
- alert( "<?php echo T_('Please select a directory'); ?>" );
- } else {
- form.submit();
- }
- };
-
- YAHOO.util.Event.addListener('install_dir_button', "click", YAHOO.miacms.base.submitbutton3);
- </script>
- <?php
- }
- function showUrlForm ($prompt, $option, $element, $client) {
- ?>
- <form action="index2.php" method="post" name="adminForm_url">
- <table class="adminform">
- <tr>
- <th>
- <?php echo T_('Install from HTTP URL')?>
- </th>
- </tr>
- <tr>
- <td align="left">
- <?php echo T_('Install HTTP URL:')?>
- <input type="text" name="userurl[]" class="text_area" size="65" value="<?php echo $prompt; ?>" />
- <input type="submit" class="button" value="<?php echo T_('Upload URL & Install')?>" />
- </td>
- </tr>
- </table>
- <input type="hidden" name="task" value="installfromurl" />
- <input type="hidden" name="option" value="<?php echo $option;?>"/>
- <input type="hidden" name="element" value="<?php echo $element;?>"/>
- <input type="hidden" name="client" value="<?php echo $client;?>"/>
- </form>
- <br />
- <?php
- }
- /**
- * @param string
- * @param string
- * @param string
- * @param string
- */
- function showInstallMessage ($messages, $title, $return) {
- global $PHP_SELF;
- if (!$return) $return = mamboCore::get('mosConfig_live_site').'/administrator/index2.php';
- ?>
- <table class="adminheading">
- <tr>
- <th class="install">
- <?php echo $title; ?>
- </th>
- </tr>
- </table>
- <table class="adminform">
- <?php
- if (!is_array($messages)) $messages = array($messages);
- foreach ($messages as $message) {
- switch ($message->level) {
- case _MOS_ERROR_INFORM:
- $colour = 'green';
- $level = 'Information: ';
- break;
- case _MOS_ERROR_WARN:
- $colour = 'red';
- $level = 'Warning: ';
- break;
- case _MOS_ERROR_SEVERE:
- $colour = 'red';
- $level = 'Severe: ';
- break;
- case _MOS_ERROR_FATAL:
- $colour = 'red';
- $level = 'Fatal: ';
- break;
- }
- ?>
- <tr>
- <td align="left">
- <span class="<?php echo $colour; ?>"><strong><?php echo $level.$message->text; ?></strong></span>
- </td>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td colspan="2" align="center">
- [ <a href="<?php echo $return;?>" style="font-size: 16px; font-weight: bold"><?php echo T_('Continue ...')?></a> ]
- </td>
- </tr>
- </table>
- <?php
- }
- }
- ?>