C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mamFM\_installation\install4.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<?php
/**
* @version $Id: install4.php 2622 2006-02-26 04:16:09Z stingrey $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Set flag that this is a parent file
define"_VALID_MOS");

// Include common.php
require_once( 'common.php' );
require_once( 
'../includes/database.php' );

$DBhostname mosGetParam$_POST'DBhostname''' );
$DBuserName mosGetParam$_POST'DBuserName''' );
$DBpassword mosGetParam$_POST'DBpassword''' );
$DBname      mosGetParam$_POST'DBname''' );
$DBPrefix      mosGetParam$_POST'DBPrefix''' );
$sitename      mosGetParam$_POST'sitename''' );
$adminEmail mosGetParam$_POST'adminEmail''');
$siteUrl      mosGetParam$_POST'siteUrl''' );
$absolutePath mosGetParam$_POST'absolutePath''' );
$adminPassword mosGetParam$_POST'adminPassword''');

$filePerms '';
if (
mosGetParam($_POST,'filePermsMode',0))
    
$filePerms '0'.
        (
mosGetParam($_POST,'filePermsUserRead',0) * +
         
mosGetParam($_POST,'filePermsUserWrite',0) * +
         
mosGetParam($_POST,'filePermsUserExecute',0)).
        (
mosGetParam($_POST,'filePermsGroupRead',0) * +
         
mosGetParam($_POST,'filePermsGroupWrite',0) * +
         
mosGetParam($_POST,'filePermsGroupExecute',0)).
        (
mosGetParam($_POST,'filePermsWorldRead',0) * +
         
mosGetParam($_POST,'filePermsWorldWrite',0) * +
         
mosGetParam($_POST,'filePermsWorldExecute',0));

$dirPerms '';
if (
mosGetParam($_POST,'dirPermsMode',0))
    
$dirPerms '0'.
        (
mosGetParam($_POST,'dirPermsUserRead',0) * +
         
mosGetParam($_POST,'dirPermsUserWrite',0) * +
         
mosGetParam($_POST,'dirPermsUserSearch',0)).
        (
mosGetParam($_POST,'dirPermsGroupRead',0) * +
         
mosGetParam($_POST,'dirPermsGroupWrite',0) * +
         
mosGetParam($_POST,'dirPermsGroupSearch',0)).
        (
mosGetParam($_POST,'dirPermsWorldRead',0) * +
         
mosGetParam($_POST,'dirPermsWorldWrite',0) * +
         
mosGetParam($_POST,'dirPermsWorldSearch',0));

if ((
trim($adminEmail== "")) || (preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/"$adminEmail )==false)) {
    echo 
"<form name=\"stepBack\" method=\"post\" action=\"install3.php\">
        <input type=\"hidden\" name=\"DBhostname\" value=\"
$DBhostname\" />
        <input type=\"hidden\" name=\"DBuserName\" value=\"
$DBuserName\" />
        <input type=\"hidden\" name=\"DBpassword\" value=\"
$DBpassword\" />
        <input type=\"hidden\" name=\"DBname\" value=\"
$DBname\" />
        <input type=\"hidden\" name=\"DBPrefix\" value=\"
$DBPrefix\" />
        <input type=\"hidden\" name=\"DBcreated\" value=\"1\" />
        <input type=\"hidden\" name=\"sitename\" value=\"
$sitename\" />
        <input type=\"hidden\" name=\"adminEmail\" value=\"
$adminEmail\" />
        <input type=\"hidden\" name=\"siteUrl\" value=\"
$siteUrl\" />
        <input type=\"hidden\" name=\"absolutePath\" value=\"
$absolutePath\" />
        <input type=\"hidden\" name=\"filePerms\" value=\"
$filePerms\" />
        <input type=\"hidden\" name=\"dirPerms\" value=\"
$dirPerms\" />
        </form>"
;
    echo 
"<script>alert('You must provide a valid admin email address.'); document.stepBack.submit(); </script>";
    return;
}

if(
$DBhostname && $DBuserName && $DBname) {
    
$configArray['DBhostname']    = $DBhostname;
    
$configArray['DBuserName']    = $DBuserName;
    
$configArray['DBpassword']    = $DBpassword;
    
$configArray['DBname']         = $DBname;
    
$configArray['DBPrefix']    = $DBPrefix;
} else {
    echo 
"<form name=\"stepBack\" method=\"post\" action=\"install3.php\">
        <input type=\"hidden\" name=\"DBhostname\" value=\"
$DBhostname\" />
        <input type=\"hidden\" name=\"DBuserName\" value=\"
$DBuserName\" />
        <input type=\"hidden\" name=\"DBpassword\" value=\"
$DBpassword\" />
        <input type=\"hidden\" name=\"DBname\" value=\"
$DBname\" />
        <input type=\"hidden\" name=\"DBPrefix\" value=\"
$DBPrefix\" />
        <input type=\"hidden\" name=\"DBcreated\" value=\"1\" />
        <input type=\"hidden\" name=\"sitename\" value=\"
$sitename\" />
        <input type=\"hidden\" name=\"adminEmail\" value=\"
$adminEmail\" />
        <input type=\"hidden\" name=\"siteUrl\" value=\"
$siteUrl\" />
        <input type=\"hidden\" name=\"absolutePath\" value=\"
$absolutePath\" />
        <input type=\"hidden\" name=\"filePerms\" value=\"
$filePerms\" />
        <input type=\"hidden\" name=\"dirPerms\" value=\"
$dirPerms\" />
        </form>"
;

    echo 
"<script>alert('The database details provided are incorrect and/or empty'); document.stepBack.submit(); </script>";
    return;
}

if (
$sitename) {
    if (!
get_magic_quotes_gpc()) {
        
$configArray['sitename'] = addslashes($sitename);
    } else {
        
$configArray['sitename'] = $sitename;
    }
} else {
    echo 
"<form name=\"stepBack\" method=\"post\" action=\"install3.php\">
        <input type=\"hidden\" name=\"DBhostname\" value=\"
$DBhostname\" />
        <input type=\"hidden\" name=\"DBuserName\" value=\"
$DBuserName\" />
        <input type=\"hidden\" name=\"DBpassword\" value=\"
$DBpassword\" />
        <input type=\"hidden\" name=\"DBname\" value=\"
$DBname\" />
        <input type=\"hidden\" name=\"DBPrefix\" value=\"
$DBPrefix\" />
        <input type=\"hidden\" name=\"DBcreated\" value=\"1\" />
        <input type=\"hidden\" name=\"sitename\" value=\"
$sitename\" />
        <input type=\"hidden\" name=\"adminEmail\" value=\"
$adminEmail\" />
        <input type=\"hidden\" name=\"siteUrl\" value=\"
$siteUrl\" />
        <input type=\"hidden\" name=\"absolutePath\" value=\"
$absolutePath\" />
        <input type=\"hidden\" name=\"filePerms\" value=\"
$filePerms\" />
        <input type=\"hidden\" name=\"dirPerms\" value=\"
$dirPerms\" />
        </form>"
;

    echo 
"<script>alert('The sitename has not been provided'); document.stepBack2.submit();</script>";
    return;
}

if (
file_exists'../configuration.php' )) {
    
$canWrite is_writable'../configuration.php' );
} else {
    
$canWrite is_writable'..' );
}

if (
$siteUrl) {
    
$configArray['siteUrl']=$siteUrl;
    
// Fix for Windows
    
$absolutePathstr_replace("\\\\","/"$absolutePath);
    
$configArray['absolutePath']=$absolutePath;
    
$configArray['filePerms']=$filePerms;
    
$configArray['dirPerms']=$dirPerms;

    
$config "<?php\n";
    
$config .= "\$mosConfig_offline = '0';\n";
    
$config .= "\$mosConfig_host = '{$configArray['DBhostname']}';\n";
    
$config .= "\$mosConfig_user = '{$configArray['DBuserName']}';\n";
    
$config .= "\$mosConfig_password = '{$configArray['DBpassword']}';\n";
    
$config .= "\$mosConfig_db = '{$configArray['DBname']}';\n";
    
$config .= "\$mosConfig_dbprefix = '{$configArray['DBPrefix']}';\n";
    
$config .= "\$mosConfig_lang = 'english';\n";
    
$config .= "\$mosConfig_absolute_path = '{$configArray['absolutePath']}';\n";
    
$config .= "\$mosConfig_live_site = '{$configArray['siteUrl']}';\n";
    
$config .= "\$mosConfig_sitename = '{$configArray['sitename']}';\n";
    
$config .= "\$mosConfig_shownoauth = '0';\n";
    
$config .= "\$mosConfig_useractivation = '1';\n";
    
$config .= "\$mosConfig_uniquemail = '1';\n";
    
$config .= "\$mosConfig_offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';\n";
    
$config .= "\$mosConfig_error_message = 'This site is temporarily unavailable.<br /> Please notify the System Administrator';\n";
    
$config .= "\$mosConfig_debug = '0';\n";
    
$config .= "\$mosConfig_lifetime = '900';\n";
    
$config .= "\$mosConfig_session_life_admin = '1800';\n";
    
$config .= "\$mosConfig_session_type = '0';\n";
    
$config .= "\$mosConfig_MetaDesc = 'Joomla - the dynamic portal engine and content management system';\n";
    
$config .= "\$mosConfig_MetaKeys = 'Joomla, joomla';\n";
    
$config .= "\$mosConfig_MetaTitle = '1';\n";
    
$config .= "\$mosConfig_MetaAuthor = '1';\n";
    
$config .= "\$mosConfig_locale = 'en_GB';\n";
    
$config .= "\$mosConfig_offset = '0';\n";
    
$config .= "\$mosConfig_offset_user = '0';\n";
    
$config .= "\$mosConfig_hideAuthor = '0';\n";
    
$config .= "\$mosConfig_hideCreateDate = '0';\n";
    
$config .= "\$mosConfig_hideModifyDate = '0';\n";
    
$config .= "\$mosConfig_hidePdf = '".intval( !is_writable"{$configArray['absolutePath']}/media/" ) )."';\n";
    
$config .= "\$mosConfig_hidePrint = '0';\n";
    
$config .= "\$mosConfig_hideEmail = '0';\n";
    
$config .= "\$mosConfig_enable_log_items = '0';\n";
    
$config .= "\$mosConfig_enable_log_searches = '0';\n";
    
$config .= "\$mosConfig_enable_stats = '0';\n";
    
$config .= "\$mosConfig_sef = '0';\n";
    
$config .= "\$mosConfig_vote = '0';\n";
    
$config .= "\$mosConfig_gzip = '0';\n";
    
$config .= "\$mosConfig_multipage_toc = '1';\n";
    
$config .= "\$mosConfig_allowUserRegistration = '1';\n";
    
$config .= "\$mosConfig_link_titles = '0';\n";
    
$config .= "\$mosConfig_error_reporting = -1;\n";
    
$config .= "\$mosConfig_list_limit = '30';\n";
    
$config .= "\$mosConfig_caching = '0';\n";
    
$config .= "\$mosConfig_cachepath = '{$configArray['absolutePath']}/cache';\n";
    
$config .= "\$mosConfig_cachetime = '900';\n";
    
$config .= "\$mosConfig_mailer = 'mail';\n";
    
$config .= "\$mosConfig_mailfrom = '$adminEmail';\n";
    
$config .= "\$mosConfig_fromname = '{$configArray['sitename']}';\n";
    
$config .= "\$mosConfig_sendmail = '/usr/sbin/sendmail';\n";
    
$config .= "\$mosConfig_smtpauth = '0';\n";
    
$config .= "\$mosConfig_smtpuser = '';\n";
    
$config .= "\$mosConfig_smtppass = '';\n";
    
$config .= "\$mosConfig_smtphost = 'localhost';\n";
    
$config .= "\$mosConfig_back_button = '1';\n";
    
$config .= "\$mosConfig_item_navigation = '1';\n";
    
$config .= "\$mosConfig_secret = '" mosMakePassword(16) . "';\n";
    
$config .= "\$mosConfig_pagetitles = '1';\n";
    
$config .= "\$mosConfig_readmore = '1';\n";
    
$config .= "\$mosConfig_hits = '1';\n";
    
$config .= "\$mosConfig_icons = '1';\n";
    
$config .= "\$mosConfig_favicon = 'favicon.ico';\n";
    
$config .= "\$mosConfig_fileperms = '".$configArray['filePerms']."';\n";
    
$config .= "\$mosConfig_dirperms = '".$configArray['dirPerms']."';\n";
    
$config .= "\$mosConfig_helpurl = 'http://help.joomla.org';\n";
    
$config .= "\$mosConfig_mbf_content = '0';\n";
    
$config .= "\$mosConfig_editor = 'tinymce';\n";
    
$config .= "setlocale (LC_TIME, \$mosConfig_locale);\n";
    
$config .= "?>";

    if (
$canWrite && ($fp fopen("../configuration.php""w"))) {
        
fputs$fp$configstrlen$config ) );
        
fclose$fp );
    } else {
        
$canWrite false;
    } 
// if

    
$cryptpass=md5$adminPassword );

    
$database = new database$DBhostname$DBuserName$DBpassword$DBname$DBPrefix );
    
$nullDate $database->getNullDate();

    
// create the admin user
    
$installdate date('Y-m-d H:i:s');
    
$query "INSERT INTO `#__users` VALUES (62, 'Administrator', 'admin', '$adminEmail', '$cryptpass', 'Super Administrator', 0, 1, 25, '$installdate', '$nullDate', '', '')";
    
$database->setQuery$query );
    
$database->query();
    
// add the ARO (Access Request Object)
    
$query "INSERT INTO `#__core_acl_aro` VALUES (10,'users','62',0,'Administrator',0)";
    
$database->setQuery$query );
    
$database->query();
    
// add the map between the ARO and the Group
    
$query "INSERT INTO `#__core_acl_groups_aro_map` VALUES (25,'',10)";
    
$database->setQuery$query );
    
$database->query();

    
// chmod files and directories if desired
    
$chmod_report "Directory and file permissions left unchanged.";
    if (
$filePerms != '' || $dirPerms != '') {
        
$mosrootfiles = array(
            
'administrator',
            
'cache',
            
'components',
            
'images',
            
'language',
            
'mambots',
            
'media',
            
'modules',
            
'templates',
            
'configuration.php'
        
);
        
$filemode NULL;
        if (
$filePerms != ''$filemode octdec($filePerms);
        
$dirmode NULL;
        if (
$dirPerms != ''$dirmode octdec($dirPerms);
        
$chmodOk TRUE;
        foreach (
$mosrootfiles as $file) {
            if (!
mosChmodRecursive($absolutePath.'/'.$file$filemode$dirmode)) {
                
$chmodOk FALSE;
            }
        }
        if (
$chmodOk) {
            
$chmod_report 'File and directory permissions successfully changed.';
        } else {
            
$chmod_report 'File and directory permissions could not be changed.<br />'.
                            
'Please CHMOD Joomla files and directories manually.';
        }
    } 
// if chmod wanted
} else {
?>
    <form action="install3.php" method="post" name="stepBack3" id="stepBack3">
      <input type="hidden" name="DBhostname" value="<?php echo $DBhostname;?>" />
      <input type="hidden" name="DBusername" value="<?php echo $DBuserName;?>" />
      <input type="hidden" name="DBpassword" value="<?php echo $DBpassword;?>" />
      <input type="hidden" name="DBname" value="<?php echo $DBname;?>" />
      <input type="hidden" name="DBPrefix" value="<?php echo $DBPrefix;?>" />
      <input type="hidden" name="DBcreated" value="1" />
      <input type="hidden" name="sitename" value="<?php echo $sitename;?>" />
      <input type="hidden" name="adminEmail" value="$adminEmail" />
      <input type="hidden" name="siteUrl" value="$siteUrl" />
      <input type="hidden" name="absolutePath" value="$absolutePath" />
      <input type="hidden" name="filePerms" value="$filePerms" />
      <input type="hidden" name="dirPerms" value="$dirPerms" />
    </form>
    <script>alert('The site url has not been provided'); document.stepBack3.submit();</script>
<?php
}
echo 
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Joomla - Web Installer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="../images/favicon.ico" />
<link rel="stylesheet" href="install.css" type="text/css" />
</head>
<body>
<div id="wrapper">
    <div id="header">
        <div id="joomla"><img src="header_install.png" alt="Joomla Installation" /></div>
    </div>
</div>
<div id="ctr" align="center">
    <form action="dummy" name="form" id="form">
    <div class="install">
        <div id="stepbar">
            <div class="step-off">pre-installation check</div>
            <div class="step-off">license</div>
            <div class="step-off">step 1</div>
            <div class="step-off">step 2</div>
            <div class="step-off">step 3</div>
            <div class="step-on">step 4</div>
        </div>
        <div id="right">
            <div id="step">step 4</div>
            <div class="far-right">
                <input class="button" type="button" name="runSite" value="View Site"
<?php
                
if ($siteUrl) {
                    echo 
"onClick=\"window.location.href='$siteUrl/index.php' \"";
                } else {
                    echo 
"onClick=\"window.location.href='".$configArray['siteURL']."/index.php' \"";
                }
?>/>
                <input class="button" type="button" name="Admin" value="Administration"
<?php
                
if ($siteUrl) {
                    echo 
"onClick=\"window.location.href='$siteUrl/administrator/index.php' \"";
                } else {
                    echo 
"onClick=\"window.location.href='".$configArray['siteURL']."/administrator/index.php' \"";
                }
?>/>
            </div>
            <div class="clr"></div>
            <h1>Congratulations! Joomla is installed</h1>
            <div class="install-text">
                <p>Click the "View Site" button to start Joomla site or "Administration"
                    to take you to administrator login.</p>
            </div>
            <div class="install-form">
                <div class="form-block">
                    <table width="100%">
                        <tr><td class="error" align="center">PLEASE REMEMBER TO COMPLETELY<br/>REMOVE THE INSTALLATION DIRECTORY</td></tr>
                        <tr><td align="center"><h5>Administration Login Details</h5></td></tr>
                        <tr><td align="center" class="notice"><b>Username : admin</b></td></tr>
                        <tr><td align="center" class="notice"><b>Password : <?php echo $adminPassword?></b></td></tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr><td align="right">&nbsp;</td></tr>
<?php                        if (!$canWrite) { ?>
                        <tr>
                            <td class="small">
                                Your configuration file or directory is not writeable,
                                or there was a problem creating the configuration file. You'll have to
                                upload the following code by hand. Click in the textarea to highlight
                                all of the code.
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <textarea rows="5" cols="60" name="configcode" onclick="javascript:this.form.configcode.focus();this.form.configcode.select();" ><?php echo htmlspecialchars$config );?></textarea>
                            </td>
                        </tr>
<?php                        ?>
                        <tr><td class="small"><?php /*echo $chmod_report*/?></td></tr>
                    </table>
                </div>
            </div>
            <div id="break"></div>
        </div>
        <div class="clr"></div>
    </div>
    </form>
</div>
<div class="clr"></div>
<div class="ctr">
    <a href="http://www.joomla.org" target="_blank">Joomla!</a> is Free Software released under the GNU/GPL License.
</div>
</html>