Limit version check popups to once per hour

This commit is contained in:
Isaac Connor 2020-04-04 11:52:40 -04:00
parent 6feffe2aa9
commit 402c38725b
1 changed files with 10 additions and 6 deletions

View File

@ -1,20 +1,24 @@
var consoleRefreshTimeout = <?php echo 1000*ZM_WEB_REFRESH_MAIN ?>; var consoleRefreshTimeout = <?php echo 1000*ZM_WEB_REFRESH_MAIN ?>;
<?php <?php
if ( ZM_CHECK_FOR_UPDATES && canEdit('System') && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) ) { if ( canEdit('System') ) {
$showVersionPopup = true; if ( ZM_CHECK_FOR_UPDATES && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) ) {
} elseif ( ZM_DYN_SHOW_DONATE_REMINDER ) { $showVersionPopup = true;
if ( canEdit('System') ) { $nextReminder = time() + 60*60;
// limit popups to one per hour instead of on every console refresh.
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_NEXT_REMINDER'");
} else if ( ZM_DYN_SHOW_DONATE_REMINDER ) {
if ( ZM_DYN_DONATE_REMINDER_TIME > 0 ) { if ( ZM_DYN_DONATE_REMINDER_TIME > 0 ) {
if ( ZM_DYN_DONATE_REMINDER_TIME < time() ) { if ( ZM_DYN_DONATE_REMINDER_TIME < time() ) {
$showDonatePopup = true; $showDonatePopup = true;
} }
} else { } else {
$nextReminder = time() + 30*24*60*60; $nextReminder = time() + 30*24*60*60;
dbQuery( "update Config set Value = '".$nextReminder."' where Name = 'ZM_DYN_DONATE_REMINDER_TIME'" ); dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_DONATE_REMINDER_TIME'");
} }
} }
} } // end if canEdit('System')
?> ?>
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>; var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>; var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;