Skip to content

Commit

Permalink
Saving files before refreshing line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bizarrus committed Sep 24, 2024
1 parent 85c3a5a commit 5e4c714
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
17 changes: 17 additions & 0 deletions default/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
use fruithost\Accounting\Auth;
use fruithost\Templating\TemplateFiles;

$this->getFiles()->addStylesheet('global', $this->url('css/global.css'), '1.0.0', [ 'bootstrap' ]);
$this->getFiles()->addJavascript('global', $this->url('js/global.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER);
$this->getFiles()->addJavascript('ajax', $this->url('js/ajax.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER);

if(!Auth::isLoggedIn()) {
$this->getFiles()->addStylesheet('login', $this->url('css/login.css'), '2.0.0', [ 'bootstrap' ]);
$this->getFiles()->addJavascript('login', $this->url('js/login.js'), '1.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER);
} else {
$this->getFiles()->addStylesheet('style', $this->url('css/style.css'), '2.0.0', [ 'bootstrap' ]);
$this->getFiles()->addJavascript('ui', $this->url('js/ui.js'), '2.0.0', [ 'bootstrap' ], TemplateFiles::FOOTER);
$this->getFiles()->addJavascript('codemirror', $this->url('js/codemirror/build/bundle.min.js'), '6.0.0', [ 'ui' ], TemplateFiles::FOOTER);
}
?>
20 changes: 20 additions & 0 deletions handler/settings/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* fruithost | OpenSource Hosting
*
* @author Adrian Preuß
* @version 1.0.0
* @license MIT
*/

use fruithost\Accounting\Auth;
use fruithost\Localization\I18N;

Auth::setSettings('LANGUAGE', NULL, $_POST['language']);
Auth::setSettings('TIME_FORMAT', NULL, $_POST['time_format']);
Auth::setSettings('TIME_ZONE', NULL, $_POST['time_zone']);

$template->getCore()->getHooks()->runAction('SAVE_ACCOUNT_SETTINGS_GLOBAL', $_POST);
$template->assign('success', I18N::get('Your settings has been updated.'));
I18N::reload();
?>
48 changes: 48 additions & 0 deletions handler/settings/security.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* fruithost | OpenSource Hosting
*
* @author Adrian Preuß
* @version 1.0.0
* @license MIT
*/

use fruithost\Accounting\Auth;
use fruithost\Localization\I18N;

$selected = null;

foreach($template->getCore()->getHooks()->applyFilter('2FA_METHODS', [
(object) [
'id' => 'mail',
'name' => I18N::get('E-Mail'),
'enabled' => true
]
]) AS $index => $method) {
if($method->id == $_POST['2fa_type']) {
$selected = $method;
break;
}
}

if($selected == null) {
$template->assign('error', I18N::get('The selected 2FA method is not known.'));
return;
}

if(!$selected->enabled) {
$template->assign('error', sprintf(I18N::get('The 2FA method "%s" is currently deactivated and can therefore not be used.'), $selected->name));
return;
}

if(isset($_POST['2fa_enabled'])) {
Auth::setSettings('2FA_ENABLED', NULL, 'true');
} else {
Auth::setSettings('2FA_ENABLED', NULL, 'false');
}

Auth::setSettings('2FA_TYPE', NULL, $_POST['2fa_type']);

$template->getCore()->getHooks()->runAction('SAVE_ACCOUNT_SETTINGS_SECURITY', $_POST);
$template->assign('success', I18N::get('Your security settings has been updated.'));
?>

0 comments on commit 5e4c714

Please sign in to comment.