1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-05 04:37:51 +02:00

Monstra General Updates

This commit is contained in:
Awilum
2015-10-16 18:28:14 +03:00
parent 1854cfe80e
commit 13e1dd1e63
21 changed files with 143 additions and 63 deletions

View File

@@ -31,7 +31,7 @@ class Monstra
/**
* The version of Monstra
*/
const VERSION = '3.0.1';
const VERSION = '3.0.2';
/**

View File

@@ -5,10 +5,18 @@
*/
// Main engine defines
if ( ! defined('DS')) define('DS', DIRECTORY_SEPARATOR);
if ( ! defined('ROOT')) define('ROOT', rtrim(dirname(__FILE__), '\\/'));
if ( ! defined('BACKEND')) define('BACKEND', false);
if ( ! defined('MONSTRA_ACCESS')) define('MONSTRA_ACCESS', true);
if (! defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
if (! defined('ROOT')) {
define('ROOT', rtrim(dirname(__FILE__), '\\/'));
}
if (! defined('BACKEND')) {
define('BACKEND', false);
}
if (! defined('MONSTRA_ACCESS')) {
define('MONSTRA_ACCESS', true);
}
// Load bootstrap file
require_once(ROOT . DS . 'engine' . DS . '_init.php');
@@ -16,9 +24,13 @@
// Get array with the names of all modules compiled and loaded
$php_modules = get_loaded_extensions();
// Get server port
if ($_SERVER["SERVER_PORT"] == "80") $port = ""; else $port = ':'.$_SERVER["SERVER_PORT"];
// Get server port
if ($_SERVER["SERVER_PORT"] == "80") {
$port = "";
} else {
$port = ':'.$_SERVER["SERVER_PORT"];
}
// Get site URL
$site_url = 'http://'.$_SERVER["SERVER_NAME"].$port.str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);
@@ -35,7 +47,7 @@
$dir_array = array('public', 'storage', 'backups', 'tmp');
// Languages array
$languages_array = array('en', 'ru', 'fr', 'de', 'it', 'es', 'lt', 'pl', 'pt-br', 'hu', 'fa' , 'sk', 'uk', 'nl', 'sr-yu', 'id', 'ja', 'zh-cn', 'tr');
$languages_array = array('en', 'ru', 'fr', 'de', 'it', 'es', 'lt', 'pl', 'pt-br', 'hu', 'fa' , 'sk', 'uk', 'nl', 'sr', 'id', 'ja', 'zh-cn', 'tr');
// Select Monstra language
if (Request::get('language')) {
@@ -55,23 +67,54 @@
// If pressed <Install> button then try to install
if (Request::post('install_submit')) {
if (Request::post('sitename') == '') $errors['sitename'] = __('Field "Site name" is empty', 'system');
if (Request::post('siteurl') == '') $errors['siteurl'] = __('Field "Site url" is empty', 'system');
if (Request::post('login') == '') $errors['login'] = __('Field "Username" is empty', 'system');
if (Request::post('password') == '') $errors['password'] = __('Field "Password" is empty', 'system');
if (Request::post('email') == '') $errors['email'] = __('Field "Email" is empty', 'system');
if ( ! Valid::email(Request::post('email'))) $errors['email_valid'] = __('Email not valid', 'system');
if (trim(Request::post('php') !== '')) $errors['php'] = true;
if (trim(Request::post('simplexml') !== '')) $errors['simplexml'] = true;
if (trim(Request::post('mod_rewrite') !== '')) $errors['mod_rewrite'] = true;
if (trim(Request::post('htaccess') !== '')) $errors['htaccess'] = true;
if (trim(Request::post('sitemap') !== '')) $errors['sitemap'] = true;
if (trim(Request::post('install') !== '')) $errors['install'] = true;
if (trim(Request::post('public') !== '')) $errors['public'] = true;
if (trim(Request::post('storage') !== '')) $errors['storage'] = true;
if (trim(Request::post('backups') !== '')) $errors['backups'] = true;
if (trim(Request::post('tmp') !== '')) $errors['tmp'] = true;
if (Request::post('sitename') == '') {
$errors['sitename'] = __('Field "Site name" is empty', 'system');
}
if (Request::post('siteurl') == '') {
$errors['siteurl'] = __('Field "Site url" is empty', 'system');
}
if (Request::post('login') == '') {
$errors['login'] = __('Field "Username" is empty', 'system');
}
if (Request::post('password') == '') {
$errors['password'] = __('Field "Password" is empty', 'system');
}
if (Request::post('email') == '') {
$errors['email'] = __('Field "Email" is empty', 'system');
}
if (! Valid::email(Request::post('email'))) {
$errors['email_valid'] = __('Email not valid', 'system');
}
if (trim(Request::post('php') !== '')) {
$errors['php'] = true;
}
if (trim(Request::post('simplexml') !== '')) {
$errors['simplexml'] = true;
}
if (trim(Request::post('mod_rewrite') !== '')) {
$errors['mod_rewrite'] = true;
}
if (trim(Request::post('htaccess') !== '')) {
$errors['htaccess'] = true;
}
if (trim(Request::post('sitemap') !== '')) {
$errors['sitemap'] = true;
}
if (trim(Request::post('install') !== '')) {
$errors['install'] = true;
}
if (trim(Request::post('public') !== '')) {
$errors['public'] = true;
}
if (trim(Request::post('storage') !== '')) {
$errors['storage'] = true;
}
if (trim(Request::post('backups') !== '')) {
$errors['backups'] = true;
}
if (trim(Request::post('tmp') !== '')) {
$errors['tmp'] = true;
}
// If errors is 0 then install cms
if (count($errors) == 0) {
@@ -104,14 +147,14 @@
$htaccess = file_get_contents('.htaccess');
$save_htaccess_content = str_replace("/%siteurlhere%/", $rewrite_base, $htaccess);
$handle = fopen ('.htaccess', "w");
$handle = fopen('.htaccess', "w");
fwrite($handle, $save_htaccess_content);
fclose($handle);
// Installation done :)
header("location: index.php?install=done");
} else {
Notification::setNow('errors', $errors);
} else {
Notification::setNow('errors', $errors);
}
}
?>
@@ -144,7 +187,7 @@
.monstra-dialog,
.install-block-footer {
margin: 0 auto;
width: 600px;
width: 600px;
}
.install-block-footer {
@@ -152,7 +195,7 @@
margin-bottom: 20px;
}
.well {
.well {
border: none;
border-radius: 0px;
background: #fff;
@@ -200,7 +243,7 @@
.language-link img {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
filter: alpha(opacity=30);
-khtml-opacity: 0.3;
-moz-opacity:0.3;
opacity: 0.3;
@@ -241,19 +284,19 @@
}
if (in_array('SimpleXML', $php_modules)) {
$errors['simplexml'] = '';
$errors['simplexml'] = '';
} else {
$errors['simplexml'] = 'error';
$errors['simplexml'] = 'error';
}
if (function_exists('apache_get_modules')) {
if ( ! in_array('mod_rewrite', apache_get_modules())) {
if (! in_array('mod_rewrite', apache_get_modules())) {
$errors['mod_rewrite'] = 'error';
} else {
$errors['mod_rewrite'] = '';
$errors['mod_rewrite'] = '';
}
} else {
$errors['mod_rewrite'] = '';
$errors['mod_rewrite'] = '';
}
if (is_writable(__FILE__)) {
@@ -294,24 +337,40 @@
$action = '';
}
?>
<?php foreach ($languages_array as $lang_code) { ?>
<a data-placement="top" data-toggle="tooltip" class="language-link<?php if (Option::get('language') == $lang_code) echo ' language-link-current';?>" title="<?php echo I18n::$locales[$lang_code]; ?>" href="<?php echo $site_url.'/?language=' . $lang_code.$action; ?>"><img src="<?php echo $site_url; ?>/public/assets/img/flags/<?php echo $lang_code?>.png" alt="<?php echo $lang_code?>"></a>
<?php } ?>
</div>
<div class="install-block <?php if(Request::get('action') && Request::get('action') == 'install') { ?><?php } else { ?> hide <?php } ?>">
<?php foreach ($languages_array as $lang_code) {
?>
<a data-placement="top" data-toggle="tooltip" class="language-link<?php if (Option::get('language') == $lang_code) {
echo ' language-link-current';
}
?>" title="<?php echo I18n::$locales[$lang_code];
?>" href="<?php echo $site_url.'/?language=' . $lang_code.$action;
?>"><img src="<?php echo $site_url;
?>/public/assets/img/flags/<?php echo $lang_code?>.png" alt="<?php echo $lang_code?>"></a>
<?php
} ?>
</div>
<div class="install-block <?php if (Request::get('action') && Request::get('action') == 'install') {
?><?php
} else {
?> hide <?php
} ?>">
<ul class="list-unstyled">
<?php
// Monstra Notifications
if (Notification::get('errors') && count(Notification::get('errors') > 0)) {
foreach (Notification::get('errors') as $error) {
?>
<li class="error alert alert-danger"><?php echo $error; ?></li>
?>
<li class="error alert alert-danger"><?php echo $error;
?></li>
<?php
}
}
}
?>
</ul>
@@ -330,7 +389,9 @@
<div class="form-group">
<label><?php echo __('Site Name', 'system'); ?></label>
<input class="form-control" name="sitename" type="text" value="<?php if (Request::post('sitename')) echo Html::toText(Request::post('sitename')); ?>" />
<input class="form-control" name="sitename" type="text" value="<?php if (Request::post('sitename')) {
echo Html::toText(Request::post('sitename'));
} ?>" />
</div>
<div class="form-group">
@@ -340,7 +401,9 @@
<div class="form-group">
<label><?php echo __('Username', 'users'); ?></label>
<input class="form-control login" name="login" value="<?php if(Request::post('login')) echo Html::toText(Request::post('login')); ?>" type="text" />
<input class="form-control login" name="login" value="<?php if (Request::post('login')) {
echo Html::toText(Request::post('login'));
} ?>" type="text" />
</div>
<div class="form-group">
@@ -442,17 +505,22 @@
<div class="form-group">
<label><?php echo __('Email', 'users'); ?></label>
<input name="email" class="form-control" value="<?php if (Request::post('email')) echo Html::toText(Request::post('email')); ?>" type="text" />
</div>
<input name="email" class="form-control" value="<?php if (Request::post('email')) {
echo Html::toText(Request::post('email'));
} ?>" type="text" />
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" name="install_submit" value="<?php echo __('Install', 'system'); ?>" />
</div>
</div>
</form>
</div>
</div>
<div class="monstra-dialog <?php if(Request::get('action') && Request::get('action') == 'install') { ?>hide<?php } ?>">
<div class="monstra-dialog <?php if (Request::get('action') && Request::get('action') == 'install') {
?>hide<?php
} ?>">
<ul class="list-unstyled">
<?php
@@ -475,7 +543,7 @@
}
if (function_exists('apache_get_modules')) {
if ( ! in_array('mod_rewrite',apache_get_modules())) {
if (! in_array('mod_rewrite', apache_get_modules())) {
echo '<li class="error alert alert-danger">'.__('Apache Mod Rewrite is required', 'system').'</li>';
} else {
echo '<li class="ok alert alert-success">'.__('Module Mod Rewrite is installed', 'system').'</li>';
@@ -510,26 +578,38 @@
echo '<li class="error alert alert-danger">'.__('Main .htaccess file not writable', 'system').'</li>';
}
if (isset($errors['sitename'])) echo '<li class="error">'.$errors['sitename'].'</li>';
if (isset($errors['siteurl'])) echo '<li class="error">'.$errors['siteurl'].'</li>';
if (isset($errors['login'])) echo '<li class="error">'.$errors['login'].'</li>';
if (isset($errors['password'])) echo '<li class="error">'.$errors['password'].'</li>';
if (isset($errors['email'])) echo '<li class="error">'.$errors['email'].'</li>';
if (isset($errors['email_valid'])) echo '<li class="error">'.$errors['email_valid'].'</li>';
if (isset($errors['sitename'])) {
echo '<li class="error">'.$errors['sitename'].'</li>';
}
if (isset($errors['siteurl'])) {
echo '<li class="error">'.$errors['siteurl'].'</li>';
}
if (isset($errors['login'])) {
echo '<li class="error">'.$errors['login'].'</li>';
}
if (isset($errors['password'])) {
echo '<li class="error">'.$errors['password'].'</li>';
}
if (isset($errors['email'])) {
echo '<li class="error">'.$errors['email'].'</li>';
}
if (isset($errors['email_valid'])) {
echo '<li class="error">'.$errors['email_valid'].'</li>';
}
?>
</ul>
<a href="install.php?action=install" class="btn btn-primary continue"><?php echo __('Continue', 'system'); ?></a>
</div>
<div class="install-block-footer login-footer">
<div class="text-center">
<span>© 2012 - 2014 <a href="http://monstra.org" class="small-grey-text" target="_blank">Monstra</a> <?php echo __('Version', 'system'); ?> <?php echo Monstra::VERSION; ?></span>
<span>© 2012 - 2015 <a href="http://monstra.org" class="small-grey-text" target="_blank">Monstra</a> <?php echo __('Version', 'system'); ?> <?php echo Monstra::VERSION; ?></span>
</div>
</div>
<script type="text/javascript">
$('.language-link').tooltip();
$(document).ready(function() {
$('.continue').click(function() {
$('.monstra-dialog').addClass('hide');

0
public/assets/img/flags/de.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

0
public/assets/img/flags/en.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 389 B

0
public/assets/img/flags/es.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 398 B

0
public/assets/img/flags/fa.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 459 B

0
public/assets/img/flags/fr.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

0
public/assets/img/flags/hu.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

0
public/assets/img/flags/id.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

0
public/assets/img/flags/it.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

0
public/assets/img/flags/ja.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 341 B

0
public/assets/img/flags/lt.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

0
public/assets/img/flags/nl.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

0
public/assets/img/flags/pl.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

0
public/assets/img/flags/pt-br.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

0
public/assets/img/flags/ru.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

0
public/assets/img/flags/sk.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 B

0
public/assets/img/flags/tr.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 489 B

0
public/assets/img/flags/uk.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

0
public/assets/img/flags/zh-cn.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 503 B