mirror of
https://github.com/Mowie/Mowie
synced 2024-06-13 06:09:39 +00:00
Improvements to the installer
This commit is contained in:
parent
dd1200d885
commit
0f1f894f70
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if(file_exists('../inc/config.yml'))
|
||||
if (file_exists('../inc/config.yml'))
|
||||
{
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
|
@ -18,15 +18,15 @@ $lang->setLangFolder('lang/');
|
|||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Installation</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" href="assets/admin.css" type="text/css">
|
||||
<script src="assets/js/jquery.min.js"></script>
|
||||
<script>
|
||||
function fadeInput(input) {
|
||||
$('#' + input).fadeToggle(200);
|
||||
}
|
||||
</script>
|
||||
<title>Installation</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" href="assets/admin.css" type="text/css">
|
||||
<script src="assets/js/jquery.min.js"></script>
|
||||
<script>
|
||||
function fadeInput(input) {
|
||||
$('#' + input).fadeToggle(200);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="background: url('assets/bglogin.jpg') no-repeat center fixed;">
|
||||
<img src="http://server/SelfCMS/Version2/admin/assets/Logo.svg" alt="Mowie" class="install-logo"/>
|
||||
|
@ -39,13 +39,10 @@ if (isset($_POST['submit']))
|
|||
$_POST['db_host'] !== '' &&
|
||||
$_POST['db_name'] !== '' &&
|
||||
$_POST['db_user'] !== '' &&
|
||||
$_POST['db_pw1'] !== '' &&
|
||||
$_POST['db_pw2'] !== '' &&
|
||||
$_POST['db_pw'] !== '' &&
|
||||
$_POST['general_webUrl'] !== '' &&
|
||||
$_POST['general_home_url'] !== '' &&
|
||||
$_POST['general_pma'] !== '' &&
|
||||
$_POST['general_page_title'] !== '' &&
|
||||
$_POST['general_editor_css'] !== '' &&
|
||||
$_POST['general_template'] !== '' &&
|
||||
$_POST['admin_name'] !== '' &&
|
||||
$_POST['admin_mail'] !== '' &&
|
||||
|
@ -63,7 +60,7 @@ if (isset($_POST['submit']))
|
|||
$CONFIG['Database']['db_host'] = $_POST['db_host'];
|
||||
$CONFIG['Database']['db_name'] = $_POST['db_name'];
|
||||
$CONFIG['Database']['db_usr'] = $_POST['db_user'];
|
||||
$CONFIG['Database']['db_pw'] = $_POST['db_pw1'];
|
||||
$CONFIG['Database']['db_pw'] = $_POST['db_pw'];
|
||||
$CONFIG['Database']['db_prefix'] = $_POST['db_prefix'];
|
||||
$CONFIG['Templating']['template'] = $_POST['general_template'];
|
||||
$CONFIG['Templating']['tpl_title'] = 'title';
|
||||
|
@ -93,11 +90,6 @@ if (isset($_POST['submit']))
|
|||
}
|
||||
|
||||
//Test Passwords
|
||||
if ($_POST['db_pw1'] !== $_POST['db_pw2'])
|
||||
{
|
||||
echo msg('fail', 'Mysqlpasswords don\'t match.');
|
||||
exit;
|
||||
}
|
||||
if ($_POST['admin_pw1'] !== $_POST['admin_pw2'])
|
||||
{
|
||||
echo msg('fail', 'Adminpasswords don\'t match');
|
||||
|
@ -190,21 +182,36 @@ ALTER TABLE `' . $_POST['db_prefix'] . 'system_roles`
|
|||
echo msg('fail', 'Error setting page title.');
|
||||
exit;
|
||||
}
|
||||
|
||||
//htacces
|
||||
$htacces = 'RewriteEngine On
|
||||
if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache') !== false)
|
||||
{
|
||||
$htacces = 'RewriteEngine On
|
||||
|
||||
RewriteRule ^(admin|inc|apps|content)($|/) - [L]
|
||||
RewriteRule !favicon\.ico - [C]
|
||||
RewriteRule !index\.php - [C]
|
||||
RewriteRule ^(.*)$ /index.php?$1 [QSA,L]';
|
||||
if (file_put_contents('../.htaccess', $htacces))
|
||||
{
|
||||
echo msg('succes', '.htaccess was successfully set.<br/>');
|
||||
RewriteRule ^(.*)$ /index.php?$1 [QSA,L]
|
||||
|
||||
# Disables download of configuration
|
||||
<Files ~ "\.(tpl|yml|ini)$">
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
</Files>';
|
||||
if (file_put_contents('../.htaccess', $htacces))
|
||||
{
|
||||
echo msg('succes', '.htaccess was successfully set.<br/>');
|
||||
} else
|
||||
{
|
||||
echo msg('fail', 'Error setting up .htaccess.<br/>');
|
||||
exit;
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo msg('fail', 'Error setting up .htaccess.<br/>');
|
||||
exit;
|
||||
echo msg('info', 'We detected you are not using Apache. Please make sure to redirect all requests to index.php (Like Apache\'s mod_rewrite).');
|
||||
}
|
||||
|
||||
//Apps
|
||||
$apps = new apps(2);
|
||||
$appUri = '../apps/';
|
||||
|
@ -235,11 +242,11 @@ RewriteRule ^(.*)$ /index.php?$1 [QSA,L]';
|
|||
{
|
||||
?>
|
||||
|
||||
<div class="install-container">
|
||||
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" class="form">
|
||||
<h2>Language</h2>
|
||||
<span>Select your language:</span>
|
||||
<select name="lang">
|
||||
<div class="install-container">
|
||||
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" class="form">
|
||||
<h2>Language</h2>
|
||||
<span>Select your language:</span>
|
||||
<select name="lang">
|
||||
<?php
|
||||
$langs = $lang->getAll();
|
||||
foreach ($langs as $lang_code => $lang_detail)
|
||||
|
@ -247,50 +254,52 @@ RewriteRule ^(.*)$ /index.php?$1 [QSA,L]';
|
|||
echo '<option value="' . $lang_code . '">' . $lang_detail['Lang'] . '</option>';
|
||||
}
|
||||
?>
|
||||
</select><br/><br/>
|
||||
</select><br/><br/>
|
||||
|
||||
<h2>Mysql</h2>
|
||||
<span>Host</span><input type="text" placeholder="Host" name="db_host" value="localhost"/><br/>
|
||||
<span>Database</span><input type="text" placeholder="Database" name="db_name"/><br/>
|
||||
<span>Username</span><input type="text" placeholder="Username" name="db_user" value="root"/><br/>
|
||||
<span>Password</span><input type="password" placeholder="Password" name="db_pw1"/><br/>
|
||||
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="db_pw2"/><br/>
|
||||
<span>Table prefix</span><input type="text" placeholder="Table prefix" name="db_prefix"/><br/><br/>
|
||||
<h2>Mysql</h2>
|
||||
<span>Host</span><input type="text" placeholder="Host" name="db_host" value="localhost"/><br/>
|
||||
<span>Database</span><input type="text" placeholder="Database" name="db_name"/><br/>
|
||||
<span>Username</span><input type="text" placeholder="Username" name="db_user" value="root"/><br/>
|
||||
<span>Password</span><input type="password" placeholder="Password" name="db_pw"/><br/>
|
||||
<span>Table prefix (optional)</span><input type="text" placeholder="Table prefix" name="db_prefix"/><br/><br/>
|
||||
|
||||
<h2>Website</h2>
|
||||
<span>Website Url</span><input type="text" placeholder="Website Url" name="general_webUrl"
|
||||
value="http://<?php echo $_SERVER['SERVER_NAME'] . str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']); ?>"/><br/>
|
||||
<span>Home Url</span><input type="text" placeholder="Home Url" name="general_home_url"
|
||||
value="<?php echo str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']); ?>"/><br/>
|
||||
<span>Phpmyadmin Url</span><input type="text" placeholder="Phpmyadmin Url" name="general_pma"/><br/>
|
||||
<span>Page Title</span><input type="text" placeholder="Page Title" name="general_page_title"/><br/>
|
||||
<span>Editor CSS</span><input type="text" placeholder="Editor CSS" name="general_editor_css"/><br/>
|
||||
<span>Template</span><input type="text" placeholder="Template" name="general_template"
|
||||
value="content/template.tpl"/><br/>
|
||||
<h2>Website</h2>
|
||||
<span>Page Title</span><input type="text" placeholder="Page Title" name="general_page_title"/><br/>
|
||||
<span>Website Url</span><input type="text" placeholder="Website Url" name="general_webUrl"
|
||||
value="http://<?php echo $_SERVER['SERVER_NAME'] . str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']); ?>"/><br/>
|
||||
<span> </span><a onclick="fadeInput('more');" style="display: block;">More Options</a><br/>
|
||||
<div id="more" style="display: none;">
|
||||
<span>Home Url</span><input type="text" placeholder="Home Url" name="general_home_url"
|
||||
value="<?php echo str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']); ?>"/><br/>
|
||||
<span>Phpmyadmin Url (optional)</span><input type="text" placeholder="Phpmyadmin Url" name="general_pma"/><br/>
|
||||
<span>Editor CSS (optional)</span><input type="text" placeholder="Editor CSS" name="general_editor_css"/><br/>
|
||||
<span>Template</span><input type="text" placeholder="Template" name="general_template"
|
||||
value="content/template.tpl"/><br/>
|
||||
</div>
|
||||
<h2>Mail</h2>
|
||||
<span> </span><input type="checkbox" name="mail_smtp" id="mail_smtp"
|
||||
onchange="fadeInput('mailInput');"/><label for="mail_smtp"><i></i>
|
||||
Use SMTP</label>
|
||||
|
||||
<h2>Mail</h2>
|
||||
<span> </span><input type="checkbox" name="mail_smtp" id="mail_smtp" onchange="fadeInput('mailInput');"/><label for="mail_smtp"><i></i>
|
||||
Use SMTP</label>
|
||||
<br/>
|
||||
<div id="mailInput" style="display: none">
|
||||
<span>SMTP-Host</span><input type="text" placeholder="SMTP-Host" name="mail_host"/><br/>
|
||||
<span>SMTP-Username</span><input type="text" placeholder="SMTP-Username" name="mail_user"/><br/>
|
||||
<span>SMTP-Password</span><input type="text" placeholder="SMTP-Password" name="mail_pass"/><br/>
|
||||
<span>Security</span>
|
||||
<input type="radio" name="mail_secure" id="mail_ssl"/><label for="mail_ssl"><i></i> Use SSL</label>
|
||||
<input type="radio" name="mail_secure" id="mail_tls"/><label for="mail_tls"><i></i> Use TLS</label>
|
||||
<br/>
|
||||
<span>Port</span><input type="number" placeholder="Port" name="mail_port"/>
|
||||
|
||||
<br/>
|
||||
<div id="mailInput" style="display: none">
|
||||
<span>SMTP-Host</span><input type="text" placeholder="SMTP-Host" name="mail_host"/><br/>
|
||||
<span>SMTP-Username</span><input type="text" placeholder="SMTP-Username" name="mail_user"/><br/>
|
||||
<span>SMTP-Password</span><input type="text" placeholder="SMTP-Password" name="mail_pass"/><br/>
|
||||
<span>Security</span>
|
||||
<input type="radio" name="mail_secure" id="mail_ssl"/><label for="mail_ssl"><i></i> Use SSL</label>
|
||||
<input type="radio" name="mail_secure" id="mail_tls"/><label for="mail_tls"><i></i> Use TLS</label>
|
||||
<br/>
|
||||
<span>Port</span><input type="number" placeholder="Port" name="mail_port"/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<h2>First Adminuser</h2>
|
||||
<span>Name</span><input type="text" placeholder="Name" name="admin_name"/><br/>
|
||||
<span>Email-Adress</span><input type="email" placeholder="Email-Adress" name="admin_mail"/><br/>
|
||||
<span>Password</span><input type="password" placeholder="Password" name="admin_pw1"/><br/>
|
||||
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="admin_pw2"/><br/>
|
||||
<h2>First Adminuser</h2>
|
||||
<span>Name</span><input type="text" placeholder="Name" name="admin_name"/><br/>
|
||||
<span>Email-Adress</span><input type="email" placeholder="Email-Adress" name="admin_mail"/><br/>
|
||||
<span>Password</span><input type="password" placeholder="Password" name="admin_pw1"/><br/>
|
||||
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="admin_pw2"/><br/>
|
||||
<?php
|
||||
//Apps
|
||||
$apps = new apps(2);
|
||||
|
@ -304,10 +313,10 @@ RewriteRule ^(.*)$ /index.php?$1 [QSA,L]';
|
|||
}
|
||||
}
|
||||
?>
|
||||
<p style="text-align: center"><input type="submit" value="Install" name="submit"/></p>
|
||||
</form>
|
||||
<p style="text-align: center"><input type="submit" value="Install" name="submit"/></p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user