2019-01-04 22:26:34 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web action file
|
|
|
|
// Copyright (C) 2019 ZoneMinder LLC
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
if ( !canEdit('System') ) {
|
2019-02-22 22:19:07 +08:00
|
|
|
ZM\Warning('Need System permissions to update donation');
|
2019-01-04 22:26:34 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $action == 'donate' && isset($_REQUEST['option']) ) {
|
|
|
|
$option = $_REQUEST['option'];
|
|
|
|
switch( $option ) {
|
|
|
|
case 'go' :
|
2019-03-06 02:10:04 +08:00
|
|
|
// Ignore this, the caller will open the page itself
|
|
|
|
break;
|
2019-01-04 22:26:34 +08:00
|
|
|
case 'hour' :
|
|
|
|
case 'day' :
|
|
|
|
case 'week' :
|
|
|
|
case 'month' :
|
2019-03-06 02:10:04 +08:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_DONATE_REMINDER_TIME'");
|
|
|
|
break;
|
2019-01-04 22:26:34 +08:00
|
|
|
case 'never' :
|
|
|
|
case 'already' :
|
2019-03-06 02:10:04 +08:00
|
|
|
dbQuery("UPDATE Config SET Value = '0' WHERE Name = 'ZM_DYN_SHOW_DONATE_REMINDER'");
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
Warning("Unknown value for option in donate: $option");
|
|
|
|
break;
|
2019-01-04 22:26:34 +08:00
|
|
|
} // end switch option
|
2019-03-06 02:10:04 +08:00
|
|
|
$view = 'none';
|
2019-01-04 22:26:34 +08:00
|
|
|
}
|
|
|
|
?>
|