Date & Time

master
Squidly271 2023-10-08 11:27:23 -04:00
parent 7804183a55
commit 65f7113c21
5 changed files with 31 additions and 5 deletions

View File

@ -122,6 +122,7 @@ $memRaw = trim(str_replace("MemTotal:","",exec("cat /proc/meminfo | grep MemTota
$memoryInstalled = explode(" ",$memRaw);
$CArequirementsNOTmet = $memoryInstalled[0] < 2500000;
$ServerDateCorrect = checkServerDate() ? "true": "false";
function tr($string,$ret=false) {
@ -270,6 +271,8 @@ $(function(){
if ( "<?=$date?>" == "1/01" ) addBannerWarning("<?tr("Happy New Year!")?>",false);
if ( "<?=$date?>" == "12/31" ) addBannerWarning("<?tr("Happy New Year!")?> <i style='float:initial;cursor:initial;' class='fa fa-beer'></i> <?tr("Please Enjoy Responsibly")?>",false);
if ( "<?=$ServerDateCorrect?>" == "false" ) addBannerWarning("<?tr("Server Date and Time Incorrect. Issues will result with Community Applications. Fix this in Settings - Date And Time")?>",true,true);
context.init({preventDoubleContext:false,left:false,right:false,bottom:true,above:true});
$(".maxPerPage").html(sprintf("<?tr("Results Per Page: %s")?>","<?=$cfg['maxPerPage']?>"));

View File

@ -1,9 +1,9 @@
dbcd3253215c5714e7fb165f02bc782c ./Apps.page
6128b283301eb61e14826fbc5365d899 ./Apps.page
385834d91dc8758bfcd5d34f1c3e530e ./CA_notices.page
2c2a1b7d148fe51ee38813d1a0e71589 ./ca_settings.page
01ed7990078dee7cecfeda9a4e49377e ./default.cfg
2fbccf0c27923cf5089e496993deecfc ./include/exec.php
4bb86b8d71180b347444e9cb88f5d3d3 ./include/helpers.php
08d934821777b8383f477b9e742c5363 ./include/exec.php
06e6f49f82df8bf88c615c65c4b6b13d ./include/helpers.php
343e1d26129551fc142b09b5d6e10503 ./include/paths.php
7234caf6800479df03abb222aaedaca5 ./javascript/libraries.js
71f911a818d88d3d567f8a2898094ee2 ./README.md

View File

@ -1036,8 +1036,12 @@ function force_update() {
$updatedSyncFlag = true;
if (! DownloadApplicationFeed() ) {
$o['script'] = "$('.onlyShowWithFeed').hide();";
$o['data'] = "<div class='ca_center'><font size='4'><span class='ca_bold'>".tr("Download of appfeed failed.")."</span></font><font size='3'><br><br>Community Applications requires your server to have internet access. The most common cause of this failure is a failure to resolve DNS addresses. You can try and reset your modem and router to fix this issue, or set static DNS addresses (Settings - Network Settings) of 208.67.222.222 and 208.67.220.220 and try again.<br><br>Alternatively, there is also a chance that the server handling the application feed is temporarily down. See also <a href='https://forums.unraid.net/topic/120220-fix-common-problems-more-information/page/2/?tab=comments#comment-1101084' target='_blank'>this post</a> for more information";
$tempFile = @file_get_contents($caPaths['appFeedDownloadError']);
if ( checkServerDate() )
$o['data'] = "<div class='ca_center'><font size='4'><span class='ca_bold'>".tr("Download of appfeed failed.")."</span></font><font size='3'><br><br>Community Applications requires your server to have internet access. The most common cause of this failure is a failure to resolve DNS addresses. You can try and reset your modem and router to fix this issue, or set static DNS addresses (Settings - Network Settings) of 208.67.222.222 and 208.67.220.220 and try again.<br><br>Alternatively, there is also a chance that the server handling the application feed is temporarily down. See also <a href='https://forums.unraid.net/topic/120220-fix-common-problems-more-information/page/2/?tab=comments#comment-1101084' target='_blank'>this post</a> for more information";
else
$o['data'] = "<div class='ca_center'><font size='4'><span class='ca_bold'>".tr("Download of appfeed failed.")."</span></font><font size='3'><br><br>Community Applications requires your server to have internet access. This could be because it appears that the current date and time of your server is incorrect. Correct this within Settings - Date And Time. See also <a href='https://forums.unraid.net/topic/120220-fix-common-problems-more-information/page/2/?tab=comments#comment-1101084' target='_blank'>this post</a> for more information";
$tempFile = @file_get_contents($caPaths['appFeedDownloadError']);
$downloaded = @file_get_contents($tempFile);
if (strlen($downloaded) > 100)
$o['data'] .= "<font size='2' color='red'><br><br>It *appears* that a partial download of the application feed happened (or is malformed), therefore it is probable that the application feed is temporarily down. Please try again later)</font>";

View File

@ -752,6 +752,25 @@ function plain($ip) {
return str_replace(['[',']'],'',$ip);
}
###########################################
# Checks server date against CA's version #
###########################################
# only a quick check if date on server is 30 days before CA's version. Not 100% accurate to determine if date & time on server is incorrect
function checkServerDate() {
$currentDate = strtotime(date("Y-m-d"));
$caVersion = preg_replace("/[^0-9.]/","",plugin("version","/var/log/plugins/community.applications.plg"));
if ( ! $caVersion )
return true;
$caVersion = str_replace(".","-",$caVersion);
$caVersion = strtotime($caVersion);
if ( ($caVersion - $currentDate) > 2592000 ) # 30 Days
return false;
else
return true;
}
##################################################################################
# Adds in all the various missing entries from the templates for PHP8 compliance #
##################################################################################