[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: install4.php 7813 2007-06-29 06:04:09Z louis $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 6 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // Set flag that this is a parent file 15 define( "_VALID_MOS", 1 ); 16 17 // Include common.php 18 require_once ( 'common.php' ); 19 require_once ( '../includes/database.php' ); 20 21 $DBhostname = mosGetParam( $_POST, 'DBhostname', '' ); 22 $DBuserName = mosGetParam( $_POST, 'DBuserName', '' ); 23 $DBpassword = mosGetParam( $_POST, 'DBpassword', '' ); 24 $DBname = mosGetParam( $_POST, 'DBname', '' ); 25 $DBPrefix = mosGetParam( $_POST, 'DBPrefix', '' ); 26 $sitename = mosGetParam( $_POST, 'sitename', '' ); 27 $adminEmail = mosGetParam( $_POST, 'adminEmail', ''); 28 $siteUrl = mosGetParam( $_POST, 'siteUrl', '' ); 29 $absolutePath = mosGetParam( $_POST, 'absolutePath', '' ); 30 $adminPassword = mosGetParam( $_POST, 'adminPassword', ''); 31 32 $filePerms = ''; 33 if (mosGetParam($_POST,'filePermsMode',0)) 34 $filePerms = '0'. 35 (mosGetParam($_POST,'filePermsUserRead',0) * 4 + 36 mosGetParam($_POST,'filePermsUserWrite',0) * 2 + 37 mosGetParam($_POST,'filePermsUserExecute',0)). 38 (mosGetParam($_POST,'filePermsGroupRead',0) * 4 + 39 mosGetParam($_POST,'filePermsGroupWrite',0) * 2 + 40 mosGetParam($_POST,'filePermsGroupExecute',0)). 41 (mosGetParam($_POST,'filePermsWorldRead',0) * 4 + 42 mosGetParam($_POST,'filePermsWorldWrite',0) * 2 + 43 mosGetParam($_POST,'filePermsWorldExecute',0)); 44 45 $dirPerms = ''; 46 if (mosGetParam($_POST,'dirPermsMode',0)) 47 $dirPerms = '0'. 48 (mosGetParam($_POST,'dirPermsUserRead',0) * 4 + 49 mosGetParam($_POST,'dirPermsUserWrite',0) * 2 + 50 mosGetParam($_POST,'dirPermsUserSearch',0)). 51 (mosGetParam($_POST,'dirPermsGroupRead',0) * 4 + 52 mosGetParam($_POST,'dirPermsGroupWrite',0) * 2 + 53 mosGetParam($_POST,'dirPermsGroupSearch',0)). 54 (mosGetParam($_POST,'dirPermsWorldRead',0) * 4 + 55 mosGetParam($_POST,'dirPermsWorldWrite',0) * 2 + 56 mosGetParam($_POST,'dirPermsWorldSearch',0)); 57 58 if ((trim($adminEmail== "")) || (preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $adminEmail )==false)) { 59 echo "<form name=\"stepBack\" method=\"post\" action=\"install3.php\"> 60 <input type=\"hidden\" name=\"DBhostname\" value=\"$DBhostname\" /> 61 <input type=\"hidden\" name=\"DBuserName\" value=\"$DBuserName\" /> 62 <input type=\"hidden\" name=\"DBpassword\" value=\"$DBpassword\" /> 63 <input type=\"hidden\" name=\"DBname\" value=\"$DBname\" /> 64 <input type=\"hidden\" name=\"DBPrefix\" value=\"$DBPrefix\" /> 65 <input type=\"hidden\" name=\"DBcreated\" value=\"1\" /> 66 <input type=\"hidden\" name=\"sitename\" value=\"$sitename\" /> 67 <input type=\"hidden\" name=\"adminEmail\" value=\"$adminEmail\" /> 68 <input type=\"hidden\" name=\"siteUrl\" value=\"$siteUrl\" /> 69 <input type=\"hidden\" name=\"absolutePath\" value=\"$absolutePath\" /> 70 <input type=\"hidden\" name=\"filePerms\" value=\"$filePerms\" /> 71 <input type=\"hidden\" name=\"dirPerms\" value=\"$dirPerms\" /> 72 </form>"; 73 echo "<script>alert('You must provide a valid admin email address.'); document.stepBack.submit(); </script>"; 74 return; 75 } 76 77 if($DBhostname && $DBuserName && $DBname) { 78 $configArray['DBhostname'] = $DBhostname; 79 $configArray['DBuserName'] = $DBuserName; 80 $configArray['DBpassword'] = $DBpassword; 81 $configArray['DBname'] = $DBname; 82 $configArray['DBPrefix'] = $DBPrefix; 83 } else { 84 echo "<form name=\"stepBack\" method=\"post\" action=\"install3.php\"> 85 <input type=\"hidden\" name=\"DBhostname\" value=\"$DBhostname\" /> 86 <input type=\"hidden\" name=\"DBuserName\" value=\"$DBuserName\" /> 87 <input type=\"hidden\" name=\"DBpassword\" value=\"$DBpassword\" /> 88 <input type=\"hidden\" name=\"DBname\" value=\"$DBname\" /> 89 <input type=\"hidden\" name=\"DBPrefix\" value=\"$DBPrefix\" /> 90 <input type=\"hidden\" name=\"DBcreated\" value=\"1\" /> 91 <input type=\"hidden\" name=\"sitename\" value=\"$sitename\" /> 92 <input type=\"hidden\" name=\"adminEmail\" value=\"$adminEmail\" /> 93 <input type=\"hidden\" name=\"siteUrl\" value=\"$siteUrl\" /> 94 <input type=\"hidden\" name=\"absolutePath\" value=\"$absolutePath\" /> 95 <input type=\"hidden\" name=\"filePerms\" value=\"$filePerms\" /> 96 <input type=\"hidden\" name=\"dirPerms\" value=\"$dirPerms\" /> 97 </form>"; 98 99 echo "<script>alert('The database details provided are incorrect and/or empty'); document.stepBack.submit(); </script>"; 100 return; 101 } 102 103 if ($sitename) { 104 if (!get_magic_quotes_gpc()) { 105 $configArray['sitename'] = addslashes($sitename); 106 } else { 107 $configArray['sitename'] = $sitename; 108 } 109 } else { 110 echo "<form name=\"stepBack\" method=\"post\" action=\"install3.php\"> 111 <input type=\"hidden\" name=\"DBhostname\" value=\"$DBhostname\" /> 112 <input type=\"hidden\" name=\"DBuserName\" value=\"$DBuserName\" /> 113 <input type=\"hidden\" name=\"DBpassword\" value=\"$DBpassword\" /> 114 <input type=\"hidden\" name=\"DBname\" value=\"$DBname\" /> 115 <input type=\"hidden\" name=\"DBPrefix\" value=\"$DBPrefix\" /> 116 <input type=\"hidden\" name=\"DBcreated\" value=\"1\" /> 117 <input type=\"hidden\" name=\"sitename\" value=\"$sitename\" /> 118 <input type=\"hidden\" name=\"adminEmail\" value=\"$adminEmail\" /> 119 <input type=\"hidden\" name=\"siteUrl\" value=\"$siteUrl\" /> 120 <input type=\"hidden\" name=\"absolutePath\" value=\"$absolutePath\" /> 121 <input type=\"hidden\" name=\"filePerms\" value=\"$filePerms\" /> 122 <input type=\"hidden\" name=\"dirPerms\" value=\"$dirPerms\" /> 123 </form>"; 124 125 echo "<script>alert('The sitename has not been provided'); document.stepBack2.submit();</script>"; 126 return; 127 } 128 129 if (file_exists( '../configuration.php' )) { 130 $canWrite = is_writable( '../configuration.php' ); 131 } else { 132 $canWrite = is_writable( '..' ); 133 } 134 135 if ($siteUrl) { 136 $configArray['siteUrl']=$siteUrl; 137 // Fix for Windows 138 $absolutePath= str_replace("\\\\","/", $absolutePath); 139 $configArray['absolutePath']=$absolutePath; 140 $configArray['filePerms']=$filePerms; 141 $configArray['dirPerms']=$dirPerms; 142 143 $config = "<?php\n"; 144 $config .= "if(!defined('RG_EMULATION')) { define( 'RG_EMULATION', 0 ); }\n"; 145 $config .= "\$mosConfig_offline = '0';\n"; 146 $config .= "\$mosConfig_host = '{$configArray['DBhostname']}';\n"; 147 $config .= "\$mosConfig_user = '{$configArray['DBuserName']}';\n"; 148 $config .= "\$mosConfig_password = '{$configArray['DBpassword']}';\n"; 149 $config .= "\$mosConfig_db = '{$configArray['DBname']}';\n"; 150 $config .= "\$mosConfig_dbprefix = '{$configArray['DBPrefix']}';\n"; 151 $config .= "\$mosConfig_lang = 'english';\n"; 152 $config .= "\$mosConfig_absolute_path = '{$configArray['absolutePath']}';\n"; 153 $config .= "\$mosConfig_live_site = '{$configArray['siteUrl']}';\n"; 154 $config .= "\$mosConfig_sitename = '{$configArray['sitename']}';\n"; 155 $config .= "\$mosConfig_shownoauth = '0';\n"; 156 $config .= "\$mosConfig_useractivation = '1';\n"; 157 $config .= "\$mosConfig_uniquemail = '1';\n"; 158 $config .= "\$mosConfig_offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';\n"; 159 $config .= "\$mosConfig_error_message = 'This site is temporarily unavailable.<br /> Please notify the System Administrator';\n"; 160 $config .= "\$mosConfig_debug = '0';\n"; 161 $config .= "\$mosConfig_lifetime = '900';\n"; 162 $config .= "\$mosConfig_session_life_admin = '1800';\n"; 163 $config .= "\$mosConfig_session_type = '0';\n"; 164 $config .= "\$mosConfig_MetaDesc = 'Joomla - the dynamic portal engine and content management system';\n"; 165 $config .= "\$mosConfig_MetaKeys = 'Joomla, joomla';\n"; 166 $config .= "\$mosConfig_MetaTitle = '1';\n"; 167 $config .= "\$mosConfig_MetaAuthor = '1';\n"; 168 $config .= "\$mosConfig_locale = 'en_GB';\n"; 169 $config .= "\$mosConfig_offset = '0';\n"; 170 $config .= "\$mosConfig_offset_user = '0';\n"; 171 $config .= "\$mosConfig_hideAuthor = '0';\n"; 172 $config .= "\$mosConfig_hideCreateDate = '0';\n"; 173 $config .= "\$mosConfig_hideModifyDate = '0';\n"; 174 $config .= "\$mosConfig_hidePdf = '".intval( !is_writable( "{$configArray['absolutePath']}/media/" ) )."';\n"; 175 $config .= "\$mosConfig_hidePrint = '0';\n"; 176 $config .= "\$mosConfig_hideEmail = '0';\n"; 177 $config .= "\$mosConfig_enable_log_items = '0';\n"; 178 $config .= "\$mosConfig_enable_log_searches = '0';\n"; 179 $config .= "\$mosConfig_enable_stats = '0';\n"; 180 $config .= "\$mosConfig_sef = '0';\n"; 181 $config .= "\$mosConfig_vote = '0';\n"; 182 $config .= "\$mosConfig_gzip = '0';\n"; 183 $config .= "\$mosConfig_multipage_toc = '1';\n"; 184 $config .= "\$mosConfig_allowUserRegistration = '1';\n"; 185 $config .= "\$mosConfig_link_titles = '0';\n"; 186 $config .= "\$mosConfig_error_reporting = -1;\n"; 187 $config .= "\$mosConfig_list_limit = '30';\n"; 188 $config .= "\$mosConfig_caching = '0';\n"; 189 $config .= "\$mosConfig_cachepath = '{$configArray['absolutePath']}/cache';\n"; 190 $config .= "\$mosConfig_cachetime = '900';\n"; 191 $config .= "\$mosConfig_mailer = 'mail';\n"; 192 $config .= "\$mosConfig_mailfrom = '$adminEmail';\n"; 193 $config .= "\$mosConfig_fromname = '{$configArray['sitename']}';\n"; 194 $config .= "\$mosConfig_sendmail = '/usr/sbin/sendmail';\n"; 195 $config .= "\$mosConfig_smtpauth = '0';\n"; 196 $config .= "\$mosConfig_smtpuser = '';\n"; 197 $config .= "\$mosConfig_smtppass = '';\n"; 198 $config .= "\$mosConfig_smtphost = 'localhost';\n"; 199 $config .= "\$mosConfig_back_button = '1';\n"; 200 $config .= "\$mosConfig_item_navigation = '1';\n"; 201 $config .= "\$mosConfig_secret = '" . mosMakePassword(16) . "';\n"; 202 $config .= "\$mosConfig_pagetitles = '1';\n"; 203 $config .= "\$mosConfig_readmore = '1';\n"; 204 $config .= "\$mosConfig_hits = '1';\n"; 205 $config .= "\$mosConfig_icons = '1';\n"; 206 $config .= "\$mosConfig_favicon = 'favicon.ico';\n"; 207 $config .= "\$mosConfig_fileperms = '".$configArray['filePerms']."';\n"; 208 $config .= "\$mosConfig_dirperms = '".$configArray['dirPerms']."';\n"; 209 $config .= "\$mosConfig_helpurl = 'http://help.joomla.org';\n"; 210 $config .= "\$mosConfig_multilingual_support = '0';\n"; 211 $config .= "\$mosConfig_editor = 'tinymce';\n"; 212 $config .= "\$mosConfig_admin_expired = '1';\n"; 213 $config .= "\$mosConfig_frontend_login = '1';\n"; 214 $config .= "\$mosConfig_frontend_userparams = '1';\n"; 215 $config .= "\$mosConfig_itemid_compat = '0';\n"; 216 $config .= "setlocale (LC_TIME, \$mosConfig_locale);\n"; 217 $config .= "?>"; 218 219 if ($canWrite && ($fp = fopen("../configuration.php", "w"))) { 220 fputs( $fp, $config, strlen( $config ) ); 221 fclose( $fp ); 222 } else { 223 $canWrite = false; 224 } // if 225 226 $salt = mosMakePassword(16); 227 $crypt = md5($adminPassword.$salt); 228 $cryptpass = $crypt.':'.$salt; 229 230 $database = new database( $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix ); 231 $nullDate = $database->getNullDate(); 232 233 // create the admin user 234 $installdate = date('Y-m-d H:i:s'); 235 $query = "INSERT INTO `#__users` VALUES (62, 'Administrator', 'admin', '$adminEmail', '$cryptpass', 'Super Administrator', 0, 1, 25, '$installdate', '$nullDate', '', '')"; 236 $database->setQuery( $query ); 237 $database->query(); 238 // add the ARO (Access Request Object) 239 $query = "INSERT INTO `#__core_acl_aro` VALUES (10,'users','62',0,'Administrator',0)"; 240 $database->setQuery( $query ); 241 $database->query(); 242 // add the map between the ARO and the Group 243 $query = "INSERT INTO `#__core_acl_groups_aro_map` VALUES (25,'',10)"; 244 $database->setQuery( $query ); 245 $database->query(); 246 247 // chmod files and directories if desired 248 $chmod_report = "Directory and file permissions left unchanged."; 249 if ($filePerms != '' || $dirPerms != '') { 250 $mosrootfiles = array( 251 'administrator', 252 'cache', 253 'components', 254 'images', 255 'language', 256 'mambots', 257 'media', 258 'modules', 259 'templates', 260 'configuration.php' 261 ); 262 $filemode = NULL; 263 if ($filePerms != '') $filemode = octdec($filePerms); 264 $dirmode = NULL; 265 if ($dirPerms != '') $dirmode = octdec($dirPerms); 266 $chmodOk = TRUE; 267 foreach ($mosrootfiles as $file) { 268 if (!mosChmodRecursive($absolutePath.'/'.$file, $filemode, $dirmode)) { 269 $chmodOk = FALSE; 270 } 271 } 272 if ($chmodOk) { 273 $chmod_report = 'File and directory permissions successfully changed.'; 274 } else { 275 $chmod_report = 'File and directory permissions could not be changed.<br />'. 276 'Please CHMOD Joomla! files and directories manually.'; 277 } 278 } // if chmod wanted 279 } else { 280 ?> 281 <form action="install3.php" method="post" name="stepBack3" id="stepBack3"> 282 <input type="hidden" name="DBhostname" value="<?php echo $DBhostname;?>" /> 283 <input type="hidden" name="DBusername" value="<?php echo $DBuserName;?>" /> 284 <input type="hidden" name="DBpassword" value="<?php echo $DBpassword;?>" /> 285 <input type="hidden" name="DBname" value="<?php echo $DBname;?>" /> 286 <input type="hidden" name="DBPrefix" value="<?php echo $DBPrefix;?>" /> 287 <input type="hidden" name="DBcreated" value="1" /> 288 <input type="hidden" name="sitename" value="<?php echo $sitename;?>" /> 289 <input type="hidden" name="adminEmail" value="$adminEmail" /> 290 <input type="hidden" name="siteUrl" value="$siteUrl" /> 291 <input type="hidden" name="absolutePath" value="$absolutePath" /> 292 <input type="hidden" name="filePerms" value="$filePerms" /> 293 <input type="hidden" name="dirPerms" value="$dirPerms" /> 294 </form> 295 <script>alert('The site url has not been provided'); document.stepBack3.submit();</script> 296 <?php 297 } 298 echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; 299 ?> 300 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 301 <html xmlns="http://www.w3.org/1999/xhtml"> 302 <head> 303 <title>Joomla! - Web Installer</title> 304 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 305 <link rel="shortcut icon" href="../images/favicon.ico" /> 306 <link rel="stylesheet" href="install.css" type="text/css" /> 307 </head> 308 <body> 309 <div id="wrapper"> 310 <div id="header"> 311 <div id="joomla"><img src="header_install.png" alt="Joomla! Installation" /></div> 312 </div> 313 </div> 314 <div id="ctr" align="center"> 315 <form action="dummy" name="form" id="form"> 316 <div class="install"> 317 <div id="stepbar"> 318 <div class="step-off">pre-installation check</div> 319 <div class="step-off">license</div> 320 <div class="step-off">step 1</div> 321 <div class="step-off">step 2</div> 322 <div class="step-off">step 3</div> 323 <div class="step-on">step 4</div> 324 </div> 325 <div id="right"> 326 <div id="step">step 4</div> 327 <div class="far-right"> 328 <input class="button" type="button" name="runSite" value="View Site" 329 <?php 330 if ($siteUrl) { 331 echo "onClick=\"window.location.href='$siteUrl/index.php' \""; 332 } else { 333 echo "onClick=\"window.location.href='".$configArray['siteURL']."/index.php' \""; 334 } 335 ?>/> 336 <input class="button" type="button" name="Admin" value="Administration" 337 <?php 338 if ($siteUrl) { 339 echo "onClick=\"window.location.href='$siteUrl/administrator/index.php' \""; 340 } else { 341 echo "onClick=\"window.location.href='".$configArray['siteURL']."/administrator/index.php' \""; 342 } 343 ?>/> 344 </div> 345 <div class="clr"></div> 346 <h1>Congratulations! Joomla! is installed</h1> 347 <div class="install-text"> 348 <p>Click the "View Site" button to start Joomla! site or "Administration" 349 to take you to administrator login.</p> 350 </div> 351 <div class="install-form"> 352 <div class="form-block"> 353 <table width="100%"> 354 <tr><td class="error" align="center">PLEASE REMEMBER TO COMPLETELY<br/>REMOVE THE INSTALLATION DIRECTORY</td></tr> 355 <tr><td align="center"><h5>Administration Login Details</h5></td></tr> 356 <tr><td align="center" class="notice"><b>Username : admin</b></td></tr> 357 <tr><td align="center" class="notice"><b>Password : <?php echo $adminPassword; ?></b></td></tr> 358 <tr><td> </td></tr> 359 <tr><td align="right"> </td></tr> 360 <?php if (!$canWrite) { ?> 361 <tr> 362 <td class="small"> 363 Your configuration file or directory is not writeable, 364 or there was a problem creating the configuration file. You'll have to 365 upload the following code by hand. Click in the textarea to highlight 366 all of the code. 367 </td> 368 </tr> 369 <tr> 370 <td align="center"> 371 <textarea rows="5" cols="60" name="configcode" onclick="javascript:this.form.configcode.focus();this.form.configcode.select();" ><?php echo htmlspecialchars( $config );?></textarea> 372 </td> 373 </tr> 374 <?php } ?> 375 <tr><td class="small"><?php /*echo $chmod_report*/; ?></td></tr> 376 </table> 377 </div> 378 </div> 379 <div id="break"></div> 380 </div> 381 <div class="clr"></div> 382 </div> 383 </form> 384 </div> 385 <div class="clr"></div> 386 <div class="ctr"> 387 <a href="http://www.joomla.org" target="_blank">Joomla!</a> is Free Software released under the GNU/GPL License. 388 </div> 389 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |