[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/installation/ -> install3.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  /** Include common.php */
  20  require_once ( 'common.php' );
  21  include_once ( 'langconfig.php' );
  22  
  23  $DBhostname = mosGetParam( $_POST, 'DBhostname', '' );
  24  $DBuserName = mosGetParam( $_POST, 'DBuserName', '' );
  25  $DBpassword = mosGetParam( $_POST, 'DBpassword', '' );
  26  $DBname      = mosGetParam( $_POST, 'DBname', '' );
  27  $DBPrefix      = mosGetParam( $_POST, 'DBPrefix', '' );
  28  $DBcreated    = intval( mosGetParam( $_POST, 'DBcreated', 0 ) );
  29  $sitename      = stripslashes( mosGetParam( $_POST, 'sitename', '' ) );
  30  $adminEmail = mosGetParam( $_POST, 'adminEmail', '');
  31  $filePerms    = mosGetParam( $_POST, 'filePerms', '');
  32  $dirPerms    = mosGetParam( $_POST, 'dirPerms', '');
  33  $configArray['siteUrl'] = trim( mosGetParam( $_POST, 'siteUrl', '' ) );
  34  $configArray['absolutePath'] = stripslashes( trim( mosGetParam( $_POST, 'absolutePath', '' ) ) );
  35  ?>
  36  <?php
  37  echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?".">";
  38  ?>
  39  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  40  <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $text_direction;?>">
  41  <head>
  42  <title><?php echo T_('Mambo - Web Installer') ?></title>
  43  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  44  <link rel="shortcut icon" href="../images/favicon.ico" />
  45  <link rel="stylesheet" href="install<?php if($text_direction=='rtl') echo '_'.$text_direction ?>.css" type="text/css" />
  46  <?php
  47  if ($sitename == '') {
  48      echo "<body><form name=\"stepBack\" method=\"post\" action=\"install2.php\">
  49              <input type=\"hidden\" name=\"DBhostname\" value=\"$DBhostname\">
  50              <input type=\"hidden\" name=\"DBuserName\" value=\"$DBuserName\">
  51              <input type=\"hidden\" name=\"DBpassword\" value=\"$DBpassword\">
  52              <input type=\"hidden\" name=\"DBname\" value=\"$DBname\">
  53              <input type=\"hidden\" name=\"DBPrefix\" value=\"$DBPrefix\">
  54              <input type=\"hidden\" name=\"DBcreated\" value=\"$DBcreated\">
  55          </form>";
  56      $error_msg = "The sitename has not been provided";
  57      echo "<script>alert('".$error_msg."'); document.stepBack.submit(); </script></body></html>";
  58      return;
  59  } ?>
  60  
  61  <script type="text/javascript">
  62  <!--
  63  function check() {
  64      // form validation check
  65      var formValid = true;
  66      var f = document.form;
  67      if ( f.siteUrl.value == '' ) {
  68          alert('<?php echo T_('Please enter Site URL') ?>');
  69          f.siteUrl.focus();
  70          formValid = false;
  71      } else if ( f.absolutePath.value == '' ) {
  72          alert('<?php echo T_('Please enter the absolute path to your site') ?>');
  73          f.absolutePath.focus();
  74          formValid = false;
  75      } else if ( f.adminEmail.value == '' ) {
  76          alert('<?php echo T_('Please enter an email address to contact your administrator') ?>');
  77          f.adminEmail.focus();
  78          formValid = false;
  79      } else if ( f.adminPassword.value == '' ) {
  80          alert('<?php echo T_('Please enter a password for you administrator') ?>');
  81          f.adminPassword.focus();
  82          formValid = false;
  83      }
  84  
  85      return formValid;
  86  }
  87  
  88  function changeFilePermsMode(mode)
  89  {
  90      if(document.getElementById) {
  91          switch (mode) {
  92              case 0:
  93                  document.getElementById('filePermsFlags').style.display = 'none';
  94                  break;
  95              default:
  96                  document.getElementById('filePermsFlags').style.display = '';
  97          } // switch
  98      } // if
  99  }
 100  
 101  function changeDirPermsMode(mode)
 102  {
 103      if(document.getElementById) {
 104          switch (mode) {
 105              case 0:
 106                  document.getElementById('dirPermsFlags').style.display = 'none';
 107                  break;
 108              default:
 109                  document.getElementById('dirPermsFlags').style.display = '';
 110          } // switch
 111      } // if
 112  }
 113  //-->
 114  </script>
 115  </head>
 116  <body onload="document.form.siteUrl.focus();">
 117  <div id="wrapper">
 118      <div id="header">
 119          <div id="mambo"><img src="header_install.png" alt="<?php echo T_('Mambo Installation') ?>" /></div>
 120      </div>
 121  </div>
 122  <div id="ctr" align="center">
 123      <form action="install4.php" method="post" name="form" id="form" onsubmit="return check();">
 124      <input type="hidden" name="DBhostname" value="<?php echo "$DBhostname"; ?>" />
 125      <input type="hidden" name="DBuserName" value="<?php echo "$DBuserName"; ?>" />
 126      <input type="hidden" name="DBpassword" value="<?php echo "$DBpassword"; ?>" />
 127      <input type="hidden" name="DBname" value="<?php echo "$DBname"; ?>" />
 128      <input type="hidden" name="DBPrefix" value="<?php echo "$DBPrefix"; ?>" />
 129      <input type="hidden" name="sitename" value="<?php echo "$sitename"; ?>" />
 130      <div class="install">
 131          <div id="stepbar">
 132              <div class="step-off"><?php echo T_('pre-installation check') ?></div>
 133              <div class="step-off"><?php echo T_('license') ?></div>
 134              <div class="step-off"><?php echo T_('step 1') ?></div>
 135              <div class="step-off"><?php echo T_('step 2') ?></div>
 136              <div class="step-on"><?php echo T_('step 3') ?></div>
 137              <div class="step-off"><?php echo T_('step 4') ?></div>
 138              <div class="far-right">
 139                  <input class="button" type="submit" name="next" value="<?php echo T_('Next') ?> >>"/>
 140              </div>
 141          </div>
 142          <div id="right">
 143              <div id="step"><?php echo T_('step 3') ?></div>
 144              <div id="steposi"></div>
 145              <div class="clr"></div>
 146              <h1><?php echo T_('Confirm the site URL, path, admin e-mail and file/directory chmods') ?></h1>
 147              <div class="install-text"><?php echo T_('<p>If URL and Path looks correct then please do not change. If you are not sure then please contact your ISP or administrator. Usually the values displayed will work for your site.<br /><br />Enter your e-mail address, this will be the e-mail address of the site SuperAdministrator.<br /><br />The permission settings will be used while installing mambo itself, by the mambo addon-installers and by the media manager. If you are unsure what flags shall be set, leave the default settings at the moment. You can still change these flags later in the site global configuration.</p>') ?>
 148              </div>
 149              <div class="install-form">
 150                  <div class="form-block">
 151                      <table class="content2">
 152                      <tr>
 153                          <td width="100"><?php echo T_('URL') ?></td>
 154  <?php
 155      $url = "";
 156      if ($configArray['siteUrl'])
 157          $url = $configArray['siteUrl'];
 158      else {
 159          $root = $_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']!=80?':'.$_SERVER['SERVER_PORT']:'').$_SERVER['PHP_SELF'];
 160          $root = str_replace("installation/","",$root);
 161          $root = str_replace("/install3.php","",$root);
 162          $url = "http://".$root;
 163      }
 164  ?>                        <td align="center"><input class="inputbox" type="text" name="siteUrl" value="<?php echo $url; ?>" size="50"/></td>
 165                      </tr>
 166                      <tr>
 167                          <td><?php echo T_('Path') ?></td>
 168  <?php
 169      $abspath = "";
 170      if ($configArray['absolutePath'])
 171          $abspath = $configArray['absolutePath'];
 172      else {
 173          $path = getcwd();
 174          if (preg_match("/\/installation/i", "$path"))
 175              $abspath = str_replace('/installation',"",$path);
 176          else
 177              $abspath = str_replace('\installation',"",$path);
 178      }
 179  ?>                        <td align="center"><input class="inputbox" type="text" name="absolutePath" value="<?php echo $abspath; ?>" size="50"/></td>
 180                      </tr>
 181                      <tr>
 182                          <td><?php echo T_('Your E-mail') ?></td>
 183                          <td align="center"><input class="inputbox" type="text" name="adminEmail" value="<?php echo "$adminEmail"; ?>" size="50" /></td>
 184                      </tr>
 185                      <tr>
 186                          <td><?php echo T_('Admin password') ?></td>
 187                          <td align="center"><input class="inputbox" type="text" name="adminPassword" value="<?php echo mosMakePassword(8); ?>" size="50"/></td>
 188                      </tr>
 189                      <tr>
 190  <?php
 191      $mode = 0;
 192      $flags = 0644;
 193      if ($filePerms!='') {
 194          $mode = 1;
 195          $flags = octdec($filePerms);
 196      } // if
 197  ?>
 198                          <td colspan="2">
 199                                <fieldset><legend><?php echo T_('File Permissions') ?></legend>
 200                                  <table cellpadding="1" cellspacing="1" border="0">
 201                                      <tr>
 202                                          <td><input type="radio" id="filePermsMode0" name="filePermsMode" value="0" onclick="changeFilePermsMode(0)"<?php if (!$mode) echo ' checked="checked"'; ?>/></td>
 203                                          <td><label for="filePermsMode0"><?php echo T_('Dont CHMOD files (use server defaults)') ?></label></td>
 204                                      </tr>
 205                                      <tr>
 206                                          <td><input type="radio" id="filePermsMode1" name="filePermsMode" value="1" onclick="changeFilePermsMode(1)"<?php if ($mode) echo ' checked="checked"'; ?>/></td>
 207                                          <td><label for="filePermsMode1"> <?php echo T_('CHMOD files to:') ?></label></td>
 208                                      </tr>
 209                                      <tr id="filePermsFlags"<?php if (!$mode) echo ' style="display:none"'; ?>>
 210                                          <td>&nbsp;</td>
 211                                          <td>
 212                                              <table cellpadding="1" cellspacing="0" border="0">
 213                                                  <tr>
 214                                                      <td><?php echo T_('User:') ?></td>
 215                                                      <td><input type="checkbox" id="filePermsUserRead" name="filePermsUserRead" value="1"<?php if ($flags & 0400) echo ' checked="checked"'; ?>/></td>
 216                                                      <td><label for="filePermsUserRead"><?php echo T_('read') ?></label></td>
 217                                                      <td><input type="checkbox" id="filePermsUserWrite" name="filePermsUserWrite" value="1"<?php if ($flags & 0200) echo ' checked="checked"'; ?>/></td>
 218                                                      <td><label for="filePermsUserWrite"><?php echo T_('write') ?></label></td>
 219                                                      <td><input type="checkbox" id="filePermsUserExecute" name="filePermsUserExecute" value="1"<?php if ($flags & 0100) echo ' checked="checked"'; ?>/></td>
 220                                                      <td width="100%"><label for="filePermsUserExecute"><?php echo T_('execute') ?></label></td>
 221                                                  </tr>
 222                                                  <tr>
 223                                                      <td><?php echo T_('Group:') ?></td>
 224                                                      <td><input type="checkbox" id="filePermsGroupRead" name="filePermsGroupRead" value="1"<?php if ($flags & 040) echo ' checked="checked"'; ?>/></td>
 225                                                      <td><label for="filePermsGroupRead"><?php echo T_('read') ?></label></td>
 226                                                      <td><input type="checkbox" id="filePermsGroupWrite" name="filePermsGroupWrite" value="1"<?php if ($flags & 020) echo ' checked="checked"'; ?>/></td>
 227                                                      <td><label for="filePermsGroupWrite"><?php echo T_('write') ?></label></td>
 228                                                      <td><input type="checkbox" id="filePermsGroupExecute" name="filePermsGroupExecute" value="1"<?php if ($flags & 010) echo ' checked="checked"'; ?>/></td>
 229                                                      <td width="100%"><label for="filePermsGroupExecute"><?php echo T_('execute') ?></label></td>
 230                                                  </tr>
 231                                                  <tr>
 232                                                      <td><?php echo T_('World:') ?></td>
 233                                                      <td><input type="checkbox" id="filePermsWorldRead" name="filePermsWorldRead" value="1"<?php if ($flags & 04) echo ' checked="checked"'; ?>/></td>
 234                                                      <td><label for="filePermsWorldRead"><?php echo T_('read') ?></label></td>
 235                                                      <td><input type="checkbox" id="filePermsWorldWrite" name="filePermsWorldWrite" value="1"<?php if ($flags & 02) echo ' checked="checked"'; ?>/></td>
 236                                                      <td><label for="filePermsWorldWrite"><?php echo T_('write') ?></label></td>
 237                                                      <td><input type="checkbox" id="filePermsWorldExecute" name="filePermsWorldExecute" value="1"<?php if ($flags & 01) echo ' checked="checked"'; ?>/></td>
 238                                                      <td width="100%"><label for="filePermsWorldExecute"><?php echo T_('execute') ?></label></td>
 239                                                  </tr>
 240                                              </table>
 241                                          </td>
 242                                      </tr>
 243                                  </table>
 244                              </fieldset>
 245                          </td>
 246                      </tr>
 247                      <tr>
 248  <?php
 249      $mode = 0;
 250      $flags = 0755;
 251      if ($dirPerms!='') {
 252          $mode = 1;
 253          $flags = octdec($dirPerms);
 254      } // if
 255  ?>
 256                          <td colspan="2">
 257                                <fieldset><legend><?php echo T_('Directory Permissions') ?></legend>
 258                                  <table cellpadding="1" cellspacing="1" border="0">
 259                                      <tr>
 260                                          <td><input type="radio" id="dirPermsMode0" name="dirPermsMode" value="0" onclick="changeDirPermsMode(0)"<?php if (!$mode) echo ' checked="checked"'; ?>/></td>
 261                                          <td><label for="dirPermsMode0"><?php echo T_('Dont CHMOD directories (use server defaults)') ?></label></td>
 262                                      </tr>
 263                                      <tr>
 264                                          <td><input type="radio" id="dirPermsMode1" name="dirPermsMode" value="1" onclick="changeDirPermsMode(1)"<?php if ($mode) echo ' checked="checked"'; ?>/></td>
 265                                          <td><label for="dirPermsMode1"> <?php echo T_('CHMOD directories to:') ?></label></td>
 266                                      </tr>
 267                                      <tr id="dirPermsFlags"<?php if (!$mode) echo ' style="display:none"'; ?>>
 268                                          <td>&nbsp;</td>
 269                                          <td>
 270                                              <table cellpadding="1" cellspacing="0" border="0">
 271                                                  <tr>
 272                                                      <td>User:</td>
 273                                                      <td><input type="checkbox" id="dirPermsUserRead" name="dirPermsUserRead" value="1"<?php if ($flags & 0400) echo ' checked="checked"'; ?>/></td>
 274                                                      <td><label for="dirPermsUserRead"><?php echo T_('read') ?></label></td>
 275                                                      <td><input type="checkbox" id="dirPermsUserWrite" name="dirPermsUserWrite" value="1"<?php if ($flags & 0200) echo ' checked="checked"'; ?>/></td>
 276                                                      <td><label for="dirPermsUserWrite"><?php echo T_('write') ?></label></td>
 277                                                      <td><input type="checkbox" id="dirPermsUserSearch" name="dirPermsUserSearch" value="1"<?php if ($flags & 0100) echo ' checked="checked"'; ?>/></td>
 278                                                      <td width="100%"><label for="dirPermsUserSearch"><?php echo T_('search') ?></label></td>
 279                                                  </tr>
 280                                                  <tr>
 281                                                      <td>Group:</td>
 282                                                      <td><input type="checkbox" id="dirPermsGroupRead" name="dirPermsGroupRead" value="1"<?php if ($flags & 040) echo ' checked="checked"'; ?>/></td>
 283                                                      <td><label for="dirPermsGroupRead"><?php echo T_('read') ?></label></td>
 284                                                      <td><input type="checkbox" id="dirPermsGroupWrite" name="dirPermsGroupWrite" value="1"<?php if ($flags & 020) echo ' checked="checked"'; ?>/></td>
 285                                                      <td><label for="dirPermsGroupWrite"><?php echo T_('write') ?></label></td>
 286                                                      <td><input type="checkbox" id="dirPermsGroupSearch" name="dirPermsGroupSearch" value="1"<?php if ($flags & 010) echo ' checked="checked"'; ?>/></td>
 287                                                      <td width="100%"><label for="dirPermsGroupSearch"><?php echo T_('search') ?></label></td>
 288                                                  </tr>
 289                                                  <tr>
 290                                                      <td>World:</td>
 291                                                      <td><input type="checkbox" id="dirPermsWorldRead" name="dirPermsWorldRead" value="1"<?php if ($flags & 04) echo ' checked="checked"'; ?>/></td>
 292                                                      <td><label for="dirPermsWorldRead"><?php echo T_('read') ?></label></td>
 293                                                      <td><input type="checkbox" id="dirPermsWorldWrite" name="dirPermsWorldWrite" value="1"<?php if ($flags & 02) echo ' checked="checked"'; ?>/></td>
 294                                                      <td><label for="dirPermsWorldWrite"><?php echo T_('write') ?></label></td>
 295                                                      <td><input type="checkbox" id="dirPermsWorldSearch" name="dirPermsWorldSearch" value="1"<?php if ($flags & 01) echo ' checked="checked"'; ?>/></td>
 296                                                      <td width="100%"><label for="dirPermsWorldSearch"><?php echo T_('search') ?></label></td>
 297                                                  </tr>
 298                                              </table>
 299                                          </td>
 300                                      </tr>
 301                                  </table>
 302                              </fieldset>
 303                          </td>
 304                      </tr>
 305                      </table>
 306                  </div>
 307              </div>
 308              <div id="break"></div>
 309          </div>
 310          <div class="clr"></div>
 311      </div>
 312      </form>
 313  </div>
 314  <div class="clr"></div>
 315  <div class="ctr">
 316  <?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>.') ?>
 317  </div>
 318  </body>
 319  </html>