echo "<div style='float:left;'>" . $lang['fld_enclosed'] . "</div>"; echo "<input type='text' value='\"' name='export_csv_fieldsenclosed' style='float:right;'/>"; echo "<div style='clear:both;'></div>"; echo "<div style='float:left;'>" . $lang['fld_escaped'] . "</div>"; echo "<input type='text' value='\\' name='export_csv_fieldsescaped' style='float:right;'/>"; echo "<div style='clear:both;'></div>"; echo "<div style='float:left;'>" . $lang['rep_null'] . "</div>"; echo "<input type='text' value='NULL' name='export_csv_replacenull' style='float:right;'/>"; echo "<div style='clear:both;'></div>"; echo "<label><input type='checkbox' name='export_csv_crlf'/> " . $lang['rem_crlf'] . "</label><br/>"; echo "<label><input type='checkbox' checked='checked' name='export_csv_fieldnames'/> " . $lang['put_fld'] . "</label>"; echo "</fieldset>"; echo "<div style='clear:both;'></div>"; echo "<br/><br/>"; echo "<fieldset><legend><b>" . $lang['save_as'] . "</b></legend>"; $file = pathinfo($db->getPath()); $name = $file['filename']; echo "<input type='text' name='filename' value='" . htmlencode($name) . "_" . htmlencode($target_table) . "_" . date("Y-m-d") . ".dump' style='width:400px;'/> <input type='submit' name='export' value='" . $lang['export'] . "' class='btn'/>"; echo "</fieldset>"; echo "</form>"; echo "<div class='confirm' style='margin-top: 2em'>" . sprintf($lang['backup_hint'], "<a href='?download=" . urlencode($currentDB['path']) . "' title='" . $lang['backup'] . "'>" . $lang["backup_hint_linktext"] . "</a>") . "</div>"; break; //- Import table (=table_import) //- Import table (=table_import) case "table_import": if (isset($_POST['import'])) { echo "<div class='confirm'>"; if ($importSuccess === true) { echo $lang['import_suc']; } else { echo $lang['err'] . ': ' . $importSuccess;
echo "<fieldset style='float:left; width:260px; margin-right:20px;'><legend><b>Export</b></legend>"; echo "<input type='hidden' value='" . $_GET['table'] . "' name='single_table'/>"; echo "<input type='radio' name='export_type' checked='checked' value='sql'/> SQL"; echo "</fieldset>"; echo "<fieldset style='float:left;'><legend><b>Options</b></legend>"; echo "<input type='checkbox' checked='checked' name='structure'/> Export with structure [<a onmouseover='tooltip.show(\"Creates the queries to add the tables and their columns\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='data'/> Export with data [<a onmouseover='tooltip.show(\"Creates the queries to insert the table rows\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' name='drop'/> Add DROP TABLE [<a onmouseover='tooltip.show(\"Creates the queries to remove the tables before potentially adding them so that errors do not occur if they already exist\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='transaction'/> Add TRANSACTION [<a onmouseover='tooltip.show(\"Performs queries within transactions so that if an error occurs, the table is not returned to a partially incomplete and unusable state\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='comments'/> Comments [<a onmouseover='tooltip.show(\"Adds comments to the file to explain what is happening in each part of it\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "</fieldset>"; echo "<div style='clear:both;'></div>"; echo "<br/><br/>"; echo "<fieldset style='float:left;'><legend><b>Save As</b></legend>"; echo "<input type='hidden' name='database_num' value='" . $_SESSION[COOKIENAME . 'currentDB'] . "'/>"; $file = pathinfo($db->getPath()); $name = $file['filename']; echo "<input type='text' name='filename' value='" . $name . "." . $_GET['table'] . "." . date("n-j-y") . ".dump' style='width:400px;'/> <input type='submit' name='export' value='Export' class='btn'/>"; echo "</fieldset>"; echo "</form>"; break; /////////////////////////////////////////////// import table /////////////////////////////////////////////// import table case "table_import": if (isset($_POST['import'])) { echo "<div class='confirm'>"; if ($importSuccess === true) { echo "Import was successful."; } else { echo $importSuccess; }
} else { echo "class='tab'"; } echo ">Structure</a>"; echo "<a href='" . PAGE . "?view=sql' "; if ($view == "sql") { echo "class='tab_pressed'"; } else { echo "class='tab'"; } echo ">SQL</a>"; echo "<div style='clear:both;'></div>"; echo "<div id='main'>"; if ($view == "structure") { echo "<b>Database name</b>: " . $db->getName() . "<br/>"; echo "<b>Path to database</b>: " . $db->getPath() . "<br/>"; echo "<b>Size of database</b>: " . $db->getSize() . "<br/>"; echo "<b>Database last modified</b>: " . $db->getDate() . "<br/>"; echo "<b>SQLite version of database</b>: " . $db->getVersion() . "<br/>"; echo "<b>PHP extension used</b>: " . $db->getType() . "<br/><br/>"; $query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"; $result = $db->selectArray($query); $j = 0; for ($i = 0; $i < sizeof($result); $i++) { if (substr($result[$i]['name'], 0, 7) != "sqlite_" && $result[$i]['name'] != "") { $j++; } } if ($j == 0) { echo "No tables in database.<br/><br/>"; } else {
echo "<fieldset style='float:left; width:260px; margin-right:20px;'><legend><b>Export</b></legend>"; echo "<input type='hidden' value='" . $_GET['table'] . "' name='single_table'/>"; echo "<input type='radio' name='export_type' checked='checked' value='sql'/> SQL"; echo "</fieldset>"; echo "<fieldset style='float:left;'><legend><b>Options</b></legend>"; echo "<input type='checkbox' checked='checked' name='structure'/> Export with structure [<a onmouseover='tooltip.show(\"Creates the queries to add the tables and their columns\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='data'/> Export with data [<a onmouseover='tooltip.show(\"Creates the queries to insert the table rows\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' name='drop'/> Add DROP TABLE [<a onmouseover='tooltip.show(\"Creates the queries to remove the tables before potentially adding them so that errors do not occur if they already exist\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='transaction'/> Add TRANSACTION [<a onmouseover='tooltip.show(\"Performs queries within transactions so that if an error occurs, the table is not returned to a partially incomplete and unusable state\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "<input type='checkbox' checked='checked' name='comments'/> Comments [<a onmouseover='tooltip.show(\"Adds comments to the file to explain what is happening in each part of it\");' onmouseout='tooltip.hide();'>?</a>]<br/>"; echo "</fieldset>"; echo "<div style='clear:both;'></div>"; echo "<br/><br/>"; echo "<fieldset style='float:left;'><legend><b>Save As</b></legend>"; echo "<input type='hidden' name='database_num' value='" . $_SESSION['currentDB'] . "'/>"; echo "<input type='text' name='filename' value='" . $db->getPath() . "." . $_GET['table'] . "." . date("n-j-y") . ".dump' style='width:400px;'/> <input type='submit' name='export' value='Export' class='btn'/>"; echo "</fieldset>"; echo "</form>"; break; /////////////////////////////////////////////// import table /////////////////////////////////////////////// import table case "table_import": if (isset($_POST['import'])) { echo "<div class='confirm'>"; echo "Import was successful."; echo "</div><br/>"; } echo "<form method='post' action='" . PAGE . "?table=" . $_GET['action'] . "&action=table_import' enctype='multipart/form-data'>"; echo "<fieldset><legend><b>File to import</b></legend>"; echo "<input type='radio' name='export_type' checked='checked' value='sql'/> SQL"; echo "<br/><br/>";
echo "<input type='text' value='\\' name='export_csv_fieldsescaped' style='float:right;'/>"; echo "<div style='clear:both;'>"; echo "<div style='float:left;'>Lines terminated by</div>"; echo "<input type='text' value='AUTO' name='export_csv_linesterminated' style='float:right;'/>"; echo "<div style='clear:both;'>"; echo "<div style='float:left;'>Replace NULL by</div>"; echo "<input type='text' value='NULL' name='export_csv_replacenull' style='float:right;'/>"; echo "<div style='clear:both;'>"; echo "<input type='checkbox' name='export_csv_crlf'/> Remove CRLF characters within fields<br/>"; echo "<input type='checkbox' checked='checked' name='export_csv_fieldnames'/> Put field names in first row"; echo "</fieldset>"; echo "<div style='clear:both;'></div>"; echo "<br/><br/>"; echo "<fieldset style='float:left;'><legend><b>Save As</b></legend>"; echo "<input type='hidden' name='database_num' value='" . $_SESSION[COOKIENAME . 'currentDB'] . "'/>"; $file = pathinfo($db->getPath()); $name = $file['filename']; echo "<input type='text' name='filename' value='" . $name . "." . $_GET['table'] . "." . date("n-j-y") . ".dump' style='width:400px;'/> <input type='submit' name='export' value='Export' class='btn'/>"; echo "</fieldset>"; echo "</form>"; break; /////////////////////////////////////////////// import table /////////////////////////////////////////////// import table case "table_import": if (isset($_POST['import'])) { echo "<div class='confirm'>"; if ($importSuccess === true) { echo "Import was successful."; } else { echo $importSuccess; }