示例#1
0
文件: cron.php 项目: NewRoute/lglib
function LGLIB_backup_database()
{
    global $_VARS, $_TABLES;
    $interval = (int) $_VARS['db_backup_interval'];
    if ($interval > -1) {
        // if cron backups not disabled
        $lastrun = (int) $_VARS['db_backup_lastrun'];
        if ($interval == 0 || !$lastrun || $lastrun < time() - $interval) {
            // time to run again
            USES_lglib_class_dbbackup();
            $backup = new dbBackup();
            $backup->cron_backup();
        }
    }
}
示例#2
0
文件: index.php 项目: JohnToro/lglib
$expected = array('dobackup', 'fragment', 'backup', 'download', 'delete', 'config', 'saveconfig');
foreach ($expected as $provided) {
    if (isset($_POST[$provided])) {
        $action = $provided;
    } elseif (isset($_GET[$provided])) {
        $action = $provided;
    }
}
$content = '';
switch ($action) {
    case 'backup':
        if (SEC_checkToken()) {
            if ($_VARS['lglib_dbback_mysqldump']) {
                $display .= DBADMIN_backup();
            } else {
                USES_lglib_class_dbbackup();
                $backup = new dbBackup();
                $backup->perform_backup();
                $backup->Purge();
                $view = 'list';
            }
        } else {
            COM_accessLog("User {$_USER['username']} tried to illegally backup the database and failed CSRF checks.");
            echo COM_refresh($_CONF['site_admin_url'] . '/index.php');
        }
        break;
    case 'download':
        $file = '';
        if (isset($_GET['file'])) {
            $file = preg_replace('/[^a-zA-Z0-9\\-_\\.]/', '', COM_applyFilter($_GET['file']));
            $file = str_replace('..', '', $file);