Initial commit
This commit is contained in:
70
language.php
Normal file
70
language.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
defined(page_security_key) or exit;
|
||||
|
||||
//Check if allowed
|
||||
if (isAllowed('language',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
||||
header('location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Capture post data
|
||||
if (isset($_POST['language_US'], $_POST['language_NL'])) {
|
||||
// Save templates
|
||||
file_put_contents('./settings/translations/translations_US.php', $_POST['language_US']);
|
||||
file_put_contents('./settings/translations/translations_NL.php', $_POST['language_NL']);
|
||||
header('Location: index.php?page=language&success_msg=1');
|
||||
exit;
|
||||
}
|
||||
// Read language_US template PHP file
|
||||
$contents = file_get_contents('./settings/translations/translations_US.php');
|
||||
// Read language template PHP file
|
||||
$contents2 = file_get_contents('./settings/translations/translations_NL.php');
|
||||
// Handle success messages
|
||||
if (isset($_GET['success_msg'])) {
|
||||
if ($_GET['success_msg'] == 1) {
|
||||
$success_msg = 'Settings updated successfully!';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?=template_header('Language', 'language','view')?>
|
||||
|
||||
<form action="" method="post">
|
||||
|
||||
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||
<h2 class="responsive-width-100">Translations</h2>
|
||||
<input type="submit" name="submit" value="Save" class="btn">
|
||||
</div>
|
||||
|
||||
<?php if (isset($success_msg)): ?>
|
||||
<div class="msg success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<p><?=$success_msg?></p>
|
||||
<i class="fas fa-times"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="tabs">
|
||||
<a href="#" class="active">US</a>
|
||||
<a href="#" class="active">NL</a>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<div class="form responsive-width-100">
|
||||
<div class="tab-content active">
|
||||
<label for="language_US"></label>
|
||||
<textarea name="language_US" id="language_US" style="min-height: 100vh;"><?=$contents?></textarea>
|
||||
</div>
|
||||
<div class="tab-content active">
|
||||
<label for="language_NL"></label>
|
||||
<textarea name="language_NL" id="language_NL" style="min-height: 100vh;"><?=$contents2?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script>
|
||||
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
|
||||
checkbox.onclick = () => checkbox.value = checkbox.checked ? 'true' : 'false';
|
||||
});
|
||||
</script>
|
||||
|
||||
<?=template_footer()?>
|
||||
Reference in New Issue
Block a user