PageRenderTime 33ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/4.6/administrator/components/com_installer/admin.installer.html.php

http://miacms.googlecode.com/
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
  1. <?php
  2. /**
  3. * @package MiaCMS
  4. * @subpackage Installer
  5. * @author MiaCMS see README.php
  6. * @copyright see README.php
  7. * See COPYRIGHT.php for copyright notices and details.
  8. * @license GNU/GPL Version 2, see LICENSE.php
  9. * MiaCMS is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; version 2 of the License.
  12. */
  13. /** ensure this file is being included by a parent file */
  14. defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  15. function writableCell( $folder ) {
  16. echo '<tr>';
  17. echo '<td class="item">' . $folder . '/</td>';
  18. echo '<td align="left">';
  19. 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>';
  20. echo '</tr>';
  21. }
  22. /**
  23. * @package MiaCMS
  24. */
  25. class HTML_installer {
  26. function showInstallForm( $title, $option, $element, $client = "", $p_startdir = "", $backLink="" ) {
  27. ?>
  28. <form enctype="multipart/form-data" action="index2.php" method="post" name="filename">
  29. <table class="adminheading">
  30. <tr>
  31. <th class="install">
  32. <?php echo $title;?>
  33. </th>
  34. <td align="right" nowrap="nowrap">
  35. <?php echo $backLink;?>
  36. </td>
  37. </tr>
  38. </table>
  39. <table class="adminform">
  40. <tr>
  41. <th>
  42. <?php echo T_('Upload Package File'); ?>
  43. </th>
  44. </tr>
  45. <tr>
  46. <td align="left">
  47. <?php echo T_('Package File:')?>
  48. <input class="text_area" id="userfile" name="userfile" type="file" size="70"/>
  49. <input class="button" type="submit" value="<?php echo T_('Upload File &amp; Install')?>" />
  50. </td>
  51. </tr>
  52. </table>
  53. <input type="hidden" name="task" value="uploadfile"/>
  54. <input type="hidden" name="option" value="<?php echo $option;?>"/>
  55. <input type="hidden" name="element" value="<?php echo $element;?>"/>
  56. <input type="hidden" name="client" value="<?php echo $client;?>"/>
  57. </form>
  58. <br />
  59. <?php
  60. if (ini_get('allow_url_fopen')) HTML_installer::showUrlForm('http://', $option, $element, $client);
  61. ?>
  62. <form action="index2.php" method="post" id="adminForm_dir" name="adminForm_dir">
  63. <table class="adminform">
  64. <tr>
  65. <th>
  66. <?php echo T_('Install from directory')?>
  67. </th>
  68. </tr>
  69. <tr>
  70. <td align="left">
  71. <?php echo T_('Install directory:')?>&nbsp;
  72. <input type="text" name="userfile" class="text_area" size="65" value="<?php echo $p_startdir; ?>"/>&nbsp;
  73. <input id="install_dir_button" type="button" class="button" value="<?php echo T_('Install')?>" />
  74. </td>
  75. </tr>
  76. </table>
  77. <input type="hidden" name="task" value="installfromdir" />
  78. <input type="hidden" name="option" value="<?php echo $option;?>"/>
  79. <input type="hidden" name="element" value="<?php echo $element;?>"/>
  80. <input type="hidden" name="client" value="<?php echo $client;?>"/>
  81. </form>
  82. <br />
  83. <script type="text/javascript">
  84. YAHOO.miacms.base.submitbutton3 = function(pressbutton) {
  85. var form = YAHOO.util.Dom.get("adminForm_dir") || document.adminForm_dir;
  86. //Do field validation
  87. if (YAHOO.miacms.base.trim(form.userfile.value) === ""){
  88. alert( "<?php echo T_('Please select a directory'); ?>" );
  89. } else {
  90. form.submit();
  91. }
  92. };
  93. YAHOO.util.Event.addListener('install_dir_button', "click", YAHOO.miacms.base.submitbutton3);
  94. </script>
  95. <?php
  96. }
  97. function showUrlForm ($prompt, $option, $element, $client) {
  98. ?>
  99. <form action="index2.php" method="post" name="adminForm_url">
  100. <table class="adminform">
  101. <tr>
  102. <th>
  103. <?php echo T_('Install from HTTP URL')?>
  104. </th>
  105. </tr>
  106. <tr>
  107. <td align="left">
  108. <?php echo T_('Install HTTP URL:')?>&nbsp;
  109. <input type="text" name="userurl[]" class="text_area" size="65" value="<?php echo $prompt; ?>" />&nbsp;
  110. <input type="submit" class="button" value="<?php echo T_('Upload URL &amp; Install')?>" />
  111. </td>
  112. </tr>
  113. </table>
  114. <input type="hidden" name="task" value="installfromurl" />
  115. <input type="hidden" name="option" value="<?php echo $option;?>"/>
  116. <input type="hidden" name="element" value="<?php echo $element;?>"/>
  117. <input type="hidden" name="client" value="<?php echo $client;?>"/>
  118. </form>
  119. <br />
  120. <?php
  121. }
  122. /**
  123. * @param string
  124. * @param string
  125. * @param string
  126. * @param string
  127. */
  128. function showInstallMessage ($messages, $title, $return) {
  129. global $PHP_SELF;
  130. if (!$return) $return = mamboCore::get('mosConfig_live_site').'/administrator/index2.php';
  131. ?>
  132. <table class="adminheading">
  133. <tr>
  134. <th class="install">
  135. <?php echo $title; ?>
  136. </th>
  137. </tr>
  138. </table>
  139. <table class="adminform">
  140. <?php
  141. if (!is_array($messages)) $messages = array($messages);
  142. foreach ($messages as $message) {
  143. switch ($message->level) {
  144. case _MOS_ERROR_INFORM:
  145. $colour = 'green';
  146. $level = 'Information: ';
  147. break;
  148. case _MOS_ERROR_WARN:
  149. $colour = 'red';
  150. $level = 'Warning: ';
  151. break;
  152. case _MOS_ERROR_SEVERE:
  153. $colour = 'red';
  154. $level = 'Severe: ';
  155. break;
  156. case _MOS_ERROR_FATAL:
  157. $colour = 'red';
  158. $level = 'Fatal: ';
  159. break;
  160. }
  161. ?>
  162. <tr>
  163. <td align="left">
  164. <span class="<?php echo $colour; ?>"><strong><?php echo $level.$message->text; ?></strong></span>
  165. </td>
  166. </tr>
  167. <?php
  168. }
  169. ?>
  170. <tr>
  171. <td colspan="2" align="center">
  172. [&nbsp;<a href="<?php echo $return;?>" style="font-size: 16px; font-weight: bold"><?php echo T_('Continue ...')?></a>&nbsp;]
  173. </td>
  174. </tr>
  175. </table>
  176. <?php
  177. }
  178. }
  179. ?>