mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-02 20:29:20 +02:00
Merge branch 'develop' into feature/twig-hooks-filters
This commit is contained in:
commit
592bfaea70
@ -2,10 +2,15 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
// configuration
|
||||
$dirs_required = [
|
||||
$dirs_required_writable = [
|
||||
'system/logs',
|
||||
'system/cache',
|
||||
];
|
||||
|
||||
$dirs_required = [
|
||||
'tools/ext' => $locale['step_requirements_folder_not_exists_tools_ext'],
|
||||
];
|
||||
|
||||
$dirs_optional = [
|
||||
GUILD_IMAGES_DIR => $locale['step_requirements_warning_images_guilds'],
|
||||
GALLERY_DIR => $locale['step_requirements_warning_images_gallery'],
|
||||
@ -18,6 +23,7 @@ $extensions_optional = [
|
||||
'gd' => $locale['step_requirements_warning_player_signatures'],
|
||||
'zip' => $locale['step_requirements_warning_install_plugins'],
|
||||
];
|
||||
|
||||
/*
|
||||
*
|
||||
* @param string $name
|
||||
@ -41,7 +47,7 @@ $failed = false;
|
||||
// start validating
|
||||
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50500), PHP_VERSION);
|
||||
|
||||
foreach ($dirs_required as $value)
|
||||
foreach ($dirs_required_writable as $value)
|
||||
{
|
||||
$is_writable = is_writable(BASE . $value) && (MYAAC_OS != 'WINDOWS' || win_is_writable(BASE . $value));
|
||||
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $is_writable);
|
||||
@ -52,6 +58,12 @@ foreach ($dirs_optional as $dir => $errorMsg) {
|
||||
version_check($locale['step_requirements_write_perms'] . ': ' . $dir, $is_writable, $is_writable ? '' : $errorMsg, true);
|
||||
}
|
||||
|
||||
foreach ($dirs_required as $dir => $errorMsg)
|
||||
{
|
||||
$exists = is_dir(BASE . $dir);
|
||||
version_check($locale['step_requirements_folder_exists'] . ': ' . $dir, $exists, $exists ? '' : $errorMsg);
|
||||
}
|
||||
|
||||
$ini_register_globals = ini_get_bool('register_globals');
|
||||
version_check('register_long_arrays', !$ini_register_globals, $ini_register_globals ? $locale['on'] : $locale['off']);
|
||||
|
||||
@ -78,4 +90,3 @@ if($failed) {
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
|
@ -41,57 +41,56 @@ if(!$error) {
|
||||
$configToSave['cache_engine'] = 'auto';
|
||||
$configToSave['cache_prefix'] = 'myaac_' . generateRandomString(8, true, false, true);
|
||||
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
if(!$error) {
|
||||
require BASE . 'install/includes/database.php';
|
||||
$content = '';
|
||||
$saved = Settings::saveConfig($configToSave, BASE . 'config.local.php', $content);
|
||||
if ($saved) {
|
||||
success($locale['step_database_config_saved']);
|
||||
$_SESSION['saved'] = true;
|
||||
|
||||
$locale['step_database_importing'] = str_replace('$DATABASE_NAME$', config('database_name'), $locale['step_database_importing']);
|
||||
success($locale['step_database_importing']);
|
||||
require BASE . 'config.local.php';
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
if(isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
}
|
||||
else {
|
||||
if(!$db->hasTable('accounts')) {
|
||||
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
if (!$error) {
|
||||
require BASE . 'install/includes/database.php';
|
||||
|
||||
if(!$db->hasTable('players')) {
|
||||
$tmp = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!$db->hasTable('guilds')) {
|
||||
$tmp = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!$error) {
|
||||
$twig->display('install.installer.html.twig', array(
|
||||
'url' => 'tools/5-database.php',
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
|
||||
$content = '';
|
||||
$saved = Settings::saveConfig($configToSave, BASE . 'config.local.php', $content);
|
||||
if($saved) {
|
||||
success($locale['step_database_config_saved']);
|
||||
$_SESSION['saved'] = true;
|
||||
if (isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
}
|
||||
else {
|
||||
$_SESSION['config_content'] = $content;
|
||||
unset($_SESSION['saved']);
|
||||
if (!$db->hasTable('accounts')) {
|
||||
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.php</b>', $locale['step_database_error_file']);
|
||||
error($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
if (!$db->hasTable('players')) {
|
||||
$tmp = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$db->hasTable('guilds')) {
|
||||
$tmp = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$twig->display('install.installer.html.twig', array(
|
||||
'url' => 'tools/5-database.php',
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_SESSION['config_content'] = $content;
|
||||
unset($_SESSION['saved']);
|
||||
|
||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.php</b>', $locale['step_database_error_file']);
|
||||
error($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
|
||||
else {
|
||||
// import schema
|
||||
try {
|
||||
$locale['step_database_importing'] = str_replace('$DATABASE_NAME$', config('database_name'), $locale['step_database_importing']);
|
||||
success($locale['step_database_importing']);
|
||||
|
||||
$db->query(file_get_contents(BASE . 'install/includes/schema.sql'));
|
||||
|
||||
$locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
|
||||
|
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$reward = setting('core.account_mail_confirmed_reward');
|
||||
|
||||
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
||||
$rewardCoins = setting('core.account_mail_confirmed_reward_coins');
|
||||
if ($rewardCoins > 0 && !$hasCoinsColumn) {
|
||||
|
@ -127,6 +127,7 @@ try {
|
||||
}
|
||||
|
||||
if(defined('MYAAC_INSTALL')) {
|
||||
$error = $e->getMessage();
|
||||
return; // installer will take care of this
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,8 @@ date_default_timezone_set(setting('core.date_timezone'));
|
||||
|
||||
setting(
|
||||
[
|
||||
'core.account_create_character_create',
|
||||
setting('core.account_create_character_create') && (!setting('core.mail_enabled') || !setting('core.account_mail_verify'))
|
||||
'core.account_mail_verify',
|
||||
setting('core.account_mail_verify') && setting('core.mail_enabled')
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Anforderungen';
|
||||
$locale['step_requirements_title'] = 'Anforderungen überprüfen';
|
||||
$locale['step_requirements_php_version'] = 'PHP Version';
|
||||
$locale['step_requirements_write_perms'] = 'Schreibberechtigungen';
|
||||
$locale['step_requirements_folder_exists'] = 'Ordner ist vorhanden';
|
||||
$locale['step_requirements_folder_not_exists_tools_ext'] = 'NPM Package Manager wird verwendet für externe JavaScript/CSS Bibliotheken.'
|
||||
. ' Es sollte via Command Line installiert werden: <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">https://docs.npmjs.com/downloading-and-installing-node-js-and-npm</a>'
|
||||
. ' Nachdem das Tool installiert wurde, folgende Befehl sollte ausgeführt in dem Hauptordner des MyAACs: "npm install".';
|
||||
$locale['step_requirements_failed'] = 'Die Installation wird deaktiviert, bis diese Anforderungen erfüllt sind.</b><br/>Für weitere Informationen siehe <b>README</b> Datei.';
|
||||
$locale['step_requirements_extension'] = '$EXTENSION$ PHP Erweiterung';
|
||||
|
||||
|
@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Requirements';
|
||||
$locale['step_requirements_title'] = 'Requirements check';
|
||||
$locale['step_requirements_php_version'] = 'PHP Version';
|
||||
$locale['step_requirements_write_perms'] = 'Write permissions';
|
||||
$locale['step_requirements_folder_exists'] = 'Directory exists';
|
||||
$locale['step_requirements_folder_not_exists_tools_ext'] = 'NPM Package Manager is used for external JavaScript/CSS libraries.'
|
||||
. ' You need to install it through Command Line: <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">https://docs.npmjs.com/downloading-and-installing-node-js-and-npm</a>'
|
||||
. ' When you done with installing that tool, execute: "npm install" in the main MyAAC folder.';
|
||||
$locale['step_requirements_failed'] = 'Installation will be disabled until these requirements will be passed.</b><br/>For more informations see <b>README</b> file.';
|
||||
$locale['step_requirements_extension'] = '$EXTENSION$ PHP extension';
|
||||
$locale['step_requirements_warning_images_guilds'] = 'Guild logo upload will not work';
|
||||
|
@ -36,6 +36,10 @@ $locale['step_requirements'] = 'Wymagania';
|
||||
$locale['step_requirements_title'] = 'Sprawdzanie wymagań';
|
||||
$locale['step_requirements_php_version'] = 'Wersja PHP';
|
||||
$locale['step_requirements_write_perms'] = 'Uprawnienia do zapisu';
|
||||
$locale['step_requirements_folder_exists'] = 'Folder istnieje';
|
||||
$locale['step_requirements_folder_not_exists_tools_ext'] = 'Manadżer Pakietów NPM jest używany do zewnętrznych bibliotek JavaScript/CSS.'
|
||||
. ' Trzeba go zainstalować poprzez wiersz poleceń: <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">https://docs.npmjs.com/downloading-and-installing-node-js-and-npm</a>'
|
||||
. ' Po instalacji narzędzia, wywołaj następujące polecenie w głownym katalogu MyAAC: "npm install".';
|
||||
$locale['step_requirements_failed'] = 'Instalacja zostanie zablokowana dopóki te wymagania nie zostaną spełnione.</b><br/>Po więcej informacji zasięgnij do pliku <b>README</b>.';
|
||||
$locale['step_requirements_extension'] = 'Rozszerzenie PHP - $EXTENSION$';
|
||||
$locale['step_requirements_warning_images_guilds'] = 'Nie będzie możliwości uploadu obrazków gildii';
|
||||
|
@ -25,16 +25,20 @@ if(!Account::where('email_hash', $hash)->exists()) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Account::where('email_hash', $hash)->where('email_verified', 0)->exists()) {
|
||||
$query = $query->fetch(PDO::FETCH_ASSOC);
|
||||
$accountModel = Account::where('email_hash', $hash)->where('email_verified', 0)->first();
|
||||
if ($accountModel) {
|
||||
$accountModel->email_verified = 1;
|
||||
$accountModel->save();
|
||||
|
||||
success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this. You can now <a href=' . getLink('account/manage') . '>log in</a>.');
|
||||
|
||||
$account = new OTS_Account();
|
||||
$account->load($query['id']);
|
||||
$account->load($accountModel->id);
|
||||
if ($account->isLoaded()) {
|
||||
$hooks->trigger(HOOK_EMAIL_CONFIRMED, ['account' => $account]);
|
||||
}
|
||||
}
|
||||
|
||||
Account::where('email_hash', $hash)->update('email_verified', 1);
|
||||
success('You have now verified your e-mail, this will increase the security of your account. Thank you for doing this.');
|
||||
else {
|
||||
error('Link has expired.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -236,6 +236,9 @@ if($save)
|
||||
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
|
||||
{
|
||||
echo 'Your account has been created.<br/><br/>';
|
||||
|
||||
warning("Before you can login - you need to verify your E-Mail. The verification link has been sent to $email. If the message is not coming - remember to check the SPAM folder.");
|
||||
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Account Created',
|
||||
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
|
||||
@ -252,15 +255,6 @@ if($save)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(setting('core.account_create_character_create')) {
|
||||
// character creation
|
||||
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
|
||||
if (!$character_created) {
|
||||
error('There was an error creating your character. Please create your character later in account management page.');
|
||||
error(implode(' ', $errors));
|
||||
}
|
||||
}
|
||||
|
||||
if(setting('core.account_create_auto_login')) {
|
||||
if ($hasBeenCreatedByEMail) {
|
||||
$_POST['account_login'] = $email;
|
||||
@ -311,6 +305,15 @@ if($save)
|
||||
}
|
||||
}
|
||||
|
||||
if(setting('core.account_create_character_create')) {
|
||||
// character creation
|
||||
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
|
||||
if (!$character_created) {
|
||||
error('There was an error creating your character. Please create your character later in account management page.');
|
||||
error(implode(' ', $errors));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -60,28 +60,33 @@ if(!empty($login_account) && !empty($login_password))
|
||||
&& (!isset($t) || $t['attempts'] < 5)
|
||||
)
|
||||
{
|
||||
session_regenerate_id();
|
||||
setSession('account', $account_logged->getId());
|
||||
setSession('password', encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password));
|
||||
if($remember_me) {
|
||||
setSession('remember_me', true);
|
||||
}
|
||||
|
||||
$logged = true;
|
||||
$logged_flags = $account_logged->getWebFlags();
|
||||
|
||||
if(isset($_POST['admin']) && !admin()) {
|
||||
$errors[] = 'This account has no admin privileges.';
|
||||
unsetSession('account');
|
||||
unsetSession('password');
|
||||
unsetSession('remember_me');
|
||||
$logged = false;
|
||||
if (setting('core.account_mail_verify') && (int)$account_logged->getCustomField('email_verified') !== 1) {
|
||||
$errors[] = 'Your account is not verified. Please verify your email address. If the message is not coming check the SPAM folder in your E-Mail client.';
|
||||
}
|
||||
else {
|
||||
$account_logged->setCustomField('web_lastlogin', time());
|
||||
}
|
||||
session_regenerate_id();
|
||||
setSession('account', $account_logged->getId());
|
||||
setSession('password', encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password));
|
||||
if($remember_me) {
|
||||
setSession('remember_me', true);
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
|
||||
$logged = true;
|
||||
$logged_flags = $account_logged->getWebFlags();
|
||||
|
||||
if(isset($_POST['admin']) && !admin()) {
|
||||
$errors[] = 'This account has no admin privileges.';
|
||||
unsetSession('account');
|
||||
unsetSession('password');
|
||||
unsetSession('remember_me');
|
||||
$logged = false;
|
||||
}
|
||||
else {
|
||||
$account_logged->setCustomField('web_lastlogin', time());
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_LOGIN, array('account' => $account_logged, 'password' => $login_password, 'remember_me' => $remember_me));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,6 +382,8 @@ class Settings implements \ArrayAccess
|
||||
}
|
||||
|
||||
$this->settingsDatabase[$pluginKeyName][$key] = $value;
|
||||
// invalidate cache
|
||||
unset($this->cache[$offset]);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
|
@ -110,7 +110,7 @@
|
||||
|
||||
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
|
||||
|
||||
{% if (not setting('core.mail_enabled') or not setting('core.account_mail_verify')) and setting('core.account_create_character_create') %}
|
||||
{% if setting('core.account_create_character_create') %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="TableShadowContainerRightTop">
|
||||
|
Loading…
x
Reference in New Issue
Block a user