| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Installer 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 function writableCell( $folder ) { 21 echo '<tr>'; 22 echo '<td class="item">' . $folder . '/</td>'; 23 echo '<td align="left">'; 24 echo is_writable( $GLOBALS['mosConfig_absolute_path'] . '/' . $folder ) ? '<strong><span class="green">'.T_('Writeable').'</span></strong>' : '<strong><span class="red">'.T_('Unwriteable').'</span></strong>' . '</td>'; 25 echo '</tr>'; 26 } 27 28 /** 29 * @package Mambo 30 */ 31 class HTML_installer { 32 33 function showInstallForm( $title, $option, $element, $client = "", $p_startdir = "", $backLink="" ) { 34 ?> 35 <script type="text/javascript"> 36 function submitbutton3(pressbutton) { 37 var form = document.adminForm_dir; 38 39 // do field validation 40 if (form.userfile.value == ""){ 41 alert( "<?php echo T_('Please select a directory'); ?>" ); 42 } else { 43 form.submit(); 44 } 45 } 46 </script> 47 <form enctype="multipart/form-data" action="index2.php" method="post" name="filename"> 48 <table class="adminheading"> 49 <tr> 50 <th class="install"> 51 <?php echo $title;?> 52 </th> 53 <td align="right" nowrap="true"> 54 <?php echo $backLink;?> 55 </td> 56 </tr> 57 </table> 58 59 <table class="adminform"> 60 <tr> 61 <th> 62 <?php echo T_('Upload Package File'); ?> 63 </th> 64 </tr> 65 <tr> 66 <td align="left"> 67 <?php echo T_('Package File:')?> 68 <input class="text_area" name="userfile" type="file" size="70"/> 69 <input class="button" type="submit" value="<?php echo T_('Upload File & Install')?>" /> 70 </td> 71 </tr> 72 </table> 73 74 <input type="hidden" name="task" value="uploadfile"/> 75 <input type="hidden" name="option" value="<?php echo $option;?>"/> 76 <input type="hidden" name="element" value="<?php echo $element;?>"/> 77 <input type="hidden" name="client" value="<?php echo $client;?>"/> 78 </form> 79 <br /> 80 81 <?php 82 if (ini_get('allow_url_fopen')) HTML_installer::showUrlForm('http://', $option, $element, $client); 83 ?> 84 85 <form action="index2.php" method="post" name="adminForm_dir"> 86 <table class="adminform"> 87 <tr> 88 <th> 89 <?php echo T_('Install from directory')?> 90 </th> 91 </tr> 92 <tr> 93 <td align="left"> 94 <?php echo T_('Install directory:')?> 95 <input type="text" name="userfile" class="text_area" size="65" value="<?php echo $p_startdir; ?>"/> 96 <input type="button" class="button" value="<?php echo T_('Install')?>" onclick="submitbutton3()" /> 97 </td> 98 </tr> 99 </table> 100 101 <input type="hidden" name="task" value="installfromdir" /> 102 <input type="hidden" name="option" value="<?php echo $option;?>"/> 103 <input type="hidden" name="element" value="<?php echo $element;?>"/> 104 <input type="hidden" name="client" value="<?php echo $client;?>"/> 105 </form> 106 <br /> 107 <?php 108 } 109 110 function showUrlForm ($prompt, $option, $element, $client) { 111 ?> 112 <form action="index2.php" method="post" name="adminForm_url"> 113 <table class="adminform"> 114 <tr> 115 <th> 116 <?php echo T_('Install from HTTP URL')?> 117 </th> 118 </tr> 119 <tr> 120 <td align="left"> 121 <?php echo T_('Install HTTP URL:')?> 122 <input type="text" name="userurl[]" class="text_area" size="65" value="<?php echo $prompt; ?>" /> 123 <input type="submit" class="button" value="<?php echo T_('Upload URL & Install')?>" /> 124 </td> 125 </tr> 126 </table> 127 <input type="hidden" name="task" value="installfromurl" /> 128 <input type="hidden" name="option" value="<?php echo $option;?>"/> 129 <input type="hidden" name="element" value="<?php echo $element;?>"/> 130 <input type="hidden" name="client" value="<?php echo $client;?>"/> 131 </form> 132 <br /> 133 <?php 134 } 135 136 function AddonForm ($prompt, $option, $element, $client) { 137 ?> 138 <form action="index2.php" method="post" name="adminForm_url"> 139 <?php //Load Addon XML file from The Source 140 141 $fhandle = @fopen("http://source.mambo-foundation.org/external/config/addon.xml", "r"); 142 if (!$fhandle) { 143 $error = T_('Failed to open addon.xml on The Source (source.mambo-foundation.org). Check your Internet connection.'); 144 exit($error); 145 } else { 146 $addon = simplexml_load_file('http://source.mambo-foundation.org/external/config/addon.xml'); 147 } 148 149 //Count the number of items in the XML file 150 $addon_count = 0; 151 foreach($addon->name as $i) $addon_count++; 152 ?> 153 <table width="100%" border="1" cellpadding="0" 154 cellspacing="1" class="adminform"> 155 156 <tr> 157 <th colspan="7" style="text-align: left;"><?php echo T_('Add-On Installation') ?></th> 158 </tr> 159 <tr> 160 <th colspan="7" style="text-align: left;"><input type="submit" name="install_packages" value="<?php echo T_('Install Package(s)') ?>" /> 161 <i><?php echo T_('Note: Check the package or packages you wish to install below. Any number of packages or types may be installed with a single click.') ?></i></th> 162 </tr> 163 <tr style="background-color: Orange; font-weight: bold; text-align: center;"> 164 <td width="185"><?php echo T_('Mark for installation') ?></td> 165 <td width="159"><?php echo T_('Add-On Package') ?></td> 166 <td width="168"><?php echo T_('Package Description') ?></td> 167 <td width="168"><?php echo T_('Author') ?></td> 168 <td width="107"><?php echo T_('Latest Version'); ?></td> 169 <td width="107"><?php echo T_('Installed Version'); ?></td> 170 </tr> 171 <!-- Display the Mambots --> 172 <tr> 173 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Mambots') ?></strong></td> 174 </tr> 175 <?php for ( $counter = 0; $counter < $addon_count; $counter++) { 176 if ($addon->type[$counter]=='Mambot') { ?> 177 <tr> 178 <td style="text-align: center;"><div align="center"> 179 <input name="userurl[]" value="<?php echo $addon->url[$counter] ?>" type="checkbox" /> 180 </div></td> 181 <td><div align="left"><?php echo $addon->name[$counter] ?></div></td> 182 <td><?php echo $addon->desc[$counter] ?></td> 183 <td><div align="left"><?php echo $addon->author[$counter] ?></div></td> 184 <?php 185 //Find current version if installed 186 $LatestVersion = $addon->version[$counter]; 187 $addonXMLpath = $addon->xmlfile[$counter]; 188 $InstalledVersion = getCurrentAddonVersion($addonXMLpath); 189 ?> 190 <td><?php echo $LatestVersion; ?></td> 191 <td <?php if ($InstalledVersion!="Not Installed" && strcmp($InstalledVersion, $LatestVersion)<0) { 192 echo "style=\"background-color: Red; color: White; font-weight: bold;\""; } 193 ?> > 194 <?php echo $InstalledVersion; ?> 195 </td> 196 </tr> 197 <?php } } ?> 198 <!-- Display the Components --> 199 <tr> 200 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Components') ?></strong></td> 201 </tr> 202 <?php for ( $counter = 0; $counter < $addon_count; $counter++) { 203 if ($addon->type[$counter]=='Component') { ?> 204 <tr> 205 <td style="text-align: center;"><div align="center"> 206 <input name="userurl[]" value="<?php echo $addon->url[$counter] ?>" type="checkbox" /> 207 </div></td> 208 <td><div align="left"><?php echo $addon->name[$counter] ?></div></td> 209 <td><?php echo $addon->desc[$counter] ?></td> 210 <td><div align="left"><?php echo $addon->author[$counter] ?></div></td> 211 <?php 212 //Find current version if installed 213 $LatestVersion = $addon->version[$counter]; 214 $addonXMLpath = $addon->xmlfile[$counter]; 215 $InstalledVersion = getCurrentAddonVersion($addonXMLpath); 216 ?> 217 <td><?php echo $LatestVersion; ?></td> 218 <td <?php if ($InstalledVersion!="Not Installed" && strcmp($InstalledVersion, $LatestVersion)<0) { 219 echo "style=\"background-color: Red; color: White; font-weight: bold;\""; } 220 ?> > 221 <?php echo $InstalledVersion; ?> 222 </td> 223 </tr> 224 <?php } } ?> 225 <!-- Display the Modules --> 226 <tr> 227 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Modules') ?></strong></td> 228 </tr> 229 <?php for ( $counter = 0; $counter < $addon_count; $counter++) { 230 if ($addon->type[$counter]=='Module') { ?> 231 <tr> 232 <td style="text-align: center;"><div align="center"> 233 <input name="userurl[]" value="<?php echo $addon->url[$counter] ?>" type="checkbox" /> 234 </div></td> 235 <td><div align="left"><?php echo $addon->name[$counter] ?></div></td> 236 <td><?php echo $addon->desc[$counter] ?></td> 237 <td><div align="left"><?php echo $addon->author[$counter] ?></div></td> 238 <?php 239 //Find current version if installed 240 $LatestVersion = $addon->version[$counter]; 241 $addonXMLpath = $addon->xmlfile[$counter]; 242 $InstalledVersion = getCurrentAddonVersion($addonXMLpath); 243 ?> 244 <td><?php echo $LatestVersion; ?></td> 245 <td <?php if ($InstalledVersion!="Not Installed" && strcmp($InstalledVersion, $LatestVersion)<0) { 246 echo "style=\"background-color: Red; color: White; font-weight: bold;\""; } 247 ?> > 248 <?php echo $InstalledVersion; ?> 249 </td> 250 </tr> 251 <?php } } ?> 252 <?php //Load Certified 3rd Party Addon XML file from The Source 253 if (fopen("http://source.mambo-foundation.org/external/config/external_addon.xml", "r")) { 254 $exaddon = simplexml_load_file('http://source.mambo-foundation.org/external/config/external_addon.xml'); 255 } else { 256 exit('Failed to open external_addon.xml on The Source (source.mambo-foundation.org).'); 257 } 258 //Count the number of items in the XML file 259 $exaddon_count = 0; 260 foreach($exaddon->name as $i) $exaddon_count++; 261 ?> 262 <tr> 263 <th colspan="7" style="text-align: left;"><?php echo T_('Peer Reviewed / Certified 3rd Party Add-On Installation')?></th> 264 </tr> 265 <tr style="background-color: Orange; font-weight: bold; text-align: center;"> 266 <td width="185"><?php echo T_('Mark for installation'); ?></td> 267 <td width="159"><?php echo T_('Add-On Package'); ?></td> 268 <td width="168"><?php echo T_('Package Description'); ?></td> 269 <td width="168"><?php echo T_('Author'); ?></td> 270 <td width="107"><?php echo T_('Latest Version'); ?></td> 271 <td width="107"><?php echo T_('Installed Version'); ?></td> 272 </tr> 273 <!-- Display the Mambots --> 274 <tr> 275 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Mambots') ?></strong></td> 276 </tr> 277 <?php 278 //Setup variable to test for the existance of packages 279 $exmambot_count = 0; 280 for ( $counter = 0; $counter < $exaddon_count; $counter++) { 281 if ($exaddon->type[$counter]=='Mambot') { 282 //If we are here then 3rd party mambots exist 283 $exmambot_count = 1; 284 ?> 285 <tr> 286 <td style="text-align: center;"><div align="center"> 287 <input name="userurl" value="<?php echo $exaddon->url[$counter] ?>" type="checkbox"> 288 </div></td> 289 <td><div align="left"><?php echo $exaddon->name[$counter] ?></div></td> 290 <td><?php echo $exaddon->desc[$counter] ?></td> 291 <td><div align="left"><?php echo $exaddon->author[$counter] ?></div></td> 292 <td><?php echo $exaddon->version[$counter] ?></td> 293 </tr> 294 <?php } } 295 //If no 3rd party mambots exist then display the message below 296 if ($exmambot_count == 0) {?> 297 <tr> 298 <td></td> 299 <td> 300 <?php 301 echo T_('There are no qualifying packages at this time') ?></td> 302 </tr> 303 <?php } ?> 304 <!-- Display the Components --> 305 <tr> 306 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Components') ?></strong></td> 307 </tr> 308 <?php 309 //Setup variable to test for the existance of packages 310 $excomponent_count = 0; 311 for ( $counter = 0; $counter < $exaddon_count; $counter++) { 312 if ($exaddon->type[$counter]=='Component') { 313 //If we are here then 3rd party components exist 314 $excomponent_count = 1; 315 ?> 316 <tr> 317 <td style="text-align: center;"><div align="center"> 318 <input name="userurl" value="<?php echo $exaddon->url[$counter] ?>" type="checkbox"> 319 </div></td> 320 <td><div align="left"><?php echo $exaddon->name[$counter] ?></div></td> 321 <td><?php echo $exaddon->desc[$counter] ?></td> 322 <td><div align="left"><?php echo $exaddon->author[$counter] ?></div></td> 323 <td><?php echo $exaddon->version[$counter] ?></td> 324 </tr> 325 <?php } } 326 //If no 3rd party components exist then display the message below 327 if ($excomponent_count == 0) {?> 328 <tr> 329 <td></td> 330 <td><?php echo T_('There are no qualifying packages at this time') ?></td> 331 </tr> 332 <?php } ?> 333 <!-- Display the Modules --> 334 <tr> 335 <td style="background-color: Yellow; font-weight: bold; text-align: center;"><strong><?php echo T_('Package Type: Modules') ?></strong></td> 336 </tr> 337 <?php 338 //Setup variable to test for the existance of packages 339 $exmodule_count = 0; 340 for ( $counter = 0; $counter < $exaddon_count; $counter++) { 341 if ($exaddon->type[$counter]=='Module') { 342 //If we are here then 3rd party modules exist 343 $exmodule_count = 1; 344 ?> 345 <tr> 346 <td style="text-align: center;"><div align="center"> 347 <input name="userurl" value="<?php echo $exaddon->url[$counter] ?>" type="checkbox"> 348 </div></td> 349 <td><div align="left"><?php echo $exaddon->name[$counter] ?></div></td> 350 <td><?php echo $exaddon->desc[$counter] ?></td> 351 <td><div align="left"><?php echo $exaddon->author[$counter] ?></div></td> 352 <td><?php echo $exaddon->version[$counter] ?></td> 353 </tr> 354 <?php } } 355 //If no 3rd party modules exist then display the message below 356 if ($exmodule_count == 0) {?> 357 <tr> 358 <td></td> 359 <td><?php echo T_('There are no qualifying packages at this time') ?></td> 360 </tr> 361 <?php } ?> 362 </table> 363 <input name="task" value="installfromurl" type="hidden" /> 364 <input name="option" value="<?php echo $option;?>" type="hidden" /> 365 <input name="element" value="<?php echo $element;?>" type="hidden" /> 366 <input name="client" value="<?php echo $client;?>" type="hidden" /> 367 </form> 368 <br /> 369 <?php 370 } 371 372 function theSourceForm ($option, $element, $client) { 373 HTML_installer::showUrlForm('', $option, $element, $client); 374 echo '<object type="text/html" data="http://source.mambo-foundation.org/component/syndstyle/option,com_remository/" width="500" height="1000">' 375 .T_('Sorry, it seems that The Source is not available').'</object>'; 376 } 377 378 /** 379 * @param string 380 * @param string 381 * @param string 382 * @param string 383 */ 384 function showInstallMessage ($messages, $title, $return) { 385 global $PHP_SELF; 386 if (!$return) $return = mamboCore::get('mosConfig_live_site').'/administrator/index2.php'; 387 ?> 388 <table class="adminheading"> 389 <tr> 390 <th class="install"> 391 <?php echo $title; ?> 392 </th> 393 </tr> 394 </table> 395 396 <table class="adminform"> 397 <?php 398 if (!is_array($messages)) $messages = array($messages); 399 foreach ($messages as $message) { 400 switch ($message->level) { 401 case _MOS_ERROR_INFORM: 402 $colour = 'green'; 403 $level = 'Information: '; 404 break; 405 case _MOS_ERROR_WARN: 406 $colour = 'red'; 407 $level = 'Warning: '; 408 break; 409 case _MOS_ERROR_SEVERE: 410 $colour = 'red'; 411 $level = 'Severe: '; 412 break; 413 case _MOS_ERROR_FATAL: 414 $colour = 'red'; 415 $level = 'Fatal: '; 416 break; 417 } 418 ?> 419 <tr> 420 <td align="left"> 421 <span class="<?php echo $colour; ?>"><strong><?php echo $level.$message->text; ?></strong></span> 422 </td> 423 </tr> 424 <?php 425 } 426 ?> 427 <tr> 428 <td colspan="2" align="center"> 429 [ <a href="<?php echo $return;?>" style="font-size: 16px; font-weight: bold"><?php echo T_('Continue ...')?></a> ] 430 </td> 431 </tr> 432 </table> 433 <?php 434 } 435 } 436 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |