commit 25d3a3ee93ee3adfc9790a9a2531e169f9a9c2cd Author: DSB Date: Fri Jun 10 22:58:43 2011 +0000 diff --git a/ReadMe/ReadMe.txt b/ReadMe/ReadMe.txt new file mode 100644 index 0000000..e270cd8 --- /dev/null +++ b/ReadMe/ReadMe.txt @@ -0,0 +1,15 @@ +MySqlDumper Copyright (C)2004-2007 Daniel Schlichtholz (admin@daniel-schlichtholz.de) & Steffen Kamper + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 675 Mass +Ave, Cambridge, MA 02139, USA. diff --git a/ReadMe/changelog.txt b/ReadMe/changelog.txt new file mode 100644 index 0000000..a8b31ff --- /dev/null +++ b/ReadMe/changelog.txt @@ -0,0 +1,135 @@ +Changelog (from Version 1.21 to 1.22): + +Added: +- used character set is shown while backing up with PHP +- used character set is shown while restoring + +Deleted: +- removed some old no longer needed debug-features to speed up backup & restore + +Deleted: +- removed old function "WritePageParams" which is no longer used +- removed some checkings for temp-files that are no longer created (this will speed up the backup and restore progress!) + +Bugfix: unwanted vars have been saved to parameter.php (array $config_dont_save was not recognized - possible mysql character sets have been savedto parameter.php by accident). Fixed. + +Added: Set HTML-output of crondump.pl to utf-8 + +Bugfix: PHP-Emails were still sent in ISO, so some special chars were shown incorrectly. Fixed Emailheader to be utf8. + +Added: sendmail call from configuration is now interpretd by crondump.pl (no more need to fix it manually in crondump.pl) + +Added: security - recursively cleaning tags in $_REQUEST-Array (now walks through sub-arrays) + +Bugfix: filemanagement.php Date of Perlfiles were shown incorrectly. Fixed + +Bugfix for Firefox: replaced some & in links by & + +Bugfix: Filemanagement - Selected Encoding got lost on some servers. Fixed. + +Bugfix: SQLBrowser - there was still a last bug left when BBCode was activated. Not all columns were shown with interpreted BBCode. Now they do. ;) + +Bugfix: SQLBrowser - warning when editing fields: "undefined var d_collate" - fixed + +Added Feature: SQLBrowser +- in table overview some columns are displayed "human readable" (1 MB instead of 1048576) +- added explaining titles when hovering size (move curosr onto TB and you will see the explanation "TeraByte") + +Bugfix: SQLBrowser - BB-Codes are now reactivated. You can activate BBCode-displaying of any char-row again + +Bugfix: SQLBrowser - fixed some problems with the listing of table overview (fields were sometimes not in the correct row if a field before was empty) + +Added: most wanted features when restoring ;) +- if it is a backupfile of MSD -> get character set automatically and restore file with switching MySQL-connection to correct character set +- let the user choose the charset of backupfile if we can't detect the charset automatically + +Bugfix: enclosed encoding in backticks when writing encoding to dumpfile (problem: encoding is a keyword and must be placed inside backticks) + +Bugfix: for Installation (Warning: mysql_query() [function.mysql-query]: Unable to save result set in +/www/htdocs/xxx/inc/functions.php on line 471") - suppressed Warning by adding @ + +Added: Toolbox - choose character set and collation separatly when creating new tables + +Added: Toolbox - language var for charset added + +Bugfix: Toolbox - charset and collation was not surrounded by backticks. Error when using charset "binary". Fixed. + +Bugfix: fixed some validation errors in sqlbrowser + +Bugfix: filemanagement -> bugfix for coloring table rows when listing backup-files + +Bugfix: SQLBrowser: undefined index 'Name' + +Added: SQLBrowser - edit table structure: Charset-Listing is now sorted alphabetically + +Bugfix: when editing Records in SQLBrowser the tablename got lost + +Fixed some missing lang-vars in language pack "de-Du" + +Added feature: when backing up via PHP one now can choose the encoding of the backupfile (standard encoding of MySQL-Server is pre-selected) +SET NAMES character_set now also is written into backupfile when using PHP + +Added: Implemented detection of possible character_sets of MySQL-Server for MySQL 4.0 and 4.1 and higher + +Added: some language-vars for output (language-packs are updatet) + +Bugfix: SQL-Browser: fixed a problem when deleting tables + +Added: some language-vars (I found some fixed text-outputs) + +Security: began to secure some of the included files. They can't be accessed directly now (still some more to do) + +Update crondump.pl: +- security: crondump.pl won't do anything if the passed config-parameter contains ":" (should prevent unsecured installations from including external evil configurations) +- translated some German outputs to English +- removed some unnecessary breaks and hr's in logfiles and screen-outputs +- adorned output in some other ways +- added the possibility to include and evaluate the new .conf.php-file + +Bugfix for warning: undefined index cronfile_savepath + +Added feature: show file encoding in filemangement + +Security: Perl configuration file is named .conf.php - corrected configuration (config_overview) to get the correct filelist according to the new filenames + +Bugfix crondump.pl: when using Multipart and Multidump together the partcounter was not reset to 1 (Part1 of the next database was named part_(part of last database+1) + +Added Charset-var: preparing the manual choose of the encoding of the backupfile + +Added charset-var to statusline in order to show it in filemanagement.PHP/msd/trunk/msd_cron/crondump.pl + +Bugfix: SET NAMES $charset; has been placed before each table - now it is just written once into each backupfile + +Bugfix Perlscript: Use of uninitialized value in concatenation (.) or string + +Added: Perlscript crondump.pl: +- When backing up, Perl now sets the connection to MySQL to utf8 +- added output "SET NAMES utf8" to Dumpfile. This way MySQL is switched to utf8 when restoring + +Added: Delete older perl configuration files + +Added: Security issue for typo3 + +Bugfix for undefined Index-Notices in SQLBrowser + +anti vulnerable patch in sql.php + +Bugfix: when using InnoDbs nr of records was shown wrong in databaseoverview (Not really a bug because MySQL itself returns the wrong sum - bypassing this by using SELECT count(*) ) + +Added: output of used Perl compress::zlib version number in perltest.pl + +Bugfix: failure when using the converter and the backup contains "decimal" fields. Backticks were set wrong. Fixed. + +Added: Portsetting of configuration was not recognized by crondump.pl - now you can choose different ports than 3306 + +Bugfix: on some servers some of the configvars in mysqldumper.conf were not saved as 0 but as empty strings. This lead to errore when executing crondump.pl . Fixed by converting those vars to intvalues when saving mysqldumper.conf. + +Bugfix: error unknown var $id in sql.php when changing fields + +Bugfix: menu.php Javscript-Definition completet + +Added some error handling for mysql_search if chosen table is empty + +Added string-conversion for output if connection is not set to utf8 + +Bugfix: JS-Error when selecting a SQL-Command from the SQLLib in other browsers than IE \ No newline at end of file diff --git a/ReadMe/install_deutsch.txt b/ReadMe/install_deutsch.txt new file mode 100644 index 0000000..4639569 --- /dev/null +++ b/ReadMe/install_deutsch.txt @@ -0,0 +1,96 @@ +Installation: + +- lade den Ordner mysqldumper auf Deinen Webspace hoch +- gebe der Datei config.php die Rechte 777 (es ist nicht nötig die Datei config.php von Hand anzupassen! Das erledigt MySQLDumper während der Installation von alleine.) + +- Starte das Script im Browser (http://www.deineDomain.de/mysqldumper/) +- Folge der Installation +- in Schritt 2 (Konfiguration) ändere die Daten (Host, Name, Passwort) der zu verwaltenden Datenbanken + +- MySQLDumper benötigt zum Speichern der Backups verschiedene Unterordner, die mit den Rechten 0777 versehen werden müssen. +MySQLDumper erstellt diese Verzeichnisse automatisch. + +Sollte der Webserver mit dem Einstellung "safe_mode=on" konfiguriert sein (und nur dann! - Ansonsten kannst Du diesen Punkt überspringen. Solltest Du Dir nicht sicher sein, so meldet Dir MySQLDumper dies während der Installation aber auch zuverlässig), so kann MySQLDUmper die Verzeichnisse aufgrund der Serverbeschränkung nicht selbstständig anlegen. +Im Falle von safe_mode=on müssen folgende Ordner von Dir manuell mit Deinem FTP-Programm erstellt und mit den Rechten (CHMOD) 0777 versehen werden: + + - work + - work/backup + - work/config + - work/structure + - work/log +("work/backup" bedeutet, dass im Ordner "work" ein Unterverzeichnis "backup" erstellt wird) + +- Da wir wissen, dass sich viele User nicht die Mühe machen diese ReadMe-Datei zu lesen, werden alle Einstellungen +vom MySQLDumper gewissenhaft überprüft und bei Nicht-Erfüllung jeweils eine entsprechende Bildschirmausgabe gemacht. ;-) + + +- Fertig ! Jetzt kann MySQLDUmper im Browser über http://www.DeineDomain/Dein_MySQLDumper-Verzeichnis/ aufgerufen werden +------------------- + +Verzeichnisschutz erstellen: + +Es ist dringend erforderlich den MySQLDUmper vor Fremdzugriffen zu schützen!!! +Jeder, der Zugriff zum MySQLDUmper hat, kann in der Datenbank beliebige SQL-Befehle ausführen, +die Daten herunterladen oder einfach alle Daten der Datenbank löschen. +Deshalb sollte jeder das MySQLDumper-Verzeichnis durch einen Verzeichnisschutz schützen. +Dies geschieht über eine sogenannte .htaccess-Datei, welche den besten Schutz bietet. +Glücklicherweise bietet MySQLDumper eine eigene Routine, um einen Verzeichnisschutz zu erstellen. +Es gibt aber so viele unterschiedliche Verfahren einen Webserver zu konfigurieren, dass die +automatische Erstellung nicht immer klappt. Dies merkt der Dumper aber und teilt das auch mit. +Sollte Dir MySQLDumepr mitteilen, dass das Anlegen des Schutzes nicht funktioniert hat udn Dich auffordern +manuell eine Datei anzulegen, dann versuche folgendes: + +- gebe dem Hauptverzeichnis des MySQLDumpers mit Deinem FTP-Programm die Rechte 0777 +- starte MySQLDUmper in Deinem Browser und versuche erneut einen Schutz zu erstellen + +- die Angabe der Verschlüsselungsart bezieht sich auf das Betriebssystem des Serers Deines Webspaces! Nicht auf Dein lokales Betriebssystem. In 99% aller Fälle ist die voreingestellte Verschlüsselungsart "Linux und Unix-Systeme (Crypt)" richtig! Ändere diese nur, wenn Du genau weißt, dass Dein Webserver (!) auf Windows läuft + +- nun sollte der Verzeichnisschutz korrekt erstellt werden. Du merkst das daran, dass Du beim nächsten Seitenaufruf +nach den Zugangsdaten gefragt wirst. + +- solltest Du nicht nach den Zugangsdaten gefragt werden, so realisiert Dein Hoster den Verzeichnisschutz auf eine andere Art und Weise. Erkundige Dich bei Deinem Hoster, wie man auf seinem Server einen Verzeichnisschutz erstellen kann. + +- solltest Du immer wieder nach den Zugangsdaten gefragt werden udn diese nicht anerkannt werden, so hast Du die falsche Verschlüsselungsart gewählt. Lösche dann die Dateien .htaccess und .htpasswd im MySQLDumper-Hauptordner - dann bekommst Du wieder Zugriff. Dummerweise gibt es aber auch Hoster + + + +Anleitung für das Perlskript: + +Wer Perl in allen Verzeichnissen ausführen kann, dem reichen folgende Schritte: + +1. Rufe im MySQLDumper die Seite Backup auf. +2. Kopiere den Pfad, der hinter Eintrag in crondump.pl für $absolute_path_of_configdir: steht. +3. öffne die Datei "crondump.pl" im Editor +4. trage den kopierten Pfad dort bei absolute_path_of_configdir ein (keine Leerzeichen) +5. Speicher crondump.pl +6. gebe den Datein die Rechte 755 +6b. Wenn die Endung cgi gewünscht ist, ändere bei allen 3 Dateien die Endung von pl -> cgi (umbenennen) +(ev. 10b+11 von oben) + +Fertig. + +-------------------- +Wenn bei Dir Perl nur innerhalb des Verzeichnisses "cgi-bin" ausgeführt werden kann: + +1. Rufe im MySQLDumper die Seite Backup auf und klicke auf "Backup Perl". +2. Kopiere den Pfad, der hinter Eintrag in crondump.pl für $absolute_path_of_configdir: steht. +3. öffne die Datei "crondump.pl" im Editor +4. trage den kopierten Pfad dort bei absolute_path_of_configdir ein (keine Leerzeichen) +5. Speicher crondump.pl +6. kopiere crondump.pl, sowie perltest.pl und simpletest.pl ins cgi-bin-Verzeichnis (Ascii-Modus im FTP) +7. gebe den Dateien die Rechte 755 +7b. Wenn die Endung cgi gewünscht ist, ändere bei allen 3 Dateien die Endung von pl -> cgi (umbenennen) + +8. Rufe die Konfiguration im MySQLDumper auf +9. wähle Seite Cronscript +10. ändere Perl Ausführungspfad in /cgi-bin/ +10b. wenn die Scripte .pl haben, ändere die Dateiendung auf .cgi +11. speicher die Konfiuguration +------------------------ +fertig, die Skripte lassen sich nun von der Backupseite aufrufen + + +Windowsuser müssen bei allen Scripten die erste Zeile ändern, dort steht der Pfad von Perl. Beispiel: +statt: #!/usr/bin/perl -w +jetzt #!C:\perl\bin\perl.exe -w + diff --git a/ReadMe/install_english.txt b/ReadMe/install_english.txt new file mode 100644 index 0000000..13373dd --- /dev/null +++ b/ReadMe/install_english.txt @@ -0,0 +1,70 @@ +Installation: + +- upload the folder mysqldumper to your webspace +- chmod the file "config.php" to 777 +- start the script in your browser (http://www.deineDomain.de/mysqldumper/) +- Follow the Installationscript +- in step 2 (Configuration) change Data (Host, Name, Password) of your databaseconnection and save +- in case of safe_mode=1 you must create the folders manually. + create following folders in the Scriptdir: + + - work + - work/backup + - work/config + - work/structure + - work/log + + and chmod these folders to 0777 + +- Ready ! + + + +Guidance for the Perl script: + +When you can execute Perl anywhere: + +1. In MySQLDumper switch to the page Backup. +2. Copy the path, that stands behind entry in crondump.pl for $absolute_path_of_configdir: +3. open the file "crondump.pl" in the editor +4. paste the copied path there to the $absolute_path_of_configdir-variable (no blanks,no new line) +5. Save crondump.pl +6. chmod the scripts to 0755. +7. If the ending .cgi is desired, change the ending of all 3 files from .pl to .cgi (rename) +8. If the Scripts are renamed to *.cgi , change Fileextension to cgi in the MySQLDumper Configuration (cronscript) + +Done. + +-------------------------------------- +When perl is only allowed in cgi-bin: + +Many user have a cgi-bin directory, in which Perl can be executed. +This is usually available via Browser http://www.domain.com/cgi-bin/ . + +In this casse do the following steps: + +1. in MySQLDumper call the page Backup and click "Backup Perl". +2. Copy the path, that stands behind entry in crondump.pl for $absolute_path_of_configdir: +3. open the file "crondump.pl" in the editor +4. paste the copied path there with absolute_path_of_configdir (no blanks, no new line) +5. Save crondump.pl +6. copy crondump.pl, as well as perltest.pl and simpletest.pl to the cgi-bin directory (ASCII mode in the ftp-client!) +7. chmod 755 the scripts to 0755. +7b. If the ending cgi is desired, change the ending of all 3 files .pl to .cgi (rename) +8. in MySQLDumper switch to the page Configuration +9. click on Cronscript +10. change the Perl execution path to /cgi-bin/ or ./../cgi-bin (depending on your file-structure. Path is relative from MSD-Dir) +10b. if the Scripts are renamed to *.cgi , change Fileextension to cgi +11 save the Configuration +------------------------------------- + +Ready ! The scripts are now available from the Page "Backup". + + +Windowsuser must change the first line of all Perlscripts, to the path of Perl. + +Example: + +instead of: #!/usr/bin/perl w +now #!C:\perl\bin\perl.exe w + diff --git a/ReadMe/install_francais.txt b/ReadMe/install_francais.txt new file mode 100644 index 0000000..2160204 --- /dev/null +++ b/ReadMe/install_francais.txt @@ -0,0 +1,71 @@ +Installation: + +- Envoyer le répertoire "mysqldumper" sur votre serveur +- Chmoder le fichier "config.php" en 777 +- Débuter le script en saisissant l'adresse suivante dans votre navigateur (http://www.votre_domaine.fr/mysqldumper/) +- Suivez les instructions d'installation du script +- Dans l'étape 2 (Configuration), changer les données (Serveur, Nom, Mot de passe) par ceux fournis par votre hébergeur puis sauvegardez +- Si pour votre serveur le safe_mode=1 vous devez créer manuellement les répertoires suivants: + + créer les répertoires ci-dessous dans le répertoire du Script (mysqldumper/): + + - work + - work/backup + - work/config + - work/structure + - work/log + + et Chmoder ces répertoires en 0777 + +- C'est fini ! + + + +Guide pour le script Perl: + +Si vous pouvez exécuter Perl de tous les fichiers, il vous suffit de suivre les étapes suivantes: + +1. Appeler dans MySQLDumper la page 'Sauvegarde' et cliquer "Backup Perl". +2. Copier le chemin qui se trouve derrière le texte: crondump.pl pour $absolute_path_of_configdir: +3. Ouvrir le fichier "crondump.pl" dans un éditeur +4. et transmettre le chemin que vous avez copié près de absolute_path_of_configdir (sans espace) +5. Sauvegarder crondump.pl +6. Donner les droits CHMOD 755 +7. Si l'extension .cgi est désirée, changer pour les trois fichiers l'extension de .pl vers .cgi (action renommer) +8. Si le script est renommé en *.cgi, changer l'extension du fichier en cgi dans la configuration MySQLDumper (cronscript) + +-C'est fini ! + +-------------------------------------- +Quand perl est seulement laissé dans cgi-bin: + +La plupart ont un répertoire cgi-bin, qui permet d'exécuter en Perl. +Vous pouvez y accéder dans la majeur partie des cas en saisissant l'adresse suivante dans votre navigateur http://www.domaine.com/cgi-bin/. + +Dans ce cas veuillez suivre les étapes suivantes: + +1. Appeler la page 'Sauvegarde' dans MySQLDumper. +2. Copier le chemin qui se trouve derrière le texte: crondump.pl pour $absolute_path_of_configdir: +3. Ouvrir le fichier "crondump.pl" dans un éditeur +4. et transmettre le chemin que vous venez de copier près de absolute_path_of_configdir (sans espace) +5. Sauvegarder crondump.pl +6. Copier crondump.pl, ainsi que perltest.pl et simpletest.pl dans le répertoire cgi-bin (Mode-ASCII par FTP) +7. Donner les droits CHMOD 755 +7b. Si l'extension .cgi est désirée, changer pour les trois fichiers l'extension de .pl vers .cgi (action renommer) +8. Appeller la configuraion dans MySQLDumper +9. Choisir la page script Cron +10. Changer le chemin d'exécution Perl vers /cgi-bin/ou ./../cgi-bin (depend de la structure fichiers. Le chemin est relatif de MSD-Dir) +10b. Si les scripts ont l'extension .cgi, changer l'extension vers .cgi +11. et sauvegarder la configuration + +Voila, c'est terminé, les scripts s'exécutent maintenant d'après la page de sauvegarde. + +---------------------------------------------------------------------------------- + +Les utilisateurs de windows doivent changer la première ligne de tous les scripts de Perls, avec le chemin de Perl. + +Exemple: + +Au lieu de: #!/usr/bin/perl w +Mettre #!C:\perl\bin\perl.exe w + diff --git a/ReadMe/install_italiano.txt b/ReadMe/install_italiano.txt new file mode 100644 index 0000000..b7833c7 --- /dev/null +++ b/ReadMe/install_italiano.txt @@ -0,0 +1,65 @@ +Installazione: + +- carica la cartella mysqldumper sul tuo spazio web +- metti i diritti del file config.php a 777 +- fai partire lo script nel tuo Browser (http://www.il tuo dominio.it/mysqldumper/) +- segui la installazione +- nel secondo passo (configurazione) cambia i tuoi dati (Host, nome, password) della banca dati da gestire + +- nel caso di safe_mode=1 dovete creare le cartelle manualmente. + crea nella cartella di MySQLDumper le cartelle + + - works + - works/backup + - works/config + - works/sturcture + - works/log + + + metti i diritti delle cartelle a 777 + +- finito ! + +Istruzioni Perlskript: + +Molti hanno un elenco con cartella cgi-bin in cui puo essere efettuato Perl. +A maggior parte dei casi questo e raggingibile tramite Browser http://www.domain.de/cgi-bin/. + +Chi puo usare Perl in tutti gli elenchi deve seguire semplicemente i seguenti passi: + +1. Chiama nel MySQLDumper la pagina Backup. +2. Copia il cammino, che è scritto nella crondump.pl per $absolute_path_of_configdir. +3. Apri il dato "crondump.pl" in editor +4. Porta il cammino dove c`è absolute_path_of_configdir (senza spazi) +5. Salva crondump.pl +6. Metti i permessi dei dati a CHMOD 755 +6b. Se preferite cgi, cambiate tutti i 3 dati da pl -> cgi (rinominare) + (ev. 10b+11 da sopra) + +finito. + +--------------------- + +Nel caso che puoi effettuare Perl in "cgi-bin"consigliamo di effettuare i seguenti passi: + +1. Chiama nel MySQLDumper la pagina Backup e clicca "Backup Perl". +2. Copia il cammino, che è scritto nella crondump.pl per $absolute_path_of_configdir: +3. Apri il dato "crondump.pl" in editor +4. Porta il cammino dove c`è absolute_path_of_configdir (senza spazi) +5. Salva crondump.pl +6. Copia crondump.pl, perltest.pl e simpletest.pl nel elenco cgi-bin (nel modo Ascii con FTP) +7. Metti i permessi dei dati in CHMOD 755 +7b. Se preferite cgi come nome del dato, allora cambiate tutti i 3 dati da pl -> cgi (rinominare) + +8. Chiama la configurazione nel MySQLDumper +9. Scegli la pagina Cronscript +10. Cambia l`esecuzione di cammino di Perl in /cgi-bin/ +10b.Se gli script hanno .pl, cambiali in .cgi +11. Salva la configurazione. +--------------------- +Hai finito, i tuoi script si fanno caricare nella tua pagina backup. + +Se usate Windows dovete cambiare in tutti i dati la prima riga; dove trovate il cammino di Perl. Esempio: +aposto di: #!/usr/bin/perl -w +adesso #!C:\perl\bin\perl.exe -w + diff --git a/ReadMe/license_deutsch.txt b/ReadMe/license_deutsch.txt new file mode 100644 index 0000000..64ff14f --- /dev/null +++ b/ReadMe/license_deutsch.txt @@ -0,0 +1,105 @@ +GNU General Public License +Deutsche Übersetzung der Version 2, Juni 1991 + +Copyright © 1989, 1991 Free Software Foundation, Inc. + +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + + +Diese Übersetzung ist kein rechtskräftiger Ersatz für die englischsprachige Originalversion! + + +Vorwort +Die meisten Softwarelizenzen sind daraufhin entworfen worden, Ihnen die Freiheit zu nehmen, die Software weiterzugeben und zu verändern. Im Gegensatz dazu soll Ihnen die GNU General Public License , die Allgemeine Öffentliche GNU-Lizenz, ebendiese Freiheit garantieren. Sie soll sicherstellen, daß die Software für alle Benutzer frei ist. Diese Lizenz gilt für den Großteil der von der Free Software Foundation herausgegebenen Software und für alle anderen Programme, deren Autoren ihr Datenwerk dieser Lizenz unterstellt haben. Auch Sie können diese Möglichkeit der Lizenzierung für Ihre Programme anwenden. (Ein anderer Teil der Software der Free Software Foundation unterliegt stattdessen der GNU Library General Public License , der Allgemeinen Öffentlichen GNU-Lizenz für Bibliotheken.) [Mittlerweile wurde die GNU Library Public License von der GNU Lesser Public License abgelöst - Anmerkung des Übersetzers.] + +Die Bezeichnung ,,freie`` Software bezieht sich auf Freiheit, nicht auf den Preis. Unsere Lizenzen sollen Ihnen die Freiheit garantieren, Kopien freier Software zu verbreiten (und etwas für diesen Service zu berechnen, wenn Sie möchten), die Möglichkeit, die Software im Quelltext zu erhalten oder den Quelltext auf Wunsch zu bekommen. Die Lizenzen sollen garantieren, daß Sie die Software ändern oder Teile davon in neuen freien Programmen verwenden dürfen - und daß Sie wissen, daß Sie dies alles tun dürfen. + +Um Ihre Rechte zu schützen, müssen wir Einschränkungen machen, die es jedem verbieten, Ihnen diese Rechte zu verweigern oder Sie aufzufordern, auf diese Rechte zu verzichten. Aus diesen Einschränkungen folgen bestimmte Verantwortlichkeiten für Sie, wenn Sie Kopien der Software verbreiten oder sie verändern. + +Beispielsweise müssen Sie den Empfängern alle Rechte gewähren, die Sie selbst haben, wenn Sie - kostenlos oder gegen Bezahlung - Kopien eines solchen Programms verbreiten. Sie müssen sicherstellen, daß auch die Empfänger den Quelltext erhalten bzw. erhalten können. Und Sie müssen ihnen diese Bedingungen zeigen, damit sie ihre Rechte kennen. + +Wir schützen Ihre Rechte in zwei Schritten: (1) Wir stellen die Software unter ein Urheberrecht (Copyright), und (2) wir bieten Ihnen diese Lizenz an, die Ihnen das Recht gibt, die Software zu vervielfältigen, zu verbreiten und/oder zu verändern. + +Um die Autoren und uns zu schützen, wollen wir darüberhinaus sicherstellen, daß jeder erfährt, daß für diese freie Software keinerlei Garantie besteht. Wenn die Software von jemand anderem modifiziert und weitergegeben wird, möchten wir, daß die Empfänger wissen, daß sie nicht das Original erhalten haben, damit irgendwelche von anderen verursachte Probleme nicht den Ruf des ursprünglichen Autors schädigen. + +Schließlich und endlich ist jedes freie Programm permanent durch Software-Patente bedroht. Wir möchten die Gefahr ausschließen, daß Distributoren eines freien Programms individuell Patente lizensieren - mit dem Ergebnis, daß das Programm proprietär würde. Um dies zu verhindern, haben wir klargestellt, daß jedes Patent entweder für freie Benutzung durch jedermann lizenziert werden muß oder überhaupt nicht lizenziert werden darf. + +Es folgen die genauen Bedingungen für die Vervielfältigung, Verbreitung und Bearbeitung: + + +Allgemeine Öffentliche GNU-Lizenz +Bedingungen für die Vervielfältigung, +Verbreitung und Bearbeitung +§0. Diese Lizenz gilt für jedes Programm und jedes andere Datenwerk, in dem ein entsprechender Vermerk des Copyright-Inhabers darauf hinweist, daß das Datenwerk unter den Bestimmungen dieser General Public License verbreitet werden darf. Im folgenden wird jedes derartige Programm oder Datenwerk als ,,das Programm`` bezeichnet; die Formulierung ,,auf dem Programm basierendes Datenwerk`` bezeichnet das Programm sowie jegliche Bearbeitung des Programms im urheberrechtlichen Sinne, also ein Datenwerk, welches das Programm, auch auszugsweise, sei es unverändert oder verändert und/oder in eine andere Sprache übersetzt, enthält. (Im folgenden wird die Übersetzung ohne Einschränkung als ,,Bearbeitung`` eingestuft.) Jeder Lizenznehmer wird im folgenden als ,,Sie`` angesprochen. + +Andere Handlungen als Vervielfältigung, Verbreitung und Bearbeitung werden von dieser Lizenz nicht berührt; sie fallen nicht in ihren Anwendungsbereich. Der Vorgang der Ausführung des Programms wird nicht eingeschränkt, und die Ausgaben des Programms unterliegen dieser Lizenz nur, wenn der Inhalt ein auf dem Programm basierendes Datenwerk darstellt (unabhängig davon, daß die Ausgabe durch die Ausführung des Programmes erfolgte). Ob dies zutrifft, hängt von den Funktionen des Programms ab. + +§1. Sie dürfen auf beliebigen Medien unveränderte Kopien des Quelltextes des Programms, wie sie ihn erhalten haben, anfertigen und verbreiten. Voraussetzung hierfür ist, daß Sie mit jeder Kopie einen entsprechenden Copyright-Vermerk sowie einen Haftungsausschluß veröffentlichen, alle Vermerke, die sich auf diese Lizenz und das Fehlen einer Garantie beziehen, unverändert lassen und desweiteren allen anderen Empfängern des Programms zusammen mit dem Programm eine Kopie dieser Lizenz zukommen lassen. + +Sie dürfen für den eigentlichen Kopiervorgang eine Gebühr verlangen. Wenn Sie es wünschen, dürfen Sie auch gegen Entgeld eine Garantie für das Programm anbieten. + +§2. Sie dürfen Ihre Kopie(n) des Programms oder eines Teils davon verändern, wodurch ein auf dem Programm basierendes Datenwerk entsteht; Sie dürfen derartige Bearbeitungen unter den Bestimmungen von Paragraph 1 vervielfältigen und verbreiten, vorausgesetzt, daß zusätzlich alle im folgenden genannten Bedingungen erfüllt werden: + + +1. +Sie müssen die veränderten Dateien mit einem auffälligen Vermerk versehen, der auf die von Ihnen vorgenommene Modifizierung und das Datum jeder Änderung hinweist. + +2. +Sie müssen dafür sorgen, daß jede von Ihnen verbreitete oder veröffentlichte Arbeit, die ganz oder teilweise von dem Programm oder Teilen davon abgeleitet ist, Dritten gegenüber als Ganzes unter den Bedingungen dieser Lizenz ohne Lizenzgebühren zur Verfügung gestellt wird. + +3. +Wenn das veränderte Programm normalerweise bei der Ausführung interaktiv Kommandos einliest, müssen Sie dafür sorgen, daß es, wenn es auf dem üblichsten Wege für solche interaktive Nutzung gestartet wird, eine Meldung ausgibt oder ausdruckt, die einen geeigneten Copyright-Vermerk enthält sowie einen Hinweis, daß es keine Gewährleistung gibt (oder anderenfalls, daß Sie Garantie leisten), und daß die Benutzer das Programm unter diesen Bedingungen weiter verbreiten dürfen. Auch muß der Benutzer darauf hingewiesen werden, wie er eine Kopie dieser Lizenz ansehen kann. (Ausnahme: Wenn das Programm selbst interaktiv arbeitet, aber normalerweise keine derartige Meldung ausgibt, muß Ihr auf dem Programm basierendes Datenwerk auch keine solche Meldung ausgeben). + +Diese Anforderungen gelten für das bearbeitete Datenwerk als Ganzes. Wenn identifizierbare Teile des Datenwerkes nicht von dem Programm abgeleitet sind und vernünftigerweise als unabhängige und eigenständige Datenwerke für sich selbst zu betrachten sind, dann gelten diese Lizenz und ihre Bedingungen nicht für die betroffenen Teile, wenn Sie diese als eigenständige Datenwerke weitergeben. Wenn Sie jedoch dieselben Abschnitte als Teil eines Ganzen weitergeben, das ein auf dem Programm basierendes Datenwerk darstellt, dann muß die Weitergabe des Ganzen nach den Bedingungen dieser Lizenz erfolgen, deren Bedingungen für weitere Lizenznehmer somit auf das gesamte Ganze ausgedehnt werden - und somit auf jeden einzelnen Teil, unabhängig vom jeweiligen Autor. + +Somit ist es nicht die Absicht dieses Abschnittes, Rechte für Datenwerke in Anspruch zu nehmen oder Ihnen die Rechte für Datenwerke streitig zu machen, die komplett von Ihnen geschrieben wurden; vielmehr ist es die Absicht, die Rechte zur Kontrolle der Verbreitung von Datenwerken, die auf dem Programm basieren oder unter seiner auszugsweisen Verwendung zusammengestellt worden sind, auszuüben. + +Ferner bringt auch das einfache Zusammenlegen eines anderen Datenwerkes, das nicht auf dem Programm basiert, mit dem Programm oder einem auf dem Programm basierenden Datenwerk auf ein- und demselben Speicher- oder Vertriebsmedium dieses andere Datenwerk nicht in den Anwendungsbereich dieser Lizenz. + +§3. Sie dürfen das Programm (oder ein darauf basierendes Datenwerk gemäß Paragraph 2) als Objectcode oder in ausführbarer Form unter den Bedingungen der Paragraphen 1 und 2 kopieren und weitergeben - vorausgesetzt, daß Sie außerdem eine der folgenden Leistungen erbringen: + + +1. +Liefern Sie das Programm zusammen mit dem vollständigen zugehörigen maschinenlesbaren Quelltext auf einem für den Datenaustausch üblichen Medium aus, wobei die Verteilung unter den Bedingungen der Paragraphen 1 und 2 erfolgen muß. Oder: + +2. +Liefern Sie das Programm zusammen mit einem mindestens drei Jahre lang gültigen schriftlichen Angebot aus, jedem Dritten eine vollständige maschinenlesbare Kopie des Quelltextes zur Verfügung zu stellen - zu nicht höheren Kosten als denen, die durch den physikalischen Kopiervorgang anfallen -, wobei der Quelltext unter den Bedingungen der Paragraphen 1 und 2 auf einem für den Datenaustausch üblichen Medium weitergegeben wird. Oder: + +3. +Liefern Sie das Programm zusammen mit dem schriftlichen Angebot der Zurverfügungstellung des Quelltextes aus, das Sie selbst erhalten haben. (Diese Alternative ist nur für nicht-kommerzielle Verbreitung zulässig und nur, wenn Sie das Programm als Objectcode oder in ausführbarer Form mit einem entsprechenden Angebot gemäß Absatz b erhalten haben.) + +Unter dem Quelltext eines Datenwerkes wird diejenige Form des Datenwerkes verstanden, die für Bearbeitungen vorzugsweise verwendet wird. Für ein ausführbares Programm bedeutet ,,der komplette Quelltext``: Der Quelltext aller im Programm enthaltenen Module einschließlich aller zugehörigen Modulschnittstellen-Definitionsdateien sowie der zur Compilation und Installation verwendeten Skripte. Als besondere Ausnahme jedoch braucht der verteilte Quelltext nichts von dem zu enthalten, was üblicherweise (entweder als Quelltext oder in binärer Form) zusammen mit den Hauptkomponenten des Betriebssystems (Kernel, Compiler usw.) geliefert wird, unter dem das Programm läuft - es sei denn, diese Komponente selbst gehört zum ausführbaren Programm. + +Wenn die Verbreitung eines ausführbaren Programms oder von Objectcode dadurch erfolgt, daß der Kopierzugriff auf eine dafür vorgesehene Stelle gewährt wird, so gilt die Gewährung eines gleichwertigen Zugriffs auf den Quelltext als Verbreitung des Quelltextes, auch wenn Dritte nicht dazu gezwungen sind, den Quelltext zusammen mit dem Objectcode zu kopieren. + +§4. Sie dürfen das Programm nicht vervielfältigen, verändern, weiter lizenzieren oder verbreiten, sofern es nicht durch diese Lizenz ausdrücklich gestattet ist. Jeder anderweitige Versuch der Vervielfältigung, Modifizierung, Weiterlizenzierung und Verbreitung ist nichtig und beendet automatisch Ihre Rechte unter dieser Lizenz. Jedoch werden die Lizenzen Dritter, die von Ihnen Kopien oder Rechte unter dieser Lizenz erhalten haben, nicht beendet, solange diese die Lizenz voll anerkennen und befolgen. + +§5. Sie sind nicht verpflichtet, diese Lizenz anzunehmen, da Sie sie nicht unterzeichnet haben. Jedoch gibt Ihnen nichts anderes die Erlaubnis, das Programm oder von ihm abgeleitete Datenwerke zu verändern oder zu verbreiten. Diese Handlungen sind gesetzlich verboten, wenn Sie diese Lizenz nicht anerkennen. Indem Sie das Programm (oder ein darauf basierendes Datenwerk) verändern oder verbreiten, erklären Sie Ihr Einverständnis mit dieser Lizenz und mit allen ihren Bedingungen bezüglich der Vervielfältigung, Verbreitung und Veränderung des Programms oder eines darauf basierenden Datenwerks. + +§6. Jedesmal, wenn Sie das Programm (oder ein auf dem Programm basierendes Datenwerk) weitergeben, erhält der Empfänger automatisch vom ursprünglichen Lizenzgeber die Lizenz, das Programm entsprechend den hier festgelegten Bestimmungen zu vervielfältigen, zu verbreiten und zu verändern. Sie dürfen keine weiteren Einschränkungen der Durchsetzung der hierin zugestandenen Rechte des Empfängers vornehmen. Sie sind nicht dafür verantwortlich, die Einhaltung dieser Lizenz durch Dritte durchzusetzen. + +§7. Sollten Ihnen infolge eines Gerichtsurteils, des Vorwurfs einer Patentverletzung oder aus einem anderen Grunde (nicht auf Patentfragen begrenzt) Bedingungen (durch Gerichtsbeschluß, Vergleich oder anderweitig) auferlegt werden, die den Bedingungen dieser Lizenz widersprechen, so befreien Sie diese Umstände nicht von den Bestimmungen dieser Lizenz. Wenn es Ihnen nicht möglich ist, das Programm unter gleichzeitiger Beachtung der Bedingungen in dieser Lizenz und Ihrer anderweitigen Verpflichtungen zu verbreiten, dann dürfen Sie als Folge das Programm überhaupt nicht verbreiten. Wenn zum Beispiel ein Patent nicht die gebührenfreie Weiterverbreitung des Programms durch diejenigen erlaubt, die das Programm direkt oder indirekt von Ihnen erhalten haben, dann besteht der einzige Weg, sowohl das Patentrecht als auch diese Lizenz zu befolgen, darin, ganz auf die Verbreitung des Programms zu verzichten. + +Sollte sich ein Teil dieses Paragraphen als ungültig oder unter bestimmten Umständen nicht durchsetzbar erweisen, so soll dieser Paragraph seinem Sinne nach angewandt werden; im übrigen soll dieser Paragraph als Ganzes gelten. + +Zweck dieses Paragraphen ist nicht, Sie dazu zu bringen, irgendwelche Patente oder andere Eigentumsansprüche zu verletzen oder die Gültigkeit solcher Ansprüche zu bestreiten; dieser Paragraph hat einzig den Zweck, die Integrität des Verbreitungssystems der freien Software zu schützen, das durch die Praxis öffentlicher Lizenzen verwirklicht wird. Viele Leute haben großzügige Beiträge zu dem großen Angebot der mit diesem System verbreiteten Software im Vertrauen auf die konsistente Anwendung dieses Systems geleistet; es liegt am Autor/Geber, zu entscheiden, ob er die Software mittels irgendeines anderen Systems verbreiten will; ein Lizenznehmer hat auf diese Entscheidung keinen Einfluß. + +Dieser Paragraph ist dazu gedacht, deutlich klarzustellen, was als Konsequenz aus dem Rest dieser Lizenz betrachtet wird. + +§8. Wenn die Verbreitung und/oder die Benutzung des Programms in bestimmten Staaten entweder durch Patente oder durch urheberrechtlich geschützte Schnittstellen eingeschränkt ist, kann der Urheberrechtsinhaber, der das Programm unter diese Lizenz gestellt hat, eine explizite geographische Begrenzung der Verbreitung angeben, in der diese Staaten ausgeschlossen werden, so daß die Verbreitung nur innerhalb und zwischen den Staaten erlaubt ist, die nicht ausgeschlossen sind. In einem solchen Fall beinhaltet diese Lizenz die Beschränkung, als wäre sie in diesem Text niedergeschrieben. + +§9. Die Free Software Foundation kann von Zeit zu Zeit überarbeitete und/oder neue Versionen der General Public License veröffentlichen. Solche neuen Versionen werden vom Grundprinzip her der gegenwärtigen entsprechen, können aber im Detail abweichen, um neuen Problemen und Anforderungen gerecht zu werden. + +Jede Version dieser Lizenz hat eine eindeutige Versionsnummer. Wenn in einem Programm angegeben wird, daß es dieser Lizenz in einer bestimmten Versionsnummer oder ,,jeder späteren Version`` (``any later version'') unterliegt, so haben Sie die Wahl, entweder den Bestimmungen der genannten Version zu folgen oder denen jeder beliebigen späteren Version, die von der Free Software Foundation veröffentlicht wurde. Wenn das Programm keine Versionsnummer angibt, können Sie eine beliebige Version wählen, die je von der Free Software Foundation veröffentlicht wurde. + +§10. Wenn Sie den Wunsch haben, Teile des Programms in anderen freien Programmen zu verwenden, deren Bedingungen für die Verbreitung anders sind, schreiben Sie an den Autor, um ihn um die Erlaubnis zu bitten. Für Software, die unter dem Copyright der Free Software Foundation steht, schreiben Sie an die Free Software Foundation ; wir machen zu diesem Zweck gelegentlich Ausnahmen. Unsere Entscheidung wird von den beiden Zielen geleitet werden, zum einen den freien Status aller von unserer freien Software abgeleiteten Datenwerke zu erhalten und zum anderen das gemeinschaftliche Nutzen und Wiederverwenden von Software im allgemeinen zu fördern. + + +Keine Gewährleistung + +§11. Da das Programm ohne jegliche Kosten lizenziert wird, besteht keinerlei Gewährleistung für das Programm, soweit dies gesetzlich zulässig ist. Sofern nicht anderweitig schriftlich bestätigt, stellen die Copyright-Inhaber und/oder Dritte das Programm so zur Verfügung, ,,wie es ist``, ohne irgendeine Gewährleistung, weder ausdrücklich noch implizit, einschließlich - aber nicht begrenzt auf - Marktreife oder Verwendbarkeit für einen bestimmten Zweck. Das volle Risiko bezüglich Qualität und Leistungsfähigkeit des Programms liegt bei Ihnen. Sollte sich das Programm als fehlerhaft herausstellen, liegen die Kosten für notwendigen Service, Reparatur oder Korrektur bei Ihnen. + +§12. In keinem Fall, außer wenn durch geltendes Recht gefordert oder schriftlich zugesichert, ist irgendein Copyright-Inhaber oder irgendein Dritter, der das Programm wie oben erlaubt modifiziert oder verbreitet hat, Ihnen gegenüber für irgendwelche Schäden haftbar, einschließlich jeglicher allgemeiner oder spezieller Schäden, Schäden durch Seiteneffekte (Nebenwirkungen) oder Folgeschäden, die aus der Benutzung des Programms oder der Unbenutzbarkeit des Programms folgen (einschließlich - aber nicht beschränkt auf - Datenverluste, fehlerhafte Verarbeitung von Daten, Verluste, die von Ihnen oder anderen getragen werden müssen, oder dem Unvermögen des Programms, mit irgendeinem anderen Programm zusammenzuarbeiten), selbst wenn ein Copyright-Inhaber oder Dritter über die Möglichkeit solcher Schäden unterrichtet worden war. + + +Ende der Bedingungen diff --git a/ReadMe/license_english.txt b/ReadMe/license_english.txt new file mode 100644 index 0000000..13db015 --- /dev/null +++ b/ReadMe/license_english.txt @@ -0,0 +1,88 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +END OF TERMS AND CONDITIONS diff --git a/ReadMe/update_deutsch.txt b/ReadMe/update_deutsch.txt new file mode 100644 index 0000000..d4c8387 --- /dev/null +++ b/ReadMe/update_deutsch.txt @@ -0,0 +1,10 @@ +Update einer älteren MySQLDumper-Version: + +- überschreibe alle Dateien mit denen aus der neuen Version +- rufe MySQLDumper im Browser auf, klicke Dich in die Konfiguration und klicke einmal auf "speichern" +- wenn das crondump.pl-Script per cronjob aufgerufen wird: im Aufruf muss der Parameter config angepasst werden +(bis Version 1.21 hieß er mysqldumper.conf - seit Version 1.22 heißt er mysqldumper.conf.php !) + +Hinweis: +eventuell wirst Du auf dem Wege dahin auf Warnmeldungen stoßen ["undefinde index ..."]. +Diese kannst Du ignorieren. Nach dem Speichern der Konfiguration sind diese verschwunden. diff --git a/ReadMe/update_english.txt b/ReadMe/update_english.txt new file mode 100644 index 0000000..20eb10a --- /dev/null +++ b/ReadMe/update_english.txt @@ -0,0 +1,10 @@ +Updating an older Version of MySQLDumper: + +- overwrite all files with the new ones +- call MySQLDumper in your browser, go to the configuration and clicke "save" +- when you are running crondump.pl via cronjob: remember to update the name of the configuration file in the call of the cronjob +(up to version 1.21 it was named mysqldumper.conf - now it is called mysqldumper.conf.php !) + +Notice: +maybe you will some warnings on your way to the configuration: ["undefinde index ..."]. +Ignore that. After saving the new configuration theses warnings are gone. diff --git a/mysqldumper/config.php b/mysqldumper/config.php new file mode 100644 index 0000000..24667d8 --- /dev/null +++ b/mysqldumper/config.php @@ -0,0 +1,152 @@ +1000 +$config['processlist_refresh']=2000; + +//Disable all .htaccess-Functions with value 1 +$config['no_htaccess']=0; + +$config['empty_db_before_restore']=0; +$config['optimize_tables_beforedump']=1; +$config['stop_with_error']=1; + +// For sending a mail after backup set send_mail to 1, otherless set to 0 +$config['send_mail']=0; +// Attach the backup 0=no 1=yes +$config['send_mail_dump']=0; +// set the recieve adress for the mail +$config['email_recipient']=""; +// set the sender adress (the script) +$config['email_sender']=""; + +//max. Size of Email-Attach, here 3 MB +$config['email_maxsize1']=3; +$config['email_maxsize2']=2; + + +// For FTP-Transfer of Backupfiles set ftp_transfer to 1 +$config['ftp_transfer']=0; + +// FTP Server Configuration for Transfer +$config['ftp_connectionindex']=0; +$config['ftp_server'][0]=""; // Adress of FTP-Server +$config['ftp_port'][0]="21"; // Port +$config['ftp_user'][0]=""; // Username +$config['ftp_pass'][0]=""; // Password +$config['ftp_dir'][0]=""; // Upload-Directory + +$config['ftp_server'][1]=""; // Adress of FTP-Server +$config['ftp_port'][1]="21"; // Port +$config['ftp_user'][1]=""; // Username +$config['ftp_pass'][1]=""; // Password +$config['ftp_dir'][1]=""; // Upload-Directory + +$config['ftp_server'][2]=""; // Adress of FTP-Server +$config['ftp_port'][2]="21"; // Port +$config['ftp_user'][2]=""; // Username +$config['ftp_pass'][2]=""; // Password +$config['ftp_dir'][2]=""; // Upload-Directory + +$config['ftp_timeout']=30; +$config['ftp_useSSL']=0; +$config['ftp_mode']=0; + +//Multipart 0=off 1=on +$config['multi_part']=0; +$config['multipartgroesse1']=1; +$config['multipartgroesse2']=2; +$config['multipart_groesse']=0; + +//Auto-Delete 0=off 1=on +$config['auto_delete']=0; +$config['del_files_after_days']=0; +$config['max_backup_files']=3; +$config['max_backup_files_each']=0; + + +//configuration file +$config['cron_configurationfile']="mysqldumper.conf.php"; +//path to perl, for windows use e.g. C:perlbinperl.exe +$config['cron_perlpath']="/usr/bin/perl"; +//mailer use sendmail(1) or SMTP(0) +$config['cron_use_sendmail']=1; +//path to sendmail +$config['cron_sendmail']="/usr/lib/sendmail -t -oi -oem"; +//adress of smtp-server +$config['cron_smtp']="localhost"; +//smtp-port +$config['cron_smtp_port']=25; +$config['cron_samedb']=0; +$config['cron_timelimit']=360; +$config['cron_extender']=0; +$config['cron_mail']=0; +$config['cron_mail_dump']=0; +$config['cron_ftp']=0; +$config['cron_compression']=1; +$config['cron_printout']=1; +$config['cron_completelog']=1; +$config['multi_dump']=0; + +$config['logcompression'] = "1"; +$config['log_maxsize1'] = "1"; +$config['log_maxsize2'] = "2"; +$config['log_maxsize'] = "1048576"; + +?> \ No newline at end of file diff --git a/mysqldumper/config_overview.php b/mysqldumper/config_overview.php new file mode 100644 index 0000000..89ec896 --- /dev/null +++ b/mysqldumper/config_overview.php @@ -0,0 +1,771 @@ +1 && substr($config['ftp_dir'][$i],-1)!="/")) $config['ftp_dir'][$i].="/"; + } +} + +$showVP=false; +$oldtheme=$config['theme']; +$oldscposition=$config['interface_server_caption_position']; +$checkFTP=Array(" 

 
 "," 

 
 "," 

 
 "); +if(isset($_POST['testFTP0'])) { + $checkFTP[0]='
'.$lang['testconnection'].' FTP-Connection 1

'.TesteFTP($_POST['ftp_server0'],$_POST['ftp_port0'],$_POST['ftp_user0'],$_POST['ftp_pass0'],$_POST['ftp_dir0']).'
'; + $ftptested=0; +} +if(isset($_POST['testFTP1'])) { + $checkFTP[1]='
'.$lang['testconnection'].' FTP-Connection 2

'.TesteFTP($_POST['ftp_server1'],$_POST['ftp_port1'],$_POST['ftp_user1'],$_POST['ftp_pass1'],$_POST['ftp_dir1']).'
'; + $ftptested=1; +} +if(isset($_POST['testFTP2'])) { + $checkFTP[2]='
'.$lang['testconnection'].' FTP-Connection 3

'.TesteFTP($_POST['ftp_server2'],$_POST['ftp_port2'],$_POST['ftp_user2'],$_POST['ftp_pass2'],$_POST['ftp_dir2']).'
'; + $ftptested=2; +} + +if($ftptested>-1) { + $ftp_server[$ftptested]=$_POST['ftp_server'.$ftptested]; + $ftp_port[$ftptested]=$_POST['ftp_port'.$ftptested]; + $ftp_user[$ftptested]=$_POST['ftp_user'.$ftptested]; + $ftp_pass[$ftptested]=$_POST['ftp_pass'.$ftptested]; + $ftp_dir[$ftptested]=stripslashes($_POST['ftp_dir'.$ftptested]); + if($ftp_dir[$ftptested]=="" || (strlen($ftp_dir[$ftptested])>1 && substr($ftp_dir[$ftptested],-1)!="/")) $ftp_dir[$ftptested].="/"; +} + +echo MSDHeader(); + +if (isset($_POST['load'])) +{ + $msg=SetDefault(true); + $msg=nl2br($msg)."
". $lang['load_success']."
"; + echo ''; +} + +if (isset($_POST['save'])) +{ + //Parameter auslesen + + $config['multi_dump']=(isset($_POST['MultiDBDump'])) ? $_POST['MultiDBDump'] : 0; + $databases['db_actual_cronpraefix']=$_POST['dbcronpraefix']; + $config['compression']=$_POST['compression']; + $config['language']=$_POST['language']; + $config['interface_server_caption']=$_POST['server_caption']; + $config['interface_server_caption_position']=$_POST['server_caption_position']; + $config['interface_sqlboxsize']=$_POST['sqlboxsize']; + $config['theme']=$_POST['theme']; + $config['interface_table_compact']=(isset($_POST['interface_table_compact'])) ? $_POST['interface_table_compact'] : 1; + + $config['email_recipient']=$_POST['email0']; + $config['email_sender']=$_POST['email1']; + $config['send_mail']=$_POST['send_mail']; + $config['send_mail_dump']=$_POST['send_mail_dump']; + + $config['email_maxsize1']=$_POST['email_maxsize1']; if($config['email_maxsize1']=="") $config['email_maxsize1']=0; + $config['email_maxsize2']=$_POST['email_maxsize2']; + $config['email_maxsize']=$config['email_maxsize1']*(($config['email_maxsize2']==1) ? 1024 : 1024*1024); + + $config['backup_complete_inserts']=(isset($_POST['backup_complete_inserts'])) ? 1 : 0; + $config['backup_extended_inserts']=(isset($_POST['backup_extended_inserts'])) ? 1 : 0; + $config['backup_delayed_inserts']=(isset($_POST['backup_delayed_inserts'])) ? 1 : 0; + $config['backup_ignore_inserts']=(isset($_POST['backup_ignore_inserts'])) ? 1 : 0; + $config['backup_lock_tables']=(isset($_POST['backup_lock_tables'])) ? 1 : 0; + $config['backup_downgrade']=(isset($_POST['backup_downgrade'])) ? 1 : 0; + + $config['memory_limit']=$_POST['memory_limit']; if($config['memory_limit']=="") $config['memory_limit']=0; + $config['minspeed']=$_POST['minspeed']; if($config['minspeed']<50) $config['minspeed']=50; + $config['maxspeed']=$_POST['maxspeed']; + $config['stop_with_error']=$_POST['stop_with_error']; + + $config['multi_part']=$_POST['multi_part']; + $config['multipartgroesse1']=$_POST['multipartgroesse1']; + $config['multipartgroesse2']=$_POST['multipartgroesse2']; + if($config['multipartgroesse1']<100 && $config['multipartgroesse2']==1)$config['multipartgroesse1']=100; + + $oldlogcompression=$config['logcompression']; + $config['logcompression']=(isset($_POST['logcompression']) && $_POST['logcompression']==1) ? 1 : 0; + $config['log_maxsize1']=$_POST['log_maxsize1']; if($config['log_maxsize1']=="") $config['log_maxsize1']=0; + $config['log_maxsize2']=$_POST['log_maxsize2']; + $config['log_maxsize']=$config['log_maxsize1']*(($config['log_maxsize2']==1) ? 1024 : 1024*1024); + + $config['auto_delete']=$_POST['auto_delete']; + $config['del_files_after_days']=$_POST['del_files_after_days']; + $config['max_backup_files']=$_POST['max_backup_files']; + $config['max_backup_files_each']=$_POST['max_backup_files_each']; + + + $config['empty_db_before_restore']=$_POST['empty_db_before_restore']; + $config['optimize_tables_beforedump']=$_POST['optimize_tables']; + $config['cron_samedb']=$_POST['cron_samedb']; + + + $config['cron_extender']=$_POST['cron_extender']; + // cron_select_savepath/ + if (!isset($_POST['cron_select_savepath'])) $_POST['cron_select_savepath']='mysqldumper'; + if(isset($_POST['cron_savepath_new']) && !empty($_POST['cron_savepath_new'])) + $config['cron_configurationfile']=$_POST['cron_savepath_new'].".conf.php"; + else + $config['cron_configurationfile']=$_POST['cron_select_savepath'].".conf.php"; + + + $config['cron_execution_path']=$_POST['cron_execution_path']; + if($config['cron_execution_path']=="")$config['cron_execution_path']="msd_cron/"; + if(strlen($config['cron_execution_path'])>1 && substr($config['cron_execution_path'],-1)!="/") $config['cron_execution_path'].="/"; + $config['cron_mail']=$_POST['cron_mail']; + $config['cron_mail_dump']=$_POST['cron_mail_dump']; + + $config['cron_use_sendmail']=$_POST['cron_use_sendmail']; + $config['cron_sendmail']=$_POST['cron_sendmail']; + $config['cron_smtp']=$_POST['cron_smpt']; + + $config['cron_printout']=$_POST['cron_printout']; + $config['cron_completelog']=$_POST['cron_completelog']; + $config['cron_ftp']=$_POST['cron_ftp']; + $config['cron_compression']=$_POST['cron_compression']; + $config['cron_comletelog']=$_POST['cron_completelog']; + + $databases['multi']=Array(); + $databases['multi_praefix']=Array(); + $databases['multi_commandbeforedump']=Array(); + $databases['multi_commandafterdump']=Array(); + if (isset($databases['Name'][0]) && $databases['Name'][0]>'') + { + for($i=0;$i0)?implode(";",$databases['multi']) : ""; + $databases['multisetting_praefix']=(count($databases['multi'])>0)?implode(";",$databases['multi_praefix']) : ""; + $databases['multisetting_commandbeforedump']=(count($databases['multi'])>0)?implode(";",$databases['multi_commandbeforedump']) : ""; + $databases['multisetting_commandafterdump']=(count($databases['multi'])>0)?implode(";",$databases['multi_commandafterdump']) : ""; + + $databases['db_actual_cronindex']=$_POST['cron_dbindex']; + if($config['cron_samedb']==0){ + $databases['db_actual_cronindex']=$databases['db_selected_index']; + + } elseif($databases['db_actual_cronindex']=="-2") { + $cron_save_all_dbs=1; + $datenbanken=count($databases['Name']); + $cron_db_array=str_replace(";","|",$databases['multisetting']); + $cron_dbpraefix_array=str_replace(";","|",$databases['multisetting_praefix']); + $cron_db_cbd_array=str_replace(";","|",$databases['multisetting_commandbeforedump']); + $cron_db_cad_array=str_replace(";","|",$databases['multisetting_commandafterdump']); + + } elseif ($databases['db_actual_cronindex']=="-3") { + $cron_save_all_dbs=1; + $cron_db_array=implode("|",$databases['Name']); + $cron_dbpraefix_array=implode("|",$databases['praefix']); + $cron_db_cbd_array=implode("|",$databases['command_before_dump']); + $cron_db_cad_array=implode("|",$databases['command_after_dump']); + + } + + $config['ftp_transfer']=$_POST['ftp_transfer']; + $config['ftp_connectionindex']=$_POST['ftp_transferconn']; + $config['ftp_timeout']=$_POST['ftp_timeout']; + $config['ftp_useSSL']=isset($_POST['ftp_useSSL']) ? $_POST['ftp_useSSL'] : 0; + $config['ftp_mode']=isset($_POST['ftp_mode']) ? 1 : 0; + + for($i=0;$i<3;$i++) { + $checkFTP[$i]=""; + $config['ftp_server'][$i]=$_POST['ftp_server'.$i]; + $config['ftp_port'][$i]=$_POST['ftp_port'.$i]; + $config['ftp_user'][$i]=$_POST['ftp_user'.$i]; + $config['ftp_pass'][$i]=$_POST['ftp_pass'.$i]; + $config['ftp_dir'][$i]=stripslashes($_POST['ftp_dir'.$i]); + if($config['ftp_port'][$i]+0==0) $config['ftp_port'][$i]=21; + if($config['ftp_dir'][$i]=="" || (strlen($config['ftp_dir'][$i])>1 && substr($config['ftp_dir'][$i],-1)!="/")) $config['ftp_dir'][$i].="/"; + } + + $config['bb_width']=$_POST['bb_width']; + $config['bb_textcolor']=$_POST['bb_textcolor']; + $config['sql_limit']=$_POST['sql_limit']; + + $config['connect_utf8']=isset($_POST['connect_utf8']) ?1:0; + if($config['dbhost']!=$_POST['dbhost'] || + $config['dbuser']!=$_POST['dbuser'] || + $config['dbpass']!=$_POST['dbpass'] || + $config['dbport']!=$_POST['dbport'] || + $config['dbsocket']!=$_POST['dbsocket']) { + //neue Verbindungsparameter + + $show_VP=true; + + //alte Parameter sichern + $old['dbhost']=$config['dbhost']; + $old['dbuser']=$config['dbuser']; + $old['dbpass']=$config['dbpass']; + $old['dbport']=$config['dbport']; + $old['dbsocket']=$config['dbsocket']; + + //neu setzen + $config['dbhost']=$_POST['dbhost']; + $config['dbuser']=$_POST['dbuser']; + $config['dbpass']=$_POST['dbpass']; + $config['dbport']=$_POST['dbport']; + $config['dbsocket']=$_POST['dbsocket']; + if(MSD_mysql_connect()) + { + // neue Vernindungsdaten wurden akzeptiert -> manuelle DB-Liste von anderem User löschen + if (file_exists('./'.$config['files']['dbs_manual'])) @unlink('./'.$config['files']['dbs_manual']); + unset($databases['Name']); + SetDefault(); + $msg.= ''; + } + else + { + //alte Werte holen + $config['dbhost']=$old['dbhost']; + $config['dbuser']=$old['dbuser']; + $config['dbpass']=$old['dbpass']; + $config['dbport']=$old['dbport']; + $config['dbsocket']=$old['dbsocket']; + $msg.='

'.$lang['wrong_connectionpars'].'

'; + } + + } + + // Manuelles hinzufügen einer Datenbank + if ($_POST['add_db_manual']>'') + { + $to_add=trim($_POST['add_db_manual']); + $found=false; + // Prüfen, ob die DB bereits in der Liste vorhanden ist + if (isset($databases['Name'][0])) + { + foreach ($databases['Name'] as $existing_db) + { + if ($existing_db==$to_add) $found=true; + } + } + if ($found) $add_db_message=sprintf($lang['db_in_list'],$to_add); + else + { + if(MSD_mysql_connect()) + { + $res=mysql_selectdb($to_add,$config['dbconnection']); + if (!$res===false) + { + $dbs_manual=array(); + if (file_exists('./'.$config['files']['dbs_manual'])) $dbs_manual=file('./'.$config['files']['dbs_manual']); + if (!in_array($to_add,$dbs_manual)) $dbs_manual[]=$to_add; + $file_handle=fopen('./'.$config['files']['dbs_manual'],'a'); + if ($file_handle) + { + foreach ($dbs_manual as $f) { fwrite($file_handle,$f); } + fclose($file_handle); + @chmod('./'.$config['files']['dbs_manual'],0777); + //Menü aktualisieren, damit die DB in dr Selectliste erscheint + echo ''; + } + else $add_db_message=sprintf($lang['db_manual_file_error'],$to_add); + } + else $add_db_message=sprintf($lang['db_manual_error'],$to_add); + $showVP=true; + } + } + } + + // und wegschreiben + if (WriteParams(0)==true) + { + //neue Sprache? Dann Menü links auch aktualisieren + if( $_POST['lang_old']!=$config['language'] + || $_POST['scaption_old']!=$config['interface_server_caption'] + || $oldtheme!=$config['theme'] + || $oldscposition!=$config['interface_server_caption_position']) + { + $msg.= ''; + } + //Parameter laden + include($config['files']['parameter']); + if ($config['logcompression']!=$oldlogcompression) SwitchLogfileFormat(); + $msg.= '

'.$lang['save_success'].'

'; + } else $msg.= '

'.$lang['save_error'].'

'; +} + +ReadSQL(); + +?> + +'.$nl; +$aus['formstart'].='
'; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; +$aus['formstart'].='
'.$nl; + +$aus['formstart'].='


'.$nl; +$aus['formstart'].=''.$nl; +$aus['formstart'].=''.$nl; +$aus['formstart'].='
'.$msg.$nl; + +// Zugangsdaten +$aus['db']='
'.$lang['connectionpars'].''.$nl.$nl; +$aus['db'].='
'.$lang['db_backuppars'].''; + +$aus['db'].=''; + +//Wenn Datenbanken vorhanden sind +if (isset($databases['Name'][0]) && $databases['Name'][0]>'') +{ + if(count($databases['Name'])==1) + { + $databases['db_actual']=$databases['Name'][0]; + $aus['db'].=''; + $aus['db'].=''; + $aus['db'].=''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + } + else + { + $aus['db'].=''; + $aus['db'].=''; +$aus['db'].='
'.Help($lang['help_db'],"conf1").$lang['list_db'].''.$databases['db_actual'].'
'.Help($lang['help_praefix'],"conf2").$lang['praefix'].'
'.Help($lang['help_commands'],"").'Command before Dump'.ComboCommandDump(0,$databases['db_selected_index']).'
'.Help($lang['help_commands'],"").'Command after Dump'.ComboCommandDump(1,$databases['db_selected_index']).''.$lang['sql_befehle'].'
'.Help($lang['help_db'],"conf1").$lang['list_db'].''.$lang['activate_multidump'].'
'; + $aus['db'].=''; + $aus['db'].=''; + + //erst die aktuelle DB + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + + $dbacombo=$dbbcombo="";$j=0; + for($i=0;$i'; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + $aus['db'].= ''; + } + } + } +} +else $aus['db'].=''; +$aus['db'].='
'.$lang['db'].'Multidump
('.$lang['all'].' '.$lang['none'].')
'.Help($lang['help_praefix'],"conf2").$lang['praefix'].''.Help($lang['help_commands'],"",11).'Command before Dump'.Help($lang['help_commands'],"",11).'Command after Dump'.$lang['sql_befehle'].'
'.$databases['db_actual'].''.ComboCommandDump(0,$databases['db_selected_index']).''.ComboCommandDump(1,$databases['db_selected_index']).''.$lang['sql_befehle'].'
'.$databases['Name'][$i].''.ComboCommandDump(0,$i).''.ComboCommandDump(1,$i).''.$lang['sql_befehle'].'
'.$lang['no_db_found'].'
'; + +// sonstige Einstellungen +$aus['global1']='
'.$lang['general'].''; + +$aus['global1'].=''; +$aus['global1'].=''; + +$aus['global1'].=''; +$aus['global1'].=''; + +$aus['global1'].=''; +$aus['global1'].=''; + +$aus['global1'].='
'.Help("","").'Logfiles: '.$lang['compressed'].'
'; +$aus['global1'].=''.$lang['maxsize'].':    '; +$aus['global1'].='
'.Help($lang['help_memorylimit'],"").$lang['memory_limit'].':  '; +$aus['global1'].=' Bytes   automatisch ermitteln'; +$aus['global1'].='
'.Help($lang['help_speed'],"").$lang['speed'].':  '.$lang['to'].' 
'.$lang['dump'].''; + +$aus['global1'].=''; +$aus['global1'].=''; +//Multipart-Backup --> +$aus['global1'].=''; +$aus['global1'].=''; +$aus['global1'].=''; +$aus['global1'].=''; +$aus['global1'].=''; + +$aus['global1'].=''; + + +$aus['global1'].='
'.Help($lang['help_zip'],"conf3").$lang['gzip'].': '.$lang['activated']; +$aus['global1'].=''.$lang['not_activated'].'
'.Help($lang['help_multipart'],"").$lang['multi_part'].': '; +$aus['global1'].=''.$lang['yes']; +$aus['global1'].=''.$lang['no']; +$aus['global1'].='
'.Help($lang['help_multipartgroesse'],"").$lang['multi_part_groesse'].':  
'; +$aus['global1'].='  '; +$aus['global1'].='
'.Help($lang['help_optimize'],"").$lang['optimize'].': '.$lang['activated']; +$aus['global1'].=''.$lang['not_activated'].'
'.Help("","").$lang['backup_format'].': '.$lang['inserts_complete'].'
'; +$aus['global1'].=''.$lang['inserts_extended'].'
'; +$aus['global1'].=''.$lang['inserts_delayed'].'
'; +$aus['global1'].=''.$lang['inserts_ignore'].'
'; +$aus['global1'].=''.$lang['lock_tables'].'
'; +$aus['global1'].=''.$lang['downgrade'].'
'.$lang['restore'].''; +$aus['global1'].=''; + + +$aus['global1'].='
'.Help($lang['help_empty_db_before_restore'],"conf4").$lang['empty_db_before_restore'].': '; +$aus['global1'].=''.$lang['yes']; +$aus['global1'].=''.$lang['no']; +$aus['global1'].='
'.Help("","").$lang['errorhandling_restore'].''; +$aus['global1'].=''.$lang['ehrestore_continue'].'
'; +$aus['global1'].=''.$lang['ehrestore_stop']; +$aus['global1'].='
'; + +//Interface --> +$aus['global3']='
'.$lang['config_interface'].''; +$aus['global3'].=''; +$aus['global3'].=''; + +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; + +$aus['global3'].='
'.Help($lang['help_lang'],"conf11").$lang['language'].':   '.$lang['download_languages'].'
'.Help($lang['help_servercaption'],"").$lang['servercaption'].':'.$lang['activated'].'   '; +$aus['global3'].=''.$lang['in_mainframe'].'  '.$lang['in_leftframe'].''; +$aus['global3'].='
'.Help("","").'Theme  '.$lang['download_styles'].'
'.$lang['sql_browser'].''; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].=''; + +$aus['global3'].='
'.Help("","").$lang['sqlboxheight'].':  pixel
'.Help("","").$lang['sqllimit'].':  
'.Help("","").$lang['bbparams'].': '; +$aus['global3'].=''; +$aus['global3'].=''; +$aus['global3'].='
'.$lang['width'].': pixel
'.$lang['bbtextcolor'].': 
'; +$aus['global3'].='
'.Help("","").'SQL-Grid: normal   '; +$aus['global3'].='compact
'; + +//automatisches Löschen--> +$aus['global2']='
'.$lang['config_autodelete'].''; +$aus['global2'].=''; +$aus['global2'].=''; +$aus['global2'].=''; +$aus['global2'].=''; +$aus['global2'].='
'.Help($lang['help_ad1'],"conf8").$lang['autodelete'].': '.$lang['activated']; +$aus['global2'].=''.$lang['not_activated']; +$aus['global2'].='
'.Help($lang['help_ad2'],"conf9").$lang['age_of_files'].': 
'.Help($lang['help_ad3'],"conf10").$lang['number_of_files_form'].':  '; +$aus['global2'].=''.$lang['max_backup_files_each1'].' '; +$aus['global2'].=''.$lang['max_backup_files_each2']; +$aus['global2'].='
'; + + +//Email--> +$aus['transfer1']='
'.$lang['config_email'].''; +$aus['transfer1'].=''; +$aus['transfer1'].=''; +$aus['transfer1'].=''; +$aus['transfer1'].=''; +$aus['transfer1'].=''; +$aus['transfer1'].='
'.Help($lang['help_mail1'],"conf5").$lang['send_mail_form'].': '.$lang['yes']; +$aus['transfer1'].=''.$lang['no']; +$aus['transfer1'].='
'.Help($lang['help_mail2'],"conf6").$lang['email_adress'].': 
'.Help($lang['help_mail3'],"conf7").$lang['email_subject'].': 
'.Help($lang['help_mail5'],"").$lang['send_mail_dump'].': '; +$aus['transfer1'].=''.$lang['yes']; +$aus['transfer1'].=''.$lang['no']; +$aus['transfer1'].='
'.Help($lang['help_mail4'],"").$lang['email_maxsize'].': '; +$aus['transfer1'].='  '; +$aus['transfer1'].='
'.Help($lang['help_cronmailprg'],"").$lang['cron_mailprg'].': '; +$aus['transfer1'].=''; +$aus['transfer1'].='
sendmail
SMPT
 SMTP-Port: '.$config['cron_smtp_port'].'
'; + +//FTP--> +$aus['transfer2']='
'.$lang['config_ftp'].''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; + +$aus['transfer2'].=''; +$aus['transfer2'].=''; + +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].='
'.Help($lang['help_ftptransfer'],"").$lang['ftp_transfer'].': '.$lang['activated']; +$aus['transfer2'].=' '.$lang['not_activated'].'
'.Help($lang['useconnection'].":","").$lang['useconnection'].': '; +$aus['transfer2'].=' FTP 1  '; +$aus['transfer2'].=' FTP 2  '; +$aus['transfer2'].=' FTP 3
'.Help($lang['help_ftptimeout'],"").$lang['ftp_timeout'].':  sec
'.Help($lang['help_ftp_mode'],"").$lang['ftp_choose_mode'].': '; +$aus['transfer2'].=$lang['ftp_passive'].'
'; + +$aus['transfer2'].='
'.Help($lang['help_ftpssl'],"").$lang['ftp_ssl'].': '; +$aus['transfer2'].=''.$lang['ftp_useSSL'].'
'; + +//1 +$aus['transfer2'].='
FTP-Connection 1

'.$checkFTP[0].'
'; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].='
'.Help($lang['help_ftpserver'],"conf14",12).$lang['ftp_server'].': 
'.Help($lang['help_ftpport'],"conf15",12).$lang['ftp_port'].': 
'.Help($lang['help_ftpuser'],"conf16",12).$lang['ftp_user'].': 
'.Help($lang['help_ftppass'],"conf17",12).$lang['ftp_pass'].': 
'.Help($lang['help_ftpdir'],"conf18",12).$lang['ftp_dir'].': 
'; +//2 +$aus['transfer2'].='
FTP-Connection 2

'.$checkFTP[1].'
'; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].='
'.Help($lang['help_ftpserver'],"conf14",12).$lang['ftp_server'].': 
'.Help($lang['help_ftpport'],"conf15",12).$lang['ftp_port'].': 
'.Help($lang['help_ftpuser'],"conf16",12).$lang['ftp_user'].': 
'.Help($lang['help_ftppass'],"conf17",12).$lang['ftp_pass'].': 
'.Help($lang['help_ftpdir'],"conf18",12).$lang['ftp_dir'].': 
'; +//3 +$aus['transfer2'].='
FTP-Connection 3

'.$checkFTP[2].'
'; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].=''; +$aus['transfer2'].='
'.Help($lang['help_ftpserver'],"conf14",12).$lang['ftp_server'].': 
'.Help($lang['help_ftpport'],"conf15",12).$lang['ftp_port'].': 
'.Help($lang['help_ftpuser'],"conf16",12).$lang['ftp_user'].': 
'.Help($lang['help_ftppass'],"conf17",12).$lang['ftp_pass'].': 
'.Help($lang['help_ftpdir'],"conf18",12).$lang['ftp_dir'].': 
'; + + +//Crondump +$aus['cron']='
'.$lang['config_cronperl'].''; +$aus['cron'].=''; +$aus['cron'].=''; + +$aus['cron'].=''; + +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; +$aus['cron'].=''; + +$aus['cron'].=''; +$aus['cron'].='
'.Help($lang['help_cronextender'],"").$lang['cron_extender'].': .pl'; +$aus['cron'].='.cgi'; +$aus['cron'].='
'.Help($lang['help_cronsavepath'],"").$lang['cron_savepath'].': '; +$aus['cron'].='
'.$lang['existing'].':
'.$lang['new'].': .conf.php
'.Help($lang['help_cronexecpath'],"").$lang['cron_execpath'].': 
'.Help($lang['help_cronprintout'],"").$lang['cron_printout'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no'].'
'.Help($lang['help_croncompletelog'],"").$lang['cron_completelog'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no'].'
'.Help($lang['help_cronsamedb'],"conf13").$lang['cron_samedb'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no']; +$aus['cron'].='
'.Help($lang['help_crondbindex'],"conf14").$lang['cron_crondbindex'].': 
  
'.Help($lang['help_cronzip'],"").$lang['gzip'].': '.$lang['activated']; +$aus['cron'].=''.$lang['not_activated']; +$aus['cron'].='
'.Help($lang['help_cronmail'],"").$lang['send_mail_form'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no']; +$aus['cron'].='
'.Help($lang['help_cronmail_dump'],"").$lang['send_mail_dump'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no']; +$aus['cron'].='
'.Help($lang['help_cronftp'],"").$lang['cron_ftp'].': '.$lang['yes']; +$aus['cron'].=''.$lang['no']; +$aus['cron'].='
'; + +//Formular-Buttons --> +$aus['formende']='

'; + +// AUSGABE +echo $aus['formstart']; +echo $aus['db']; +echo $aus['global1']; +echo $aus['global2']; +echo $aus['global3']; +echo $aus['transfer1']; +echo $aus['transfer2']; +echo $aus['cron']; + +echo $aus['formende']; + +echo ''; + +echo MSDFooter(); + + + +?> diff --git a/mysqldumper/css/msd/icons/ardown.gif b/mysqldumper/css/msd/icons/ardown.gif new file mode 100644 index 0000000..825c9e8 Binary files /dev/null and b/mysqldumper/css/msd/icons/ardown.gif differ diff --git a/mysqldumper/css/msd/icons/arrowdown.gif b/mysqldumper/css/msd/icons/arrowdown.gif new file mode 100644 index 0000000..32d7ceb Binary files /dev/null and b/mysqldumper/css/msd/icons/arrowdown.gif differ diff --git a/mysqldumper/css/msd/icons/arrowleft.gif b/mysqldumper/css/msd/icons/arrowleft.gif new file mode 100644 index 0000000..560043d Binary files /dev/null and b/mysqldumper/css/msd/icons/arrowleft.gif differ diff --git a/mysqldumper/css/msd/icons/arrowup.gif b/mysqldumper/css/msd/icons/arrowup.gif new file mode 100644 index 0000000..e9eba1f Binary files /dev/null and b/mysqldumper/css/msd/icons/arrowup.gif differ diff --git a/mysqldumper/css/msd/icons/arup.gif b/mysqldumper/css/msd/icons/arup.gif new file mode 100644 index 0000000..701b714 Binary files /dev/null and b/mysqldumper/css/msd/icons/arup.gif differ diff --git a/mysqldumper/css/msd/icons/blank.gif b/mysqldumper/css/msd/icons/blank.gif new file mode 100644 index 0000000..076c753 Binary files /dev/null and b/mysqldumper/css/msd/icons/blank.gif differ diff --git a/mysqldumper/css/msd/icons/browse.gif b/mysqldumper/css/msd/icons/browse.gif new file mode 100644 index 0000000..e52271a Binary files /dev/null and b/mysqldumper/css/msd/icons/browse.gif differ diff --git a/mysqldumper/css/msd/icons/close.gif b/mysqldumper/css/msd/icons/close.gif new file mode 100644 index 0000000..57b3cc3 Binary files /dev/null and b/mysqldumper/css/msd/icons/close.gif differ diff --git a/mysqldumper/css/msd/icons/compact.gif b/mysqldumper/css/msd/icons/compact.gif new file mode 100644 index 0000000..9dcb131 Binary files /dev/null and b/mysqldumper/css/msd/icons/compact.gif differ diff --git a/mysqldumper/css/msd/icons/delete.gif b/mysqldumper/css/msd/icons/delete.gif new file mode 100644 index 0000000..131f69e Binary files /dev/null and b/mysqldumper/css/msd/icons/delete.gif differ diff --git a/mysqldumper/css/msd/icons/edit.gif b/mysqldumper/css/msd/icons/edit.gif new file mode 100644 index 0000000..bfa895c Binary files /dev/null and b/mysqldumper/css/msd/icons/edit.gif differ diff --git a/mysqldumper/css/msd/icons/empty.gif b/mysqldumper/css/msd/icons/empty.gif new file mode 100644 index 0000000..fbcb328 Binary files /dev/null and b/mysqldumper/css/msd/icons/empty.gif differ diff --git a/mysqldumper/css/msd/icons/emptykeys.gif b/mysqldumper/css/msd/icons/emptykeys.gif new file mode 100644 index 0000000..7750c06 Binary files /dev/null and b/mysqldumper/css/msd/icons/emptykeys.gif differ diff --git a/mysqldumper/css/msd/icons/encompact.gif b/mysqldumper/css/msd/icons/encompact.gif new file mode 100644 index 0000000..e590f5c Binary files /dev/null and b/mysqldumper/css/msd/icons/encompact.gif differ diff --git a/mysqldumper/css/msd/icons/fulltext.gif b/mysqldumper/css/msd/icons/fulltext.gif new file mode 100644 index 0000000..bedce14 Binary files /dev/null and b/mysqldumper/css/msd/icons/fulltext.gif differ diff --git a/mysqldumper/css/msd/icons/gz.gif b/mysqldumper/css/msd/icons/gz.gif new file mode 100644 index 0000000..f0adfe5 Binary files /dev/null and b/mysqldumper/css/msd/icons/gz.gif differ diff --git a/mysqldumper/css/msd/icons/help16.gif b/mysqldumper/css/msd/icons/help16.gif new file mode 100644 index 0000000..c1f81c4 Binary files /dev/null and b/mysqldumper/css/msd/icons/help16.gif differ diff --git a/mysqldumper/css/msd/icons/help32.gif b/mysqldumper/css/msd/icons/help32.gif new file mode 100644 index 0000000..18ac603 Binary files /dev/null and b/mysqldumper/css/msd/icons/help32.gif differ diff --git a/mysqldumper/css/msd/icons/key.gif b/mysqldumper/css/msd/icons/key.gif new file mode 100644 index 0000000..16106df Binary files /dev/null and b/mysqldumper/css/msd/icons/key.gif differ diff --git a/mysqldumper/css/msd/icons/key_primary.gif b/mysqldumper/css/msd/icons/key_primary.gif new file mode 100644 index 0000000..b12f28b Binary files /dev/null and b/mysqldumper/css/msd/icons/key_primary.gif differ diff --git a/mysqldumper/css/msd/icons/nokey.gif b/mysqldumper/css/msd/icons/nokey.gif new file mode 100644 index 0000000..0a3caa6 Binary files /dev/null and b/mysqldumper/css/msd/icons/nokey.gif differ diff --git a/mysqldumper/css/msd/icons/notok.gif b/mysqldumper/css/msd/icons/notok.gif new file mode 100644 index 0000000..399e815 Binary files /dev/null and b/mysqldumper/css/msd/icons/notok.gif differ diff --git a/mysqldumper/css/msd/icons/ok.gif b/mysqldumper/css/msd/icons/ok.gif new file mode 100644 index 0000000..4abfb29 Binary files /dev/null and b/mysqldumper/css/msd/icons/ok.gif differ diff --git a/mysqldumper/css/msd/icons/openfile.gif b/mysqldumper/css/msd/icons/openfile.gif new file mode 100644 index 0000000..8987640 Binary files /dev/null and b/mysqldumper/css/msd/icons/openfile.gif differ diff --git a/mysqldumper/css/msd/icons/primary.gif b/mysqldumper/css/msd/icons/primary.gif new file mode 100644 index 0000000..c80e3cb Binary files /dev/null and b/mysqldumper/css/msd/icons/primary.gif differ diff --git a/mysqldumper/css/msd/icons/progressbar_dump.gif b/mysqldumper/css/msd/icons/progressbar_dump.gif new file mode 100644 index 0000000..c57f75e Binary files /dev/null and b/mysqldumper/css/msd/icons/progressbar_dump.gif differ diff --git a/mysqldumper/css/msd/icons/progressbar_restore.gif b/mysqldumper/css/msd/icons/progressbar_restore.gif new file mode 100644 index 0000000..e5ac82c Binary files /dev/null and b/mysqldumper/css/msd/icons/progressbar_restore.gif differ diff --git a/mysqldumper/css/msd/icons/progressbar_speed.gif b/mysqldumper/css/msd/icons/progressbar_speed.gif new file mode 100644 index 0000000..c8cd9dc Binary files /dev/null and b/mysqldumper/css/msd/icons/progressbar_speed.gif differ diff --git a/mysqldumper/css/msd/icons/rename.gif b/mysqldumper/css/msd/icons/rename.gif new file mode 100644 index 0000000..c55d78e Binary files /dev/null and b/mysqldumper/css/msd/icons/rename.gif differ diff --git a/mysqldumper/css/msd/icons/search.gif b/mysqldumper/css/msd/icons/search.gif new file mode 100644 index 0000000..26e0cd4 Binary files /dev/null and b/mysqldumper/css/msd/icons/search.gif differ diff --git a/mysqldumper/css/msd/icons/unique.gif b/mysqldumper/css/msd/icons/unique.gif new file mode 100644 index 0000000..1d5c870 Binary files /dev/null and b/mysqldumper/css/msd/icons/unique.gif differ diff --git a/mysqldumper/css/msd/pics/body_bg.gif b/mysqldumper/css/msd/pics/body_bg.gif new file mode 100644 index 0000000..f50f7aa Binary files /dev/null and b/mysqldumper/css/msd/pics/body_bg.gif differ diff --git a/mysqldumper/css/msd/pics/cellpic.gif b/mysqldumper/css/msd/pics/cellpic.gif new file mode 100644 index 0000000..242f988 Binary files /dev/null and b/mysqldumper/css/msd/pics/cellpic.gif differ diff --git a/mysqldumper/css/msd/pics/h1_logo.gif b/mysqldumper/css/msd/pics/h1_logo.gif new file mode 100644 index 0000000..d6a339b Binary files /dev/null and b/mysqldumper/css/msd/pics/h1_logo.gif differ diff --git a/mysqldumper/css/msd/pics/mainnavi.gif b/mysqldumper/css/msd/pics/mainnavi.gif new file mode 100644 index 0000000..23547e3 Binary files /dev/null and b/mysqldumper/css/msd/pics/mainnavi.gif differ diff --git a/mysqldumper/css/msd/pics/menubutton.gif b/mysqldumper/css/msd/pics/menubutton.gif new file mode 100644 index 0000000..f1def49 Binary files /dev/null and b/mysqldumper/css/msd/pics/menubutton.gif differ diff --git a/mysqldumper/css/msd/pics/navi_bg.jpg b/mysqldumper/css/msd/pics/navi_bg.jpg new file mode 100644 index 0000000..5b956ed Binary files /dev/null and b/mysqldumper/css/msd/pics/navi_bg.jpg differ diff --git a/mysqldumper/css/msd/pics/overall_bg.gif b/mysqldumper/css/msd/pics/overall_bg.gif new file mode 100644 index 0000000..af143fa Binary files /dev/null and b/mysqldumper/css/msd/pics/overall_bg.gif differ diff --git a/mysqldumper/css/msd/pics/pagetitle.gif b/mysqldumper/css/msd/pics/pagetitle.gif new file mode 100644 index 0000000..b240bf5 Binary files /dev/null and b/mysqldumper/css/msd/pics/pagetitle.gif differ diff --git a/mysqldumper/css/msd/style.css b/mysqldumper/css/msd/style.css new file mode 100644 index 0000000..b7962d3 --- /dev/null +++ b/mysqldumper/css/msd/style.css @@ -0,0 +1,158 @@ +/* MySQLDumper STYLESHEET + +Name: msd + +*/ + +* {margin: 0;padding: 0;} +img {border:0;} + + + +body {font:12px/1.5 Verdana,Helvetica,sans-serif;color:#4E5665;background: #C7D1D0;} +body.menu {font:12px Verdana,Helvetica,sans-serif;color:#4E5665;background:#738C88;} + +/* LINKS */ + +a {color:#4E5665 ; text-decoration:underline; font:12px verdana, sans-serif} +a:hover {color:#E87B00; text-decoration:none} +a.ul {text-decoration:underline;} + + +/* general */ +#pagetitle {font-size: 18px;font-weight: bold;background:url(pics/pagetitle.gif) #A9AFBB;letter-spacing: 2px;color:White;padding:2px 6px;} + +#server0 {position:absolute;bottom:4px;text-align:center; left:10px; color:white;} +#server1 {position:absolute;right:16px;text-align:center;padding:10px;} +a.server {color:#333333;font-size:10px;} +a.server:hover {text-decoration: underline;color: white;} + +.version {font-size: 11px;font-weight:bold; } +.small {font-size:11px;} +.ssmall {font-size:10px;} +.success {font-weight:bold;} +.error {color:red;font-weight:bold;} +.explain { text-decoration:none;border-bottom:1px dotted; } +.explain:hover { cursor:help; } + + +table td {text-align:left;vertical-align:top;padding:0 6px;} +table th {padding:0 6px;} + +/* MENU */ +#wrapmenu { background:url(pics/pagetitle.gif) #A9AFBB; background-repeat:repeat-x;} +#db-select { font:12px Verdana,Helvetica,sans-serif;color:#4E5665;background:#A9AFBB; } + +#menu {margin-top:1px;background: url(pics/navi_bg.jpg) no-repeat; text-align:center;} +#menu ul {margin-top:174px;padding:0;list-style:none;border-top:1px solid #9AA2B1} +#menu ul li { height:20px;} +#menu ul li a {display:block;position:relative; /*fuer den ie*/ font:11px/20px verdana, sans-serif;text-decoration:none;color:#4E5665; background:url(pics/mainnavi.gif) repeat-x 0 -20px;padding:0 15px;height:20px;text-align:left;} +#menu ul li a:hover {color:#fff; background:url(pics/mainnavi.gif) repeat-x 0 0px;} +/*der aktive link in der navi*/ +#menu ul li.active a {font-weight:bold;color:#fff; background:url(pics/mainnavi.gif) repeat-x 0 -40px; display:block;} + +#menu p,#menu p a{color:#fff;line-height:1.5;font-size:11px;} + +#db-selectbox +{ + position:relative; + top:0px; + width:190px; + background:transparent; + text-align:center; + font:11px/1.5 Verdana,Helvetica,sans-serif; + color:white; +} + +#db-selectbox a { font:11px/1.5 Verdana,Helvetica,sans-serif; color:white;text-decoration:underline; } +#db-selectbox a:hover { text-decoration:none} + +/* MAIN */ +#topnavi {text-align:center;margin:6px;} +#content {margin-left:12px;} +#content p {margin-bottom:8px;} + +/*Tabellen */ +table tr.dbrow {background:#E4E9E8;} +table tr.dbrow1 {background:#D5DDDC;} +table tr.dbrowsel {background:#fff;} +table td.treffer {background:#000;} +/* Treffer bei der MySQL-Suche */ +table tr.dbrow .treffer, table tr.dbrow1 .treffer { color:yellow; background-color:#738C88; } + +table.bordersmall,table.border {border:2px solid #738C88;width:84%;} +table.border th,table.bordersmall th {font-size:11px;color:#738C88;} +table.border tr.thead,table.bordersmall tr.thead {background:#A5B6B4;height:24px;} +table td.sum { background-color:red;font-weight:bold;text-align:right;} + + +table.bordersmall input,table.bordersmall select,table.bordersmall td, +#sqlheaderbox select,#configright select, #configright a {font-size:11px;} +.tdcompact {width:100px;height:16px;overflow:hidden;font-size:11px;} +.tdnormal {white-space:nowrap;padding:4px;} +.sqlheadmenu a {} + + +/* FORM-Elements */ +#content .Formbutton {white-space:nowrap;margin:6px;font:10px verdana, sans-serif; border: 1px solid #4E5665; background:#A9B2B1; color:#4E5665;padding:2px;cursor: pointer;} +#content .SQLbutton {font-size:11px;background:#E4E9E8;cursor: pointer;} +#content textarea #thta {font-size:11px;color:blue;width:400px;height:300px;overflow:scroll;} +#content textarea {width:100%;background:#B3C2C0;} + +input.radio,input.checkbox {background-color: transparent;} + +/* Colors for Formelements */ +input.text,input.small {background:#B3C2C0;color:#4E5665;} +select {background:#B3C2C0;color:#4E5665;} +textarea {background:#B3C2C0;color:#4E5665;} + +/* for Geckos */ +input[disabled] {color:#888;} + + +/*horizontales Menü */ + +#hormenu {} +#hormenu ul {border-bottom:thin solid #D5DDDC;margin-bottom:8px;width:80%;} +#hormenu ul li {display:inline;} +#hormenu ul li a {font:11px/20px verdana, sans-serif;text-decoration:none;color:#4E5665;padding:0 14px;border:0;} +#hormenu ul li a:hover {color:#E87B00;} +#hormenu ul li#active a{font:bold 11px/20px verdana, sans-serif;text-decoration:none; color:#E87B00; float:left; padding:0 14px;} +#hormenu ul li#active a:hover{color:#E87B00; } + +/* spezielle Elemente */ +.MySQLbox{font-size: 10pt;padding: 6px;background:#000; color: #fff;border: thin solid #999999;height: 200px;width: 80%;text-align: left;overflow: auto; } +#content #mysqlbox {border:1px solid #738C88;background:#D5DDDC;} +#content #sqlheaderbox {white-space:nowrap;height:20px;vertical-align:middle;padding-top:2px;} +#content #sqleditbox {border:1px solid #738C88;background:#E4E9E8;margin-bottom:10px;} +#content #sqleditbox form {margin:10px;} +#content #sqleditbox p {background:#A5B6B4;font-weight:bold;text-align:center;} +#content #sqlnewbox {border:1px solid #738C88;background:#E4E9E8;} +#content #sqlnewbox p {background:#A5B6B4;font-weight:bold;text-align:center;} +#content #sqloutbox {font-size: 11px;width:700px;padding:6px;background:#D5DDDC;border:1px solid #738C88;overflow:auto;height:240px;} +#content p.autodel {font-size:11px;border-bottom:1px dashed #fff;margin-bottom:12px;} +#content .Logbox {font:12px/1.2 "Courier New", Courier, monospace;padding: 6px;border: thin solid #738C88;height: 320px;width: 90%;text-align: left;overflow: auto;} +#content .Logbox span {color:#738C88;} +#content .backupmsg {padding-left:20px;font-size:11px;} +#content .backupmsg .success,#content .backupmsg a{color:#999;font-size:11px;} +#content .backupmsg .error {color:red;} + +/* TEXT */ + +h1 {font-size:16px;} +h5 {font-size:14px;margin:12px 0;} +h6 {font-size:11px; background:#D1D4DC;border:1px solid #9AA2B1;text-indent: 12px;margin:8px 0;} + +/* Config */ +#configleft {float:left;width:160px;margin-top:24px;} +#configleft .Formbutton {width:130px;margin:8px 0;} +#configleft .ConfigButton {width:130px;font-size:11px;background:#E4E9E8;} +#configleft .ConfigButtonSelected {width: 130px;font-size: 11px;background: #D5DDDC;} + +#configright {font-size:11px;margin-left:160px;} +#configright fieldset {border:1px solid #D5DDDC;padding:12px;width:90%;} +#configright legend {color:#646968;margin:8px 0;} + + +#footer {font-size:11px;text-align:center;border-top:1px dashed #eee;margin-top:36px;} +#footer a {font-size:11px;} diff --git a/mysqldumper/dump.php b/mysqldumper/dump.php new file mode 100644 index 0000000..dac6d03 --- /dev/null +++ b/mysqldumper/dump.php @@ -0,0 +1,429 @@ +0) ? $config['minspeed'] : 50); +$dump['dump_encoding']= (isset($_POST['dump_encoding'])) ? urldecode($_POST['dump_encoding']):''; + +if (isset($_GET['select_dump_encoding'])) +{ + // Erstaufruf -> encoding auswerten + include_once('./inc/functions_sql.php'); + get_sql_encodings(); + $encodingline=$config['mysql_possible_character_sets'][$_GET['select_dump_encoding']]; + $encoding=explode(' ',$encodingline); + $dump['dump_encoding']=isset($encoding[0]) ? $encoding[0]:$encodingline; +} + +$mp2=array('Bytes','Kilobytes','Megabytes','Gigabytes'); +$cancelurl='dump.php?cancel=1&part='.$dump['part'].'&backupdatei='.urlencode($dump['backupdatei']).'&backupdateistructure='.urlencode($dump['backupdatei_structure']); +$aus2=$page_parameter=$debugausgabe=$a=''; +$dump['tabellen_gesamt']=0; + +if($cancel==1) { + //Abbruch durch Benutzer + //Wildcard erzeugen + $wildcard=substr($dump['backupdatei'],0,strlen($databases['db_actual'])+17); + $wildcard2=$dump['backupdatei_structure']; + echo $pageheader.'

Abruch durch Benutzer

Der Backupvorgang wurde unterbrochen.

'; + echo 'Folgende angefangene Backupdateien wurden gelöscht:

'; + echo $wildcard.'*
'.$wildcard2; + echo ''; + exit; +} + +FillMultiDBArrays(); + +if($databases['db_actual_tableselected']!='' && $config['multi_dump']==0) +{ + $dump['tblArray']=explode('|',$databases['db_actual_tableselected']); + $tbl_sel=true; + $msgTbl=sprintf($lang['nr_tables_selected'],count($dump['tblArray'])); +} + +//Zeitzähler aktivieren +$dump['max_zeit']=intval($config['max_execution_time']*$config['time_buffer']); +$dump['startzeit']=time(); +$xtime=(isset($_POST['xtime'])) ? $_POST['xtime']:time(); +$dump['countdata']= (!empty($_POST['countdata'])) ? $_POST['countdata'] : 0; +$dump['aufruf']= (!empty($_POST['aufruf'])) ? $_POST['aufruf'] : 0; +MSD_mysql_connect($dump['dump_encoding']); + +$flipped = array_flip($databases['Name']); +$dump['tables']=Array(); +$dump['records']=Array(); +$dump['totalrecords']=0; + +for($ii=0;$ii0) + { + for ($i=0;$i<$num_tables;$i++) + { + $row=mysql_fetch_array($tabellen); + if($config['optimize_tables_beforedump']==1 && $dump['table_offset']==-1) mysql_query('OPTIMIZE `'.$row['Name'].'`'); + if (isset($tbl_sel)) + { + if (in_array($row['Name'],$dump['tblArray'])) { + $dump['tables'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Name']; + $dump['records'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Rows']; + $dump['totalrecords']+=$row['Rows']; + } + } + elseif ($databases['praefix'][$dump['dbindex']]!='' && !isset($tbl_sel)) + { + if (substr($row['Name'],0,strlen($databases['praefix'][$dump['dbindex']]))==$databases['praefix'][$dump['dbindex']]) { + $dump['tables'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Name']; + $dump['records'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Rows']; + $dump['totalrecords']+=$row['Rows']; + } + } + else + { + $dump['tables'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Name']; + $dump['records'][]=$databases['Name'][$dump['dbindex']].'|'.$row['Rows']; + + // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs + $sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dump['dbindex']]."`.`".$row['Name']."`"; + $res2=@mysql_query($sql_2); + $row2=mysql_fetch_array($res2); + $row['Rows']=$row2['count_records']; + + + $dump['totalrecords']+=$row['Rows']; + } + } + } +} + +$num_tables=count($dump['tables']); +if($config['optimize_tables_beforedump']==1 && $dump['table_offset']==-1) $out.=sprintf($lang['nr_tables_optimized'],$num_tables).'
'; +$dump['data']=''; +$dump['structure']=''; +$dump['dbindex']=(isset($_POST['dbindex'])) ? $_POST['dbindex'] :$flipped[$databases['multi'][0]]; + +//Ausgaben-Header bauen +$aus_header[]= PicCache($relativ_path); +$aus_header[]= headline('Backup: '.(($config['multi_dump']==1) ? 'Multidump ('.count($databases['multi']).' '.$lang['dbs'].')' : $lang['db'].': '.$databases['Name'][$dump['dbindex']].(($databases['praefix'][$dump['dbindex']]!='') ?' ('.$lang['withpraefix'].' '.$databases['praefix'][$dump['dbindex']].')' : ''))); +if (isset($aus_error) && count($aus_error)>0) $aus_header=array_merge($aus_header,$aus_error); + +if(count($dump['tables'])==0) +{ + //keine Tabellen gefunden + $aus[]='

'.$lang['error'].': '.sprintf($lang['dump_notables'],$databases['Name'][$dump['dbindex']]).'

'; + if(!$config['multi_dump']==1) + { + echo $pageheader.implode("\n",$aus); + echo ''; + exit(); + } +} +else +{ + if ($dump['table_offset']==-1) + { + // File anlegen, da Erstaufruf + new_file(); + $dump['table_offset']=0; // jetzt kanns losgehen + flush(); + } + else + { + // SQL-Befehle ermitteln + $dump['restzeilen']=$dump['anzahl_zeilen']; + WHILE ( ($dump['table_offset'] < $num_tables) && ($dump['restzeilen']>0) ) + { + $table = substr($dump['tables'][$dump['table_offset']],strpos($dump['tables'][$dump['table_offset']],'|')+1); + $adbname=substr($dump['tables'][$dump['table_offset']],0,strpos($dump['tables'][$dump['table_offset']],'|')); + if($databases['Name'][$dump['dbindex']]!=$adbname) + { + //neue Datenbank + WriteLog('Dump \''.$dump['backupdatei'].'\' finished.'); + ExecuteCommand('a'); + if($config['multi_part']==1) + { + $out.=$lang['finished'].'
'; + $dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],'part_')).'part_'; + $dateiendung=($config['compression']==1) ? '.sql.gz':'.sql'; + for ($i=1;$i<($dump['part']-$dump['part_offset']);$i++) + { + $mpdatei=$dateistamm.$i.$dateiendung; + clearstatcache(); + $sz=byte_output(@filesize($config['paths']['backup'].$mpdatei)); + $out.= $lang['file'].' '.$mpdatei.' ('.$sz.') '.$lang['dump_successful'].'
'; + } + } + else + { + clearstatcache(); + $out.=$lang['finished'].'
'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')
'; + } + if ($config['send_mail']==1) DoEmail(); + if($config['ftp_transfer']==1) DoFTP(); + if(isset($flipped[$adbname])) $dump['dbindex']=$flipped[$adbname]; + $dump['part_offset']=$dump['part']-1; + $out.='

'; + new_file(); + } + $aktuelle_tabelle=$dump['table_offset']; + if ($dump['zeilen_offset']==0) + { + if($config['minspeed']>0) + { + $dump['anzahl_zeilen']=$config['minspeed']; + $dump['restzeilen']=$config['minspeed']; + } + $dump['data'] .= get_def($adbname,$table); + $dump['structure'].=get_def($adbname,$table,0); + } + WriteToDumpFile(); + get_content($adbname,$table); + $dump['restzeilen']--; + if($config['memory_limit']>0 && strlen($dump['data'])>$config['memory_limit']) WriteToDumpFile(); + } + } + + ///////////////////////////////// + // Anzeige - Fortschritt + ///////////////////////////////// + + if($config['multi_dump']==1) + { + $mudbs=''; + for($i=0;$i '; + else + $mudbs.= ''.$databases['multi'][$i].'   '; + } + } + if($config['multi_part']==1) $aus[]= '
Multipart-Backup: '.$config['multipartgroesse1'].' '.$mp2[$config['multipartgroesse2']].'
'; + + $aus[]= '

'.$lang['dump_headline'].'

'; + + if($dump['kommentar']) $aus[]= $lang['comment'].': '.$dump['kommentar'].'
'; + $aus[]=($config['multi_dump']==1) ? $lang['db'].': '.$mudbs : $lang['db'].': '.$databases['Name'][$dump['dbindex']].''; + $aus[]=(($databases['praefix'][$dump['dbindex']]!='') ?' ('.$lang['withpraefix'].' '.$databases['praefix'][$dump['dbindex']].')' : '').'
'; + if(isset($tbl_sel)) $aus[]= $msgTbl.'

'; + + if($config['multi_part']==1) + { + $aus[]= 'Multipart-Backup File '.($dump['part']-$dump['part_offset']-1).'
'; + $aus2=', '.($dump['part']-1).' files'; + } + $aus[]=$lang['dump_filename'].''.$dump['backupdatei'].'
'; + $aus[]=$lang['charset'].': '.$dump['dump_encoding'].''; + + $aus[]='
'.$lang['filesize'].': '.byte_output($dump['filesize']).'

'.$lang['gzip_compression'].' '; + $aus[]=($config['compression']==1) ? $lang['activated'] : $lang['not_activated']; + $aus[]='.
'; + + $table = @substr($dump['tables'][$dump['table_offset']],strpos($dump['tables'][$dump['table_offset']],'|')+1); + $adbname=@substr($dump['tables'][$dump['table_offset']],0,strpos($dump['tables'][$dump['table_offset']],'|')); + + $sql='SELECT COUNT(*) AS anzahl FROM `'.$table.'`'; + $res=mysql_query($sql); + if ($res) + { + $row=mysql_fetch_object($res); + $dump['zeilen_total']=intval($row->anzahl); + + if ($dump['zeilen_total']>0) $fortschritt=intval((100*$dump['zeilen_offset'])/$dump['zeilen_total']); + else $fortschritt=100; + + $aus[]= $lang['saving_table'].''.($dump['table_offset']+1).' '.$lang['of'].' '.sizeof($dump['tables']).'
' + .$lang['actual_table'].': '.$table.'

' + .$lang['progress_table'].':
'; + + $aus[]= '' + .'' + .'' + .''; + + if ($dump['anzahl_zeilen']+$dump['zeilen_offset']>=$dump['zeilen_total']) + { + $eintrag=$dump['zeilen_offset']+1; + $zeilen_gesamt=$dump['zeilen_total']; + if ($zeilen_gesamt==0) $eintrag=0; + } + else + { + $zeilen_gesamt=$dump['zeilen_offset']+$dump['anzahl_zeilen']; + $eintrag=$dump['zeilen_offset']+1; + } + + $aus[]= '' + .'
 '.($fortschritt).'%
'.$lang['entry'].' '.number_format($eintrag,0,',','.').' '.$lang['upto'].' ' + .number_format(($zeilen_gesamt),0,',','.').' '.$lang['of'].' ' + .number_format($dump['zeilen_total'],0,',','.').'
'; + + $dump['tabellen_gesamt']=(isset($dump['tables'])) ? count($dump['tables']) : 0; + + $noch_zu_speichern=$dump['totalrecords']-$dump['countdata']; + $prozent= ($dump['totalrecords']>0) ? round(((100*$noch_zu_speichern)/$dump['totalrecords']),0) : 100; + if ($noch_zu_speichern==0 || $prozent>100) $prozent=100; + + $aus[]= '
'.$lang['progress_over_all'].':' + .'' + .'' + .'' + .'
'.(100-$prozent).'%
'; + + //Speed-Anzeige + $fw=($config['maxspeed']==$config['minspeed']) ? 300 : round(($dump['anzahl_zeilen']-$config['minspeed'])/($config['maxspeed']-$config['minspeed'])*300,0); + if($fw>300)$fw=300; + $aus[]= '
'; + $aus[]= '
'; + $aus[]= 'Speed
'.$dump['anzahl_zeilen'].'
'; + $aus[]= ''; + $aus[]= '
'; + $aus[]= '
'; + $aus[]= ''; + $aus[]= ''; + $aus[]= '
'.$config['minspeed'].''.$config['maxspeed'].'
'; + + //Status-Text + $aus[]= '

'.zeit_format(time()-$xtime).', '.$dump['aufruf'].' pages'.$aus2; + $aus[]= ($dump['errors']>0) ? ', '.$dump['errors'].' errors' : ''; + $aus[]= '

'; + $aus[]= '
'.$out.'
'; + } + ////////////////////////////////////// + // Ende Anzeige + ////////////////////////////////////// + + WriteToDumpFile(); + + flush(); + if(!isset($summe_eintraege)) $summe_eintraege=0; + + if ($dump['table_offset']<=$dump['tabellen_gesamt']) + { + $dauer=time()-($xtime+$dump['verbraucht']); + $dump['verbraucht']+=$dauer; + $summe_eintraege+=$dump['anzahl_zeilen']; + + //Zeitanpassung + if($config['direct_connection']==1) { + if ($dauer<$dump['max_zeit']) $dump['anzahl_zeilen']=$dump['anzahl_zeilen']*$config['tuning_add']; + else $dump['anzahl_zeilen']=$dump['anzahl_zeilen']*$config['tuning_sub']; + $dump['anzahl_zeilen']=round($dump['anzahl_zeilen'],0); + if($config['minspeed']>0) {if ($dump['anzahl_zeilen']<$config['minspeed']) $dump['anzahl_zeilen']=$config['minspeed'];} + if($config['maxspeed']>0) {if($dump['anzahl_zeilen']>$config['maxspeed']) $dump['anzahl_zeilen']=$config['maxspeed'];} + } + $dump['aufruf']++; + } + else + { + //Backup fertig + $dump['data']="\n".$mysql_commentstring.' EOB - End of backup\n\n\n'; + WriteToDumpFile(); + ExecuteCommand('a'); + chmod($config['paths']['backup'].$dump['backupdatei'],0755); + if($config['multi_part']==1) + { + $out.='
'; + $dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],'part_')).'part_'; + $dateiendung=($config['compression']==1) ? '.sql.gz':'.sql'; + clearstatcache(); + for ($i=1;$i<($dump['part']-$dump['part_offset']);$i++) + { + $mpdatei=$dateistamm.$i.$dateiendung; + $sz=byte_output(@filesize($config['paths']['backup'].$mpdatei)); + $out.= $lang['file'].' '.$mpdatei.' ('.$sz.') '.$lang['dump_successful'].'
'; + } + + } + else $out.='
'.$lang['file']. + ' '.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')' + .''.$lang['dump_successful'].'
'; + + $backup_ready=1; + $xtime=time()-$xtime; + $aus=Array(); + $aus[]= '
'; + if($config['multi_dump']==1) + { + WriteLog('Dump \''.$dump['backupdatei'].'\' finished.'); + WriteLog('Multidump: '.count($databases['multi']).' Databases in '.zeit_format($xtime).'.'); + } + else WriteLog('Dump \''.$dump['backupdatei'].'\' finished in '.zeit_format($xtime).'.'); + + if ($config['send_mail']==1) DoEmail(); + if($config['ftp_transfer']==1) DoFTP(); + $out.='
'; + + $aus[]= ''.$lang['done'].'
'; + + if($config['multi_dump']==1) + { + $aus[]= sprintf($lang['multidump'],count($databases['multi'])).': '; + + $aus[]=''.implode(', ',$databases['multi']).''; + //$out=''; + } + else + { + $aus[]= '
'.sprintf($lang['dump_endergebnis'],$num_tables,number_format($dump['countdata'],0,',','.')); + } + if($dump['errors']>0) $aus[]=sprintf($lang['dump_errors'],$dump['errors']); + + $aus[]=''.$out.'
' + .'

'.zeit_format($xtime).', '.$dump['aufruf'].' pages'.$aus2.'

' + .str_repeat(' ',60); + $aus[]= '
'; + $aus[]= '   '; + $aus[]= '   

'; + + $DumpFertig=1; + } +} + + +//===================================================================== +//================= Anzeige =========================================== +//===================================================================== + +//Seite basteln +$config_array=(isset($config)) ? 'CONFIG
'.@print_r($config,true).'
': ''; +$database_array=(isset($database)) ? 'DATABASE
'.@print_r($database,true).'
': ''; +$dump_array=(isset($dump)) ? 'DUMP
'.@print_r($dump,true).'
': ''; +$aus=array_merge($aus_header,$aus); + +$dump['xtime']=$xtime; +if ($DumpFertig!=1) $page_parameter=get_page_parameter($dump); + +$pagefooter=($DumpFertig==1) ? '

Daniel Schlichtholz & Steffen Kamper - Infoboard: '.$config['homepage'].'

' : ''; +$pagefooter.='
'; + +$js_aufruf_automatisch=$page_parameter.''; +$selbstaufruf=($page_parameter=='') ? '' : $js_aufruf_automatisch; +$complete_page=$pageheader.implode("\n",$aus).$selbstaufruf.$pagefooter; +echo $complete_page; +?> \ No newline at end of file diff --git a/mysqldumper/filemanagement.php b/mysqldumper/filemanagement.php new file mode 100644 index 0000000..c232bae --- /dev/null +++ b/mysqldumper/filemanagement.php @@ -0,0 +1,518 @@ +parent.MySQL_Dumper_content.location.href="dump.php?comment='.urlencode($dk) + .'&select_dump_encoding='.$dump['select_dump_encoding'] + .'";'; + exit; +} + +//-------------------------------------------------------- +//*** Abfrage ob Dump *** +//-------------------------------------------------------- +if (isset($_POST['dump'])) +{ + $dk=(isset($_POST['dumpKommentar'])) ? ((get_magic_quotes_gpc()) ? stripslashes($_POST['dumpKommentar']) : $_POST['dumpKommentar']) : ""; + if(isset($_POST['tblfrage']) && $_POST['tblfrage']==1) { + //Tabellenabfrage + $tblfrage_refer="dump"; + include ("inc/tabellenabfrage.php"); + exit; + } else { + @$check_dir=TestWorkDir(); + if (!$check_dir===true) die($check_dir); + $databases['db_actual_tableselected']=""; + WriteParams(1,$config,$databases); + + $dump['fileoperations']=0; + echo ''; + } +} + +//-------------------------------------------------------- +//*** Abfrage ob Restore nach Tabellenaufruf *** +//-------------------------------------------------------- +if (isset($_POST['restore_tbl'])) +{ + $databases['db_actual_tableselected']=substr($_POST['tbl_array'],0,strlen($_POST['tbl_array'])-1); + WriteParams(1,$config,$databases); + + echo ''; + + exit; +} +//-------------------------------------------------------- +//*** Abfrage ob Restore *** +//-------------------------------------------------------- +if (isset($_POST['restore'])) +{ + if (isset($_POST['file'])) + { + if(isset($_POST['tblfrage']) && $_POST['tblfrage']==1) + { + //Tabellenabfrage + $tblfrage_refer="restore"; + $filename=urldecode($_POST['file'][0]); + include ("inc/tabellenabfrage.php"); + exit; + } + else + { + $file=$_POST['file'][0]; + $statusline=read_statusline_from_file($file); + if (isset($_POST['select_dump_encoding_restore'])) + { + $encodingstring=$config['mysql_possible_character_sets'][$_POST['select_dump_encoding_restore']]; + $encoding=explode(' ',$encodingstring); + $dump_encoding=$encoding[0]; + } + else + { + if (!isset($statusline['charset']) || trim($statusline['charset'])=='?') + { + echo headline($lang['fm_restore'].': '.$file); + + // if we can't detect encoding ask user + echo '
'.$lang['choose_charset'].'

'; + echo '
'; + echo ''; + + echo '
'.$lang['fm_choose_encoding'].':'; + echo '
'; + echo $lang['mysql_connection_encoding'].':'.$config['mysql_standard_character_set'].'

'; + echo ''; + echo '
'; + exit(); + } + else $dump_encoding=$statusline['charset']; + } + + $databases['db_actual_tableselected']=""; + WriteParams(1,$config,$databases); + echo ''; + } + } + else + $msg.= '

'.$lang['fm_nofile'].'

'.br(); +} + + +//-------------------------------------------------------- +//*** Abfrage ob Delete *** +//-------------------------------------------------------- +if (isset($_POST['delete']) ) +{ + $msg=""; + if (isset($_POST['file'])) + { + $file=$_POST['file']; + //hier muss die Abfrage checkbox/radiobox rein + if($_POST['multi']==1) { + $delfiles=Array(); + $msg.= '

'; + for($i=0;$i'; + } else { + for ($j=0; $j'; + WriteLog("deleted '$del[$j]'."); + } + } + + } + $msg.='

'; + + + } else { + + if($_POST['multipart'][0]==0) { + $delfiles[]=$_POST['file'][0]; + } else { + $delfiles[]=substr($_POST['file'][0],0,strpos($_POST['file'][0],"_part_"))."*.*"; + } + + $del=DeleteFilesM($fpath,$delfiles[0]); + if($del==0){ + $msg.= '

'.$lang['fm_delete1'].$fpath.$_POST['file'][0].$lang['fm_delete3'].'

'; + } else { + for ($j=0; $j'; + WriteLog("deleted '$del[$j]'."); + } + } + } + } + else + $msg.= '

'.$lang['fm_nofile'].'

'.br(); +} +if (isset($_POST['deleteauto']) ) $msg.='

'.AutoDelete().'

'; + +if (isset($_POST['deleteall']) ) +{ + //hier kommt alldelete rein + $del=DeleteFilesM($fpath,"*.sql"); + if($del==0){ + //$msg.="Fehler beim löschen!"; + }else{ + for ($i=0; $i'; + WriteLog("deleted '$del[$i]'."); + } + $msg.='

'; + } + $del=DeleteFilesM($fpath,"*.gz"); + +} + +if (isset($_POST['deleteallfilter']) ) +{ + //hier kommt alldelete rein + $del=DeleteFilesM($fpath,$databases['db_actual']."*"); + if($del==0){ + //$msg.="Fehler beim löschen!"; + }else{ + for ($i=0; $i'; + WriteLog("deleted '$del[$i]'."); + } + $msg.='

'; + } +} + +////////////////////////////////// +// Upload +/////////////////////////////////// +if (isset($_POST['upload'])) +{ + $error=false; + if (!isset($_FILES['upfile']['name'])) echo ''.$lang['fm_uploadfilerequest'].'

'; + else + { + if (!file_exists($fpath.$_FILES['upfile']['name'])) + { + // Extension ermitteln -strrpos fängt hinten an und ermittelt somit den letzten Punkt + $endung=strrchr($_FILES['upfile']['name'],"."); + $erlaubt=ARRAY(".gz",".sql"); + if (!in_array($endung,$erlaubt)) + { + $msg.= "".$lang['fm_uploadnotallowed1']."
"; + $msg.= $lang['fm_uploadnotallowed2']."
"; + } + else + { + if (!$error) + { + if (move_uploaded_file($_FILES['upfile']['tmp_name'],$fpath.$_FILES['upfile']['name'])) @chmod($fpath.$upfile_name,0755); + else $error.="".$lang['fm_uploadmoveerror']."
"; + } + if ($error) $msg.= $error."".$lang['fm_uploadfailed']."
"; + } + } + else $msg.= "".$lang['fm_uploadfileexists']."
"; + } +} + + +//Seitenteile vordefinieren +$href='filemanagement.php?action='.$action.'&kind='.$kind; + + + + +//$tbl_abfrage=' '; +if($config['multi_dump']==0) $tbl_abfrage=''.$lang['fm_selecttables'].''; +$dk= (isset($_POST['dumpKommentar'])) ? htmlentities($_POST['dumpKommentar']):''; +$tbl_abfrage.=''.$lang['fm_comment'].':'; + +$autodel='

'.$lang['autodelete'].": "; +$abue=($config['max_backup_files_each']==1)? $lang['max_backup_files_each2'] :$lang['max_backup_files_each1']; +$abue2=($config['del_files_after_days']>0) ? $lang['age_of_files']."=".$config['del_files_after_days'].", " : ""; +$autodel.=($config['auto_delete']==0) ? $lang['not_activated'] : $lang['activated']." (".$abue2.$lang['number_of_files_form']."=".$config['max_backup_files']." -> ".$abue.")"; +$autodel.='

'.br().br(); + +//Fallunterscheidung + + + +switch ($action) { + case "dump": + //Variablen + if($config['multi_dump']==0) DBDetailInfo($databases['db_selected_index']); + $cext=($config['cron_extender']==0) ? "pl" : "cgi"; + $actualUrl=substr($_SERVER['SCRIPT_NAME'],0,strrpos($_SERVER['SCRIPT_NAME'],"/")+1); + if(substr($actualUrl,-1)!="/") $actualUrl.="/"; + if(substr($actualUrl,0,1)!="/") $actualUrl="/$actualUrl"; + $refdir=(substr($config['cron_execution_path'],0,1)=="/") ? "" : $actualUrl; + $scriptdir=$config['cron_execution_path'].'crondump.'.$cext; + $sfile=$config['cron_execution_path']."perltest.$cext"; + $simplefile=$config['cron_execution_path']."simpletest.$cext"; + $scriptentry=Realpfad("./").$config['paths']['config']; + $cronabsolute=(substr($config['cron_execution_path'],0,1)=="/") ? $_SERVER['DOCUMENT_ROOT'].$scriptdir : Realpfad("./").$scriptdir; + $confabsolute=$config['cron_configurationfile']; + $scriptref="http://".$_SERVER['SERVER_NAME'].$refdir.$config['cron_execution_path'].'crondump.'.$cext."?config=".$confabsolute; + $cronref="perl ".$cronabsolute." config=".$confabsolute; + + //Ausgabe + echo headline($lang['fm_dump_header']); + if(!is_writable($config['paths']['backup'])) die(''.sprintf($lang['wrong_rights'],'work/backup','777').''); + + echo (isset($msg) && $msg!="")?"$msg
":""; + echo $autodel; + + //Auswahl + echo '
+ +       + +
'; + + echo '
'; + + //Dumpsettings + echo '
'.$lang['dump'].' (PHP)
'; + + echo br(3).'
'.br(); + echo ''; + + echo ''.$tbl_abfrage; + echo ''; + echo ''; + echo ''; + echo '
'.$lang['fm_choose_encoding'].':
'.$lang['mysql_connection_encoding'].':'.$config['mysql_standard_character_set'].'
'; + + + echo '
'.$lang['fm_dumpsettings'].' (PHP)
'; + + echo ''.$lang['db'].': '. + (($config['multi_dump']==1) ? + 'Multidump ('.count($databases['multi']).' '.$lang['dbs'].')' + : + $databases['db_actual'].'  ('.$databases['Detailinfo']['tables']." Tables, ".$databases['Detailinfo']['records']." Records, ".byte_output($databases['Detailinfo']['size']).")").''; + echo '   '.$lang['praefix'].': '.(($config['multi_dump']==1) ? '-' : $databases['praefix'][$databases['db_selected_index']]).''; + echo '
'.$lang['gzip'].': '.(($config['compression']==1) ? $lang['activated'] : $lang['not_activated']).''; + echo '   '.$lang['multi_part'].': '.(($config['multi_part']==1) ? $lang['yes'] : $lang['no']).''; + if($config['multi_part']==1) { + echo '   '.$lang['multi_part_groesse'].': '.byte_output($config['multipart_groesse']); + } + echo '
'.$lang['backup_format'].': '; + $t=''; + if($config['backup_complete_inserts']==1) $t.=$lang['inserts_complete']." / "; + if($config['backup_extended_inserts']==1) $t.=$lang['inserts_extended']." / "; + if($config['backup_ignore_inserts']==1) $t.=$lang['inserts_ignore']." / "; + if($config['backup_delayed_inserts']==1) $t.=$lang['inserts_delayed']." / "; + if($config['backup_lock_tables']==1 && $config['backup_delayed_inserts']==0) $t.=$lang['lock_tables']." / "; + $t=($t=="") ? $lang['normal'] : substr($t,0,strlen($t)-3); + if($config['backup_downgrade']==1) $t.='   '.htmlspecialchars($lang['downgrade']); + + echo $t.'
'; + + if($config['send_mail']==1) { + $t=$config['email_recipient'].(($config['send_mail_dump']==1) ? $lang['withattach'] : $lang['withoutattach']); + } + echo ''.$lang['send_mail_form'].': '.(($config['send_mail']==1) ? $t : $lang['not_activated']); + echo ''; + + echo '
'.$lang['ftp_transfer'].': '.(($config['ftp_transfer']==1) ? $lang['activated'] : $lang['not_activated']); + if($config['ftp_transfer']==1) { + echo 'Host: '.$config['ftp_server'][$config['ftp_connectionindex']].' Port '.$config['ftp_port'][$config['ftp_connectionindex']].' User: '.$config['ftp_user'][$config['ftp_connectionindex']].' Dir: '.$config['ftp_dir'][$config['ftp_connectionindex']]; + } + + echo '

'; + + echo '
'; + + break; + + case "restore": + echo headline($lang['fm_restore_header'].$databases['db_actual'].$lang['fm_restore_header2']); + echo (isset($msg) && $msg!="")?"$msg":""; + echo $autodel; + + echo br(3).'
'.br(); + echo '
'.br(); + echo ''; + echo FileList(); + echo '
'.br(); + + break; + case "files": + $sysfedit=(isset($_POST['sysfedit'])) ? 1 : 0; + $sysfedit=(isset($_GET['sysfedit'])) ? $_GET['sysfedit'] : $sysfedit; + echo headline($lang['file_manage']); + echo (isset($msg) && $msg!="") ? $msg.'
' : ''; + echo $autodel; + + echo ''.br(); + echo br(3).'
'.br(); + echo br().''.br(); + echo br().''.br(); + echo br().''.br(); + echo br().''.br(); + + echo FileList().'
'.br(); + + echo '
'.$lang['fm_fileupload'].'
'.br(); + echo '
'.br(); + echo ''.br(); + echo ''.br(); + echo '
'.$lang['max_upload_size'].': '.$config['upload_max_filesize'].''; + echo '
'.$lang['max_upload_size_info']; + + echo '
'.br(); + + echo '
Tools
'; + echo ''; + echo '
'; + + break; + case "convert": + // Konverter + echo headline($lang['converter']); + echo '

'; + echo '
'; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'.$lang['convert_title'].'
'.$lang['convert_file'].''.FilelisteCombo($config['paths']['backup'],$selectfile).'
'.$lang['convert_filename'].':
'.$lang['compressed'].'

'; + if(isset($_POST['startconvert'])) { + $destfile.=($compressed==1) ? ".sql.gz" : ".sql"; + echo $lang['converting']." $selectfile ==> $destfile
"; + + if($selectfile!="" && file_exists($config['paths']['backup'].$selectfile) && strlen($destfile)>2) { + Converter($selectfile,$destfile,$compressed); + } + else echo $lang['convert_wrong_parameters']; + } + +} + +echo ''.br(3); +echo MSDFooter(); + + + +?> + diff --git a/mysqldumper/images/blank.gif b/mysqldumper/images/blank.gif new file mode 100644 index 0000000..076c753 Binary files /dev/null and b/mysqldumper/images/blank.gif differ diff --git a/mysqldumper/images/h1_logo.gif b/mysqldumper/images/h1_logo.gif new file mode 100644 index 0000000..d6a339b Binary files /dev/null and b/mysqldumper/images/h1_logo.gif differ diff --git a/mysqldumper/images/konqueror.png b/mysqldumper/images/konqueror.png new file mode 100644 index 0000000..3fb315d Binary files /dev/null and b/mysqldumper/images/konqueror.png differ diff --git a/mysqldumper/images/logo.gif b/mysqldumper/images/logo.gif new file mode 100644 index 0000000..7f5bac8 Binary files /dev/null and b/mysqldumper/images/logo.gif differ diff --git a/mysqldumper/images/mozilla.png b/mysqldumper/images/mozilla.png new file mode 100644 index 0000000..fc347eb Binary files /dev/null and b/mysqldumper/images/mozilla.png differ diff --git a/mysqldumper/images/msie.png b/mysqldumper/images/msie.png new file mode 100644 index 0000000..6dbe4d0 Binary files /dev/null and b/mysqldumper/images/msie.png differ diff --git a/mysqldumper/images/omniweb.png b/mysqldumper/images/omniweb.png new file mode 100644 index 0000000..6f07f16 Binary files /dev/null and b/mysqldumper/images/omniweb.png differ diff --git a/mysqldumper/images/opera.png b/mysqldumper/images/opera.png new file mode 100644 index 0000000..9b70988 Binary files /dev/null and b/mysqldumper/images/opera.png differ diff --git a/mysqldumper/images/safari.png b/mysqldumper/images/safari.png new file mode 100644 index 0000000..683f2ea Binary files /dev/null and b/mysqldumper/images/safari.png differ diff --git a/mysqldumper/images/schriftzug_logo.png b/mysqldumper/images/schriftzug_logo.png new file mode 100644 index 0000000..04989f6 Binary files /dev/null and b/mysqldumper/images/schriftzug_logo.png differ diff --git a/mysqldumper/inc/footer.php b/mysqldumper/inc/footer.php new file mode 100644 index 0000000..75650aa --- /dev/null +++ b/mysqldumper/inc/footer.php @@ -0,0 +1,15 @@ +CONFIG
".@print_r($config,true)."
": ""; +$database_array=(isset($database)) ? "DATABASE
".@print_r($database,true)."
": ""; +$dump_array=(isset($dump)) ? "DUMP
".@print_r($dump,true)."
": ""; +$restore_array=(isset($restore)) ? "RESTORE
".@print_r($restore,true)."
" : ""; + +echo '

'.$lang['authors'].':  + +Daniel Schlichtholz & Steffen Kamper - Infoboard: +'. +$config['homepage'].'

'; + +echo ''; + +?> diff --git a/mysqldumper/inc/functions.php b/mysqldumper/inc/functions.php new file mode 100644 index 0000000..682f448 --- /dev/null +++ b/mysqldumper/inc/functions.php @@ -0,0 +1,523 @@ +Help'; + } else { + return 'Help'; + } +} + +function DeleteFilesM($dir, $pattern = "*.*") +{ + $deleted = false; + $pattern = str_replace(array("\*","\?"), array(".*","."), preg_quote($pattern)); + if (substr($dir,-1) != "/") $dir.= "/"; + if (is_dir($dir)) + { $d = opendir($dir); + while ($file = readdir($d)) + { if (is_file($dir.$file) && ereg("^".$pattern."$", $file)) + { + if (unlink($dir.$file)) $deleted[] = $file; + } + } + closedir($d); + return $deleted; + } + else return 0; +} + +function SetDefault($load_default=false) +{ + global $config,$databases,$nl,$out,$lang,$preConfig; + + //Arrays löschen + $i=0; + $databases['Name']=Array(); + + $old_lang=isset($config['language']) && in_array($config['language'],$lang['languages']) ? $config['language'] : ''; + if($load_default==true) + { + if(file_exists($config['files']['parameter'])) @unlink($config['files']['parameter']); + include("./config.php"); + if(is_array($preConfig)) { + foreach($preConfig as $key=>$val) {$config[$key]=$val;} + } + + if($old_lang!='') $config['language']=$old_lang; + include("./language/".$config['language']."/lang.php"); + } + + //DB-Liste holen + MSD_mysql_connect(); + + $create_statement='CREATE TABLE `mysqldumper_test_abcxyvfgh` (`test` varchar(200) default NULL, `id` bigint(20) unsigned NOT NULL auto_increment,' + .'PRIMARY KEY (`id`)) TYPE=MyISAM;'; + + $res = mysql_query("SHOW DATABASES ;",$config['dbconnection']); + if (!$res===false) + { + $numrows=mysql_numrows($res); + $a=0; + for($i=0;$i<$numrows;$i++) + { + $row = mysql_fetch_row($res); + $found_db=$row[0]; + + // Testverbindung - Tabelle erstellen, nachschauen, ob es geklappt hat und dann wieder löschen + $use=@mysql_select_db($found_db); + if ($use) + { + $res2=mysql_query("DROP TABLE IF EXISTS `mysqldumper_test_abcxyvfgh`",$config['dbconnection']); + $res2=mysql_query($create_statement,$config['dbconnection']); + if (!$res2===false) + { + $res2=mysql_query("DROP TABLE IF EXISTS `mysqldumper_test_abcxyvfgh`",$config['dbconnection']); + + if( isset($old_db) && $found_db==$old_db) $databases['db_selected_index']=$a; + $databases['Name'][$a]=$found_db; + $databases['praefix'][$a]=""; + $databases['command_before_dump'][$a] = ""; + $databases['command_after_dump'][$a] = ""; + $out.=$lang['saving_db_form']." ".$found_db." ".$lang['added']."$nl"; + $a++; + } + } + } + if(!isset($databases['db_selected_index'])) + { + $databases['db_selected_index']=0; + $databases['db_actual']=$databases['Name'][0]; + } + $databases['db_actual_cronpraefix']=""; + $databases['db_actual_cronindex']=0; + } + + WriteParams(1); + if($load_default===true) WriteLog("default settings loaded."); + + return $out; +} + +function WriteParams($as=0) +{ + global $config,$databases,$config_dontsave; + $nl="\n"; + FillMultiDBArrays(); + check_manual_dbs(); + + //Parameter zusammensetzen + $config['multipart_groesse']=$config['multipartgroesse1']*(($config['multipartgroesse2']==1) ? 1024 : 1024*1024); + $param=$pars_all=' $val){ + if (!in_array($var,$config_dontsave)) + { + if(is_array($val)) { + foreach($val as $var2 => $val2){ + if ($config['magic_quotes_gpc']==0 || $as==1) { + $pars_all.='$config[\''.$var.'\']['.((is_int($var2)) ? $var2 : "'".$var2."'").'] = \''.addslashes($val2)."';$nl"; + } else { + $pars_all.='$config[\''.$var.'\']['.((is_int($var2)) ? $var2 : "'".$var2."'").'] = \''.$val2."';$nl"; + } + } + } else { + if ($config['magic_quotes_gpc']==0 || $as==1) { + if(!in_array($var,$config_dontsave)) $pars_all.='$config[\''.$var.'\'] = \''.addslashes($val)."';$nl"; + } else { + if(!in_array($var,$config_dontsave)) $pars_all.='$config[\''.$var.'\'] = \''.$val."';$nl"; + } + } + } + } + foreach($databases as $var => $val){ + if(is_array($val)) { + foreach($val as $var2 => $val2){ + if ($config['magic_quotes_gpc']==0 || $as==1) { + $pars_all.='$databases[\''.$var.'\']['.((is_int($var2)) ? $var2 : "'".$var2."'").'] = \''.addslashes($val2)."';$nl"; + } else { + $pars_all.='$databases[\''.$var.'\']['.((is_int($var2)) ? $var2 : "'".$var2."'").'] = \''.$val2."';$nl"; + } + } + } else { + if ($config['magic_quotes_gpc']==0 || $as==1) { + $pars_all.='$databases[\''.$var.'\'] = \''.addslashes($val)."';$nl"; + } else { + $pars_all.='$databases[\''.$var.'\'] = \''.$val."';$nl"; + } + } + } + + + + $param.='?>'; $pars_all.='?>'; + + //Datei öffnen und schreiben + $ret=true; + @chmod($config['files']['parameter'], 0777); + if ($fp=fopen($config['files']['parameter'], "wb")) + { + if (!fwrite($fp,$pars_all)) $ret=false; + if (!fclose($fp)) $ret=false; + } + else $ret=false; + + $ret=WriteCronScript(); + + return $ret; +} + +function escape_specialchars($text) +{ +// $tomask=Array('@'=>'\@','$'=>'\$','\\'=>'\\\\'); + $suchen=ARRAY('@','$','\\\\'); + $ersetzen=ARRAY('\@','\$','\\'); + $text=str_replace($suchen,$ersetzen,$text); + return $text; +} + +function WriteCronScript() +{ + + global $nl, $config, $databases, $cron_save_all_dbs, + $cron_db_array,$cron_dbpraefix_array,$cron_db_cbd_array,$cron_db_cad_array; + + if (!isset($databases['db_selected_index'])) $databases['db_selected_index']=0; + if(!isset($databases['praefix'][$databases['db_selected_index']])) $databases['praefix'][$databases['db_selected_index']]=""; + if(!isset($databases['db_actual_cronindex'])) $databases['db_actual_cronindex']=$databases['db_selected_index']; + if(!isset($config['email_maxsize'])) $config['email_maxsize']=$config['email_maxsize1']*(($config['email_maxsize2']==1) ? 1024 : 1024*1024); + + if($config['cron_samedb']==0) + { + $cron_dbname=(isset($databases['db_actual'])) ? $databases['db_actual']:0; + $cron_dbpraefix = $databases['praefix'][$databases['db_selected_index']]; + } + else + { + if($databases['db_actual_cronindex']>=0) + { + $cron_dbname=$databases['Name'][$databases['db_actual_cronindex']]; + $cron_dbpraefix = $databases['db_actual_cronpraefix']; + + } + else + { + $cron_dbname=$databases['db_actual']; + $cron_dbpraefix = $databases['praefix'][$databases['db_selected_index']]; + } + } + + if($databases['db_actual_cronindex']=="-2") + { + $cron_save_all_dbs=1; + $datenbanken=count($databases['Name']); + $cron_db_array=str_replace(";","|",$databases['multisetting']); + $cron_dbpraefix_array=str_replace(";","|",$databases['multisetting_praefix']); + $cron_db_cbd_array=str_replace(";","|",$databases['multisetting_commandbeforedump']); + $cron_db_cad_array=str_replace(";","|",$databases['multisetting_commandafterdump']); + } + + if ($databases['db_actual_cronindex']=="-3") + { + $cron_save_all_dbs=1; + $cron_db_array=implode("|",$databases['Name']); + $cron_dbpraefix_array=implode("|",$databases['praefix']); + $cron_db_cbd_array=implode("|",$databases['command_before_dump']); + $cron_db_cad_array=implode("|",$databases['command_after_dump']); + } + + if($databases['db_actual_cronindex']<0) + { + $csadb='$cron_save_all_dbs=1;'.$nl; + $csadb.='$cron_db_array=qw('.$cron_db_array.');'.$nl; + $csadb.='$cron_dbpraefix_array=qw('.$cron_dbpraefix_array.');'.$nl; + $csadb.='$dbpraefix="";'.$nl; + $csadb.='$command_beforedump_array="'.$cron_db_cbd_array.'";'.$nl; + $csadb.='$command_afterdump_array="'.$cron_db_cad_array.'";'.$nl; + } + else + { + $csadb='$cron_save_all_dbs=0;'.$nl; + $csadb.='$cron_db_array="";'.$nl; + $csadb.='$cron_dbpraefix_array="";'.$nl; + $csadb.='$dbpraefix="'.$cron_dbpraefix.'";'.$nl; + if (!isset($databases['command_before_dump'][$databases['db_selected_index']])) $databases['command_before_dump'][$databases['db_selected_index']]=''; + $csadb.='$command_beforedump_array="'.$databases['command_before_dump'][$databases['db_selected_index']].'";'.$nl; + if (!isset($databases['command_after_dump'][$databases['db_selected_index']])) $databases['command_after_dump'][$databases['db_selected_index']]=''; + $csadb.='$command_afterdump_array="'.$databases['command_after_dump'][$databases['db_selected_index']].'";'.$nl; + } + + + $r=str_replace("\\\\","/",$config['paths']['root']); + $r=str_replace("@","\@",$r); + $p1=$r.$config['paths']['backup']; + $p2=$r.$config['files']['perllog'].(($config['logcompression']==1) ? '.gz':''); + $p3=$r.$config['files']['perllogcomplete'].(($config['logcompression']==1) ? '.gz':''); + + // auf manchen Server wird statt 0 ein leerer String gespeichert -> fuehrt zu einem Syntax-Fehler + // hier die entsprechenden Ja/Nein-Variablen sicherheitshalber in intvalues aendern + $int_array=array('dbport','cron_compression','cron_printout','cron_mail','cron_mail_dump','multi_part', + 'multipart_groesse','email_maxsize','auto_delete','del_files_after_days', + 'del_files_after_days','max_backup_files','perlspeed','optimize_tables_beforedump', + 'logcompression','log_maxsize','backup_complete_inserts','backup_extended_inserts', + 'backup_delayed_inserts','backup_ignore_inserts','backup_lock_tables','cron_completelog'); + foreach ($int_array as $i) + { + $config[$i]=intval($config[$i]); + } + if ($config['dbport']==0) $config['dbport']=3306; + + $cronscript=""; + + + //Datei öffnen und schreiben + $ret=true; + + + + $ext=($config['cron_extender']==0) ? "pl" : "cgi"; + + $sfile=$config['paths']['config'].$config['cron_configurationfile']; + if(substr($sfile,-5)=='.conf') { + @unlink($sfile); + $sfile.='.php'; + } + if(file_exists($sfile)) @chmod("$sfile",0777); + + if ($fp=fopen($sfile, "wb")) + { + if (!fwrite($fp,$cronscript)) $ret=false; + if (!fclose($fp)) $ret=false; + } + else $ret=false; + + if(file_exists($config['paths']['config']."mysqldumper.conf")) @unlink($config['paths']['config']."mysqldumper.conf"); + + if(!file_exists($config['paths']['config']."mysqldumper.conf.php")) { + $sfile=$config['paths']['config']."mysqldumper.conf.php"; + if ($fp=fopen($sfile, "wb")) + { + if (!fwrite($fp,$cronscript)) $ret=false; + if (!fclose($fp)) $ret=false; + //chmod("$sfile",0755); + } + else $ret=false; + } + return $ret; + +} + +function LogFileInfo($logcompression) { + global $config; + + $l=Array();$sum=$s=$l['log_size']=$l['perllog_size']=$l['perllogcomplete_size']=$l['errorlog_size']=$l['log_totalsize']=0; + if($logcompression==1) { + $l['log']=$config['files']['log'].".gz"; + $l['perllog']=$config['files']['perllog'].".gz"; + $l['perllogcomplete']=$config['files']['perllogcomplete'].".gz"; + $l['errorlog']=$config['paths']['log']."error.log.gz"; + } else { + $l['log']=$config['files']['log']; + $l['perllog']=$config['files']['perllog']; + $l['perllogcomplete']=$config['files']['perllogcomplete']; + $l['errorlog']=$config['paths']['log']."error.log"; + } + $l['log_size']+=@filesize($l['log']);$sum+=$l['log_size']; + $l['perllog_size']+=@filesize($l['perllog']);$sum+=$l['perllog_size']; + $l['perllogcomplete_size']+=@filesize($l['perllogcomplete']);$sum+=$l['perllogcomplete_size']; + $l['errorlog_size']+=@filesize($l['errorlog']);$sum+=$l['errorlog_size']; + $l['log_totalsize']+=$sum; + + + return $l; +} + +function DeleteLog() +{ + global $config; + //Datei öffnen und schreiben + $log=date('d.m.Y H:i:s')." Log created.\n"; + if($config['logcompression']==1) { + $fp = @gzopen($config['files']['log'].'.gz', "wb"); + @gzwrite ($fp,$log); + @gzclose ($fp); + @chmod($config['files']['log'].'.gz',0755); + } else { + $fp = @fopen($config['files']['log'], "wb"); + @fwrite ($fp,$log); + @fclose ($fp); + @chmod($config['files']['log'],0755); + } +} + +function SwitchLogfileFormat() +{ + global $config; + $del=DeleteFilesM($config['paths']['log'],"*"); + DeleteLog(); +} + + +function CreateDirsFTP() { + + global $config,$lang,$install_ftp_server,$install_ftp_port,$install_ftp_user_name,$install_ftp_user_pass,$install_ftp_path; + // Herstellen der Basis-Verbindung + echo '
'.$lang['connect_to'].' `'.$install_ftp_server.'` Port '.$install_ftp_port.' ...
'; + $conn_id = ftp_connect($install_ftp_server); + // Einloggen mit Benutzername und Kennwort + $login_result = ftp_login($conn_id, $install_ftp_user_name, $install_ftp_user_pass); + // Verbindung überprüfen + if ((!$conn_id) || (!$login_result)) { + echo $lang['ftp_notconnected']; + echo $lang['connwith']." $tinstall_ftp_server ".$lang['asuser']." $install_ftp_user_name ".$lang['notpossible']; + return 0; + } else { + if ($config['ftp_mode']==1) ftp_pasv($conn_id,true); + //Wechsel in betroffenes Verzeichnis + echo $lang['changedir'].' `'.$install_ftp_path.'` ...
'; + ftp_chdir($conn_id,$install_ftp_path); + // Erstellen der Verzeichnisse + echo $lang['dircr1'].' ...
'; + ftp_mkdir($conn_id,"work"); + ftp_site($conn_id, "CHMOD 0777 work"); + echo $lang['changedir'].' `work` ...
'; + ftp_chdir($conn_id,"work"); + echo $lang['indir'].' `'.ftp_pwd($conn_id).'`
'; + echo $lang['dircr5'].' ...
'; + ftp_mkdir($conn_id,"config"); + ftp_site($conn_id, "CHMOD 0777 config"); + echo $lang['dircr2'].' ...
'; + ftp_mkdir($conn_id,"backup"); + ftp_site($conn_id, "CHMOD 0777 backup"); + echo $lang['dircr3'].' ...
'; + ftp_mkdir($conn_id,"structure"); + ftp_site($conn_id, "CHMOD 0777 structure"); + echo $lang['dircr4'].' ...
'; + ftp_mkdir($conn_id,"log"); + ftp_site($conn_id, "CHMOD 0777 log"); + + // Schließen des FTP-Streams + ftp_quit($conn_id); + return 1; + } +} + +function ftp_mkdirs($config,$dirname) +{ + $dir=split("/", $dirname); + for ($i=0;$i'; + } + } + if (isset($databases['Name'][0])) $databases['db_actual']=$databases['Name'][0]; +} + +// removes tags from inputs recursivly +function my_strip_tags($value) +{ + $ret=''; + if (is_array($value)) + { + foreach ($value as $key=>$val) + { + $$key=my_strip_tags($val); + } + } + else $ret=trim(strip_tags($value)); + return $ret; +} + +?> \ No newline at end of file diff --git a/mysqldumper/inc/functions_dump.php b/mysqldumper/inc/functions_dump.php new file mode 100644 index 0000000..a879703 --- /dev/null +++ b/mysqldumper/inc/functions_dump.php @@ -0,0 +1,483 @@ +'.$lang['startdump'].' `'.$databases['Name'][$dump['dbindex']].'`'.(($databases['praefix'][$dump['dbindex']]!="") ?' ('.$lang['withpraefix'].' '.$databases['praefix'][$dump['dbindex']].')' : '').'... '; + ExecuteCommand('b'); + if($dump['part']==1) + { + $dump['table_offset']=0; + $dump['countdata']=0; + } + // Seitenerstaufruf -> Backupdatei anlegen + + $dump['data']=$statuszeile.$mysql_commentstring.' Dump created at '.$cur_time.$nl.$nl; + $dump['structure']=$mysql_commentstring.' Status:0:0::'.$databases['Name'][$dump['dbindex']]; + $dump['structure'].=":php:".MSD_VERSION.$nl; + $dump['structure'].=$mysql_commentstring.' Dump by MySQLDumper '.MSD_VERSION.' ('.$config['homepage'].')'.$nl; + $dump['structure'].=$mysql_commentstring.' Dump created on '.$cur_time.$nl.$mysql_commentstring.' This file only contains the structure of the database without data \n\n'; + + } + else + { + if($config['multi_part']!=0) { + WriteLog('Continue Multipart-Dump with File '.($dump['part']-$dump['part_offset']).' (last file was '.$last_groesse.' Bytes)'); + $dump['data']=$statuszeile.$mysql_commentstring.' This is part '.($dump['part']-$dump['part_offset']).' of the backup.'.$nl.$nl.$dump['data']; + + } + } + WriteToDumpFile(); + $dump['part']++; +} + +function GetStatusLine($kind="php") +{ + /*AUFBAU der Statuszeile: + -- Status:tabellenzahl:datensätze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:CharsetEXTINFO + Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt) + (complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables) + */ + + global $databases,$config, $dump,$mysql_commentstring; + + $t_array=explode("|",$databases['db_actual_tableselected']); + $t=0; + $r=0; + $t_zeile="$mysql_commentstring\n$mysql_commentstring TABLE-INFO\n"; + MSD_mysql_connect(); + $res=mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); + $numrows=intval(@mysql_num_rows($res)); + for($i=0;$i<$numrows;$i++) { + $erg=mysql_fetch_array($res); + // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs + $sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dump['dbindex']]."`.`".$erg['Name']."`"; + $res2=@mysql_query($sql_2); + $row2=mysql_fetch_array($res2); + $erg['Rows']=$row2['count_records']; + + if(($databases['db_actual_tableselected']=="" || ($databases['db_actual_tableselected']!="" && (in_array($erg[0],$t_array)))) && (substr($erg[0],0,strlen($databases['praefix'][$dump['dbindex']]))==$databases['praefix'][$dump['dbindex']])) { + $t++;$r+=$erg['Rows']; + $t_zeile.="$mysql_commentstring TABLE|".$erg['Name']."|".$erg['Rows']."|".($erg['Data_length']+$erg['Index_length'])."|".$erg['Update_time']."\n"; + } + } + //$dump['totalrecords']=$r; + $flags=$config['backup_complete_inserts'].$config['backup_extended_inserts'].$config['backup_ignore_inserts'].$config['backup_delayed_inserts'].$config['backup_downgrade'].$config['backup_lock_tables'].$config['optimize_tables_beforedump']; + + $mp=($config['multi_part']==1) ? $mp="MP_".($dump['part']-$dump['part_offset']) : "MP_0"; + $statusline="$mysql_commentstring Status:$t:$r:$mp:".$databases['Name'][$dump['dbindex']].":$kind:".MSD_VERSION.":".$dump['kommentar'].":"; + $statusline.=MSD_MYSQL_VERSION.":$flags:::".$dump['dump_encoding'].":EXTINFO\n".$t_zeile."$mysql_commentstring"." EOF TABLE-INFO\n$mysql_commentstring\n\n"; + return $statusline; +} + +// Liest die Eigenschaften der Tabelle aus der DB und baut die CREATE-Anweisung zusammen +function get_def($db, $table,$withdata=1) +{ + global $config,$nl,$mysql_commentstring; + + $def = "\n\n$mysql_commentstring\n$mysql_commentstring Create Table `$table`\n$mysql_commentstring\n\nDROP TABLE IF EXISTS `$table`;\n"; + mysql_select_db($db); + $result = mysql_query('SHOW CREATE TABLE `'.$table.'`',$config['dbconnection']); + $row=mysql_fetch_row($result); + $def .= (($config['backup_downgrade']==1) ? DownGrade($row[1],false) : $row[1].';')."\n\n"; + + if($withdata==1) { + $def.="$mysql_commentstring\n$mysql_commentstring Data for Table `$table`\n$mysql_commentstring\n\n"; + if($config['backup_delayed_inserts']==0) $def.="/*!40000 ALTER TABLE `$table` DISABLE KEYS */;".$nl; + if($config['backup_lock_tables']==1 && $config['backup_delayed_inserts']==0) $def.="LOCK TABLES `$table` WRITE;\n\n"; + } + return $def; +} + + +// Liest die Daten aus der DB aus und baut die INSERT-Anweisung zusammen +function get_content($db, $table) +{ + global $config,$nl,$dump,$buffer; + + $content=''; + $delayed=(isset($config['backup_delayed_inserts']) && $config['backup_delayed_inserts']==1) ? 'DELAYED ' : ''; + $complete=(isset($config['backup_complete_inserts']) && $config['backup_complete_inserts']==1) ? Fieldlist($db,$table).' ':''; + $ignore=(isset($config['backup_ignore_inserts']) && $config['backup_ignore_inserts']==1) ? 'IGNORE ':''; + + $table_ready=0; + $query='SELECT * FROM `'.$table.'` LIMIT '.$dump['zeilen_offset'].','.($dump['restzeilen']+1); + mysql_select_db($db); + $result = mysql_query($query,$config['dbconnection']); + $ergebnisse=mysql_num_rows($result); + $num_felder=mysql_num_fields($result); + $first=1; + + if ($ergebnisse>$dump['restzeilen']) + { + $dump['zeilen_offset']+=$dump['restzeilen']; + $ergebnisse--; + $dump['restzeilen']=0; + } + else + { + $dump['table_offset']++; + $dump['zeilen_offset']=0; + $dump['restzeilen']=$dump['restzeilen']-$ergebnisse; + $table_ready=1; + } + $ax=0; + for ($x=0;$x<$ergebnisse;$x++) + { + $row=mysql_fetch_row($result); + $ax++; + + if($config['backup_extended_inserts']==0 || ($config['backup_extended_inserts']==1 && $first==1 && $ax==1) ) { + $insert = 'INSERT '.$delayed.$ignore.'INTO `'.$table.'` '.$complete.'VALUES ('; + $first=0; + } else $insert='('; + + + for($j=0; $j<$num_felder;$j++) + { + if(!isset($row[$j])) $insert .= 'NULL,'; + else if($row[$j] != '') $insert.= '\''.mysql_escape_string($row[$j]).'\','; + else $insert .= '\'\','; + } + $insert=substr($insert,0,-1); + if(strlen($dump['data'])>400000 || $x==($ergebnisse-1)) { + $ax=0;$first=1; + } + $insert .= ($config['backup_extended_inserts']==0 || $x==($ergebnisse-1) || $ax==0) ? ");\n" : '),'; + $dump['data'] .= $insert; + $dump['countdata']++; + if(strlen($dump['data'])>$config['memory_limit'] || ($config['multi_part']==1 && strlen($dump['data'])+$buffer>$config['multipart_groesse']) ) { + WriteToDumpFile(); + } + } + + if($table_ready==1 && $config['backup_lock_tables']==1 && $config['backup_delayed_inserts']==0) $dump['data'].="\nUNLOCK TABLES;"; + if($table_ready==1 && $config['backup_delayed_inserts']==0) $dump['data'].="\n/*!40000 ALTER TABLE `$table` ENABLE KEYS */;\n\n"; + mysql_free_result($result); +} + +function WriteToDumpFile() +{ + global $config,$dump,$buffer; + $dump['filesize']=0; + + $df=$config['paths']['backup'].$dump['backupdatei']; + $sf=$config['paths']['structure'].$dump['backupdatei_structure']; + + if ($config['compression']==1) + { + if($dump['data']!='') { + $fp = gzopen ($df,'ab'); + gzwrite ($fp,$dump['data']); gzclose ($fp); + } + if($dump['structure']!='') { + $fp = gzopen ($sf,'ab'); + gzwrite ($fp,$dump['structure']); gzclose ($fp); + } + } + else + { + if($dump['data']!='') { + $fp = fopen ($df,'ab'); + fwrite ($fp,$dump['data']);fclose ($fp); + } + if($dump['structure']!='') { + $fp = fopen ($sf,'ab'); + fwrite ($fp,$dump['structure']); fclose ($fp); + } + } + $dump['data']=$dump['structure']=''; + if(!isset($dump['fileoperations'])) $dump['fileoperations']=0; + $dump['fileoperations']++; + + if ($config['multi_part']==1) clearstatcache(); + $dump['filesize']=filesize($df); + if ($config['multi_part']==1 && $dump['filesize']+$buffer>$config['multipart_groesse']) + new_file($dump['filesize']); // Wenn maximale Dateigroesse erreicht -> neues File starten +} + +function ExecuteCommand($when) +{ + global $config,$databases,$dump,$out,$lang; + + if($when=='b') { // before dump + $cd=$databases['command_before_dump'][$dump['dbindex']]; + $cap='before Dump'; $lf='
'; + } else { + $cd=$databases['command_after_dump'][$dump['dbindex']]; + $cap='after Dump'; $lf=''; + } + + if($cd!='') { + //jetzt ausführen + if(substr(strtolower($cd),0,7)!='system:') { + @mysql_select_db($databases['Name'][$dump['dbindex']]); + if(strpos($cd,';')) { + $cad=explode(';',$cd); + for($i=0;$iERROR executing Query '.$cap.'
'; + } else { + WriteLog("executing Query $cap ($cd) was successful"); + $out.=$lf.'executing Query '.$cap.' was successful
'; + } + } elseif(substr(strtolower($cd),0,7)=="system:") { + //$result=@system(substr($cd,7),$returnval); + $cap=substr($cd,7); + $result=1; + if(!$result) { + WriteLog("Error while executing System Command $cap"); + $dump['errors']++; + $out.=$lf.'ERROR executing System Command '.$cap.'
'; + } else { + WriteLog("executing System Command $cap was successful. [$returnval]"); + $out.=$lf.'executing System Command '.$cap.' was successful
'; + } + } + } + +} + +function DoEmail() +{ + global $config,$dump,$databases,$email,$lang,$out,$REMOTE_ADDR; + + $header=""; + if($config['cron_use_sendmail']==1) { + //sendmail + if(ini_get("sendmail_path")!=$config['cron_sendmail']) @ini_set("SMTP",$config['cron_sendmail']); + if(ini_get("sendmail_from")!=$config['email_sender']) @ini_set("SMTP",$config['email_sender']); + } else { + //SMTP + } + if(ini_get("SMTP")!=$config['cron_smtp']) @ini_set("SMTP",$config['cron_smtp']); + if(ini_get("smtp_port")!=25) @ini_set("smtp_port",25); + + + if($config['multi_part']==0) { + $file = $dump['backupdatei']; + $file_name=(strpos("/",$file)) ? substr($file,strrpos("/",$file)) : $file; + $file_type = filetype($config['paths']['backup'].$file); + $file_size = filesize($config['paths']['backup'].$file); + if(($config['email_maxsize']>0 && $file_size>$config['email_maxsize']) || $config['send_mail_dump']==0) { + //anhang zu gross + $subject = "Backup '".$databases['Name'][$dump['dbindex']]."' - ".date("d\.m\.Y H:i",time()); + $header.= "FROM:".$config['email_sender']."\n"; + $header.= "MIME-version: 1.0\n"; + $header .= "X-Mailer: PHP/" . phpversion(). "\n"; + $header .= "X-Sender-IP: $REMOTE_ADDR\n"; + $header .= "Content-Type: text/html"; + if($config['send_mail_dump']!=0) { + $msg_body = sprintf(addslashes($lang['emailbody_toobig']),byte_output($config['email_maxsize']),$databases['Name'][$dump['dbindex']],"$file (".byte_output(filesize($config['paths']['backup'].$file)).")
"); + } else { + $msg_body = sprintf(addslashes($lang['emailbody_noattach']),$databases['Name'][$dump['dbindex']],"$file (".byte_output(filesize($config['paths']['backup'].$file)).")"); + } + $msg_body.=''.$file.''; + $email_log="Email sent to '".$config['email_recipient']."'"; + $email_out=$lang['email_was_send']."`".$config['email_recipient']."`
"; + } else { + //alles ok, anhang generieren + $msg_body = sprintf(addslashes($lang['emailbody_attach']),$databases['Name'][$dump['dbindex']],"$file (".byte_output(filesize($config['paths']['backup'].$file)).")"); + $subject = "Backup '".$databases['Name'][$dump['dbindex']]."' - ".date("d\.m\.Y",time()); + $fp = fopen($config['paths']['backup'].$file, "r"); + $contents = fread($fp, $file_size); + $encoded_file = chunk_split(base64_encode($contents)); + fclose($fp); + $header.= "FROM:".$config['email_sender']."\n"; + $header.= "MIME-version: 1.0\n"; + $header.= "Content-type: multipart/mixed; "; + $header.= "boundary=\"Message-Boundary\"\n"; + $header.= "Content-transfer-encoding: 7BIT\n"; + $header.= "X-attachments: $file_name"; + $body_top = "--Message-Boundary\n"; + $body_top.= "Content-type: text/html; charset=utf-8\n"; + $body_top.= "Content-transfer-encoding: 7BIT\n"; + $body_top.= "Content-description: Mail message body\n\n"; + $msg_body = $body_top . $msg_body; + $msg_body.= "\n\n--Message-Boundary\n"; + $msg_body.= "Content-type: $file_type; name=\"$file\"\n"; + $msg_body.= "Content-Transfer-Encoding: BASE64\n"; + $msg_body.= "Content-disposition: attachment; filename=\"$file\"\n\n"; + $msg_body.= "$encoded_file\n"; + $msg_body.= "--Message-Boundary--\n"; + $email_log="Email was sent to '".$config['email_recipient']."' with '".$dump['backupdatei']."'."; + $email_out=$lang['email_was_send']."`".$config['email_recipient']."`".$lang['with']."`".$dump['backupdatei']."`.
"; + } + } else { + //Multipart + $mp_sub="Backup '".$databases['Name'][$dump['dbindex']]."' - ".date("d\.m\.Y",time()); + $subject = $mp_sub; + $header.= "FROM:".$config['email_sender']."\n"; + $header.= "MIME-version: 1.0\n"; + $header .= "X-Mailer: PHP/" . phpversion(). "\n"; + $header .= "X-Sender-IP: $REMOTE_ADDR\n"; + $header .= "Content-Type: text/html; charset=utf-8"; + $dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],"part_"))."part_"; + $dateiendung=($config['compression']==1)?".sql.gz":".sql"; + $mpdatei=Array(); + $mpfiles=""; + for ($i=1;$i<($dump['part']-$dump['part_offset']);$i++) { + $mpdatei[$i-1]=$dateistamm.$i.$dateiendung; + $sz=byte_output(@filesize($config['paths']['backup'].$mpdatei[$i-1])); + $mpfiles.=$mpdatei[$i-1]." (".$sz.")
"; + } + $msg_body = ($config['send_mail_dump']==1) ? sprintf(addslashes($lang['emailbody_mp_attach']),$databases['Name'][$dump['dbindex']],$mpfiles) : sprintf(addslashes($lang['emailbody_mp_noattach']),$databases['Name'][$dump['dbindex']],$mpfiles); + $email_log="Email was sent to '".$config['email_recipient']."'"; + $email_out=$lang['email_was_send']."`".$config['email_recipient']."`
"; + } + if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) { + $out.= ''.$email_out.''; + WriteLog("$email_log"); + } else { + $out.=''.$lang['mailerror'].'
'; + WriteLog("Email to '".$config['email_recipient']."' failed !"); + ErrorLog("Email ",$databases['Name'][$dump['dbindex']],'Subject: '.stripslashes($subject),$lang['mailerror']); + $dump['errors']++; + } + + if(isset($mpdatei) && $config['send_mail_dump']==1) { // && ($config['email_maxsize']==0 || ($config['email_maxsize']>0 && $config['multipartgroesse2']<=$config['email_maxsize']))) { + for($i=0;$i"; + + if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) { + $out.= ''.$email_out.''; + WriteLog("$email_log"); + } else { + $out.=''.$lang['mailerror'].'
'; + WriteLog("Email to '".$config['email_recipient']."' failed !"); + ErrorLog("Email ",$databases['Name'][$dump['dbindex']],'Subject: '.stripslashes($subject),$lang['mailerror']); + $dump['errors']++; + } + } + } +} + + + +function DoFTP() +{ + global $config,$dump,$out; + + if($config['multi_part']==0) { + SendViaFTP($dump['backupdatei'],1); + } else { + $dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],"part_"))."part_"; + $dateiendung=($config['compression']==1)?".sql.gz":".sql"; + for ($i=1;$i<($dump['part']-$dump['part_offset']);$i++) { + $mpdatei=$dateistamm.$i.$dateiendung; + SendViaFTP($mpdatei,$i); + } + } + $out.=''."file sent via FTP (".$dump['backupdatei']." => ".$config['ftp_server'][$config['ftp_connectionindex']].")

"; +} + +function SendViaFTP($source_file,$conn_msg=1) +{ + global $config,$out,$lang; + flush(); + if($conn_msg==1) $out.=''.$lang['filesendftp']."(".$config['ftp_server'][$config['ftp_connectionindex']]." - ".$config['ftp_user'][$config['ftp_connectionindex']].")
"; + + + // Herstellen der Basis-Verbindung + if($config['ftp_useSSL']==0) + $conn_id = ftp_connect($config['ftp_server'][$config['ftp_connectionindex']], $config['ftp_port'][$config['ftp_connectionindex']],$config['ftp_timeout']); + else + $conn_id = ftp_ssl_connect($config['ftp_server'][$config['ftp_connectionindex']], $config['ftp_port'][$config['ftp_connectionindex']],$config['ftp_timeout']); + // Einloggen mit Benutzername und Kennwort + $login_result = ftp_login($conn_id, $config['ftp_user'][$config['ftp_connectionindex']], $config['ftp_pass'][$config['ftp_connectionindex']]); + if ($config['ftp_mode']==1) ftp_pasv($conn_id,true); + + // Verbindung überprüfen + if ((!$conn_id) || (!$login_result)) { + $out.= ''.$lang['ftpconnerror'].$config['ftp_server'][$config['ftp_connectionindex']].$lang['ftpconnerror1'].$config['ftp_user'][$config['ftp_connectionindex']].$lang['ftpconnerror2'].'
'; + exit; + } else { + if($conn_msg==1) $out.= ''.$lang['ftpconnected1'].$config['ftp_server'][$config['ftp_connectionindex']].$lang['ftpconnerror1'].$config['ftp_user'][$config['ftp_connectionindex']].'
'; + } + + // Upload der Datei + $dest=$config['ftp_dir'][$config['ftp_connectionindex']].$source_file; + $source=$config['paths']['backup'].$source_file; + $upload = @ftp_put($conn_id, $dest,$source , FTP_BINARY); + + // Upload-Status überprüfen + if (!$upload) { + $out.= ''.$lang['ftpconnerror3']."
($source -> $dest)

"; + } else { + $out.= ''.$lang['file'].' '.$source_file.''.$lang['ftpconnected2'].$config['ftp_server'][$config['ftp_connectionindex']].$lang['ftpconnected3'].'
'; + WriteLog("'$source_file' sent via FTP."); + } + + // Schließen des FTP-Streams + @ftp_quit($conn_id); +} +?> diff --git a/mysqldumper/inc/functions_files.php b/mysqldumper/inc/functions_files.php new file mode 100644 index 0000000..a97a16d --- /dev/null +++ b/mysqldumper/inc/functions_files.php @@ -0,0 +1,378 @@ +'; + $r.=''; + + $dh = opendir($fpath); + while (false !== ($filename = readdir($dh))) + { + if ($filename != "." && $filename != ".." && !is_dir($fpath.$filename)) { + $r.='
[offene Klammern: $klammerstart] --$rit
"; + + } + return $anz; +} + +function get_sqlbefehl() +{ + global $restore,$config,$databases,$lang; + + //Init + $restore['fileEOF']=false; + $restore['EOB']=false; + $complete_sql=''; + $sqlparser_status=0; + if(!isset($restore['eintraege_ready'])) $restore['eintraege_ready']=0; + + //Parsen + WHILE ($sqlparser_status!=100 && !$restore['fileEOF'] && !$restore['EOB'] ) + { + //nächste Zeile lesen + $zeile= ($restore['compressed']) ? gzgets($restore['filehandle']) : fgets($restore['filehandle']); + + /******************* Setzen des Parserstatus *******************/ + // herausfinden um was für einen Befehl es sich handelt + IF ($sqlparser_status==0) + { + + //Vergleichszeile, um nicht bei jedem Vergleich strtoupper ausführen zu müssen + $zeile2=strtoupper(trim($zeile)); + + // Am Ende eines MySQLDumper-Backups angelangt? + if(substr($zeile2,0,6)=='-- EOB' || substr($zeile2,0,5)=='# EOB') + { + $restore['EOB']=true; + $zeile='--';$zeile2='--'; + $sqlparser_status=100; + } + + // Kommenatr? + if ( (substr($zeile2,0,2)=='--') || (substr($zeile2,0,1)=='#') ) + { + $zeile='';$zeile2=''; $sqlparser_status=0; + } + + //Einfache Anweisung finden die mit Semikolon beendet werden + if(substr($zeile2,0,11)=='LOCK TABLES') $sqlparser_status=5; + if(substr($zeile2,0,6)=='COMMIT') $sqlparser_status=5; + if(substr($zeile2,0,5)=='BEGIN') $sqlparser_status=5; + if(substr($zeile2,0,13)=='UNLOCK TABLES') $sqlparser_status=5; + if(substr($zeile2,0,4)=='SET ') $sqlparser_status=5; + if(substr($zeile2,0,6)=='START ') $sqlparser_status=5; + if(substr($zeile2,0,3)=='/*!') $sqlparser_status=5; //MySQL-Condition oder Kommentar + if(substr($zeile2,0,11)=='ALTER TABLE') $sqlparser_status=5; + if(substr($zeile2,0,12)=='CREATE TABLE') $sqlparser_status=2; //Createaktion + if(substr($zeile2,0,12)=='CREATE INDEX') $sqlparser_status=4; //Indexaktion + + //Kommentar + if ( ($sqlparser_status!=5) && (substr($zeile2,0,2)=='/*')) $sqlparser_status=6; + + // Befehle, die nicht ausgeführt werden sollen + if (substr($zeile2,0,4)=='USE ') $sqlparser_status=7; + if (substr($zeile2,0,14)=='DROP DATABASE ') $sqlparser_status=7; + if(substr($zeile2,0,10)=='DROP TABLE') $sqlparser_status=1; //Löschaktion + + if (substr($zeile2,0,7)=='INSERT ') + { + $sqlparser_status=3; //Datensatzaktion + //$restore['actual_table']=strtolower(get_tablename_aus_insert($zeile)); + $restore['actual_table']=get_tablename_aus_insert($zeile); + + // Pruefen ob die Spaltenanzahl bekannt ist und wenn nicht setzen + if(!isset($restore['num_table_fields'][$restore['actual_table']])) + { + $restore['num_table_fields'][$restore['actual_table']]=get_num_rows($restore['actual_table']); + } + } + // Fortsetzung von erweiterten Inserts + if ($restore['flag']==1) $sqlparser_status=3; + + if ( ($sqlparser_status==0) && (trim($complete_sql)>'') && ($restore['flag']==-1) ) + { + // Unbekannten Befehl entdeckt + v($restore); + echo "
Sql: ".$complete_sql; + echo "
Erweiterte Inserts: ".$restore['erweiterte_inserts']; + die('
'.$lang['unknown_sqlcommand'].': '.$zeile); + } + /******************* Ende von Setzen des Parserstatus *******************/ + } + + $last_char=substr(rtrim($zeile),-1); + // Zeilenumbrüche erhalten - sonst werden Schlüsselwörter zusammengefügt + // z.B. 'null' und in der nächsten Zeile 'check' wird zu 'nullcheck' + $complete_sql.=$zeile."\n"; + + if($sqlparser_status==1) + { //Löschaktion + if($last_char==';') $sqlparser_status=100; //Befehl komplett + } + + if($sqlparser_status==2) + { + // Createanweisung ist beim Finden eines ; beendet + if($last_char==';' ) + { + if($config['minspeed']>0) $restore['anzahl_zeilen']=$config['minspeed']; + + //Spaltenanzahl fuer diese Tabelle merken + $restore['actual_table']=get_tablename($complete_sql); + + $complete_sql=del_inline_comments($complete_sql); //Inline-Kommentare entfernen + + //Create ausfuehren und Anzahl der Spalten speichern + $restore['actual_fieldcount']=submit_create_action($complete_sql); + $restore['num_table_fields'][$restore['actual_table']]=$restore['actual_fieldcount']; + + // Zeile verwerfen und naechsten Befehl suchen + $complete_sql=''; + $sqlparser_status=0; + } + } + + if($sqlparser_status==3) + { + //INSERT + // Anzahl der Felder ermitteln wenn unbekannt + if(!isset($restore['num_table_fields'][$restore['actual_table']])) + { + $restore['num_table_fields'][$restore['actual_table']]=get_num_rows($restore['actual_table']); + } + + + $AnzahlFelder=SQL_Is_Complete($complete_sql,$restore['num_table_fields'][$restore['actual_table']],DEBUG); + + // einen vollständigen Insert ermittelt + if($AnzahlFelder==$restore['num_table_fields'][$restore['actual_table']]) + { + $sqlparser_status=100; + $complete_sql=trim($complete_sql); + + // letzter Ausdruck des erweiterten Inserts erreicht? + if(substr($complete_sql,-2)==');') + { + $restore['flag']=-1; + } + + // Wenn am Ende der Zeile ein Klammer Komma -> erweiterter Insert-Modus -> Steuerflag setzen + if(substr($complete_sql,-2)=='),') + { + // letztes Komme gegen Semikolon tauschen + $complete_sql=substr($complete_sql,0,-1).';'; + $restore['erweiterte_inserts']=1; + $restore['flag']=1; + } + + if (substr(strtoupper($complete_sql),0,7)!='INSERT ') + { + $complete_sql=$restore['insert_syntax'].' VALUES '.$complete_sql.';'; + } + else + { + // INSERT Syntax ermitteln und merken + $ipos=strpos(strtoupper($complete_sql),'VALUES'); + if (!$ipos===false) $restore['insert_syntax']=substr($complete_sql,0,$ipos); + else $restore['insert_syntax']='INSERT INTO `'.$restore['actual_table'].'`'; + } + + if($AnzahlFelder>$restore['num_table_fields'][$restore['actual_table']] && $restore['erweiterte_inserts']==0) + { + if(!isset($restore['table_create'][$restore['actual_table']])) + { + global $lang; + include('./inc/functions_sql.php'); + $restore['table_create'][$restore['actual_table']]=GetCreateTable($databases['db_actual'],$restore['actual_table']); + } + + echo '
'; + echo '

Parser-Fehler : zuviele gezählt in Tabelle '.$restore["actual_table"].' ('.$AnzahlFelder.' statt '.$restore["num_table_fields"][$restore["actual_table"]].')'; + echo '
Aktuelle Tabelle: '.$restore['actual_table']; + echo '

CREATE-Anweisung

'; + echo '

INSERT-Anweisung


'; + echo '

'.$zeile; + die; + } + } + } + + // Index + if($sqlparser_status==4) + { //Createindex + if($last_char==';' ) + { + if($config['minspeed']>0) {$restore['anzahl_zeilen']=$config['minspeed'];} + $complete_sql=del_inline_comments($complete_sql); + $sqlparser_status=100; //Befehl komplett + } + } + + // Kommentar oder Condition + if($sqlparser_status==5) + { //Anweisung + if($last_char==';' ) + { + if($config['minspeed']>0) {$restore['anzahl_zeilen']=$config['minspeed'];} + $complete_sql=del_inline_comments($complete_sql); + $sqlparser_status=100; //Befehl komplett + } + } + + // Mehrzeiliger oder Inline-Kommentar + if($sqlparser_status==6) + { + if(!strrpos($zeile,'*/')===false) + { + $complete_sql=trim(del_inline_comments($complete_sql)); + $sqlparser_status=0; + } + } + + // Befehle, die verworfen werden sollen + if($sqlparser_status==7) + { //Anweisung + if($last_char==';' ) + { + if($config["minspeed"]>0) {$restore["anzahl_zeilen"]=$config["minspeed"];} + $complete_sql=''; + $sqlparser_status=0; + } + } + + if ( ($restore['compressed']) && (gzeof($restore['filehandle'])) ) $restore['fileEOF']=true; + if ( (!$restore['compressed']) && (feof($restore['filehandle'])) ) $restore['fileEOF']=true; + + } + return trim($complete_sql); +} + +function submit_create_action($sql) +{ + //Führt eine Create-Anweisung durch und ermittelt danach die Anzahl der aktuellen Spalten + // und legt diese im Array ab + global $restore; + $tablename=get_tablename($sql); + if (DEBUG) + { + echo "
Tabellenname: ".$tablename; + echo "
Create: ".$sql; + } + $res=mysql_query($sql); + if (!$res===false) + { + if (DEBUG) echo "
Create-Anweisung erfolgreich ausgeführt."; + $restore['actual_table']=$tablename; + $restore['table_ready']++; + } + else + { + //erster Versuch die Tabelle anzulegen hat nicht geklappt + // versuchen wir es mal mit der alten Syntax + $res=mysql_query(downgrade($sql)); + if (!$res===false) + { + if (DEBUG) echo "
Create-Anweisung nach Downgrade erfolgreich ausgeführt."; + $restore['actual_table']=$tablename; + $restore['table_ready']++; + } + else + { + SQLError($sql,'Couldn\'t create table: '.$tablename); + die(); + } + } + return get_num_rows($tablename); +} + +function get_num_rows($tablename) +{ + //Anzahl der Tabellenspalten ermitteln + $sql='SHOW COLUMNS FROM `'.$tablename.'`'; + $res=mysql_query($sql); + if ($res) + { + $num_rows=mysql_num_rows($res); + } + else + { + global $restore; + v($restore); + die('Couldn\'t read rowcount for table '.$tablename.'!
Restore:'.$restore['actual_table']); + } + return $num_rows; +} + +function del_inline_comments($sql) +{ + $sql=str_replace("\n",'
',$sql); + + //Inline-Kommentare entfernen + preg_match_all("/(\/\*(.+)\*\/)/U",$sql,$array); + if (is_array($array[0])) + { + if (DEBUG) + { + v($array); + echo"

vorher:
".$sql."

"; + } + $sql=str_replace($array[0],'',$sql); + if (DEBUG) echo"Nachher: :
".$sql."

"; + } + $sql=trim(str_replace('
',"\n",$sql)); + //Wenn nach dem Entfernen nur noch ein ; übrigbleibt -> entfernen + if ($sql==';') $sql=''; + return $sql; +} + +function lock_table() +{ + global $config,$restore; + if ($config["lock_tables"]==1 && (isset($restore["actual_table"])) && ($restore["actual_table"]<>"unbekannt") ) + { + $sql="LOCK TABLES `".$restore["actual_table"]."` WRITE"; + $res=MSD_query($sql) || die(SQLError("Kein Lock ausgeführt!",mysql_error())); + } +} + +function stri_replace($original,$patterns) +{ + $finalremove=$original; + $piece_front=''; + $piece_back=''; + $piece_replace=''; + + for ($x=0; $x < count($patterns); $x++) + { + $safety=0; + while(strstr(strtolower($finalremove),strtolower($patterns[$x]))) + { + $safety=$safety+1; + if ($safety >= 100000) { break; } + + $occ=strpos(strtolower($finalremove),strtolower($patterns[$x])); + $piece_front=substr($finalremove,0,$occ); + $piece_back=substr($finalremove,($occ+strlen($patterns[$x]))); + $finalremove=$piece_front . $piece_replace . $piece_back; + } + } + return $finalremove; +} + + +// extrahiert auf einfache Art den Tabellennamen aus dem "Create"-Befehl +function get_tablename($t) +{ + global $restore; + $ersetzen=array('CREATE TABLE','IF NOT EXISTS'); + $t=trim(stri_replace($t,$ersetzen)); + $t=trim(str_replace('(',' ',$t)); + $w=explode(' ',$t); + $tn=$w[0]; + if(substr($tn,0,1)=='`') $tn=substr($tn,1,strlen($tn)-2); + return $tn; +} + +// extrahiert auf einfache Art den Tabellennamen aus dem "Insert"-Befehl +function get_tablename_aus_insert($t) +{ + $t=substr($t,0,100); + $t=substr($t,strpos(strtolower($t), 'into ')+5); + $w=explode(' ',$t); + $tn=$w[0]; + if(substr($tn,0,1)=='`') $tn=substr($tn,1,strlen($tn)-2); + return $tn; +} + +function SQL_Is_Complete($s,$expected=0,$debug=0) +{ + global $restore; + if ($debug) echo "
Zu analysieren:".$s."
"; + $anz=$f_begin=$f_end=$restore["erw_anz"]=0; + $Backslash=chr(92); + $s=trim(strtoupper(($s))); + if(substr($s,-2)==");" || substr($s,-2)=="),") $s=substr($s,0,strlen($s)-2); + if(substr($s,-1)==")") $s=substr($s,0,strlen($s)-1); + if(strpos($s," VALUES")) { + $i=strpos($s," VALUES")+7; + $s=substr($s,$i); + } + $i=strpos($s,"(")+1; + $s=substr($s,$i); + + $tb=explode(",",$s); + for ($i=0;$i0 && $anz==$expected-1 && substr($v,-1)==")") { + $v=substr($v,0,strlen($v)-1); // ) entfernen + //if($i+12) { + + $f_end=1; + } elseif (($B_Delimiter % 2)==1 && strlen($v)>2) { + //ist mit `'` maskiert + $f_end=0; + } elseif(($B_Esc % 2)==1) { + //ist mit Backslash maskiert + $f_end=0; + } else { + + $f_end=1; + } + } + } + if($debug==1) echo "$f_begin/$f_end Feld $i: ".htmlspecialchars($tb[$i])."- $anz ($B_Ticks / $B_Esc)
"; + if($f_begin==1 && $f_end==1) { + $anz++; + $f_begin=$f_end=0; + if($anz==$expected) { + $restore["erw_anz"]++; + if($debug==1) echo "
".$restore["erw_anz"].".Insert - (".$anz." Felder)
"; + $anz=0; + } + } + + } + if($anz==0 && $expected>0 && $restore["erw_anz"]>0) $anz=$expected; + + return $anz; +} + +?> diff --git a/mysqldumper/inc/functions_sql.php b/mysqldumper/inc/functions_sql.php new file mode 100644 index 0000000..8ec952f --- /dev/null +++ b/mysqldumper/inc/functions_sql.php @@ -0,0 +1,1254 @@ +0) { + $SQL_ARRAY=file($sf); + } +} +function WriteSQL() +{ + global $SQL_ARRAY,$config; + $sf=$config['paths']['config'].'sql_statements'; + $str=""; + for($i=0;$i0) + { + $s=$nl.$nl.''.$nl.$nl; + } + return $s; +} + +function Table_ComboBox() +{ + global $db,$config,$lang,$nl; + $tabellen = mysql_query("SHOW TABLES FROM `$db`",$config['dbconnection']); + $num_tables = mysql_num_rows($tabellen); + $s=$nl.$nl.''.$nl.$nl; + return $s; +} +function TableComboBox($default='') +{ + global $db,$config,$lang,$nl; + $tabellen = mysql_list_tables($db,$config['dbconnection']); + $num_tables = mysql_num_rows($tabellen); + $s=''.$nl; + for($i=0;$i<$num_tables;$i++) { + $t=mysql_tablename($tabellen,$i); + $s.=''.$nl; + } + return $s; +} +function DB_Exists($db) +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $erg=false; + $dbs=mysql_list_dbs($config['dbconnection']); + while ($row = mysql_fetch_object($dbs)) { + if(strtolower($row->Database)==strtolower($db)) { + $erg=true;break; + } + } + return $erg; +} +function Table_Exists($db,$table) +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $erg=false; + $sqlt="SHOW TABLES FROM `$db`"; + $res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); + + if($res) { + $row = mysql_fetch_row($res); + if(strtolower($row[0])==strtolower($table)) { + $erg=true; + } + } else die("ERROR"); + return $erg; +} + +function DB_Empty($dbn) +{ + $r="DROP DATABASE `$dbn`;\nCREATE DATABASE `$dbn`;"; + MSD_DoSQL($r); + +} + +function sqlReturnsRecords($sql) { + global $mysql_SQLhasRecords; + $s=explode(' ',$sql); + return in_array(strtoupper($s[0]),$mysql_SQLhasRecords) ? 1:0; + +} + +function getCountSQLStatements($sql) { + $z=0; + $l=strlen($sql); + $inQuotes=false; + for($i=0;$i<$l;$i++) { + if($sql[$i]=="'" || $sql[$i]=='"') $inQuotes=!$inQuotes; + if($sql[$i]==';' && $inQuotes==false) $z++; + } + return $z; +} + +function splitSQLStatements2Array($sql) { + $z=0;$sqlArr=array();$tmp=''; + $sql=str_replace("\n",'',$sql); + $l=strlen($sql); + $inQuotes=false; + for($i=0;$i<$l;$i++) { + $tmp.=$sql[$i]; + if($sql[$i]=="'" || $sql[$i]=='"') $inQuotes=!$inQuotes; + if($sql[$i]==';' && $inQuotes==false) { + $z++; + $sqlArr[]=$tmp; + $tmp=''; + } + } + if(trim($tmp)!='') $sqlArr[]=$tmp; + return $sqlArr; +} + + +function DB_Copy($source,$destination,$drop_source=0,$insert_data=1) +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $SQL_Array=$t=""; + if(!DB_Exists($destination)) $SQL_Array.="CREATE DATABASE `$destination` ;\n"; + $SQL_Array.="USE `$destination` ;\n"; + $tabellen = mysql_list_tables($source,$config['dbconnection']); + $num_tables = mysql_num_rows($tabellen); + for($i=0;$i<$num_tables;$i++) { + $table=mysql_tablename($tabellen,$i); + $sqlt="SHOW CREATE TABLE `$source`.`$table`"; + $res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); + $row=mysql_fetch_row($res); + $c=$row[1]; if(substr($c,-1)==";") $c=substr($c,0,strlen($c)-1); + $SQL_Array.=($insert_data==1) ? "$c SELECT * FROM `$source`.`$table` ;\n" : "$c ;\n"; + } + if($drop_source==1) $SQL_Array.="DROP DATABASE `$source` ;"; + + mysql_select_db($destination); + MSD_DoSQL($SQL_Array); + +} +function Table_Copy($source,$destination,$insert_data,$destinationdb="") +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $SQL_Array=$t=""; + $sqlc="SHOW CREATE TABLE $source"; + $res=MSD_query($sqlc) or die(SQLError($sqlc,mysql_error())); + $row=mysql_fetch_row($res); + $c=$row[1]; + $a1=strpos($c,"`"); + $a2=strpos($c,"`",$a1+1); + $c=substr($c,0,$a1+1).$destination.substr($c,$a2); + if(substr($c,-1)==";") $c=substr($c,0,strlen($c)-1); + $SQL_Array.=($insert_data==1) ? "$c SELECT * FROM $source ;\n" : "$c ;\n"; + //echo "
$SQL_Array
"; + MSD_DoSQL($SQL_Array); + +} +function MSD_DoSQL($sqlcommands,$limit="") +{ + + global $config,$out,$numrowsabs,$numrows,$num_befehle,$time_used,$sql; + + if(!isset($sql['parser']['sql_commands'])) $sql['parser']['sql_commands']=0; + if(!isset($sql['parser']['sql_errors'])) $sql['parser']['sql_errors']=0; + + $sql['parser']['time_used']=getmicrotime(); + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $out=$sqlcommand=""; + $allSQL=splitSQLStatements2Array($sqlcommands); #explode(';',preg_replace('/\r\n|\n/', '', $sqlcommands)); + $sql_queries=count($allSQL); + + if(!isset($allSQL[$sql_queries-1])) $sql_queries--; + if($sql_queries==1) { + SQLParser($allSQL[0]); + $sql['parser']['sql_commands']++; + $out.=Stringformat(($sql['parser']['sql_commands']),4).": ". $allSQL[0]."\n"; + $result =MSD_query($allSQL[0]) or die(SQLError($allSQL[0],mysql_error())); + + } else { + + for($i=0;$i<$sql_queries; $i++) { + $allSQL[$i]=trim(rtrim($allSQL[$i])); + + if($allSQL[$i]!="") { + $sqlcommand.=$allSQL[$i]; + $sqlcommand=SQLParser($sqlcommand); + //echo "$i: ".htmlentities($sqlcommand)."
"; + if($sql['parser']['start']==0 && $sql['parser']['end']==0 && $sqlcommand!="") { + //sql complete + $sql['parser']['sql_commands']++; + $out.=Stringformat(($sql['parser']['sql_commands']),4).": ". $sqlcommand."\n"; + $result =MSD_query($sqlcommand) or die(SQLError($sqlcommand,mysql_error())); + $sqlcommand=""; + } + } + } + } + $sql['parser']['time_used']=getmicrotime()-$sql['parser']['time_used']; +} + +function SQLParser($command,$debug=0) +{ + global $sql; + $sql['parser']['start']=$sql['parser']['end']=0; + $sql['parser']['sqlparts']=0; + if(!isset($sql['parser']['drop'])) $sql['parser']['drop']=0; + if(!isset($sql['parser']['create'])) $sql['parser']['create']=0; + if(!isset($sql['parser']['insert'])) $sql['parser']['insert']=0; + if(!isset($sql['parser']['update'])) $sql['parser']['update']=0; + if(!isset($sql['parser']['comment'])) $sql['parser']['comment']=0; + $Backslash=chr(92); + $s=rtrim(trim(($command))); + + //Was ist das für eine Anfrage ? + if(substr($s,0,1)=="#" || substr($s,0,2)=="--") { + $sql['parser']['comment']++; + $s=""; + } elseif(strtoupper(substr($s,0,5))=="DROP ") { + $sql['parser']['drop']++; + } elseif(strtoupper(substr($s,0,7))=="CREATE ") { + //Hier nur die Anzahl der Klammern zählen + $sql['parser']['start']=1; + $kl1=substr_count($s,"("); + $kl2=substr_count($s,")"); + if($kl2-$kl1==0) { + $sql['parser']['start']=0; + $sql['parser']['create']++; + } + } elseif(strtoupper(substr($s,0,7))=="INSERT " || strtoupper(substr($s,0,7))=="UPDATE ") { + + if(strtoupper(substr($s,0,7))=="INSERT ") $sql['parser']['insert']++; else $sql['parser']['update']++; + $i=strpos(strtoupper($s)," VALUES")+7; + $st=substr($s,$i); + $i=strpos($st,"(")+1; + $st=substr($st,$i); + $st=substr($st,0,strlen($st)-2); + + $tb=explode(",",$st); + for ($i=0;$i2) { + + $sql['parser']['end']=1; + } elseif (($B_Delimiter % 2)==1 && strlen($v)>2) { + //ist mit `'` maskiert + $sql['parser']['end']=0; + } elseif(($B_Esc % 2)==1) { + //ist mit Backslash maskiert + $sql['parser']['end']=0; + } else { + + $sql['parser']['end']=1; + } + } + } + if($debug==1) echo "".$sql['parser']['start']."/".$sql['parser']['end']." Feld $i: ".htmlspecialchars($tb[$i])."- ".$sql['parser']['sqlparts']." ($B_Ticks / $B_Esc)
"; + if($sql['parser']['start']==1 && $sql['parser']['end']==1) { + $sql['parser']['sqlparts']++; + $sql['parser']['start']=$sql['parser']['end']=0; + } + } + } + return $s; +} + +function SQLOutput($sqlcommand,$meldung="") +{ + global $sql,$lang; + $s= '
'.$lang['sql_output'].'
'; +// if($meldung!="") $s.='

'.$meldung.'

'; + if($meldung!="") $s.=$meldung; + + if(isset($sql['parser']['sql_commands'])) + { + $s.=''.$sql['parser']['sql_commands'].'
'.$lang['sql_commands_in'].round($sql['parser']['time_used'],4).$lang['sql_commands_in2'].'

'; + $s.=$lang['sql_out1'].''.$sql['parser']['drop'].' DROP-, '; + $s.=''.$sql['parser']['create'].' CREATE-, '; + $s.=''.$sql['parser']['insert'].' INSERT-, '; + $s.=''.$sql['parser']['update'].' UPDATE-'.$lang['sql_out2'].'
'; + $s.=$lang['sql_out3'].''.$sql['parser']['comment'].' '.$lang['sql_out4'].'
'; + if($sql['parser']['sql_commands']<5000) + $s.='
'.Highlight_SQL($sqlcommand).'
'; + else $s.=$lang['sql_out5'].""; + } + elseif($sqlcommand!="")$s.='
'.$lang['sql_output'].'
'.Highlight_SQL($sqlcommand).'
'; + return $s.''; +} + + + +function GetCreateTable($db,$tabelle) +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $res=mysql_query("SHOW CREATE TABLE `$db`.`$tabelle`"); + if($res) { + $row=mysql_fetch_array($res); + return $row['Create Table']; + } else return mysql_error(); + +} + +function KindSQL($sql) +{ + if (preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $sql)) { + return 2; + } elseif (preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $sql)) { + return 1; + } +} + + + + +function GetPostParams() +{ + global $db,$dbid,$tablename,$context,$limitstart,$order,$orderdir,$sql; + $db=$_POST['db']; + $dbid=$_POST['dbid']; + $tablename=$_POST['tablename']; + $context=$_POST['context']; + $limitstart=$_POST['limitstart']; + $order=$_POST['order']; + $orderdir=$_POST['orderdir']; + $sql['sql_statement']=(isset($_POST['sql_statement'])) ? stripslashes(urldecode($_POST['sql_statement'])) : "SELECT * FROM `$tablename`"; + +} + +function ComboCommandDump($when,$index) +{ + global $SQL_ARRAY,$nl,$databases,$lang; + + if(count($SQL_ARRAY)==0) { + $r=''.$lang['sql_befehle'].''; + if($when==0) + $r.=''; + else + $r.=''; + } else { + if($when==0) { + $r=''; + $csql=$databases['command_after_dump'][$index]; + } + + $r.=''; + if(count($SQL_ARRAY)>0) { + for($i=0;$i'.SQL_Name($i).''.$nl; + } + } + + $r.=''; + } + return $r; +} + +function EngineCombo($default="") +{ + global $config; + if(!$config['dbconnection']) MSD_mysql_connect(); + + $r=''; + if(!MSD_NEW_VERSION) { + //BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM + $r.=''; + $r.=''; + $r.=''; + $r.=''; + $r.=''; + $r.=''; + $r.=''; + } else { + $res=mysql_query("SHOW ENGINES"); + $num = mysql_num_rows($res); + for($i=0;$i<$num;$i++) { + $row=mysql_fetch_array($res); + $r.=''; + } + } + return $r; +} + +function CharsetCombo($default="") +{ + global $config; + if(!MSD_NEW_VERSION) { return ""; + } else { + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + $res=mysql_query("SHOW Charset"); + $num = mysql_num_rows($res); + $r=''; + $charsets=array(); + for($i=0;$i<$num;$i++) { + $charsets[]=mysql_fetch_array($res); + } + + if (is_array($charsets)) + { + $charsets=mu_sort($charsets,'Charset'); + foreach ($charsets as $row) + { + $r.=''; + } + } + return $r; + } +} + +function GetCollationArray() +{ + global $config; + if(!isset($config['dbconnection'])) MSD_mysql_connect(); + + $res=mysql_query("SHOW Collation"); + $num = mysql_num_rows($res); + $r=Array(); + for($i=0;$i<$num;$i++) { + $row=mysql_fetch_array($res); + $r[$i]['Collation']=$row['Collation']; + $r[$i]['Charset']=$row['Charset']; + $r[$i]['Id']=$row['Id']; + $r[$i]['Default']=$row['Default']; + $r[$i]['Compiled']=$row['Compiled']; + $r[$i]['Sortlen']=$row['Sortlen']; + } + return $r; +} + +function CollationCombo($default="",$withcharset=0) +{ + if(!MSD_NEW_VERSION) { + return ""; + } else { + $r=GetCollationArray(); + sort($r); + $s=""; + $s=''; + $group=""; + for($i=0;$i0) $s.=''; + $s.=''; + } + $s.=''; + } + return $s.''; + } +} +function AttributeCombo($default="") +{ + $s=''; + $s.=''; + $s.=''; + return $s; + +} + +function simple_bbcode_conversion($a) +{ + global $config; + $tag_start='
'; + $tag_end='
'; + + //replacements + $a=nl2br($a); + + $a=preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/si","$2",$a); + $a=preg_replace("/\[urltargetself=(.*?)\](.*?)\[\/urltargetself\]/si","$2",$a); + $a=preg_replace("/\[url\](.*?)\[\/url\]/si","$1",$a); + $a=preg_replace("/\[ed2k=\+(.*?)\](.*?)\[\/ed2k\]/si","$2",$a); + $a=preg_replace("/\[ed2k=(.*?)\](.*?)\[\/ed2k\]/si","$2",$a); + + $a=preg_replace("/\[center\](.*?)\[\/center\]/si", "
$1
", $a); + $a=preg_replace("/\[size=([1-2]?[0-9])\](.*?)\[\/size\]/si", "$2", $a); + $a=preg_replace("/\[size=([1-2]?[0-9]):(.*?)\](.*?)\[\/size(.*?)\]/si", "$3", $a); + $a=preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/si", "$2", $a); + $a=preg_replace("/\[color=(.*?)\](.*?)\[\/color\]/si", "$2", $a); + $a=preg_replace("/\[color=(.*?):(.*?)\](.*?)\[\/color(.*?)\]/si", "$3", $a); + $a=preg_replace("/\[img\](.*?)\[\/img\]/si", "", $a); + $a=preg_replace("/\[b\](.*?)\[\/b\]/si", "$1", $a); + $a=preg_replace("/\[b(.*?)\](.*?)\[\/b(.*?)\]/si", "$2", $a); + $a=preg_replace("/\[u\](.*?)\[\/u\]/si", "$1", $a); + $a=preg_replace("/\[u(.*?)\](.*?)\[\/u(.*?)\]/si", "$2", $a); + $a=preg_replace("/\[i\](.*?)\[\/i\]/si", "$1", $a); + $a=preg_replace("/\[i(.*?)\](.*?)\[\/i(.*?)\]/si", "$2", $a); + $a=preg_replace("/\[quote\](.*?)\[\/quote\]/si", "

$1

", $a); + $a=preg_replace("/\[quote:(.*?)\](.*?)\[\/quote(.*?)\]/si", "

$2

", $a); + $a=preg_replace("/\[code:(.*?)\](.*?)\[\/code(.*?)\]/si", "

$2

", $a); + $a=preg_replace("/\[hide\](.*?)\[\/hide\]/si", "
$1
", $a); + + $a=preg_replace("/[[:space:]]http:\/\/(.*?)[[:space:]]/si","$1",$a); + return $tag_start.$a.$tag_end; +} + +function ExtractTablename($q) +{ + $offset=0; + if (strlen($q)>100) $q=substr(0,100,$q); + + $p=strtoupper($q); + $i=strpos($p,"FROM")+5; + $p=substr($p,$i); + if(substr($p,0,1)=="("){ + $offset=2; + echo "$offset
"; + } + if(strpos($p," ",$offset)) { + $j=strpos($p," ",$offset); + $p=substr($p,$offset,$j); + } + $t=substr($q,$i+$offset,strlen($p)-$offset); + if(substr($t,-1)==",") { + //Achtung, keine eindeutige Tabelle + $t=''; + } + if(substr($t,0,1)=="`" && substr($t,-1)=="`") $t=substr($t,1,strlen($t)-2); + return $t; +} + +function ExtractTablenameFromSQL($q) +{ + global $databases; + $table=''; + if (strlen($q)>100) $q=substr(0,100,$q); + $p=strtoupper($q); + $first=substr($p,0,strpos($p," ")); + switch($first) + { + case "SHOW": + $table=''; + break; + case "SELECT": + $p=substr($q,strpos($p,"FROM")+5); + $p=explode(" ",$p); + $t=$p[0]; + if(strpos($t,".")) $t=substr($t, strpos($t,".")+1); + $table=str_replace("`","",$t); + break; + case "DROP": + case "INSERT": + case "UPDATE": + break; + default: + $table=$first; + } + // So, dann wollen wir doch mal nachsehen, ob es die ermittelte Tabelle ueberhaupt gibt + if (Table_Exists($databases['db_actual'],$table)) return $table; + else return ""; +} + +function GetOptionsCombo($arr,$default) +{ + global $feldtypen,$feldattribute,$feldnull,$feldextras,$feldkeys,$feldrowformat; + $r=""; + foreach ($arr as $s) { + $r.=''."\n"; + } + return $r; +} + +function make_options($arr,$selected) +{ + $r=''; + foreach ($arr as $key=>$val) + { + $r.='