schedule-settings.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. $schedule_action = get_input("schedule-action");
  3. $enable_schedule = get_input("enable-schedule");
  4. $schedule_period = get_input("schedule-period");
  5. $schedule_delete = get_input("schedule-delete");
  6. $backup_options = get_input("backup_options");
  7. $ftp_enable = get_input("ftp-enable", false);
  8. $ftp = get_input("ftp", false);
  9. if (!$backup_options) {
  10. register_error(elgg_echo('backup-tool:settings:error:backup_options'));
  11. } else {
  12. elgg_set_plugin_setting('backup_options', serialize($backup_options), 'backup-tool');
  13. if ($schedule_action == elgg_echo("backuptool:schedule:button:enable")) {
  14. $enable_schedule = true;
  15. elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
  16. system_messages(elgg_echo("backup-tool:settings:success:enable"));
  17. } elseif ($schedule_action == elgg_echo("backuptool:schedule:button:disable")) {
  18. $enable_schedule = false;
  19. elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
  20. system_messages(elgg_echo("backup-tool:settings:success:disable"));
  21. } else {
  22. system_messages(elgg_echo("backup-tool:settings:success"));
  23. }
  24. elgg_set_plugin_setting('schedule_period', $schedule_period, 'backup-tool');
  25. elgg_set_plugin_setting('schedule_delete', $schedule_delete, 'backup-tool');
  26. //save ftp settings
  27. elgg_set_plugin_setting('ftp_enable', $ftp_enable[0], 'backup-tool');
  28. elgg_set_plugin_setting('ftp', serialize($ftp), 'backup-tool');
  29. }