Remove time code, will do client side formatting soon
This commit is contained in:
1 parent
c1a1218bf3
commit
cc4a17d0aa
6 files changed
+6
-282
No files matched your search
@@ -334,37 +334,6 @@ function logout() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function saveTimeSettings() {
|
||||
var country = document.getElementById("country").value
|
||||
var timezone = document.getElementById("timezone").value
|
||||
var dateFormatElements = document.getElementsByName("dateFormat");
|
||||
var timeFormatElements = document.getElementsByName("timeFormat");
|
||||
|
||||
var dateFormat = getSelectedRadioValue(dateFormatElements);
|
||||
var timeFormat = getSelectedRadioValue(timeFormatElements);
|
||||
|
||||
$.ajax({
|
||||
url: '/api/dashboard/setPreferences.php',
|
||||
type: 'POST',
|
||||
data: {country: country, timezone: timezone, dateformat: dateFormat, timeformat: timeFormat},
|
||||
success: function(responseJson) {
|
||||
console.log('Server response:', responseJson);
|
||||
|
||||
const isSuccess = responseJson.success === true || responseJson.success === 'true';
|
||||
|
||||
if (isSuccess) {
|
||||
showSuccess('Saved your preferences');
|
||||
} else {
|
||||
showError(responseJson.response);
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
showError(jqXHR.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getSelectedRadioValue(radioElements) {
|
||||
for (var i = 0; i < radioElements.length; i++) {
|
||||
if (radioElements[i].checked) {
|
||||
|
||||
@@ -53,7 +53,7 @@ if ($result->num_rows > 0) {
|
||||
|
||||
$uploadsByDay = $overallUploadsByDay = $overallLoginsByDay = array();
|
||||
|
||||
$currentDate = new DateTime('now', new DateTimeZone('America/Los_Angeles'));
|
||||
$currentDate = new DateTime('now', new DateTimeZone("America/Los_Angeles"));
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$day = $currentDate->format('m-d-Y');
|
||||
$uploadsByDay[$day] = 0;
|
||||
@@ -115,7 +115,6 @@ $loginStatsData = json_encode(array_reverse(array_values($overallLoginsByDay)));
|
||||
$uploadStatsLabels = json_encode(array_reverse(array_keys($uploadsByDay)));
|
||||
|
||||
$role_format = $role == 1 ? "Owner" : ($role == 2 ? "Manager" : ($role == 0 ? "User" : "Unknown"));
|
||||
date_default_timezone_set('America/Los_Angeles');
|
||||
|
||||
$motd = str_ireplace('%discord%', '<a href="/discord" style="text-decoration: underline;">Discord</a>', $motd);
|
||||
$news = str_ireplace('%discord%', '<a href="/discord" style="text-decoration: underline;">Discord</a>', $news);
|
||||
@@ -132,27 +131,6 @@ $news = str_ireplace('%role%', $role_format, $news);
|
||||
$motd = str_ireplace('%uid%', $uid, $motd);
|
||||
$news = str_ireplace('%uid%', $uid, $news);
|
||||
|
||||
$motd = str_ireplace('%year%', date('Y'), $motd);
|
||||
$news = str_ireplace('%year%', date('Y'), $news);
|
||||
|
||||
$motd = str_ireplace('%month%', date('n'), $motd);
|
||||
$news = str_ireplace('%month%', date('n'), $news);
|
||||
|
||||
$motd = str_ireplace('%monthformat%', date('F'), $motd);
|
||||
$news = str_ireplace('%monthformat%', date('F'), $news);
|
||||
|
||||
$motd = str_ireplace('%day%', date('j'), $motd);
|
||||
$news = str_ireplace('%day%', date('j'), $news);
|
||||
|
||||
$motd = str_ireplace('%dayformat%', date('l'), $motd);
|
||||
$news = str_ireplace('%dayformat%', date('l'), $news);
|
||||
|
||||
$motd = str_ireplace('%date%', date('n/j/Y'), $motd);
|
||||
$news = str_ireplace('%date%', date('n/j/Y'), $news);
|
||||
|
||||
$motd = str_ireplace('%dateformat%', date('F jS, Y'), $motd);
|
||||
$news = str_ireplace('%dateformat%', date('F jS, Y'), $news);
|
||||
|
||||
$motd = str_ireplace('%storage%', $size, $motd);
|
||||
$news = str_ireplace('%storage%', $size, $news);
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ $checkedSession = true;
|
||||
|
||||
$session = htmlspecialchars($_COOKIE['session']);
|
||||
|
||||
$stmt = $conn->prepare("SELECT uid, username, email, api_key, country, timezone, dateformat, timeformat, role, discord_id FROM users WHERE session = ?");
|
||||
$stmt = $conn->prepare("SELECT uid, username, email, api_key, role, discord_id FROM users WHERE session = ?");
|
||||
$stmt->bind_param("s", $session);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($uid, $username, $email, $api_key, $country, $timezone, $dateFormat, $timeFormat, $role, $discord_id);
|
||||
$stmt->bind_result($uid, $username, $email, $api_key, $role, $discord_id);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
@@ -64,78 +64,6 @@ ob_start();
|
||||
</div>
|
||||
<button onclick="downloadConfig()" style="margin-top: 8px;">Download ShareX Config</button>
|
||||
</div>
|
||||
|
||||
<div id="container">
|
||||
<h1>Time Settings</h1>
|
||||
<div class="settings-group">
|
||||
<label for="country" style="color: #fff;">Country:</label>
|
||||
<select id="country" name="country">
|
||||
<?php
|
||||
$countries = ["Andorra", "French Southern and Antarctic Lands", "Laos", "Canada", "Nigeria", "Vanuatu", "Czechia", "Malawi", "Mali", "Iceland", "Norway", "Saint Vincent and the Grenadines", "Guadeloupe", "Chile", "Bermuda", "Kuwait", "Dominica", "Montenegro", "United States Virgin Islands", "Cameroon", "Sri Lanka", "China", "Bangladesh", "Sweden", "Grenada", "Turkey", "Guinea", "Tanzania", "Rwanda", "Singapore", "Morocco", "Saint Barthélemy", "Iraq", "Brunei", "Isle of Man", "North Korea", "Iran", "Curaçao", "Paraguay", "Albania", "Tajikistan", "Bolivia", "Austria", "Saint Kitts and Nevis", "United States Minor Outlying Islands", "Colombia", "Kosovo", "Belize", "Guinea-Bissau", "Marshall Islands", "Myanmar", "French Polynesia", "Brazil", "Croatia", "Somalia", "Afghanistan", "Anguilla", "Cook Islands", "Western Sahara", "New Zealand", "Eritrea", "Cambodia", "Bahamas", "Belarus", "Norfolk Island", "Tuvalu", "South Georgia", "Mauritania", "New Caledonia", "Bulgaria", "Mozambique", "Niue", "Estonia", "Italy", "Malta", "Slovenia", "India", "Peru", "Burundi", "Lithuania", "United States", "Honduras", "Tonga", "Saudi Arabia", "Suriname", "Qatar", "Saint Helena, Ascension and Tristan da Cunha", "Gibraltar", "Northern Mariana Islands", "Mauritius", "Barbados", "Réunion", "British Indian Ocean Territory", "Syria", "Egypt", "São Tomé and Príncipe", "Kiribati", "Timor-Leste", "Lesotho", "Solomon Islands", "Libya", "South Korea", "Liechtenstein", "Nicaragua", "Ecuador", "Maldives", "Algeria", "Kyrgyzstan", "Finland", "Antarctica", "Kenya", "Cuba", "Montserrat", "Poland", "Åland Islands", "Ethiopia", "Togo", "Bosnia and Herzegovina", "Uruguay", "Guam", "Cape Verde", "Chad", "Vatican City", "Palau", "Haiti", "Yemen", "Eswatini", "Zimbabwe", "Greece", "Israel", "Saint Martin", "Antigua and Barbuda", "Cyprus", "Sint Maarten", "Monaco", "Fiji", "Ukraine", "Martinique", "Hong Kong", "Portugal", "Bhutan", "Nepal", "France", "Ireland", "United Arab Emirates", "Guernsey", "Saint Lucia", "Dominican Republic", "Serbia", "Botswana", "Ivory Coast", "Ghana", "Comoros", "Azerbaijan", "United Kingdom", "Central African Republic", "Palestine", "Caribbean Netherlands", "Taiwan", "Pitcairn Islands", "San Marino", "Svalbard and Jan Mayen", "Djibouti", "Wallis and Futuna", "Denmark", "Papua New Guinea", "Madagascar", "Bouvet Island", "Hungary", "Tokelau", "Trinidad and Tobago", "Gambia", "Luxembourg", "Cocos (Keeling) Islands", "Republic of the Congo", "Argentina", "DR Congo", "Greenland", "Jordan", "Belgium", "Switzerland", "Indonesia", "Lebanon", "Malaysia", "Cayman Islands", "Slovakia", "Armenia", "Christmas Island", "Mongolia", "Saint Pierre and Miquelon", "Japan", "South Africa", "Philippines", "Micronesia", "Germany", "Latvia", "Jamaica", "Macau", "Nauru", "Faroe Islands", "Guyana", "Burkina Faso", "Sudan", "Russia", "Mayotte", "Australia", "Liberia", "Mexico", "Tunisia", "Aruba", "Kazakhstan", "Oman", "French Guiana", "Niger", "Turkmenistan", "Sierra Leone", "Samoa", "Senegal", "Georgia", "Namibia", "South Sudan", "Thailand", "Bahrain", "Heard Island and McDonald Islands", "Falkland Islands", "Jersey", "Vietnam", "Guatemala", "Moldova", "North Macedonia", "Uzbekistan", "Romania", "Uganda", "El Salvador", "Zambia", "Gabon", "Equatorial Guinea", "Spain", "Netherlands", "British Virgin Islands", "Benin", "Pakistan", "Panama", "Turks and Caicos Islands", "Angola", "American Samoa", "Venezuela", "Costa Rica", "Puerto Rico", "Seychelles"];
|
||||
|
||||
foreach ($countries as $option) {
|
||||
echo '<option class="settings-value" value="' . htmlspecialchars($option) . '"';
|
||||
if ($option == $country) {
|
||||
echo ' selected';
|
||||
}
|
||||
echo '>' . htmlspecialchars($option) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="settings-group">
|
||||
<label for="timezone" style="color: #fff;">Timezone:</label>
|
||||
<select id="timezone" name="timezone">
|
||||
<?php
|
||||
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
|
||||
|
||||
foreach ($timezones as $option) {
|
||||
echo '<option class="settings-value" value="' . htmlspecialchars($option) . '"';
|
||||
if ($option == $timezone) {
|
||||
echo ' selected';
|
||||
}
|
||||
echo '>' . htmlspecialchars($option) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="settings-group settings-radio-group">
|
||||
<div class="settings-label">Date Format:</div>
|
||||
<label class="radio-container">
|
||||
<input type="radio" name="dateFormat" value="mmddyyyy" <?php echo $dateFormat == "mmddyyyy" ? 'checked' : ''; ?>>
|
||||
<i class="far fa-circle"></i>
|
||||
<i class="fas fa-check-circle"></i>
|
||||
mm/dd/yyyy
|
||||
</label>
|
||||
<label class="radio-container">
|
||||
<input type="radio" name="dateFormat" value="ddmmyyyy" <?php echo $dateFormat == "ddmmyyyy" ? 'checked' : ''; ?>>
|
||||
<i class="far fa-circle"></i>
|
||||
<i class="fas fa-check-circle"></i>
|
||||
dd/mm/yyyy
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="settings-group settings-radio-group">
|
||||
<div class="settings-label">Time Format:</div>
|
||||
<label class="radio-container">
|
||||
<input type="radio" name="timeFormat" value="12hour" <?php echo $timeFormat == "12" ? 'checked' : ''; ?>>
|
||||
<i class="far fa-circle"></i>
|
||||
<i class="fas fa-check-circle"></i>
|
||||
12-hour
|
||||
</label>
|
||||
<label class="radio-container">
|
||||
<input type="radio" name="timeFormat" value="24hour" <?php echo $timeFormat == "24" ? 'checked' : ''; ?>>
|
||||
<i class="far fa-circle"></i>
|
||||
<i class="fas fa-check-circle"></i>
|
||||
24-hour
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button onclick="saveTimeSettings()" style="margin-top: 8px;">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
$title = 'Settings';
|
||||
|
||||
Reference in new issue
Block a user