[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/installation/ -> index.php (source)

   1  <?php
   2  /**
   3  * Install instructions
   4  * @package Mambo
   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  if (!defined('_VALID_MOS')) define( '_VALID_MOS', 1 );
  18  
  19  if (file_exists( '../configuration.php' ) && filesize( '../configuration.php' ) > 10) {
  20      header( "Location: ../index.php" );
  21      exit();
  22  }
  23  require_once ( '../includes/version.php' );
  24  
  25  $_VERSION = new version();
  26  
  27  $version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' '
  28  . $_VERSION->DEV_STATUS
  29  .' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE .' '
  30  . $_VERSION->RELTIME .' '. $_VERSION->RELTZ;
  31  
  32  /** Include common.php */
  33  include_once ( 'common.php' );
  34  
  35  list($tmp_lang,$directions) = getLanguages();
  36  $lang = trim( mosGetParam( $_POST, 'lang', '' ) );
  37  $charset="utf-8";
  38  $text_direction="ltr";
  39  if($lang=='') {
  40      $lang="en";
  41  }else
  42  {
  43      $str_charset = explode(" ",$tmp_lang[$lang]);
  44      $charset = $str_charset[1];
  45      $text_direction = $directions[$lang];
  46          
  47  }
  48  $filename = "langconfig.php";
  49  if(is_writable($filename)) {
  50      $handle = fopen($filename,'w+');
  51      $content = "<?php\n";
  52      $content.="defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );\n";
  53      $content .= "\$lang = \"$lang\";\n";
  54      $content .= "\$charset = \"$charset\";\n";
  55      $content .= "\$text_direction = \"$text_direction\";\n";
  56      $content .= "\$gettext =& phpgettext();\n";
  57      $content .= "\$gettext->debug       = '0';\n";
  58      $content .= "\$gettext->has_gettext = '0';\n";
  59      $content .= "\$gettext->setlocale(\$lang);\n";
  60      $content .= "\$gettext->bindtextdomain(\$lang, 'language/');\n";
  61      $content .= "\$gettext->textdomain(\$lang);\n";
  62      $content .= "?>";
  63      fwrite($handle,$content);
  64      fclose($handle);
  65  }
  66  include_once ( 'langconfig.php' );
  67  function getLanguages() {
  68          $langfiles = glob("language/*.xml");
  69          $langs = array();
  70          
  71          foreach($langfiles as $xml) {
  72              if(is_readable($xml)) {
  73                  $source = file_get_contents($xml);
  74                  $encoding = "UTF-8";
  75                  if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
  76                      $encoding = strtoupper($m[1]);
  77                  }
  78                  $parser = xml_parser_create();
  79                  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
  80                  xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
  81                  xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
  82                  if (!xml_parse_into_struct($parser,$source,$values)) {
  83                      die(sprintf("XML error: %s at ".$xml." in line %d",
  84                      xml_error_string(xml_get_error_code($parser)),
  85                      xml_get_current_line_number($parser)));
  86                  }
  87                  xml_parser_free($parser);
  88                  $flag = true;
  89                  $title = "English";
  90                  foreach($values as $key=>$val) {
  91                      $tag = strtolower($val['tag']);
  92                      if($flag) {    
  93                          if($tag=="locale") {
  94                              $title = $val['attributes']['title'];
  95                              $text_direction = $val['attributes']['text_direction'];
  96                              $flag = false;
  97                          }
  98                      }
  99                  }
 100                  $name = str_replace("language/","",$xml);
 101                  $name = str_replace(".xml","",$name);
 102                  $langs[$name] = $title." ".strtolower($encoding);
 103                  $directions[$name]=$text_direction;
 104              }
 105          }
 106          return Array($langs,$directions);
 107  }
 108  
 109  function get_php_setting($val) {
 110      $r =  (ini_get($val) == '1' ? 1 : 0);
 111      return $r ? T_('ON') : T_('OFF');
 112  }
 113  
 114  function writableCell( $folder ) {
 115      echo '<tr>';
 116      echo '<td class="item">' . $folder . '/</td>';
 117      echo '<td align="left">';
 118      echo is_writable( "../$folder" ) ? '<strong><span class="green">'.T_('Writeable').'</span></strong>' : '<strong><span class="red">'.T_('Unwriteable').'</span></strong>' . '</td>';
 119      echo '</tr>';
 120  }
 121  
 122  echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?".">";
 123  ?>
 124  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 125  <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $text_direction;?>">
 126  <head>
 127  <title><?php echo T_('Mambo - Web Installer') ?></title>
 128  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
 129  <link rel="shortcut icon" href="../images/favicon.ico" />
 130  <link rel="stylesheet" href="install<?php if($text_direction=='rtl') echo '_'.$text_direction ?>.css" type="text/css" />
 131  <script type="text/javascript">
 132  <!--
 133  var checkobj
 134  function agreesubmit(el){
 135      checkobj=el
 136      if (document.all||document.getElementById){
 137          for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
 138          var tempobj=checkobj.form.elements[i]
 139          if(tempobj.type.toLowerCase()=="submit")
 140          tempobj.disabled=!checkobj.checked
 141          }
 142      }
 143  }
 144  
 145  function defaultagree(el){
 146      if (!document.all&&!document.getElementById){
 147          if (window.checkobj&&checkobj.checked)
 148          return true
 149          else{
 150              alert("<?php echo T_('Please read/accept license to continue installation')?>")
 151              return false
 152          }
 153      }
 154  }
 155  //-->
 156  </script>
 157  </head>
 158  <body>
 159  
 160  <div id="wrapper">
 161  <div id="header">
 162  <div id="mambo"><img src="header_install.png" alt="<?php echo T_('Mambo Installation') ?>" /></div>
 163  </div>
 164  </div>
 165  
 166  <div id="ctr" align="center">
 167  <div class="install">
 168  <div id="stepbar">
 169  <div class="step-on"><?php echo T_('pre-installation check') ?></div>
 170  <div class="step-off"><?php echo T_('license') ?></div>
 171  <div class="step-off"><?php echo T_('step 1') ?></div>
 172  <div class="step-off"><?php echo T_('step 2') ?></div>
 173  <div class="step-off"><?php echo T_('step 3') ?></div>
 174  <div class="step-off"><?php echo T_('step 4') ?></div>
 175  <div class="far-right">
 176  <input name="Button2" type="submit" class="button" value="<?php echo T_('Next') ?> >>" onclick="window.location='install.php';" />
 177  </div>
 178  </div>
 179  
 180  <div id="right">
 181  
 182  <div id="step"><?php echo T_('pre-installation check') ?></div>
 183  <div id="steposi"></div>
 184  
 185  <div class="clr"></div>
 186  <h1><?php echo T_('Pre-installation check for:') ?><!-- <br /> --> <?php echo $version; ?></h1>
 187      <form action="index.php" method="post" name="Langue">
 188                  <h1><?php echo T_('Mambo installation language') ?>:</h1>
 189                  <div class="install-text"> <?php echo T_('The installer automatically detects your browser language preferences. However, you can select one of the available languages.') ?>
 190                      <div class="ctr"></div>
 191                  </div>
 192  
 193                  <div class="install-form">
 194                      <div class="form-block">
 195                          <table class="content">
 196                              <tr>
 197                                  <td class="item"> <?php echo T_('Installation language') ?> </td>
 198                                  <td align="left">
 199                                      <?php
 200                                      echo '<select size="1" name="lang" onchange="this.form.submit();">';
 201                                      foreach ( $tmp_lang as $key=>$lang_found ){
 202                                          if( $key == $lang ){
 203                                              echo '<option value ="'.$key.'" selected="selected">'.ucfirst($lang_found)."</option>\n";
 204                                          }else{
 205                                              echo '<option value ="'.$key.'">'.ucfirst($lang_found)."</option>\n";
 206                                          }
 207                                      }
 208                                      echo '</select>';
 209                                      ?>
 210                                  </td>
 211                              </tr>
 212                          </table>
 213                      </div>
 214                  </div>
 215                  <div class="install-form">
 216                      <div class="form-block">
 217                          <table class="content">
 218                              <tr>
 219                                  <td><strong><?php echo T_('Language check') ?></strong></td>
 220                              <tr>
 221                                  <td><?php echo T_('Installation language') ?></td>
 222                                  <td>
 223                                      <font color="green"><strong><?php echo ucfirst( $tmp_lang[$lang] ); ?></strong></font>
 224                                  </td>
 225                              </tr>
 226                              <tr>
 227                                  <td>ISO</td>
 228                                  <td>
 229                                      <font color="green"><strong><?php echo $charset; ?></strong></font>
 230                                  </td>
 231                              </tr>
 232                          </table>
 233                      </div>
 234                  </div>
 235              </form>
 236  <div class="clr"></div>
 237  <div class="install-text">
 238  <?php echo T_('If any of these items are highlighted in red then please take actions to correct them. Failure to do so could lead to your Mambo installation not functioning correctly.') ?>
 239  <div class="ctr"></div>
 240  </div>
 241  
 242  <div class="install-form">
 243  <div class="form-block">
 244  
 245  <table class="content">
 246  <tr>
 247      <td class="item">
 248      <?php echo T_('PHP version') ?> >= 4.3.0
 249      </td>
 250      <td align="left">
 251      <?php echo phpversion() < '4.3' ? '<strong><span class="red">'.T_('No').'</span></strong>' : '<strong><span class="green">'.T_('Yes').'</span></strong>';?>
 252      </td>
 253  </tr>
 254  <tr>
 255      <td>
 256      &nbsp; - <?php echo T_('zlib compression support') ?>
 257      </td>
 258      <td align="left">
 259      <?php echo extension_loaded('zlib') ? '<strong><span class="green">'.T_('Available').'</span></strong>' : '<strong><span class="red">'.T_('Unavailable').'</span></strong>';?>
 260      </td>
 261  </tr>
 262  <tr>
 263      <td>
 264      &nbsp; - <?php echo T_('XML support') ?>
 265      </td>
 266      <td align="left">
 267      <?php echo extension_loaded('xml') ? '<strong><span class="green">'.T_('Available').'</span></strong>' : '<strong><span class="red">'.T_('Unavailable').'</span></strong>';?>
 268      </td>
 269  </tr>
 270  <tr>
 271      <td>
 272      &nbsp; - <?php echo T_('MySQL support') ?>
 273      </td>
 274      <td align="left">
 275      <?php echo function_exists( 'mysql_connect' ) ? '<strong><span class="green">'.T_('Available').'</span></strong>' : '<strong><span class="red">'.T_('Unavailable').'</span></strong>';?>
 276      </td>
 277  </tr>
 278  <tr>
 279      <td>
 280      &nbsp; - <span class="red"><?php echo T_('Note:') ?></span>
 281      </td>
 282      <td align="left">
 283      <?php echo T_('MySQL Strict Mode is not supported') ?>
 284      </td>
 285  </tr>
 286  <tr>
 287      <td valign="top" class="item">
 288      configuration.php
 289      </td>
 290      <td align="left">
 291      <?php
 292      if (@file_exists('../configuration.php') &&  @is_writable( '../configuration.php' )){
 293          echo '<strong><span class="green">'.T_('Writeable').'</span></strong>';
 294      } else if (is_writable( '..' )) {
 295          echo '<strong><span class="green">'.T_('Writeable').'</span></strong>';
 296      } else {
 297          echo '<strong><span class="red">'.T_('Unwriteable').'</span></strong><br /><span class="small">'.T_('You can still continue the install as the configuration will be displayed at the end, just copy & paste this and upload.').'</span>';
 298      } ?>
 299      </td>
 300  </tr>
 301  <tr>
 302      <td class="item">
 303      <?php echo T_('Session save path') ?>
 304      </td>
 305      <td align="left">
 306      <strong><?php echo (($sp=ini_get('session.save_path'))?$sp:'Not set'); ?></strong>,
 307      <?php echo is_writable( $sp ) ? '<strong><span class="green">'.T_('Writeable').'</span></strong>' : '<strong><span class="red">'.T_('Unwriteable').'</span></strong>';?>
 308      </td>
 309  </tr>
 310  </table>
 311  </div>
 312  </div>
 313  <div class="clr"></div>
 314  
 315  <h1><?php echo T_('Recommended settings:') ?></h1>
 316  <div class="install-text">
 317  <?php echo T_('These settings are recommended for PHP in order to ensure full compatibility with Mambo. However, Mambo will still operate if your settings do not quite match the recommended.') ?>
 318  
 319  <br />
 320  
 321  
 322  <div class="ctr"></div>
 323  </div>
 324  
 325  <div class="install-form">
 326  <div class="form-block">
 327  
 328  <table class="content">
 329  <tr>
 330      <td class="toggle">
 331      <?php echo T_('Directive') ?>
 332      </td>
 333      <td class="toggle">
 334      <?php echo T_('Recommended') ?>
 335      </td>
 336      <td class="toggle">
 337      <?php echo T_('Actual') ?>
 338      </td>
 339  </tr>
 340  <?php
 341  $php_recommended_settings = array(array ('Safe Mode','safe_mode',T_('OFF')),
 342  array ('Display Errors','display_errors',T_('ON')),
 343  array ('File Uploads','file_uploads',T_('ON')),
 344  array ('Magic Quotes GPC','magic_quotes_gpc',T_('ON')),
 345  array ('Magic Quotes Runtime','magic_quotes_runtime',T_('OFF')),
 346  array ('Register Globals','register_globals',T_('OFF')),
 347  array ('Output Buffering','output_buffering',T_('OFF')),
 348  array ('Session auto start','session.auto_start',T_('OFF')),
 349  );
 350  
 351  foreach ($php_recommended_settings as $phprec) {
 352  ?>
 353  <tr>
 354      <td class="item"><?php echo $phprec[0]; ?>:</td>
 355      <td class="toggle"><?php echo $phprec[2]; ?>:</td>
 356      <td>
 357      <?php
 358      if ( get_php_setting($phprec[1]) == $phprec[2] ) {
 359      ?>
 360          <span class="green"><strong>
 361      <?php
 362      } else {
 363      ?>
 364          <span class="red"><strong>
 365      <?php
 366      }
 367      echo get_php_setting($phprec[1]);
 368      ?>
 369      </strong></span>
 370      <td>
 371  </tr>
 372  <?php
 373  }
 374  ?>
 375  </table>
 376  </div>
 377  </div>
 378  <div class="clr"></div>
 379  <h1><?php echo T_('Directory and File Permissions:') ?></h1>
 380  <div class="install-text">
 381  <?php echo T_('In order for Mambo to function correctly it needs to be able to access or write to certain files or directories. If you see "Unwriteable" you need to change the permissions on the file or directory to allow Mambo to write to it.') ?>
 382  <div class="clr">&nbsp;&nbsp;</div>
 383  <div class="ctr"></div>
 384  </div>
 385  
 386  <div class="install-form">
 387  <div class="form-block">
 388  
 389  <table class="content">
 390  <?php
 391  writableCell( 'administrator/backups' );
 392  writableCell( 'administrator/components' );
 393  writableCell( 'administrator/modules' );
 394  writableCell( 'administrator/templates' );
 395  writableCell( 'cache' );
 396  writableCell( 'components' );
 397  writableCell( 'images' );
 398  writableCell( 'images/banners' );
 399  writableCell( 'images/stories' );
 400  ?>
 401  <tr>
 402      <td valign="top" class="item">
 403      installation/langconfig.php
 404      </td>
 405      <td align="left">
 406      <?php
 407      if (@file_exists('../installation/langconfig.php') &&  @is_writable( '../installation/langconfig.php' )){
 408          echo '<strong><span class="green">'.T_('Writeable').'</span></strong>';
 409      } else if (is_writable( '..' )) {
 410          echo '<strong><span class="green">'.T_('Writeable').'</span></strong>';
 411      } else {
 412          echo '<strong><span class="red">'.T_('Unwriteable').'</span></strong>';
 413      } ?>
 414      </td>
 415  </tr>
 416  <?php
 417  writableCell( 'language' );
 418  writableCell( 'mambots' );
 419  writableCell( 'mambots/authenticator' );
 420  writableCell( 'mambots/content' );
 421  writableCell( 'mambots/editors' );
 422  writableCell( 'mambots/editors-xtd' );
 423  writableCell( 'mambots/search' );
 424  writableCell( 'mambots/system' );
 425  writableCell( 'media' );
 426  writableCell( 'modules' );
 427  writableCell( 'templates' );
 428  writableCell( 'uploadfiles' );
 429  ?>
 430  </table>
 431  </div>
 432  <div class="clr"></div>
 433  </div>
 434  <div class="clr"></div>
 435  </div>
 436  <div class="clr"></div>
 437  </div>
 438  </div>
 439  <div class="ctr">
 440  <?php echo T_('<a href="http://www.mambo-foundation.org" target="_blank">Mambo </a> is Free Software released under the <a href="http://www.opensource.org/licenses/gpl-2.0.php" target="_blank">GNU/GPL License</a>.') ?>
 441  </div>
 442  </body>
 443  </html>