$db = new Database($_SESSION[COOKIENAME . 'currentDB']); $db->registerUserFunction($custom_functions); if ($_POST['import_type'] == "sql") { $data = file_get_contents($_FILES["file"]["tmp_name"]); $importSuccess = $db->import_sql($data); } else { $field_terminate = $_POST['import_csv_fieldsterminated']; $field_enclosed = $_POST['import_csv_fieldsenclosed']; $field_escaped = $_POST['import_csv_fieldsescaped']; $null = $_POST['import_csv_replacenull']; $fields_in_first_row = isset($_POST['import_csv_fieldnames']); $importSuccess = $db->import_csv($_FILES["file"]["tmp_name"], $_POST['single_table'], $field_terminate, $field_enclosed, $field_escaped, $null, $fields_in_first_row); } } //- Download (backup) a database file (as SQLite file, not as dump) if (isset($_GET['download']) && isManagedDB($_GET['download']) !== false) { header("Content-type: application/octet-stream"); header('Content-Disposition: attachment; filename="' . basename($_GET['download']) . '";'); header("Pragma: no-cache"); header("Expires: 0"); readfile($_GET['download']); exit; } } //- HTML: output starts here header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <!-- Copyright <?php
// only rename? $newpath = $oldpath_parts['dirname'] . DIRECTORY_SEPARATOR . basename($_POST['newname']); if ($newpath != $_POST['newname'] && $subdirectories) { // it seems that the file should not only be renamed but additionally moved. // we need to make sure it stays within $directory... $new_realpath = realpath($newpath_parts['dirname']) . DIRECTORY_SEPARATOR; $directory_realpath = realpath($directory) . DIRECTORY_SEPARATOR; if (strpos($new_realpath, $directory_realpath) === 0) { // its okay, the new directory is within $directory $newpath = $_POST['newname']; } else { die($lang['err'] . ': ' . $lang['db_moved_outside']); } } if (checkDbName($newpath)) { $checkDB = isManagedDB($oldpath); if ($checkDB !== false) { rename($oldpath, $newpath); $databases[$checkDB]['path'] = $newpath; $databases[$checkDB]['name'] = basename($newpath); $_SESSION[COOKIENAME . 'currentDB'] = $databases[$checkDB]; $justrenamed = true; } else { die($lang['err'] . ': ' . $lang['rename_only_managed']); } } else { if (is_file($newpath) || is_dir($newpath)) { $dbexists = true; } else { $extension_not_allowed = true; }