/** * This file is a part of MyWebSQL package * * @file: modules/download.php * @author Samnan ur Rehman * @copyright (c) 2008-2012 Samnan ur Rehman * @web http://mywebsql.net * @license http://mywebsql.net/license */ function processRequest(&$db) { if (!ini_get('safe_mode')) { set_time_limit(0); } Session::close(); switch ($_REQUEST['id']) { case 'backup': include_once BASE_PATH . "/config/backups.php"; $compression = v($_REQUEST['compression']); $file = get_backup_filename($compression); include_once BASE_PATH . "/lib/output.php"; $output = new Output($file, $compression); $message = '<div class="message ui-state-highlight">' . __('Database backup successfully created') . '</div>'; if ($output->is_valid()) { downloadDatabase($db, false); $output->end(); } else { $message = '<div class="error ui-state-highlight">' . __('Failed to create database backup') . '</div>'; } echo view('backup', array('MESSAGE' => $message), $db->getObjectList()); break; case 'exportres': downloadResults($db); break; case 'exporttbl': downloadTable($db, $_REQUEST['name']); break; case 'export': downloadDatabase($db); break; } }
// if (have_panel_permissions($s_login['user'], 'adm_backup')) { if (isset($_POST['adm_backup_doit'])) { $s_backup = array('target' => get_request_data('adm_bu_target'), 'mdonly' => (bool) get_request_data('adm_bu_mdonly'), 'mdoldstyle' => (bool) get_request_data('adm_bu_mdoldstyle'), 'transport' => (bool) get_request_data('adm_bu_transport'), 'convert' => (bool) get_request_data('adm_bu_convert'), 'nogc' => (bool) get_request_data('adm_bu_nogc'), 'ignorecs' => (bool) get_request_data('adm_bu_ignorecs'), 'ignorelt' => (bool) get_request_data('adm_bu_ignorelt'), 'verbose' => (bool) get_request_data('adm_bu_verbose')); } if (isset($_POST['adm_backup_doit']) && !empty($s_backup['target'])) { $s_sysdba_pw = get_sysdba_pw(); $backup_options = array('mdonly' => IBASE_BKP_METADATA_ONLY, 'mdoldstyle' => IBASE_BKP_OLD_DESCRIPTIONS, 'transport' => IBASE_BKP_NON_TRANSPORTABLE, 'convert' => IBASE_BKP_CONVERT, 'nogc' => IBASE_BKP_NO_GARBAGE_COLLECT, 'ignorecs' => IBASE_BKP_IGNORE_CHECKSUMS, 'ignorelt' => IBASE_BKP_IGNORE_LIMBO); $options = 0; foreach ($backup_options as $idx => $option) { if ($s_backup[$idx]) { $options |= $option; } } $source_db = !empty($s_login['host']) ? $s_login['host'] . ':' . $s_login['database'] : $s_login['database']; $target_file = get_backup_filename($s_backup['target']); if ($s_backup['verbose']) { // remove pending backup-jobs from session $s_iframejobs = array_filter($s_iframejobs, create_function('$a', '$a["job"]!="backup";')); $iframekey_backup = md5(uniqid('backup')); $s_iframejobs[$iframekey_backup] = array('job' => 'backup', 'source' => $source_db, 'target' => $target_file, 'options' => $options, 'timestamp' => time()); } elseif (($service = fbird_service_attach($s_login['host'], $s_login['user'], $s_login['password'])) != FALSE) { $result = fbird_backup($service, $source_db, $target_file, $options, $s_backup['verbose']); $message = nl2br(str_replace(array(chr(0x1) . chr(0xa), 'gbak: '), '', $result)); fbird_service_detach($service); } else { $ib_error = fbird_errmsg(); } } } //