Fix donate now functionality. Improve zmWindow to take an optional sub path so that we can target /donate directly

pull/2752/head
Isaac Connor 2019-11-05 10:07:42 -05:00
parent 5603fd70f8
commit 5b02bc76f4
4 changed files with 20 additions and 24 deletions

View File

@ -25,24 +25,20 @@ if ( !canEdit('System') ) {
if ( $action == 'donate' && isset($_REQUEST['option']) ) {
$option = $_REQUEST['option'];
switch( $option ) {
$nextReminder = time();
switch ( $option ) {
case 'go' :
// Ignore this, the caller will open the page itself
break;
// Ignore this, the caller will open the page itself, use a return to shortut the view=none
return;
case 'hour' :
$nextReminder += 60*60;
case 'day' :
$nextReminder += 24*60*60;
case 'week' :
$nextReminder += 7*24*60*60;
case 'month' :
$nextReminder = time();
if ( $option == 'hour' ) {
$nextReminder += 60*60;
} elseif ( $option == 'day' ) {
$nextReminder += 24*60*60;
} elseif ( $option == 'week' ) {
$nextReminder += 7*24*60*60;
} elseif ( $option == 'month' ) {
$nextReminder += 30*24*60*60;
}
$nextReminder += 30*24*60*60;
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_DONATE_REMINDER_TIME'");
break;
case 'never' :

View File

@ -98,8 +98,8 @@ function getPopupSize( tag, width, height ) {
return popupSize;
}
function zmWindow() {
var zmWin = window.open( 'http://www.zoneminder.com', 'ZoneMinder' );
function zmWindow(sub_url) {
var zmWin = window.open( 'https://www.zoneminder.com'+sub_url, 'ZoneMinder' );
if ( ! zmWin ) {
// if popup blocking is enabled, the popup won't be defined.
console.log("Please disable popup blocking.");

View File

@ -24,13 +24,13 @@ if ( !canEdit('System') ) {
}
$options = array(
"go" => translate('DonateYes'),
"hour" => translate('DonateRemindHour'),
"day" => translate('DonateRemindDay'),
"week" => translate('DonateRemindWeek'),
"month" => translate('DonateRemindMonth'),
"never" => translate('DonateRemindNever'),
"already" => translate('DonateAlready'),
'go' => translate('DonateYes'),
'hour' => translate('DonateRemindHour'),
'day' => translate('DonateRemindDay'),
'week' => translate('DonateRemindWeek'),
'month' => translate('DonateRemindMonth'),
'never' => translate('DonateRemindNever'),
'already' => translate('DonateAlready'),
);
$focusWindow = true;

View File

@ -1,3 +1,3 @@
if ( action == "donate" && option == "go" ) {
zmWindow();
if ( action == 'donate' && option == 'go' ) {
zmWindow('/donate/');
}