Skip to content

Commit

Permalink
#4003 Make XX_NEED_TO_UPDATE_XX a defined variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-developer committed Dec 22, 2024
1 parent be6abd9 commit a9a9b93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions config_repo/allskyDefines.inc.repo
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ define('ALLSKY_VERSION', 'XX_ALLSKY_VERSION_XX');
define('ALLSKY_STATUS', 'XX_ALLSKY_STATUS_XX');
define('RASPI_CONFIG', 'XX_RASPI_CONFIG_XX');
define('RASPI_ADMIN_DETAILS', 'XX_RASPI_CONFIG_XX/raspap.auth');
define('CONFIG_UPDATE_STRING', 'XX_NEED_TO_UPDATE_XX');

// Split the placeholder so it doesn't get replaced.
if (ALLSKY_HOME == "XX_ALLSKY_HOME" . "_XX") {
Expand Down
5 changes: 2 additions & 3 deletions html/allsky/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function initialize() {
global $webSettings_array;
global $configFilePrefix;

$needToUpdateString = "XX_NEED_TO_UPDATE_XX";
$configurationFileName = "configuration.json";
$retMsg = "";

Expand All @@ -32,11 +31,11 @@ function initialize() {
return($retMsg);
}
$webSettings_str = file_get_contents($configuration_file, true);
if (strpos($webSettings_str, $needToUpdateString) !== false) {
if (strpos($webSettings_str, CONFIG_UPDATE_STRING) !== false) {
$retMsg .= "<p class='warning-msg'>";
$retMsg .= "The '$configurationFileName' file needs to be updated via";
$retMsg .= " the 'Editor' page in the WebUI.";
$retMsg .= "<br><br>Update fields with '$needToUpdateString'";
$retMsg .= "<br><br>Update fields with '".CONFIG_UPDATE_STRING."'";
$retMsg .= " and check all other entries.";
$retMsg .= "<br><br>This Allsky Website will not work until updated.";
$retMsg .= "</p>";
Expand Down
7 changes: 4 additions & 3 deletions html/includes/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function DisplayEditor()
}
?>
<script type="text/javascript">
let CONFIG_UPDATE_STRING = "<?php echo CONFIG_UPDATE_STRING ?>"
$(document).ready(function () {
let clearTimer = null;
let currentMarks = [];
Expand Down Expand Up @@ -118,10 +119,10 @@ function startTimer() {
});

editor.on("change", (instance, changeObj) => {
highlightText('XX_NEED_TO_UPDATE_XX');
highlightText(CONFIG_UPDATE_STRING);
});

highlightText('XX_NEED_TO_UPDATE_XX');
highlightText(CONFIG_UPDATE_STRING);
});

$("#save_file").click(function () {
Expand Down Expand Up @@ -234,7 +235,7 @@ className: 'btn-danger'
$.get(fileName + "?_ts=" + new Date().getTime(), function (data) {
data = JSON.stringify(data, null, "\t");
editor.getDoc().setValue(data);
highlightText('XX_NEED_TO_UPDATE_XX')
highlightText(CONFIG_UPDATE_STRING)
}).fail(function (x) {
if (x.status == 200) { // json files can fail but actually work
editor.getDoc().setValue(x.responseText);
Expand Down

0 comments on commit a9a9b93

Please sign in to comment.