require_once '../../../../init.php';
use WHMCS\Database\Capsule;
session_start();
if (!isset($_SESSION['adminid'])) {
header('Location: /admin/login.php?redirect=addonmodules.php%3Fmodule%3Dticketspamcheck');
exit;
}
function get_ticket_language_setting() {
$result = Capsule::table('tblticketspamcheckdashboardsettings')
->select('language')
->first();
return $result ? $result->language : 'en';
}
function load_translation($language) {
$filePath = _DIR_ . "/translations/{$language}.php";
if (file_exists($filePath)) {
return include $filePath;
}
return include _DIR_ . "/translations/en.php";
}
$language = get_ticket_language_setting();
$translations = load_translation($language);
$homeTitle = $translations['home_title'];
$welcomeMessage = $translations['welcome_message'];
$description = $translations['description'];
$home = $translations['home'];
$spamReports = $translations['spam_reports'];
$settings = $translations['settings'];
$leaveDashboard = $translations['leave_dashboard'];
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>echo htmlspecialchars($homeTitle);</title>
<link rel="icon" href="https://i.imgur.com/9ssrqfO.png" type="image/png">
<style>
:root {
--bg-color: #f0f0f0;
--text-color: #333;
--sidebar-bg-color: #333;
--sidebar-text-color: white;
--link-hover-color: #575757;
--button-bg-color: #007BFF;
--header-bg-color: #fff;
--header-text-color: #333;
}
.dark-theme {
--bg-color: #121212;
--text-color: #fff;
--sidebar-bg-color: #1e1e1e;
--sidebar-text-color: #bbb;
--link-hover-color: #3e3e3e;
--button-bg-color: #1e90ff;
--header-bg-color: #1e1e1e;
--header-text-color: #fff;
}
body {
font-family: Arial, sans-serif;
margin: 0;
height: 100vh;
display: flex;
background-color: var(--bg-color);
color: var(--text-color);
transition: background-color 0.3s, color 0.3s;
}
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 60px;
background-color: var(--header-bg-color);
color: var(--header-text-color);
padding: 0 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s, color 0.3s;
z-index: 1000;
}
.header h1 {
margin: 0;
font-size: 22px;
}
.theme-toggle {
cursor: pointer;
padding: 10px;
background-color: transparent;
border: none;
font-size: 24px;
color: var(--header-text-color);
transition: color 0.3s;
}
.sidebar {
position: fixed;
top: 60px;
left: 0;
bottom: 0;
width: 250px;
background-color: var(--sidebar-bg-color);
color: var(--sidebar-text-color);
padding: 20px;
display: flex;
flex-direction: column;
transition: background-color 0.3s, color 0.3s;
z-index: 999;
}
.sidebar a {
color: var(--sidebar-text-color);
text-decoration: none;
padding: 10px 15px;
margin-bottom: 10px;
border-radius: 4px;
display: flex;
align-items: center;
transition: background 0.3s, color 0.3s;
}
.sidebar a:hover {
background-color: var(--link-hover-color);
}
.sidebar a i {
margin-right: 10px;
}
.content {
margin-left: 300px;
margin-top: 80px;
padding: 20px;
flex-grow: 1;
transition: background-color 0.3s, color 0.3s;
}
.footer {
background-color: var(--header-bg-color);
color: var(--header-text-color);
text-align: center;
padding: 10px;
font-size: 14px;
position: fixed;
bottom: 0;
left: 0;
right: 0;
box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="header">
<h1>echo htmlspecialchars($homeTitle);</h1>
<button class="theme-toggle" onclick="toggleTheme()">
<i id="theme-icon" class="fas fa-moon"></i>
</button>
</div>
<div class="sidebar">
<a href="/modules/addons/ticketspamcheck/dashboard/home.php">echo htmlspecialchars($home);</a>
<a href="/modules/addons/ticketspamcheck/dashboard/spamreports.php">echo htmlspecialchars($spamReports);</a>
<a href="/modules/addons/ticketspamcheck/dashboard/settings.php">echo htmlspecialchars($settings);</a>
<a href="/admin/addonmodules.php?module=ticketspamcheck">echo htmlspecialchars($leaveDashboard);</a>
</div>
<div class="content">
<h1>echo htmlspecialchars($welcomeMessage); <span id="username">echo htmlspecialchars($username);</span></h1>
<p>echo htmlspecialchars($description);</p>
</div>
<div class="footer">
<p>© 2024 - echo date('Y'); Ricardo Neud. All rights reserved.</p>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script>
<script>
function toggleTheme() {
const themeIcon = document.getElementById('theme-icon');
let theme = 'light';
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.remove('dark-theme');
themeIcon.classList.remove('fa-sun');
themeIcon.classList.add('fa-moon');
theme = 'light';
} else {
document.body.classList.add('dark-theme');
themeIcon.classList.remove('fa-moon');
themeIcon.classList.add('fa-sun');
theme = 'dark';
}
localStorage.setItem('theme', theme);
fetch('', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
'theme': theme
})
})
.then(response => response.json())
.then(data => {
console.log('Theme updated:', data.theme);
})
.catch(error => {
console.error('Error updating theme:', error);
});
}
document.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('theme');
const themeIcon = document.getElementById('theme-icon');
if (savedTheme === 'dark') {
document.body.classList.add('dark-theme');
themeIcon.classList.remove('fa-moon');
themeIcon.classList.add('fa-sun');
} else {
document.body.classList.remove('dark-theme');
themeIcon.classList.remove('fa-sun');
themeIcon.classList.add('fa-moon');
}
});
</script>
</body>
</html>
© 2023 Quttera Ltd. All rights reserved.