| ... | ... |
@@ -6,6 +6,8 @@ |
| 6 | 6 |
// Based on eFiction 1.1 |
| 7 | 7 |
// Copyright (C) 2003 by Rebecca Smallwood. |
| 8 | 8 |
// http://efiction.sourceforge.net/ |
| 9 |
+// |
|
| 10 |
+// Size fix / UTF-8 feature 2016-05-18 |
|
| 9 | 11 |
// ---------------------------------------------------------------------- |
| 10 | 12 |
// LICENSE |
| 11 | 13 |
// |
| ... | ... |
@@ -51,33 +53,31 @@ if(!isADMIN) die( ); |
| 51 | 53 |
|
| 52 | 54 |
// Database backup |
| 53 | 55 |
function datadump ($table) {
|
| 54 |
- $result .= "# Dump of $table \r\n"; |
|
| 55 |
- $result .= "# Dump DATE : " . date("d-M-Y") ."\r\n\r\n";
|
|
| 56 |
+ echo "# Dump of $table \r\n"; |
|
| 57 |
+ echo "# Dump DATE : " . date("d-M-Y") ."\r\n\r\n";
|
|
| 56 | 58 |
|
| 57 | 59 |
$tabledata = dbquery("SELECT * FROM $table");
|
| 58 | 60 |
|
| 59 | 61 |
while($t = dbassoc($tabledata)) {
|
| 60 |
- $result .= "INSERT INTO ".$table." "; |
|
| 62 |
+ echo "INSERT INTO ".$table." "; |
|
| 61 | 63 |
$row = array( ); |
| 62 | 64 |
foreach($t AS $field => $value) {
|
| 63 | 65 |
$value = escapestring($value); |
| 64 |
- $value = ereg_replace("\n","\\n",$value);
|
|
| 66 |
+ $value = str_replace("\n","\\n",$value);
|
|
| 65 | 67 |
if (isset($value)) $row[$field] = "\"$value\""; |
| 66 | 68 |
else $row[$field] = "\"\""; |
| 67 | 69 |
} |
| 68 |
- $result .= "VALUES(".implode(", ", $row).");\r\n";
|
|
| 70 |
+ echo "VALUES(".implode(", ", $row).");\r\n";
|
|
| 69 | 71 |
} |
| 70 |
- return $result . "\r\n\r\n\r\n"; |
|
| 72 |
+ echo "\r\n\r\n\r\n"; |
|
| 71 | 73 |
} |
| 72 | 74 |
|
| 73 | 75 |
$alltables = dbquery("SHOW TABLES");
|
| 74 |
- $content = ""; |
|
| 76 |
+ |
|
| 75 | 77 |
while ($table = dbassoc($alltables)) {
|
| 76 |
- foreach ($table as $db => $tablename) {
|
|
| 77 |
- $content .= datadump($tablename); |
|
| 78 |
- } |
|
| 78 |
+ datadump(current($table)); |
|
| 79 | 79 |
} |
| 80 |
- echo $content; |
|
| 80 |
+ |
|
| 81 | 81 |
if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
|
| 82 | 82 |
exit( ); |
| 83 | 83 |
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,84 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// eFiction 3.0 |
|
| 4 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 5 |
+// Valid HTML 4.01 Transitional |
|
| 6 |
+// Based on eFiction 1.1 |
|
| 7 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 8 |
+// http://efiction.sourceforge.net/ |
|
| 9 |
+// ---------------------------------------------------------------------- |
|
| 10 |
+// LICENSE |
|
| 11 |
+// |
|
| 12 |
+// This program is free software; you can redistribute it and/or |
|
| 13 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 14 |
+// as published by the Free Software Foundation; either version 2 |
|
| 15 |
+// of the License, or (at your option) any later version. |
|
| 16 |
+// |
|
| 17 |
+// This program is distributed in the hope that it will be useful, |
|
| 18 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 |
+// GNU General Public License for more details. |
|
| 21 |
+// |
|
| 22 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 23 |
+// ---------------------------------------------------------------------- |
|
| 24 |
+ |
|
| 25 |
+define("_BASEDIR", "../");
|
|
| 26 |
+include("../config.php");
|
|
| 27 |
+ |
|
| 28 |
+$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'");
|
|
| 29 |
+$settings = dbassoc($settingsresults); |
|
| 30 |
+foreach($settings as $var => $val) {
|
|
| 31 |
+ $$var = stripslashes($val); |
|
| 32 |
+ $settings[$var] = htmlspecialchars($val); |
|
| 33 |
+} |
|
| 34 |
+if(!defined("SITEKEY")) define("SITEKEY", $settings['sitekey']);
|
|
| 35 |
+unset($settings['sitekey']); |
|
| 36 |
+if(!defined("TABLEPREFIX")) define("TABLEPREFIX", $settings['tableprefix']);
|
|
| 37 |
+unset($settings['tableprefix']); |
|
| 38 |
+$debug = 0; |
|
| 39 |
+include("../languages/".$language.".php");
|
|
| 40 |
+include("../languages/".$language."_admin.php");
|
|
| 41 |
+$file_name = str_replace(" ", "_", $sitename).date("m-d-Y").".sql";
|
|
| 42 |
+Header("Content-type: application/octet-stream");
|
|
| 43 |
+Header("Content-Disposition: attachment; filename='$file_name'");
|
|
| 44 |
+ |
|
| 45 |
+session_start( ); |
|
| 46 |
+require_once("../includes/queries.php");
|
|
| 47 |
+require_once("../includes/get_session_vars.php");
|
|
| 48 |
+$debug = false; // Because we don't want debug info mucking up our backup. |
|
| 49 |
+ |
|
| 50 |
+if(!isADMIN) die( ); |
|
| 51 |
+ |
|
| 52 |
+// Database backup |
|
| 53 |
+function datadump ($table) {
|
|
| 54 |
+ $result .= "# Dump of $table \r\n"; |
|
| 55 |
+ $result .= "# Dump DATE : " . date("d-M-Y") ."\r\n\r\n";
|
|
| 56 |
+ |
|
| 57 |
+ $tabledata = dbquery("SELECT * FROM $table");
|
|
| 58 |
+ |
|
| 59 |
+ while($t = dbassoc($tabledata)) {
|
|
| 60 |
+ $result .= "INSERT INTO ".$table." "; |
|
| 61 |
+ $row = array( ); |
|
| 62 |
+ foreach($t AS $field => $value) {
|
|
| 63 |
+ $value = escapestring($value); |
|
| 64 |
+ $value = ereg_replace("\n","\\n",$value);
|
|
| 65 |
+ if (isset($value)) $row[$field] = "\"$value\""; |
|
| 66 |
+ else $row[$field] = "\"\""; |
|
| 67 |
+ } |
|
| 68 |
+ $result .= "VALUES(".implode(", ", $row).");\r\n";
|
|
| 69 |
+ } |
|
| 70 |
+ return $result . "\r\n\r\n\r\n"; |
|
| 71 |
+} |
|
| 72 |
+ |
|
| 73 |
+ $alltables = dbquery("SHOW TABLES");
|
|
| 74 |
+ $content = ""; |
|
| 75 |
+ while ($table = dbassoc($alltables)) {
|
|
| 76 |
+ foreach ($table as $db => $tablename) {
|
|
| 77 |
+ $content .= datadump($tablename); |
|
| 78 |
+ } |
|
| 79 |
+ } |
|
| 80 |
+ echo $content; |
|
| 81 |
+ if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
|
|
| 82 |
+ exit( ); |
|
| 83 |
+ |
|
| 84 |
+?> |
|
| 0 | 85 |
\ No newline at end of file |