* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')) { include_once ("../lib/lib_common.php"); ReloadIndex('admin'); } include_once '../lib/input_helpers.php'; //////////// Check Droits utilisateur //////////// if (!$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// if(isset($_GET['todo'])) $todo = $_GET['todo']; else $todo = null; $cronfile = SITE_PATH.'config/cron/50_db-backup'; $cronfolder = SITE_PATH.'config/cron/'; $backupFolder = SITE_PATH. 'plugins/' . $plug->getVar('name') . '/backups/'; $cronOptions = array('nocron' => _t('db-backup', 'no-cron'), '0 2 * * *' => _t('db-backup', 'select-daily'), '0 2 * * 7' => _t('db-backup', 'select-weekly'), '0 2 1 * *' => _t('db-backup', 'select-monthly') ); // getting available backups $backup_files = array(); if ($handle = opendir($backupFolder)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != ".htaccess") { array_push($backup_files, $entry); } } closedir($handle); } // sort alphabetically sort($backup_files); if($todo == 'download') { header('Location: ../library/dl.php?file=plugins/'.$plug->getVar('name').'/backups/'.$_GET['file']); } if($todo == 'generate') { include_once($plug->getVar('relative_url') . 'backup.php'); } if(isset($_POST['valider'])) { $mincron = 0; $pieces = explode(' ', $_POST['db-backup-scheduled']); if($_POST['db-backup-scheduled'] == 'nocron') { // we delete the new cron file if(file_exists($cronfile)) unlink($cronfile); } else { if(is_numeric($_POST['db-backup-minutes']) && $_POST['db-backup-minutes'] < 60 && $_POST['db-backup-minutes'] >= 0) $mincron = $_POST['db-backup-minutes']; $pieces[0] = $mincron; // we update values if needed // we create the new cron file $command = implode(' ', $pieces) . ' '. $plug->getVar('relative_url') . 'backup.php' ; file_put_contents($cronfile, $command); } $a = array( 'backup-scheduled' => $_POST['db-backup-scheduled']); if(isset($_POST['db-backup-library'])) $a = array_merge($a, array('backup-library' => 1)); if(isset($_POST['db-backup-plugins'])) $a = array_merge($a, array('backup-plugins' => 1)); if(isset($_POST['db-backup-minutes'])) $a = array_merge($a, array('backup-minutes' => $mincron)); $r =$plug->storeValues($a, $sql_object); if($r) { $update_msg = _t('db-backup', 'update-succesful'); } } $options = $plug->retrieveValues($sql_object); isset($options['backup-minutes']) ? $minutes = $options['backup-minutes'] : $minutes = 0; isset($options['backup-scheduled']) ? $schedule = $options['backup-scheduled'] : $schedule = 'nocron'; isset($options['backup-library']) ? $prefix_exclude = 'checked' : $prefix_exclude = ''; isset($options['backup-library']) ? $performLibraryBackup = 'libraryBackup=true' : $performLibraryBackup = 'libraryBackup=false'; isset($options['backup-plugins']) ? $prefix_excludeP = 'checked' : $prefix_excludeP = ''; isset($options['backup-plugins']) ? $performPluginsBackup = 'pluginsBackup=true' : $performPluginsBackup = 'pluginsBackup=false'; ?>
'.$update_msg.'
'; ?> '.$error.'
'; ?> '.sprintf(_t('db-backup', 'cron-not-writable'), $cronfolder).''; } ?>


:
>
:
>

:

'.sprintf(_t('db-backup', 'not-writable'), $backupFolder).''; } ?>