diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5996f8a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +/work/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..c41a0b1 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# MySQLDumper +Backup & Restore for MySQL databases + +This project is no longer maintained and inactive. Please take a look for alternatives. + +Adding version 1.24 as master to make bug fixing via pull request as easy as possible. diff --git a/ReadMe/changelog_deutsch.txt b/ReadMe/changelog_deutsch.txt index 13f13a7..0f43466 100644 --- a/ReadMe/changelog_deutsch.txt +++ b/ReadMe/changelog_deutsch.txt @@ -1,53 +1,107 @@ -Changelog der wichtigsten nderungen im Vergleich zur Version 1.22 (1.23 hat die Beta-Phase nie verlassen): +Version 1.24.4 + +Folgende Dinge wurden geändert: +- Allgemein: Wenn "inc" in der Domain oder im Pfad zum MySQLDUmper-Verzeichnis vorkam, konnte die Datei runtime.php nicht eingebunden werden. +- Home / Konfiguration: beim Speichern der Perl-Konfigurationsdatei wurden die Auswahl der zu sichernden Datenbanken nicht korrekt gespeichert. +- Home / Verzeichnisschutz: beim Anlegen des Verzeichnisschutzes wurden PHP-Warnungen ausgegeben wenn PHP kleiner 5.3.0 genutzt wird. +- Perl: Einige kosmetische Änderungen in der Ausgabe. +- Perl: Schreibt "DROP VIEW" anstelle von "DROP TABLE" in die Backupdatei wenn es sich um einen VIEW handelt. +- Perl: Ausgabe des Typs einer Tabelle zur Ausgabe hinzugefügt. + +Version 1.24.3 + +Folgende Dinge wurden geändert: + +- Manuelles Hinzufügen von Datenbanken: Das interne Handling wurde überarbeitet. Die Datei dbs_manual.php ist nicht mehr notwendig; manuell hinzugefügte Datenbanken werden nun im jeweiligen Konfigurationsprofil gespeichert. +- Home / Verzeichnisschutz: Beim Anlegen war die Ausgabe über Erfolg / Misserfolg vertauscht. +- Home / Verzeichnisschutz: Schlägt das Erstellen des Schutzes fehl, so enthielt die folgende Anzeige der Inhalte der Dateien unschöne
's, die nicht in die Dateien gehören. +- Home / Verzeichnisschutz: Der erstellten htaccess-Datei wurde "RewriteEngine off" hinzugefügt. Das vermindert Probleme, wenn MySQLDumper in einen Unterordner bestehender Systeme installiert wird, die selbst mod_rewrite nutzen. +- Home / Verzeichnisschutz: Funktion zum Editieren eines bestehenden Schutzes wurde überarbeitet. +- Home / Datenbanken: Der Key Status wurde unvollständig ermittelt. Es wurde für jede Tabelle nur der erste Index betrachtet. +- SQLBrowser / Tabellenstruktur: Bei der Anzeige der Felder und Indizes ist die Spalte "Kommentar" hinzugekommen. +- SQLBrowser / Tabellenstruktur: Die Verwaltung für Indizes wurde überarbeitet. Es können nun beliebige Indizes festgelegt werden, was bisher auf Primärschlüssel beschränkt war. +- SQLBrowser: Die Systemtabelle "information_schema" wird nun angezeigt und kann betrachtet werden. +- SQLBrowser: Ein Fehler, welcher die korrekte Funktion der Suche verhindern konnte, wurde korrigiert. +- SQLBrowser: Bei bestimmten Anfragen wurde die Anzahl der Datensätze nicht korrekt ermittelt. +- SQLBrowser: Datensätze, welche in einem Feld das Zeichen "|" enthalten, konnten unter Umständen nicht editiert werden. +- SQLBrowser: Die Fehlerbehandlung wurde verbessert. +- Wiederherstellung: Bei der Wiederherstellung von Backups anderer Skripte wurden "CREATE DATABASE"-Anweisungen nicht korrekt erkannt. +- Verwaltung / Backup-Konverter: Im Backup-Konverter befand sich ein fehlerhafter Funktionsaufruf, der eine Fehlermeldung verursachte. +- Perl: in der Perl-Datei crondump.pl wurden Warnungen ausgegeben, wenn die Option "Autodelete" aktiviert ist und sich Backups anderer Programme im work/backup-Ordner befinden. +- Perl: Anzeige der Perl-Version, Kleinigkeiten bei der Fehlerbehandlung, Schriftart in der HTML-Ausgabe +- Perl: Unterstützung von FTP via SSL (NET::FTPSSL-Perl-Modul notwendig) +- Perl: Die optionalen SQL-Befehle (Command Before/After) können nun mit mehreren, aufeinanderfolgenden Querys konfiguriert werden + +Version 1.24.2 + +Folgende Dinge wurden geändert: + +- Trotz der inteligenten Umgehung des PHP-Timeouts, kann es während einer Wiederherstellung beim Aufbau von Indexen großer Tabellen zu einem Timeout kommen. +Jetzt kann man MySQLDumper so konfigurieren, dass während der Wiederherstellung "ENABLE KEYS"-Befehle ignoriert werden. +Nach der Wiederherstellung müssen die so deaktivierten Schlüssel/Indexe manuell wieder aktiviert werden. +Dies geschieht unter Home/Datenbanken/Datenbank wählen/ Button: Enable keys. Die Option und eine entsprechende Nachricht wird automatisch eingeblendet wenn nicht aktivierte Schlüssel/Indexe erkannt werden => nichts zu sehen = nichts zu tun. + +- Bei Systemen, die den Wert 0 in auto_increment-Feldern nutzen (z.B. bei Magento), kann die Wiederherstellung den Eintrag mit dem Wert 0 verfälschen, so dass es in der Anwendung (die gesicherte Anwendung, nicht MySQLDumper) zu Fehlfunktionen kommen kann. +Nun setzt MySQLDumper für die Dauer der Wiederherstellung den SQL-Modus auf "NO_AUTO_VALUE_ON_ZERO", so dass auch ungültige Werte aus der Originalanwendung unverfälscht erhalten bleiben. + +- Das Perl Skript wirft Warnungen beim Sichern von VIEWS. + +- Beim Sichern über die Web-Gui und aktivierter Option "Tabellen optimieren" hat diese aufgrund eines fehlerhaften Befehls +keine Auswirkung. + +-------------------- +Version 1.24 + +Changelog der wichtigsten Änderungen im Vergleich zur Version 1.22 (1.23 hat die Beta-Phase nie verlassen): - MySQLDumper 1.24 funktioniert nach wie vor sowohl mit PHP4 als auch mit PHP5 -- neue, helle und freundliche Optik. Der "alte" Style ist fr "Nostaligiker" ebenfalls enthalten. +- neue, helle und freundliche Optik. Der "alte" Style ist für "Nostaligiker" ebenfalls enthalten. - bessere Speicherausnutzung - Backup und Wiederherstellung per PHP sind im Schnitt ca. 25 Prozent schneller -- Mglichkeit beim Sichern und auch beim Wiederherstellen nur bestimmte Tabellen auszuwhlen -- Nutzen von mehreren MySQL-Servern und -Usern ber Konfigurationsprofile. -Damit kann man mehrere Server ber eine MySQLDumper-Installation warten und sichern. -- der interne SQL-Parser ist an vielen Stellen verbessert worden (noch mehr Fremdbackups knnen importiert werden) +- Möglichkeit beim Sichern und auch beim Wiederherstellen nur bestimmte Tabellen auszuwählen +- Nutzen von mehreren MySQL-Servern und -Usern über Konfigurationsprofile. +Damit kann man mehrere Server über eine MySQLDumper-Installation warten und sichern. +- der interne SQL-Parser ist an vielen Stellen verbessert worden (noch mehr Fremdbackups können importiert werden) - SQLBrowser: jede Menge Bugfxies und kleinere Erweiterungen (dennoch ist der SQLBrowser noch als experimentell einzustufen) -- SQLBrowser: ber die Lupe kommt man zu einer durchdachten Vollextsuche. Editiert man einen Datensatz, kommt man zur Trefferliste zurck. - Das ist recht komfortabel wenn man Stellen finden muss, von denen man nicht genau wei in welchen Spalten sie vorkommen knnen. +- SQLBrowser: über die Lupe kommt man zu einer durchdachten Vollextsuche. Editiert man einen Datensatz, kommt man zur Trefferliste zurück. + Das ist recht komfortabel wenn man Stellen finden muss, von denen man nicht genau weiß in welchen Spalten sie vorkommen können. - Tools: der Export von Daten als Datei funktionierte in 1.22 nicht. Jetzt klappt das wieder. -- die Konfiguration in der WEB-GUI wurde an einigen Stellen nochmals vereinfacht und berflssige Parameter entfernt +- die Konfiguration in der WEB-GUI wurde an einigen Stellen nochmals vereinfacht und überflüssige Parameter entfernt (Du hast kaum noch eine Chance etwas "falsch" einzustellen. :) ) -- FTP-bertragung kann nun optional auf bis zu 3 unterschiedliche Server gleichzeitig erfolgen +- FTP-Übertragung kann nun optional auf bis zu 3 unterschiedliche Server gleichzeitig erfolgen - Tabellen vom Typ VIEW und MEMORY werden nun automatisch erkannt und deren Daten korrekterweise nicht mitgesichert, wohl aber deren Struktur. -- das Verzeichnis work/structure wird nicht mehr bentigt +- das Verzeichnis work/structure wird nicht mehr benötigt - die automatisch immer mit angelegten Struktur-Backups wurden entfernt - noch besseres, internes Handling der Kodierung von Backups (Umlautproblematik) -- Fehler (auch beim Sichern) werden noch zuverlssig abgefangen und aussagekrftig im Log notiert -- Konverter: wurde neu geschrieben. Jetzt werden groe Dateien beim Konvertieren automatisch in Multipart-Dateien aufgeteilt +- Fehler (auch beim Sichern) werden noch zuverlässig abgefangen und aussagekräftig im Log notiert +- Konverter: wurde neu geschrieben. Jetzt werden große Dateien beim Konvertieren automatisch in Multipart-Dateien aufgeteilt - keine Notices in Server-Logs mehr -- Beim Anlegen von gespeicherten SQL-Befehlen knnen nun mehrere Queries angegeben werden, die bei Nutzung von "Command before/after backup" -nacheinander ausgefhrt werden. Der Erfolg oder Mierfolg wird om Logfile notiert. -- Beim Anlegen des Verzeichnisschutzes wird die Strke des Kennworts visualisiert. +- Beim Anlegen von gespeicherten SQL-Befehlen können nun mehrere Queries angegeben werden, die bei Nutzung von "Command before/after backup" +nacheinander ausgeführt werden. Der Erfolg oder Mißerfolg wird om Logfile notiert. +- Beim Anlegen des Verzeichnisschutzes wird die Stärke des Kennworts visualisiert. crodump.pl: - wenn die crondump.pl im Standardordner "msd_cron" aufgerufen werded kann, braucht man den "$absolute_path_of_configdir" nicht mehr editieren. Hier findet nun eine automatische Erkennung statt. - besseres Abfangen von Fehlern -- es wird prziser mit aussagekrftigen Nachrichten geloggt -- automatisches Lschen betrachtet Multipart-Dateien nun korrekt als 1 vollstndiges Backup und funktioniert wie erwartet -- das automatische Lschen wird nicht mehr zu Beginn ausgefhrt, sondern erst nach Beenden des Sicherungsvorgangs +- es wird präziser mit aussagekräftigen Nachrichten geloggt +- automatisches Löschen betrachtet Multipart-Dateien nun korrekt als 1 vollständiges Backup und funktioniert wie erwartet +- das automatische Löschen wird nicht mehr zu Beginn ausgeführt, sondern erst nach Beenden des Sicherungsvorgangs (somit bleiben im Fehlerfall alte Backups erhalten) - der Parameter der zu nutzenden Konfigurationsdatei kann im Aufruf nun auf 3 Arten angegeben werden. -Die fehlende Endung ".conf.php" wird bei Bedarf automatisch ergnzt: +Die fehlende Endung ".conf.php" wird bei Bedarf automatisch ergänzt: 1. config=mysqldumper.conf.php 2. config=mysqdumper.conf 3. config=mysqldumper - Signalhandler entfernt: -Dieser sollte eigentlich einen Abbruch des Users melden und das Skript beenden. ber einen Cronjob aufgerufen fhrte dies bei einigen, wenigen +Dieser sollte eigentlich einen Abbruch des Users melden und das Skript beenden. Über einen Cronjob aufgerufen führte dies bei einigen, wenigen Servern zu der Fehlfunktion, dass mehrere Instanzen des Skripts gestartet wurden, die lange in der Prozesliste standen und manuell beendet werden mussten. -... und viele weitere kleine und groe Bugfixes und jede Menge Aufrumarbeiten im Code. +... und viele weitere kleine und große Bugfixes und jede Menge Aufräumarbeiten im Code. -Wer Du es ganz genau wissen mchtest, dann schaue Dir das changelog auf Sourceforge an. Hier ist akribisch -jede nderung am Code dokumentiert: +Wer Du es ganz genau wissen möchtest, dann schaue Dir das changelog auf Sourceforge an. Hier ist akribisch +jede Änderung am Code dokumentiert: http://mysqldumper.svn.sourceforge.net/viewvc/mysqldumper/trunk/?view=log diff --git a/ReadMe/changelog_english.txt b/ReadMe/changelog_english.txt index 62f6d72..63263e8 100644 --- a/ReadMe/changelog_english.txt +++ b/ReadMe/changelog_english.txt @@ -1,6 +1,56 @@ +Version 1.24.4 + +We addressed the following issues: +- General: If "inc" was anywhere in the path or the domain to the MySQLDumper-Root-Diretory the file runtime.php couldn't be included. +- Configuration: When saving the Perl configuration file, the selected databases to be backed up have been saved incorrectly. +- Home / directory protection: At creating the protection PHP-Warnings were shown if running PHP lower than 5.3.0. +- Perl: Some cosmetic changes in output +- Perl: Write "DROP VIEW" instead of "DROP TABLE" to backup file if table is a view. +- Perl: Added type of table to log output. + +Version 1.24.3 + +We addressed the following issues: +- Configuration / Databases / Connection Parameter: manual adding of databases: The internal handling was completely modified. The file dbs_manual.php is no longer needed. Manually added databases are now stored in the selected configuration profile. +- Home / directory protection: Fixed a bug that inverted the resulting message of success / failure. +- Home / directory protection: If the automatic creation of the directory protection failed, the displayed content of the .htaccess file to be created manually contained some messy
html code. +- Home / directory protection: The created .htaccess file was extended with "RewriteEngine off". That fixes some problems if MySQLDumper was installed in a sub-folder of an existing website that also used .htaccess files with "mod_rewrite". +- Home / directory protection: The functionality for editing an existing protection was revised. +- Home / Databases: The key status was determined incompletely so that only the first index of each table was considered. +- SQL-Browser / table structure: Added the row "comment" in the display of fields and indexes. +- SQL-Browser / table structure: The functionality for managing keys was revised. It is now possible to define any kind of keys which was limited to primary keys. +- SQL-Browser: The system table "information_schema" is now displayed and can be browsed. +- SQL-Browser: A bug was fixed that could prevent the search from working correctly. +- SQL-Browser: For some queries the number of records was not determined correctly. +- SQL-Browser: Records containing the character "|" could not be edited in some cases. +- SQL-Browser: Error handling was improved. +- Restore: When restoring backups that were not created with MySQLDumper, CREATE DATABASE statements were not recognized correctly. +- File-Administration / Backup Converter: Inside the backup converter there was a buggy routine that caused an error message. +- Backup / Perl: When the configuration option "autodelete" was activated and the folder work/backup contained files not created by MySQLDumper, the perl script crondump.pl issued warning messages. +- Perl: Show perl version, better error handling, nicer font with html +- Perl: Support for FTP over SSL added (NET::FTPSSL perl modul necessary). +- Perl: The optional SQL-Commands (Command Before/After) can now handle multiple Queries. + +Version 1.24.2 + +We addressed the following issues: +- Although MySQLDumper bypasses timeouts by taking care of PHP's max_execution_time, it can happen that building the index of a big table leads to a timeout. +Now you can can configure MySQLDumper to ignore "ENABLE KEYS" statements while restoring a backup. But remember to enable them manually afterwards. +This is done under Home/Databases/Select database/ Button: Enable Keys. This option and a message will only show up, if MySQLDumper detects disabled keys or indexes. + +- When systems use the value 0 for auto_increment fields (e.g. Magento), restoring could change the value which could cause the app to malfunction. +While restoring MySQLDumper now sets the SQL-Mode to "NO_AUTO_VALUE_ON_ZERO" for the restoring session. + +- The Perl script crondump.pl threw warnings when backing up views. + +- When backing up via the gui the option "optimize tables" has no effect because of an incomplete query. + +-------------------- +Version 1.24 + Changelog of the most important changes compared to version 1.22 (1.23 never left the beta status): -- MySQLDumper 1.24 still is wokring on PHP4 and PHP5 +- MySQLDumper 1.24 still is working on PHP4 and PHP5 - new, light and friendly style. The "old" style is still included. - better use of RAM - backup and restore via PHP is about 25 percent faster diff --git a/ReadMe/changelog_español.txt b/ReadMe/changelog_español.txt new file mode 100644 index 0000000..5623d98 --- /dev/null +++ b/ReadMe/changelog_español.txt @@ -0,0 +1,100 @@ +Versión 1.24.4 + +Hemos abordado los siguientes temas: +- General: Si "inc" estaba en cualquier parte de la ruta o el dominio a la MySQLDumper-Root-Diretory, el archivo runtime.php no pudo ser incluido. +- Configuración: Al guardar el archivo de configuración de Perl, las bases de datos seleccionadas para realizar una copia de seguridad se han guardado incorrectamente. +- Protección de inicio / directorio: Al crear la protección se mostraron PHP-Advertencias si se ejecuta PHP inferior a 5.3.0. +- Perl: Algunos cambios cosméticos en la salida +- Perl: Escribir "DROP VIEW" en lugar de "DROP TABLE" al archivo de copia de seguridad si la tabla es una vista. +- Perl: Se agregó el tipo de tabla para registrar la salida. + +Versión 1.24.3 + +Hemos abordado los siguientes temas: +- Configuración / Bases de datos / Parámetro de conexión: adición manual de bases de datos: El manejo interno fue completamente modificado. El archivo dbs_manual.php ya no es necesario. Las bases de datos añadidas manualmente se almacenan ahora en el perfil de configuración seleccionado. +- Protección de inicio / directorio: Corregido un error que invirtió el mensaje resultante de éxito / fracaso. +- Protección de inicio / directorio: Si falla la creación automática de la protección de directorio, el contenido mostrado en el archivo .htaccess que se va a crear manualmente contiene algún código html desordenado. +- Protección de inicio / directorio: El archivo .htaccess creado se extendió con "RewriteEngine off". Esto soluciona algunos problemas si MySQLDumper se instaló en una subcarpeta de un sitio web existente que también usaba archivos .htaccess con "mod_rewrite". +- Protección de inicio / directorio: Se revisó la funcionalidad para editar una protección existente. +- Inicio / Bases de datos: El estado clave se determinó de manera incompleta de modo que sólo se consideró el primer índice de cada tabla. +- SQL-Navegador / estructura de tabla: Se agregó la fila "comentario" en la visualización de campos e índices. +- SQL-Browser / estructura de tabla: Se revisó la funcionalidad para gestionar claves. Ahora es posible definir cualquier tipo de claves que estuviera limitada a las claves primarias. +- SQL-Browser: La tabla de sistema "information_schema" ahora se muestra y se puede navegar. +- SQL-Browser: Se ha corregido un error que podría impedir que la búsqueda funcione correctamente. +- SQL-Browser: Para algunas consultas el número de registros no se determinó correctamente. +- SQL-Browser: Registros que contienen el carácter "|" No se pudo editar en algunos casos. +- SQL-Browser: Se ha mejorado el manejo de errores. +- Restaurar: Al restaurar copias de seguridad que no se crearon con MySQLDumper, las sentencias CREATE DATABASE no fueron reconocidas correctamente. +- File-Administration / Backup Converter: Dentro del convertidor de copia de seguridad había una rutina de buggy que causó un mensaje de error. +- Backup / Perl: Cuando la opción de configuración "autodelete" fue activada y la carpeta work / backup contenía archivos no creados por MySQLDumper, el script perl crondump.pl emitió mensajes de advertencia. +- Perl: Mostrar versión de Perl, mejor manejo de errores, mejor fuente con html +- Perl: Se ha añadido soporte para FTP a través de SSL (NET :: FTPLL perl modul necesario). +- Perl: Los comandos SQL opcionales (Command Before / After) ahora pueden manejar varias consultas. + +Versión 1.24.2 + +Hemos abordado los siguientes temas: +- Aunque MySQLDumper ignora los timeouts (tiempos fuera) de espera al cuidar el max_execution_time de PHP, puede suceder que construir el índice de una tabla grande conduzca a un tiempo de espera. +Ahora puede configurar MySQLDumper para ignorar las sentencias "ENABLE KEYS" mientras restaura una copia de seguridad. Pero recuerde habilitarlos manualmente después. +Esto se realiza en Inicio / Bases de datos / Seleccionar base de datos / Botón: Habilitar claves. Esta opción y un mensaje solo aparecerán si MySQLDumper detecta claves o índices inhabilitados. + +- Cuando los sistemas usan el valor 0 para campos de auto_increment (por ejemplo, Magento), la restauración podría cambiar el valor que podría provocar que la aplicación funcione mal. +Mientras restaura MySQLDumper ahora establece el modo SQL como "NO_AUTO_VALUE_ON_ZERO" para la sesión de restauración. + +- El script de Perl crondump.pl lanzó advertencias al realizar copias de seguridad de vistas. + +- Al realizar una copia de seguridad a través del gui, la opción "optimizar tablas" no tiene ningún efecto debido a una consulta incompleta. + +-------------------- +Versión 1.24 + +Changelog de los cambios más importantes en comparación con la versión 1.22 (1.23 nunca dejó el estado beta): + +- MySQLDumper 1.24 sigue trabajando en PHP4 y PHP5 +- estilo nuevo, ligero y amistoso. El "viejo" estilo sigue siendo incluido. +- mejor uso de la RAM +- la copia de seguridad y restauración a través de PHP es aproximadamente un 25% más rápida +- posibilidad de seleccionar tablas al hacer una copia de seguridad o restauración +- utilizar diferentes perfiles de configuración para gestionar diferentes MySQL-Server o -user. +  De esta manera usted puede mantener diferentes MySQL-Server con un solo MySQLDumper-Instalación. +- el SQL-Parser interno se ha mejorado (más copias de seguridad de otros programas pueden ser importet) +- SQLBrowser: un montón de correcciones de errores y algunas mejoras (sin embargo, debe ser considerado como experimental) +- SQLBrowser: una cómoda búsqueda fulltext le permite encontrar texto incluso cuando no sabe en qué columna puede ocurrir +  Después de editar un registro volverá a la lista de resultados. Eso realmente es cómodo cuando se necesita cambiar los datos. +- Herramientas: en la versión 1.22 la exportación de datos como archivo no funcionó. Ahora está funcionando de nuevo. +- la GUI Web ha sido simplificada. Se han eliminado algunos parámetros. (Casi no tienes la oportunidad de configurar algo incorrectamente :)) +- FTP-Transfer: direcciona hasta 3 configuraciones de ftp simultáneamente en un proceso de reserva +- Ahora se detectan las tablas de tipo VIEW o MEMORY y los datos no se guardan, pero la estructura de la tabla es +- el directorio de trabajo / estructura ya no es necesario +- se ha eliminado la copia de seguridad automática de "estructura única" +- mejor y más seguro manejo de las codificaciones de los archivos de copia de seguridad +- mejor y más seguro manejo de errores +- el convertidor de copia de seguridad ha sido reescrito. Ahora también convierte automáticamente archivos grandes en archivos Multipart. +- no hay avisos en los registros del servidor +- al agregar consultas SQL a la biblioteca de SQL, ahora puede introducir más de una consulta. Si utiliza "commadn antes / después de la copia de seguridad" +  Estas consultas se ejecutarán en una fila. Suces o falla se escribe en el archivo de registro. +- Al crear una protección por contraseña se visualiza la fuerza de la contraseña. + +Crodump.pl: +- cuando se puede llamar a crondump.pl en el directorio estándar "msd_cron" ya no es necesario ingresar el +  "$ Absolute_path_of_configdir" manualmente. Se añadió una detección automática. +- una mejor y más segura captura de errores +- registro de eventos es mucho más preciso y le da declaraciones claras lo que sucedió +- la eliminación automática ahora considera archivos Multipart como una copia de seguridad completa y funciona de la manera que usted espera que funcione +- la eliminación automática se realiza después del proceso de copia de seguridad. En caso de errores, esto conserva las copias de seguridad antiguas que pueda necesitar. +- el parámetro de configuración - el perfil de configuración que se va a utilizar - se puede configurar de tres maneras. El sufijo faltante +  ".conf.php" se añadirá dinámicamente. +1. config = mysqldumper.conf.php +2. config = mysqdumper.conf +3. config = mysqldumper + +- manipulador de señales eliminado: +Cuando crondump.pl se inició a través de un cronjob hubo un mal funcionamiento. En algunos, un servidor raro este manipulador de señales causó un segundo +O tercera instancia de la secuencia de comandos que nunca se detuvo y se quedó en la lista de procesos. En este caso el proceso debe ser eliminado manualmente. + +... y muchos más pequeños o grandes correcciones de errores y la limpieza del código + +Cuando quiera saber más, eche un vistazo al changelog de mis cambios de código en Sourceforge. Cada cambio +Del código se documenta aquí: + +Http://mysqldumper.svn.sourceforge.net/viewvc/mysqldumper/trunk/?view=log \ No newline at end of file diff --git a/ReadMe/install_english.txt b/ReadMe/install_english.txt index fbdbaf7..23080b0 100644 --- a/ReadMe/install_english.txt +++ b/ReadMe/install_english.txt @@ -2,4 +2,4 @@ Installation: - upload the folder mysqldumper to any folder on your webspace - start the script in your browser (http://www.yourDomain.de/yourFolder/mysqldumper/) -- Follow the Installatio assistent \ No newline at end of file +- Follow the Installation assistent diff --git a/ReadMe/install_español.txt b/ReadMe/install_español.txt new file mode 100644 index 0000000..b01bb61 --- /dev/null +++ b/ReadMe/install_español.txt @@ -0,0 +1,6 @@ +Instalación: + +- Descargue la carpeta MySQLDumper en su espacio web +- Cambie los derechos de config.php a 777 +- Navegue a su sitio (por ejemplo: http://www.su_sitio_de_internet.mx/mysqldumper/) +- Sigue la instalación \ No newline at end of file diff --git a/ReadMe/license_español.txt b/ReadMe/license_español.txt new file mode 100644 index 0000000..7e3cc4b --- /dev/null +++ b/ReadMe/license_español.txt @@ -0,0 +1,87 @@ +Licencia Pública General de GNU +Versión 2 (junio de 1991) + +Copyright © 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 EE.UU. Se permite la copia y distribución de copias literales de esta licencia, siempre y cuando no entren en los cambios. + +preámbulo + +La mayoría de las licencias de software están diseñadas para privar al usuario de la libertad de compartir y modificar el software. Por el contrario, la Licencia Pública General de GNU pretende garantizar su libertad de compartir y modificar software libre, para asegurar que el software es libre para todos sus usuarios. Esta Licencia Pública General se aplica a la mayoría del software de la Free Software Foundation, así como cualquier otro programa cuyos autores se comprometen a utilizarla (ningún otro software de la Free Software Foundation que se rige, en cambio, por la Licencia Pública General reducida GNU). También puede aplicarla a sus propios programas. + +Cuando se habla de software libre expresión de libertad, no de precio. Nuestras Licencias Públicas Generales están diseñadas con el objetivo de garantizar su libertad de distribuir copias de software libre (y cobrar por ese servicio si lo desea), que reciba el código fuente o que pueda recibir, si lo desea, tiene la posibilidad para modificar el software o usar fragmentos de él en nuevos programas libres, y que, por otra parte, es consciente de que puede hacerlo todo. + +Para proteger sus derechos, necesitamos introducir algunas restricciones que impiden que cualquier otro puede negar estos derechos o pedirle que renuncie a ellos. Estas restricciones implican ciertas obligaciones que le afectan si distribuir copias del software o modificar. + +Por ejemplo, si distribuye copias del software libre, ya sea libre o no, lo tiene que dar a los receptores todos los derechos que tiene. Tendrá que asegurarse de que estos, también, reciban o puedan obtener el código fuente y tendrán que mostrar estos términos para informarles de sus derechos. + +Hay dos pasos para proteger sus derechos: (1) poner el software con derechos de autor y (2) le ofrecemos esta licencia, que autoriza legalmente copiar, distribuir y / o modificar el software. + +También, como una protección para todos los autores y nosotros mismos, es importante hacerles claro a todas las partes que no existe garantía para este software libre. En el caso de que cualquier usuario puede modificar el software y luego distribuir a un tercero, los beneficiarios deben saber que lo que nos trajeron no es el software original, por lo que cualquier problema introducido por la otra parte no afecta a la reputación de los autores originales. + +Por último, cualquier programa libre está constantemente amenazado por las patentes de software. Nuestra intención es evitar el peligro de que los redistribuidores de un programa libre obtengan patentes por su cuenta, por lo tanto, su programa de software registrado. Para evitar esto, deja claro que cualquier patente debe garantizar la transferencia de la licencia a cualquier usuario que sea posible, para que todos puedan utilizar el software libre o de otro modo, no debe garantizar que nadie ninguna licencia. + +A continuación se enumeran los términos y condiciones exactos para la copia, distribución y modificación. + +Licencia Pública General de GNU +TÉRMINOS Y CONDICIONES PARA LA COPIA, distribución y modificación + +0. Esta Licencia se aplica a cualquier programa o producto contenida de otra manera en una nota colocada por el titular de los derechos de autor para especificar que puede ser distribuido bajo los términos de esta Licencia Pública General. En lo sucesivo, el término "programa" se refiere a cualquier programa o producto de este tipo, mientras que el término "basado en el Programa" se refieren al programa tanto como cualquier producto derivado de acuerdo con la ley de derechos de autor, es decir, cualquier producto que contiene el programa o una porción del mismo, ya sea literal o con modificaciones y / o traducido a otro idioma. (De aquí en adelante, la traducción está incluida sin ningún límite en el término "modificación".) Las licencias se escriben en la forma de cortesía cómo a "usted". + +Cualquier actividad que no sea la copia, distribución y modificación no están cubiertas por esta licencia, pero quedan fuera de su alcance. No se restringen a la acción para ejecutar el programa, y ​​los resultados extraídos del Programa están cubiertos únicamente si sus contenidos constituyen un trabajo basado en el Programa (independientemente de si se hace ejecutando el Programa). Esto es cierto o no, dependerá de lo que haga el programa. + +1. Usted puede copiar y distribuir copias literales del código fuente del Programa, ya que recibe, en cualquier medio, siempre que cada copia incluye, de manera adecuada y suficientemente visibles, las indicaciones requeridas relativas a la propiedad intelectual y la exención del garantía de que mantenga intactos todos los avisos que se refieran a esta licencia ya la ausencia de cualquier interés para ellos y entregado a todos los demás destinatarios del programa una copia de esta licencia junto con el programa. + +Puede cobrar un precio por el acto físico de transferir una copia, y si lo desea, también puede ofrecer una cierta garantía a cambio de una tarifa. + +2. Puede modificar su copia o copias del Programa o cualquier parte de ella, y así obtener un producto basado en el Programa, y ​​copiar y distribuir tales modificaciones o producto en los términos del apartado 1 anterior, siempre que se mantengan también con todas las condiciones siguientes: + +a) Debe hacer que cualquier archivo modificado incluye instrucciones en un lugar destacado sentido de que el archivo correspondiente se modificó, y la fecha de cualquier cambio. +b) Debe hacer que cualquier producto distribuido ni publicado por usted, en su totalidad o en parte contiene o se deriva del Programa o de cualquier parte del programa, obtener una licencia en su conjunto sin este impacto gasto alguno a ningún acuerdo con terceras partes con los términos de esta licencia. +c) Si el programa modificado lee normalmente órdenes interactivamente cuando es ejecutado, debe hacer que, cuando su ejecución para ese uso interactivo de la más común, mostrar o exhibir un aviso que incluya la información correspondiente al programa de propiedad intelectual y la ausencia de cualquier interés (o, en su caso, al hecho de que usted es el que da la garantía), la indicación de que los usuarios pueden redistribuir el programa de acuerdo con estas condiciones y la información necesaria para conocer cómo el acceso de un usuario copia de esta licencia. (Excepción: si el propio programa es interactivo pero normalmente no muestra este tipo de advertencias, no es necesario que su producto basado en el Programa muestre ningún aviso.) + +Estos requisitos se aplican al producto modificado como un todo. Si el producto contiene secciones fácilmente identificables no derivadas del Programa, que razonablemente puede considerarse como productos separados e independientes para sí mismos, pero esta licencia y sus términos no se aplican a esas partes cuando sean distribuidas como productos separados. Pero si esas mismas secciones se distribuyen como parte de un todo que consiste basado en el Programa, la distribución de todos debe ser la sede de los términos de esta licencia, cuyas disposiciones se aplican a todos los demás poseedores de la licencia, que cubre todo el conjunto y, en En consecuencia, todas y cada una de las partes de la articulación independientemente de quien los escribe. + +Así que el propósito de esta sección no ha sido reclamar los derechos o refutar sus afirmaciones sobre cualquier producto en para usted en su totalidad; más bien al contrario, su propósito es ejercer el derecho a controlar la distribución de derivados o colectivos basados ​​en el Programa. +Por otra parte, la simple agregación de Programa (o un trabajo basado en el Programa) otro producto no basado en el Programa en un volumen de un medio de distribución o almacenamiento no implica la inclusión de otros productos dentro del alcance de esta licencia. + +3. Usted puede copiar y distribuir el Programa (o un producto basado en él, según los términos de la Sección 2) en código objeto o en formato ejecutable según los apartados 1 y 2 anteriores, siempre que cumplan también con los siguientes requisitos: + +a) Acompañarlo con el código fuente completo correspondiente en formato legible por máquina, que se distribuye bajo los términos de los apartados 1 y 2 anteriores, en un medio habitualmente utilizado para el intercambio de software. +b) Acompañarlo con una oferta por escrito, válida durante al menos tres años, que fue dada a terceros, por un costo sea superior a los costes en que se puede incurrir en la ejecución física de la distribución del código fuente, un formato de copia completa código fuente legible por la máquina, que se ha distribuido bajo los términos de las secciones 1 y 2 anteriores, en un medio habitualmente utilizado para el intercambio de software. +c) Acompañarlo con la información que recibió sobre la oferta de distribución del código fuente correspondiente. (Esta opción se permite sólo para distribución no comercial y sólo si usted recibió el programa como código objeto o en formato ejecutable con tal oferta acabamos de explicar, de conformidad con el apartado b anterior). + +Se entiende por una fuente que trabaja su formato más adecuado cuando se le hacen modificaciones. En el caso de un trabajo ejecutable, se considera el código fuente completo todo el código fuente para todos los módulos, que incluye todos los archivos de definición de interfaz asociados y los guiones utilizados para controlar la compilación e instalación del ejecutable. Sin embargo, como una excepción especial, el código fuente distribuido no necesita incluir nada que sea distribuido normalmente (ya sea binaria o fuente) con los componentes principales (compilador, kernel, etc.) del sistema operativo en el cual funciona el ejecutable, salvo que dicha el propio componente acompañe al ejecutable. + +Si la distribución del ejecutable o del código objeto se hace mediante la concesión de acceso a la copia desde un lugar designado, a continuación, la concesión de acceso para copiar el código fuente desde el mismo lugar que se considera como distribución del código fuente, aunque se requiere un tercero para copiar el código fuente junto con el objeto. + +4. Usted no puede copiar, modificar, sublicenciar o distribuir el Programa excepto las expresamente mencionadas en este documento. Cualquier otro intento de copiar, modificar, sublicenciar o distribuir el programa es nulo, y supondrá la cancelación automática de los derechos de la concesión de esta licencia. Sin embargo, las partes a las que las copias o los derechos concedidos en virtud de los términos de esta licencia no se resuelva sus respectivas licencias, siempre que cumplan plenamente con todo lo que en ellos se estipula. + +5. Teniendo en cuenta que no han firmado, no está obligado a aceptar estos términos. Sin embargo, ella es la única que autoriza modificar o distribuir el Programa o cualquier obra derivada. Estas acciones están prohibidas por la ley, mientras no aceptar esta licencia. Por lo tanto, al modificar o distribuir el Programa (o cualquier trabajo basado en el Programa) está indicando que acepta esta Licencia para la ejecución de estas acciones, así como todos los términos y condiciones establecidos en el mismo para la copia, distribución o la modificación del programa o cualquier producto basado en él. + +6. Cada vez que redistribuya el Programa (o cualquier trabajo basado en el Programa), el receptor recibirá automáticamente una licencia del licenciatario original para copiar, distribuir o modificar el Programa sujeto a estos términos y condiciones. Usted no puede imponer ninguna restricción adicional sobre el ejercicio de los derechos establecidos en el mismo por el receptor. Usted no es responsable cuando un tercero para exigir el cumplimiento de los términos establecidos en este documento. + +7. Si, como consecuencia de una resolución judicial o alegación patente violación, o por cualquier otra razón (no limitada a asuntos relacionados con patentes), dio lugar a la imposición de cualquier condición (ya sea por orden judicial, acuerdo o cualquier otra causa) que contradigan las condiciones de esta licencia, que no le exime de cumplir las condiciones de esta licencia. Para que no sea posible distribuir el programa respetando las obligaciones bajo esta licencia y asimismo cualquier otra obligación pertinente, entonces usted tiene que dejar de distribuir de ninguna manera. Por ejemplo, si hay una licencia de patente que no permite la redistribución del Programa libre de derechos de autor por parte de todos aquellos que reciban copias directa o indirectamente de usted, la única manera de cumplir con los términos de la licencia de patentes y más de esta licencia, al mismo tiempo estarían evitando por completo la distribución del programa. + +En el caso de que cualquier sección de este apartado se considera inválida o imposible de cumplir bajo cualquier circunstancia particular se aplica al resto de la sección y, en cualquier otra circunstancia, se aplica la sección en su conjunto. + +El objetivo de esta sección no se induzca a infringir ninguna reivindicación de patente o cualquier otro derecho de propiedad intelectual, ni impugnar la validez de tales reclamaciones. La única intención de esta sección es la de proteger la integridad del sistema de distribución de software libre, puesto en práctica por el desarrollo de licencia pública. + +Mucha gente ha hecho contribuciones generosas a la evolución de la amplia gama de software distribuido a través de este sistema, con la confianza de que una aplicación coherente. Sólo el autor / donante puede decidir si está dispuesto a distribuir su software mediante cualquier otro sistema; titular de una licencia no puede imponer este tipo de elección. + +Esta sección está destinada a dejar claro lo que se cree es una consecuencia del resto de esta Licencia. + +8. En el caso de que algunos países restringen la distribución y / o uso del Programa de cualquier patente o por interfaces bajo copyright, el tenedor del copyright que presentó el programa a los términos de esta Licencia puede añadir una limitación explícita de distribución geográfica excluyendo esos países, de forma que sólo se permite la distribución en o entre los países no sujetos a dicha exclusión. Si este es el caso, la licencia para incorporar limitación mencionada en los mismos términos que fueron reclutados como parte del cuerpo de esta Licencia. + +9. La Free Software Foundation puede publicar versiones revisadas y / o nuevas esta Licencia Pública General en el momento que considere oportuno. La nueva versión mantiene el mismo espíritu que el actual, aunque los detalles pueden diferir en algunos de los contenidos con el fin de hacer frente a nuevos problemas o preocupaciones. + +Cada versión tiene un número de identificación diferente. Si el Programa especifica que se aplica a una versión específica de esta licencia y "cualquier versión posterior", se puede elegir entre adhieren a los términos y condiciones del primer pozo de esa versión o de cualquier versión posterior publicada por la Free Software Foundation. Si el Programa no especifica un número de versión de esta Licencia, usted tiene la opción de elegir cualquier versión de todos publicados por la Free Software Foundation. + +10. Si desea incluir partes del Programa en otros programas libres con diferentes condiciones de distribución, se espera que para hacer frente a la escritura del autor de pedir su consentimiento. En el caso de los derechos de autor de software de la Free Software Foundation, ir a escribir a la Free Software Foundation, que a veces hace excepciones en estos casos. La elección que hacemos se basa en nuestros dos objetivos de preservar la libertad de todos los derivados de nuestro software libre y promover el intercambio y la reutilización del software en general. + + +SIN GARANTÍA + +11. COMO EL PROGRAMA SE LICENCIA LIBRE DE CARGAS, NO SE OFRECE NINGUNA GARANTÍA SOBRE EL PROGRAMA, EN LA EXTENSIÓN PERMITIDA POR LA LEGISLACIÓN APLICABLE. EXCEPTO CUANDO SE INDIQUE DE OTRA FORMA POR ESCRITO, LOS TENEDORES DEL COPYRIGHT Y / U OTRAS PARTES PROPORCIONAN EL PROGRAMA "TAL CUAL" SIN GARANTÍA DE NINGÚN TIPO, YA SEA EXPRESA O IMPLÍCITA, INCLUYENDO, PERO NO LIMITADO A, LAS GARANTÍAS IMPLÍCITAS DE COMERCIALIZACIÓN E IDONEIDAD PARA UN FIN DETERMINADO . TODO EL RIESGO EN CUANTO A LA CALIDAD Y RENDIMIENTO DEL PROGRAMA ES CON USTED. SI EL PROGRAMA TIENE UN ERROR, ASUME EL COSTE DE CUALQUIER SERVICIO, REPARACIÓN O CORRECCIÓN. + +12. EN NINGÚN CASO, SALVO QUE LO REQUIERA LA LEGISLACIÓN APLICABLE O HAYA SIDO ACORDADO POR ESCRITO, NINGÚN TENEDOR DEL COPYRIGHT NI NINGUNA OTRA PARTE QUE MODIFIQUE Y / O REDISTRIBUYA EL PROGRAMA SEGÚN PERMITE EN ESTA LICENCIA SERÁ RESPONSABLE ANTE USTED POR DAÑOS, INCLUYENDO CUALQUIER GENERAL, ESPECIAL, DAÑOS INCIDENTALES O CONSECUENTES QUE SURJAN DEL USO O DE USO DEL PROGRAMA INCAPACIDAD (INCLUYENDO PERO NO LIMITADO A LA PÉRDIDA DE DATOS OA LA GENERACIÓN INCORRECTA OA PÉRDIDAS SUFRIDAS POR USTED O POR TERCERAS PARTES OA UN FALLO DEL PROGRAMA AL FUNCIONAR EN COMBINACIÓN CON CUALQUIER OTRO PROGRAMA) , INCLUSO SI DICHO TENEDOR U OTRA PARTE HA SIDO ADVERTIDO DE LA POSIBILIDAD DE TALES DAÑOS. + +FIN DE LOS TÉRMINOS Y CONDICIONES diff --git a/config.php b/config.php index fd3e999..1ca658f 100644 --- a/config.php +++ b/config.php @@ -42,7 +42,7 @@ $config['compression']=1; $config['processlist_refresh']=3000; $config['empty_db_before_restore']=0; -$config['optimize_tables_beforedump']=1; +$config['optimize_tables_beforedump']=0; $config['stop_with_error']=1; // For sending a mail after backup set send_mail to 1, otherless set to 0 @@ -75,9 +75,9 @@ $config['ftp_timeout'][1]=30; $config['ftp_useSSL'][1]=0; $config['ftp_mode'][1]=0; $config['ftp_server'][1]=''; -$config['ftp_port'][1]='21'; -$config['ftp_user'][1]=''; -$config['ftp_pass'][1]=''; +$config['ftp_port'][1]='21'; +$config['ftp_user'][1]=''; +$config['ftp_pass'][1]=''; $config['ftp_dir'][1]=''; $config['ftp_transfer'][2]=0; @@ -85,10 +85,10 @@ $config['ftp_timeout'][2]=30; $config['ftp_useSSL'][2]=0; $config['ftp_mode'][2]=0; $config['ftp_server'][2]=''; -$config['ftp_port'][2]='21'; -$config['ftp_user'][2]=''; -$config['ftp_pass'][2]=''; -$config['ftp_dir'][2]=''; +$config['ftp_port'][2]='21'; +$config['ftp_user'][2]=''; +$config['ftp_pass'][2]=''; +$config['ftp_dir'][2]=''; //Multipart 0=off 1=on $config['multi_part']=0; @@ -123,4 +123,4 @@ $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 +$config['log_maxsize']=1048576; diff --git a/config_overview.php b/config_overview.php index 4d09de7..ce2d13f 100644 --- a/config_overview.php +++ b/config_overview.php @@ -58,7 +58,7 @@ if (isset($_GET['config_delete'])) $_SESSION['config_file']=$config['config_file']; read_config($config['config_file']); // Standard laden } - + $del=@unlink($config['paths']['config'] . $del_config . '.php'); if ($del) $del=@unlink($config['paths']['config'] . $del_config . '.conf.php'); if ($del === false) $msg='

' . sprintf($lang['L_ERROR_DELETING_CONFIGFILE'],$del_config) . '

'; @@ -75,9 +75,9 @@ $config['cron_smtp_port']=( !isset($config['cron_smtp_port']) ) ? 25 : $config[' if (!isset($command)) $command=0; $checkFTP=Array( - - " 

 
 ", - " 

 
 ", + + " 

 
 ", + " 

 
 ", " 

 
 " ); $checkFTP[$i]=""; @@ -88,7 +88,7 @@ if (( isset($_POST['testFTP0']) ) || ( isset($_POST['testFTP1']) ) || ( isset($_ $config['ftp_timeout']=array(); $config['ftp_mode']=array(); $config['ftp_useSSL']=array(); - + for ($i=0; $i < 3; $i++) { $config['ftp_transfer'][$i]=( isset($_POST['ftp_transfer'][$i]) ) ? $_POST['ftp_transfer'][$i] : 0; @@ -132,7 +132,7 @@ if ($ftptested > -1) $config['ftp_user'][$ftptested]=$ftp_user[$ftptested]; $config['ftp_pass'][$ftptested]=$ftp_pass[$ftptested]; $config['ftp_dir'][$ftptested]=$ftp_dir[$ftptested]; - + if ($ftp_dir[$ftptested] == "" || ( strlen($ftp_dir[$ftptested]) > 1 && substr($ftp_dir[$ftptested],-1) != "/" )) $ftp_dir[$ftptested].="/"; WriteParams(); } @@ -159,47 +159,48 @@ if (isset($_POST['save'])) $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_recipient_cc']=$_POST['email_recipient_cc']; $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['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']; if ($config['maxspeed'] < $config['minspeed']) $config['maxspeed']=$config['minspeed'] * 2; - $config['stop_with_error']=$_POST['stop_with_error']; - + $config['stop_with_error']=$_POST['stop_with_error']; + $config['ignore_enable_keys']=isset($_POST['ignore_enable_keys']) ? (int) $_POST['ignore_enable_keys']:0; + $config['multi_part']=$_POST['multi_part']; $config['multipartgroesse1']=isset($_POST['multipartgroesse1']) ? floatval(str_replace(',','.',$_POST['multipartgroesse1'])) : 0; $config['multipartgroesse2']=isset($_POST['multipartgroesse2']) ? intval($_POST['multipartgroesse2']) : 0; if ($config['multipartgroesse1'] < 100 && $config['multipartgroesse2'] == 1) $config['multipartgroesse1']=100; if ($config['multipartgroesse1'] < 1 && $config['multipartgroesse2'] == 2) $config['multipartgroesse1']=1; - + $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['max_backup_files']=$_POST['max_backup_files']; - + $config['empty_db_before_restore']=$_POST['empty_db_before_restore']; $config['optimize_tables_beforedump']=$_POST['optimize_tables']; $config['cron_dbindex']=$_POST['cron_dbindex']; $config['cron_comment']=$_POST['cron_comment']; - + $config['cron_extender']=$_POST['cron_extender']; // cron_select_savepath/ if (!isset($_POST['cron_select_savepath'])) $_POST['cron_select_savepath']=$config['config_file']; @@ -217,25 +218,25 @@ if (isset($_POST['save'])) $config['cron_configurationfile']=$_POST['cron_savepath_new'] . ".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_use_sendmail']=$_POST['cron_use_sendmail']; $config['cron_sendmail']=$_POST['cron_sendmail']; $config['cron_smtp']=isset($_POST['cron_smtp']) ? $_POST['cron_smtp'] : 'localhost'; - + $config['cron_printout']=$_POST['cron_printout']; $config['cron_completelog']=$_POST['cron_completelog']; $config['cron_compression']=$_POST['compression']; $config['cron_completelog']=$_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; $i < count($databases['Name']); $i++) @@ -256,7 +257,7 @@ if (isset($_POST['save'])) $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']) : ""; - + if ($config['cron_dbindex'] == -2) { $datenbanken=count($databases['Name']); @@ -264,7 +265,7 @@ if (isset($_POST['save'])) $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 ($config['cron_dbindex'] == -3) { @@ -273,19 +274,19 @@ if (isset($_POST['save'])) $cron_db_cbd_array=implode("|",$databases['command_before_dump']); $cron_db_cad_array=implode("|",$databases['command_after_dump']); } - + $config['ftp_transfer']=array(); $config['ftp_timeout']=array(); $config['ftp_mode']=array(); $config['ftp_useSSL']=array(); - + for ($i=0; $i < 3; $i++) { $checkFTP[$i]=""; $config['ftp_transfer'][$i]=isset($_POST['ftp_transfer'][$i]) ? $_POST['ftp_transfer'][$i] : $config['ftp_transfer'][$i]; $config['ftp_timeout'][$i]=isset($_POST['ftp_timeout'][$i]) ? $_POST['ftp_timeout'][$i] : 30; $config['ftp_useSSL'][$i]=isset($_POST['ftp_useSSL'][$i]) ? 1 : 0; - + $config['ftp_mode'][$i]=isset($_POST['ftp_mode'][$i]) ? 1 : 0; $config['ftp_server'][$i]=$_POST['ftp_server'][$i]; $config['ftp_port'][$i]=$_POST['ftp_port'][$i]; @@ -295,23 +296,23 @@ if (isset($_POST['save'])) if ($config['ftp_port'][$i] == 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']; - + 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']; @@ -321,7 +322,6 @@ if (isset($_POST['save'])) if (MSD_mysql_connect()) { // neue Verbindungsdaten wurden akzeptiert -> manuelle DB-Liste von anderem User löschen - if (file_exists('./' . $config['files']['dbs_manual'])) @unlink('./' . $config['files']['dbs_manual']); SetDefault(); $msg.=''; } @@ -336,7 +336,7 @@ if (isset($_POST['save'])) $msg.='

' . $lang['L_WRONG_CONNECTIONPARS'] . '

'; } } - + // Manuelles hinzufügen einer Datenbank if ($_POST['add_db_manual'] > '') { @@ -355,26 +355,12 @@ if (isset($_POST['save'])) { if (MSD_mysql_connect()) { - $res=mysql_selectdb($to_add,$config['dbconnection']); + $res=@mysqli_select_db($config['dbconnection'], $to_add); 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 der Selectliste erscheint - echo ''; - } - else - $add_db_message=sprintf($lang['L_DB_MANUAL_FILE_ERROR'],$to_add); + $databases['Name'][] = $to_add; + //Menü aktualisieren, damit die DB in der Selectliste erscheint + echo ''; } else $add_db_message=sprintf($lang['L_DB_MANUAL_ERROR'],$to_add); @@ -382,7 +368,7 @@ if (isset($_POST['save'])) } } } - + //Nach einer Uebernahme einer neuen Configuration vor dem Schreiben ueberfluessige Indexe entfernen $anzahl_datenbanken=sizeof($databases['Name']); if (sizeof($databases['praefix']) > $anzahl_datenbanken) @@ -395,7 +381,7 @@ if (isset($_POST['save'])) } if ($databases['db_selected_index'] >= $anzahl_datenbanken) $databases['db_selected_index']=0; } - + // und wegschreiben if ($save_config) { @@ -556,25 +542,25 @@ if (sizeof($configs) > 0) if ($old_config['config_file'] == $c) $aus['conf'].='dbrowsel'; else $aus['conf'].=( $i % 2 ) ? 'dbrow' : 'dbrow1'; $aus['conf'].='">'; - + $aus['conf'].='' . $i . '.'; - + // Einstellungen $aus['conf'].=''; - + $aus['conf'].=''; $aus['conf'].=''; // filename - + $aus['conf'].=''; $aus['conf'].=''; $aus['conf'].=''; - + // Datenbankliste anzeigen $aus['conf'].='
' . $lang['L_NAME'] . ':' . $c . '
' . $lang['L_DB_HOST'] . ':' . $config['dbhost'] . '
' . $lang['L_DB_USER'] . ':' . $config['dbuser'] . '
'; - + $aus['conf'].=$lang['L_DBS'] . ':'; $aus['conf'].=''; $aus['conf'].=$icon['search'] . '' . sizeof($databases['Name']) . ''; $aus['conf'].='
'; $aus['conf'].='
'; - + $aus['conf'].=''; - + $aus['conf'].=''; - + // String aus Multidump-DBs aufbauen $toolboxstring=''; $databases['multi']=array(); @@ -612,7 +598,7 @@ if (sizeof($configs) > 0) if (isset($multi_praefixe[$x]) && $multi_praefixe[$x] > '') $toolboxstring.=' (\'' . $multi_praefixe[$x] . '\')'; } } - + // DB-Liste fuer PHP if ($config['multi_dump'] == 1) // Multidump { @@ -625,7 +611,7 @@ if (sizeof($configs) > 0) if (isset($databases['db_selected_index']) && isset($databases['praefix'][$databases['db_selected_index']]) && $databases['praefix'][$databases['db_selected_index']] > '') $text.=" ('" . $databases['praefix'][$databases['db_selected_index']] . "')"; $aus['conf'].=table_output($lang['L_BACKUP_DBS_PHP'],$text); } - + // DB-Liste fuer Perl // Fallback falls aus alten Konfigurationsdateien der Index noch nicht gesetzt ist -> alle DBs sichern if (!isset($config['cron_dbindex'])) $config['cron_dbindex']=-3; @@ -644,12 +630,12 @@ if (sizeof($configs) > 0) if (isset($databases['praefix'][$config['cron_dbindex']]) && $databases['praefix'][$config['cron_dbindex']] > '') $text.=" ('" . $databases['praefix'][$config['cron_dbindex']] . "')"; $aus['conf'].=table_output($lang['L_BACKUP_DBS_PERL'],$text); } - + if ($config['multi_part'] == 1) // Multipart { $aus['conf'].=table_output($lang['L_MULTI_PART'],$lang['L_YES'] . ", " . $lang['L_FILESIZE'] . " " . byte_output($config['multipart_groesse'])); } - + if ($config['send_mail'] == 1) //Email { $aus['conf'].=table_output($lang['L_SEND_MAIL_FORM'],$lang['L_YES'] . ", " . $lang['L_EMAIL_ADRESS'] . ": " . $config['email_recipient']); @@ -659,9 +645,9 @@ if (sizeof($configs) > 0) if ($config['email_maxsize2'] == 2) $bytes=$bytes * 1024; $text.=byte_output($bytes); if ($config['send_mail_dump'] == 1) $aus['conf'].=table_output($lang['L_SEND_MAIL_DUMP'],$text); - + } - + for ($x=0; $x < 3; $x++) { if (isset($config['ftp_transfer'][$x]) && $config['ftp_transfer'][$x] > 0) @@ -672,11 +658,11 @@ if (sizeof($configs) > 0) } $aus['conf'].='
'; $aus['conf'].='' . $icon['edit'] . ''; - + if ($c != 'mysqldumper') // && $old_config['config_file']!=$c) $aus['conf'].='' . $icon['delete'] . ''; else $aus['conf'].=' '; - + $aus['conf'].=''; } } @@ -733,19 +719,25 @@ if (isset($databases['Name'][0]) && $databases['Name'][0] > '') } else { + $disabled = ''; + if (in_array($databases['db_actual'], $dontBackupDatabases)) $disabled = ' disabled="disabled"'; + $aus['db'].='' . Help($lang['L_HELP_DB'],"conf1") . $lang['L_LIST_DB'] . ' ' . $lang['L_ACTIVATE_MULTIDUMP'] . ''; $aus['db'].=''; $aus['db'].=''; $aus['db'].=''; - + //erst die aktuelle DB $aus['db'].=''; - $aus['db'].=''; - $aus['db'].=''; - $aus['db'].=''; + $aus['db'].=''; + $aus['db'].=''; + $aus['db'].=''; $aus['db'].=''; $aus['db'].=''; - + $dbacombo=$dbbcombo=""; $j=0; for ($i=0; $i < count($databases['Name']); $i++) @@ -753,9 +745,17 @@ if (isset($databases['Name'][0]) && $databases['Name'][0] > '') if ($i != $databases['db_selected_index']) { $j++; + $disabled = ''; + if (in_array($databases['Name'][$i], $dontBackupDatabases)) $disabled = ' disabled="disabled"'; + if (!isset($databases['praefix'][$i])) $databases['praefix'][$i] = ''; $aus['db'].=''; - $aus['db'].=''; - $aus['db'].=''; + $aus['db'].=''; + $aus['db'].=''; $aus['db'].=''; $aus['db'].=''; } @@ -804,7 +804,7 @@ $aus['global1'].=''; -$aus['global1'].=''; +$aus['global1'].=''; $aus['global1'].=''; @@ -814,10 +814,20 @@ $aus['global1'].=' ' . $lang['L_NO']; $aus['global1'].=''; -$aus['global1'].='
' . $lang['L_DB'] . 'Multidump
(' . $lang['L_ALL'] . ' ' . $lang['L_NONE'] . ')
' . Help($lang['L_HELP_PRAEFIX'],"conf2") . $lang['L_PRAEFIX'] . '' . Help($lang['L_HELP_COMMANDS'],"",11) . 'Command before Dump' . Help($lang['L_HELP_COMMANDS'],"",11) . 'Command after Dump' . $lang['L_SQL_BEFEHLE'] . '
' . $databases['db_actual'] . '' . ComboCommandDump(0,$databases['db_selected_index']) . '' . ComboCommandDump(1,$databases['db_selected_index']) . '' . ComboCommandDump(0,$databases['db_selected_index'], $disabled) + . '' . ComboCommandDump(1,$databases['db_selected_index'], $disabled) . '' . $lang['L_SQL_BEFEHLE'] . '
' . $databases['Name'][$i] . '' . ComboCommandDump(0,$i) . '' . ComboCommandDump(1,$i) . '' . ComboCommandDump(0,$i, $disabled) . '' + . ComboCommandDump(1,$i, $disabled) . '' . $lang['L_SQL_BEFEHLE'] . '
' . Help($lang['L_HELP_OPTIMIZE'],"") . $lang['L_OPTIMIZE'] . '
' . Help($lang['L_HELP_OPTIMIZE'],"") . $lang['L_OPTIMIZE'] . ': ' . $lang['L_ACTIVATED']; $aus['global1'].='    ' . $lang['L_NOT_ACTIVATED'] . '
' . Help("","") . $lang['L_ERRORHANDLING_RESTORE'] . ''; +$aus['global1'].='
' . Help("","") . $lang['L_ERRORHANDLING_RESTORE'] . ':'; $aus['global1'].=' ' . $lang['L_EHRESTORE_CONTINUE'] . '
'; $aus['global1'].=' ' . $lang['L_EHRESTORE_STOP']; -$aus['global1'].='
'; +$aus['global1'].=''; + +if (!isset($config['ignore_enable_keys'])) { + $config['ignore_enable_keys'] = 0; +} +$aus['global1'].='Ignore "ENABLE KEYS":'; +$aus['global1'].=' ' . $lang['L_YES']; +$aus['global1'].='    ' . $lang['L_NO']; +$aus['global1'].=''; + +$aus['global1'].=''; $aus['global1'].=print_save_button(); $aus['global1'].=''; @@ -825,13 +835,13 @@ $aus['global1'].=''; $aus['global3']='
' . $lang['L_CONFIG_INTERFACE'] . ''; $aus['global3'].=''; $aus['global3'].=''; +$aus['global3'].=''; $aus['global3'].=''; $aus['global3'].=''; -$aus['global3'].=''; +$aus['global3'].=''; $aus['global3'].='
' . Help($lang['L_HELP_LANG'],"conf11") . $lang['L_LANGUAGE'] . ':   ' . $lang['L_DOWNLOAD_LANGUAGES'] . '
' . Help($lang['L_HELP_SERVERCAPTION'],"") . $lang['L_SERVERCAPTION'] . ': ' . $lang['L_ACTIVATED'] . '   '; $aus['global3'].=' ' . $lang['L_IN_MAINFRAME'] . '   ' . $lang['L_IN_LEFTFRAME'] . ''; $aus['global3'].='
' . Help("","") . 'Theme  ' . $lang['L_DOWNLOAD_STYLES'] . '
' . Help("","") . 'Theme:
' . $lang['L_SQL_BROWSER'] . ''; $aus['global3'].=''; @@ -894,22 +904,22 @@ $aus['transfer2']='
' . $lang['L_CONFIG_FTP for ($i=0; $i < 3; $i++) { $aus['transfer2'].='
FTP-Connection ' . ( $i + 1 ) . '
' . Help("","") . $lang['L_SQLBOXHEIGHT'] . ': 
'; - + $aus['transfer2'].=''; $aus['transfer2'].=''; - + $aus['transfer2'].=''; $aus['transfer2'].=''; - + $aus['transfer2'].=''; $aus['transfer2'].=''; $aus['transfer2'].=''; - + echo '
' . Help($lang['L_HELP_FTPTRANSFER'],"") . $lang['L_FTP_TRANSFER'] . ':  ' . $lang['L_ACTIVATED']; $aus['transfer2'].='    ' . $lang['L_NOT_ACTIVATED'] . '
' . Help($lang['L_HELP_FTPTIMEOUT'],"") . $lang['L_FTP_TIMEOUT'] . ':  sec
' . Help($lang['L_HELP_FTP_MODE'],"") . $lang['L_FTP_CHOOSE_MODE'] . ':  '; $aus['transfer2'].=$lang['L_FTP_PASSIVE'] . '
'; - + $aus['transfer2'].='
' . Help($lang['L_HELP_FTPSSL'],"") . $lang['L_FTP_SSL'] . ': '; $aus['transfer2'].=' ' . $lang['L_FTP_USESSL'] . '
'; - + $aus['transfer2'].='

' . $checkFTP[$i] . '
'; $aus['transfer2'].=''; $aus['transfer2'].=''; @@ -948,8 +958,11 @@ if (isset($databases['Name'][0]) && $databases['Name'][0] > '') $datenbanken=count($databases['Name']); for ($i=0; $i < $datenbanken; $i++) { - $aus['cron'].='
' . Help($lang['L_HELP_FTPSERVER'],"conf14",12) . $lang['L_FTP_SERVER'] . ': 
' . Help($lang['L_HELP_FTPPORT'],"conf15",12) . $lang['L_FTP_PORT'] . ': 
'.''.''.''; - + if ($dump['anzahl_zeilen']+$dump['zeilen_offset']>=$dump['zeilen_total']) { $eintrag=$dump['zeilen_offset']+1; @@ -309,17 +308,17 @@ else $zeilen_gesamt=$dump['zeilen_offset']+$dump['anzahl_zeilen']; $eintrag=$dump['zeilen_offset']+1; } - + $aus[]=''.'
 '.($fortschritt).'%
'.$lang['L_ENTRY'].' '.number_format($eintrag,0,',','.').' '.$lang['L_UPTO'].' '.number_format(($zeilen_gesamt),0,',','.').' '.$lang['L_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[]="\n".'
'.$lang['L_PROGRESS_OVER_ALL'].':'."\n".''.''.''.'
'.(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; @@ -335,13 +334,13 @@ else // Ende Anzeige WriteToDumpFile(); 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 ($dauer<$dump['max_zeit']) { @@ -377,11 +376,11 @@ else $sz=byte_output(@filesize($config['paths']['backup'].$mpdatei)); $out.="\n".$lang['L_FILE'].' '.$mpdatei.' ('.$sz.') '.$lang['L_DUMP_SUCCESSFUL'].'
'; } - + } else $out.="\n".'
'.$lang['L_FILE'].' '.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')'.''.$lang['L_DUMP_SUCCESSFUL'].'
'; - + $xtime=time()-$xtime; $aus=Array(); $aus[]='
'."\n"; @@ -392,15 +391,15 @@ else } else WriteLog('Dump \''.$dump['backupdatei'].'\' finished in '.zeit_format($xtime).'.'); - + if ($config['send_mail']==1) DoEmail(); for($i=0;$i<3;$i++) { if ($config['ftp_transfer'][$i]==1) DoFTP($i); } - + $aus[]=''.$lang['L_DONE'].'
'; - + if ($config['multi_dump']==1) { $aus[]=sprintf($lang['L_MULTIDUMP'],count($databases['multi'])).': '; @@ -413,13 +412,13 @@ else $aus[]='
'.sprintf($lang['L_DUMP_ENDERGEBNIS'],$num_tables,number_format($dump['countdata'],0,',','.')); } if ($dump['errors']>0) $aus[]=sprintf($lang['L_DUMP_ERRORS'],$dump['errors']); - + $aus[]='
'.$out.'
'.'

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

'."\n"; $aus[]="\n".'
'; $aus[]='   '; $aus[]='   

'; $aus[]='
'; - + $DumpFertig=1; } } diff --git a/filemanagement.php b/filemanagement.php index 716e4e5..33f0f3d 100644 --- a/filemanagement.php +++ b/filemanagement.php @@ -46,7 +46,7 @@ if ($action=='dl') } fclose($file); } - + //readfile($file); exit(); } @@ -106,7 +106,7 @@ if (isset($_POST['dump'])) if (!$check_dir===true) die($check_dir); $databases['db_actual_tableselected']=""; WriteParams(); - + $dump['fileoperations']=0; echo ''; exit(); @@ -119,7 +119,7 @@ if (isset($_POST['restore_tbl'])) $databases['db_actual_tableselected']=substr($_POST['tbl_array'],0,strlen($_POST['tbl_array'])-1); WriteParams(); echo ''; - + exit(); } @@ -151,7 +151,7 @@ if (isset($_POST['restore'])) if (!isset($statusline['charset'])||trim($statusline['charset'])=='?') { echo headline($lang['L_FM_RESTORE'].': '.$file); - + // if we can't detect encoding ask user echo '
'.$lang['L_CHOOSE_CHARSET'].'

'; echo '
'; @@ -160,7 +160,7 @@ if (isset($_POST['restore'])) echo make_options($config['mysql_possible_character_sets'],$dump['sel_dump_encoding']); echo '
'; echo $lang['L_MYSQL_CONNECTION_ENCODING'].':'.$config['mysql_standard_character_set'].'

'; echo ''; echo '
'; @@ -169,7 +169,7 @@ if (isset($_POST['restore'])) else $dump_encoding=$statusline['charset']; } - + $databases['db_actual_tableselected']=""; WriteParams(); echo ''; @@ -292,7 +292,12 @@ $autodel.='

'; switch ($action) { case 'dump': - //Variablen + $dbName = $databases['Name'][$databases['db_selected_index']]; + if ($config['multi_dump']==0 && in_array($dbName, $dontBackupDatabases)) { + echo headline($lang['L_FM_DUMP_HEADER'].' ("'.$lang['L_CONFIG_HEADLINE'].': '.$config['config_file'].'")'); + echo ''.sprintf($lang['L_BACKUP_NOT_POSSIBLE'], $dbName).''; + break; + } 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); @@ -302,18 +307,18 @@ switch ($action) $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; + $scriptentry=basePath(). $config['paths']['config']; + $cronabsolute=(substr($config['cron_execution_path'],0,1)=="/") ? $_SERVER['DOCUMENT_ROOT'].$scriptdir : basePath().$scriptdir; $confabsolute=$config['config_file']; $scriptref=getServerProtocol().$_SERVER['SERVER_NAME'].$refdir.$config['cron_execution_path'].'crondump.'.$cext."?config=".$confabsolute; $cronref="perl ".$cronabsolute." -config=".$confabsolute." -html_output=0"; - + //Ausgabe echo headline($lang['L_FM_DUMP_HEADER'].' ("'.$lang['L_CONFIG_HEADLINE'].': '.$config['config_file'].'")'); if (!is_writable($config['paths']['backup'])) die(''.sprintf($lang['L_WRONG_RIGHTS'],'work/backup','777').''); echo ($msg>'') ? $msg.'
' : ''; echo $autodel; - + //Auswahl echo '
@@ -321,14 +326,14 @@ switch ($action)
'; echo '
'; - + //Dumpsettings echo '
'.$lang['L_DUMP'].' (PHP)
'; - + echo '
'; echo '
'; - + echo '
'; echo $tbl_abfrage; echo ''; @@ -338,9 +343,9 @@ switch ($action) echo ''; echo '
'.$lang['L_MYSQL_CONNECTION_ENCODING'].':'.$config['mysql_standard_character_set'].'
'; echo '

'; - + echo '
'.$lang['L_FM_DUMPSETTINGS'].' (PHP)
'; - + echo ''; echo ''; - + if ($config['multi_dump']==0&&$databases['praefix'][$databases['db_selected_index']]>'') { echo ''; } - + echo ''; - + echo ''; - + if ($config['multi_part']==1) { echo ''; } - + if ($config['send_mail']==1) { $t=$config['email_recipient'].(($config['send_mail_dump']==1) ? $lang['L_WITHATTACH'] : $lang['L_WITHOUTATTACH']); } echo ''; - + for ($x=0; $x<3; $x++) { if (isset($config['ftp_transfer'][$x])&&$config['ftp_transfer'][$x]>0) @@ -389,20 +394,20 @@ switch ($action) } //echo ''; echo '
'.$lang['L_DB'].':'; if ($config['multi_dump']==1) @@ -351,35 +356,35 @@ switch ($action) else { echo $databases['db_actual'].'  ('.$databases['Detailinfo']['tables']." Tables, ".$databases['Detailinfo']['records']." Records, ".byte_output($databases['Detailinfo']['size']).')'; - + } echo '
'.$lang['L_PRAEFIX'].':'; echo $databases['praefix'][$databases['db_selected_index']]; echo '
'.$lang['L_GZIP'].':'.(($config['compression']==1) ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED']); echo '
'.$lang['L_MULTI_PART'].':'.(($config['multi_part']==1) ? $lang['L_YES'] : $lang['L_NO']); echo '
'.$lang['L_MULTI_PART_GROESSE'].':'.byte_output($config['multipart_groesse']).'
'.$lang['L_SEND_MAIL_FORM'].':'.(($config['send_mail']==1) ? $t : $lang['L_NOT_ACTIVATED']); echo '
'; - + echo '

'; - + echo '
'; - + break; - + case 'restore': echo headline(sprintf($lang['L_FM_RESTORE_HEADER'],$databases['db_actual'])); echo ($msg>'') ? $msg : ''; @@ -490,22 +495,22 @@ switch ($action) echo ''; echo ''; echo ''; - + echo FileList().''; - + echo '
'.$lang['L_FM_FILEUPLOAD'].'
'; echo '
'; echo ''; echo ''; echo '
'.$lang['L_MAX_UPLOAD_SIZE'].': '.$config['upload_max_filesize'].''; echo '
'.$lang['L_MAX_UPLOAD_SIZE_INFO']; - + echo '
'; - + echo '
Tools
'; echo ''; echo '
'; - + break; case "convert": // Konverter @@ -521,7 +526,7 @@ switch ($action) { //$destfile.=($compressed==1) ? ".sql.gz" : ".sql"; echo $lang['L_CONVERTING']." $selectfile ==> $destfile
"; - + if ($selectfile!=""&&file_exists($config['paths']['backup'].$selectfile)&&strlen($destfile)>2) { Converter($selectfile,$destfile,$compressed); diff --git a/inc/functions.php b/inc/functions.php index e94dc24..7fc0f36 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1,58 +1,59 @@ $fItem) - { - $between=explode(strtolower($fItem),strtolower($string)); - $pos=0; - foreach ($between as $bKey=>$bItem) - { - $between[$bKey]=substr($string,$pos,strlen($bItem)); - $pos+=strlen($bItem) + strlen($fItem); - } - $string=implode($replace[$fKey],$between); - } - return ( $string ); - } + + function str_ireplace($find, $replace, $string) + { + if (!is_array($find)) { + $find = array( + + $find + ); + } + if (!is_array($replace)) { + if (!is_array($find)) { + $replace = array( + + $replace + ); + } else { + // this will duplicate the string into an array the size of $find + $c = count($find); + $rString = $replace; + unset($replace); + for ($i = 0; $i < $c; $i++) { + $replace[$i] = $rString; + } + } + } + foreach ($find as $fKey => $fItem) { + $between = explode(strtolower($fItem), strtolower($string)); + $pos = 0; + foreach ($between as $bKey => $bItem) { + $between[$bKey] = substr($string, $pos, strlen($bItem)); + $pos += strlen($bItem) + strlen($fItem); + } + $string = implode($replace[$fKey], $between); + } + + return ($string); + } } if (!function_exists('stripos')) // borrowed from php.net comments { - - function stripos($haystack, $needle) - { - return strpos($haystack,stristr($haystack,$needle)); - } + + function stripos($haystack, $needle) + { + return strpos($haystack, stristr($haystack, $needle)); + } } -function Help($ToolTip, $Anker, $imgsize=12) +function Help($ToolTip, $Anker, $imgsize = 12) {/* global $config; if($Anker!=""){ @@ -63,659 +64,739 @@ function Help($ToolTip, $Anker, $imgsize=12) */ } -function DeleteFilesM($dir, $pattern="*.*") +function DeleteFilesM($dir, $pattern = "*.*") { - $deleted=array(); - $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]=true; - else $deleted[$file]=false; - } - } - closedir($d); - return $deleted; - } + $deleted = array(); + $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) && preg_match("/^" . $pattern . "$/", $file)) { + if (unlink($dir . $file)) { + $deleted[$file] = true; + } else { + $deleted[$file] = false; + } + } + } + closedir($d); + + return $deleted; + } } -function SetDefault($load_default=false) +function SetDefault($load_default = false) { - global $config,$databases,$nl,$out,$lang,$preConfig; - - if ($load_default == true) - { - if (file_exists($config['files']['parameter']) && ( is_readable($config['files']['parameter']) )) include ( $config['files']['parameter'] ); // alte Config lesen - } - $restore_values=array(); - $restore_values['cron_dbindex']=isset($config['cron_dbindex']) ? $config['cron_dbindex'] : -3; - $restore_values['cron_dbpraefix_array']=isset($config['cron_dbpraefix_array']) ? $config['cron_dbpraefix_array'] : ''; - if ($restore_values['cron_dbindex'] >= 0 && isset($databases['Name'][$config['cron_dbindex']])) // eine bestimmte Db gewaehlt? - { - // Ja, Namen merken, um spaeter den Index wieder herzustellen - $restore_values['db_actual_cron']=$databases['Name'][$config['cron_dbindex']]; - } - $restore_values['db_actual']=isset($databases['db_actual']) ? $databases['db_actual'] : ''; - //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['L_SAVING_DB_FORM'] . " " . $found_db . " " . $lang['L_ADDED'] . "$nl"; - $a++; - } - } - } - if (!isset($databases['db_selected_index'])) - { - $databases['db_selected_index']=0; - $databases['db_actual']=$databases['Name'][0]; - } - } - - WriteParams(1,$restore_values); - if ($load_default === true) WriteLog("default settings loaded."); - - return $out; + global $config, $databases, $nl, $out, $lang, $preConfig; + + if ($load_default == true) { + if (file_exists($config['files']['parameter']) && (is_readable($config['files']['parameter']))) { + include($config['files']['parameter']); + } // alte Config lesen + } + $restore_values = array(); + $restore_values['cron_dbindex'] = isset($config['cron_dbindex']) ? $config['cron_dbindex'] : -3; + $restore_values['cron_dbpraefix_array'] = isset($config['cron_dbpraefix_array']) ? $config['cron_dbpraefix_array'] + : ''; + if ($restore_values['cron_dbindex'] >= 0 + && isset($databases['Name'][$config['cron_dbindex']]) + ) // eine bestimmte Db gewaehlt? + { + // Ja, Namen merken, um spaeter den Index wieder herzustellen + $restore_values['db_actual_cron'] = $databases['Name'][$config['cron_dbindex']]; + } + $restore_values['db_actual'] = isset($databases['db_actual']) ? $databases['db_actual'] : ''; + + $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"); + } + + $oldVals = array(); + // Zuordnung nach Namen der Db zwischenspeichern, um Eingaben nicht zu verlieren + if (isset($databases) && isset($databases['Name'])) { + foreach ($databases['Name'] as $k => $v) { + if (!isset($oldVals[$k])) { + $oldVals[$v] = array(); + } + $oldVals[$v]['praefix'] = $databases['praefix'][$k]; + $oldVals[$v]['command_before_dump'] = $databases['command_before_dump'][$k]; + $oldVals[$v]['command_after_dump'] = $databases['command_after_dump'][$k]; + } + } + $oldDbArray = array(); + if (isset($databases['Name'])) { + $oldDbArray = $databases['Name']; + } + $databases['Name'] = array(); + $found_dbs = array(); + //DB-Liste holen + MSD_mysql_connect(); + + $res = mysqli_query( $config['dbconnection'], 'SHOW DATABASES'); + WHILE ($row = mysqli_fetch_row($res)) { + $found_dbs[] = $row[0]; + } + $found_dbs = array_merge($oldDbArray, $found_dbs); + $found_dbs = array_unique($found_dbs); + sort($found_dbs); + // now check each db + $a = 0; + for ($i = 0; $i < count($found_dbs); $i++) { + $found_db = $found_dbs[$i]; + $use = @mysqli_select_db($GLOBALS["___mysqli_ston"], $found_db); + if ($use) { + 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] = ""; + if (isset($oldVals[$found_db])) { + $databases['praefix'][$a] = $oldVals[$found_db]['praefix']; + $databases['command_before_dump'][$a] = $oldVals[$found_db]['command_before_dump']; + $databases['command_after_dump'][$a] = $oldVals[$found_db]['command_after_dump']; + } + $out .= $lang['L_SAVING_DB_FORM'] . " " . $found_db . " " . $lang['L_ADDED'] . "$nl"; + $a++; + } + } + if (!isset($databases['db_selected_index'])) { + $databases['db_selected_index'] = 0; + $databases['db_actual'] = $databases['Name'][0]; + } + WriteParams(1, $restore_values); + if ($load_default === true) { + WriteLog("default settings loaded."); + } + + return $out; } -function WriteParams($as=0, $restore_values=false) +function WriteParams($as = 0, $restore_values = false) { - // wenn $as=1 wird versucht den aktuellen Index der Datenbank nach dem Einlesen wieder zu ermitteln - // auch wenn sich die Indexnummer durch Loeschaktionen geaendert hat - global $config,$databases,$config_dontsave; - $nl="\n"; - - // alte Werte retten - if ($as) - { - if (is_array($restore_values)) - { - if ($restore_values['cron_dbindex'] < 0) - { - // Multidump oder "alle Datenbanken" war gewaehlt - $config['cron_dbindex']=$restore_values['cron_dbindex']; - } - else - { - //den Index der konkreten Datenbank aus der alten Konfiguration ermitteln - $db_names=array(); - $db_names=array_flip($databases['Name']); - if (isset($db_names[$restore_values['db_actual']])) - { - // alte Db existiert noch -> Index uebernehmen - $databases['db_actual']=$restore_values['db_actual']; - } - else - $databases['db_actual']=$databases['Name'][0]; - - //Cron-Index wiederfinden - if (isset($db_names[$restore_values['cron_dbindex']])) - { - $config['cron_dbindex']=$db_names[$restore_values['cron_dbindex']]; - } - else - { - // DB wurde zwischenzeitlich geloescht - sicherheitshalber alle DBs sichern - $databases['cron_dbindex']=-3; - } - } - } - } - 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)) - { - $pars_all.='$config[\'' . $var . '\']=array();' . $nl; - foreach ($val as $var2=>$val2) - { - if ($config['magic_quotes_gpc'] == 1) - { - $val2=stripslashes($val2); - } - $pars_all.='$config[\'' . $var . '\'][' . ( ( is_int($var2) ) ? $var2 : "'" . $var2 . "'" ) . '] = \'' . my_addslashes($val2) . "';$nl"; - } - } - else - { - if ($config['magic_quotes_gpc'] == 1) - { - $val=stripslashes($val); - } - if (!in_array($var,$config_dontsave)) $pars_all.='$config[\'' . $var . '\'] = \'' . my_addslashes($val) . "';$nl"; - } - } - } - foreach ($databases as $var=>$val) - { - if (is_array($val)) - { - $pars_all.='$databases[\'' . $var . '\']=array();' . $nl; - foreach ($val as $var2=>$val2) - { - if ($config['magic_quotes_gpc'] == 1 || $as == 1) - { - $pars_all.='$databases[\'' . $var . '\'][' . ( ( is_int($var2) ) ? $var2 : "'" . $var2 . "'" ) . '] = \'' . my_addslashes(stripslashes($val2)) . "';$nl"; - } - else - { - $pars_all.='$databases[\'' . $var . '\'][' . ( ( is_int($var2) ) ? $var2 : "'" . $var2 . "'" ) . '] = \'' . my_addslashes($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; - $file=$config['paths']['config'] . $config['config_file'] . '.php'; - if ($fp=fopen($file,"wb")) - { - if (!fwrite($fp,$pars_all)) $ret=false; - if (!fclose($fp)) $ret=false; - @chmod($file,0777); - } - else - $ret=false; - - $ret=WriteCronScript($restore_values); - return $ret; + // wenn $as=1 wird versucht den aktuellen Index der Datenbank nach dem Einlesen wieder zu ermitteln + // auch wenn sich die Indexnummer durch Loeschaktionen geaendert hat + global $config, $databases, $config_dontsave; + $nl = "\n"; + // alte Werte retten + if ($as) { + if (is_array($restore_values)) { + if ($restore_values['cron_dbindex'] < 0) { + // Multidump oder "alle Datenbanken" war gewaehlt + $config['cron_dbindex'] = $restore_values['cron_dbindex']; + } else { + //den Index der konkreten Datenbank aus der alten Konfiguration ermitteln + $db_names = array(); + $db_names = array_flip($databases['Name']); + if (isset($db_names[$restore_values['db_actual']])) { + // alte Db existiert noch -> Index uebernehmen + $databases['db_actual'] = $restore_values['db_actual']; + } else { + $databases['db_actual'] = $databases['Name'][0]; + } + + //Cron-Index wiederfinden + if (isset($db_names[$restore_values['cron_dbindex']])) { + $config['cron_dbindex'] = $db_names[$restore_values['cron_dbindex']]; + } else { + // DB wurde zwischenzeitlich geloescht - sicherheitshalber alle DBs sichern + $databases['cron_dbindex'] = -3; + } + } + } + } + FillMultiDBArrays(); + + //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)) { + $pars_all .= '$config[\'' . $var . '\']=array();' . $nl; + foreach ($val as $var2 => $val2) { + if ($config['magic_quotes_gpc'] == 1) { + $val2 = stripslashes($val2); + } + $pars_all .= '$config[\'' . $var . '\'][' . ((is_int($var2)) ? $var2 : "'" . $var2 . "'") . '] = \'' + . my_addslashes($val2) . "';$nl"; + } + } else { + if ($config['magic_quotes_gpc'] == 1) { + $val = stripslashes($val); + } + if (!in_array($var, $config_dontsave)) { + $pars_all .= '$config[\'' . $var . '\'] = \'' . my_addslashes($val) . "';$nl"; + } + } + } + } + foreach ($databases as $var => $val) { + if (is_array($val)) { + $pars_all .= '$databases[\'' . $var . '\']=array();' . $nl; + foreach ($val as $var2 => $val2) { + if ($config['magic_quotes_gpc'] == 1 || $as == 1) { + $pars_all + .= '$databases[\'' . $var . '\'][' . ((is_int($var2)) ? $var2 : "'" . $var2 . "'") . '] = \'' + . my_addslashes(stripslashes($val2)) . "';$nl"; + } else { + $pars_all + .= '$databases[\'' . $var . '\'][' . ((is_int($var2)) ? $var2 : "'" . $var2 . "'") . '] = \'' + . my_addslashes($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; + $file = $config['paths']['config'] . $config['config_file'] . '.php'; + if ($fp = fopen($file, "wb")) { + if (!fwrite($fp, $pars_all)) { + $ret = false; + } + if (!fclose($fp)) { + $ret = false; + } + @chmod($file, 0777); + } else { + $ret = false; + } + + $ret = WriteCronScript($restore_values); + + return $ret; } function escape_specialchars($text) { - $suchen=ARRAY( - - '@', - '$', - '\\\\', - '"' - ); - $ersetzen=ARRAY( - - '\@', - '\$', - '\\', - '\"' - ); - $text=str_replace($suchen,$ersetzen,$text); - return $text; + $suchen = ARRAY( + + '@', + '$', + '\\\\', + '"' + ); + $ersetzen = ARRAY( + + '\@', + '\$', + '\\', + '\"' + ); + $text = str_replace($suchen, $ersetzen, $text); + + return $text; } // definiert einen SAtring, der ein Array nach Perlsyntax aufbaut -function my_implode($arr, $mode=0) // 0=String, 1=intval +function my_implode($arr, $mode = 0) // 0=String, 1=intval { - global $nl; - if (!is_array($arr)) return false; - foreach ($arr as $key=>$val) - { - if ($mode == 0) $arr[$key]=escape_specialchars($val); - else $arr[$key]=intval($val); - } - if ($mode == 0) $ret='("' . implode('","',$arr) . '");' . $nl; - else $ret='(' . implode(',',$arr) . ');' . $nl; - return $ret; + global $nl; + if (!is_array($arr)) { + return false; + } + foreach ($arr as $key => $val) { + if ($mode == 0) { + $arr[$key] = escape_specialchars($val); + } else { + $arr[$key] = intval($val); + } + } + if ($mode == 0) { + $ret = '("' . implode('","', $arr) . '");' . $nl; + } else { + $ret = '(' . implode(',', $arr) . ');' . $nl; + } + + return $ret; } -function WriteCronScript($restore_values=false) +function WriteCronScript($restore_values = false) { - global $nl,$config,$databases,$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 ); - $cron_dbname=$databases['db_actual']; - - //v($databases); - // -2 = Multidump configuration - // -3 = all databases - nothing to do - // get standard values for all databases - $cron_db_array=$databases['Name']; - $cron_dbpraefix_array=$databases['praefix']; - $cron_command_before_dump=$databases['command_before_dump']; - $cron_command_after_dump=$databases['command_after_dump']; - if (!isset($config['cron_dbindex'])) $config['cron_dbindex']=-3; - if (intval($config['cron_dbindex']) == -2) - { - // get values from multidump-settings - $cron_db_array=$databases['multi']; - $cron_dbpraefix_array=$databases['multi_praefix']; - $cron_command_before_dump=$databases['multi_commandbeforedump']; - $cron_command_after_dump=$databases['multi_commandafterdump']; - } - - $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', - 'multi_part', - 'multipart_groesse', - 'email_maxsize', - 'auto_delete', - 'max_backup_files', - 'perlspeed', - 'optimize_tables_beforedump', - 'logcompression', - 'log_maxsize', - 'cron_completelog', - 'cron_use_sendmail', - 'cron_smtp_port' - ); - foreach ($int_array as $i) - { - if (is_array($i)) - { - foreach ($i as $key=>$val) - { - $int_array[$key]=intval($val); - } - } - else - $config[$i]=intval($config[$i]); - } - if ($config['dbport'] == 0) $config['dbport']=3306; - - $cronscript=""; - - // Save config - $ret=true; - $sfile=$config['paths']['config'] . $config['config_file'] . '.conf.php'; - if (file_exists($sfile)) @unlink($sfile); - - if ($fp=fopen($sfile,"wb")) - { - if (!fwrite($fp,$cronscript)) $ret=false; - if (!fclose($fp)) $ret=false; - @chmod("$sfile",0777); - } - else - $ret=false; - - // if standard config was deleted -> restore it with the actual values - 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",0777); - } - else - $ret=false; - } - return $ret; + global $nl, $config, $databases, $cron_db_array, $cron_dbpraefix_array, $cron_db_cbd_array, $cron_db_cad_array, $dontBackupDatabases; + + 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); + } + $cron_dbname = $databases['db_actual']; + + // -2 = Multidump configuration + // -3 = all databases - nothing to do + // get standard values for all databases + $cron_db_array = $databases['Name']; + $cron_dbpraefix_array = $databases['praefix']; + $cron_command_before_dump = $databases['command_before_dump']; + $cron_command_after_dump = $databases['command_after_dump']; + if (!isset($config['cron_dbindex'])) { + $config['cron_dbindex'] = -3; + } + if (intval($config['cron_dbindex']) == -2) { + // get selected dbs from multidump-settings + $cron_db_array = $databases['multi']; + $cron_dbpraefix_array = $databases['multi_praefix']; + $cron_command_before_dump = $databases['multi_commandbeforedump']; + $cron_command_after_dump = $databases['multi_commandafterdump']; + } + // we need to correct the index of the selected database after we cleaned + // the db-array from information_schema and mysql if it points to a db-name + if ($config['cron_dbindex'] >= 0) { + $cronDbIndexDbName = $databases['Name'][$config['cron_dbindex']]; + } else { + $cronDbIndex = $config['cron_dbindex']; + } + + $newDbNames = $databases['Name']; + //remove database we don't want to backup + // from newDbNames + foreach ($databases['Name'] as $k=>$v) { + if (in_array($v, $dontBackupDatabases)) { + unset($newDbNames[$k]); + } + } + // and from cron (cron_db_array has different length to newDbNames: at least mysql and information_schema are missing) + foreach ($cron_db_array as $k=>$v) { + if (in_array($v, $dontBackupDatabases)) { + unset($cron_db_array[$k], + $cron_dbpraefix_array[$k], + $cron_command_before_dump[$k], + $cron_command_after_dump[$k] + ); + } + } + + // find new index + if ($config['cron_dbindex'] >= 0) { + sort($newDbNames); + $dbNames = array_flip($newDbNames); + if (isset($dbNames[$cronDbIndexDbName])) { + $cronDbIndex = $dbNames[$cronDbIndexDbName]; + } else { + $cronDbIndex = 0; + } + } + $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', + 'multi_part', + 'multipart_groesse', + 'email_maxsize', + 'auto_delete', + 'max_backup_files', + 'perlspeed', + 'optimize_tables_beforedump', + 'logcompression', + 'log_maxsize', + 'cron_completelog', + 'cron_use_sendmail', + 'cron_smtp_port' + ); + foreach ($int_array as $i) { + if (is_array($i)) { + foreach ($i as $key => $val) { + $int_array[$key] = intval($val); + } + } else { + $config[$i] = intval($config[$i]); + } + } + if ($config['dbport'] == 0) { + $config['dbport'] = 3306; + } + + $cronscript = ""; + + // Save config + $ret = true; + $sfile = $config['paths']['config'] . $config['config_file'] . '.conf.php'; + if (file_exists($sfile)) { + @unlink($sfile); + } + + if ($fp = fopen($sfile, "wb")) { + if (!fwrite($fp, $cronscript)) { + $ret = false; + } + if (!fclose($fp)) { + $ret = false; + } + @chmod("$sfile", 0777); + } else { + $ret = false; + } + + // if standard config was deleted -> restore it with the actual values + 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", 0777); + } 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; + 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 (file_exists($config['files']['log'] . '.gz')) @unlink($config['files']['log'] . '.gz'); - if (file_exists($config['files']['log'] . '.gz')) @unlink($config['files']['log']); - if ($config['logcompression'] == 1) - { - $fp=@gzopen($config['files']['log'] . '.gz',"wb"); - @gzwrite($fp,$log); - @gzclose($fp); - @chmod($config['files']['log'] . '.gz',0777); - } - else - { - $fp=@fopen($config['files']['log'],"wb"); - @fwrite($fp,$log); - @fclose($fp); - @chmod($config['files']['log'],0777); - } + global $config; + //Datei öffnen und schreiben + $log = date('d.m.Y H:i:s') . " Log created.\n"; + if (file_exists($config['files']['log'] . '.gz')) { + @unlink($config['files']['log'] . '.gz'); + } + if (file_exists($config['files']['log'] . '.gz')) { + @unlink($config['files']['log']); + } + if ($config['logcompression'] == 1) { + $fp = @gzopen($config['files']['log'] . '.gz', "wb"); + @gzwrite($fp, $log); + @gzclose($fp); + @chmod($config['files']['log'] . '.gz', 0777); + } else { + $fp = @fopen($config['files']['log'], "wb"); + @fwrite($fp, $log); + @fclose($fp); + @chmod($config['files']['log'], 0777); + } } 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['L_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['L_FTP_NOTCONNECTED']; - echo $lang['L_CONNWITH'] . " $tinstall_ftp_server " . $lang['L_ASUSER'] . " $install_ftp_user_name " . $lang['L_NOTPOSSIBLE']; - return 0; - } - else - { - if ($config['ftp_mode'] == 1) ftp_pasv($conn_id,true); - //Wechsel in betroffenes Verzeichnis - echo $lang['L_CHANGEDIR'] . ' `' . $install_ftp_path . '` ...
'; - ftp_chdir($conn_id,$install_ftp_path); - // Erstellen der Verzeichnisse - echo $lang['L_DIRCR1'] . ' ...
'; - ftp_mkdir($conn_id,"work"); - ftp_site($conn_id,"CHMOD 0777 work"); - echo $lang['L_CHANGEDIR'] . ' `work` ...
'; - ftp_chdir($conn_id,"work"); - echo $lang['L_INDIR'] . ' `' . ftp_pwd($conn_id) . '`
'; - echo $lang['L_DIRCR5'] . ' ...
'; - ftp_mkdir($conn_id,"config"); - ftp_site($conn_id,"CHMOD 0777 config"); - echo $lang['L_DIRCR2'] . ' ...
'; - ftp_mkdir($conn_id,"backup"); - ftp_site($conn_id,"CHMOD 0777 backup"); - echo $lang['L_DIRCR4'] . ' ...
'; - ftp_mkdir($conn_id,"log"); - ftp_site($conn_id,"CHMOD 0777 log"); - - // Schließen des FTP-Streams - ftp_quit($conn_id); - return 1; - } + + 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['L_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['L_FTP_NOTCONNECTED']; + echo $lang['L_CONNWITH'] . " $tinstall_ftp_server " . $lang['L_ASUSER'] . " $install_ftp_user_name " + . $lang['L_NOTPOSSIBLE']; + + return 0; + } else { + if ($config['ftp_mode'] == 1) { + ftp_pasv($conn_id, true); + } + //Wechsel in betroffenes Verzeichnis + echo $lang['L_CHANGEDIR'] . ' `' . $install_ftp_path . '` ...
'; + ftp_chdir($conn_id, $install_ftp_path); + // Erstellen der Verzeichnisse + echo $lang['L_DIRCR1'] . ' ...
'; + ftp_mkdir($conn_id, "work"); + ftp_site($conn_id, "CHMOD 0777 work"); + echo $lang['L_CHANGEDIR'] . ' `work` ...
'; + ftp_chdir($conn_id, "work"); + echo $lang['L_INDIR'] . ' `' . ftp_pwd($conn_id) . '`
'; + echo $lang['L_DIRCR5'] . ' ...
'; + ftp_mkdir($conn_id, "config"); + ftp_site($conn_id, "CHMOD 0777 config"); + echo $lang['L_DIRCR2'] . ' ...
'; + ftp_mkdir($conn_id, "backup"); + ftp_site($conn_id, "CHMOD 0777 backup"); + echo $lang['L_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 < count($dir) - 1; $i++) - { - $path.=$dir[$i] . "/"; - @ftp_mkdir($config['dbconnection'],$path); - } - if (@ftp_mkdir($config['dbconnection'],$dirname)) return 1; + $path = ''; + $dir = explode("/", $dirname); + for ($i = 0; $i < count($dir) - 1; $i++) { + $path .= $dir[$i] . "/"; + @ftp_mkdir($config['dbconnection'], $path); + } + if (@ftp_mkdir($config['dbconnection'], $dirname)) { + return 1; + } } function IsWritable($dir) { - $testfile=$dir . "/.writetest"; - if ($writable=@fopen($testfile,'w')) - { - @fclose($writable); - @unlink($testfile); - } - return $writable; + $testfile = $dir . "/.writetest"; + if ($writable = @fopen($testfile, 'w')) { + @fclose($writable); + @unlink($testfile); + } + + return $writable; } -function SearchDatabases($printout, $db='') +function SearchDatabases($printout, $db = '') { - global $databases,$config,$lang; - - if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $db_list=array(); - if ($db == '') - { - // Datenbanken automatisch erkennen - $show_dbs=mysql_query("SHOW DATABASES",$config['dbconnection']); - if (!$show_dbs === false) - { - WHILE ($row=mysql_fetch_row($show_dbs)) - { - if (trim($row[0]) > '') $db_list[]=$row[0]; - } - } - } - else - $db_list[]=$db; // DB wurde manuell angegeben - + global $databases, $config, $lang; - if (sizeof($db_list) > 0) - { - $databases['db_selected_index']=0; - for ($i=0; $i < sizeof($db_list); $i++) - { - // Test-Select um zu sehen, ob Berechtigungen existieren - if (!@mysql_query("SHOW TABLES FROM `" . $db_list[$i] . "`",$config['dbconnection']) === false) - { - $databases['Name'][$i]=$db_list[0]; - $databases['praefix'][$i]=''; - $databases['command_before_dump'][$i]=''; - $databases['command_after_dump'][$i]=''; - - if ($printout == 1) echo $lang['L_FOUND_DB'] . ' `' . $db_list[$i] . '`
'; - } - } - } - if (isset($databases['Name'][0])) $databases['db_actual']=$databases['Name'][0]; + if (!isset($config['dbconnection'])) { + MSD_mysql_connect(); + } + $db_list = array(); + if ($db > '') { + $db_list[] = $db; // DB wurde manuell angegeben + } + // Datenbanken automatisch erkennen + $show_dbs = mysqli_query( $config['dbconnection'], "SHOW DATABASES"); + if (!$show_dbs === false) { + WHILE ($row = mysqli_fetch_row($show_dbs)) { + if (trim($row[0]) > '') { + $db_list[] = $row[0]; + } + } + } + $db_list = array_unique($db_list); + sort($db_list); + if (sizeof($db_list) > 0) { + $databases['db_selected_index'] = 0; + for ($i = 0; $i < sizeof($db_list); $i++) { + // Test-Select um zu sehen, ob Berechtigungen existieren + if (!@mysqli_query( $config['dbconnection'], "SHOW TABLES FROM `" . $db_list[$i] . "`") === false) { + $databases['Name'][$i] = $db_list[$i]; + $databases['praefix'][$i] = ''; + $databases['command_before_dump'][$i] = ''; + $databases['command_after_dump'][$i] = ''; + if ($printout == 1) { + echo $lang['L_FOUND_DB'] . ' `' . $db_list[$i] . '`
'; + } + } else { + if ($printout == 1) { + echo '' . sprintf($lang['L_DB_MANUAL_ERROR'], $db_list[$i]) . '
'; + } + } + } + } + if (isset($databases['Name'][0])) { + $databases['db_actual'] = $databases['Name'][0]; + } } // removes tags from inputs recursivly function my_strip_tags($value) { - global $dont_strip; - if (is_array($value)) - { - foreach ($value as $key=>$val) - { - if (!in_array($key,$dont_strip)) $ret[$key]=my_strip_tags($val); - else $ret[$key]=$val; - } - } - else - $ret=trim(strip_tags($value)); - return $ret; + global $dont_strip; + if (is_array($value)) { + foreach ($value as $key => $val) { + if (!in_array($key, $dont_strip)) { + $ret[$key] = my_strip_tags($val); + } else { + $ret[$key] = $val; + } + } + } else { + $ret = trim(strip_tags($value)); + } + + return $ret; } /** * Add a slashes only before ' - * + * * Used for escaping strings in JS-alerts and config-files - * + * * @param $string + * * @return string */ function my_addslashes($string) { - return str_replace("'","\'",$string); + return str_replace("'", "\'", $string); } /** * Replaces quotes for outputting value in HTML-attributes - * + * * Replaces quotes for outputing value in HTML-attributes without breaking HTML - * - * @param string $value value to output - * @return string + * + * @param string $value value to output + * + * @return string */ function my_quotes($value) { - return str_replace('"','"',$value); + return str_replace('"', '"', $value); } // prepares a string for executing it as query function db_escape($string) { - global $config; - if (function_exists('mysql_real_escape_string')) - { - $string=mysql_real_escape_string($string,$config['dbconnection']); - } - else if (function_exists('mysql_escape_string')) - { - $string=mysql_escape_string($string,$config['dbconnection']); - } - else $string=addslashes($string); - return $string; + global $config; + if (function_exists('mysqli_real_escape_string')) { + $string = mysqli_real_escape_string( $config['dbconnection'], $string); + } else { + $string = addslashes($string); + } + + return $string; } -?> \ No newline at end of file +?> diff --git a/inc/functions_dump.php b/inc/functions_dump.php index 2f29198..fb176a5 100644 --- a/inc/functions_dump.php +++ b/inc/functions_dump.php @@ -72,18 +72,18 @@ function GetStatusLine($kind="php") $r=0; $t_zeile="$mysql_commentstring\n$mysql_commentstring TABLE-INFO\r\n"; MSD_mysql_connect(); - $res=mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); - $numrows=intval(@mysql_num_rows($res)); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); + $numrows=intval(@mysqli_num_rows($res)); for($i=0;$i<$numrows;$i++) { - $erg=mysql_fetch_array($res); + $erg=mysqli_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); + $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2); if ($res2===false) { // error reading table definition - $read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$databases['Name'][$dump['dbindex']],$erg['Name']).': '.mysql_error($config['dbconnection']); + $read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$databases['Name'][$dump['dbindex']],$erg['Name']).': '.((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); Errorlog("DUMP",$databases['Name'][$dump['dbindex']],'',$read_create_error,0); WriteLog($read_create_error); if ($config['stop_with_error']>0) @@ -95,7 +95,7 @@ function GetStatusLine($kind="php") } else { - $row2=mysql_fetch_array($res2); + $row2=mysqli_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']])) @@ -129,9 +129,9 @@ function get_def($db,$table,$withdata=1) } else $def.="DROP TABLE IF EXISTS `$table`;\n"; - mysql_select_db($db); - $result=mysql_query('SHOW CREATE TABLE `'.$table.'`',$config['dbconnection']); - $row=@mysql_fetch_row($result); + mysqli_select_db($GLOBALS["___mysqli_ston"], $db); + $result=mysqli_query($config['dbconnection'], 'SHOW CREATE TABLE `'.$table.'`'); + $row=@mysqli_fetch_row($result); if ($row===false) return false; $def.=$row[1].';'."\n\n"; if ($withdata==1) @@ -152,12 +152,12 @@ function get_content($db,$table) $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); + mysqli_select_db($GLOBALS["___mysqli_ston"], $db); + $result=mysqli_query($config['dbconnection'], $query); + $ergebnisse=@mysqli_num_rows($result); if ($ergebnisse!==false) { - $num_felder=mysql_num_fields($result); + $num_felder=(($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false); $first=1; if ($ergebnisse>$dump['restzeilen']) @@ -176,7 +176,7 @@ function get_content($db,$table) $ax=0; for($x=0;$x<$ergebnisse;$x++) { - $row=mysql_fetch_row($result); + $row=mysqli_fetch_row($result); $ax++; $insert='INSERT INTO `'.$table.'` '.$complete.'VALUES ('; @@ -185,7 +185,7 @@ function get_content($db,$table) { if (!isset($row[$j])) $insert.='NULL,'; else - if ($row[$j]!='') $insert.='\''.mysql_escape_string($row[$j]).'\','; + if ($row[$j]!='') $insert.='\''. mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $row[$j]) .'\','; else $insert.='\'\','; } @@ -211,7 +211,7 @@ function get_content($db,$table) WriteToDumpFile(); } } - @mysql_free_result($result); + @((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false); } function WriteToDumpFile() @@ -275,7 +275,7 @@ function ExecuteCommand($when) if (substr(strtolower($cd),0,7)!='system:') { $cad=array(); - @mysql_select_db($databases['Name'][$dump['dbindex']]); + mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['Name'][$dump['dbindex']]); if (strpos($cd,';')) { $cad=explode(';',$cd); @@ -287,12 +287,12 @@ function ExecuteCommand($when) { if (trim($cad[$i])>'') { - $result=@mysql_query($cad[$i],$config['dbconnection']); + $result=@mysqli_query($config['dbconnection'], $cad[$i]); if ($result===false) { - WriteLog("Error executing Query '$cad[$i]'! MySQL returns: ".trim(mysql_error())); - ErrorLog("Error executing Query '$cad[$i]'!",$databases['Name'][$dump['dbindex']],$cad[$i],mysql_error(),0); + WriteLog("Error executing Query '$cad[$i]'! MySQL returns: ".trim(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)))); + ErrorLog("Error executing Query '$cad[$i]'!",$databases['Name'][$dump['dbindex']],$cad[$i],((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)),0); $dump['errors']++; $out.='Error executing Query '.$cad[$i].''.$lf; } diff --git a/inc/functions_files.php b/inc/functions_files.php index 0ed6643..b6b8ae0 100644 --- a/inc/functions_files.php +++ b/inc/functions_files.php @@ -4,7 +4,7 @@ function FilelisteCombo($fpath,$selected) { $r=''; - + if ($multi==0) { $fl.=''; @@ -216,12 +216,12 @@ function FileList($multi=0) } else $fl.=' '.$db_backups[$i]['db'].' '; - + $fl.=''.((substr($dbn,-3)==".gz") ? ''.$lang['L_COMPRESSED'].'':" ").''; $fl.=''.$db_backups[$i]['script'].''; $fl.=''.(($db_backups[$i]['kommentar']!="") ? ''.$db_backups[$i]['kommentar'].'':" ").''; $fl.=''.(($db_backups[$i]['kommentar']!="") ? nl2br(wordwrap($db_backups[$i]['kommentar'],50)):" ").''; - + $fl.=''.$db_backups[$i]['date'].''; $fl.=''; $fl.=($db_backups[$i]['multipart']==0) ? $lang['L_NO']:''.$db_backups[$i]['multipart'].' Files'; // @@ -231,7 +231,7 @@ function FileList($multi=0) $fl.=''.byte_output($db_backups[$i]['size']).''; $fl.=''.$db_backups[$i]['charset'].''; $fl.=''; - + if ($expand==$i) { $fl.=''; @@ -254,7 +254,7 @@ function FileList($multi=0) ksort($db_summary_last); ksort($db_summary_anzahl); ksort($db_summary_size); - + $i=0; while (list ($key,$val)=each($db_summary_anzahl)) { @@ -268,7 +268,7 @@ function FileList($multi=0) } } if (!is_array($files)) $fl.=''.$lang['L_FM_NOFILESFOUND'].''; - + //-------------------------------------------------------- //*** Ausgabe der Gesamtgröße aller Backupfiles *** //-------------------------------------------------------- @@ -277,7 +277,7 @@ function FileList($multi=0) $fl.=''.$lang['L_FM_TOTALSIZE'].' ('.$Sum_Files.' files): '; $fl.=''.byte_output($gesamt).''; $fl.=''; - + //-------------------------------------------------------- //*** Ausgabe des freien Speicher auf dem Rechner *** //-------------------------------------------------------- @@ -286,7 +286,7 @@ function FileList($multi=0) $fl.=''.$space.''; $fl.=''; $fl.='
'; - + return $fl; } @@ -322,7 +322,7 @@ function PartListe($f,$nr) if ($i>1) $s.="
"; $s.=''.$dateistamm.$i.$dateiendung.'   '.byte_output(@filesize($config['paths']['backup'].$dateistamm.$i.$dateiendung)); $s.=' '; - + } return $s; } @@ -330,7 +330,7 @@ function PartListe($f,$nr) function Converter($filesource,$filedestination,$cp) { global $config,$lang; - + $filesize=0; $max_filesize=1024*1024*10; //10 MB splitsize $part=1; @@ -340,11 +340,11 @@ function Converter($filesource,$filedestination,$cp) if (file_exists($config['paths']['backup'].$filedestination)) unlink($config['paths']['backup'].$filedestination); $f=($cps==1) ? gzopen($config['paths']['backup'].$filesource,"r"):fopen($config['paths']['backup'].$filesource,"r"); $z=($cp==1) ? gzopen($config['paths']['backup'].$filedestination.'_part_1.sql.gz',"w"):fopen($config['paths']['backup'].$filedestination.'_part_1.sql',"w"); - + $zeile=get_pseudo_statusline($part,$filedestination)."\r\n"; ($cp==1) ? gzwrite($z,$zeile):fwrite($z,$zeile); $zeile=''; - + $insert=$mode=""; $n=0; $eof=($cps==1) ? gzeof($f):feof($f); @@ -353,7 +353,7 @@ function Converter($filesource,$filedestination,$cp) { $eof=($cps==1) ? gzeof($f):feof($f); $zeile=($cps==1) ? gzgets($f,5144000):fgets($f,5144000); - + $t=strtolower(substr($zeile,0,10)); if ($t>'') { @@ -362,14 +362,14 @@ function Converter($filesource,$filedestination,$cp) case 'insert int': { // eine neue Insert Anweisung beginnt - if (strpos($zeile,0,'(')===false) + if (strpos($zeile,'(')===false) { //Feldnamen stehen in der naechsten Zeile - holen $zeile.="\n\r"; $zeile.=($cps==1) ? trim(gzgets($f,8192)):trim(fgets($f,8192)); $zeile.=' '; } - + // get INSERT-Satement $insert=substr($zeile,0,strpos($zeile,'(')); if (substr(strtoupper($insert),-7)!='VALUES ') $insert.=' VALUES '; @@ -378,7 +378,7 @@ function Converter($filesource,$filedestination,$cp) $splitable=false; break; } - + case 'create tab': { $mode='create'; @@ -392,15 +392,15 @@ function Converter($filesource,$filedestination,$cp) } } } - + if ($mode=='insert') { if (substr(rtrim($zeile),strlen($zeile)-3,2)==');') $splitable=true; - + // Komma loeschen $zeile=str_replace('),(',");\n\r".$insert.' (',$zeile); } - + if ($splitable==true&&$filesize>$max_filesize) // start new file? { $part++; @@ -474,7 +474,7 @@ function Converter($filesource,$filedestination,$cp) fwrite($z,$zeile); fclose($z); } - + if ($cps==1) gzclose($f); else fclose($f); diff --git a/inc/functions_global.php b/inc/functions_global.php index ee91c37..1b72a73 100644 --- a/inc/functions_global.php +++ b/inc/functions_global.php @@ -1,885 +1,939 @@ '."\n"; - foreach ($parameter as $key=>$val) - { - if (is_array($val)) - { - foreach ($val as $key2=>$val2) - { - $page_parameter.=''."\n"; - } - } - else - $page_parameter.=''."\n"; - } - $page_parameter.=''; - return $page_parameter; + $page_parameter = '
' . "\n"; + foreach ($parameter as $key => $val) { + if (is_array($val)) { + foreach ($val as $key2 => $val2) { + $page_parameter .= '' + . "\n"; + } + } else { + $page_parameter .= '' . "\n"; + } + } + $page_parameter .= '
'; + + return $page_parameter; } function mu_sort($array, $key_sort) { - $key_sorta=explode(',',$key_sort); - $keys=array_keys($array[0]); - $n=0; - - for ($m=0; $m oder rsort=absteigend - return $output; + $key_sorta = explode(',', $key_sort); + $keys = array_keys($array[0]); + $n = 0; + + for ($m = 0; $m < count($key_sorta); $m++) { + $nkeys[$m] = trim($key_sorta[$m]); + } + $n += count($key_sorta); + + for ($i = 0; $i < count($keys); $i++) { + if (!in_array($keys[$i], $key_sorta)) { + $nkeys[$n] = $keys[$i]; + $n += "1"; + } + } + for ($u = 0; $u < count($array); $u++) { + $arr = $array[$u]; + for ($s = 0; $s < count($nkeys); $s++) { + $k = $nkeys[$s]; + if (isset($array[$u][$k])) { + $output[$u][$k] = $array[$u][$k]; + } + } + } + // wenn die Sortierung nicht ab- sondern aufsteigend sein soll, muss sort() benutzt werden + sort($output); // Sort=Aufsteigend -> oder rsort=absteigend + return $output; } function FillMultiDBArrays() { - global $config,$databases; - - // Nur füllen wenn überhaupt Datenbanken gefunden wurden - if ((isset($databases['Name']))&&(count($databases['Name'])>0)) - { - $databases['multi']=Array(); - $databases['multi_praefix']=Array(); - if (!isset($databases['db_selected_index'])) $databases['db_selected_index']=0; - if (!isset($databases['db_actual'])&&isset($databases['Name'])) $databases['db_actual']=$databases['Name'][$databases['db_selected_index']]; - if (!isset($databases['multisetting'])) $databases['multisetting']=''; - - // if($config['multi_dump']==1) - // { - if ($databases['multisetting']=='') - { - //$databases['multi'][0]=$databases['db_actual']; - //$databases['multi_praefix'][0]=(isset($databases['praefix'][0])) ? $databases['praefix'][0] : ''; - } - else - { - $databases['multi']=explode(';',$databases['multisetting']); - $flipped=array_flip($databases['Name']); - for ($i=0; $i 0)) { + $databases['multi'] = Array(); + $databases['multi_praefix'] = Array(); + if (!isset($databases['db_selected_index'])) { + $databases['db_selected_index'] = 0; + } + if (!isset($databases['db_actual']) && isset($databases['Name'])) { + $databases['db_actual'] = $databases['Name'][$databases['db_selected_index']]; + } + if (!isset($databases['multisetting'])) { + $databases['multisetting'] = ''; + } + + // if($config['multi_dump']==1) + // { + if ($databases['multisetting'] == '') { + //$databases['multi'][0]=$databases['db_actual']; + //$databases['multi_praefix'][0]=(isset($databases['praefix'][0])) ? $databases['praefix'][0] : ''; + } else { + $databases['multi'] = explode(';', $databases['multisetting']); + $flipped = array_flip($databases['Name']); + for ($i = 0; $i < count($databases['multi']); $i++) { + if (isset($flipped[$databases['multi'][$i]])) { + $ind = $flipped[$databases['multi'][$i]]; + $databases['multi_praefix'][$i] = (isset($databases['praefix'][$ind])) ? $databases['praefix'][$ind] + : ''; + } + } + } + + // } + /* else { $databases['multi'][0]=(isset($databases['db_actual'])) ? $databases['db_actual'] : ''; $databases['multi_praefix'][0]=(isset($databases['praefix'])) ? $databases['praefix'][$databases['db_selected_index']] : ''; } */ - } + } } function DBDetailInfo($index) { - global $databases,$config; - - $databases['Detailinfo']['tables']=$databases['Detailinfo']['records']=$databases['Detailinfo']['size']=0; - MSD_mysql_connect(); - if (isset($databases['Name'][$index])) - { - mysql_select_db($databases['Name'][$index]); - $databases['Detailinfo']['Name']=$databases['Name'][$index]; - $res=@mysql_query('SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`'); - if ($res) $databases['Detailinfo']['tables']=mysql_num_rows($res); - if ($databases['Detailinfo']['tables']>0) - { - $s1=$s2=0; - for ($i=0; $i<$databases['Detailinfo']['tables']; $i++) - { - $row=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'][$index]."`.`".$row['Name']."`"; - $res2=@mysql_query($sql_2); - $row2=@mysql_fetch_array($res2); - $row['Rows']=isset($row2['count_records']) ? $row2['count_records'] : 0; - $s1+=$row['Rows']; - $s2+=$row['Data_length']+$row['Index_length']; - } - $databases['Detailinfo']['records']=$s1; - $databases['Detailinfo']['size']=$s2; - } - } + global $databases, $config; + + $databases['Detailinfo']['tables'] = $databases['Detailinfo']['records'] = $databases['Detailinfo']['size'] = 0; + MSD_mysql_connect(); + if (isset($databases['Name'][$index])) { + mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['Name'][$index]); + $databases['Detailinfo']['Name'] = $databases['Name'][$index]; + $res = @mysqli_query( + $GLOBALS["___mysqli_ston"], + 'SHOW TABLE STATUS FROM `' . $databases['Name'][$index] . '`' + ); + if ($res) { + $databases['Detailinfo']['tables'] = mysqli_num_rows($res); + } + if ($databases['Detailinfo']['tables'] > 0) { + $s1 = $s2 = 0; + while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) { + $s1 += $row['Rows']; + $s2 += $row['Data_length'] + $row['Index_length']; + } + $databases['Detailinfo']['records'] = $s1; + $databases['Detailinfo']['size'] = $s2; + } + } } function Stringformat($s, $count) { - if ($count>=strlen($s)) return str_repeat("0",$count-strlen($s)).$s; - else - return $s; + if ($count >= strlen($s)) { + return str_repeat("0", $count - strlen($s)) . $s; + } else { + return $s; + } } function getmicrotime() { - list ($usec, $sec)=explode(" ",microtime()); - return ((float) $usec+(float) $sec); + list ($usec, $sec) = explode(" ", microtime()); + + return ((float)$usec + (float)$sec); } function MD_FreeDiskSpace() { - global $lang; - $dfs=@diskfreespace("../"); - return ($dfs) ? byte_output($dfs) : $lang['L_NOTAVAIL']; + global $lang; + $dfs = @diskfreespace("../"); + + return ($dfs) ? byte_output($dfs) : $lang['L_NOTAVAIL']; } function WriteDynamicText($txt, $object) { - return ''; + return ''; } -function byte_output($bytes, $precision=2, $names=Array()) +function byte_output($bytes, $precision = 2, $names = Array()) { - if (!is_numeric($bytes)||$bytes<0) - { - return false; - } - for ($level=0; $bytes>=1024; $level++) - { - $bytes/=1024; - } - switch ($level) - { - case 0: - $suffix=(isset($names[0])) ? $names[0] : 'B'; - break; - case 1: - $suffix=(isset($names[1])) ? $names[1] : 'KB'; - break; - case 2: - $suffix=(isset($names[2])) ? $names[2] : 'MB'; - break; - case 3: - $suffix=(isset($names[3])) ? $names[3] : 'GB'; - break; - case 4: - $suffix=(isset($names[4])) ? $names[4] : 'TB'; - break; - case 5: - $suffix=(isset($names[4])) ? $names[4] : 'PB'; - break; - case 6: - $suffix=(isset($names[4])) ? $names[4] : 'EB'; - break; - case 7: - $suffix=(isset($names[4])) ? $names[4] : 'ZB'; - break; - - default: - $suffix=(isset($names[$level])) ? $names[$level] : ''; - break; - } - return sprintf("%01.".$precision."f",round($bytes,$precision)).' '.$suffix; + if (!is_numeric($bytes) || $bytes < 0) { + return false; + } + for ($level = 0; $bytes >= 1024; $level++) { + $bytes /= 1024; + } + switch ($level) { + case 0: + $suffix = (isset($names[0])) ? $names[0] : 'B'; + break; + case 1: + $suffix = (isset($names[1])) ? $names[1] : 'KB'; + break; + case 2: + $suffix = (isset($names[2])) ? $names[2] : 'MB'; + break; + case 3: + $suffix = (isset($names[3])) ? $names[3] : 'GB'; + break; + case 4: + $suffix = (isset($names[4])) ? $names[4] : 'TB'; + break; + case 5: + $suffix = (isset($names[4])) ? $names[4] : 'PB'; + break; + case 6: + $suffix = (isset($names[4])) ? $names[4] : 'EB'; + break; + case 7: + $suffix = (isset($names[4])) ? $names[4] : 'ZB'; + break; + + default: + $suffix = (isset($names[$level])) ? $names[$level] : ''; + break; + } + + return sprintf("%01." . $precision . "f", round($bytes, $precision)) . ' ' . $suffix; } function ExtractDBname($s) { - $sp=explode('_',$s); - $anz=count($sp)-1; - $r=0; - if ($anz>4) - { - $df=5; //Datumsfelder - if ($sp[$anz-1]=='part') $df+=2; - if ($sp[$anz-3]=='crondump'||$sp[$anz-1]=='crondump') $df+=2; - $anz=$anz-$df; //Datum weg - for ($i=0; $i<=$anz; $i++) - { - $r+=strlen($sp[$i])+1; - } - return substr($s,0,$r-1); - } - else - { - //Fremdformat - return substr($s,0,strpos($s,'.')); - } + $sp = explode('_', $s); + $anz = count($sp) - 1; + $r = 0; + if ($anz > 4) { + $df = 5; //Datumsfelder + if ($sp[$anz - 1] == 'part') { + $df += 2; + } + if ($sp[$anz - 3] == 'crondump' || $sp[$anz - 1] == 'crondump') { + $df += 2; + } + $anz = $anz - $df; //Datum weg + for ($i = 0; $i <= $anz; $i++) { + $r += strlen($sp[$i]) + 1; + } + + return substr($s, 0, $r - 1); + } else { + //Fremdformat + return substr($s, 0, strpos($s, '.')); + } } function ExtractBUT($s) { - $i=strpos(strtolower($s),"part"); - if ($i>0) $s=substr($s,0,$i-1); - $i=strpos(strtolower($s),"crondump"); - if ($i>0) $s=substr($s,0,$i-1); - $i=strpos(strtolower($s),".sql"); - if ($i>0) $s=substr($s,0,$i); - $sp=explode("_",$s); - - $anz=count($sp)-1; - if (strtolower($sp[$anz])=='perl') $anz--; - if ($anz>4) - { - return $sp[$anz-2].".".$sp[$anz-3].".".$sp[$anz-4]." ".$sp[$anz-1].":".$sp[$anz]; - } - else - { - //Fremdformat - return ""; - } + $i = strpos(strtolower($s), "part"); + if ($i > 0) { + $s = substr($s, 0, $i - 1); + } + $i = strpos(strtolower($s), "crondump"); + if ($i > 0) { + $s = substr($s, 0, $i - 1); + } + $i = strpos(strtolower($s), ".sql"); + if ($i > 0) { + $s = substr($s, 0, $i); + } + $sp = explode("_", $s); + + $anz = count($sp) - 1; + if (strtolower($sp[$anz]) == 'perl') { + $anz--; + } + if ($anz > 4) { + return $sp[$anz - 2] . "." . $sp[$anz - 3] . "." . $sp[$anz - 4] . " " . $sp[$anz - 1] . ":" . $sp[$anz]; + } else { + //Fremdformat + return ""; + } } function WriteLog($aktion) { - global $config,$lang; - $log=date('d.m.Y H:i:s').' '.htmlspecialchars($aktion)."\n"; - - $logfile=($config['logcompression']==1) ? $config['files']['log'].'.gz' : $config['files']['log']; - if (@filesize($logfile)+strlen($log)>$config['log_maxsize']) @unlink($logfile); - - //Datei öffnen und schreiben - if ($config['logcompression']==1) - { - - $fp=@gzopen($logfile,'a'); - if ($fp) - { - @gzwrite($fp,$log).'
'; - @gzclose($fp); - } - else - echo '

'.$lang['L_LOGFILENOTWRITABLE'].' ('.$logfile.')

'; - } - else - { - $fp=@fopen($logfile,"ab"); - if ($fp) - { - @fwrite($fp,$log); - @fclose($fp); - } - else - echo '

'.$lang['L_LOGFILENOTWRITABLE'].' ('.$logfile.')

'; - } + global $config, $lang; + $log = date('d.m.Y H:i:s') . ' ' . htmlspecialchars($aktion) . "\n"; + + $logfile = ($config['logcompression'] == 1) ? $config['files']['log'] . '.gz' : $config['files']['log']; + if (@filesize($logfile) + strlen($log) > $config['log_maxsize']) { + @unlink($logfile); + } + + //Datei öffnen und schreiben + if ($config['logcompression'] == 1) { + + $fp = @gzopen($logfile, 'a'); + if ($fp) { + @gzwrite($fp, $log) . '
'; + @gzclose($fp); + } else { + echo '

' . $lang['L_LOGFILENOTWRITABLE'] . ' (' . $logfile . ')

'; + } + } else { + $fp = @fopen($logfile, "ab"); + if ($fp) { + @fwrite($fp, $log); + @fclose($fp); + } else { + echo '

' . $lang['L_LOGFILENOTWRITABLE'] . ' (' . $logfile . ')

'; + } + } } -function ErrorLog($dest, $db, $sql, $error, $art=1) +function ErrorLog($dest, $db, $sql, $error, $art = 1) { - //$art=0 -> Fehlermeldung - //$art=1 -> Hinweis - + //$art=0 -> Fehlermeldung + //$art=1 -> Hinweis - global $config; - if (strlen($sql)>100) $sql=substr($sql,0,100)." ... (snip)"; - //Error-Zeile generieren - $errormsg=date('d.m.Y H:i:s').': '; - $errormsg.=($dest=='RESTORE') ? ' Restore of db `'.$db.'`|:|' : ' Dump of db `'.$db.'`|:|'; - - if ($art==0) - { - $errormsg.='Error-Message: '.$error.'|:|'; - } - else - { - $errormsg.='Notice: '.$error.'|:|'; - } - - if ($sql>'') $errormsg.='SQL: '.$sql."\n"; - - //Datei öffnen und schreiben - if ($config['logcompression']==1) - { - $fp=@gzopen($config['paths']['log'].'error.log.gz','ab'); - if ($fp) - { - @gzwrite($fp,($errormsg)); - @gzclose($fp); - } - } - else - { - $fp=@fopen($config['paths']['log'].'error.log','ab'); - if ($fp) - { - @fwrite($fp,($errormsg)); - @fclose($fp); - } - } + + global $config; + if (strlen($sql) > 100) { + $sql = substr($sql, 0, 100) . " ... (snip)"; + } + //Error-Zeile generieren + $errormsg = date('d.m.Y H:i:s') . ': '; + $errormsg .= ($dest == 'RESTORE') ? ' Restore of db `' . $db . '`|:|' : ' Dump of db `' . $db . '`|:|'; + + if ($art == 0) { + $errormsg .= 'Error-Message: ' . $error . '|:|'; + } else { + $errormsg .= 'Notice: ' . $error . '|:|'; + } + + if ($sql > '') { + $errormsg .= 'SQL: ' . $sql . "\n"; + } + + //Datei öffnen und schreiben + if ($config['logcompression'] == 1) { + $fp = @gzopen($config['paths']['log'] . 'error.log.gz', 'ab'); + if ($fp) { + @gzwrite($fp, ($errormsg)); + @gzclose($fp); + } + } else { + $fp = @fopen($config['paths']['log'] . 'error.log', 'ab'); + if ($fp) { + @fwrite($fp, ($errormsg)); + @fclose($fp); + } + } } -function DirectoryWarnings($path="") +function DirectoryWarnings($path = "") { - global $config,$lang; - $warn=''; - if (!is_writable($config['paths']['work'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['work'],'0777'); - if (!is_writable($config['paths']['config'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['config'],'0777'); - if (!is_writable($config['paths']['backup'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['backup'],'0777'); - if (!is_writable($config['paths']['log'])) $warn.=sprintf($lang['L_WRONG_RIGHTS'],$config['paths']['log'],'0777'); - - if ($warn!='') $warn=''.$warn.''; - return $warn; + global $config, $lang; + $warn = ''; + if (!is_writable($config['paths']['work'])) { + $warn .= sprintf($lang['L_WRONG_RIGHTS'], $config['paths']['work'], '0777'); + } + if (!is_writable($config['paths']['config'])) { + $warn .= sprintf($lang['L_WRONG_RIGHTS'], $config['paths']['config'], '0777'); + } + if (!is_writable($config['paths']['backup'])) { + $warn .= sprintf($lang['L_WRONG_RIGHTS'], $config['paths']['backup'], '0777'); + } + if (!is_writable($config['paths']['log'])) { + $warn .= sprintf($lang['L_WRONG_RIGHTS'], $config['paths']['log'], '0777'); + } + + if ($warn != '') { + $warn = '' . $warn . ''; + } + + return $warn; } function TestWorkDir() { - global $config; - - $ret=SetFileRechte($config['paths']['work']); - if ($ret===true) $ret=SetFileRechte($config['paths']['backup']); - if ($ret===true) $ret=SetFileRechte($config['paths']['log']); - if ($ret===true) $ret=SetFileRechte($config['paths']['config']); - - if ($ret===true) - { - if (!file_exists($config['files']['parameter'])) SetDefault(true); - if (!file_exists($config['files']['log'])) DeleteLog(); - } - return $ret; + global $config; + + $ret = SetFileRechte($config['paths']['work']); + if ($ret === true) { + $ret = SetFileRechte($config['paths']['backup']); + } + if ($ret === true) { + $ret = SetFileRechte($config['paths']['log']); + } + if ($ret === true) { + $ret = SetFileRechte($config['paths']['config']); + } + + if ($ret === true) { + if (!file_exists($config['files']['parameter'])) { + SetDefault(true); + } + if (!file_exists($config['files']['log'])) { + DeleteLog(); + } + } + + return $ret; } -function SetFileRechte($file, $is_dir=1, $perm=0777) +function SetFileRechte($file, $is_dir = 1, $perm = 0777) { - global $lang; - $ret=true; - if ($is_dir==1) - { - if (substr($file,-1)!="/") $file.="/"; - } - clearstatcache(); - - // erst pruefen, ob Datei oder Verzeichnis existiert - if (!file_exists($file)) - { - // Wenn es sich um ein Verzeichnis handelt -> anlegen - if ($is_dir==1) - { - $ret=@mkdir($file,$perm); - if (!$ret===true) - { - // Hat nicht geklappt -> Rueckmeldung - $ret=sprintf($lang['L_CANT_CREATE_DIR'],$file); - } - } - } - - // wenn bisher alles ok ist -> Rechte setzen - egal ob Datei oder Verzeichnis - if ($ret===true) - { - $ret=@chmod($file,$perm); - if (!$ret===true) $ret=sprintf($lang['L_WRONG_RIGHTS'],$file,decoct($perm)); - } - return $ret; + global $lang; + $ret = true; + if ($is_dir == 1) { + if (substr($file, -1) != "/") { + $file .= "/"; + } + } + clearstatcache(); + + // erst pruefen, ob Datei oder Verzeichnis existiert + if (!file_exists($file)) { + // Wenn es sich um ein Verzeichnis handelt -> anlegen + if ($is_dir == 1) { + $ret = @mkdir($file, $perm); + if (!$ret === true) { + // Hat nicht geklappt -> Rueckmeldung + $ret = sprintf($lang['L_CANT_CREATE_DIR'], $file); + } + } + } + + // wenn bisher alles ok ist -> Rechte setzen - egal ob Datei oder Verzeichnis + if ($ret === true) { + $ret = @chmod($file, $perm); + if (!$ret === true) { + $ret = sprintf($lang['L_WRONG_RIGHTS'], $file, decoct($perm)); + } + } + + return $ret; } function SelectDB($index) { - global $databases; - if (isset($databases['Name'][$index])) - { - $databases['db_actual']=$databases['Name'][$index]; - if (isset($databases['praefix'][$index])) $databases['praefix'][$databases['db_selected_index']]=$databases['praefix'][$index]; - else - $databases['praefix'][$databases['db_selected_index']]=''; - if (isset($databases['db_selected_index'])) $databases['db_selected_index']=$index; - else - $databases['db_selected_index']=0; - } - else - { - // keine DB vorhanden - $databases['praefix'][$databases['db_selected_index']]=''; - $databases['db_selected_index']=0; - $databases['db_actual']=''; - } + global $databases; + if (is_string($index)) { + // name given + $dbNames = array_flip($databases['Name']); + if (array_key_exists($index, $dbNames)) { + $index = $dbNames[$index]; + } + } + if (isset($databases['Name'][$index])) { + $databases['db_actual'] = $databases['Name'][$index]; + if (isset($databases['praefix'][$index])) { + $databases['praefix'][$databases['db_selected_index']] = $databases['praefix'][$index]; + } else { + $databases['praefix'][$databases['db_selected_index']] = ''; + } + if (isset($databases['db_selected_index'])) { + $databases['db_selected_index'] = $index; + } else { + $databases['db_selected_index'] = 0; + } + } else { + // keine DB vorhanden + $databases['praefix'][$databases['db_selected_index']] = ''; + $databases['db_selected_index'] = 0; + $databases['db_actual'] = ''; + } } function EmptyDB($dbn) { - global $config; - $t_sql=array(); - @mysql_query('SET FOREIGN_KEY_CHECKS=0'); - $res=mysql_query('SHOW TABLE STATUS FROM `'.$dbn.'`',$config['dbconnection']) or die('EmptyDB: '.mysql_error()); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) - { - if (substr(strtoupper($row['Comment']),0,4)=='VIEW') - { - $t_sql[]='DROP VIEW `'.$dbn.'``'.$row['Name'].'`'; - } - else - { - $t_sql[]='DROP TABLE `'.$dbn.'`.`'.$row['Name'].'`'; - } - } - if (sizeof($t_sql)>0) - { - for ($i=0; $i 0) { + for ($i = 0; $i < count($t_sql); $i++) { + $res = mysqli_query($GLOBALS["___mysqli_ston"], $t_sql[$i]) or die('EmptyDB-Error: ' . ((is_object( + $GLOBALS["___mysqli_ston"] + )) ? mysqli_error($GLOBALS["___mysqli_ston"]) + : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); + } + } + @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=1'); } function AutoDelete() { - global $del_files,$config,$lang,$out; - $out=''; - if ($config['max_backup_files']>0) - { - //Files einlesen - $dh=opendir($config['paths']['backup']); - $dbbackups=array(); - $files=array(); - - // Build assoc Array $db=>$timestamp=>$filenames - while (false!==($filename=readdir($dh))) - { - if ($filename!='.'&&$filename!='..'&&!is_dir($config['paths']['backup'].$filename)) - { - //statuszeile auslesen - if (substr($filename,-2)=='gz') - { - $fp=gzopen($config['paths']['backup'].$filename,'r'); - $sline=gzgets($fp,40960); - gzclose($fp); - } - else - { - $fp=fopen($config['paths']['backup'].$filename,'r'); - $sline=fgets($fp,500); - fclose($fp); - } - $statusline=ReadStatusline($sline); - if ($statusline['dbname']!='unknown') - { - $tabellenanzahl=($statusline['tables']==-1) ? '' : $statusline['tables']; - $eintraege=($statusline['records']==-1) ? '' : $statusline['records']; - $part=($statusline['part']=='MP_0'||$statusline['part']='') ? 0 : substr($statusline['part'],3); - $db_name=$statusline['dbname']; - $datum=substr($filename,strlen($db_name)+1); - $timestamp=substr($datum,0,16); - if (!isset($files[$db_name])) $files[$db_name]=array(); - if (!isset($files[$db_name][$timestamp])) $files[$db_name][$timestamp]=array(); - $files[$db_name][$timestamp][]=$filename; - } - } - } - $out=''; // stores output messages - // Backups pro DB und Timestamp ermitteln - foreach ($files as $db=>$val) - { - //echo "
DB ".$db." hat ".sizeof($val)." Backups."; - if (sizeof($val)>$config['max_backup_files']) - { - $db_files=$val; - krsort($db_files,SORT_STRING); - //now latest backupfiles are on top -> delete all files with greater index - $i=0; - foreach ($db_files as $timestamp=>$filenames) - { - if ($i>=$config['max_backup_files']) - { - // Backup too old -> delete files - foreach ($filenames as $f) - { - if ($out=='') $out.=$lang['L_FM_AUTODEL1'].'
'; - if (@unlink('./'.$config['paths']['backup'].$f)) - { - $out.=''.sprintf($lang['L_DELETE_FILE_SUCCESS'],$f).'
'; - } - else - { - $out.=$lang['L_ERROR'].': '.sprintf($lang['L_DELETE_FILE_ERROR'],$f).'
'; - } - } - } - $i++; - } - } - } - } - return $out; + global $del_files, $config, $lang, $out; + $out = ''; + if ($config['max_backup_files'] > 0) { + //Files einlesen + $dh = opendir($config['paths']['backup']); + $dbbackups = array(); + $files = array(); + + // Build assoc Array $db=>$timestamp=>$filenames + while (false !== ($filename = readdir($dh))) { + if ($filename != '.' && $filename != '..' && !is_dir($config['paths']['backup'] . $filename)) { + //statuszeile auslesen + if (substr($filename, -2) == 'gz') { + $fp = gzopen($config['paths']['backup'] . $filename, 'r'); + $sline = gzgets($fp, 40960); + gzclose($fp); + } else { + $fp = fopen($config['paths']['backup'] . $filename, 'r'); + $sline = fgets($fp, 500); + fclose($fp); + } + $statusline = ReadStatusline($sline); + if ($statusline['dbname'] != 'unknown') { + $tabellenanzahl = ($statusline['tables'] == -1) ? '' : $statusline['tables']; + $eintraege = ($statusline['records'] == -1) ? '' : $statusline['records']; + $part = ($statusline['part'] == 'MP_0' || $statusline['part'] = '') + ? 0 + : substr( + $statusline['part'], + 3 + ); + $db_name = $statusline['dbname']; + $datum = substr($filename, strlen($db_name) + 1); + $timestamp = substr($datum, 0, 16); + if (!isset($files[$db_name])) { + $files[$db_name] = array(); + } + if (!isset($files[$db_name][$timestamp])) { + $files[$db_name][$timestamp] = array(); + } + $files[$db_name][$timestamp][] = $filename; + } + } + } + $out = ''; // stores output messages + // Backups pro DB und Timestamp ermitteln + foreach ($files as $db => $val) { + //echo "
DB ".$db." hat ".sizeof($val)." Backups."; + if (sizeof($val) > $config['max_backup_files']) { + $db_files = $val; + krsort($db_files, SORT_STRING); + //now latest backupfiles are on top -> delete all files with greater index + $i = 0; + foreach ($db_files as $timestamp => $filenames) { + if ($i >= $config['max_backup_files']) { + // Backup too old -> delete files + foreach ($filenames as $f) { + if ($out == '') { + $out .= $lang['L_FM_AUTODEL1'] . '
'; + } + if (@unlink('./' . $config['paths']['backup'] . $f)) { + $out .= '' . sprintf($lang['L_DELETE_FILE_SUCCESS'], $f) + . '
'; + } else { + $out .= $lang['L_ERROR'] . ': ' . sprintf( + $lang['L_DELETE_FILE_ERROR'], + $f + ) . '
'; + } + } + } + $i++; + } + } + } + } + + return $out; } -function DeleteFile($files, $function='max') +function DeleteFile($files, $function = 'max') { - global $config,$lang; - $delfile=explode("|",$files); - $r='

'.$lang['L_FM_AUTODEL1'].'
'; - $r.=$delfile[3]."
"; - $part=$delfile[2]; - if ($part>0) - { - for ($i=$part; $i>0; $i--) - { - $delete=@unlink($config['paths']['backup'].$delfile[3]); - if ($delete) WriteLog("autodeleted ($function) '$delfile[3]'."); - } - } - else - { - WriteLog("autodeleted ($function) '$delfile[3]'."); - unlink($config['paths']['backup'].$delfile[3]); - } - $r.='

'; - return $r; + global $config, $lang; + $delfile = explode("|", $files); + $r = '

' . $lang['L_FM_AUTODEL1'] . '
'; + $r .= $delfile[3] . "
"; + $part = $delfile[2]; + if ($part > 0) { + for ($i = $part; $i > 0; $i--) { + $delete = @unlink($config['paths']['backup'] . $delfile[3]); + if ($delete) { + WriteLog("autodeleted ($function) '$delfile[3]'."); + } + } + } else { + WriteLog("autodeleted ($function) '$delfile[3]'."); + unlink($config['paths']['backup'] . $delfile[3]); + } + $r .= '

'; + + return $r; } function ReadStatusline($line) { - /*AUFBAU der Statuszeile: + /*AUFBAU der Statuszeile: -- Status:tabellenzahl:datensätze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:EXTINFO 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 $lang; - $statusline=Array(); - if ((substr($line,0,8)!="# Status"&&substr($line,0,9)!="-- Status")||substr($line,0,10)=='-- StatusC') - { - //Fremdfile - $statusline['tables']=-1; - $statusline['records']=-1; - $statusline['part']='MP_0'; - $statusline['dbname']='unknown'; - $statusline['script']=''; - $statusline['scriptversion']=''; - $statusline['comment']=''; - $statusline['mysqlversion']='unknown'; - $statusline['flags']='2222222'; - $statusline['sqlbefore']=''; - $statusline['sqlafter']=''; - $statusline['charset']='?'; - } - else - { - // MySQLDumper-File - Informationen extrahieren - $s=explode(':',$line); - if (count($s)<12) - { - //fehlenden Elemente auffüllen - $c=count($s); - array_pop($s); - for ($i=$c-1; $i<12; $i++) - { - $s[]=''; - } - } - $statusline['tables']=$s[1]; - $statusline['records']=$s[2]; - $statusline['part']=($s[3]==''||$s[3]=='MP_0') ? 'MP_0' : $s[3]; - $statusline['dbname']=$s[4]; - $statusline['script']=$s[5]; - $statusline['scriptversion']=$s[6]; - $statusline['comment']=$s[7]; - $statusline['mysqlversion']=$s[8]; - $statusline['flags']=$s[9]; - $statusline['sqlbefore']=$s[10]; - $statusline['sqlafter']=$s[11]; - if ((isset($s[12]))&&trim($s[12])!='EXTINFO') $statusline['charset']=$s[12]; - else - $statusline['charset']='?'; - } - - //flags zerlegen - if (strlen($statusline['flags'])<6) $statusline['flags']="2222222"; - $statusline['complete_inserts']=substr($statusline['flags'],0,1); - $statusline['extended_inserts']=substr($statusline['flags'],1,1); - $statusline['ignore_inserts']=substr($statusline['flags'],2,1); - $statusline['delayed_inserts']=substr($statusline['flags'],3,1); - $statusline['downgrade']=substr($statusline['flags'],4,1); - $statusline['lock_tables']=substr($statusline['flags'],5,1); - $statusline['optimize_tables']=substr($statusline['flags'],6,1); - return $statusline; + global $lang; + $statusline = Array(); + if ((substr($line, 0, 8) != "# Status" && substr($line, 0, 9) != "-- Status") + || substr($line, 0, 10) == '-- StatusC' + ) { + //Fremdfile + $statusline['tables'] = -1; + $statusline['records'] = -1; + $statusline['part'] = 'MP_0'; + $statusline['dbname'] = 'unknown'; + $statusline['script'] = ''; + $statusline['scriptversion'] = ''; + $statusline['comment'] = ''; + $statusline['mysqlversion'] = 'unknown'; + $statusline['flags'] = '2222222'; + $statusline['sqlbefore'] = ''; + $statusline['sqlafter'] = ''; + $statusline['charset'] = '?'; + } else { + // MySQLDumper-File - Informationen extrahieren + $s = explode(':', $line); + if (count($s) < 12) { + //fehlenden Elemente auffüllen + $c = count($s); + array_pop($s); + for ($i = $c - 1; $i < 12; $i++) { + $s[] = ''; + } + } + $statusline['tables'] = $s[1]; + $statusline['records'] = $s[2]; + $statusline['part'] = ($s[3] == '' || $s[3] == 'MP_0') ? 'MP_0' : $s[3]; + $statusline['dbname'] = $s[4]; + $statusline['script'] = $s[5]; + $statusline['scriptversion'] = $s[6]; + $statusline['comment'] = $s[7]; + $statusline['mysqlversion'] = $s[8]; + $statusline['flags'] = $s[9]; + $statusline['sqlbefore'] = $s[10]; + $statusline['sqlafter'] = $s[11]; + if ((isset($s[12])) && trim($s[12]) != 'EXTINFO') { + $statusline['charset'] = $s[12]; + } else { + $statusline['charset'] = '?'; + } + } + + //flags zerlegen + if (strlen($statusline['flags']) < 6) { + $statusline['flags'] = "2222222"; + } + $statusline['complete_inserts'] = substr($statusline['flags'], 0, 1); + $statusline['extended_inserts'] = substr($statusline['flags'], 1, 1); + $statusline['ignore_inserts'] = substr($statusline['flags'], 2, 1); + $statusline['delayed_inserts'] = substr($statusline['flags'], 3, 1); + $statusline['downgrade'] = substr($statusline['flags'], 4, 1); + $statusline['lock_tables'] = substr($statusline['flags'], 5, 1); + $statusline['optimize_tables'] = substr($statusline['flags'], 6, 1); + + return $statusline; } -function NextPart($s, $first=0, $keep_suffix=false) +function NextPart($s, $first = 0, $keep_suffix = false) { - $nf=explode('_',$s); - $i=array_search('part',$nf)+1; - $p=substr($nf[$i],0,strpos($nf[$i],'.')); - $ext=substr($nf[$i],strlen($p)); - if ($first==1) - { - $nf[$i]='1'.$ext; - } - else - { - $nf[$i]=++$p.$ext; - } - $filename=implode('_',$nf); - return $filename; + $nf = explode('_', $s); + $i = array_search('part', $nf) + 1; + $p = substr($nf[$i], 0, strpos($nf[$i], '.')); + $ext = substr($nf[$i], strlen($p)); + if ($first == 1) { + $nf[$i] = '1' . $ext; + } else { + $nf[$i] = ++$p . $ext; + } + $filename = implode('_', $nf); + + return $filename; } function zeit_format($t) { - global $lang; - $tt_m=floor($t/60); - $tt_s=$t-($tt_m*60); - if ($tt_m<1) return floor($tt_s).' '.$lang['L_SECONDS']; - else if ($tt_m==1) return '1 '.$lang['L_MINUTE'].' '.floor($tt_s).' '.$lang['L_SECONDS']; - else return $tt_m.' '.$lang['L_MINUTES'].' '.floor($tt_s).' '.$lang['L_SECONDS']; + global $lang; + $tt_m = floor($t / 60); + $tt_s = $t - ($tt_m * 60); + if ($tt_m < 1) { + return floor($tt_s) . ' ' . $lang['L_SECONDS']; + } else { + if ($tt_m == 1) { + return '1 ' . $lang['L_MINUTE'] . ' ' . floor($tt_s) . ' ' . $lang['L_SECONDS']; + } else { + return $tt_m . ' ' . $lang['L_MINUTES'] . ' ' . floor($tt_s) . ' ' . $lang['L_SECONDS']; + } + } } function TesteFTP($i) { - global $lang,$config; - if (!isset($config['ftp_timeout'][$i])) $config['ftp_timeout'][$i]=30; - $s=''; - if ($config['ftp_port'][$i]==''||$config['ftp_port'][$i]==0) $config['ftp_port'][$i]=21; - $pass=-1; - if (!extension_loaded("ftp")) - { - $s='
'.$lang['L_NOFTPPOSSIBLE'].''; - } - else - $pass=0; - - if ($pass==0) - { - if ($config['ftp_server'][$i]==''||$config['ftp_user'][$i]=='') - { - $s='
'.$lang['L_WRONGCONNECTIONPARS'].''; - } - else - $pass=1; - } - - if ($pass==1) - { - $s=$lang['L_CONNECT_TO'].' `'.$config['ftp_server'][$i].'` Port '.$config['ftp_port'][$i]; - - if ($config['ftp_useSSL'][$i]==0) - { - $conn_id=@ftp_connect($config['ftp_server'][$i],$config['ftp_port'][$i],$config['ftp_timeout'][$i]); - } - else - { - $conn_id=@ftp_ssl_connect($config['ftp_server'][$i],$config['ftp_port'][$i],$config['ftp_timeout'][$i]); - } - if ($conn_id) $login_result=@ftp_login($conn_id,$config['ftp_user'][$i],$config['ftp_pass'][$i]); - if (!$conn_id||(!$login_result)) - { - $s.='
'.$lang['L_CONN_NOT_POSSIBLE'].''; - } - else - { - $pass=2; - if ($config['ftp_mode'][$i]==1) ftp_pasv($conn_id,true); - } - } - - if ($pass==2) - { - $s.='
Login ok
'.$lang['L_CHANGEDIR'].' `'.$config['ftp_dir'][$i].'` '; - $dirc=@ftp_chdir($conn_id,$config['ftp_dir'][$i]); - if (!$dirc) - { - $s.='
'.$lang['L_CHANGEDIRERROR'].''; - } - else - { - $pass=3; - $s.=''.$lang['L_OK'].''; - } - @ftp_close($conn_id); - } - - if ($pass==3) $s.='
'.$lang['L_FTP_OK'].''; - return $s; + global $lang, $config; + if (!isset($config['ftp_timeout'][$i])) { + $config['ftp_timeout'][$i] = 30; + } + $s = ''; + if ($config['ftp_port'][$i] == '' || $config['ftp_port'][$i] == 0) { + $config['ftp_port'][$i] = 21; + } + $pass = -1; + if (!extension_loaded("ftp")) { + $s = '
' . $lang['L_NOFTPPOSSIBLE'] . ''; + } else { + $pass = 0; + } + + if ($pass == 0) { + if ($config['ftp_server'][$i] == '' || $config['ftp_user'][$i] == '') { + $s = '
' . $lang['L_WRONGCONNECTIONPARS'] . ''; + } else { + $pass = 1; + } + } + + if ($pass == 1) { + $s = $lang['L_CONNECT_TO'] . ' `' . $config['ftp_server'][$i] . '` Port ' . $config['ftp_port'][$i]; + + if ($config['ftp_useSSL'][$i] == 0) { + $conn_id = @ftp_connect($config['ftp_server'][$i], $config['ftp_port'][$i], $config['ftp_timeout'][$i]); + } else { + $conn_id = @ftp_ssl_connect($config['ftp_server'][$i], $config['ftp_port'][$i], $config['ftp_timeout'][$i]); + } + if ($conn_id) { + $login_result = @ftp_login($conn_id, $config['ftp_user'][$i], $config['ftp_pass'][$i]); + } + if (!$conn_id || (!$login_result)) { + $s .= '
' . $lang['L_CONN_NOT_POSSIBLE'] . ''; + } else { + $pass = 2; + if ($config['ftp_mode'][$i] == 1) { + ftp_pasv($conn_id, true); + } + } + } + + if ($pass == 2) { + $s .= '
Login ok
' . $lang['L_CHANGEDIR'] . ' `' . $config['ftp_dir'][$i] . '` '; + $dirc = @ftp_chdir($conn_id, $config['ftp_dir'][$i]); + if (!$dirc) { + $s .= '
' . $lang['L_CHANGEDIRERROR'] . ''; + } else { + $pass = 3; + $s .= '' . $lang['L_OK'] . ''; + } + @ftp_close($conn_id); + } + + if ($pass == 3) { + $s .= '
' . $lang['L_FTP_OK'] . ''; + } + + return $s; } -function Realpfad($p) +/** + * Get current MSD home path + * + * @return string + */ +function basePath() { - global $config; - $dir=dirname(__FILE__); - $dir=str_replace('inc','',$dir); - $dir=str_replace('\\','/',$dir); - $dir=str_replace('//','/',$dir); - if (substr($dir,-1)!='/') $dir.='/'; - return $dir; + $path= dirname(__FILE__) . '/../'; + if (function_exists('realpath')) { + $path = realpath($path) . '/'; + } + + return $path; } // liest die Dateiliste aller vorhanden Konfigurationsfiles function get_config_filelist() { - global $config; - $default=$config['config_file']; - clearstatcache(); - $dh=opendir($config['paths']['config']); - $r=""; - while (false!==($filename=readdir($dh))) - { - if ($filename!="."&&$filename!=".."&&!is_dir($config['paths']['config'].$filename)&&substr($filename,-9)==".conf.php") - { - $f=substr($filename,0,strlen($filename)-9); - $r.=''.$end."\n"; - } - elseif ($k=="radio") - { - $r.=$start.''; - $r.=''.$end."\n"; - } - $i++; - } - return $r; + global $config, $lang; + $default = $config['language']; + $dh = opendir($config['paths']['root'] . "language/"); + $r = ""; + $lang_files = array(); + while (false !== ($filename = readdir($dh))) { + if ($filename != "." && $filename != '.svn' && $filename != ".." && $filename != "flags" + && is_dir( + $config['paths']['root'] . "language/" . $filename + ) + ) { + $lang_files[$lang[$filename]] = $filename; + } + } + ksort($lang_files); + $i = 1; + foreach ($lang_files as $filename) { + if ($k == "op") { + $r .= $start . '' . $end . "\n"; + } elseif ($k == "radio") { + $r .= $start . ''; + $r .= '' . $end . "\n"; + } + $i++; + } + + return $r; } // detect language subdirs and add them to the global definition of $lang function GetLanguageArray() { - global $config,$lang; - $dh=opendir($config['paths']['root']."language/"); - unset($lang['languages']); - $lang['languages']=array(); - while (false!==($filename=readdir($dh))) - { - if ($filename!="."&&$filename!='.svn'&&$filename!=".."&&$filename!="flags"&&is_dir($config['paths']['root']."language/".$filename)) - { - $lang['languages'][]=$filename; - } - } + global $config, $lang; + $dh = opendir($config['paths']['root'] . "language/"); + unset($lang['languages']); + $lang['languages'] = array(); + while (false !== ($filename = readdir($dh))) { + if ($filename != "." && $filename != '.svn' && $filename != ".." && $filename != "flags" + && is_dir( + $config['paths']['root'] . "language/" . $filename + ) + ) { + $lang['languages'][] = $filename; + } + } } -function headline($title, $mainframe=1) +function headline($title, $mainframe = 1) { - global $config,$lang; - $s=''; - if ($config['interface_server_caption']==1) - { - if ($config['interface_server_caption_position']==$mainframe) - { - $s.='
'.$lang['L_SERVER'].': '.$_SERVER['SERVER_NAME'].'
'; - } - } - if ($mainframe==1) - { - $s.='
'.$title.'
'; - $s.='
'; - } - return $s; + global $config, $lang; + $s = ''; + if ($config['interface_server_caption'] == 1) { + if ($config['interface_server_caption_position'] == $mainframe) { + $s .= '
' . $lang['L_SERVER'] . ': ' . $_SERVER['SERVER_NAME'] . '
'; + } + } + if ($mainframe == 1) { + $s .= '
' . $title . '
'; + $s .= '
'; + } + + return $s; } -function PicCache($rpath='./') +function PicCache($rpath = './') { - global $BrowserIcon,$config; - - $t='
'; - - $dh=opendir($config['files']['iconpath']); - while (false!==($filename=readdir($dh))) - { - if ($filename!="."&&$filename!=".."&&!is_dir($config['files']['iconpath'].$filename)) - { - $t.=''."\n"; - } - } - $t.='
'; - return $t; + global $BrowserIcon, $config; + + $t = '
'; + + $dh = opendir($config['files']['iconpath']); + while (false !== ($filename = readdir($dh))) { + if ($filename != "." && $filename != ".." && !is_dir($config['files']['iconpath'] . $filename)) { + $t .= '' . "\n"; + } + } + $t .= '
'; + + return $t; } -function MSDHeader($kind=0) +function MSDHeader($kind = 0) { - global $config; - header('Pragma: no-cache'); - header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: -1"); // Datum in der Vergangenheit - header('Content-Type: text/html; charset=UTF-8'); - - //kind 0=main 1=menu - $r=''."\n\n\n"; - $r.=''."\n"; - $r.=''."\n"; - - $r.='MySqlDumper'."\n"; - $r.=''."\n"; - $r.=''."\n"; - $r.="\n'; - return $r; + global $config; + header('Pragma: no-cache'); + header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header("Expires: -1"); // Datum in der Vergangenheit + header('Content-Type: text/html; charset=UTF-8'); + + //kind 0=main 1=menu + $r = '' + . "\n\n\n"; + $r .= '' . "\n"; + $r .= '' . "\n"; + + $r .= 'MySqlDumper' . "\n"; + $r .= '' . "\n"; + $r .= '' . "\n"; + $r .= "\n'; + + return $r; } -function MSDFooter($rfoot='', $enddiv=1) +function MSDFooter($rfoot = '', $enddiv = 1) { - /* + /* global $config,$databases,$dump,$restore,$lang; if (isset($config['homepage'])) { @@ -889,313 +943,298 @@ function MSDFooter($rfoot='', $enddiv=1) } else */ - $f=''; - if ($enddiv==1) $f.='
'; - - $f.=$rfoot.''; - - return $f; + $f = ''; + if ($enddiv == 1) { + $f .= '
'; + } + + $f .= $rfoot . ''; + + return $f; } function save_bracket($str) { - // Wenn Klammer zu am Ende steht, diese behalten - $str=trim($str); - if (substr($str,-1)==')') $str=')'; - else - $str=''; - return $str; + // Wenn Klammer zu am Ende steht, diese behalten + $str = trim($str); + if (substr($str, -1) == ')') { + $str = ')'; + } else { + $str = ''; + } + + return $str; } -function DownGrade($s, $show=true) +function DownGrade($s, $show = true) { - $tmp=explode(",",$s); - //echo "
";print_r($tmp);echo "
"; - + $tmp = explode(",", $s); + //echo "
";print_r($tmp);echo "
"; - for ($i=0; $i'')&&!in_array($d,$databases['Name'])) - { - $databases['Name'][$index]=$d; - $databases['praefix'][$index]=''; - $databases['command_before_dump'][$index]=''; - $databases['command_after_dump'][$index]=''; - } - - // wenn Index==-1 -> keine Db gewählt -> DB 0 als aktuell setzen - if ($databases['db_selected_index']==-1) - { - $databases['db_selected_index']=0; - $databases['db_actual']=$databases['Name'][0]; - } - } - } + return $back; } /** * Convert all array elements to UTF-8 - * + * * @param $array + * * @return array */ function convert_to_utf8($obj) { - global $config; - $ret=$obj; - // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden, - // da die Webseite utf8-kodiert ist - if (!isset($config['mysql_can_change_encoding'])) get_sql_encodings(); - - if ($config['mysql_can_change_encoding']==false&&$config['mysql_standard_character_set']!='utf8') - { - if (is_array($obj)) - { - foreach ($obj as $key=>$val) - { - //echo "
Wandle " . $val . " nach "; - $obj[$key]=utf8_encode($val); - //echo $obj[$key]; - } - } - if (is_string($obj)) $obj=utf8_encode($obj); - $ret=$obj; - } - return $ret; + global $config; + $ret = $obj; + // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden, + // da die Webseite utf8-kodiert ist + if (!isset($config['mysql_can_change_encoding'])) { + get_sql_encodings(); + } + + if ($config['mysql_can_change_encoding'] == false && $config['mysql_standard_character_set'] != 'utf8') { + if (is_array($obj)) { + foreach ($obj as $key => $val) { + //echo "
Wandle " . $val . " nach "; + $obj[$key] = utf8_encode($val); + //echo $obj[$key]; + } + } + if (is_string($obj)) { + $obj = utf8_encode($obj); + } + $ret = $obj; + } + + return $ret; } /** * Convert all array elements to Latin1 - * + * * @param $array + * * @return array */ function convert_to_latin1($obj) { - global $config; - $ret=$obj; - // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden, - // da die Webseite utf8-kodiert ist - if ($config['mysql_can_change_encoding']==false&&$config['mysql_standard_character_set']!='utf8') - { - if (is_array($obj)) - { - foreach ($obj as $key=>$val) - { - $obj[$key]=utf8_decode($val); - } - } - if (is_string($obj)) $obj=utf8_decode($obj); - $ret=$obj; - } - return $ret; + global $config; + $ret = $obj; + // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden, + // da die Webseite utf8-kodiert ist + if ($config['mysql_can_change_encoding'] == false && $config['mysql_standard_character_set'] != 'utf8') { + if (is_array($obj)) { + foreach ($obj as $key => $val) { + $obj[$key] = utf8_decode($val); + } + } + if (is_string($obj)) { + $obj = utf8_decode($obj); + } + $ret = $obj; + } + + return $ret; } // returns the index of the selected val in an optionlist function get_index($arr, $selected) { - $ret=false; // return false if not found - foreach ($arr as $key=>$val) - { - if (strtolower(substr($val,0,strlen($selected)))==strtolower($selected)) - { - $ret=$key; - break; - } - } - return $ret; + $ret = false; // return false if not found + foreach ($arr as $key => $val) { + if (strtolower(substr($val, 0, strlen($selected))) == strtolower($selected)) { + $ret = $key; + break; + } + } + + return $ret; } /** * Check if config is readable - * + * * @param $file + * * @return boolean */ -function read_config($file=false) +function read_config($file = false) { - global $config,$databases; - $ret=false; - if (!$file) $file=$config['config_file']; - // protect from including external files - $search=array( + global $config, $databases; + $ret = false; + if (!$file) { + $file = $config['config_file']; + } + // protect from including external files + $search = array(':', 'http', 'ftp', ' '); + $replace = array('', '', '', ''); + $file = str_replace($search, $replace, $file); - ':', 'http', 'ftp', ' '); - $replace=array( + if (is_readable($config['paths']['config'] . $file . '.php')) { + // to prevent modern server from caching the new configuration we need to evaluate it this way + clearstatcache(); + $f = implode('', file($config['paths']['config'] . $file . '.php')); + $f = str_replace('', '', $f); + eval($f); + $config['config_file'] = $file; + $_SESSION['config_file'] = $config['config_file']; + $ret = true; + } - '', '', '', ''); - $file=str_replace($search,$replace,$file); - - if (is_readable($config['paths']['config'].$file.'.php')) - { - // to prevent modern server from caching the new configuration we need to evaluate it this way - clearstatcache(); - $f=implode('',file($config['paths']['config'].$file.'.php')); - $f=str_replace('','',$f); - eval($f); - $config['config_file']=$file; - $_SESSION['config_file']=$config['config_file']; - $ret=true; - } - return $ret; + return $ret; } /** * Get all work configurations from /work/config directory - * + * * @return array */ function get_config_filenames() { - global $config; - $configs=array(); - $dh=opendir($config['paths']['config']."/"); - while (false!==($filename=readdir($dh))) - { - if (substr($filename,-4)=='.php'&&substr($filename,-9)!='.conf.php'&&$filename!='dbs_manual.php') - { - $configs[]=substr($filename,0,-4); - } - } - return $configs; + global $config; + $configs = array(); + $dh = opendir($config['paths']['config'] . "/"); + while (false !== ($filename = readdir($dh))) { + if (substr($filename, -4) == '.php' && substr($filename, -9) != '.conf.php' && $filename != 'dbs_manual.php') { + $configs[] = substr($filename, 0, -4); + } + } + + return $configs; } -function table_output($text, $val, $small=false, $colspan=1) +function table_output($text, $val, $small = false, $colspan = 1) { - $ret=''; - $ret.='1) $ret.=' colspan="'.$colspan.'"'; - $ret.='>'.$text; - if ($colspan==1) $ret.=': '; - else - $ret.=' '; - if ($colspan==1) $ret.=''; - if ($small) $ret.=''.$val.''; - else - $ret.=''.$val.''; - return $ret; + $ret = ''; + $ret .= ' 1) { + $ret .= ' colspan="' . $colspan . '"'; + } + $ret .= '>' . $text; + if ($colspan == 1) { + $ret .= ': '; + } else { + $ret .= ' '; + } + if ($colspan == 1) { + $ret .= ''; + } + if ($small) { + $ret .= '' . $val . ''; + } else { + $ret .= '' . $val . ''; + } + + return $ret; } /** @@ -1203,155 +1242,182 @@ function table_output($text, $val, $small=false, $colspan=1) */ function get_sql_encodings() { - global $config; - unset($config['mysql_possible_character_sets']); - if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $erg=false; - $config['mysql_standard_character_set']=''; - $config['mysql_possible_character_sets']=array(); - - if (!defined('MSD_MYSQL_VERSION')) GetMySQLVersion(); - $v=explode('.',MSD_MYSQL_VERSION); - $config['mysql_can_change_encoding']=false; - if (($v[0]<=4&&$v[1]<1)||$v[0]<=3) - { - // MySQL < 4.1 - $config['mysql_can_change_encoding']=false; - $sqlt='SHOW VARIABLES LIKE \'character_set%\''; - $res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); - if ($res) - { - WHILE ($row=mysql_fetch_row($res)) - { - if ($row[0]=='character_set') - { - $config['mysql_standard_character_set']=$row[1]; - if ($v[0]==3) $config['mysql_possible_character_sets'][0]=$row[1]; - } - - if ($row[0]=='character_sets'&&$v[0]>3) - { - $config['mysql_possible_character_sets']=explode(' ',$row[1]); - sort($config['mysql_possible_character_sets']); - } - } - } - } - else - { - // MySQL-Version >= 4.1 - $config['mysql_can_change_encoding']=true; - $sqlt='SHOW CHARACTER SET'; - $res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); - - if ($res) - { - WHILE ($row=mysql_fetch_row($res)) - { - $config['mysql_possible_character_sets'][]=$row[0].' - '.$row[1]; - } - sort($config['mysql_possible_character_sets']); - } - - $sqlt='SHOW VARIABLES LIKE \'character_set_connection\''; - $res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); - - if ($res) - { - WHILE ($row=mysql_fetch_row($res)) - { - $config['mysql_standard_character_set']=$row[1]; - } - } - } + global $config; + unset($config['mysql_possible_character_sets']); + if (!isset($config['dbconnection'])) { + MSD_mysql_connect(); + } + $erg = false; + $config['mysql_standard_character_set'] = ''; + $config['mysql_possible_character_sets'] = array(); + + if (!defined('MSD_MYSQL_VERSION')) { + GetMySQLVersion(); + } + $v = explode('.', MSD_MYSQL_VERSION); + $config['mysql_can_change_encoding'] = false; + if (($v[0] <= 4 && $v[1] < 1) || $v[0] <= 3) { + // MySQL < 4.1 + $config['mysql_can_change_encoding'] = false; + $sqlt = 'SHOW VARIABLES LIKE \'character_set%\''; + $res = MSD_query($sqlt) or die(SQLError( + $sqlt, + ((is_object($GLOBALS["___mysqli_ston"])) + ? mysqli_error($GLOBALS["___mysqli_ston"]) + : (($___mysqli_res + = mysqli_connect_error()) ? $___mysqli_res : false)) + )); + if ($res) { + WHILE ($row = mysqli_fetch_row($res)) { + if ($row[0] == 'character_set') { + $config['mysql_standard_character_set'] = $row[1]; + if ($v[0] == 3) { + $config['mysql_possible_character_sets'][0] = $row[1]; + } + } + + if ($row[0] == 'character_sets' && $v[0] > 3) { + $config['mysql_possible_character_sets'] = explode(' ', $row[1]); + sort($config['mysql_possible_character_sets']); + } + } + } + } else { + // MySQL-Version >= 4.1 + $config['mysql_can_change_encoding'] = true; + $sqlt = 'SHOW CHARACTER SET'; + $res = MSD_query($sqlt) or die(SQLError( + $sqlt, + ((is_object($GLOBALS["___mysqli_ston"])) + ? mysqli_error($GLOBALS["___mysqli_ston"]) + : (($___mysqli_res + = mysqli_connect_error()) ? $___mysqli_res : false)) + )); + + if ($res) { + WHILE ($row = mysqli_fetch_row($res)) { + $config['mysql_possible_character_sets'][] = $row[0] . ' - ' . $row[1]; + } + sort($config['mysql_possible_character_sets']); + } + + $sqlt = 'SHOW VARIABLES LIKE \'character_set_connection\''; + $res = MSD_query($sqlt) or die(SQLError( + $sqlt, + ((is_object($GLOBALS["___mysqli_ston"])) + ? mysqli_error($GLOBALS["___mysqli_ston"]) + : (($___mysqli_res + = mysqli_connect_error()) ? $___mysqli_res : false)) + )); + + if ($res) { + WHILE ($row = mysqli_fetch_row($res)) { + $config['mysql_standard_character_set'] = $row[1]; + } + } + } } /** * Un-quotes a quoted string/array - * + * * @param $value + * * @return string/array */ function stripslashes_deep($value) { - $value=is_array($value) ? array_map('stripslashes_deep',$value) : stripslashes($value); - return $value; + $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); + + return $value; } /** * Remove whitespaces before and after an string or array - * + * * @param $value + * * @return string/array */ function trim_deep($value) { - $value=is_array($value) ? array_map('trim_deep',$value) : trim($value); - return $value; + $value = is_array($value) ? array_map('trim_deep', $value) : trim($value); + + return $value; } /** * load external source from given URL and save content locally - * + * * loads content from an external URL and saves it locally in $path with the name $local_file * return false on failure or true on success - * + * * @param $url * @param $file * @param local_file * @param $path + * * @return boolean */ -function fetchFileFromURL($url, $file, $local_path='./data/',$local_file) +function fetchFileFromURL($url, $file, $local_path = './data/', $local_file) { - $data=fetchFileDataFromURL($url.$file); - if ($data) - { - $d=fopen($local_path.$local_file,"wb"); - $ret=fwrite($d,$data); - fclose($d); - return $ret; - } - return false; + $data = fetchFileDataFromURL($url . $file); + if ($data) { + $d = fopen($local_path . $local_file, "wb"); + $ret = fwrite($d, $data); + fclose($d); + + return $ret; + } + + return false; } /** * Loads data from an external source via HTTP-socket - * + * * Loads data from an external source $url given as URL * and returns the content as a binary string or an empty string on failure - * - * @param $url + * + * @param $url + * * @return string file data */ function fetchFileDataFromURL($url) { - $url_parsed=parse_url($url); - $in=''; - - $host=$url_parsed['host']; - $port=isset($url_parsed['port']) ? intval($url_parsed['port']) : 80; - if ($port==0) $port=80; - $path=$url_parsed['path']; - if (isset($url_parsed['query'])&&$url_parsed['query']!='') $path.='?'.$url_parsed['query']; - - $fp=fsockopen($host,$port,$errno,$errstr,3); - if ($fp) - { - $out="GET $path HTTP/1.1\r\nHost: $host\r\n"; - $out.="Connection: close\r\n\r\n"; - fwrite($fp,$out); - $body=false; - while (!feof($fp)) - { - $s=fgets($fp,1024); - if ($body) $in.=$s; - if ($s=="\r\n") $body=true; - } - - fclose($fp); - } - return $in; + $url_parsed = parse_url($url); + $in = ''; + + $host = $url_parsed['host']; + $port = isset($url_parsed['port']) ? intval($url_parsed['port']) : 80; + if ($port == 0) { + $port = 80; + } + $path = $url_parsed['path']; + if (isset($url_parsed['query']) && $url_parsed['query'] != '') { + $path .= '?' . $url_parsed['query']; + } + + $fp = fsockopen($host, $port, $errno, $errstr, 3); + if ($fp) { + $out = "GET $path HTTP/1.1\r\nHost: $host\r\n"; + $out .= "Connection: close\r\n\r\n"; + fwrite($fp, $out); + $body = false; + while (!feof($fp)) { + $s = fgets($fp, 1024); + if ($body) { + $in .= $s; + } + if ($s == "\r\n") { + $body = true; + } + } + + fclose($fp); + } + + return $in; } -?> \ No newline at end of file +?> diff --git a/inc/functions_imexport.php b/inc/functions_imexport.php index 5834497..b8360df 100644 --- a/inc/functions_imexport.php +++ b/inc/functions_imexport.php @@ -38,12 +38,12 @@ function ExportCSV() $res=MSD_query($sqlt); if ($res) { - $numfields=mysql_numrows($res); + $numfields=mysqli_num_rows($res); if ($sql['export']['namefirstline'] == 1) { for ($feld=0; $feld < $numfields; $feld++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); if ($sql['export']['enc'] != "") $t.=$sql['export']['enc'] . $row[0] . $sql['export']['enc'] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' ); else $t.=$row[0] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' ); } @@ -55,10 +55,10 @@ function ExportCSV() $res=MSD_query($sqlt); if ($res) { - $numrows=mysql_numrows($res); + $numrows=mysqli_num_rows($res); for ($data=0; $data < $numrows; $data++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); for ($feld=0; $feld < $numfields; $feld++) { if (!isset($row[$feld]) || is_null($row[$feld])) @@ -145,7 +145,7 @@ function DoImport() if ($sql['import']['tablecreate'] == 0) { $res=MSD_query("show fields FROM " . $sql['import']['table']); - $tabellenfelder=mysql_num_rows($res); + $tabellenfelder=mysqli_num_rows($res); if ($importfelder != $tabellenfelder) { $r.='
' . sprintf($lang['L_CSV_FIELDCOUNT_NOMATCH'],$tabellenfelder,$importfelder); @@ -206,11 +206,11 @@ function ImportCreateTable() { global $sql,$lang,$db,$config; $tbl=Array(); - $tabellen=mysql_list_tables($db,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM `$db`"); + $num_tables=mysqli_num_rows($tabellen); for ($i=0; $i < $num_tables; $i++) { - $tbl[]=strtolower(mysql_tablename($tabellen,$i)); + $tbl[]=strtolower(((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false)); } $i=0; $sql['import']['table']=$sql['import']['table'] . $i; @@ -237,7 +237,7 @@ function ImportCreateTable() else $create=substr($create,0,strlen($create) - 2); $create.=') ' . ( ( MSD_NEW_VERSION ) ? 'ENGINE' : 'TYPE' ) . "=MyISAM COMMENT='imported at " . date("l dS of F Y H:i:s A") . "'"; - $res=mysql_query($create,$config['dbconnection']) || die(SQLError($create,mysql_error())); + $res=mysqli_query($config['dbconnection'], $create) || die(SQLError($create,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)))); return 1; } @@ -258,13 +258,13 @@ function ExportXML() $res=MSD_query($sqlt); if ($res) { - $numfields=mysql_num_rows($res); + $numfields=mysqli_num_rows($res); if ($sql['export']['xmlstructure'] == 1) { $t.=str_repeat($tab,$level++) . '' . "\n"; for ($feld=0; $feld < $numfields; $feld++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $t.=str_repeat($tab,$level++) . '' . "\n"; $t.=str_repeat($tab,$level) . '' . $row['Field'] . '' . "\n"; $t.=str_repeat($tab,$level) . '' . $row['Type'] . '' . "\n"; @@ -282,12 +282,12 @@ function ExportXML() $res=MSD_query($sqlt); if ($res) { - $numrows=mysql_numrows($res); + $numrows=mysqli_num_rows($res); for ($data=0; $data < $numrows; $data++) { $t.=str_repeat($tab,$level) . "\n"; $level++; - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); for ($feld=0; $feld < $numfields; $feld++) { $t.=str_repeat($tab,$level) . '' . $row[$feld] . '' . "\n"; @@ -336,10 +336,10 @@ function ExportHTML() { $field=$fieldname=$fieldtyp=Array(); $structure="\n"; - $numfields=mysql_numrows($res); + $numfields=mysqli_num_rows($res); for ($feld=0; $feld < $numfields; $feld++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $field[$feld]=$row[0]; if ($feld == 0) @@ -347,7 +347,7 @@ function ExportHTML() $structure.="\n"; for ($i=0; $i < count($row); $i++) { - $str=mysql_fetch_field($res,$i); + $str=(((($___mysqli_tmp = mysqli_fetch_field_direct($res, 0)) && is_object($___mysqli_tmp)) ? ( (!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && (!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && (!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && (!is_null($___mysqli_type = $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0)) ) : false ) ? $___mysqli_tmp : false); $fieldname[$i]=$str->name; $fieldtyp[$i]=$str->type; $structure.="\n"; @@ -369,7 +369,7 @@ function ExportHTML() $res=MSD_query($dsql); if ($res) { - $anz=mysql_num_rows($res); + $anz=mysqli_num_rows($res); $content.="

Daten ($anz Datensätze)

\n"; $content.="
" . $str->name . "
\n"; for ($feld=0; $feld < count($field); $feld++) @@ -386,7 +386,7 @@ function ExportHTML() } for ($d=0; $d < $anz; $d++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $content.="\n"; for ($i=0; $i < count($row); $i++) { diff --git a/inc/functions_restore.php b/inc/functions_restore.php index 140b29e..04bdc17 100644 --- a/inc/functions_restore.php +++ b/inc/functions_restore.php @@ -4,14 +4,14 @@ if (!defined('MSD_VERSION')) die('No direct access.'); 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']) { @@ -22,7 +22,7 @@ function get_sqlbefehl() // 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)); // pre-built compare strings - so we need the CPU power only once :) @@ -33,13 +33,13 @@ function get_sqlbefehl() $sub3=substr($sub4,0,3); $sub2=substr($sub3,0,2); $sub1=substr($sub2,0,1); - + if ($sub7=='INSERT ') { $sqlparser_status=3; //Datensatzaktion $restore['actual_table']=get_tablename($zeile); } - + //Einfache Anweisung finden die mit Semikolon beendet werden elseif ($sub7=='LOCK TA') $sqlparser_status=4; elseif ($sub6=='COMMIT') $sqlparser_status=7; @@ -52,20 +52,20 @@ function get_sqlbefehl() elseif ($sub9=='CREATE TA') $sqlparser_status=2; //Create Table elseif ($sub9=='CREATE AL') $sqlparser_status=2; //Create View elseif ($sub9=='CREATE IN') $sqlparser_status=4; //Indexaktion - + //Condition? elseif (($sqlparser_status!=5)&&(substr($zeile2,0,2)=='/*')) $sqlparser_status=6; - + // Delete actions elseif ($sub9=='DROP TABL') $sqlparser_status=1; elseif ($sub9=='DROP VIEW') $sqlparser_status=1; - + // Befehle, die nicht ausgeführt werden sollen - elseif ($sub9=='CREATE DA ') $sqlparser_status=7; + elseif ($sub9=='CREATE DA') $sqlparser_status=7; elseif ($sub9=='DROP DATA ') $sqlparser_status=7; elseif ($sub3=='USE') $sqlparser_status=7; - + // Am Ende eines MySQLDumper-Backups angelangt? elseif ($sub6=='-- EOB'||$sub4=='# EO') { @@ -75,7 +75,7 @@ function get_sqlbefehl() $zeile2=''; $sqlparser_status=100; } - + // Kommentar? elseif ($sub2=='--'|| $sub1=='#') { @@ -83,10 +83,10 @@ function get_sqlbefehl() $zeile2=''; $sqlparser_status=0; } - + // Fortsetzung von erweiterten Inserts if ($restore['flag']==1) $sqlparser_status=3; - + if (($sqlparser_status==0)&&(trim($complete_sql)>'')&&($restore['flag']==-1)) { // Unbekannten Befehl entdeckt @@ -97,12 +97,12 @@ function get_sqlbefehl() } /******************* 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==3) { //INSERT @@ -110,19 +110,19 @@ function get_sqlbefehl() { $sqlparser_status=100; $complete_sql=trim($complete_sql); - if (substr($complete_sql,-2)=='*/') + if (substr($complete_sql,-2)=='*/') { $complete_sql=remove_comment_at_eol($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 - else + else if (substr($complete_sql,-2)=='),') { // letztes Komme gegen Semikolon tauschen @@ -130,7 +130,7 @@ function get_sqlbefehl() $restore['erweiterte_inserts']=1; $restore['flag']=1; } - + if (substr(strtoupper($complete_sql),0,7)!='INSERT ') { // wenn der Syntax aufgrund eines Reloads verloren ging - neu ermitteln @@ -147,16 +147,16 @@ function get_sqlbefehl() } } } - - else + + else if ($sqlparser_status==1) { //Löschaktion if ($last_char==';') $sqlparser_status=100; //Befehl komplett $restore['actual_table']=get_tablename($complete_sql); } - - else + + else if ($sqlparser_status==2) { // Createanweisung ist beim Finden eines ; beendet @@ -184,9 +184,9 @@ function get_sqlbefehl() $sqlparser_status=0; } } - + // Index - else + else if ($sqlparser_status==4) { //Createindex if ($last_char==';') @@ -199,9 +199,9 @@ function get_sqlbefehl() $sqlparser_status=100; } } - + // Kommentar oder Condition - else + else if ($sqlparser_status==5) { //Anweisung $t=strrpos($zeile,'*/;'); @@ -209,11 +209,17 @@ function get_sqlbefehl() { $restore['anzahl_zeilen']=$config['minspeed']; $sqlparser_status=100; + if ($config['ignore_enable_keys'] && + strrpos($zeile, 'ENABLE KEYS ') !== false) + { + $sqlparser_status=100; + $complete_sql = ''; + } } } - + // Mehrzeiliger oder Inline-Kommentar - else + else if ($sqlparser_status==6) { $t=strrpos($zeile,'*/'); @@ -223,9 +229,9 @@ function get_sqlbefehl() $sqlparser_status=0; } } - + // Befehle, die verworfen werden sollen - else + else if ($sqlparser_status==7) { //Anweisung if ($last_char==';') @@ -238,7 +244,7 @@ function get_sqlbefehl() $sqlparser_status=0; } } - + if (($restore['compressed'])&&(gzeof($restore['filehandle']))) $restore['fileEOF']=true; if ((!$restore['compressed'])&&(feof($restore['filehandle']))) $restore['fileEOF']=true; } @@ -269,24 +275,24 @@ function submit_create_action($sql) } } } - - $res=@mysql_query($sql); + + $res=@mysqli_query($GLOBALS["___mysqli_ston"], $sql); if ($res===false) { // erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht? $sql=del_inline_comments($sql); - $res=@mysql_query(downgrade($sql)); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); if ($res===false) { - // wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x? + // wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x? // versuchen wir es mal mit der alten Syntax - $res=@mysql_query(downgrade($sql)); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); } } if ($res===false) { // wenn wir hier angekommen sind hat nichts geklappt -> Fehler ausgeben und abbrechen - SQLError($sql,mysql_error()); + SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); die("
Fatal error: Couldn't create table or view `".$tablename."´"); } return $tablename; @@ -296,11 +302,11 @@ function get_insert_syntax($table) { $insert=''; $sql='SHOW COLUMNS FROM `'.$table.'`'; - $res=mysql_query($sql); + $res=mysqli_query($GLOBALS["___mysqli_ston"], $sql); if ($res) { $insert='INSERT INTO `'.$table.'` ('; - while ($row=mysql_fetch_object($res)) + while ($row=mysqli_fetch_object($res)) { $insert.='`'.$row->Field.'`,'; } @@ -310,7 +316,7 @@ function get_insert_syntax($table) { global $restore; v($restore); - SQLError($sql,mysql_error()); + SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); } return $insert; } @@ -350,7 +356,7 @@ function get_tablename($t) } $t=str_ireplace(';',' ;',$t); // tricky -> insert space as delimiter $t=trim($t); - + // jetzt einfach nach dem ersten Leerzeichen suchen $delimiter=substr($t,0,1); if ($delimiter!='`') $delimiter=' '; diff --git a/inc/functions_sql.php b/inc/functions_sql.php index 8b808ea..b74693a 100644 --- a/inc/functions_sql.php +++ b/inc/functions_sql.php @@ -18,7 +18,7 @@ function ReadSQL() fclose($fp); @chmod($sf,0777); } - if (count($SQL_ARRAY) == 0 && filesize($sf) > 0) + if ((!is_array($SQL_ARRAY) || count($SQL_ARRAY) == 0) && filesize($sf) > 0) { $SQL_ARRAY=file($sf); } @@ -63,7 +63,7 @@ function SQL_ComboBox() { global $SQL_ARRAY,$tablename,$nl; $s=''; - if (count($SQL_ARRAY) > 0) + if (is_array($SQL_ARRAY) && count($SQL_ARRAY) > 0) { $s=$nl . $nl . '' . $nl . '' . $nl; for ($i=0; $i < $num_tables; $i++) { - $t=mysql_fetch_row($tabellen); + $t=mysqli_fetch_row($tabellen); $s.='' . $nl; } $s.='' . $nl . $nl; @@ -94,12 +97,12 @@ function Table_ComboBox() function TableComboBox($default='') { global $db,$config,$lang,$nl; - $tabellen=mysql_list_tables($db,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM `$db`"); + $num_tables=mysqli_num_rows($tabellen); $s='' . $nl; for ($i=0; $i < $num_tables; $i++) { - $t=mysql_tablename($tabellen,$i); + $t=((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false); $s.='' . $nl; } return $s; @@ -110,8 +113,8 @@ 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)) + $dbs=(($___mysqli_tmp = mysqli_query($config['dbconnection'], "SHOW DATABASES")) ? $___mysqli_tmp : false); + while ($row=mysqli_fetch_object($dbs)) { if (strtolower($row->Database) == strtolower($db)) { @@ -131,7 +134,7 @@ function Table_Exists($db, $table) if ($res) { $tables=array(); - WHILE ($row=mysql_fetch_row($res)) + WHILE ($row=mysqli_fetch_row($res)) { $tables[]=$row[0]; } @@ -143,7 +146,7 @@ function Table_Exists($db, $table) function DB_Empty($dbn) { $r="DROP DATABASE `$dbn`;\nCREATE DATABASE `$dbn`;"; - MSD_DoSQL($r); + return MSD_DoSQL($r); } @@ -195,25 +198,38 @@ 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"; + if (!DB_Exists($destination)) + { + $res = MSD_DoSQL("CREATE DATABASE `$destination`;"); + if (!$res) + { + return false; + } + } $SQL_Array.="USE `$destination` ;\n"; - $tabellen=mysql_list_tables($source,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM `$source`"); + $num_tables=mysqli_num_rows($tabellen); for ($i=0; $i < $num_tables; $i++) { - $table=mysql_tablename($tabellen,$i); + $table=((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false); $sqlt="SHOW CREATE TABLE `$source`.`$table`"; $res=MSD_query($sqlt); - $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 ($res) + { + $row=mysqli_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"; + } + else + { + return false; + } } - if ($drop_source == 1) $SQL_Array.="DROP DATABASE `$source` ;"; - - mysql_select_db($destination); - MSD_DoSQL($SQL_Array); - + mysqli_select_db($GLOBALS["___mysqli_ston"], $destination); + $res=MSD_DoSQL($SQL_Array); + if ($drop_source == 1 && $res) MSD_query("DROP DATABASE `$source`;"); + return $res; } function Table_Copy($source, $destination, $insert_data, $destinationdb="") @@ -223,7 +239,7 @@ function Table_Copy($source, $destination, $insert_data, $destinationdb="") $SQL_Array=$t=""; $sqlc="SHOW CREATE TABLE $source"; $res=MSD_query($sqlc); - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $c=$row[1]; $a1=strpos($c,"`"); $a2=strpos($c,"`",$a1 + 1); @@ -258,6 +274,7 @@ function MSD_DoSQL($sqlcommands, $limit="") } else { + $result = true; for ($i=0; $i < $sql_queries; $i++) { $allSQL[$i]=trim(rtrim($allSQL[$i])); @@ -271,13 +288,14 @@ function MSD_DoSQL($sqlcommands, $limit="") //sql complete $sql['parser']['sql_commands']++; $out.=Stringformat(( $sql['parser']['sql_commands'] ),4) . ': ' . $sqlcommand . "\n"; - $result=MSD_query($sqlcommand); + $result=$result && MSD_query($sqlcommand); $sqlcommand=""; } } } } $sql['parser']['time_used']=getmicrotime() - $sql['parser']['time_used']; + return $result; } function SQLParser($command, $debug=0) @@ -444,11 +462,11 @@ function SQLOutput($sqlcommand, $meldung='') { global $sql,$lang; $s='
' . $lang['L_SQL_OUTPUT'] . '
'; - if ($meldung != '') $s.=$meldung; + if ($meldung != '') $s.=trim($meldung); if (isset($sql['parser']['sql_commands'])) { - $s.='' . $sql['parser']['sql_commands'] . '' . $lang['L_SQL_COMMANDS_IN'] . round($sql['parser']['time_used'],4) . $lang['L_SQL_COMMANDS_IN2'] . '

'; + $s.=' ' . $sql['parser']['sql_commands'] . '' . $lang['L_SQL_COMMANDS_IN'] . round($sql['parser']['time_used'],4) . $lang['L_SQL_COMMANDS_IN2'] . '

'; $s.=$lang['L_SQL_OUT1'] . '' . $sql['parser']['drop'] . ' DROP-, '; $s.='' . $sql['parser']['create'] . ' CREATE-, '; $s.='' . $sql['parser']['insert'] . ' INSERT-, '; @@ -465,16 +483,16 @@ function GetCreateTable($db, $tabelle) { global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $res=mysql_query("SHOW CREATE TABLE `$db`.`$tabelle`"); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW CREATE TABLE `$db`.`$tabelle`"); if ($res) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); if (isset($row['Create Table'])) return $row['Create Table']; elseif (isset($row['Create View'])) return $row['Create View']; else return false; } else - return mysql_error(); + return ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); } @@ -512,10 +530,10 @@ function correct_post_index($index) $index=str_replace('.','_',$index); return $index; } -function ComboCommandDump($when, $index) +function ComboCommandDump($when, $index, $disabled = '') { global $SQL_ARRAY,$nl,$databases,$lang; - if (count($SQL_ARRAY) == 0) + if (!is_array($SQL_ARRAY) || count($SQL_ARRAY) == 0) { $r='' . $lang['L_SQL_BEFEHLE'] . ''; if ($when == 0) $r.=''; @@ -525,12 +543,14 @@ function ComboCommandDump($when, $index) { if ($when == 0) { - $r=''; $csql=$databases['command_before_dump'][$index]; } else { - $r=''; $csql=$databases['command_after_dump'][$index]; } @@ -567,11 +587,11 @@ function EngineCombo($default="") } else { - $res=mysql_query("SHOW ENGINES"); - $num=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW ENGINES"); + $num=mysqli_num_rows($res); for ($i=0; $i < $num; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $r.=''; } } @@ -588,13 +608,13 @@ function CharsetCombo($default="") else { if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $res=mysql_query("SHOW Charset"); - $num=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Charset"); + $num=mysqli_num_rows($res); $r=''; $charsets=array(); for ($i=0; $i < $num; $i++) { - $charsets[]=mysql_fetch_array($res); + $charsets[]=mysqli_fetch_array($res); } if (is_array($charsets)) @@ -614,14 +634,14 @@ function GetCollationArray() global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $res=mysql_query("SHOW Collation"); - $num=@mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Collation"); + $num=@mysqli_num_rows($res); $r=Array(); if (is_array($r)) { for ($i=0; $i < $num; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $r[$i]['Collation']=isset($row['Collation']) ? $row['Collation'] : ''; $r[$i]['Charset']=isset($row['Charset']) ? $row['Charset'] : ''; $r[$i]['Id']=isset($row['Id']) ? $row['Id'] : ''; @@ -715,7 +735,7 @@ function ExtractTablenameFromSQL($q) if (strlen($q) > 100) $q=substr($q,0,100); $p=trim($q); // if we get a list of tables - no current table is selected -> return '' - if (strtoupper(substr($q,0,17)) == 'SHOW TABLE STATUS') return ''; + if (strtoupper(substr($p,0,17)) == 'SHOW TABLE STATUS') return ''; // check for SELECT-Statement to extract tablename after FROM if (strtoupper(substr($p,0,7)) == 'SELECT ') { @@ -724,8 +744,11 @@ function ExtractTablenameFromSQL($q) $parts=explode(' ',$p); $p=$parts[0]; } + // remove keyword DATABASES and the database name after that + $p = preg_replace('/DATABASE [`]*\w+[`]*/i', '', $p); + // remove other keywords $suchen=array( - + 'SHOW DATABASES', 'SHOW ', 'SELECT', 'DROP', @@ -739,7 +762,7 @@ function ExtractTablenameFromSQL($q) '*' ); $ersetzen=array( - + '', '', '', '', @@ -817,7 +840,7 @@ function getFieldinfos($db, $tabelle) $t=GetCreateTable($db,$tabelle); $sqlf="SHOW FULL FIELDS FROM `$db`.`$tabelle`;"; $res=MSD_query($sqlf); - $anz_fields=mysql_num_rows($res); + $anz_fields=mysqli_num_rows($res); $fields_infos['_primarykeys_']=array(); $fields_infos['_key_']=array(); @@ -844,7 +867,7 @@ function getFieldinfos($db, $tabelle) $fields_infos[$i]['type']=''; $fields_infos[$i]['privileges']=''; - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); if (isset($row['Collation'])) $fields_infos[$i]['collate']=$row['Collation']; if (isset($row['COLLATE'])) $fields_infos[$i]['collate']=$row['COLLATE']; // MySQL <4.1 @@ -875,12 +898,13 @@ function getFieldinfos($db, $tabelle) // now get key definitions of the table and add info to fields $sql='SHOW KEYS FROM `' . $db . '`.`' . $tabelle . '`'; $res=MSD_query($sql); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //v($row); $key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; $index_type=isset($row['Index_type']) ? $row['Index_type'] : ''; $column_name=isset($row['Column_name']) ? $row['Column_name'] : ''; + $non_unique=isset($row['Non_unique']) ? $row['Non_unique'] : ''; if ($column_name > '') { // first find indexnr of field @@ -888,7 +912,14 @@ function getFieldinfos($db, $tabelle) { if ($fields_infos[$index]['name'] == $column_name) break; } - if ($key_name == 'PRIMARY') $fields_infos['_primarykeys_'][]=$column_name; + if ($key_name == 'PRIMARY') + $fields_infos['_primarykeys_'][]=$column_name; + elseif ($index_type == 'FULLTEXT') + $fields_infos['_fulltextkey_'][]=$column_name; + elseif ($non_unique == 0) + $fields_infos['_uniquekey_'][]=$column_name; + else + $fields_infos['_key_'][]=$column_name; } } //v($fields_infos); @@ -916,12 +947,12 @@ function getExtendedFieldInfo($db, $table) $t=GetCreateTable($db,$table); $sqlf="SHOW FULL FIELDS FROM `$db`.`$table`;"; $res=MSD_query($sqlf); - $num_fields=mysql_num_rows($res); + $num_fields=mysqli_num_rows($res); $f=array(); //will hold all info for ($x=0; $x < $num_fields; $x++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); $i=$row['Field']; // define name of field as index of array //define field defaults - this way the index of the array is defined anyway @@ -966,7 +997,7 @@ function getExtendedFieldInfo($db, $table) // now get key definitions of the table and add info to field-array $sql='SHOW KEYS FROM `' . $db . '`.`' . $table . '`'; $res=MSD_query($sql); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //echo "
Keys of $table: ";v($row); $key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; @@ -1029,9 +1060,9 @@ function build_where_from_record($data) { $val=str_replace('','',$val); $val=str_replace('','',$val); - $ret.='`' . $key . '`="' . addslashes($val) . '"|'; + $ret.='`' . $key . '`="' . addslashes($val) . '" AND '; } - $ret=substr($ret,0,-1); + $ret=substr($ret,0,-5); return $ret; } @@ -1046,11 +1077,20 @@ function getPrimaryKeys($db, $table) $keys=Array(); $sqlk="SHOW KEYS FROM `" . $db . "`.`" . $table . "`;"; $res=MSD_query($sqlk); - while ($row=mysql_fetch_array($res)) + while ($row=mysqli_fetch_array($res)) { //wenn Primaerschluessel - if ($row['Key_name'] == "PRIMARY") $keys[]=$row['Column_name']; + if ($row['Key_name'] == "PRIMARY") $keys['name'][]=$row['Column_name']; + if ($row['Sub_part'] != null) + { + $keys['size'][]=$row['Sub_part']; + } + else + { + $keys['size'][]=''; + } } + return $keys; } @@ -1065,7 +1105,7 @@ function getAllFields($db, $table) $fields=Array(); $sqlk="DESCRIBE `" . $db . "`.`" . $table . "`;"; $res=MSD_query($sqlk); - while ($row=mysql_fetch_array($res)) + while ($row=mysqli_fetch_array($res)) { $fields[]=$row['Field']; } @@ -1078,20 +1118,67 @@ function getAllFields($db, $table) * OUTPUT: true/false * Author: DH */ -function setNewPrimaryKeys($db, $table, $newKeys) +function setNewPrimaryKeys($db, $table, $newKeys, $indexSizes) { - $sqlSetNewPrimaryKeys="ALTER TABLE `" . $db . "`.`" . $table . "` DROP PRIMARY KEY"; - //wenn min. 1 Schluessel im Array, sonst nur loeschen + $sqlSetNewPrimaryKeys="ALTER TABLE `" . $db . "`.`" . $table . "`"; + //wenn es Primaerschluessel gibt, diese loeschen + $existingKeys = getPrimaryKeys($db, $table); + if (count($existingKeys) > 0) + { + $sqlSetNewPrimaryKeys.=" DROP PRIMARY KEY"; + } + //wenn min. 1 Schluessel im Array, sonst nur loeschen if (count($newKeys) > 0) { - $sqlSetNewPrimaryKeys.=", - ADD PRIMARY KEY (`" . implode("`,`",$newKeys) . "`)"; + if (count($existingKeys) > 0) + { + $sqlSetNewPrimaryKeys.=", "; + } + $sqlSetNewPrimaryKeys.=" ADD PRIMARY KEY ("; + foreach ($newKeys as $id => $name) + { + if ($id > 0) $sqlSetNewPrimaryKeys.=", "; + $sqlSetNewPrimaryKeys.="`" . $name . "`"; + if ($indexSizes[$id]) { + $sqlSetNewPrimaryKeys.=" (" . $indexSizes[$id] . ")"; + } + } + $sqlSetNewPrimaryKeys.=")"; } $sqlSetNewPrimaryKeys.=";"; $res=MSD_query($sqlSetNewPrimaryKeys); return $res; } +function setNewKeys($db, $table, $newKeys, $indexType, $indexName, $indexSizes) +{ + $sqlSetNewKeys="ALTER TABLE `" . $db . "`.`" . $table . "` "; + $sqlSetNewKeys.="ADD ".$indexType." "; + if ($indexName) + { + $sqlSetNewKeys.="`" . $indexName ."` "; + } + $sqlSetNewKeys.="("; + foreach ($newKeys as $id => $name) + { + if ($id > 0) $sqlSetNewKeys.=", "; + $sqlSetNewKeys.="`" . $name . "`"; + if ($indexSizes[$id]) { + $sqlSetNewKeys.=" (" . $indexSizes[$id] . ")"; + } + } + $sqlSetNewKeys.=");"; + $res=MSD_query($sqlSetNewKeys); + return $res; +} + +function killKey($db, $table, $indexName) +{ + $sqlKillKey = "ALTER TABLE `".$db."`.`".$table."` DROP INDEX `".$indexName."`"; + $res=MSD_query($sqlKillKey); + return $res; +} + function get_output_attribut_null($null) { global $lang; diff --git a/inc/header.php b/inc/header.php index 9d4c702..06b0314 100644 --- a/inc/header.php +++ b/inc/header.php @@ -1,25 +1,32 @@ '.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_DELETED'].'

'; SetDefault(); include ($config['files']['parameter']); @@ -23,16 +23,16 @@ for ($i=0; $i"") { $query="OPTIMIZE TABLE ".$tabellen; - $res=mysql_query($query) or die(mysql_error().""); + $res=mysqli_query($GLOBALS["___mysqli_ston"], $query) or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)).""); } $_GET['dbid']=$i; $dba='

'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_OPTIMIZED'].'.

'; @@ -43,6 +43,10 @@ for ($i=0; $iassign_block_vars('DB_NOT_FOUND',array( - 'ROWCLASS' => $rowclass, - 'NR' => ($i+1), - 'DB_NAME' => $databases['Name'][$i], + 'ROWCLASS' => $rowclass, + 'NR' => ($i+1), + 'DB_NAME' => $databases['Name'][$i], 'DB_ID' => $i)); } else { - mysql_select_db($databases['Name'][$i],$config['dbconnection']); - $tabellen=mysql_query('SHOW TABLES FROM `'.$databases['Name'][$i].'`',$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + mysqli_select_db($config['dbconnection'], $databases['Name'][$i]); + $tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`'); + $num_tables=mysqli_num_rows($tabellen); $tpl->assign_block_vars('ROW',array( - 'ROWCLASS' => $rowclass, - 'NR' => ($i+1), - 'DB_NAME' => $databases['Name'][$i], - 'DB_ID' => $i, + 'ROWCLASS' => $rowclass, + 'NR' => ($i+1), + 'DB_NAME' => $databases['Name'][$i], + 'DB_ID' => $i, 'TABLE_COUNT' => $num_tables)); if ($num_tables==1) $tpl->assign_block_vars('ROW.TABLE',array()); else @@ -88,21 +92,23 @@ $tpl->pparse('show'); //list tables of selected database if (isset($_GET['dbid'])) { - // Output list of tables of the selected database + $disabled_keys_found = false; + + // Output list of tables of the selected database $tpl=new MSDTemplate(); $tpl->set_filenames(array( 'show' => 'tpl/home/databases_list_tables.tpl')); $dbid=$_GET['dbid']; - + $numrows=0; - $res=@mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`"); - mysql_select_db($databases['Name'][$dbid]); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`"); + mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['Name'][$dbid]); + if ($res) $numrows=mysqli_num_rows($res); $tpl->assign_vars(array( - 'DB_NAME' => $databases['Name'][$dbid], - 'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]), - 'DB_ID' => $dbid, - 'TABLE_COUNT' => $numrows, + 'DB_NAME' => $databases['Name'][$dbid], + 'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]), + 'DB_ID' => $dbid, + 'TABLE_COUNT' => $numrows, 'ICONPATH' => $config['files']['iconpath'])); $numrows=intval($numrows); if ($numrows>1) $tpl->assign_block_vars('MORE_TABLES',array()); @@ -114,10 +120,10 @@ if (isset($_GET['dbid'])) $sum_records=$sum_data_length=''; for ($i=0; $i<$numrows; $i++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); // 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'][$dbid]."`.`".$row['Name']."`"; - $res2=@mysql_query($sql_2); + $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2); if ($res2===false) { $row['Rows']=0; @@ -125,44 +131,48 @@ if (isset($_GET['dbid'])) } else { - $row2=mysql_fetch_array($res2); + $row2=mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; $rowclass=($i%2) ? 'dbrow' : 'dbrow1'; } - + if (isset($row['Update_time'])&&strtotime($row['Update_time'])>strtotime($last_update)) $last_update=$row['Update_time']; $sum_records+=$row['Rows']; $sum_data_length+=$row['Data_length']+$row['Index_length']; - - $tpl->assign_block_vars('ROW',array( - 'ROWCLASS' => $rowclass, - 'NR' => ($i+1), - 'TABLE_NAME' => $row['Name'], - 'TABLE_NAME_URLENCODED' => urlencode($row['Name']), - 'RECORDS' => $row['Rows'], - 'SIZE' => byte_output($row['Data_length']+$row['Index_length']), - 'LAST_UPDATE' => $row['Update_time'], - 'ENGINE' => $row['Engine'])); - + + $keys_disabled = false; + if ($row['Engine'] == "MyIsam") { + } + $tpl->assign_block_vars('ROW',array( + 'ROWCLASS' => $rowclass, + 'NR' => ($i+1), + 'TABLE_NAME' => $row['Name'], + 'TABLE_NAME_URLENCODED' => urlencode($row['Name']), + 'RECORDS' => $row['Rows'], + 'SIZE' => byte_output($row['Data_length']+$row['Index_length']), + 'LAST_UPDATE' => $row['Update_time'], + 'ENGINE' => $row['Engine'], + )); + // Otimize & Repair - only for MyISAM-Tables if ($row['Engine']=='MyISAM') { if ($row['Data_free']==0) $tpl->assign_block_vars('ROW.OPTIMIZED',array()); else $tpl->assign_block_vars('ROW.NOT_OPTIMIZED',array()); - + if ($checkit==$row['Name']||$repair==1) { - $tmp_res=mysql_query("REPAIR TABLE `".$row['Name']."`"); + $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], "REPAIR TABLE `".$row['Name']."`"); } - + if (($checkit==$row['Name']||$checkit=='ALL')) { // table needs to be checked - $tmp_res=mysql_query('CHECK TABLE `'.$row['Name'].'`'); + $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], 'CHECK TABLE `'.$row['Name'].'`'); if ($tmp_res) { - $tmp_row=mysql_fetch_row($tmp_res); + $tmp_row=mysqli_fetch_row($tmp_res); if ($tmp_row[3]=='OK') $tpl->assign_block_vars('ROW.CHECK_TABLE_OK',array()); else $tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array()); @@ -173,14 +183,31 @@ if (isset($_GET['dbid'])) // Show Check table link $tpl->assign_block_vars('ROW.CHECK_TABLE',array()); } + if ($enableKeys==$row['Name'] || $enableKeys=="ALL") + { + $sSql= "ALTER TABLE `".$databases['Name'][$dbid]."`.`".$row['Name']."` ENABLE KEYS"; + $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], $sSql); + } + $res3=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`"); + WHILE ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC)) + { + if ($row3['Comment']=="disabled") { + $keys_disabled = true; + $disabled_keys_found = true; + } + } + if ($keys_disabled) $tpl->assign_block_vars('ROW.KEYS_DISABLED', array()); + else $tpl->assign_block_vars('ROW.KEYS_ENABLED', array()); } - + } // Output sum-row $tpl->assign_block_vars('SUM',array( - 'RECORDS' => number_format($sum_records,0,",","."), - 'SIZE' => byte_output($sum_data_length), + 'RECORDS' => number_format($sum_records,0,",","."), + 'SIZE' => byte_output($sum_data_length), 'LAST_UPDATE' => $last_update)); + if ($disabled_keys_found) $tpl->assign_block_vars('DISABLED_KEYS_FOUND', array()); + } $tpl->pparse('show'); } diff --git a/inc/home/mysql_variables.php b/inc/home/mysql_variables.php index 7af4f92..3f44dbb 100644 --- a/inc/home/mysql_variables.php +++ b/inc/home/mysql_variables.php @@ -14,8 +14,8 @@ echo '

 

'; switch ($var) { case "variables": - $res=@mysql_query("SHOW variables"); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW variables"); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOVARS']; @@ -25,7 +25,7 @@ switch ($var) echo '
'; for ($i=0; $i<$numrows; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $cl=($i%2) ? "dbrow" : "dbrow1"; echo ''; } @@ -33,8 +33,8 @@ switch ($var) echo '
Name'.$lang['L_INHALT'].'
'.$row[0].''.$row[1].'
'; break; case "status": - $res=@mysql_query("SHOW STATUS"); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW STATUS"); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOSTATUS']; @@ -45,7 +45,7 @@ switch ($var) for ($i=0; $i<$numrows; $i++) { $cl=($i%2) ? "dbrow" : "dbrow1"; - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); echo ''.$row[0].''.$row[1].''; } } @@ -59,7 +59,7 @@ switch ($var) $wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0; if ($wait==0) { - $ret=mysql_query("KILL ".$_GET['killid']); + $ret=mysqli_query($GLOBALS["___mysqli_ston"], "KILL ".$_GET['killid']); $wait=2; } else @@ -77,8 +77,8 @@ switch ($var) } $killid=$wait=0; - $res=@mysql_query("SHOW FULL PROCESSLIST "); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW FULL PROCESSLIST "); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOPROCESSES']; @@ -89,7 +89,7 @@ switch ($var) for ($i=0; $i<$numrows; $i++) { $cl=($i%2) ? "dbrow" : "dbrow1"; - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); echo ''.$row[0].''.$row[1].' '.$row[2].''.$row[3].''.$row[4].''.$row[5].' '.$row[6].''.$row[7].' diff --git a/inc/home/protection_create.php b/inc/home/protection_create.php index 7f655c7..6e081e6 100644 --- a/inc/home/protection_create.php +++ b/inc/home/protection_create.php @@ -27,7 +27,7 @@ $tpl=new MSDTemplate(); $tpl->set_filenames(array( 'show' => './tpl/home/protection_create.tpl')); $tpl->assign_vars(array( - 'THEME' => $config['theme'], + 'THEME' => $config['theme'], 'HEADLINE' => headline($lang['L_HTACC_CREATE']))); if (isset($_POST['username'])) @@ -35,11 +35,13 @@ if (isset($_POST['username'])) // Form submitted if ($username=='') $error[]=$lang['L_HTACC_NO_USERNAME']; if (($userpass1!=$userpass2)||($userpass1=='')) $error[]=$lang['L_PASSWORDS_UNEQUAL']; - + if (sizeof($error)==0) { + $htaccess = "\nRewriteEngine off\n\n"; $realm='MySQLDumper'; - $htaccess="AuthName \"".$realm."\"\nAuthType Basic\nAuthUserFile \"".$config['paths']['root'].".htpasswd\"\nrequire valid-user\n"; + $htaccess.="AuthName \"".$realm."\"\nAuthType Basic\nAuthUserFile \"" + .$config['paths']['root'].".htpasswd\"\nrequire valid-user"; switch ($type) { // Crypt @@ -61,15 +63,16 @@ if (isset($_POST['username'])) } $htpasswd=$username.':'.$userpass; @chmod($config['paths']['root'],0777); - - $saved=true; + // save .htpasswd if ($file_htpasswd=@fopen('.htpasswd','w')) { $saved=fputs($file_htpasswd,$htpasswd); fclose($file_htpasswd); } - + else + $saved=false; + // save .htaccess if (false!==$saved) { @@ -82,20 +85,30 @@ if (isset($_POST['username'])) else $saved=false; } - + if (false!==$saved) { - $msg=$lang['L_HTACC_CREATED']; - $tpl->assign_block_vars('CREATE_SUCCESS',array( - 'HTACCESS' => nl2br(my_quotes($htaccess)), - 'HTPASSWD' => nl2br(my_quotes($htpasswd)))); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + $output = array( + 'HTACCESS' => nl2br(htmlspecialchars($htaccess), false), + 'HTPASSWD' => nl2br(htmlspecialchars($htpasswd), false) + ); + } else { + $output = array( + 'HTACCESS' => nl2br(htmlspecialchars($htaccess)), + 'HTPASSWD' => nl2br(htmlspecialchars($htpasswd)) + ); + } + + $msg=''.$lang['L_HTACC_CREATED'].''; + $tpl->assign_block_vars('CREATE_SUCCESS', $output); @chmod($config['paths']['root'],0755); } else { $tpl->assign_block_vars('CREATE_ERROR',array( - 'HTACCESS' => nl2br(my_quotes($htaccess)), - 'HTPASSWD' => nl2br(my_quotes($htpasswd)))); + 'HTACCESS' => htmlspecialchars($htaccess), + 'HTPASSWD' => htmlspecialchars($htpasswd))); } } } @@ -103,16 +116,16 @@ if (isset($_POST['username'])) if (sizeof($error)>0||!isset($_POST['username'])) { $tpl->assign_vars(array( - 'PASSWORDS_UNEQUAL' => my_addslashes($lang['L_PASSWORDS_UNEQUAL']), + 'PASSWORDS_UNEQUAL' => my_addslashes($lang['L_PASSWORDS_UNEQUAL']), 'HTACC_CONFIRM_DELETE' => my_addslashes($lang['L_HTACC_CONFIRM_DELETE']))); - + $tpl->assign_block_vars('INPUT',array( - 'USERNAME' => my_quotes($username), - 'USERPASS1' => my_quotes($userpass1), - 'USERPASS2' => my_quotes($userpass2), - 'TYPE0_CHECKED' => $type==0 ? ' checked="checked"' : '', - 'TYPE1_CHECKED' => $type==1 ? ' checked="checked"' : '', - 'TYPE2_CHECKED' => $type==2 ? ' checked="checked"' : '', + 'USERNAME' => htmlspecialchars($username), + 'USERPASS1' => htmlspecialchars($userpass1), + 'USERPASS2' => htmlspecialchars($userpass2), + 'TYPE0_CHECKED' => $type==0 ? ' checked="checked"' : '', + 'TYPE1_CHECKED' => $type==1 ? ' checked="checked"' : '', + 'TYPE2_CHECKED' => $type==2 ? ' checked="checked"' : '', 'TYPE3_CHECKED' => $type==3 ? ' checked="checked"' : '')); } diff --git a/inc/home/protection_delete.php b/inc/home/protection_delete.php index 6c243d2..a8e4fbd 100644 Binary files a/inc/home/protection_delete.php and b/inc/home/protection_delete.php differ diff --git a/inc/home/protection_edit.php b/inc/home/protection_edit.php index 0e59fb5..dea9c8b 100644 --- a/inc/home/protection_edit.php +++ b/inc/home/protection_edit.php @@ -6,29 +6,35 @@ echo headline($lang['L_HTACC_EDIT']); $htaccessdontexist=0; +if (isset($_POST['hta_dir'])&&isset($_POST['hta_file'])&&is_dir($_POST['hta_dir'])) +{ + $hta_dir=$_POST['hta_dir']; + $hta_file=$_POST['hta_file']; +} +else +{ + $hta_dir=$config['paths']['root']; + $hta_file='.htaccess'; +} +if ($hta_dir!=''&substr($hta_dir,-1)!='/') $hta_dir.='/'; +$hta_complete=$hta_dir.$hta_file; + if ((isset($_GET['create'])&&$_GET['create']==1)||(isset($_POST['create'])&&$_POST['create']==1)) { - $fp=fopen($hta_dir.'.htaccess','w'); + $fp=fopen($hta_complete,'w'); fwrite($fp,"# created by MySQLDumper ".MSD_VERSION."\n"); fclose($fp); } -if (isset($_POST['newload'])) -{ - $hta_dir=(isset($_POST['newhtadir'])) ? $_POST['newhtadir'] : ''; -} -else - $hta_dir=(isset($_POST['hta_dir'])) ? $_POST['hta_dir'] : ''; -if ($hta_dir!=''&substr($hta_dir,-1)!='/') $hta_dir.='/'; if (isset($_POST['submit'])&&isset($_POST['thta'])) { - $fp=fopen($hta_dir.'.htaccess','w'); + $fp=fopen($hta_complete,'w'); fwrite($fp,$_POST['thta']); fclose($fp); } -if (file_exists($hta_dir.'.htaccess')) +if (file_exists($hta_complete)) { - $htaccess_exist=file($hta_dir.'.htaccess'); + $htaccess_exist=file($hta_complete); } else { @@ -36,7 +42,11 @@ else } echo $lang['L_HTACCESS32']; -echo '
File: .htaccess   '; +echo '

'; +echo ''; +echo ''; +echo ''; +echo '
'.$lang['L_DIR'].':
'.$lang['L_FILE'].':
'; if ($htaccessdontexist!=1) { echo ''; + echo '


'; @@ -56,16 +66,18 @@ if ($htaccessdontexist!=1) '.$lang['L_HTACCESS27'].'
'.$lang['L_HTACCESS28'].'

'.$lang['L_HTACCESS29'].''; - echo '
'.$lang['L_HTACCESS18'].'
'; - echo '   '; - echo '   '; + echo '
'; + echo '   '; + echo '   '; + echo ''; echo '
'; } else { - echo '

'.$hta_dir.'.htaccess existiert nicht. Soll sie erstellt werden ?

'; - echo '
'; + echo '
'.$lang['L_FILE_MISSING'].': '.$hta_complete.'

'; + echo '
'; } -echo '
'.$lang['L_BACK'].''; +echo ''; ob_end_flush(); exit(); \ No newline at end of file diff --git a/inc/home/system.php b/inc/home/system.php index 94f00b1..61b57fb 100644 --- a/inc/home/system.php +++ b/inc/home/system.php @@ -2,18 +2,18 @@ if (!defined('MSD_VERSION')) die('No direct access.'); $sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0; $msg=""; -$res=@mysql_query("SHOW VARIABLES LIKE 'datadir'",$config['dbconnection']); +$res=@mysqli_query($config['dbconnection'], "SHOW VARIABLES LIKE 'datadir'"); if ($res) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $data_dir=$row[1]; } switch ($sysaction) { case 1: //FLUSH PRIVILEGES $msg="> operating FLUSH PRIVILEGES
"; - $res=@mysql_query("FLUSH PRIVILEGES",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "FLUSH PRIVILEGES"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -25,8 +25,8 @@ switch ($sysaction) break; case 2: //FLUSH STATUS $msg="> operating FLUSH STATUS
"; - $res=@mysql_query("FLUSH STATUS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "FLUSH STATUS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -38,8 +38,8 @@ switch ($sysaction) break; case 3: //FLUSH HOSTS $msg="> operating FLUSH HOSTS
"; - $res=@mysql_query("FLUSH HOSTS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "FLUSH HOSTS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -52,15 +52,15 @@ switch ($sysaction) break; case 4: //SHOW MASTER LOGS $msg="> operating SHOW MASTER LOGS
"; - $res=@mysql_query("SHOW MASTER LOGS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "SHOW MASTER LOGS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; } else { - $numrows=mysql_num_rows($res); + $numrows=mysqli_num_rows($res); if ($numrows==0||$numrows===false) { $msg.='> there are no master log-files'; @@ -70,7 +70,7 @@ switch ($sysaction) $msg.='> there are '.$numrows.' logfiles
'; for ($i=0; $i<$numrows; $i++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $msg.='> '.$row[0].'   '.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'
'; } } @@ -78,8 +78,8 @@ switch ($sysaction) break; case 5: //RESET MASTER $msg="> operating RESET MASTER
"; - $res=@mysql_query("RESET MASTER",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "RESET MASTER"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; diff --git a/inc/mysql.php b/inc/mysql.php index 639a161..7bfc695 100644 --- a/inc/mysql.php +++ b/inc/mysql.php @@ -3,270 +3,281 @@ if (!defined('MSD_VERSION')) die('No direct access.'); //Feldspezifikationen $feldtypen=Array( - - "VARCHAR", - "TINYINT", - "TEXT", - "DATE", - "SMALLINT", - "MEDIUMINT", - "INT", - "BIGINT", - "FLOAT", - "DOUBLE", - "DECIMAL", - "DATETIME", - "TIMESTAMP", - "TIME", - "YEAR", - "CHAR", - "TINYBLOB", - "TINYTEXT", - "BLOB", - "MEDIUMBLOB", - "MEDIUMTEXT", - "LONGBLOB", - "LONGTEXT", - "ENUM", + "VARCHAR", + "TINYINT", + "TEXT", + "DATE", + "SMALLINT", + "MEDIUMINT", + "INT", + "BIGINT", + "FLOAT", + "DOUBLE", + "DECIMAL", + "DATETIME", + "TIMESTAMP", + "TIME", + "YEAR", + "CHAR", + "TINYBLOB", + "TINYTEXT", + "BLOB", + "MEDIUMBLOB", + "MEDIUMTEXT", + "LONGBLOB", + "LONGTEXT", + "ENUM", "SET" ); $feldattribute=ARRAY( - - "", - "BINARY", - "UNSIGNED", + "", + "BINARY", + "UNSIGNED", "UNSIGNED ZEROFILL" ); $feldnulls=Array( - - "NOT NULL", + "NOT NULL", "NULL" ); $feldextras=Array( - - "", + "", "AUTO_INCREMENT" ); $feldkeys=Array( - - "", - "PRIMARY KEY", - "UNIQUE KEY", + "", + "PRIMARY KEY", + "UNIQUE KEY", "FULLTEXT" ); $feldrowformat=Array( - - "", - "FIXED", - "DYNAMIC", + + "", + "FIXED", + "DYNAMIC", "COMPRESSED" ); $rechte_daten=Array( - - "SELECT", - "INSERT", - "UPDATE", - "DELETE", + "SELECT", + "INSERT", + "UPDATE", + "DELETE", "FILE" ); $rechte_struktur=Array( - - "CREATE", - "ALTER", - "INDEX", - "DROP", + "CREATE", + "ALTER", + "INDEX", + "DROP", "CREATE TEMPORARY TABLES" ); $rechte_admin=Array( - - "GRANT", - "SUPER", - "PROCESS", - "RELOAD", - "SHUTDOWN", - "SHOW DATABASES", - "LOCK TABLES", - "REFERENCES", - "EXECUTE", - "REPLICATION CLIENT", + "GRANT", + "SUPER", + "PROCESS", + "RELOAD", + "SHUTDOWN", + "SHOW DATABASES", + "LOCK TABLES", + "REFERENCES", + "EXECUTE", + "REPLICATION CLIENT", "REPLICATION SLAVE" ); $rechte_resourcen=Array( - - "MAX QUERIES PER HOUR", - "MAX UPDATES PER HOUR", + "MAX QUERIES PER HOUR", + "MAX UPDATES PER HOUR", "MAX CONNECTIONS PER HOUR" ); $sql_keywords=array( - - 'ALTER', - 'AND', - 'ADD', - 'AUTO_INCREMENT', - 'BETWEEN', - 'BINARY', - 'BOTH', - 'BY', - 'BOOLEAN', - 'CHANGE', - 'CHARSET', - 'CHECK', - 'COLLATE', - 'COLUMNS', - 'COLUMN', - 'CROSS', - 'CREATE', - 'DATABASES', - 'DATABASE', - 'DATA', - 'DELAYED', - 'DESCRIBE', - 'DESC', - 'DISTINCT', - 'DELETE', - 'DROP', - 'DEFAULT', - 'ENCLOSED', - 'ENGINE', - 'ESCAPED', - 'EXISTS', - 'EXPLAIN', - 'FIELDS', - 'FIELD', - 'FLUSH', - 'FOR', - 'FOREIGN', - 'FUNCTION', - 'FROM', - 'GROUP', - 'GRANT', - 'HAVING', - 'IGNORE', - 'INDEX', - 'INFILE', - 'INSERT', - 'INNER', - 'INTO', - 'IDENTIFIED', - 'JOIN', - 'KEYS', - 'KILL', - 'KEY', - 'LEADING', - 'LIKE', - 'LIMIT', - 'LINES', - 'LOAD', - 'LOCAL', - 'LOCK', - 'LOW_PRIORITY', - 'LEFT', - 'LANGUAGE', - 'MEDIUMINT', - 'MODIFY', - 'MyISAM', - 'NATURAL', - 'NOT', - 'NULL', - 'NEXTVAL', - 'OPTIMIZE', - 'OPTION', - 'OPTIONALLY', - 'ORDER', - 'OUTFILE', - 'OR', - 'OUTER', - 'ON', - 'PROCEEDURE', - 'PROCEDURAL', - 'PRIMARY', - 'READ', - 'REFERENCES', - 'REGEXP', - 'RENAME', - 'REPLACE', - 'RETURN', - 'REVOKE', - 'RLIKE', - 'RIGHT', - 'SHOW', - 'SONAME', - 'STATUS', - 'STRAIGHT_JOIN', - 'SELECT', - 'SETVAL', - 'TABLES', - 'TEMINATED', - 'TO', - 'TRAILING', - 'TRUNCATE', - 'TABLE', - 'TEMPORARY', - 'TRIGGER', - 'TRUSTED', - 'UNIQUE', - 'UNLOCK', - 'USE', - 'USING', - 'UPDATE', - 'UNSIGNED', - 'VALUES', - 'VARIABLES', - 'VIEW', - 'WITH', - 'WRITE', - 'WHERE', - 'ZEROFILL', - 'XOR', - 'ALL', - 'ASC', - 'AS', - 'SET', - 'IN', - 'IS', + 'ALTER', + 'AND', + 'ADD', + 'AUTO_INCREMENT', + 'BETWEEN', + 'BINARY', + 'BOTH', + 'BY', + 'BOOLEAN', + 'CHANGE', + 'CHARSET', + 'CHECK', + 'COLLATE', + 'COLUMNS', + 'COLUMN', + 'CROSS', + 'CREATE', + 'DATABASES', + 'DATABASE', + 'DATA', + 'DELAYED', + 'DESCRIBE', + 'DESC', + 'DISTINCT', + 'DELETE', + 'DROP', + 'DEFAULT', + 'ENCLOSED', + 'ENGINE', + 'ESCAPED', + 'EXISTS', + 'EXPLAIN', + 'FIELDS', + 'FIELD', + 'FLUSH', + 'FOR', + 'FOREIGN', + 'FUNCTION', + 'FROM', + 'GROUP', + 'GRANT', + 'HAVING', + 'IGNORE', + 'INDEX', + 'INFILE', + 'INSERT', + 'INNER', + 'INTO', + 'IDENTIFIED', + 'JOIN', + 'KEYS', + 'KILL', + 'KEY', + 'LEADING', + 'LIKE', + 'LIMIT', + 'LINES', + 'LOAD', + 'LOCAL', + 'LOCK', + 'LOW_PRIORITY', + 'LEFT', + 'LANGUAGE', + 'MEDIUMINT', + 'MODIFY', + 'MyISAM', + 'NATURAL', + 'NOT', + 'NULL', + 'NEXTVAL', + 'OPTIMIZE', + 'OPTION', + 'OPTIONALLY', + 'ORDER', + 'OUTFILE', + 'OR', + 'OUTER', + 'ON', + 'PROCEEDURE', + 'PROCEDURAL', + 'PRIMARY', + 'READ', + 'REFERENCES', + 'REGEXP', + 'RENAME', + 'REPLACE', + 'RETURN', + 'REVOKE', + 'RLIKE', + 'RIGHT', + 'SHOW', + 'SONAME', + 'STATUS', + 'STRAIGHT_JOIN', + 'SELECT', + 'SETVAL', + 'TABLES', + 'TEMINATED', + 'TO', + 'TRAILING', + 'TRUNCATE', + 'TABLE', + 'TEMPORARY', + 'TRIGGER', + 'TRUSTED', + 'UNIQUE', + 'UNLOCK', + 'USE', + 'USING', + 'UPDATE', + 'UNSIGNED', + 'VALUES', + 'VARIABLES', + 'VIEW', + 'WITH', + 'WRITE', + 'WHERE', + 'ZEROFILL', + 'XOR', + 'ALL', + 'ASC', + 'AS', + 'SET', + 'IN', + 'IS', 'IF' ); $mysql_doc=Array( - "Feldtypen" => "http://dev.mysql.com/doc/mysql/de/Column_types.html" ); - +$mysql_string_types = array( + 'char', + 'varchar', + 'tinytext', + 'text', + 'mediumtext', + 'longtext', + 'binary', + 'varbinary', + 'tinyblob', + 'mediumblob', + 'blob', + 'longblob', + 'enum', + 'set' +); $mysql_SQLhasRecords=array( - - 'SELECT', - 'SHOW', - 'EXPLAIN', - 'DESCRIBE', + + 'SELECT', + 'SHOW', + 'EXPLAIN', + 'DESCRIBE', 'DESC' ); function MSD_mysql_connect($encoding='utf8', $keycheck_off=false, $actual_table='') { global $config,$databases; - - $port=( isset($config['dbport']) && !empty($config['dbport']) ) ? ':' . $config['dbport'] : ''; - $socket=( isset($config['dbsocket']) && !empty($config['dbsocket']) ) ? ':' . $config['dbsocket'] : ''; - $config['dbconnection']=mysql_connect($config['dbhost'] . $port . $socket,$config['dbuser'],$config['dbpass']) or die(SQLError("Database connection error: ",mysql_error())); + if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) { + return $config['dbconnection']; + } + $port=( isset($config['dbport']) && !empty($config['dbport']) ) ? $config['dbport'] : ini_get("mysqli.default_port"); + $socket=( isset($config['dbsocket']) && !empty($config['dbsocket']) ) ? $config['dbsocket'] : ini_get("mysqli.default_socket"); + $config['dbconnection']=@($GLOBALS["___mysqli_ston"] = mysqli_connect($config['dbhost'], $config['dbuser'], $config['dbpass'], "", $port, $socket)) or die(SQLError("Error establishing a database connection!", ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)))); if (!defined('MSD_MYSQL_VERSION')) GetMySQLVersion(); - + if (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') get_sql_encodings(); - + if ($config['mysql_standard_character_set'] != $encoding) { - $set_encoding=@mysql_query('SET NAMES \'' . $encoding . '\'',$config['dbconnection']); + $set_encoding=@mysqli_query($config['dbconnection'], 'SET NAMES \'' . $encoding . '\''); if ($set_encoding === false) $config['mysql_can_change_encoding']=false; else $config['mysql_can_change_encoding']=true; } - if ($keycheck_off) mysql_query('SET FOREIGN_KEY_CHECKS=0',$config['dbconnection']); + if ($keycheck_off) { + // only called with this param when restoring + mysqli_query($config['dbconnection'], 'SET FOREIGN_KEY_CHECKS=0'); + // also set SQL-Mode NO_AUTO_VALUE_ON_ZERO for magento users + mysqli_query( $config['dbconnection'], 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"'); + } return $config['dbconnection']; } function GetMySQLVersion() { $res=MSD_query("select version()"); - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $version=$row[0]; if (!defined('MSD_MYSQL_VERSION')) define('MSD_MYSQL_VERSION',$version); $versions=explode('.',$version); @@ -282,22 +293,21 @@ function MSD_query($query, $error_output=true) global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); //echo "
Query: ".htmlspecialchars($query); - $res=mysql_query($query,$config['dbconnection']); - if (false === $res && $error_output) SQLError($query,mysql_error($config['dbconnection'])); + $res=mysqli_query($config['dbconnection'], $query); + if (false === $res && $error_output) SQLError($query,((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); return $res; } function SQLError($sql, $error, $return_output=false) { - // v(debug_backtrace()); global $lang; - + $ret='
-
MySQL-ERROR
' . $lang['L_SQL_ERROR2'] . '
' . $error . '

' . $lang['L_SQL_ERROR1'] . '
' . Highlight_SQL($sql) . '
'; +
'; if ($return_output) return $ret; else echo $ret; } @@ -305,10 +315,10 @@ function SQLError($sql, $error, $return_output=false) function Highlight_SQL($sql) { global $sql_keywords; - + $end=''; $tickstart=false; - if (function_exists("token_get_all")) $a=@token_get_all(""); + if (function_exists("token_get_all")) $a=@token_get_all(""); else return $sql; foreach ($a as $token) { @@ -327,7 +337,7 @@ function Highlight_SQL($sql) case "T_STRING": case "T_AS": case "T_FOR": - + $end.=( in_array(strtoupper($token[1]),$sql_keywords) ) ? "" . $token[1] . "" : $token[1]; break; case "T_IF": @@ -356,9 +366,9 @@ function Fieldlist($db, $tbl) if ($res) { $fl='('; - for ($i=0; $i < mysql_num_rows($res); $i++) + for ($i=0; $i < mysqli_num_rows($res); $i++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $fl.='`' . $row[0] . '`,'; } $fl=substr($fl,0,strlen($fl) - 1) . ')'; @@ -373,27 +383,35 @@ function getDBInfos() for ($ii=0; $ii < count($databases['multi']); $ii++) { $dump['dbindex']=$flipped[$databases['multi'][$ii]]; - $tabellen=mysql_query('SHOW TABLE STATUS FROM `' . $databases['Name'][$dump['dbindex']] . '`',$config['dbconnection']) or die('getDBInfos: ' . mysql_error()); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLE STATUS FROM `' . $databases['Name'][$dump['dbindex']] . '`') or die('getDBInfos: ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); + $num_tables=mysqli_num_rows($tabellen); // Array mit den gewünschten Tabellen zusammenstellen... wenn Präfix angegeben, werden die anderen einfach nicht übernommen if ($num_tables > 0) { for ($i=0; $i < $num_tables; $i++) { - $row=mysql_fetch_array($tabellen); + $row=mysqli_fetch_array($tabellen); if (isset($row['Type'])) $row['Engine']=$row['Type']; if (isset($row['Comment']) && substr(strtoupper($row['Comment']),0,4) == 'VIEW') $dump['table_types'][]='VIEW'; else $dump['table_types'][]=strtoupper($row['Engine']); // check if data needs to be backed up if (strtoupper($row['Comment']) == 'VIEW' || ( isset($row['Engine']) && in_array(strtoupper($row['Engine']),array( - - 'MEMORY' + 'MEMORY' )) )) { $dump['skip_data'][]=$databases['Name'][$dump['dbindex']] . '|' . $row['Name']; } - if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1) mysql_query('OPTIMIZE `' . $row['Name'] . '`'); - if (isset($tbl_sel)) + if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1 + && $databases['Name'][$dump['dbindex']]!='information_schema') { + mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['Name'][$dump['dbindex']]); + $opt = 'OPTIMIZE TABLE `' . $row['Name'] . '`'; + $res = mysqli_query($GLOBALS["___mysqli_ston"], 'OPTIMIZE TABLE `' . $row['Name'] . '`'); + if ($res === false) { + die("Error in ".$opt." -> ".((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); + } + } + + if (isset($tbl_sel)) { if (in_array($row['Name'],$dump['tblArray'])) { @@ -415,13 +433,13 @@ function getDBInfos() { $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); + $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2); if ($res2 === false) { - $read_error='(' . mysql_errno() . ') ' . mysql_error(); + $read_error='(' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . ') ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); SQLError($read_error,$sql_2); WriteLog($read_error); if ($config['stop_with_error'] > 0) @@ -431,7 +449,7 @@ function getDBInfos() } else { - $row2=@mysql_fetch_array($res2); + $row2=@mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; $dump['totalrecords']+=$row['Rows']; } diff --git a/inc/runtime.php b/inc/runtime.php index 57a03b9..eb27459 100644 --- a/inc/runtime.php +++ b/inc/runtime.php @@ -1,14 +1,19 @@ = 0) { + error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE); +} + if (function_exists("date_default_timezone_set")) date_default_timezone_set(@date_default_timezone_get()); //Konstanten -if (!defined('MSD_VERSION')) define('MSD_VERSION','1.24'); +if (!defined('MSD_VERSION')) define('MSD_VERSION','1.24.4'); if (!defined('MSD_OS')) define('MSD_OS',PHP_OS); if (!defined('MSD_OS_EXT')) define('MSD_OS_EXT',@php_uname()); if (!defined('config') || !is_array($config)) $config=array(); if (!defined('databases') || !is_array($databases)) $databases=array(); //Pfade und Files -$config['paths']['root']=Realpfad('./'); +$config['paths']['root']=basePath(); $config['paths']['work']='work/'; $config['paths']['backup']=$config['paths']['work'] . 'backup/'; $config['paths']['log']=$config['paths']['work'] . 'log/'; @@ -30,7 +35,6 @@ $config['files']['log']=$config['paths']['log'] . 'mysqldump.log'; $config['files']['perllog']=$config['paths']['log'] . 'mysqldump_perl.log'; $config['files']['perllogcomplete']=$config['paths']['log'] . 'mysqldump_perl.complete.log'; $config['files']['parameter']=$config['paths']['config'] . $config['config_file'] . '.php'; -$config['files']['dbs_manual']=$config['paths']['config'] . 'dbs_manual.php'; // inti MySQL-Setting-Vars $config['mysql_standard_character_set']=''; @@ -64,7 +68,7 @@ $config['tuning_add']=1.1; $config['tuning_sub']=0.9; $config['time_buffer']=0.75; //max_zeit=$config['max_execution_time']*$config['time_buffer'] $config['perlspeed']=10000; //Anzahl der Datensaetze, die in einem Rutsch gelesen werden - +$config['ignore_enable_keys'] = 0; //Bausteine $config['homepage']='http://mysqldumper.net'; @@ -101,8 +105,10 @@ $config_dontsave=Array( 'files' ); +$dontBackupDatabases = array('mysql', 'information_schema'); + // Automatisches entfernen von Slashes und Leerzeichen vorn und hinten abschneiden -if (1==get_magic_quotes_gpc()) +if (1==get_magic_quotes_gpc()) { $_POST=stripslashes_deep($_POST); $_GET=stripslashes_deep($_GET); diff --git a/inc/sql_importexport.php b/inc/sql_importexport.php index e747424..2d420d4 100644 --- a/inc/sql_importexport.php +++ b/inc/sql_importexport.php @@ -209,11 +209,11 @@ else $res=MSD_query($sqlt); if ($res) { - $sql['export']['tablecount']=mysql_numrows($res); + $sql['export']['tablecount']=mysqli_num_rows($res); $sql['export']['recordcount']=0; for ($i=0; $i < $sql['export']['tablecount']; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $tblstr.='' . "\n"; $sql['export']['recordcount']+=$row['Rows']; } diff --git a/inc/sql_tools.php b/inc/sql_tools.php index 78e97b6..db5183f 100644 --- a/inc/sql_tools.php +++ b/inc/sql_tools.php @@ -10,48 +10,55 @@ if (isset($_POST['dbdosubmit'])) { $newname=$_POST['newname']; $db_index=$_POST['db_index']; - echo "
Db-Index:" . $_GET['db_index']; $db_action=$_POST['db_action']; $changed=false; $ausgabe=$out=""; switch ($db_action) { case "drop": - MSD_DoSQL("DROP DATABASE `" . $databases['Name'][$db_index] . "`"); - echo SQLOutput($out,'

' . $lang['L_DB'] . ' `' . $databases['Name'][$db_index] . '` wurde gelöscht.

'); - $changed=true; - break; + if (MSD_DoSQL("DROP DATABASE `" . $databases['Name'][$db_index] . "`")) + { + echo SQLOutput($out,'

' . $lang['L_DB'] . ' `' . $databases['Name'][$db_index] . '` ' . $lang['L_SQL_DELETED'] . '

'); + $changed=true; + } + break; case "empty": EmptyDB($databases['Name'][$db_index]); echo SQLOutput($out,'

' . $lang['L_DB'] . ' `' . $databases['Name'][$db_index] . '` ' . $lang['L_SQL_WASEMPTIED'] . '.

'); break; case "rename": $dbold=$databases['Name'][$db_index]; - DB_Copy($dbold,$newname,1); - echo SQLOutput($out,'

' . $lang['L_DB'] . ' `' . $dbold . '` ' . $lang['L_SQL_RENAMEDTO'] . ' `' . $newname . '`.

'); - $changed=true; + if (DB_Copy($dbold,$newname,1)) + { + echo SQLOutput($out,'

' . $lang['L_DB'] . ' `' . $dbold . '` ' . $lang['L_SQL_RENAMEDTO'] . ' `' . $newname . '`.

'); + $changed=true; + } break; case "copy": $dbold=$databases['Name'][$db_index]; - DB_Copy($dbold,$newname); - $changed=true; - echo SQLOutput($out,'

' . sprintf($lang['L_SQL_DBCOPY'],$dbold,$newname) . '

'); - break; + if (DB_Copy($dbold,$newname)) + { + $changed=true; + echo SQLOutput($out,'

' . sprintf($lang['L_SQL_DBCOPY'],$dbold,$newname) . '

'); + } + break; case "structure": - DB_Copy($databases['Name'][$db_index],$newname,0,0); - $changed=true; - echo SQLOutput($out,'

' . sprintf($lang['L_SQL_DBSCOPY'],$databases['Name'][$db_index],$newname) . '

'); - break; + if (DB_Copy($databases['Name'][$db_index],$newname,0,0)) + { + $changed=true; + echo SQLOutput($out,'

' . sprintf($lang['L_SQL_DBSCOPY'],$databases['Name'][$db_index],$newname) . '

'); + } + break; case "rights": break; } - - if ($changed=true) + + if ($changed==true) { SetDefault(); include ( $config['files']['parameter'] ); echo ''; - + } } if (isset($_POST['dbwantaction'])) @@ -71,13 +78,14 @@ if (isset($_POST['dbwantaction'])) } $db_default_collation=@explode('|',$col); if (isset($db_default_collation[1])) $sqlc.=' COLLATE `' . $db_default_collation[1] . '`'; - - MSD_query($sqlc); - echo $lang['L_DB'] . " `$newname` " . $lang['L_SQL_WASCREATED'] . ".
"; - SetDefault(); - include ( $config['files']['parameter'] ); - echo ''; - + + if (MSD_query($sqlc)) + { + echo $lang['L_DB'] . " `$newname` " . $lang['L_SQL_WASCREATED'] . ".
"; + SetDefault(); + include ( $config['files']['parameter'] ); + echo ''; + } } } $db_action=$newname=""; @@ -111,7 +119,11 @@ if (isset($_POST['dbwantaction'])) break; case "rename": echo '' . $lang['L_SQL_RENAMEDB'] . ' `' . $databases['Name'][$db_index] . '` ' . $lang['L_IN'] . ' `' . $newname . '`

'; - echo ''; + if ($newname == "") echo '

' . $lang['L_SQL_NAMEDEST_MISSING'] . '

'; + else + { + echo ''; + } break; case "copy": echo '' . sprintf($lang['L_ASKDBCOPY'],$databases['Name'][$db_index],$newname) . '

'; @@ -164,13 +176,12 @@ for ($i=0; $i < count($databases['Name']); $i++) if (MSD_NEW_VERSION) echo ''; if (MSD_NEW_VERSION) echo ''; echo ''; - + echo ''; echo "\n\n" . '  '; - + echo '  '; } echo ''; - - \ No newline at end of file + diff --git a/inc/sqlbrowser/mysql_search.php b/inc/sqlbrowser/mysql_search.php index a548fe1..579817c 100644 --- a/inc/sqlbrowser/mysql_search.php +++ b/inc/sqlbrowser/mysql_search.php @@ -4,10 +4,10 @@ if (!defined('MSD_VERSION')) die('No direct access.'); $sql='SHOW TABLES FROM `'.$db.'`'; $tables=ARRAY(); $link=MSD_mysql_connect(); -$res=mysql_query($sql,$link); +$res=mysqli_query($link, $sql); if (!$res===false) { - WHILE ($row=mysql_fetch_array($res,MYSQL_NUM)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_NUM)) { $tables[]=$row[0]; } @@ -39,7 +39,6 @@ $tablename=isset($_GET['tablename']) ? urldecode($_GET['tablename']) : ''; if (isset($_GET['mode'])&&$_GET['mode']=="kill"&&$rk>'') { //echo "
RK ist: ".$rk."

"; - if (strpos($rk,"|")!=false) $rk=str_replace('|',' AND ',$rk); $sqlk="DELETE FROM `$tablename` WHERE ".$rk." LIMIT 1"; //echo $sqlk; $res=MSD_query($sqlk); @@ -71,12 +70,12 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl // Felder ermitteln $sql='SHOW COLUMNS FROM `'.$db.'`.`'.$tables[$tabelle].'`'; - $res=mysql_query($sql,$link); + $res=mysqli_query($link, $sql); unset($felder); if (!$res===false) { // Felder der Tabelle ermitteln - WHILE ($row=mysql_fetch_object($res)) + WHILE ($row=mysqli_fetch_object($res)) { $felder[]=$row->Field; } @@ -131,10 +130,10 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl else $sql='SELECT * FROM `'.$db.'`.`'.$tables[$tabelle].'` LIMIT '.$offset.','.$anzahl_ergebnisse; - $res=@mysql_query($sql,$link); + $res=@mysqli_query($link, $sql); if ($res) { - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //Treffer markieren foreach ($row as $key=>$val) @@ -351,9 +350,9 @@ if (is_array($treffer)&&isset($treffer[0])) // remove hit marker from value $x=str_replace('','',$treffer[$a][$k]); $x=str_replace('','',$x); - $keystring.='`'.$k.'`="'.addslashes($x).'"|'; + $keystring.='`'.$k.'`="'.addslashes($x).'" AND '; } - $keystring=substr($keystring,0,-1); + $keystring=substr($keystring,0,-5); $rk=build_recordkey($keystring); } else diff --git a/inc/sqlbrowser/sql_commands.php b/inc/sqlbrowser/sql_commands.php index e6bc9a9..42537b2 100644 --- a/inc/sqlbrowser/sql_commands.php +++ b/inc/sqlbrowser/sql_commands.php @@ -7,12 +7,12 @@ function nl2null($string) return trim(str_replace($search,$replace,$string)); } //SQL-Strings -echo $aus.='

' . $lang['L_SQL_BEFEHLE'] . ' (' . count($SQL_ARRAY) . ')

'; +echo $aus.='

' . $lang['L_SQL_BEFEHLE'] . ' (' . (is_array($SQL_ARRAY)? count($SQL_ARRAY) : 0) . ')

'; echo '' . $lang['L_SQL_BEFEHLNEU'] . '

'; if (isset($_POST['sqlnewupdate'])) { - $ind=count($SQL_ARRAY); - if (count($SQL_ARRAY) > 0) array_push($SQL_ARRAY,$_POST['sqlname' . $ind] . "|" . $_POST['sqlstring' . $ind]); + $ind=(is_array($SQL_ARRAY))? count($SQL_ARRAY) : 0; + if ($ind > 0) array_push($SQL_ARRAY,$_POST['sqlname' . $ind] . "|" . $_POST['sqlstring' . $ind]); else $SQL_ARRAY[0]=htmlspecialchars($_POST['sqlname0'],ENT_COMPAT ,'UTF-8') . '|' . $_POST['sqlstring0']; WriteSQL(); echo '

' . $lang['L_SQL_BEFEHLSAVED1'] . ' \'' . $_POST['sqlname' . $ind] . '\' ' . $lang['L_SQL_BEFEHLSAVED2'] . '

'; @@ -24,7 +24,7 @@ echo '
'; echo ''; $i=0; -if (count($SQL_ARRAY) > 0) +if (is_array($SQL_ARRAY) && count($SQL_ARRAY) > 0) { for ($i=0; $i < count($SQL_ARRAY); $i++) { diff --git a/inc/sqlbrowser/sql_dataview.php b/inc/sqlbrowser/sql_dataview.php index 3e42d01..1d8f09b 100644 --- a/inc/sqlbrowser/sql_dataview.php +++ b/inc/sqlbrowser/sql_dataview.php @@ -1,36 +1,35 @@ 0, - 'Rows' => 1, - 'Data_length' => 2, - 'Auto_increment' => 3, - 'Avg_row_length' => 4, - 'Max_data_length' => 5, - 'Comment' => 6, - 'Row_format' => 7, - 'Index_length' => 8, - 'Data_free' => 9, - 'Collation' => 10, - 'Create_time' => 11, - 'Update_time' => 12, - 'Check_time' => 13, - 'Create_options' => 14, - 'Version' => 15, - 'Engine' => 16, + + 'Name' => 0, + 'Rows' => 1, + 'Data_length' => 2, + 'Auto_increment' => 3, + 'Avg_row_length' => 4, + 'Max_data_length' => 5, + 'Comment' => 6, + 'Row_format' => 7, + 'Index_length' => 8, + 'Data_free' => 9, + 'Collation' => 10, + 'Create_time' => 11, + 'Update_time' => 12, + 'Check_time' => 13, + 'Create_options' => 14, + 'Version' => 15, + 'Engine' => 16, 'Checksum' => 17 ); $byte_output=array( - - 'Data_length', - 'Avg_row_length', - 'Max_data_length', - 'Index_length', + + 'Data_length', + 'Avg_row_length', + 'Max_data_length', + 'Index_length', 'Data_free' ); @@ -67,16 +66,15 @@ if ($databases['Name'][$dbid]!=$databases['db_actual']) // refresh menu to switch to actual database echo ''; - + } echo '

' . ( $tn != '' ? $lang['L_TABLE'] . ' `' . $databases['db_actual'] . '`.`' . $tn . '`
' : '' ); if (isset($msg)) echo $msg; $numrowsabs=-1; $numrows=0; -// vorgehensweise - zwischen SELECT und FROM alles rausschneiden und durch count(*) ersetzen -// es soll die Summe der Datensaetze ermittelt werden, wenn es kein LIMIT geben wuerde, um die -// Blaettern-Links korrekt anzuzeigen +// Vorgehensweise - es soll die Summe der Datensaetze ermittelt werden, wenn es kein LIMIT gibt, +// um die Blaettern-Links korrekt anzuzeigen $skip_mysql_execution=false; if ($sql_to_display_data == 0) { @@ -88,22 +86,24 @@ if ($sql_to_display_data == 0) } else { + // auch alle Tabellen-Namen werden lowercase! -> das kann zu Problemen fuehren + // siehe https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html $sql_temp=strtolower($sql['sql_statement']); if (substr($sql_temp,0,7) == 'select ') { if (false !== strpos($sql_temp,' limit ')) { - // es wurde ein eigenes Lmit im Query angegeben - eigene Berechnung abbrechen + // es wurde ein eigenes Limit im Query angegeben - eigene Berechnung abbrechen $numrowsabs=-1; } else { - $pos=strpos($sql_temp,'from '); - $sql_temp='SELECT count(*) as anzahl ' . substr($sql['sql_statement'],$pos,strlen($sql['sql_statement']) - $pos); + // anstatt sql_temp in lowerase hier das 'original' sql_statement verwenden + $sql_temp="SELECT count(*) as anzahl FROM (".$sql['sql_statement'].") as query;"; $res=@MSD_query($sql_temp,false); if ($res) { - if ($row=mysql_fetch_object($res)) + if ($row=mysqli_fetch_object($res)) { $numrowsabs=$row->anzahl; } @@ -119,7 +119,7 @@ else $sqltmp=$sql['sql_statement'] . $sql['order_statement'] . ( strpos(strtolower($sql['sql_statement'] . $sql['order_statement']),' limit ') ? '' : $limit ); if (!$skip_mysql_execution) $res=MSD_query($sqltmp); -$numrows=@mysql_num_rows($res); +$numrows=@mysqli_num_rows($res); if ($numrowsabs == -1) $numrowsabs=$numrows; if ($limitende > $numrowsabs) $limitende=$numrowsabs; @@ -144,7 +144,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) echo '

'; //Datentabelle echo '
#' . $lang['L_NAME'] . 'SQL' . $lang['L_COMMAND'] . '
'; - + $t=$d=""; $fdesc=Array(); $key=-1; @@ -152,25 +152,22 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) { //Infos und Header holen //1.Datensatz fuer Feldinfos - $row=mysql_fetch_row($res); - + $row=mysqli_fetch_row($res); //Kompaktmodus-Switcher $t=''; $t.=''; $temp=array(); - + for ($x=0; $x < count($row); $x++) { - $temp[$x]['data']=mysql_fetch_field($res,$x); + $temp[$x]['data']=(((($___mysqli_tmp = mysqli_fetch_field_direct($res, $x)) && is_object($___mysqli_tmp)) ? ( (!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && (!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && (!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && (!is_null($___mysqli_type = $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0)) ) : false ) ? $___mysqli_tmp : false); $temp[$x]['sort']=add_sortkey($temp[$x]['data']->name); } - //v($temp); - if ($showtables == 1) $temp=mu_sort($temp,'sort'); - + for ($x=0; $x < count($temp); $x++) { $str=$temp[$x]['data']; @@ -193,23 +190,23 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) $fdesc[$temp[$x]['data']->name]['Engine']=isset($str->Engine) ? $str->Engine : ''; if (isset($str->Comment) && substr($str->Comment,0,4) == 'VIEW') $fdesc[$temp[$x]['data']->name]['Engine']='View'; $fdesc[$temp[$x]['data']->name]['Version']=isset($str->Version) ? $str->Version : ''; - + $tt=$lang['L_NAME'] . ': ' . $fdesc[$temp[$x]['data']->name]['name'] . ' Type: ' . $fdesc[$temp[$x]['data']->name]['type'] . " Max Length: " . $fdesc[$temp[$x]['data']->name]['max_length'] . " Unsigned: " . $fdesc[$temp[$x]['data']->name]['unsigned'] . " zerofill: " . $fdesc[$temp[$x]['data']->name]['zerofill']; - + $pic=''; if ($str->primary_key == 1 || $str->unique_key == 1) { if ($key == -1) $key=$temp[$x]['data']->name; else $key.='|' . $temp[$x]['data']->name; - + if ($str->primary_key == 1) $pic=$icon['key_primary']; elseif ($str->unique_key == 1) $pic=$icon['index']; } - + // show sorting icon $arname=( $orderdir == "ASC" ) ? $icon['arrow_down'] : $icon['arrow_up']; if ($str->name == $order) $t.=$arname; - + if ($bb == -1) $bb_link=( $str->type == "blob" ) ? '   [BB]' : ''; else $bb_link=( $str->type == "blob" ) ? '   [no BB]' : ''; if ($no_order == false && $showtables == 0) $t.=$pic . ' ' . $str->name . '' . $bb_link; @@ -217,17 +214,17 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) $t.=''; } unset($temp); - + $temp=array(); //und jetzt Daten holen - mysql_data_seek($res,0); - + mysqli_data_seek($res, 0); + $s=$keysort; $s=array_flip($keysort); ksort($s); for ($i=0; $i < $numrows; $i++) { - $data[0]=mysql_fetch_array($res,MYSQL_ASSOC); + $data[0]=mysqli_fetch_array($res, MYSQLI_ASSOC); if ($showtables == 1 && $tabellenansicht == 1) { // Spalten sortieren, wenn wir uns in einer Tabellenuebersicht befinden @@ -237,19 +234,19 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) else $temp[$i]=$data[0]; } - + $rownr=$limitstart + 1; for ($i=0; $i < $numrows; $i++) { $row=$temp[$i]; // mysql_fetch_row($res); $cl=( $i % 2 ) ? 'dbrow' : 'dbrow1'; $erste_spalte=1; - + // bei Tabellenuebersicht soll nach vorgefertigter Reihenfolge sortiert werden, ansonsten einfach Daten anzeigen if ($showtables == 1) $sortkey=$keysort; else $sortkey=$row; $spalte=0; - + // get primary key link for editing if ($key > -1) { @@ -259,17 +256,17 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) { if (in_array($rowkey,$keys)) { - if (strlen($primary_key) > 0) $primary_key.='|'; + if (strlen($primary_key) > 0) $primary_key.=' AND '; $primary_key.='`' . urlencode($rowkey) . '`=\'' . urlencode($rowval) . '\''; } } //echo "

Primaerschluessel erkannt: ".$primary_key; } - + foreach ($sortkey as $rowkey=>$rowval) { if (( $rowkey == 'Name' ) && $tabellenansicht == 1 && isset($row['Name'])) $tablename=$row['Name']; - + if ($erste_spalte == 1) { //edit-pics @@ -293,7 +290,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) $d.='' . $icon['edit'] . ' '; } } - + if ($showtables == 0 && $tabellenansicht == 0) { $d.='' . $icon['delete'] . ''; @@ -337,14 +334,14 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) if (isset($temp[$i][$rowkey])) $data=( $fdesc[$rowkey]['type'] == 'string' || $fdesc[$rowkey]['type'] == 'blob' ) ? convert_to_utf8($temp[$i][$rowkey]) : $temp[$i][$rowkey]; else $data=''; if (in_array($rowkey,$byte_output)) $data=byte_output($data); - + } } //v($fdesc[$rowkey]); - if ($showtables==0) + if ($showtables==0) { if (is_null($rowval)) $data='NULL'; - + else $data=htmlspecialchars($data,ENT_COMPAT,'UTF-8'); } $spalte++; @@ -360,8 +357,8 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) } } echo '
' . ( ( $tdcompact == 1 ) ? $lang['L_SQL_VIEW_STANDARD'] : $lang['L_SQL_VIEW_COMPACT'] ) . ''; $t.='   ' . $lang['L_SQL_QUERYENTRY'] . ' ' . count($row) . ' ' . $lang['L_SQL_COLUMNS']; $t.='
 #
'; - + if ($showtables == 0) echo '
' . $command_line; } else - echo '

' . $lang['L_SQL_NODATA'] . '

'; \ No newline at end of file + echo '

' . $lang['L_SQL_NODATA'] . '

'; diff --git a/inc/sqlbrowser/sql_record_insert_inputmask.php b/inc/sqlbrowser/sql_record_insert_inputmask.php index 0cec6f0..9afe299 100644 --- a/inc/sqlbrowser/sql_record_insert_inputmask.php +++ b/inc/sqlbrowser/sql_record_insert_inputmask.php @@ -6,12 +6,12 @@ $tpl->set_filenames(array( $sqledit="SHOW FIELDS FROM `$tablename`"; $res=MSD_query($sqledit); -$num=mysql_numrows($res); +$num=mysqli_num_rows($res); $feldnamen=""; for ($x=0; $x<$num; $x++) { - $row=mysql_fetch_object($res); + $row=mysqli_fetch_object($res); $feldnamen.=$row->Field.'|'; $tpl->assign_block_vars('ROW',array( 'CLASS' => ($x%2) ? 1 : 2, diff --git a/inc/sqlbrowser/sql_record_update_inputmask.php b/inc/sqlbrowser/sql_record_update_inputmask.php index 25431e2..82818f5 100644 --- a/inc/sqlbrowser/sql_record_update_inputmask.php +++ b/inc/sqlbrowser/sql_record_update_inputmask.php @@ -4,13 +4,12 @@ $tpl=new MSDTemplate(); $tpl->set_filenames(array( 'show' => './tpl/sqlbrowser/sql_record_update_inputmask.tpl')); -$recordkey=str_replace('|',' AND ',$recordkey); $target=($mode=="searchedit") ? '?mode=searchedit' : '?mode=update'; // jump back to search hit list after saving $fields=getExtendedFieldInfo($db,$tablename); $sqledit="SELECT * FROM `$tablename` WHERE ".$recordkey; $res=MSD_query($sqledit); -$record=mysql_fetch_array($res,MYSQL_ASSOC); // get the record +$record=mysqli_fetch_array($res, MYSQLI_ASSOC); // get the record $num=sizeof($record); // get the nr of fields of the record diff --git a/inc/sqlbrowser/sql_tables.php b/inc/sqlbrowser/sql_tables.php index 19867c5..2c6040d 100644 --- a/inc/sqlbrowser/sql_tables.php +++ b/inc/sqlbrowser/sql_tables.php @@ -3,17 +3,19 @@ if (!defined('MSD_VERSION')) die('No direct access.'); //Tabellen echo $aus.'
'.$lang['L_SQL_TABLESOFDB'].' `'.$databases['Name'][$dbid].'` '.$lang['L_SQL_EDIT'].'
'; -//////////////////////// DH //Primaerschluessel loeschen if (isset($_GET['killPrimaryKey'])) { $keys=getPrimaryKeys($databases['Name'][$dbid],$_GET['tablename']); //Zu loeschenden Schluessel aus dem Array entfernen - $keyPos=array_search($_GET['killPrimaryKey'],$keys); + $keyPos=array_search($_GET['killPrimaryKey'],$keys['name']); if (!(false===$keyPos)) { - unset($keys[$keyPos]); - $res=setNewPrimaryKeys($databases['Name'][$dbid],$_GET['tablename'],$keys); + unset($keys['name'][$keyPos]); + unset($keys['size'][$keyPos]); + $keys['name']=array_values($keys['name']); + $keys['size']=array_values($keys['size']); + $res=setNewPrimaryKeys($databases['Name'][$dbid], $_GET['tablename'], $keys['name'], $keys['size']); if ($res) { echo ''; } } @@ -37,37 +39,88 @@ if (isset($_GET['killPrimaryKey'])) //Primärschlüssel löschen ende -//Neue Primärschlüssel setzen -if (isset($_POST['setNewPrimaryKeys'])) +//Neue Schlüssel setzen +if (isset($_POST['setNewKeys'])) { $fields=getAllFields($databases['Name'][$dbid],$_GET['tablename']); $newKeysArray=Array(); + $newKeySizesArray=Array(); foreach ($fields as $index=>$field) { - if ((isset($_POST["setNewPrimKey".$index]))&&($_POST["setNewPrimKey".$index]!="")) + if ((isset($_POST["setNewKey".$index]))&&($_POST["setNewKey".$index]!="")) { - $newKeysArray[]=$_POST["setNewPrimKey".$index]; + $newKeysArray[]=$_POST["setNewKey".$index]; + $newKeySizesArray[]=isset($_POST["indexSize".$index]) ? (int) $_POST["indexSize".$index]:''; } } //doppelte Elemente entfernen $newKeysArray=array_unique($newKeysArray); - - $res=setNewPrimaryKeys($databases['Name'][$dbid],$_GET['tablename'],$newKeysArray); + $newKeySizesArray=array_intersect_key($newKeySizesArray, $newKeysArray); + + if ($_POST["indexType"]=="primary") + { + $res=setNewPrimaryKeys($databases['Name'][$dbid], $_GET['tablename'], $newKeysArray, $newKeySizesArray); + if ($res) + { + echo ''; + } + else + { + echo ''; + } + } + else + { + if ($_POST["indexType"]=="unique") + { + $newIndexType="UNIQUE"; + } + elseif ($_POST["indexType"]=="fulltext") + { + $newIndexType="FULLTEXT"; + } + else + { + $newIndexType="INDEX"; + } + + $res=setNewKeys($databases['Name'][$dbid], $_GET['tablename'], $newKeysArray, $newIndexType, $_POST['indexName'], $newKeySizesArray); + if ($res) + { + echo ''; + } + else + { + echo ''; + } + } +} + +//Andere Indizes löschen +if (isset($_GET['killIndex'])) +{ + $res = killKey($databases['Name'][$dbid], $_GET['tablename'], $_GET['killIndex']); if ($res) { echo ''; } else { echo ''; } } -//Neue Primärschlüssel setzen ende -//////////////////////// DH ende if (isset($_GET['kill'])) { @@ -75,9 +128,12 @@ if (isset($_GET['kill'])) else { $sql_alter="ALTER TABLE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."` DROP COLUMN `".$_GET['kill']."`"; - MSD_DoSQL($sql_alter); - echo '
'; - echo '

'.$lang['L_SQL_FIELDDELETE1'].' `'.$_GET['kill'].'` '.$lang['L_SQL_DELETED'].'.

'.highlight_sql($out).'
'; + $res = MSD_DoSQL($sql_alter); + if ($res) + { + echo '
'; + echo '

'.$lang['L_SQL_FIELDDELETE1'].' `'.$_GET['kill'].'` '.$lang['L_SQL_DELETED'].'.

'.highlight_sql($out).'
'; + } } } if (isset($_POST['tablecopysubmit'])) @@ -95,8 +151,7 @@ if (isset($_POST['tablecopysubmit'])) { Table_Copy("`".$databases['Name'][$dbid]."`.`".$table_edit_name."`",$_POST['tablecopyname'],$_POST['copyatt']); echo '
'; - echo ($_POST['copyatt']==0) ? '

'.sprintf($lang['L_SQL_SCOPY'],$table_edit_name,$_POST['tablecopyname']).'.

' : sprintf($lang['L_SQL_TCOPY'],$table_edit_name,$_POST['tablecopyname']).'

'; - echo highlight_sql($out).'
'; + echo ($_POST['copyatt']==0) ? '

'.sprintf($lang['L_SQL_SCOPY'],$table_edit_name,$_POST['tablecopyname']).'

' : sprintf($lang['L_SQL_TCOPY'],$table_edit_name,$_POST['tablecopyname']).'

'; echo highlight_sql($out).''; $tablename=$_POST['tablecopyname']; } } @@ -109,8 +164,11 @@ if (isset($_POST['newtablesubmit'])) else { $sql_alter="CREATE TABLE `".$databases['Name'][$dbid]."`.`".$_POST['newtablename']."` (`id` int(11) unsigned not null AUTO_INCREMENT PRIMARY KEY ) ".((MSD_NEW_VERSION) ? "ENGINE" : "TYPE")."=MyISAM;"; - MSD_DoSQL($sql_alter); - echo SQLOutput($out,$lang['L_TABLE'].' `'.$_POST['newtablename'].'` '.$lang['L_SQL_CREATED']); + $res = MSD_DoSQL($sql_alter); + if ($res) + { + echo SQLOutput($out,$lang['L_TABLE'].' `'.$_POST['newtablename'].'` '.$lang['L_SQL_CREATED']); + } } } if (isset($_POST['t_edit_submit'])) @@ -132,9 +190,12 @@ if (isset($_POST['t_edit_submit'])) if (MSD_NEW_VERSION&&$_POST['t_edit_charset']!="") $sql_alter.="DEFAULT CHARSET=".$_POST['t_edit_charset'].", "; if (MSD_NEW_VERSION&&$_POST['t_edit_collate']!="") $sql_alter.="COLLATE ".$_POST['t_edit_collate'].", "; $sql_alter.="COMMENT='".$_POST['t_edit_comment']."' "; - - MSD_DoSQL($sql_alter); - echo SQLOutput($out,$lang['L_TABLE'].' `'.$_POST['table_edit_name'].'` '.$lang['L_SQL_CHANGED']); + + $res = MSD_DoSQL($sql_alter); + if ($res) + { + echo SQLOutput($out,$lang['L_TABLE'].' `'.$_POST['table_edit_name'].'` '.$lang['L_SQL_CHANGED']); + } } } else @@ -166,9 +227,9 @@ if (isset($_POST['newfield_posted'])) $newkeys[1]=($_POST['f_index_new']=="unique") ? 1 : 0; $newkeys[2]=($_POST['f_index_new']=="index") ? 1 : 0; $newkeys[3]=(isset($_POST['f_indexfull'])) ? 1 : 0; - + $add_sql.=ChangeKeys($oldkeys,$newkeys,$_POST['f_name'],$_POST['f_size'],"drop_only"); - + $sql_stamm="ALTER TABLE `".$databases['Name'][$dbid]."`.`$table_edit_name` "; $sql_alter=$sql_stamm.((isset($_POST['editfield'])) ? "CHANGE COLUMN `".$_POST['fieldname']."` `".$_POST['f_name']."` " : "ADD COLUMN `".$_POST['f_name']."` "); $sql_alter.=$_POST['f_type']; @@ -186,37 +247,41 @@ if (isset($_POST['newfield_posted'])) $sql_alter.=$_POST['f_attribut']." "; $sql_alter.=$_POST['f_null']." "; $sql_alter.=($_POST['f_default']!="") ? "DEFAULT '".addslashes($_POST['f_default'])."' " : ""; - + if (MSD_NEW_VERSION&&$_POST['f_collate']!="") $sql_alter.="COLLATE ".$_POST['f_collate']." "; - + if ($_POST['f_extra']=="AUTO_INCREMENT") { $sql_alter.=" AUTO_INCREMENT "; } - if ($newkeys[0]==1) $sql_alter.=" PRIMARY KEY "; - if ($newkeys[1]==1) $sql_alter.=" UNIQUE INDEX "; - if ($newkeys[2]==1) $sql_alter.=" INDEX "; - if ($newkeys[3]==1) $sql_alter.=" FULLTEXT INDEX "; - - $sql_alter.=$_POST['f_position']." ;"; - + $sql_alter.=$_POST['f_position']; + + if ($newkeys[0]==1) $sql_alter.=", ADD PRIMARY KEY (`".$_POST['f_name']."`)"; + if ($newkeys[1]==1) $sql_alter.=", ADD UNIQUE (`".$_POST['f_name']."`)"; + if ($newkeys[2]==1) $sql_alter.=", ADD INDEX (`".$_POST['f_name']."`)"; + if ($newkeys[3]==1) $sql_alter.=", ADD FULLTEXT INDEX (`".$_POST['f_name']."`)"; + + $sql_alter.=";"; + if ($add_sql!="") { $add_sql=$sql_stamm.$add_sql; - $sql_alter="$sql_alter;\n$add_sql;\n"; + $sql_alter="$sql_alter\n$add_sql;"; + } + $res = MSD_DoSQL($sql_alter); + if ($res) + { + echo '
'; + echo '

`'.$_POST['f_name'].'` '.((isset($_POST['editfield'])) ? $lang['L_SQL_CHANGED'] : $lang['L_SQL_CREATED']).'

'; + echo highlight_sql($out).'
'; } - MSD_DoSQL($sql_alter); - - echo '
'; - echo '

`'.$_POST['f_name'].'` '.((isset($_POST['editfield'])) ? $lang['L_SQL_CHANGED'] : $lang['L_SQL_CREATED']).'.

'; - echo highlight_sql($out).'
'; $fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name); } } -mysql_select_db($databases['Name'][$dbid]); +mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['Name'][$dbid]); $sqlt="SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."` ;"; $res=MSD_query($sqlt); -$anz_tabellen=mysql_numrows($res); +$anz_tabellen=mysqli_num_rows($res); $p="sql.php?db=".$databases['Name'][$dbid]."&dbid=$dbid&tablename=$table_edit_name&context=2"; echo ''; @@ -229,12 +294,12 @@ if ($anz_tabellen==0) } else { - + echo ''.$lang['L_SQL_SELECTTABLE'].':   '; echo '  '; @@ -245,20 +310,20 @@ if ($table_edit_name!="") { $sqlf="SHOW FULL FIELDS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name` ;"; $res=MSD_query($sqlf); - $anz_fields=mysql_num_rows($res); + $anz_fields=mysqli_num_rows($res); $fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name); - + if (MSD_NEW_VERSION) $t_engine=(isset($fields_infos['_tableinfo_']['ENGINE'])) ? $fields_infos['_tableinfo_']['ENGINE'] : "MyISAM"; else $t_engine=(isset($fields_infos['_tableinfo_']['TYPE'])) ? $fields_infos['_tableinfo_']['TYPE'] : "MyISAM"; - + $t_charset=(isset($fields_infos['_tableinfo_']['DEFAULT CHARSET'])) ? $fields_infos['_tableinfo_']['DEFAULT CHARSET'] : ""; $t_collation=isset($row['Collation']) ? $row['Collation'] : ""; //(isset($fields_infos['_tableinfo_']['COLLATE'])) ? $fields_infos['_tableinfo_']['COLLATE'] : ""; $t_comment=(isset($fields_infos['_tableinfo_']['COMMENT'])) ? substr($fields_infos['_tableinfo_']['COMMENT'],1,strlen($fields_infos['_tableinfo_']['COMMENT'])-2) : ""; $t_rowformat=(isset($fields_infos['_tableinfo_']['ROW_FORMAT'])) ? $fields_infos['_tableinfo_']['ROW_FORMAT'] : ""; echo "
".$lang['L_TABLE']." `$table_edit_name`
"; $td=''; - + //Tabelleneigenschaften echo ''; echo ''; @@ -271,13 +336,13 @@ if ($table_edit_name!="") echo ''; echo ''; echo '
'.$lang['L_SQL_TBLPROPSOF'].' `'.$table_edit_name.'` ('.$anz_fields.' '.$lang['L_FIELDS'].')'.$lang['L_COMMENT'].'
 

 

'; - + $field_fehler=0; echo '
'.$lang['L_FIELDS_OF_TABLE'].' `'.$table_edit_name.'`
'; - + $d_collate=''; $d_comment=''; - + if (isset($_GET['newfield'])||isset($_GET['editfield'])||$field_fehler>0||isset($_POST['newfield_posted'])) { if (isset($_GET['editfield'])) $id=$_GET['editfield']; @@ -286,7 +351,7 @@ if ($table_edit_name!="") $d_size=(isset($_GET['editfield'])) ? $fields_infos[$id]['size'] : ""; $d_null=(isset($_GET['editfield'])) ? $fields_infos[$id]['null'] : ""; $d_attribute=(isset($_GET['editfield'])) ? $fields_infos[$id]['attributes'] : ""; - + $d_default=''; if (isset($id)&&isset($fields_infos[$id])&&isset($fields_infos[$id]['default'])) { @@ -295,7 +360,7 @@ if ($table_edit_name!="") $d_default=substr($fields_infos[$id]['default'],1,strlen($fields_infos[$id]['default'])-2); } $d_extra=(isset($_GET['editfield'])) ? $fields_infos[$id]['extra'] : ""; - + $d_primary=$d_unique=$d_index=$d_fulltext=0; if (isset($id)) { @@ -306,39 +371,9 @@ if ($table_edit_name!="") if (isset($_GET['editfield'])) { $d_primary=(in_array($fields_infos[$id]['name'],$fields_infos['_primarykeys_'])) ? 1 : 0; - if (isset($fields_infos['_key_'])) - { - for ($i=0; $i'; if (isset($_GET['editfield'])) echo ''; @@ -352,23 +387,23 @@ if ($table_edit_name!="") echo 'NULL
'; echo 'Default
'; echo 'Extra
'; - + echo ''.$lang['L_SQL_INDEXES'].'
'; echo ''; echo '  '; - + echo ''; echo '  '; - + echo ''; echo '  '; - + echo ' '; echo '  '; - + echo ''; echo '  '; - + echo ''.$lang['L_COLLATION'].'
'; echo ''.$lang['L_SQL_ATTRIBUTES'].'
'; echo ''.$lang['L_SQL_ATPOSITION'].':

 

'; + echo '

 

'; } else echo ''.$lang['L_SQL_INSERTNEWFIELD'].'

'; @@ -388,67 +423,46 @@ if ($table_edit_name!="") for ($i=0; $i<$anz_fields; $i++) { $cl=($i%2) ? "dbrow" : "dbrow1"; - if ($i==0) echo ' FieldTypeSizeNULLKeyAttributeDefaultExtraSortierung'; + if ($i==0) echo ' FieldTypeSizeNULLKeyAttributeDefaultExtra'. + $lang['L_COLLATION'].''.$lang['L_COMMENT'].''; echo ''; echo ''; echo 'edit field  '; echo 'delete field  '; - + echo ''; echo ''.($i+1).'.'; - + echo ''.$fields_infos[$i]['name'].''.$fields_infos[$i]['type'].''.$fields_infos[$i]['size'].''; echo ''.get_output_attribut_null($fields_infos[$i]['null']).''; //key if (in_array($fields_infos[$i]['name'],$fields_infos['_primarykeys_'])) echo $icon['key_primary']; - if (isset($fields_infos['_fulltextkey_'])) - { - for ($ii=0; $ii".$fields_infos['_key_'][$ii]['columns'].""; - if ($fields_infos['_key_'][$ii]['name']==$fields_infos[$i]['name']) - { - echo $icon['index']; - break; - } - } - } + if (in_array($fields_infos[$i]['name'],$fields_infos['_fulltextkey_'])) echo $icon['key_fulltext']; + if (in_array($fields_infos[$i]['name'],$fields_infos['_uniquekey_'])) echo $icon['key_unique']; + if (in_array($fields_infos[$i]['name'],$fields_infos['_key_'])) echo $icon['index']; echo ''.$fields_infos[$i]['attributes'].''; echo ''.$fields_infos[$i]['default'].''.$td.$fields_infos[$i]['extra'].''; - echo ''.((MSD_NEW_VERSION) ? $fields_infos[$i]['collate'] : " ").''; + echo ''.((MSD_NEW_VERSION) ? $fields_infos[$i]['collate'] : " ").''; + echo ''.((isset($fields_infos[$i]['comment'])) ? $fields_infos[$i]['comment'] : " ").''; + echo ""; } echo '
'; - + echo '
'.$lang['L_SQL_TABLEINDEXES'].' `'.$table_edit_name.'`
'; - echo ''.((MSD_NEW_VERSION) ? '' : '').''; + echo '
 Index-NameTyp'.$lang['L_SQL_ALLOWDUPS'].''.$lang['L_SQL_CARDINALITY'].'Spalten
+ + + + + + '.((MSD_NEW_VERSION) ? '' : '').' + + + + '; $sqlk="SHOW KEYS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name`;"; $res=MSD_query($sqlk); - $num=mysql_numrows($res); + $num=mysqli_num_rows($res); if ($num==0) { echo ''; @@ -457,83 +471,125 @@ if ($table_edit_name!="") { for ($i=0; $i<$num; $i++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); - //v($row); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); + if (!isset($row['Comment'])) { + $row['Comment'] = ''; + } $cl=($i%2) ? "dbrow" : "dbrow1"; //Images echo ''; echo ''; echo ''; echo ''; + echo ''; + echo ''; if (MSD_NEW_VERSION) echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; } } - echo '
 '.$lang['L_NAME'].''.$lang['L_SQL_COLUMNS'].''.$lang['L_INFO_SIZE'].''.$lang['L_TABLE_TYPE'].''.$lang['L_SQL_ALLOWDUPS'].''.$lang['L_SQL_CARDINALITY'].''.$lang['L_COMMENT'].'
'.$lang['L_SQL_TABLENOINDEXES'].'
'; - //echo '  '; - ///// DH - //erstmal nur fuer Primaerschluessel if ($row['Key_name']=="PRIMARY") { echo ''; echo ''; echo ''; } - ///// DH ende + else + { + echo ''; + echo ''; + echo ''; + } echo ''.($i+1).'.'.$row['Key_name'].''.$row['Column_name'].''; + if (isset($row['Sub_part']) && $row['Sub_part']>0) echo $row['Sub_part']; + echo ''.$row['Index_type'].''.(($row['Non_unique']==1) ? $lang['L_YES'] : $lang['L_NO']).''.(($row['Cardinality']>=0) ? $row['Cardinality'] : $lang['L_NO']).''.$row['Column_name'].''.$row['Comment'].'

'; - - ///// DH + echo '
'; + if ((isset($_GET['sql_createindex']))&&($_GET['sql_createindex']=="1")) + { ?> + + '; echo '
'; - echo '
'.$lang['L_SETPRIMARYKEYSFOR'].' `'.$table_edit_name.'`
'; + echo '
'.$lang['L_SETKEYSFOR'].' `'.$table_edit_name.'`
'; //kopf - echo ''; + echo '
'.$lang['L_PRIMARYKEY_FIELD'].'
'; //body $sqlFelder="DESCRIBE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."`;"; $res=MSD_query($sqlFelder); - $num=mysql_numrows($res); + $num=mysqli_num_rows($res); if ($num==0) { echo ''; } else { - //alle Felder holen + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'.$lang['L_SQL_TABLENOINDEXES'].'
'.$lang['L_NAME'].''.$lang['L_TABLE_TYPE'].'
'; + echo '

'; + + //alle Felder holen $feldArray=Array(); - while ($row=mysql_fetch_array($res)) + echo ''; + echo ''; + + while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { $feldArray[$row['Field']]=$row['Type']; } //Primaerschluessel holen, um automatisch vorzuselektieren $primaryKeys=getPrimaryKeys($databases['Name'][$dbid],$_GET['tablename']); - //eine Select-Box pro Feld anzeigen + //eine Select-Box pro Feld anzeigen, Felder für Name und Typ nur in der ersten Zeile for ($i=0; $i<$num; $i++) { - $cl=($i%2) ? "dbrow" : "dbrow1"; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; } + $i ++; } echo '
#'.$lang['L_PRIMARYKEY_FIELD'].''.$lang['L_INFO_SIZE'].'
'; - echo '
'.($i+1).'.'; + $options ="\n\n".''; + $selectedFeldTyp = false; foreach ($feldArray as $feldName=>$feldTyp) { - echo ''; + if (isset($primaryKeys['name'][$i]) && $primaryKeys['name'][$i]==$feldName) { + $options.=' selected="selected"'; + $selectedFeldTyp = $feldTyp; + } + $options.='>'.$feldName.' ['.$feldTyp.']'; } - echo ''; - echo ''; + $type =explode('(', $selectedFeldTyp); + echo '
'; //Speichern Knopf - echo '
'; + echo '
'; echo '
'; } - ///// DH ende -} \ No newline at end of file +} diff --git a/inc/tabellenabfrage.php b/inc/tabellenabfrage.php index 08c03b3..79f4d74 100644 --- a/inc/tabellenabfrage.php +++ b/inc/tabellenabfrage.php @@ -21,24 +21,24 @@ if ($tblr == 'Backup') $button_name='dump_tbl'; //Info aus der Datenbank lesen MSD_mysql_connect(); - $res=mysql_query('SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`'); - $numrows=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`'); + $numrows=mysqli_num_rows($res); $tbl_zeile=''; for ($i=0; $i < $numrows; $i++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); // 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['db_actual'] . "`.`" . $row['Name'] . "`"; - $res2=@mysql_query($sql_2); + $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2); if ($res2 === false) { - $read_error='(' . mysql_errno() . ') ' . mysql_error(); + $read_error='(' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . ') ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); $row['Rows']='' . $lang['L_ERROR'] . ': ' . $read_error . ''; } else { - $row2=@mysql_fetch_array($res2); + $row2=@mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; } diff --git a/inc/template.php b/inc/template.php index 10a8c96..9716971 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1,6 +1,8 @@ _tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value - // if it's a root-level variable, it'll be like this: - // $this->_tpldata[.][0][varname] == value - var $_tpldata=array(); - - // Hash of filenames for each template handle. - var $files=array(); - - // Root template directory. - var $root=""; - - // this will hash handle names to the compiled code for that handle. - var $compiled_code=array(); - - // This will hold the uncompiled code for that handle. - var $uncompiled_code=array(); - - /** - * Constructor. Simply sets the root dir. - * - */ - function MSDTemplate($root=".") - { - $this->set_rootdir($root); - } - - /** - * Destroys this template object. Should be called when you're done with it, in order - * to clear out the template data so you can load/parse a new template set. - */ - function destroy() - { - $this->_tpldata=array(); - } - - /** - * Sets the template root directory for this Template object. - */ - function set_rootdir($dir) - { - if (!is_dir($dir)) - { - return false; - } - $this->root=$dir; - return true; - } - - /** - * Sets the template filenames for handles. $filename_array - * should be a hash of handle => filename pairs. - */ - function set_filenames($filename_array) - { - if (!is_array($filename_array)) - { - return false; - } - - reset($filename_array); - while (list ($handle, $filename)=each($filename_array)) - { - $this->files[$handle]=$this->make_filename($filename); - } - - return true; - } - - /** - * Load the file for the handle, compile the file, - * and run the compiled code. This will print out - * the results of executing the template. - */ - function pparse($handle) - { - // Edit DSB: autimatically assign language vars - global $lang; - $this->assign_vars($lang); - - if (!$this->loadfile($handle)) - { - die("Template->pparse(): Couldn't load template file for handle $handle"); - } - - // actually compile the template now. - if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) - { - // Actually compile the code now. - $this->compiled_code[$handle]=$this->compile($this->uncompiled_code[$handle]); - } - - // Run the compiled code. - if (defined(TPL_DEBUG) && TPL_DEBUG>0) echo '
'.htmlspecialchars($this->compiled_code[$handle]).'
'; - eval($this->compiled_code[$handle]); - return true; - } - - /** - * Inserts the uncompiled code for $handle as the - * value of $varname in the root-level. This can be used - * to effectively include a template in the middle of another - * template. - * Note that all desired assignments to the variables in $handle should be done - * BEFORE calling this function. - */ - function assign_var_from_handle($varname, $handle) - { - if (!$this->loadfile($handle)) - { - die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); - } - - // Compile it, with the "no echo statements" option on. - $_str=""; - $code=$this->compile($this->uncompiled_code[$handle],true,'_str'); - - // evaluate the variable assignment. - eval($code); - // assign the value of the generated variable to the given varname. - $this->assign_var($varname,$_str); - - return true; - } - - /** - * Block-level variable assignment. Adds a new block iteration with the given - * variable assignments. Note that this should only be called once per block - * iteration. - */ - function assign_block_vars($blockname, $vararray) - { - if (strstr($blockname,'.')) - { - // Nested block. - $blocks=explode('.',$blockname); - $blockcount=sizeof($blocks) - 1; - $str='$this->_tpldata'; - for ($i=0; $i < $blockcount; $i++) - { - $str.='[\'' . $blocks[$i] . '.\']'; - eval('$lastiteration = sizeof(' . $str . ') - 1;'); - $str.='[' . $lastiteration . ']'; - } - // Now we add the block that we're actually assigning to. - // We're adding a new iteration to this block with the given - // variable assignments. - $str.='[\'' . $blocks[$blockcount] . '.\'][] = $vararray;'; - - // Now we evaluate this assignment we've built up. - eval($str); - } - else - { - // Top-level block. - // Add a new iteration to this block with the variable assignments - // we were given. - $this->_tpldata[$blockname . '.'][]=$vararray; - } - - return true; - } - - /** - * Root-level variable assignment. Adds to current assignments, overriding - * any existing variable assignment with the same name. - */ - function assign_vars($vararray) - { - global $lang; - while (list ($key, $val)=each($vararray)) - { - $this->_tpldata['.'][0][$key]=$val; - } - - return true; - } - - /** - * Root-level variable assignment. Adds to current assignments, overriding - * any existing variable assignment with the same name. - */ - function assign_var($varname, $varval) - { - $this->_tpldata['.'][0][$varname]=$varval; - - return true; - } - - /** - * Generates a full path+filename for the given filename, which can either - * be an absolute name, or a name relative to the rootdir for this Template - * object. - */ - function make_filename($filename) - { - // Check if it's an absolute or relative path. - /* - if (substr($filename, 0, 1) != '/') - { - $filename = $this->root . '/' . $filename; - } + var $classname = "MSDTemplate"; + + // variable that holds all the data we'll be substituting into + // the compiled templates. + // ... + // This will end up being a multi-dimensional array like this: + // $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value + // if it's a root-level variable, it'll be like this: + // $this->_tpldata[.][0][varname] == value + var $_tpldata = array(); + + // Hash of filenames for each template handle. + var $files = array(); + + // Root template directory. + var $root = ""; + + // this will hash handle names to the compiled code for that handle. + var $compiled_code = array(); + + // This will hold the uncompiled code for that handle. + var $uncompiled_code = array(); + + /** + * Constructor. Simply sets the root dir. + * + * @param string $root + */ + public function __construct($root = '.') + { + $this->set_rootdir($root); + } + + /** + * Destroys this template object. Should be called when you're done with it, in order + * to clear out the template data so you can load/parse a new template set. + */ + public function destroy() + { + $this->_tpldata = array(); + } + + /** + * Sets the template root directory for this Template object. + */ + public function set_rootdir($dir) + { + if (!is_dir($dir)) { + return false; + } + $this->root = $dir; + + return true; + } + + /** + * Sets the template filenames for handles. $filename_array + * should be a hash of handle => filename pairs. + */ + public function set_filenames($filename_array) + { + if (!is_array($filename_array)) { + return false; + } + + reset($filename_array); + while (list ($handle, $filename) = each($filename_array)) { + $this->files[$handle] = $this->make_filename($filename); + } + + return true; + } + + /** + * Load the file for the handle, compile the file, + * and run the compiled code. This will print out + * the results of executing the template. + */ + public function pparse($handle) + { + // Edit DSB: automatically assign language vars + global $lang; + $this->assign_vars($lang); + + if (!$this->loadfile($handle)) { + die("Template->pparse(): Couldn't load template file for handle $handle"); + } + + // actually compile the template now. + if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) { + // Actually compile the code now. + $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); + } + + // Run the compiled code. + if (defined(TPL_DEBUG) && TPL_DEBUG > 0) { + echo '
' . htmlspecialchars($this->compiled_code[$handle]) . '
'; + } + eval($this->compiled_code[$handle]); + + return true; + } + + /** + * Inserts the uncompiled code for $handle as the + * value of $varname in the root-level. This can be used + * to effectively include a template in the middle of another + * template. + * Note that all desired assignments to the variables in $handle should be done + * BEFORE calling this function. + */ + public function assign_var_from_handle($varname, $handle) + { + if (!$this->loadfile($handle)) { + die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); + } + + // Compile it, with the "no echo statements" option on. + $_str = ""; + $code = $this->compile($this->uncompiled_code[$handle], true, '_str'); + + // evaluate the variable assignment. + eval($code); + // assign the value of the generated variable to the given varname. + $this->assign_var($varname, $_str); + + return true; + } + + /** + * Block-level variable assignment. Adds a new block iteration with the given + * variable assignments. Note that this should only be called once per block + * iteration. + */ + public function assign_block_vars($blockname, $vararray) + { + if (strstr($blockname, '.')) { + // Nested block. + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + $str = '$this->_tpldata'; + for ($i = 0; $i < $blockcount; $i++) { + $str .= '[\'' . $blocks[$i] . '.\']'; + eval('$lastiteration = sizeof(' . $str . ') - 1;'); + $str .= '[' . $lastiteration . ']'; + } + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;'; + + // Now we evaluate this assignment we've built up. + eval($str); + } else { + // Top-level block. + // Add a new iteration to this block with the variable assignments + // we were given. + $this->_tpldata[$blockname . '.'][] = $vararray; + } + + return true; + } + + /** + * Root-level variable assignment. Adds to current assignments, overriding + * any existing variable assignment with the same name. + */ + public function assign_vars($vararray) + { + global $lang; + while (list ($key, $val) = each($vararray)) { + $this->_tpldata['.'][0][$key] = $val; + } + + return true; + } + + /** + * Root-level variable assignment. Adds to current assignments, overriding + * any existing variable assignment with the same name. + */ + public function assign_var($varname, $varval) + { + $this->_tpldata['.'][0][$varname] = $varval; + + return true; + } + + /** + * Generates a full path+filename for the given filename, which can either + * be an absolute name, or a name relative to the rootdir for this Template + * object. + */ + public function make_filename($filename) + { + // Check if it's an absolute or relative path. + /* + if (substr($filename, 0, 1) != '/') + { + $filename = $this->root . '/' . $filename; + } */ - if (!file_exists($filename)) - { - die("Template->make_filename(): Error - file $filename does not exist"); - } - - return $filename; - } - - /** - * If not already done, load the file for the given handle and populate - * the uncompiled_code[] hash with its code. Do not compile. - */ - function loadfile($handle) - { - // If the file for this handle is already loaded and compiled, do nothing. - if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) - { - return true; - } - - // If we don't have a file assigned to this handle, die. - if (!isset($this->files[$handle])) - { - die("Template->loadfile(): No file specified for handle $handle"); - } - - $filename=$this->files[$handle]; - - $str=implode("",@file($filename)); - if (empty($str)) - { - die("Template->loadfile(): File $filename for handle $handle is empty"); - } - - $this->uncompiled_code[$handle]=$str; - - return true; - } - - /** - * Compiles the given string of code, and returns - * the result in a string. - * If "do_not_echo" is true, the returned code will not be directly - * executable, but can be used as part of a variable assignment - * for use in assign_code_from_handle(). - */ - function compile($code, $do_not_echo=false, $retvar='') - { - // replace \ with \\ and then ' with \'. - $code=str_replace('\\','\\\\',$code); - $code=str_replace('\'','\\\'',$code); + if (!file_exists($filename)) { + die("Template->make_filename(): Error - file $filename does not exist"); + } - - // change template varrefs into PHP varrefs - + return $filename; + } - // This one will handle varrefs WITH namespaces - $varrefs=array(); - preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is',$code,$varrefs); - $varcount=sizeof($varrefs[1]); - for ($i=0; $i < $varcount; $i++) - { - $namespace=$varrefs[1][$i]; - $varname=$varrefs[3][$i]; - $new=$this->generate_block_varref($namespace,$varname); - - $code=str_replace($varrefs[0][$i],$new,$code); - } - - // This will handle the remaining root-level varrefs - $code=preg_replace('#\{([a-z0-9\-_]*?)\}#is','\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'',$code); - - // Break it up into lines. - $code_lines=explode("\n",$code); - - $block_nesting_level=0; - $block_names=array(); - $block_names[0]="."; - - // Second: prepend echo ', append ' . "\n"; to each line. - $line_count=sizeof($code_lines); - for ($i=0; $i < $line_count; $i++) - { - $code_lines[$i]=chop($code_lines[$i]); - if (preg_match('##',$code_lines[$i],$m)) - { - $n[0]=$m[0]; - $n[1]=$m[1]; - - // Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :) - if (preg_match('##',$code_lines[$i],$n)) - { - $block_nesting_level++; - $block_names[$block_nesting_level]=$m[1]; - if ($block_nesting_level < 2) - { - // Block is not nested. - $code_lines[$i]='$_' . $n[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;'; - $code_lines[$i].="\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)'; - $code_lines[$i].="\n" . '{'; - } - else - { - // This block is nested. - + /** + * If not already done, load the file for the given handle and populate + * the uncompiled_code[] hash with its code. Do not compile. + */ + public function loadfile($handle) + { + // If the file for this handle is already loaded and compiled, do nothing. + if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) { + return true; + } - // Generate a namespace string for this block. - $namespace=implode('.',$block_names); - // strip leading period from root level.. - $namespace=substr($namespace,2); - // Get a reference to the data array for this block that depends on the - // current indices of all parent blocks. - $varref=$this->generate_block_data_ref($namespace,false); - // Create the for loop code to iterate over this block. - $code_lines[$i]='$_' . $n[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;'; - $code_lines[$i].="\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)'; - $code_lines[$i].="\n" . '{'; - } - - // We have the end of a block. - unset($block_names[$block_nesting_level]); - $block_nesting_level--; - $code_lines[$i].='} // END ' . $n[1]; - $m[0]=$n[0]; - $m[1]=$n[1]; - } - else - { - // We have the start of a block. - $block_nesting_level++; - $block_names[$block_nesting_level]=$m[1]; - if ($block_nesting_level < 2) - { - // Block is not nested. - $code_lines[$i]='$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;'; - $code_lines[$i].="\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)'; - $code_lines[$i].="\n" . '{'; - } - else - { - // This block is nested. - + // If we don't have a file assigned to this handle, die. + if (!isset($this->files[$handle])) { + die("Template->loadfile(): No file specified for handle $handle"); + } - // Generate a namespace string for this block. - $namespace=implode('.',$block_names); - // strip leading period from root level.. - $namespace=substr($namespace,2); - // Get a reference to the data array for this block that depends on the - // current indices of all parent blocks. - $varref=$this->generate_block_data_ref($namespace,false); - // Create the for loop code to iterate over this block. - $code_lines[$i]='$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;'; - $code_lines[$i].="\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)'; - $code_lines[$i].="\n" . '{'; - } - } - } - else if (preg_match('##',$code_lines[$i],$m)) - { - // We have the end of a block. - unset($block_names[$block_nesting_level]); - $block_nesting_level--; - $code_lines[$i]='} // END ' . $m[1]; - } - else - { - // We have an ordinary line of code. - if (!$do_not_echo) - { - $code_lines[$i]='echo \'' . $code_lines[$i] . '\' . "\\n";'; - } - else - { - $code_lines[$i]='$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";'; - } - } - } - - // Bring it back into a single string of lines of code. - $code=implode("\n",$code_lines); - return $code; - - } - - /** - * Generates a reference to the given variable inside the given (possibly nested) - * block namespace. This is a string of the form: - * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' - * It's ready to be inserted into an "echo" line in one of the templates. - * NOTE: expects a trailing "." on the namespace. - */ - function generate_block_varref($namespace, $varname) - { - // Strip the trailing period. - $namespace=substr($namespace,0,strlen($namespace) - 1); - - // Get a reference to the data block for this namespace. - $varref=$this->generate_block_data_ref($namespace,true); - // Prepend the necessary code to stick this in an echo line. - + $filename = $this->files[$handle]; - // Append the variable reference. - $varref.='[\'' . $varname . '\']'; - - $varref='\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \''; - - return $varref; - - } - - /** - * Generates a reference to the array of data values for the given - * (possibly nested) block namespace. This is a string of the form: - * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] - * - * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. - * NOTE: does not expect a trailing "." on the blockname. - */ - function generate_block_data_ref($blockname, $include_last_iterator) - { - // Get an array of the blocks involved. - $blocks=explode(".",$blockname); - $blockcount=sizeof($blocks) - 1; - $varref='$this->_tpldata'; - // Build up the string with everything but the last child. - for ($i=0; $i < $blockcount; $i++) - { - $varref.='[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]'; - } - // Add the block reference for the last child. - $varref.='[\'' . $blocks[$blockcount] . '.\']'; - // Add the iterator for the last child if requried. - if ($include_last_iterator) - { - $varref.='[$_' . $blocks[$blockcount] . '_i]'; - } - - return $varref; - } + $str = implode("", @file($filename)); + if (empty($str)) { + die("Template->loadfile(): File $filename for handle $handle is empty"); + } + + $this->uncompiled_code[$handle] = $str; + + return true; + } + + /** + * Compiles the given string of code, and returns + * the result in a string. + * If "do_not_echo" is true, the returned code will not be directly + * executable, but can be used as part of a variable assignment + * for use in assign_code_from_handle(). + */ + public function compile($code, $do_not_echo = false, $retvar = '') + { + // replace \ with \\ and then ' with \'. + $code = str_replace('\\', '\\\\', $code); + $code = str_replace('\'', '\\\'', $code); + + + // change template varrefs into PHP varrefs + + + // This one will handle varrefs WITH namespaces + $varrefs = array(); + preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs); + $varcount = sizeof($varrefs[1]); + for ($i = 0; $i < $varcount; $i++) { + $namespace = $varrefs[1][$i]; + $varname = $varrefs[3][$i]; + $new = $this->generate_block_varref($namespace, $varname); + + $code = str_replace($varrefs[0][$i], $new, $code); + } + + // This will handle the remaining root-level varrefs + $code = preg_replace( + '#\{([a-z0-9\-_]*?)\}#is', + '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', + $code + ); + + // Break it up into lines. + $code_lines = explode("\n", $code); + + $block_nesting_level = 0; + $block_names = array(); + $block_names[0] = "."; + + // Second: prepend echo ', append ' . "\n"; to each line. + $line_count = sizeof($code_lines); + for ($i = 0; $i < $line_count; $i++) { + $code_lines[$i] = chop($code_lines[$i]); + if (preg_match('##', $code_lines[$i], $m)) { + $n[0] = $m[0]; + $n[1] = $m[1]; + + // Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :) + if (preg_match('##', $code_lines[$i], $n)) { + $block_nesting_level++; + $block_names[$block_nesting_level] = $m[1]; + if ($block_nesting_level < 2) { + // Block is not nested. + $code_lines[$i] = '$_' . $n[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] + . '.\']) ) ? sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;'; + $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] + . '_count; $_' . $n[1] . '_i++)'; + $code_lines[$i] .= "\n" . '{'; + } else { + // This block is nested. + + + // Generate a namespace string for this block. + $namespace = implode('.', $block_names); + // strip leading period from root level.. + $namespace = substr($namespace, 2); + // Get a reference to the data array for this block that depends on the + // current indices of all parent blocks. + $varref = $this->generate_block_data_ref($namespace, false); + // Create the for loop code to iterate over this block. + $code_lines[$i] = '$_' . $n[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref + . ') : 0;'; + $code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] + . '_count; $_' . $n[1] . '_i++)'; + $code_lines[$i] .= "\n" . '{'; + } + + // We have the end of a block. + unset($block_names[$block_nesting_level]); + $block_nesting_level--; + $code_lines[$i] .= '} // END ' . $n[1]; + $m[0] = $n[0]; + $m[1] = $n[1]; + } else { + // We have the start of a block. + $block_nesting_level++; + $block_names[$block_nesting_level] = $m[1]; + if ($block_nesting_level < 2) { + // Block is not nested. + $code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] + . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;'; + $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] + . '_count; $_' . $m[1] . '_i++)'; + $code_lines[$i] .= "\n" . '{'; + } else { + // This block is nested. + + + // Generate a namespace string for this block. + $namespace = implode('.', $block_names); + // strip leading period from root level.. + $namespace = substr($namespace, 2); + // Get a reference to the data array for this block that depends on the + // current indices of all parent blocks. + $varref = $this->generate_block_data_ref($namespace, false); + // Create the for loop code to iterate over this block. + $code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref + . ') : 0;'; + $code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] + . '_count; $_' . $m[1] . '_i++)'; + $code_lines[$i] .= "\n" . '{'; + } + } + } else { + if (preg_match('##', $code_lines[$i], $m)) { + // We have the end of a block. + unset($block_names[$block_nesting_level]); + $block_nesting_level--; + $code_lines[$i] = '} // END ' . $m[1]; + } else { + // We have an ordinary line of code. + if (!$do_not_echo) { + $code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";'; + } else { + $code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";'; + } + } + } + } + + // Bring it back into a single string of lines of code. + $code = implode("\n", $code_lines); + + return $code; + + } + + /** + * Generates a reference to the given variable inside the given (possibly nested) + * block namespace. This is a string of the form: + * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' + * It's ready to be inserted into an "echo" line in one of the templates. + * NOTE: expects a trailing "." on the namespace. + */ + public function generate_block_varref($namespace, $varname) + { + // Strip the trailing period. + $namespace = substr($namespace, 0, strlen($namespace) - 1); + + // Get a reference to the data block for this namespace. + $varref = $this->generate_block_data_ref($namespace, true); + // Prepend the necessary code to stick this in an echo line. + + + // Append the variable reference. + $varref .= '[\'' . $varname . '\']'; + + $varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \''; + + return $varref; + + } + + /** + * Generates a reference to the array of data values for the given + * (possibly nested) block namespace. This is a string of the form: + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] + * + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. + * NOTE: does not expect a trailing "." on the blockname. + */ + public function generate_block_data_ref($blockname, $include_last_iterator) + { + // Get an array of the blocks involved. + $blocks = explode(".", $blockname); + $blockcount = sizeof($blocks) - 1; + $varref = '$this->_tpldata'; + // Build up the string with everything but the last child. + for ($i = 0; $i < $blockcount; $i++) { + $varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]'; + } + // Add the block reference for the last child. + $varref .= '[\'' . $blocks[$blockcount] . '.\']'; + // Add the iterator for the last child if requried. + if ($include_last_iterator) { + $varref .= '[$_' . $blocks[$blockcount] . '_i]'; + } + + return $varref; + } } - -?> diff --git a/index.php b/index.php index c8c3215..1669cef 100644 --- a/index.php +++ b/index.php @@ -28,4 +28,4 @@ if (!file_exists("./work/config/mysqldumper.php")) Verbindungsdaten aus connstr auslesen if (isset($connstr) && !empty($connstr)) { - $p=explode("|",$connstr); + $p=explode("|", $connstr); $dbhost=$config['dbhost']=$p[0]; $dbuser=$config['dbuser']=$p[1]; $dbpass=$config['dbpass']=$p[2]; @@ -50,7 +51,7 @@ else //Variabeln $phase=( isset($phase) ) ? $phase : 0; if (isset($_POST['manual_db'])) $manual_db=trim($_POST['manual_db']); -$connstr="$dbhost|$dbuser|$dbpass|$dbport|$dbsocket|$manual_db"; +$connstr = "$dbhost|$dbuser|$dbpass|$dbport|$dbsocket|$manual_db"; $connection=''; $delfiles=Array(); @@ -135,25 +136,25 @@ echo '

Version ' . MSD_ switch ($phase) { - + case 0: // Anfang - Sprachauswahl // da viele ja nicht in die Anleitung schauen -> versuchen die Perldateien automatisch richtig zu chmodden @chmod('./msd_cron/crondump.pl',0755); @chmod('./msd_cron/perltest.pl',0755); @chmod('./msd_cron/simpletest.pl',0755); - + echo '

'; echo ''; echo '
LanguageTools
'; echo GetLanguageCombo("radio","radio","language",""); echo '
","
'; - + foreach ($lang['languages'] as $key) { echo ( "\n" ); } - + echo ( "\n
" ); echo ''; break; @@ -170,7 +171,7 @@ switch ($phase) { $tmp=file("config.php"); $stored=0; - + if (!isset($_POST['dbconnect'])) { // Erstaufruf - Daten aus config.php auslesen @@ -214,10 +215,10 @@ switch ($phase) if ($stored == 6) break; } } - + if (!isset($config['dbport'])) $config['dbport']=""; if (!isset($config['dbsocket'])) $config['dbsocket']=""; - + echo '
'; echo ''; echo ''; @@ -227,35 +228,41 @@ switch ($phase) echo ''; echo ''; - + echo ''; if (isset($_POST['dbconnect'])) { echo ''; echo ''; } echo '
' . $lang['L_DB_HOST'] . ':
'; echo $lang['L_PORT'] . ':  ' . $lang['L_INSTALL_HELP_PORT'] . '
' . $lang['L_SOCKET'] . ':  ' . $lang['L_INSTALL_HELP_SOCKET'] . '
' . $lang['L_TESTCONNECTION'] . ':
' . $lang['L_DBCONNECTION'] . '
'; $connection=MSD_mysql_connect(); - + if ($connection === false) { echo '

' . $lang['L_CONNECTIONERROR'] . '

 '; } else { + $databases = array(); echo '

' . $lang['L_CONNECTION_OK'] . '

'; $connection="ok"; $connstr="$dbhost|$dbuser|$dbpass|$dbport|$dbsocket|$manual_db"; echo ''; if ($manual_db > '') SearchDatabases(1,$manual_db); else SearchDatabases(1); + if (!isset($databases['Name']) || !in_array($manual_db, $databases['Name'])) { + // conect to manual db was not successful + $connstr = substr($connstr,0, strlen($connstr)-strlen($manual_db)); + $manual_db = ''; + } } echo '

'; - + if ($connection == "ok") { if (!isset($databases['Name'][0])) echo '
' . $lang['L_NO_DB_FOUND_INFO']; - + echo '
'; echo ' @@ -268,14 +275,13 @@ switch ($phase) } } break; - + case 2: // echo '
MySQLDumper - ' . $lang['L_CONFBASIC'] . '
'; $tmp=@file("config.php"); $stored=0; for ($i=0; $i < count($tmp); $i++) { - if (substr($tmp[$i],0,17) == '$config[\'dbhost\']') { $tmp[$i]='$config[\'dbhost\'] = \'' . $dbhost . '\';' . "\n"; @@ -301,7 +307,7 @@ switch ($phase) $tmp[$i]='$config[\'dbpass\'] = \'' . $dbpass . '\';' . "\n"; $stored++; } - + if ($stored == 6) break; } $ret=true; @@ -330,30 +336,10 @@ switch ($phase) echo 'document.forms["continue"].submit();'; echo ''; } - - break; - - case 3: // - if (ini_get('safe_mode') == 1) $nextphase=10; - else $nextphase=$phase + 1; - echo '
' . $lang['L_EDITCONF'] . '
'; - echo ' -
   -    - '; - echo ''; - echo '
'; - - break; - case 4: //Verzeichnisse - + break; + + case 4: //Verzeichnisse if (isset($_POST['submit'])) { $ret=true; @@ -364,21 +350,20 @@ switch ($phase) } else $ret=false; - + if ($ret == false) { echo '
' . $lang['L_ERRORMAN'] . ' config.php ' . $lang['L_MANUELL'] . '.'; die(); } } - + echo '
' . $lang['L_CREATEDIRS'] . '
'; - $check_dirs=ARRAY( - - "work/", - "work/config/", - "work/log/", + + "work/", + "work/config/", + "work/log/", "work/backup/" ); $msg=''; @@ -387,14 +372,14 @@ switch ($phase) $success=SetFileRechte($d,1,0777); if ($success != 1) $msg.=$success . '
'; } - + if ($msg > '') echo '' . $msg . ''; - + $iw[0]=IsWritable("work"); $iw[1]=IsWritable("work/config"); $iw[2]=IsWritable("work/log"); $iw[3]=IsWritable("work/backup"); - +/* // save manual_db if ($manual_db > '') { @@ -407,14 +392,14 @@ switch ($phase) @chmod('./' . $config['files']['dbs_manual'],0777); } } - +*/ if ($iw[0] && $iw[1] && $iw[2] && $iw[3]) { echo ''; } - + echo '
'; echo ''; echo ''; @@ -427,16 +412,16 @@ switch ($phase) break; case 5: echo '
' . $lang['L_LASTSTEP'] . '
'; - + echo '

' . $lang['L_INSTALLFINISHED'] . '

'; SetDefault(1); include ( "language/" . $language . "/lang_install.php" ); - + // direkt zum Start des Dumeprs echo ''; break; case 9: - + clearstatcache(); $iw[0]=IsWritable("work"); $iw[1]=IsWritable("work/config"); @@ -444,16 +429,16 @@ switch ($phase) $iw[3]=IsWritable("work/backup"); echo '
' . $lang['L_FTPMODE'] . '
'; echo '

' . $lang['L_SAFEMODEDESC'] . '

'; - + echo '
' . $lang['L_DIR'] . '' . $lang['L_RECHTE'] . '' . $lang['L_STATUS'] . '
work' . Rechte("work") . '' . ( ( $iw[0] ) ? $img_ok : $img_failed ) . '
'; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; - + // Wenn Verzeichnisse erstellt wurden - direkt weitermachen if ($iw[0] && $iw[1] && $iw[2] && $iw[3]) { @@ -462,7 +447,7 @@ switch ($phase) echo ''; } echo '
' . $lang['L_IDOMANUAL'] . '
' . $lang['L_DOFROM'] . '
' . Realpfad('./') . '
' . $lang['L_DOFROM'] . '
' . basePath() . '
work' . ( ( $iw[0] ) ? $img_ok : $img_failed ) . '
work/config' . ( ( $iw[1] ) ? $img_ok : $img_failed ) . '
work/log' . ( ( $iw[2] ) ? $img_ok : $img_failed ) . '
work/backup' . ( ( $iw[3] ) ? $img_ok : $img_failed ) . '
'; - + break; case 10: //safe_mode FTP $config['ftp_useSSL']=0; @@ -474,11 +459,11 @@ switch ($phase) if (!isset($install_ftp_port) || $install_ftp_port < 1) $install_ftp_port=21; echo '
' . $lang['L_FTPMODE'] . '
'; echo '

' . $lang['L_SAFEMODEDESC'] . '

'; - + echo ' '; - + //echo '
'; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -514,13 +499,13 @@ switch ($phase) echo '
' . $lang['L_IDOMANUAL'] . '
' . $lang['L_DOFROM'] . '
' . Realpfad('./') . '
' . $lang['L_DOFROM'] . '
' . basePath() . '
work' . ( ( $iw[0] ) ? $img_ok : $img_failed ) . '
work/config' . ( ( $iw[1] ) ? $img_ok : $img_failed ) . '
work/log' . ( ( $iw[2] ) ? $img_ok : $img_failed ) . '
'; } //echo '
'; - + break; - + case 11: //FTP-Create Dirs echo '
' . $lang['L_FTPMODE'] . '
'; if (CreateDirsFTP() == 1) @@ -547,14 +532,14 @@ switch ($phase) { // das Verzeichnis wurde korrekt gelöscht echo '

' . $lang['L_UI6'] . '

'; - echo $lang['L_UI7'] . "
\"" . Realpfad("./") . "\"
" . $lang['L_MANUELL'] . ".

"; + echo $lang['L_UI7'] . "
\"" . basePath() . "\"
" . $lang['L_MANUELL'] . ".

"; echo '' . $lang['L_UI8'] . ''; - + } else { echo '

' . $lang['L_UI9'] . '"' . $paths[count($paths) - 1] . '"'; - + } break; } @@ -592,7 +577,7 @@ function rec_rmdir($path) { return -2; } - + // gehe durch das Verzeichnis while ($entry=@readdir($dir)) { @@ -644,19 +629,19 @@ function rec_rmdir($path) return -3; // tut mir schrecklich leid... } } - + // schliesse nun das Verzeichnis @closedir($dir); - + // versuche nun, das Verzeichnis zu loeschen $res=@rmdir($path); - + // gab's einen Fehler? if (!$res) { return -2; // melde ihn } - + // alles ok return 0; } diff --git a/js/script.js b/js/script.js index c0037b8..fb51f33 100644 --- a/js/script.js +++ b/js/script.js @@ -1,55 +1,55 @@ -var NS=(document.layers);var IE=(document.all);function obj_enable(objid) -{var e=document.getElementById(objid);e.disabled=false;} -function obj_disable(objid) -{var e=document.getElementById(objid);e.disabled=true;} -function setactiveMenuFromContent() -{var a=parent.MySQL_Dumper_content.location.href;var menuid=1;if(a.indexOf("config_overview.php")!=-1)menuid=2;if(a.indexOf("filemanagement.php")!=-1) -{if(a.indexOf("action=dump")!=-1)menuid=3;if(a.indexOf("action=restore")!=-1)menuid=4;if(a.indexOf("action=files")!=-1)menuid=5;} -if(a.indexOf("sql.php")!=-1)menuid=6;if(a.indexOf("log.php")!=-1)menuid=7;if(a.indexOf("help.php")!=-1)menuid=8;setMenuActive('m'+menuid);} -function setMenuActive(id){for(var i=1;i<=10;i++){var objid='m'+i;if(id==objid) -{parent.frames[0].document.getElementById(objid).className='active';} -else -{if(parent.frames[0].document.getElementById(objid))parent.frames[0].document.getElementById(objid).className='';}}} -function GetSelectedFilename() -{var a="";var obj=document.getElementsByName("file[]");var anz=0;if(!obj.length) -{if(obj.checked){a+=obj.value;}} -else -{for(i=0;i 1","gd");}} -function SelectMD(v,anz) -{for(i=0;i0){document.getElementById('sqlstring'+i).value=obj.options[obj.selectedIndex].value;document.getElementById('sqlname'+i).value=obj.options[obj.selectedIndex].text;}} -function DisplayExport(s){document.getElementById("export_working").InnerHTML=s;} -function SelectedTableCount(){var obj=document.getElementsByName('f_export_tables[]')[0];var anz=0;for(var i=0;i 1","gd");}} +function SelectMD(v,anz) +{for(i=0;i0){document.getElementById('sqlstring'+i).value=obj.options[obj.selectedIndex].value;document.getElementById('sqlname'+i).value=obj.options[obj.selectedIndex].text;}} +function DisplayExport(s){document.getElementById("export_working").InnerHTML=s;} +function SelectedTableCount(){var obj=document.getElementsByName('f_export_tables[]')[0];var anz=0;for(var i=0;i \ No newline at end of file diff --git a/language/ar/lang_config_overview.php b/language/ar/lang_config_overview.php index 4595975..705d2f7 100644 --- a/language/ar/lang_config_overview.php +++ b/language/ar/lang_config_overview.php @@ -104,10 +104,7 @@ $lang['L_CREATE_CONFIGFILE']="انشاء تهيئة جديده للملف"; $lang['L_ERROR_LOADING_CONFIGFILE']="لا يستطيع تحميل ملف التهيئة \"%s\"."; $lang['L_BACKUP_DBS_PHP']="قواعدة البيانات الى النسخ الاحتياطي (PHP)"; $lang['L_BACKUP_DBS_PERL']="قواعد البيانات الى النسخ الاحتياطي (PERL)"; -$lang['L_CRON_COMMENT']="ادخل تعليقا - - -"; +$lang['L_CRON_COMMENT']="ادخل تعليقا"; $lang['L_AUTODETECT']="auto detect"; diff --git a/language/ar/lang_filemanagement.php b/language/ar/lang_filemanagement.php index c233492..f04e517 100644 --- a/language/ar/lang_filemanagement.php +++ b/language/ar/lang_filemanagement.php @@ -76,6 +76,5 @@ $lang['L_CHOOSE_CHARSET']="MySQLDumper لا يمكن الكشف عن الترم
اذا واجهت اي مشكلة مع بعض الاحرف في الاستعادة يمكنك تكرار عملية النسخ الاحتياطي واختيار مجموعة اخرى.
حظا موفقا. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/ar/lang_main.php b/language/ar/lang_main.php index 00d3ee7..0a75ec5 100644 --- a/language/ar/lang_main.php +++ b/language/ar/lang_main.php @@ -60,7 +60,7 @@ $lang['L_WRONG_RIGHTS']="الملف او الدليل '%s' لايمكن الكت الحقوق (chmod)ليست المجموعة او ان المكلية غير صحيحة.
استخدم برامج بروتكول FTP-لنقل ملفاتك.
الملف او الدليل من الضروري ان يستعدا %s.
"; -$lang['L_CANT_CREATE_DIR']="Couldn' لا يستطيع انشاء '%s'. +$lang['L_CANT_CREATE_DIR']="Couldn' لا يستطيع انشاء '%s'. من فضلك استخدم برامج برتكول FTP-لنقل الملفات. @@ -75,6 +75,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="لا يستطيع ايجاد الملف"; ?> \ No newline at end of file diff --git a/language/ar/lang_sql.php b/language/ar/lang_sql.php index d0b28a1..fe02cc5 100644 --- a/language/ar/lang_sql.php +++ b/language/ar/lang_sql.php @@ -186,6 +186,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="الحجم"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/ch/lang.php b/language/ch/lang.php index 5dd513f..53242f6 100644 --- a/language/ch/lang.php +++ b/language/ch/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Backups"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/ch/lang_filemanagement.php b/language/ch/lang_filemanagement.php index e8a54cf..ca83c74 100644 --- a/language/ch/lang_filemanagement.php +++ b/language/ch/lang_filemanagement.php @@ -71,6 +71,5 @@ $lang['L_ENCODING']="Kodierig"; $lang['L_FM_CHOOSE_ENCODING']="Kodierig vo de Backupdatei wähle"; $lang['L_CHOOSE_CHARSET']="Leider hät nöd chöne automatich ermittlet mit welem Zeichesatz diä Backupdatei sinerziit aagleit worde isch.
Sie müend diä Kodierig, i dere Zeichechette i dere Datei sind, vo Hand aagäh.
Dänn stellt MySQLDumper diä Verbindigskännig zum MySQL-Server uf de usgwählti Zeichesatz und fangt mit de Reschtaurierig vo de Date a.>br>Sötted Si nach de Reschtaurierig Problem mit Sonderzeiche ha, chönd Si probiere, das Backup mit ere andere Zeichesatzuswahl z reschtauriere.
Vill Glück. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/ch/lang_main.php b/language/ch/lang_main.php index d008dc2..35ff9f4 100644 --- a/language/ch/lang_main.php +++ b/language/ch/lang_main.php @@ -68,6 +68,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="Han diä Datei nöd gfunde"; ?> \ No newline at end of file diff --git a/language/ch/lang_sql.php b/language/ch/lang_sql.php index daf8fb1..6855da5 100644 --- a/language/ch/lang_sql.php +++ b/language/ch/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Grössi"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/da/lang.php b/language/da/lang.php index 4e26e5b..cadeb10 100644 --- a/language/da/lang.php +++ b/language/da/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Backups"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/da/lang_filemanagement.php b/language/da/lang_filemanagement.php index 031ff99..1deacca 100644 --- a/language/da/lang_filemanagement.php +++ b/language/da/lang_filemanagement.php @@ -67,19 +67,13 @@ $lang['L_CONVERT_FINISHED']="Konvertering afsluttet, '%s' blev skrevet korrekt." $lang['L_NO_MSD_BACKUPFILE']="Backups af andre scripts"; $lang['L_MAX_UPLOAD_SIZE']="Maksimal filstørrelse"; $lang['L_MAX_UPLOAD_SIZE_INFO']="Hvis din Dumpfil er større end den ovennævnte grænse, skal du uploade den via FTP til folderen \"work/backup\". -Derefter kan du vælge den og begynde genetableringsprocessen. - - -"; +Derefter kan du vælge den og begynde genetableringsprocessen."; $lang['L_ENCODING']="encoding"; $lang['L_FM_CHOOSE_ENCODING']="Choose encoding of backup file"; $lang['L_CHOOSE_CHARSET']="MySQLDumper couldn't detect the encoding of the backup file automatically.
You must choose the charset with which this backup was saved.
If you discover any problems with some characters after restoring, you can repeat the backup-progress and then choose another character set. -
Good luck. ;) - -"; +
Good luck. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/da/lang_main.php b/language/da/lang_main.php index 832685e..1ea4ae9 100644 --- a/language/da/lang_main.php +++ b/language/da/lang_main.php @@ -71,6 +71,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="kunne ikke finde fil"; ?> \ No newline at end of file diff --git a/language/da/lang_sql.php b/language/da/lang_sql.php index 09871c4..5bc982f 100644 --- a/language/da/lang_sql.php +++ b/language/da/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Størrelse"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/de/lang.php b/language/de/lang.php index ece228a..1a272de 100644 --- a/language/de/lang.php +++ b/language/de/lang.php @@ -52,7 +52,7 @@ $lang['L_MAX_BACKUP_FILES_EACH2']="für jede Datenbank"; $lang['L_SAVING_DB_FORM']="Datenbank"; $lang['L_TESTCONNECTION']="Verbindung testen"; $lang['L_BACK_TO_MINISQL']="Datenbank bearbeiten"; -$lang['L_CREATE']="anlegen"; +$lang['L_CREATE']="Anlegen"; $lang['L_VARIABELN']="Variablen"; $lang['L_STATUSINFORMATIONEN']="Statusinformationen"; $lang['L_VERSIONSINFORMATIONEN']="Versionsinformationen"; @@ -61,7 +61,7 @@ $lang['L_BACKUPFILESANZAHL']="Im Backup-Verzeichnis befinden sich"; $lang['L_LASTBACKUP']="Letztes Backup"; $lang['L_NOTAVAIL']="nicht verfügbar"; $lang['L_VOM']="vom"; -$lang['L_MYSQLVARS']="MySQL-Variabeln"; +$lang['L_MYSQLVARS']="MySQL-Variablen"; $lang['L_MYSQLSYS']="MySQL-Befehle"; $lang['L_STATUS']="Status"; $lang['L_PROZESSE']="Prozesse"; @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Sicherungsdateien"; $lang['L_MINUTES']="Minuten"; $lang['L_PAGE_REFRESHS']="Seitenaufrufe"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Setzen neuer Indizes für die Tabelle"; +$lang['L_KEY_CONFIRMDELETE']="Index wirklich löschen?"; ?> \ No newline at end of file diff --git a/language/de/lang_config_overview.php b/language/de/lang_config_overview.php index f6af07d..ddea076 100644 --- a/language/de/lang_config_overview.php +++ b/language/de/lang_config_overview.php @@ -104,10 +104,7 @@ $lang['L_CREATE_CONFIGFILE']="Eine neue Konfigurationsdatei anlegen"; $lang['L_ERROR_LOADING_CONFIGFILE']="Die Konfigurationsdatei \"%s\" konnte nicht geladen werden."; $lang['L_BACKUP_DBS_PHP']="zu sichernde DBs (PHP)"; $lang['L_BACKUP_DBS_PERL']="zu sichernde DBs (PERL)"; -$lang['L_CRON_COMMENT']="Kommentar eingeben - - -"; +$lang['L_CRON_COMMENT']="Kommentar eingeben"; $lang['L_AUTODETECT']="automatisch ermitteln"; diff --git a/language/de/lang_filemanagement.php b/language/de/lang_filemanagement.php index 740ebda..1c632cc 100644 --- a/language/de/lang_filemanagement.php +++ b/language/de/lang_filemanagement.php @@ -28,8 +28,7 @@ $lang['L_FM_RESTORE']="Wiederherstellen"; $lang['L_FM_ALERTRESTORE1']="Soll die Datenbank "; $lang['L_FM_ALERTRESTORE2']="mit den Inhalten der Datei"; $lang['L_FM_ALERTRESTORE3']="wiederhergestellt werden?"; -$lang['L_FM_DELETE']="Ausgewählte Dateien -löschen"; +$lang['L_FM_DELETE']="Ausgewählte Dateien löschen"; $lang['L_FM_ASKDELETE1']="Möchten Sie die Datei(en) "; $lang['L_FM_ASKDELETE2']="wirklich löschen?"; $lang['L_FM_ASKDELETE3']="Möchten Sie Autodelete nach den eingestellten Regeln jetzt ausführen?"; @@ -38,7 +37,7 @@ $lang['L_FM_ASKDELETE5']="Möchten Sie alle Backup-Dateien mit "; $lang['L_FM_ASKDELETE5_2']="_* jetzt löschen?"; $lang['L_FM_DELETEAUTO']="Autodelete manuell ausführen"; $lang['L_FM_DELETEALL']="Alle Backup-Dateien löschen"; -$lang['L_FM_DELETEALLFILTER']="Alle löschen mit"; +$lang['L_FM_DELETEALLFILTER']="Alle löschen mit "; $lang['L_FM_DELETEALLFILTER2']="_*"; $lang['L_FM_STARTDUMP']="Neues Backup starten"; $lang['L_FM_FILEUPLOAD']="Datei hochladen"; @@ -75,11 +74,8 @@ $lang['L_CHOOSE_CHARSET']="Leider konnte nicht automatisch ermittelt werden mit
Sie müssen die Kodierung, in der Zeichenketten in dieser Datei vorliegen, manuell angeben.
Danach stellt MySQLDumper die Verbindungskennung zum MySQL-Server auf den ausgewählten Zeichensatz und beginnt mit der Wiederherstellung der Daten.
Sollten Sie nach der Wiederherstellung Probleme mit Sonderzeichen entdecken, so können Sie versuchen, das Backup mit einer anderen Zeichensatzauswahl wiederherzustellen. -
Viel Glück. ;) - - -"; +
Viel Glück. ;)"; $lang['L_DOWNLOAD_FILE']="Datei herunterladen"; - +$lang['L_BACKUP_NOT_POSSIBLE'] = "Eine Sicherung der Systemdatenbank `%s` ist nicht möglich!"; ?> \ No newline at end of file diff --git a/language/de/lang_help.php b/language/de/lang_help.php index 6e4222f..ff2bdc0 100644 --- a/language/de/lang_help.php +++ b/language/de/lang_help.php @@ -29,7 +29,7 @@ $lang['L_HELP_CRONEXECPATH']="Der Ort, an dem die Perlskripte liegen. Ausgangspunkt ist die HTTP-Adresse (also im Browser). Erlaubt sind absolute und relative Pfadangaben."; $lang['L_CRON_EXECPATH']="Pfad der Perlskripte"; -$lang['L_HELP_CRONCOMPLETELOG']="Wenn die Funktion aktiviert ist, wird die komplette Ausgabe im complete_log geschrieben. +$lang['L_HELP_CRONCOMPLETELOG']="Wenn die Funktion aktiviert ist, wird die komplette Ausgabe im complete_log geschrieben. Diese Funktion ist unabhängig von der Textausgabe."; $lang['L_HELP_FTP_MODE']="Wenn Probleme bei der FTP-Übertragung auftauchen, versuchen Sie den passiven FTP-Modus. diff --git a/language/de/lang_main.php b/language/de/lang_main.php index 5b4fbcf..0c0a0ce 100644 --- a/language/de/lang_main.php +++ b/language/de/lang_main.php @@ -38,7 +38,7 @@ $lang['L_HTACC_CREATE_ERROR']="Es ist ein Fehler bei der Erstellung des Verzeich $lang['L_HTACC_PROPOSED']="Dringend empfohlen"; $lang['L_HTACC_EDIT']=".htaccess editieren"; $lang['L_HTACCESS18']=".htaccess erstellen in "; -$lang['L_HTACCESS19']="neu laden "; +$lang['L_HTACCESS19']="Neu laden "; $lang['L_HTACCESS20']="Skript ausführen"; $lang['L_HTACCESS21']="Handler zufügen"; $lang['L_HTACCESS22']="Ausführbar machen"; @@ -57,7 +57,7 @@ $lang['L_DISABLEDFUNCTIONS']="Abgeschaltete Funktionen"; $lang['L_NOGZPOSSIBLE']="Da zlib nicht installiert ist, stehen keine GZip-Funktionen zur Verfügung!"; $lang['L_DELETE_HTACCESS']="Verzeichnisschutz entfernen (.htaccess löschen)"; $lang['L_WRONG_RIGHTS']="Die Datei oder das Verzeichnis '%s' ist für mich nicht beschreibbar.
-Entweder hat sie den falschen Besitzer (Owner) oder die falschen Rechte (Chmod).
+Entweder hat sie den falschen Besitzer (Owner) oder die falschen Rechte (Chmod).
Bitte setzen Sie die richtigen Attribute mit Ihrem FTP-Programm.
Die Datei oder das Verzeichnis benötigt die Rechte %s.
"; $lang['L_CANT_CREATE_DIR']="Ich konntes das Verzeichnis '%s' nicht erstellen. @@ -75,6 +75,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Maximale Ausführungszeit"; $lang['L_PHP_EXTENSIONS']="PHP-Erweiterungen"; $lang['L_MEMORY']="Speicher"; +$lang['L_FILE_MISSING']="konnte Datei nicht finden"; ?> \ No newline at end of file diff --git a/language/de/lang_sql.php b/language/de/lang_sql.php index d7ed53b..9c4d8b2 100644 --- a/language/de/lang_sql.php +++ b/language/de/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Typ"; $lang['L_USERNAME']="Benutzername"; $lang['L_PASSWORD']="Kennwort"; $lang['L_PASSWORD_REPEAT']="Kennwort (Wiederholung)"; +$lang['L_INFO_SIZE']="Größe"; +$lang['L_TABLE_TYPE']="Typ"; +$lang['L_KEY_DELETED']="Index gelöscht"; +$lang['L_KEY_DELETEERROR']="Fehler beim Löschen des Index"; +$lang['L_KEY_ADDED']="Index angelegt"; +$lang['L_KEY_ADDERROR']="Fehler beim Anlegen des Index"; ?> \ No newline at end of file diff --git a/language/de_du/lang.php b/language/de_du/lang.php index ff4c4c1..2ade7f3 100644 --- a/language/de_du/lang.php +++ b/language/de_du/lang.php @@ -52,7 +52,7 @@ $lang['L_MAX_BACKUP_FILES_EACH2']="für jede Datenbank"; $lang['L_SAVING_DB_FORM']="Datenbank"; $lang['L_TESTCONNECTION']="Verbindung testen"; $lang['L_BACK_TO_MINISQL']="Datenbank bearbeiten"; -$lang['L_CREATE']="anlegen"; +$lang['L_CREATE']="Anlegen"; $lang['L_VARIABELN']="Variablen"; $lang['L_STATUSINFORMATIONEN']="Statusinformationen"; $lang['L_VERSIONSINFORMATIONEN']="Versionsinformationen"; @@ -61,7 +61,7 @@ $lang['L_BACKUPFILESANZAHL']="Im Backup-Verzeichnis befinden sich"; $lang['L_LASTBACKUP']="Letztes Backup"; $lang['L_NOTAVAIL']="nicht verfügbar"; $lang['L_VOM']="vom"; -$lang['L_MYSQLVARS']="MySQL-Variabeln"; +$lang['L_MYSQLVARS']="MySQL-Variablen"; $lang['L_MYSQLSYS']="MySQL-Befehle"; $lang['L_STATUS']="Status"; $lang['L_PROZESSE']="Prozesse"; @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Sicherungsdateien"; $lang['L_MINUTES']="Minuten"; $lang['L_PAGE_REFRESHS']="Seitenaufrufe"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Setzen neuer Indizes für die Tabelle"; +$lang['L_KEY_CONFIRMDELETE']="Index wirklich löschen?"; ?> \ No newline at end of file diff --git a/language/de_du/lang_dump.php b/language/de_du/lang_dump.php index bb6dd33..8dd103f 100644 --- a/language/de_du/lang_dump.php +++ b/language/de_du/lang_dump.php @@ -52,5 +52,4 @@ $lang['L_NR_TABLES_OPTIMIZED']="%s Tabellen wurden optimie $lang['L_DUMP_ERRORS']="

%s Fehler aufgetreten: anzeigen

"; $lang['L_FATAL_ERROR_DUMP']="Schwerwiegender Fehler: die CREATE-Anweisung der Tabelle '%s' in der Datenbank '%s' konnte nicht gelesen werden!"; - ?> \ No newline at end of file diff --git a/language/de_du/lang_filemanagement.php b/language/de_du/lang_filemanagement.php index c8f7486..09d35df 100644 --- a/language/de_du/lang_filemanagement.php +++ b/language/de_du/lang_filemanagement.php @@ -28,8 +28,7 @@ $lang['L_FM_RESTORE']="Wiederherstellen"; $lang['L_FM_ALERTRESTORE1']="Soll die Datenbank "; $lang['L_FM_ALERTRESTORE2']="mit den Inhalten der Datei"; $lang['L_FM_ALERTRESTORE3']="wiederhergestellt werden?"; -$lang['L_FM_DELETE']="Ausgewählte Dateien -löschen"; +$lang['L_FM_DELETE']="Ausgewählte Dateien löschen"; $lang['L_FM_ASKDELETE1']="Möchtest du die Datei(en)"; $lang['L_FM_ASKDELETE2']="wirklich löschen?"; $lang['L_FM_ASKDELETE3']="Möchtest du Autodelete nach den eingestellten Regeln jetzt ausführen?"; @@ -38,7 +37,7 @@ $lang['L_FM_ASKDELETE5']="Möchtest du alle Backup-Dateien mit "; $lang['L_FM_ASKDELETE5_2']="_* jetzt löschen?"; $lang['L_FM_DELETEAUTO']="Autodelete manuell ausführen"; $lang['L_FM_DELETEALL']="Alle Backup-Dateien löschen"; -$lang['L_FM_DELETEALLFILTER']="Alle löschen mit"; +$lang['L_FM_DELETEALLFILTER']="Alle löschen mit "; $lang['L_FM_DELETEALLFILTER2']="_*"; $lang['L_FM_STARTDUMP']="Neues Backup starten"; $lang['L_FM_FILEUPLOAD']="Datei hochladen"; @@ -77,6 +76,5 @@ $lang['L_CHOOSE_CHARSET']="Leider konnte nicht automatisch ermittelt werden mit
Solltest Du nach der Wiederherstellung Probleme mit Sonderzeichen entdecken, so kannst Du versuchen, das Backup mit einer anderen Zeichensatzauswahl wiederherzustellen.
Viel Glück. ;)"; $lang['L_DOWNLOAD_FILE']="Datei herunterladen"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "Eine Sicherung der Systemdatenbank `%s` ist nicht möglich!"; ?> \ No newline at end of file diff --git a/language/de_du/lang_help.php b/language/de_du/lang_help.php index fba8643..b869581 100644 --- a/language/de_du/lang_help.php +++ b/language/de_du/lang_help.php @@ -29,7 +29,7 @@ $lang['L_HELP_CRONEXECPATH']="Der Ort, an dem die Perlskripte liegen. Ausgangspunkt ist die HTTP-Adresse (also im Browser). Erlaubt sind absolute und relative Pfadangaben."; $lang['L_CRON_EXECPATH']="Pfad der Perlskripte"; -$lang['L_HELP_CRONCOMPLETELOG']="Wenn die Funktion aktiviert ist, wird die komplette Ausgabe im complete_log geschrieben. +$lang['L_HELP_CRONCOMPLETELOG']="Wenn die Funktion aktiviert ist, wird die komplette Ausgabe im complete_log geschrieben. Diese Funktion ist unabhängig von der Textausgabe."; $lang['L_HELP_FTP_MODE']="Wenn Probleme bei der FTP-Übertragung auftauchen, versuche den passiven FTP-Modus."; diff --git a/language/de_du/lang_main.php b/language/de_du/lang_main.php index b8c6e3c..d935e58 100644 --- a/language/de_du/lang_main.php +++ b/language/de_du/lang_main.php @@ -38,7 +38,7 @@ $lang['L_HTACC_CREATE_ERROR']="Es ist ein Fehler bei der Erstellung des Verzeich $lang['L_HTACC_PROPOSED']="Dringend empfohlen"; $lang['L_HTACC_EDIT']=".htaccess editieren"; $lang['L_HTACCESS18']=".htaccess erstellen in "; -$lang['L_HTACCESS19']="neu laden "; +$lang['L_HTACCESS19']="Neu laden "; $lang['L_HTACCESS20']="Skript ausführen"; $lang['L_HTACCESS21']="Handler zufügen"; $lang['L_HTACCESS22']="Ausführbar machen"; @@ -57,7 +57,7 @@ $lang['L_DISABLEDFUNCTIONS']="Abgeschaltete Funktionen"; $lang['L_NOGZPOSSIBLE']="Da zlib nicht installiert ist, stehen keine GZip-Funktionen zur Verfügung!"; $lang['L_DELETE_HTACCESS']="Verzeichnisschutz entfernen (.htaccess löschen)"; $lang['L_WRONG_RIGHTS']="Die Datei oder das Verzeichnis '%s' ist für mich nicht beschreibbar.
-Entweder hat sie/es den falschen Besitzer (Owner) oder die falschen Rechte (Chmod).
+Entweder hat sie/es den falschen Besitzer (Owner) oder die falschen Rechte (Chmod).
Bitte setze die richtigen Attribute mit Deinem FTP-Programm.
Die Datei oder das Verzeichnis benötigt die Rechte %s.
"; $lang['L_CANT_CREATE_DIR']="Ich konntes das Verzeichnis '%s' nicht erstellen. @@ -72,6 +72,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Maximale Ausführungszeit"; $lang['L_PHP_EXTENSIONS']="PHP-Erweiterungen"; $lang['L_MEMORY']="Speicher"; +$lang['L_FILE_MISSING']="konnte Datei nicht finden"; ?> \ No newline at end of file diff --git a/language/de_du/lang_sql.php b/language/de_du/lang_sql.php index d351fcc..eecc254 100644 --- a/language/de_du/lang_sql.php +++ b/language/de_du/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Typ"; $lang['L_USERNAME']="Benutzername"; $lang['L_PASSWORD']="Kennwort"; $lang['L_PASSWORD_REPEAT']="Kennwort (Wiederholung)"; +$lang['L_INFO_SIZE']="Größe"; +$lang['L_TABLE_TYPE']="Typ"; +$lang['L_KEY_DELETED']="Index gelöscht"; +$lang['L_KEY_DELETEERROR']="Fehler beim Löschen des Index"; +$lang['L_KEY_ADDED']="Index angelegt"; +$lang['L_KEY_ADDERROR']="Fehler beim Anlegen des Index"; ?> \ No newline at end of file diff --git a/language/el/lang.php b/language/el/lang.php index bccec0e..dbd9aba 100644 --- a/language/el/lang.php +++ b/language/el/lang.php @@ -30,15 +30,15 @@ $lang['L_CHARSET']="Κωδικοποίηση"; $lang['L_COLLATION']="Collation"; $lang['L_CHANGE']="αλλαγή"; $lang['L_IN']="σε"; -$lang['L_DO']="Εκτέλεσε"; +$lang['L_DO']="Εκτέλεση"; $lang['L_VIEW']="προβολή"; $lang['L_EXISTING']="υπάρχων"; $lang['L_BACK']="πίσω"; -$lang['L_DB_HOST']="Ονομα Host"; +$lang['L_DB_HOST']="Ονομα Διακομιστή"; $lang['L_DB_USER']="χρήστης"; $lang['L_DB_PASS']="κωδικός"; $lang['L_INFO_SCRIPTDIR']="Κατάλογος του MySQLDumper"; -$lang['L_INFO_ACTDB']="Παρούσα Β.Δεδομένων"; +$lang['L_INFO_ACTDB']="Επιλεγμένη Β.Δεδομένων"; $lang['L_WRONGCONNECTIONPARS']="Λάθος ή καμία παράμετρος σύνδεσης!"; $lang['L_CONN_NOT_POSSIBLE']="Μη δυνατή σύνδεση !"; $lang['L_SERVERCAPTION']="Προβολή Διακομιστή"; @@ -79,7 +79,7 @@ $lang['L_FILE_MANAGE']="Διαχείριση αρχείων"; $lang['L_LOG']="Καταγραφές"; $lang['L_CHOOSE_DB']="Επιλογή Β.Δεδομένων"; $lang['L_CREDITS']="Επαινοι / Βοήθεια"; -$lang['L_MULTI_PART']="Multipart Αντίγραφα ασφαλείας"; +$lang['L_MULTI_PART']="Αντίγραφα ασφαλείας σε πολλά μέρη"; $lang['L_LOGFILENOTWRITABLE']="Αδυναμία εγγραφής Καταγραφών !"; $lang['L_SQL_ERROR1']="Σφάλμα στο ερώτημα:"; $lang['L_SQL_ERROR2']="Η MySQL λέει:"; @@ -89,15 +89,15 @@ $lang['L_OK']="ΟΚ"; $lang['L_CRON_COMPLETELOG']="Εξοδος Καταγραφών πλήρης"; $lang['L_NO']="όχι"; $lang['L_CREATE_DATABASE']="Δημιουργία νέας Β.Δεδομένων"; -$lang['L_EXPORTFINISHED']="Εξαγωγή τελειωμένη."; +$lang['L_EXPORTFINISHED']="Η εξαγωγή τελείωσε."; $lang['L_SQL_BROWSER']="Πλοηγός SQL"; $lang['L_SERVER']="Διακομιστής"; -$lang['L_MYSQL_CONNECTION_ENCODING']="Στανταρ κωδικοποίηση του διακομιστή MySQL +$lang['L_MYSQL_CONNECTION_ENCODING']="Προεπιλεγμένη κωδικοποίηση του διακομιστή MySQL "; $lang['L_TITLE_SHOW_DATA']="Προβολή δεδομένων"; -$lang['L_PRIMARYKEY_CONFIRMDELETE']="Διαγραφή πρωτεύον κλειδιού?"; +$lang['L_PRIMARYKEY_CONFIRMDELETE']="Διαγραφή πρωτεύοντος κλειδιού;"; $lang['L_SETPRIMARYKEYSFOR']="Ορισμός πρωτεύοντων κλειδιών για πίνακες"; $lang['L_PRIMARYKEY_FIELD']="Πεδίο πρωτεύον κλειδιού"; $lang['L_PRIMARYKEYS_SAVE']="Αποθήκευση πρωτεύοντων κλειδιών"; @@ -105,9 +105,11 @@ $lang['L_CANCEL']="άκυρο"; $lang['L_VISIT_HOMEPAGE']="Επισκεφθείτε την Ιστοσελίδα"; $lang['L_SECONDS']="Δευτερόλεπτα"; $lang['L_BACKUPS']="Αντίγραφα Ασφαλείας"; -$lang['L_MINUTES']="Minutes"; -$lang['L_PAGE_REFRESHS']="Page refreshs"; -$lang['L_MINUTE']="Minute"; +$lang['L_MINUTES']="Λεπτά"; +$lang['L_PAGE_REFRESHS']="Ανανεώσεις σελίδας"; +$lang['L_MINUTE']="Λεπτό"; +$lang['L_SETKEYSFOR']="Ορισμός νέων index για τον πίνακα"; +$lang['L_KEY_CONFIRMDELETE']="Πραγματικά διαγραφή του index;"; -?> \ No newline at end of file +?> diff --git a/language/el/lang_config_overview.php b/language/el/lang_config_overview.php index af8538b..d857e5a 100644 --- a/language/el/lang_config_overview.php +++ b/language/el/lang_config_overview.php @@ -104,9 +104,7 @@ $lang['L_CREATE_CONFIGFILE']="Δημιουργία νέου αρχείου ρύ $lang['L_ERROR_LOADING_CONFIGFILE']="δεν ανοίγει το αρχείο ρύθμισης \"%s\"."; $lang['L_BACKUP_DBS_PHP']="ΒΔ για αντιγ. ασφαλείας (PHP)"; $lang['L_BACKUP_DBS_PERL']="ΒΔ για αντιγ. ασφαλείας (PERL)"; -$lang['L_CRON_COMMENT']="Δώστε σχόλιο - -"; +$lang['L_CRON_COMMENT']="Δώστε σχόλιο"; $lang['L_AUTODETECT']="αυτόματος εντοπισμός"; diff --git a/language/el/lang_filemanagement.php b/language/el/lang_filemanagement.php index e63c22c..ddb019d 100644 --- a/language/el/lang_filemanagement.php +++ b/language/el/lang_filemanagement.php @@ -73,9 +73,7 @@ $lang['L_FM_CHOOSE_ENCODING']="Επιλογή κωδικοποίησης για $lang['L_CHOOSE_CHARSET']="Το MySQLDumper δε μπόρεσε να αναγνωρίσει αυτόματα την κωδικοποίηση του αντιγράφου ασφαλείας.
Επιλέξτε το σετ χαρακτήρων με το οποίο αποθηκέυθηκε το αντίγραφο ασφαλείας.
Αν παρουσιαστούν προβλήματα με κάποιους χαρακτήρες μετά την επαναφορά, επαναλάβετε την επαναφορά κι επιλέξτε άλλο σετ χαρακτήρων. -
Καλή επιτυχία. ;) -"; +
Καλή επιτυχία. ;)"; $lang['L_DOWNLOAD_FILE']="Μεταφόρτωση αρχείου"; - - -?> \ No newline at end of file +$lang['L_BACKUP_NOT_POSSIBLE'] = "Δεν είναι δυνατή η λήψη αντιγράφου ασφαλείας της βάσης δεδομένων `%s` του συστήματος!"; +?> diff --git a/language/el/lang_install.php b/language/el/lang_install.php index cd79727..b6f10d0 100644 --- a/language/el/lang_install.php +++ b/language/el/lang_install.php @@ -86,7 +86,7 @@ $lang['L_SAFEMODEDESC']="Επειδή η PHP τρέχει σε ασφαλή λε "; -$lang['L_ENTER_DB_INFO']="First click the button \"Connect to MySQL\". Only if no database could be detected you need to provide a database name here."; +$lang['L_ENTER_DB_INFO']="Πρώτα πατήστε το κουμπί \"Σύνδεση στη MySQL\". Μόνο αν δεν μπορέσει να ανιχνευτεί βάση δεδομένων θα πρέπει να παρέχετε ένα όνομα βάσης δεδομένων εδώ."; -?> \ No newline at end of file +?> diff --git a/language/el/lang_main.php b/language/el/lang_main.php index 8399a09..0db80b1 100644 --- a/language/el/lang_main.php +++ b/language/el/lang_main.php @@ -60,7 +60,7 @@ $lang['L_WRONG_RIGHTS']="Το αρχείο ή ο κατάλογος '%s' δεν Τα δικαιώματα (chmod) δε ρυθμίστηκαν σωστά ή έχουν λάθος ιδιοκτήτη.
Δώστε τις σωστές ιδιότητες χρησιμοποιώντας το πρόγραμμα FTP.
Το αρχείο ή ο κατάλογος πρέπει να ρυθμιστεί σε %s.
"; -$lang['L_CANT_CREATE_DIR']="Δε δημιουργήθηκε κατάλογος '%s'. +$lang['L_CANT_CREATE_DIR']="Δε δημιουργήθηκε κατάλογος '%s'. Δημιουργήστε τον χρησιμοποιώντας το πρόγραμμα FTP. "; @@ -74,6 +74,7 @@ $lang['L_PHP_VERSION']="Εκδοση PHP"; $lang['L_MAX_EXECUTION_TIME']="Μεγ. χρόνος εκτέλεσης"; $lang['L_PHP_EXTENSIONS']="Επεκτάσεις PHP"; $lang['L_MEMORY']="Μνήμη"; +$lang['L_FILE_MISSING']="δε βρέθηκε το αρχείο"; ?> \ No newline at end of file diff --git a/language/el/lang_sql.php b/language/el/lang_sql.php index 221022d..1a024f3 100644 --- a/language/el/lang_sql.php +++ b/language/el/lang_sql.php @@ -183,6 +183,12 @@ $lang['L_ENGINE']="Μηχανή"; $lang['L_USERNAME']="Ονομα χρήστη"; $lang['L_PASSWORD']="Κωδικός"; $lang['L_PASSWORD_REPEAT']="Κωδικός (Επανάληψη)"; +$lang['L_INFO_SIZE']="Μέγεθος"; +$lang['L_TABLE_TYPE']="Τύπος"; +$lang['L_KEY_DELETED']="Το index διαγράφηκε"; +$lang['L_KEY_DELETEERROR']="Σφάλμα κατά τη διαγραφή του index"; +$lang['L_KEY_ADDED']="Το index προστέθηκε"; +$lang['L_KEY_ADDERROR']="Σφάλμα κατά την προσθήκη του index"; -?> \ No newline at end of file +?> diff --git a/language/en/lang.php b/language/en/lang.php index 33ee099..e530714 100644 --- a/language/en/lang.php +++ b/language/en/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Backups"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/en/lang_filemanagement.php b/language/en/lang_filemanagement.php index 372864d..d9d71ae 100644 --- a/language/en/lang_filemanagement.php +++ b/language/en/lang_filemanagement.php @@ -73,10 +73,7 @@ $lang['L_FM_CHOOSE_ENCODING']="Choose encoding of backup file"; $lang['L_CHOOSE_CHARSET']="MySQLDumper couldn't detect the encoding of the backup file automatically.
You must choose the charset with which this backup was saved.
If you discover any problems with some characters after restoring, you can repeat the backup-progress and then choose another character set. -
Good luck. ;) - -"; +
Good luck. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/en/lang_main.php b/language/en/lang_main.php index 606747c..1648002 100644 --- a/language/en/lang_main.php +++ b/language/en/lang_main.php @@ -60,7 +60,7 @@ $lang['L_WRONG_RIGHTS']="The file or the directory '%s' is not writable for me.< The rights (chmod) are not set properly or it has the wrong owner.
Pleae set the correct attributes using your FTP program.
The file or the directory needs to be set to %s.
"; -$lang['L_CANT_CREATE_DIR']="Couldn' t create dir '%s'. +$lang['L_CANT_CREATE_DIR']="Couldn' t create dir '%s'. Please create it using your FTP program."; $lang['L_TABLE_TYPE']="Type"; $lang['L_CHECK']="check"; @@ -72,6 +72,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="couldn't find file"; ?> \ No newline at end of file diff --git a/language/en/lang_sql.php b/language/en/lang_sql.php index 597cbea..d5a530f 100644 --- a/language/en/lang_sql.php +++ b/language/en/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Size"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/es/lang.php b/language/es/lang.php index 434c21a..86dd85b 100644 --- a/language/es/lang.php +++ b/language/es/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="cantidad de copias de seguridad"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/es/lang_filemanagement.php b/language/es/lang_filemanagement.php index e7d6476..58f57e5 100644 --- a/language/es/lang_filemanagement.php +++ b/language/es/lang_filemanagement.php @@ -75,6 +75,5 @@ Usted debe elegir el conjunto de caracteres con el que se guardó la copia de se Si usted descubre algún problema con algunos caracteres después de la restauración, puede repetir la restauración de la copia de seguridad con otro conjunto de caracteres.
Buena suerte. ;)"; $lang['L_DOWNLOAD_FILE']="Descargos ficheros"; - - -?> \ No newline at end of file +$lang['L_BACKUP_NOT_POSSIBLE'] = "¡Una copia de seguridad de la base de datos del sistema `%s` no es posible realizarla!"; +?> diff --git a/language/es/lang_install.php b/language/es/lang_install.php index 27e8164..4c3cba7 100644 --- a/language/es/lang_install.php +++ b/language/es/lang_install.php @@ -8,7 +8,7 @@ $lang['L_UNINSTALL']="Desinstalación"; $lang['L_TOOLS']="Herramientas"; $lang['L_EDITCONF']="modificar configuración"; $lang['L_OSWEITER']="seguir sin guardar"; -$lang['L_ERRORMAN']="Error al escribir la configuración!
Por favor, edite Vd. el fichero "; +$lang['L_ERRORMAN']="Error al escribir la configuración!
Por favor, edite Vd. el fichero "; $lang['L_MANUELL']="manualmente"; $lang['L_CREATEDIRS']="Directorios creados"; $lang['L_INSTALL_CONTINUE']="seguir con la instalación"; diff --git a/language/es/lang_main.php b/language/es/lang_main.php index 53219fc..81538cc 100644 --- a/language/es/lang_main.php +++ b/language/es/lang_main.php @@ -72,6 +72,7 @@ $lang['L_PHP_VERSION']="PHP-Versión"; $lang['L_MAX_EXECUTION_TIME']="El máximo de ejecución"; $lang['L_PHP_EXTENSIONS']="Extensiones de PHP"; $lang['L_MEMORY']="Memoria"; +$lang['L_FILE_MISSING']="no se encuentra el fichero"; ?> \ No newline at end of file diff --git a/language/es/lang_sql.php b/language/es/lang_sql.php index 2c9654d..53d06b5 100644 --- a/language/es/lang_sql.php +++ b/language/es/lang_sql.php @@ -182,6 +182,12 @@ $lang['L_ENGINE']="Máquina"; $lang['L_USERNAME']="Nombre de usuario"; $lang['L_PASSWORD']="Contraseña"; $lang['L_PASSWORD_REPEAT']="Contraseña (repetición)"; +$lang['L_INFO_SIZE']="Tamaño"; +$lang['L_TABLE_TYPE']="Tipo"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/flags/index.htm b/language/flags/index.htm index e0cc5f3..ee1f723 100644 --- a/language/flags/index.htm +++ b/language/flags/index.htm @@ -1,10 +1,10 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/language/fr/lang.php b/language/fr/lang.php index d2571fb..63dc180 100644 --- a/language/fr/lang.php +++ b/language/fr/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Nombres de sauvegardes"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/fr/lang_filemanagement.php b/language/fr/lang_filemanagement.php index db2881b..9159ca2 100644 --- a/language/fr/lang_filemanagement.php +++ b/language/fr/lang_filemanagement.php @@ -28,8 +28,7 @@ $lang['L_FM_RESTORE']="Restauration"; $lang['L_FM_ALERTRESTORE1']="Voulez-vous que la base de données "; $lang['L_FM_ALERTRESTORE2']="avec le contenu des fichiers"; $lang['L_FM_ALERTRESTORE3']="soit restaurée?"; -$lang['L_FM_DELETE']="Supprimer les -fichiers sélectionnés"; +$lang['L_FM_DELETE']="Supprimer les fichiers sélectionnés"; $lang['L_FM_ASKDELETE1']="Voulez-vous vraiment supprimer le fichier "; $lang['L_FM_ASKDELETE2']="really be deleted?"; $lang['L_FM_ASKDELETE3']="Voulez-vous exécuter la suppression automatique d'après les règles sauvegardées?"; @@ -38,7 +37,7 @@ $lang['L_FM_ASKDELETE5']="Voulez-vous supprimer toutes les copies de sauvegarde $lang['L_FM_ASKDELETE5_2']="_* ?"; $lang['L_FM_DELETEAUTO']="Exécuter manuellement\nsuppression automatique"; $lang['L_FM_DELETEALL']="Supprimer toutes les\ncopies de sauvegarde"; -$lang['L_FM_DELETEALLFILTER']="Supprimer tout avec"; +$lang['L_FM_DELETEALLFILTER']="Supprimer tout avec "; $lang['L_FM_DELETEALLFILTER2']="_*"; $lang['L_FM_STARTDUMP']="Exécuter une nouvelle\ncopie de sauvegarde"; $lang['L_FM_FILEUPLOAD']="Télécharger un fichier vers le serveur"; @@ -72,6 +71,5 @@ $lang['L_ENCODING']="encodage"; $lang['L_FM_CHOOSE_ENCODING']="Choisissez le type d'encodage de la sauvegarde"; $lang['L_CHOOSE_CHARSET']="MySQLDumper n'a pas pu détecter automatiquement le type d'encodage de la sauvegarde
Vous devez choisir le jeux de caractères qui a été utilisé pour la sauvegarde
Si vous découvrez des problèmes avec quelques caractères suite à la restauration, vous pouvez répéter l'opération en choisissant un autre jeux de caractères.
Bonne chance ;-)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/fr/lang_help.php b/language/fr/lang_help.php index c448420..8ab0c26 100644 --- a/language/fr/lang_help.php +++ b/language/fr/lang_help.php @@ -29,7 +29,7 @@ $lang['L_HELP_CRONEXECPATH']="L'endroit où se trouve les scripts Perl. Point de départ est l'adresse HTTP (dans le navigateur) Autorisé sont les chemins absolus et relatifs."; $lang['L_CRON_EXECPATH']="Chemin du script Perl"; -$lang['L_HELP_CRONCOMPLETELOG']="Si la fonction est activée alors la sortie complète est écrite dans le journal 'complete_log'. +$lang['L_HELP_CRONCOMPLETELOG']="Si la fonction est activée alors la sortie complète est écrite dans le journal 'complete_log'. Cette fonction est indépendante de la fonction sortie de texte."; $lang['L_HELP_FTP_MODE']="Si vous avez des problèmes durant le transfert FTP, essayez en choisissant passif comme mode de transfert."; diff --git a/language/fr/lang_main.php b/language/fr/lang_main.php index fbce88f..96cabd7 100644 --- a/language/fr/lang_main.php +++ b/language/fr/lang_main.php @@ -68,6 +68,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="le fichier n'a pas été trouvé"; ?> \ No newline at end of file diff --git a/language/fr/lang_sql.php b/language/fr/lang_sql.php index 0522640..4efd4c2 100644 --- a/language/fr/lang_sql.php +++ b/language/fr/lang_sql.php @@ -183,6 +183,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Taille"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/it/lang.php b/language/it/lang.php index fb7cf98..23b53e4 100644 --- a/language/it/lang.php +++ b/language/it/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Backups"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/it/lang_filemanagement.php b/language/it/lang_filemanagement.php index eb53a71..54eb2b3 100644 --- a/language/it/lang_filemanagement.php +++ b/language/it/lang_filemanagement.php @@ -71,6 +71,5 @@ $lang['L_ENCODING']="codifica"; $lang['L_FM_CHOOSE_ENCODING']="Scegli la codifica del file di backup"; $lang['L_CHOOSE_CHARSET']="MySQLDumper non ha rilevato automaticamente il codice del seti di caratteri utilizzato nel file di backup creato in precedenza.
Devi inserire manualmente il set di caratteri standard con cui è stato salvato questo backup.
Dopo aver fatto questo, MySQLDumper effettuerà la connessione verso il MySQL-Server contenente il set di caretteri scelto e avvierà il ripristino dei dati. Se dopo il ripristono si presentassero problemi nella visualizzazione dei caratteri speciali, sarà opportuno ripetere la procedura di ripistino scegliendo un altro set di caratteri.
Buona fortuna.;)"; $lang['L_DOWNLOAD_FILE']="Scarica file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/it/lang_help.php b/language/it/lang_help.php index c974941..fe7d3e5 100644 --- a/language/it/lang_help.php +++ b/language/it/lang_help.php @@ -24,7 +24,7 @@ $lang['L_HELP_SPEED']="Minima e massima velocità della connessione, lo standard $lang['L_SPEED']="Controllo velocità"; $lang['L_HELP_CRONEXECPATH']="Il posto in cui si trovano gli script Perl.\nIl punto di partenza iniziale è l`indirizzo HTTP (come gli indirizzi nel Browser)\nSono permessi indirizzi assoluti e relativi."; $lang['L_CRON_EXECPATH']="Percorso degli script Perl"; -$lang['L_HELP_CRONCOMPLETELOG']="Se questa funzione è attivata il dettaglio di tutte le operazioni verrà memorizzato nel file complete_log. +$lang['L_HELP_CRONCOMPLETELOG']="Se questa funzione è attivata il dettaglio di tutte le operazioni verrà memorizzato nel file complete_log. Questa funzione è indipendente dall`output del testo."; $lang['L_HELP_FTP_MODE']="Se si verificassero dei problemi con il trasferimento tramite FTP, provare ad usare la modalità passiva."; diff --git a/language/it/lang_main.php b/language/it/lang_main.php index 41139b2..d8b5ee1 100644 --- a/language/it/lang_main.php +++ b/language/it/lang_main.php @@ -68,6 +68,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="impossibile trovare il file"; ?> \ No newline at end of file diff --git a/language/it/lang_sql.php b/language/it/lang_sql.php index 5ea1c46..76dfece 100644 --- a/language/it/lang_sql.php +++ b/language/it/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Grandezza"; +$lang['L_TABLE_TYPE']="Tipo"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/pt_br/lang.php b/language/pt_br/lang.php index 3cd2eed..a5b0a00 100644 --- a/language/pt_br/lang.php +++ b/language/pt_br/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Backups"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/pt_br/lang_filemanagement.php b/language/pt_br/lang_filemanagement.php index 14231e9..81bd616 100644 --- a/language/pt_br/lang_filemanagement.php +++ b/language/pt_br/lang_filemanagement.php @@ -73,10 +73,7 @@ $lang['L_FM_CHOOSE_ENCODING']="Choose encoding of backup file"; $lang['L_CHOOSE_CHARSET']="MySQLDumper couldn't detect the encoding of the backup file automatically.
You must choose the charset with which this backup was saved.
If you discover any problems with some characters after restoring, you can repeat the backup-progress and then choose another character set. -
Good luck. ;) - -"; +
Good luck. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/pt_br/lang_main.php b/language/pt_br/lang_main.php index b83623b..6c6d01a 100644 --- a/language/pt_br/lang_main.php +++ b/language/pt_br/lang_main.php @@ -60,7 +60,7 @@ $lang['L_WRONG_RIGHTS']="O arquivo ou o diretório '%s' não tem permissão de e As permissões (chmod) não estão configuradas apropriadamente ou não há privilégios suficientes para este usuário.
Por favor configure corretamente as permissões usando o programa de FTP.
O arquivo ou diretório necessitam de configuração para %s.
"; -$lang['L_CANT_CREATE_DIR']="Não foi possível criar o diretório '%s'. +$lang['L_CANT_CREATE_DIR']="Não foi possível criar o diretório '%s'. Por favor utilize seu programa de FTP."; $lang['L_TABLE_TYPE']="Type"; $lang['L_CHECK']="check"; @@ -72,6 +72,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="não pude encontrar o arquivo"; ?> \ No newline at end of file diff --git a/language/pt_br/lang_sql.php b/language/pt_br/lang_sql.php index 9396831..4c4b6ec 100644 --- a/language/pt_br/lang_sql.php +++ b/language/pt_br/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="tamanho"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/sw/lang.php b/language/sw/lang.php index f89e95b..2f8e0ba 100644 --- a/language/sw/lang.php +++ b/language/sw/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="backup(er)"; $lang['L_MINUTES']="minuter"; $lang['L_PAGE_REFRESHS']="sidvisningar"; $lang['L_MINUTE']="minut"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/sw/lang_filemanagement.php b/language/sw/lang_filemanagement.php index 8e34f8c..128bce0 100644 --- a/language/sw/lang_filemanagement.php +++ b/language/sw/lang_filemanagement.php @@ -71,6 +71,5 @@ $lang['L_ENCODING']="Kodering"; $lang['L_FM_CHOOSE_ENCODING']="Välj backupfilens kodering"; $lang['L_CHOOSE_CHARSET']="Tyvärr kunde ej fastställas automatiskt med vilken teckensats denna backupfil har skapats.
Du måste ange koderingen manuellt.
Därefter ställer MySQLDumper in förbindelseparametrarna till MySQL-servern till den valda teckensatsen och startar återställningen.
Om datan återges med fel specialtecken efter återställningen så bör du upprepa återställningen med en annan inställning för teckensatsen.
Lycka till."; $lang['L_DOWNLOAD_FILE']="Ladda hem filen"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/sw/lang_main.php b/language/sw/lang_main.php index 9c487cb..505f17f 100644 --- a/language/sw/lang_main.php +++ b/language/sw/lang_main.php @@ -68,6 +68,7 @@ $lang['L_PHP_VERSION']="PHP-version"; $lang['L_MAX_EXECUTION_TIME']="Maximal exekveringstid"; $lang['L_PHP_EXTENSIONS']="PHP-extensioner"; $lang['L_MEMORY']="Minne"; +$lang['L_FILE_MISSING']="kunde ej hitta filen"; ?> \ No newline at end of file diff --git a/language/sw/lang_sql.php b/language/sw/lang_sql.php index e26aeb3..5ad88cf 100644 --- a/language/sw/lang_sql.php +++ b/language/sw/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Användarnamn"; $lang['L_PASSWORD']="Lösenord"; $lang['L_PASSWORD_REPEAT']="Upprepa lösenord"; +$lang['L_INFO_SIZE']="Storlek"; +$lang['L_TABLE_TYPE']="Typ"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/tr/lang.php b/language/tr/lang.php index f158a13..3368457 100644 --- a/language/tr/lang.php +++ b/language/tr/lang.php @@ -105,6 +105,8 @@ $lang['L_BACKUPS']="Yedeklemeler"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/tr/lang_config_overview.php b/language/tr/lang_config_overview.php index e463b14..120a091 100644 --- a/language/tr/lang_config_overview.php +++ b/language/tr/lang_config_overview.php @@ -90,8 +90,7 @@ $lang['L_CONFIGFILE']="Ayar dosyası"; $lang['L_MYSQL_DATA']="MySQL Verileri"; $lang['L_CONFIGURATIONS']="Ayarlar"; $lang['L_ACTION']="İşlem"; -$lang['L_FTP_SEND_TO']="adress %s
klasör %s -"; +$lang['L_FTP_SEND_TO']="adress %s
klasör %s"; $lang['L_FTP']="FTP"; $lang['L_EMAIL_CC']="CC-Alıcı"; $lang['L_NAME']="İsim"; diff --git a/language/tr/lang_filemanagement.php b/language/tr/lang_filemanagement.php index 3d0760f..fe9fbed 100644 --- a/language/tr/lang_filemanagement.php +++ b/language/tr/lang_filemanagement.php @@ -72,6 +72,5 @@ $lang['L_ENCODING']="kodlama"; $lang['L_FM_CHOOSE_ENCODING']="alınacak yedeğin karakter setini seçin"; $lang['L_CHOOSE_CHARSET']="Maalesef veritabanı yedeğinin hangi karakter seti ile kodlandığını otomatik olarak bulunmadı
Hangi karakter setini kullandıysanız onu seçip elle vermeniz gerekiyor.Daha sonra MYSQLDumper veritabanı serveri ile irtibata gecip yedeği yüklemeye başlıyacaktır.
Eğer yedek yüklendikten sonra karakter sorunu devam ediyorsa başka bir karakter seti seçip tekrar denemeniz gerekiyor.
Bol şans ;)"; $lang['L_DOWNLOAD_FILE']="Dosya indir"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/tr/lang_help.php b/language/tr/lang_help.php index f2172e4..ca10925 100644 --- a/language/tr/lang_help.php +++ b/language/tr/lang_help.php @@ -28,7 +28,7 @@ $lang['L_SPEED']="Hız"; $lang['L_HELP_CRONEXECPATH']="Perlskriptin bulunduğu alan. HTTP-Adressinden yola çıkarak (Tarayıcıda)."; $lang['L_CRON_EXECPATH']="Perlskript'in veriyolu"; -$lang['L_HELP_CRONCOMPLETELOG']="Aktiv olması durumunda çıktının komplesi complete_log dosyasına kaydedilir. +$lang['L_HELP_CRONCOMPLETELOG']="Aktiv olması durumunda çıktının komplesi complete_log dosyasına kaydedilir. Textçıktısı ayarlarına bağlı değildir."; $lang['L_HELP_FTP_MODE']="Eğer FTP-Transfer esnasında hata oluşursa,lütfen Pasif-Modus yöntemi ile deneyin."; diff --git a/language/tr/lang_main.php b/language/tr/lang_main.php index 71a7a48..c260a23 100644 --- a/language/tr/lang_main.php +++ b/language/tr/lang_main.php @@ -68,6 +68,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="Dosya bulunamadı"; ?> \ No newline at end of file diff --git a/language/tr/lang_sql.php b/language/tr/lang_sql.php index e6495d7..6a79b9c 100644 --- a/language/tr/lang_sql.php +++ b/language/tr/lang_sql.php @@ -180,6 +180,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="Ebadı"; +$lang['L_TABLE_TYPE']="Tür"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/language/vn/lang.php b/language/vn/lang.php index f16d3f4..123b8de 100644 --- a/language/vn/lang.php +++ b/language/vn/lang.php @@ -108,6 +108,8 @@ $lang['L_BACKUPS']="Các sao lưu"; $lang['L_MINUTES']="Minutes"; $lang['L_PAGE_REFRESHS']="Page refreshs"; $lang['L_MINUTE']="Minute"; +$lang['L_SETKEYSFOR']="Set new indexes for table"; +$lang['L_KEY_CONFIRMDELETE']="Really delete index?"; ?> \ No newline at end of file diff --git a/language/vn/lang_config_overview.php b/language/vn/lang_config_overview.php index 80c5378..34b303e 100644 --- a/language/vn/lang_config_overview.php +++ b/language/vn/lang_config_overview.php @@ -105,10 +105,7 @@ $lang['L_CREATE_CONFIGFILE']="Tạo file cấu hình mới"; $lang['L_ERROR_LOADING_CONFIGFILE']="Không thể tải file cấu hình \"%s\"."; $lang['L_BACKUP_DBS_PHP']="CSDL để sao lưu (PHP)"; $lang['L_BACKUP_DBS_PERL']="CSDL để sao lưu (PERL)"; -$lang['L_CRON_COMMENT']="Nhập ghi chú - - -"; +$lang['L_CRON_COMMENT']="Nhập ghi chú"; $lang['L_AUTODETECT']="auto detect"; diff --git a/language/vn/lang_filemanagement.php b/language/vn/lang_filemanagement.php index 92f1152..4800d27 100644 --- a/language/vn/lang_filemanagement.php +++ b/language/vn/lang_filemanagement.php @@ -73,10 +73,7 @@ $lang['L_FM_CHOOSE_ENCODING']="Chọn chế độ mã hóa của file sao lưu"; $lang['L_CHOOSE_CHARSET']="MySQLDumper đã không thể phát hiện ra sự mã hóa của File sao lưu một cách tự động.
Bạn phải chọn charset đúng với định dạng đã được sao lưu.
Nếu bạn thấy bất kỳ vấn đề nào sau khi khôi phục, bạn có thể lặp lại quá trình sao lưu và sau đó chọn charset khác. -
Chúc may mắn. ;) - -"; +
Chúc may mắn. ;)"; $lang['L_DOWNLOAD_FILE']="Download file"; - - +$lang['L_BACKUP_NOT_POSSIBLE'] = "A backup of the system database `%s` is not possible!"; ?> \ No newline at end of file diff --git a/language/vn/lang_main.php b/language/vn/lang_main.php index aeb2a8e..0bd2795 100644 --- a/language/vn/lang_main.php +++ b/language/vn/lang_main.php @@ -60,7 +60,7 @@ $lang['L_WRONG_RIGHTS']="File hay thư mục '%s' không cho phép ghi.
Chế độ chmod không đúng hoặc nó không dành cho chúng ta.
Đặt lại thuộc tính cho đúng bằng cách sử dụng trình FTP.
File hay thư mục cần được thiết lập thành %s.
"; -$lang['L_CANT_CREATE_DIR']="Không thể tạo thư mục '%s'. +$lang['L_CANT_CREATE_DIR']="Không thể tạo thư mục '%s'. Hãy tạo ra nó bằng cách sử dụng trình FTP. @@ -75,6 +75,7 @@ $lang['L_PHP_VERSION']="PHP-Version"; $lang['L_MAX_EXECUTION_TIME']="Max execution time"; $lang['L_PHP_EXTENSIONS']="PHP-Extensions"; $lang['L_MEMORY']="Memory"; +$lang['L_FILE_MISSING']="không tìm thấy file"; ?> \ No newline at end of file diff --git a/language/vn/lang_sql.php b/language/vn/lang_sql.php index efe7449..9eb7bb0 100644 --- a/language/vn/lang_sql.php +++ b/language/vn/lang_sql.php @@ -183,6 +183,12 @@ $lang['L_ENGINE']="Engine"; $lang['L_USERNAME']="Username"; $lang['L_PASSWORD']="Password"; $lang['L_PASSWORD_REPEAT']="Password (repeat)"; +$lang['L_INFO_SIZE']="kích thước"; +$lang['L_TABLE_TYPE']="Type"; +$lang['L_KEY_DELETED']="Index deleted"; +$lang['L_KEY_DELETEERROR']="Error deleting index"; +$lang['L_KEY_ADDED']="Index added"; +$lang['L_KEY_ADDERROR']="Error adding index"; ?> \ No newline at end of file diff --git a/menu.php b/menu.php index affe123..cba4fda 100644 --- a/menu.php +++ b/menu.php @@ -8,13 +8,13 @@ $config_refresh=''; // define template $tpl=new MSDTemplate(); $tpl->set_filenames(array( - 'header' => 'tpl/menu/header.tpl', - 'footer' => 'tpl/menu/footer.tpl', + 'header' => 'tpl/menu/header.tpl', + 'footer' => 'tpl/menu/footer.tpl', 'content' => 'tpl/menu/content.tpl')); $tpl->assign_vars(array( - 'MSD_VERSION' => MSD_VERSION, - 'CONFIG_HOMEPAGE' => $config['homepage'], + 'MSD_VERSION' => MSD_VERSION, + 'CONFIG_HOMEPAGE' => $config['homepage'], 'CONFIG_THEME' => $config['theme'])); if (isset($_POST['selected_config'])||isset($_GET['config'])) @@ -54,7 +54,7 @@ if ($config_refresh>'') $tpl->assign_var('CONFIG_REFRESH',$config_refresh); } -// changed language +// changed language if ($config['language']!=$lang_old) { $tpl->assign_block_vars('CHANGED_LANGUAGE',array()); @@ -67,11 +67,8 @@ if (isset($_GET['action'])) // remember the name of the selected database $old_dbname=isset($databases['Name'][$databases['db_selected_index']]) ? $databases['Name'][$databases['db_selected_index']] : ''; SetDefault(); - // lets lookup if the old database is still there - $old_dbs=array_flip($databases['Name']); - if (isset($old_dbs[$old_dbname])) SelectDB($old_dbs[$old_dbname]); - else - SelectDB(0); + // select old database if it still is there + SelectDB($old_dbname); $tpl->assign_block_vars('DB_REFRESH',array()); } } @@ -81,7 +78,7 @@ if (isset($_POST['dbindex'])) $dbindex=intval($_POST['dbindex']); $databases['db_selected_index']=$dbindex; $databases['db_actual']=$databases['Name'][$dbindex]; - + SelectDB($dbindex); WriteParams(0); $tpl->assign_block_vars('DB_REFRESH',array()); @@ -102,7 +99,7 @@ if (isset($databases['Name'])&&count($databases['Name'])>0) { $tpl->assign_block_vars('MAINTENANCE',array()); $tpl->assign_vars(array( - 'DB_ACTUAL' => $databases['db_actual'], + 'DB_ACTUAL' => $databases['db_actual'], 'DB_SELECTED_INDEX' => $databases['db_selected_index'])); } $tpl->assign_var('GET_FILELIST',get_config_filelist()); @@ -115,8 +112,8 @@ if (isset($databases['Name'])&&count($databases['Name'])>0) { $selected=($i==$databases['db_selected_index']) ? ' selected' : ''; $tpl->assign_block_vars('DB_LIST.DB_ROW',array( - 'ID' => $i, - 'NAME' => $databases['Name'][$i], + 'ID' => $i, + 'NAME' => $databases['Name'][$i], 'SELECTED' => $selected)); } } diff --git a/msd_cron/crondump.pl b/msd_cron/crondump.pl index 73b89e4..3269187 100644 --- a/msd_cron/crondump.pl +++ b/msd_cron/crondump.pl @@ -2,14 +2,22 @@ ######################################################################################## # MySQLDumper CronDump # -# 2004-2009 by Steffen Kamper, Daniel Schlichtholz -# additional scripting: Detlev Richter +# 2004-2010 by Steffen Kamper, Daniel Schlichtholz +# additional scripting: Detlev Richter, Jonathan Tietz +# +# for support etc. visit http://forum.mysqldumper.de +# +# This file is part of MySQLDumper released under the GNU/GPL 2 license +# http://www.mysqldumper.net +# @package MySQLDumper +# @version $Rev: 1371 $ +# @author $Author: dsb1971 $ +# @lastmodified $Date: 2011-01-24 21:15:21 +0100 (Mo, 24. Jan 2011) $ +# @filesource $URL: https://mysqldumper.svn.sourceforge.net/svnroot/mysqldumper/branches/msd1.24.3/msd_cron/crondump.pl $ # -# for support etc. visit http://www.mysqldumper.de/board -# (c) GNU General Public License ######################################################################################## # Script-Version -$pcd_version="1.24"; +my $pcd_version='1.24.4'; ######################################################################################## # please enter the absolute path of the config-dir @@ -30,16 +38,17 @@ use warnings; use DBI; use File::Find; use File::Basename; -use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +use CGI::Carp qw(warningsToBrowser fatalsToBrowser); warningsToBrowser(1); use CGI; use Data::Dumper; +use Getopt::Long; ######################################################################################## use vars qw( $pcd_version $dbhost $dbname $dbuser $dbpass $dbport $dbsocket $cron_dbindex @cron_db_array @ftp_server $dbpraefix @cron_dbpraefix_array -$compression $backup_path $logdatei $completelogdatei $nl $command_beforedump $command_afterdump +$compression $backup_path $logdatei $completelogdatei $command_beforedump $command_afterdump $cron_printout $cronmail $cronmail_dump $cronmailto $cronmailto_cc $cronmailfrom $cronftp $mp $multipart_groesse $email_maxsize $auto_delete $max_backup_files $perlspeed $optimize_tables_beforedump $result @@ -50,14 +59,14 @@ $insert $totalrecords $error_message $cfh $oldbar $print_out $msg $dt $ftp $date $mpdatei $i $BodyNormal $BodyMultipart $BodyToBig $BodyNoAttach $BodyAttachOnly $Body $DoAttach $cmt $part $fpath $fname $fmtime $timenow $daydiff $datei $inh $gz $search $fdbname @str $item %dbanz $anz %db_dat $fieldlist $first_insert $my_comment $sendmail_call $config_read_from -$cron_smtp $cron_smtp_port $cron_use_sendmail $v1 $v2 -@ftp_transfer @ftp_timeout @ftp_user @ftp_pass @ftp_dir @ftp_server @ftp_port @ftp_mode +$cron_smtp $cron_smtp_port $cron_use_sendmail +@ftp_transfer @ftp_timeout @ftp_user @ftp_pass @ftp_dir @ftp_server @ftp_port @ftp_mode @ftp_useSSL $output $query $skip $html_output $datei @trash_files $time_stamp @filearr $sql_file $backupfile $memory_limit $dbh $sth @db_array @dbpraefix_array @cron_command_before_dump @cron_command_after_dump $db_anz $record_count $filesize $status_start $status_end $sql_text $punktzaehler @backupfiles_name @backupfiles_size $mysql_commentstring $character_set $mod_gz $mod_mime $mod_ftp -@multipartfiles %db_tables @tablenames $tablename $opttbl $command +$mod_ftpssl @multipartfiles %db_tables @tablenames $tablename $opttbl $command $current_dir ); $memory_limit=100000; @@ -70,56 +79,78 @@ $punktzaehler=0; @filearr=(); $opttbl=0; $dbpraefix=""; +$complete_log= 0; +$cron_printout = 1; +#config file +$conffile=""; + +#return perl version +sub GetPerlVersion (){ + my $pversion ; + if ($^V){ + $pversion = sprintf "v%vd", $^V ; # v5.10.1 + }else{ + $pversion = local $]; + } + return $pversion; +} # import the optional modules ... my $eval_in_died; $mod_gz=0; $mod_ftp=0; $mod_mime=0; +$mod_ftpssl=0; push (@INC, "$cgibin_path"); eval { $eval_in_died = 1; require Compress::Zlib; }; if(!$@){ - $mod_gz = 1; - import Compress::Zlib; + $mod_gz = 1; + import Compress::Zlib; } eval { $eval_in_died = 1; require Net::FTP; }; if(!$@){ - $mod_ftp = 1; - import Net::FTP; + $mod_ftp = 1; + import Net::FTP; +} +eval { $eval_in_died = 1; require Net::FTPSSL; }; +if(!$@){ + $mod_ftpssl = 1; + import Net::FTPSSL; } eval { $eval_in_died = 1; require MIME::Lite; }; if(!$@){ - $mod_mime = 1; - import MIME::Lite; + $mod_mime = 1; + import MIME::Lite; } #include config file $conffile=""; -use Getopt::Long; +#read args from command GetOptions ("config=s" => \$conffile, "html_output=s" => \$html_output); -if (!defined $html_output) { $html_output=0; }; # suppress HTML Output +if (!defined $html_output) { $html_output=0; }; # suppress HTML Output +#called via browser or cmd if($ENV{'QUERY_STRING'}) { - $html_output=1; # turn HTML Output on if called via Browser-Request - my $querystring=$ENV{'QUERY_STRING'}; - #$querystring=~ s/\?/ /g; - @key_value = split(/&/,$querystring); - foreach $pair(@key_value) - { - #$pair =~ tr/+/ /; - ($key,$value) = split(/=/,$pair); - if($key eq "config") - { - $value=~ s/\?/ /g; - $conffile=$value; - $config_read_from="Querystring"; - } - if($key eq "html_output") { $html_output=$value; }; # overwrite var if given in call - } + $html_output=1; # turn HTML Output on if called via Browser-Request + my $querystring=$ENV{'QUERY_STRING'}; + #$querystring=~ s/\?/ /g; + @key_value = split(/&/,$querystring); + foreach $pair(@key_value) + { + #$pair =~ tr/+/ /; + ($key,$value) = split(/=/,$pair); + if($key eq "config") + { + $value=~ s/\?/ /g; + $conffile=$value; + $config_read_from="Querystring"; + } + if($key eq "html_output") { $html_output=$value; }; # overwrite var if given in call + } }else{ - $config_read_from="shell"; + $config_read_from="shell"; } # Now we know if script was called via HTTP-Requets or from Shell. So output Headers @@ -129,39 +160,63 @@ PrintHeader(); die "Hacking attempt - I wont do anything!\nGo away\n\n" if (lc($conffile) =~ m /:/); #try to guess path if $absolute_path_of_configdir is not filled -if($absolute_path_of_configdir eq "" || ! -d $absolute_path_of_configdir) -{ - #get full path - if ($config_read_from eq "shell") { $i=$0; } else { $i=$ENV{'SCRIPT_FILENAME'}; }; - #regex from http://www.perlmonks.org/?node_id=47035 - if ($i=~m#^(.*)\\#) { - #windows - $absolute_path_of_configdir = "$1"."work\\config\\"; - } elsif ($i=~m#^(.*)/# ) { - #*nix - $absolute_path_of_configdir = "$1"."work/config/"; - } - $absolute_path_of_configdir =~ s/msd\_cron//g; +if($absolute_path_of_configdir eq "" || ! -d $absolute_path_of_configdir) +{ + #get full path + if ($config_read_from eq "shell") { $i=$0; } else { $i=$ENV{'SCRIPT_FILENAME'}; }; + if ($i=~m#^(.*)\\#) { + #windows + $current_dir = $1; + $current_dir =~ s/msd\_cron//g; + + #set default log-files + $logdatei= $current_dir ."work\\log\\mysqldump_perl.log"; + $completelogdatei= $current_dir . "work\\log\\mysqldump_perl.complete.log"; + + $absolute_path_of_configdir = $current_dir ."work\\config\\"; + } elsif ($i=~m#^(.*)\/# ) { + #*nix + $current_dir = $1; + $current_dir =~ s/msd\_cron//g; + + #set default log-files + $logdatei= $current_dir ."work/log/mysqldump_perl.log"; + $completelogdatei= $current_dir . "work/log/mysqldump_perl.complete.log"; + + $absolute_path_of_configdir = $current_dir."work/config/"; + } + #$absolute_path_of_configdir =~ s/msd\_cron//g; + $backup_path = $absolute_path_of_configdir; + $backup_path =~ s/config/backup/g; + + #if zlib is available, set default to compress + if ($mod_gz){ + $logdatei .= ".gz"; + $completelogdatei .= ".gz"; + $logcompression=1; + } } $conffile=trim($conffile); if($conffile eq "") { - $conffile=$default_configfile; # no Parameter for configfile given -> use standardfile "mysqldumper.php.conf" - $config_read_from="standard configuration"; + $conffile=$default_configfile; # no Parameter for configfile given -> use standardfile "mysqldumper.conf.php" + $config_read_from="standard configuration"; } - # check config-dir $absolute_path_of_configdir=trim($absolute_path_of_configdir); # remove spaces -opendir(DIR, $absolute_path_of_configdir) or die "The config-directory you entered is wrong !\n($absolute_path_of_configdir - $!) \n\nPlease edit the crondump.pl and enter the right configuration-path.\n\n"; +if (!opendir(DIR, $absolute_path_of_configdir)){ + err_trap("The config-directory you entered is wrong !\n($absolute_path_of_configdir - $!) \n\nPlease edit $0 and enter the right configuration-path.\n",0,1); +} closedir(DIR); -my $abc=length($absolute_path_of_configdir)-1; -my $defed=substr($absolute_path_of_configdir,$abc,1); -if($defed ne "/") { - $absolute_path_of_configdir=$absolute_path_of_configdir."/"; + +#add trailing slash to confdir +if(substr($absolute_path_of_configdir,-1) ne "/") { + $absolute_path_of_configdir=$absolute_path_of_configdir."/"; } +#add conffile extension if (substr($conffile,length($conffile)-5,5) eq '.conf') { $conffile.='.php'; }; if (substr($conffile,length($conffile)-9,9) ne '.conf.php') { $conffile.='.conf.php'; }; @@ -170,81 +225,95 @@ $datei=$absolute_path_of_configdir.$conffile; open(CONFIG,"<$datei") or die "\nI couldn't open the configurationfile:".$datei."\nFile not found or not accessible!\n\n"; while (my $line = ) { - chomp($line); - if ($line ne '' && substr($line,0,1) ne '#') - { - eval($line); - } + chomp($line); + if ($line ne '' && substr($line,0,1) ne '#') + { + eval($line); + } } close(CONFIG); if ($html_output==1) { $cron_printout=1; }; # overwrite output if HTML-Output is activated +# more than one conffile? @confname=split(/\//,$conffile); -PrintOut("Configurationfile '".$conffile."' was loaded successfully from ".$config_read_from." ."); +PrintOut("Configuration '".$conffile."' loaded successfully from ".$config_read_from."."); if($mod_gz==1) { - PrintOut("Compression Library loaded successfully..."); + PrintOut("Compression Library loaded successfully..."); } else { - $compression=0; - PrintOut("Compression Library loading failed - Compression deactivated ..."); + $compression=0; + PrintOut("Compression Library loading failed - Compression deactivated ..."); } if($mod_ftp==1) { - PrintOut("FTP Library loaded successfully..."); + PrintOut("FTP Library loaded successfully..."); } else { - $cronftp=0; - PrintOut("FTP Library loading failed - FTP deactivated ..."); + $cronftp=0; + PrintOut("FTP Library loading failed - FTP deactivated ..."); +} +if($mod_ftpssl==1) { + PrintOut("FTP-SSL Library loaded successfully..."); + $cronftp=1; +} else { + $cronftp=0; + PrintOut("FTP-SSL Library loading failed - FTP-SSL deactivated ..."); } if($mod_mime==1) { - PrintOut("Mail Library loaded successfully..."); + PrintOut("Mail Library loaded successfully..."); } else { - $cronmail=0; - PrintOut("Mail Library loading failed - Mail deactivated ..."); + $cronmail=0; + PrintOut("Mail Library loading failed - Mail deactivated ..."); } -#teste Zugriff auf logfile -write_log("Starting backup using Perlscript version $pcd_version (configuration $conffile)\n"); +#try writing to logfile +write_log("***********************************************************************\n"); +write_log("Starting backup using Perlscript version $pcd_version (using perl ".GetPerlVersion().")\n"); +PrintOut("Starting backup using Perlscript version $pcd_version (using perl ".GetPerlVersion().")\n"); +write_log("Using configuration $conffile\n"); -#Jetzt den Dump anschmeissen -# mal schauen, obs mehrere DB's sind +#now do the dump + +#more than one db if($cron_dbindex > -1) { - $dbname=$cron_db_array[$cron_dbindex]; - $dbpraefix=$cron_dbpraefix_array[$cron_dbindex]; - $command_beforedump=$cron_command_before_dump[$cron_dbindex]; - $command_afterdump=$cron_command_after_dump[$cron_dbindex]; - ExecuteCommand(1,$command_beforedump); - DoDump(); - ExecuteCommand(2,$command_afterdump); + $dbname=$cron_db_array[$cron_dbindex]; + $dbpraefix=$cron_dbpraefix_array[$cron_dbindex]; + $command_beforedump=$cron_command_before_dump[$cron_dbindex]; + $command_afterdump=$cron_command_after_dump[$cron_dbindex]; + ExecuteCommand(1,$command_beforedump); + DoDump(); + ExecuteCommand(2,$command_afterdump); } else { - $db_anz=@cron_db_array; - for(my $ii = 0; $ii < $db_anz; $ii++) - { - if ($mp>0) { $mp=1; } # Part-Reset if using Multipart (for next database) - $dbname=$cron_db_array[$ii]; - $dbpraefix=$cron_dbpraefix_array[$ii]; - $command_beforedump=$cron_command_before_dump[$ii]; - $command_afterdump=$cron_command_after_dump[$ii]; - PrintOut("
Starting backup ".($ii+1)." of $db_anz (database `$dbname` ".(($dbpraefix ne "") ? "- looking for tables with prefix '$dbpraefix')" : ")")); - ExecuteCommand(1,$command_beforedump); - DoDump(); - ExecuteCommand(2,$command_afterdump); - } - PrintOut("
ALL $db_anz BACKUPS ARE DONE!!!"); + $db_anz=@cron_db_array; + for(my $ii = 0; $ii < $db_anz; $ii++) + { + if ($mp>0) { $mp=1; } # Part-Reset if using Multipart (for next database) + $dbname=$cron_db_array[$ii]; + $dbpraefix=$cron_dbpraefix_array[$ii]; + $command_beforedump=$cron_command_before_dump[$ii]; + $command_afterdump=$cron_command_after_dump[$ii]; + PrintOut("
Starting to backup database `$dbname` (".($ii+1)."/$db_anz)."); + if ($dbpraefix ne "") { + PrintOut("Scanning for tables with prefix '$dbpraefix')"); + } + ExecuteCommand(1,$command_beforedump); + DoDump(); + ExecuteCommand(2,$command_afterdump); + } } if($auto_delete>0) { - if($max_backup_files>0) - { - PrintOut("
Starting autodelete function:
Keep the latest $max_backup_files backup files for each database and delete older ones."); - find(\&AutoDeleteCount, $backup_path); - DoAutoDeleteCount(); - DeleteFiles (\@trash_files); - } + if($max_backup_files>0) + { + PrintOut("
Starting autodelete function:
Keep the latest $max_backup_files backup files for each database and delete older ones."); + find(\&AutoDeleteCount, $backup_path); + DoAutoDeleteCount(); + DeleteFiles (\@trash_files); + } } closeScript(); if ($html_output==0) { print "\nEnd of Cronscript\n"; } @@ -253,923 +322,996 @@ if ($html_output==0) { print "\nEnd of Cronscript\n"; } # Subroutinen # ############################################## sub DoDump { - undef(%db_tables); - ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - $Jahr+=1900;$Monat+=1;$Jahrestag+=1; - my $CTIME_String = localtime(time); - my $ret=0; - $time_stamp=$Jahr."_".sprintf("%02d",$Monat)."_".sprintf("%02d",$Monatstag)."_".sprintf("%02d",$Stunden)."_".sprintf("%02d",$Minuten); - $starttime= sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".$Jahr." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten); - $fieldlist=""; - # Verbindung mit MySQL herstellen, $dbh ist das Database Handle - if (trim($dbsocket) eq "") - { - $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; - } - else - { - $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport;mysql_socket=$dbsocket","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; - } - # herausfinden welche Mysql-Version verwendet wird - $sth = $dbh->prepare("SELECT VERSION()"); - $sth->execute; - my @mysql_version=$sth->fetchrow; - my @v=split(/\./,$mysql_version[0]); + undef(%db_tables); + ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + $Jahr+=1900;$Monat+=1;$Jahrestag+=1; + my $CTIME_String = localtime(time); + my $ret=0; + $time_stamp=$Jahr."_".sprintf("%02d",$Monat)."_".sprintf("%02d",$Monatstag)."_".sprintf("%02d",$Stunden)."_".sprintf("%02d",$Minuten); + $starttime= sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".$Jahr." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten); + $fieldlist=""; + # Verbindung mit MySQL herstellen, $dbh ist das Database Handle + if (trim($dbsocket) eq "") + { + $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; + } + else + { + $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport;mysql_socket=$dbsocket","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; + } + # herausfinden welche Mysql-Version verwendet wird + $sth = $dbh->prepare("SELECT VERSION()"); + $sth->execute; + my @mysql_version=$sth->fetchrow; + my @v=split(/\./,$mysql_version[0]); - if($v[0]>=5 || ($v[0]>=4 && $v[1]>=1) ) - { - #mysql Version >= 4.1 - $sth = $dbh->prepare("SET NAMES '".$character_set."'"); - $sth->execute; - # get standard encoding of MySQl-Server - $sth = $dbh->prepare("SHOW VARIABLES LIKE 'character_set_connection'"); - $sth->execute; - @ar=$sth->fetchrow; - $character_set=$ar[1]; - PrintOut("Characterset of connection and backup file set to ".$character_set."."); - } - else - { - # mysql Version < 4.1 -> no SET NAMES available - # get standard encoding of MySQl-Server - $sth = $dbh->prepare("SHOW VARIABLES LIKE 'character_set'"); - $sth->execute; - @ar=$sth->fetchrow; - if (defined($ar[1])) { $character_set=$ar[1]; } - PrintOut("Characterset of connection is ".$character_set."."); - } + if($v[0]>=5 || ($v[0]>=4 && $v[1]>=1) ) + { + #mysql Version >= 4.1 + $sth = $dbh->prepare("SET NAMES '".$character_set."'"); + $sth->execute; + # get standard encoding of MySQl-Server + $sth = $dbh->prepare("SHOW VARIABLES LIKE 'character_set_connection'"); + $sth->execute; + @ar=$sth->fetchrow; + $character_set=$ar[1]; + } + else + { + # mysql Version < 4.1 -> no SET NAMES available + # get standard encoding of MySQl-Server + $sth = $dbh->prepare("SHOW VARIABLES LIKE 'character_set'"); + $sth->execute; + @ar=$sth->fetchrow; + if (defined($ar[1])) { $character_set=$ar[1]; } + } + PrintOut("Characterset of connection and backup file set to ".$character_set."."); + + #Statuszeile erstellen + my $t=0; + my $r=0; + my $st_e="\n"; + undef(@tables); + undef(@tablerecords); + my $value=0; + my $engine=''; + my %db_tables_views; + my $query="SHOW TABLE STATUS FROM `$dbname`"; + if ($dbpraefix ne "") + { + $query.=" LIKE '$dbpraefix%'"; + PrintOut("Searching for tables inside database `$dbname` with prefix '$dbpraefix'."); + } + else + { + PrintOut("Searching for tables inside database `$dbname`."); + } + $sth = $dbh->prepare($query); + $sth->execute || err_trap("Error executing: ".$query." ! MySQL-Error: ".$DBI::errstr); + while ( $value=$sth->fetchrow_hashref()) + { + $value->{skip_data}=0; #defaut -> backup data of table + # decide if we need to skip the data while dumping (VIEWs and MEMORY) + + # check for old MySQL3-Syntax Type=xxx + if (defined $value->{Type}) + { + # port old index type to index engine, so we can use the index Engine in the rest of the script + $value->{Engine}=$value->{Type}; + $engine=uc($value->{Type}); + if ($engine eq "MEMORY") + { + $value->{skip_data}=1; + } + } - - #Statuszeile erstellen - my $t=0; - my $r=0; - my $st_e="\n"; - undef(@tables); - undef(@tablerecords); - my $value=0; - my $engine=''; - my $query="SHOW TABLE STATUS FROM `$dbname`"; - if ($dbpraefix ne "") - { - $query.=" LIKE '$dbpraefix%'"; - PrintOut("Searching for tables inside database `$dbname` with prefix '$dbpraefix'"); - } - else - { - PrintOut("Searching for tables inside database `$dbname`"); - } - $sth = $dbh->prepare($query); - $sth->execute || err_trap("Error executing: ".$query." ! MySQL-Error: ".$DBI::errstr); - while ( $value=$sth->fetchrow_hashref()) - { - $value->{skip_data}=0; #defaut -> backup data of table - # decide if we need to skip the data while dumping (VIEWs and MEMORY) - - # check for old MySQL3-Syntax Type=xxx - if (defined $value->{Type}) - { - # port old index type to index engine, so we can use the index Engine in the rest of the script - $value->{Engine}=$value->{Type}; - $engine=uc($value->{Type}); - if ($engine eq "MEMORY") - { - $value->{skip_data}=1; - } - } + # check for >MySQL3 Engine=xxx + if (defined $value->{Engine}) + { + $engine=uc($value->{Engine}); + if ($engine eq "MEMORY") + { + $value->{skip_data}=1; + } + } - # check for >MySQL3 Engine=xxx - if (defined $value->{Engine}) - { - $engine=uc($value->{Engine}); - if ($engine eq "MEMORY") - { - $value->{skip_data}=1; - } - } + # check for Views - if it is a view the comment starts with "VIEW" + if (defined $value->{Comment} && uc(substr($value->{Comment},0,4)) eq 'VIEW') + { + $value->{skip_data}=1; + $value->{Engine}='VIEW'; + $value->{Update_time}=''; + $db_tables_views{$value->{Name}}=$value; + } + else + { + $db_tables{$value->{Name}}=$value; + } + # cast indexes to int, cause they are used for builing the statusline + $value->{Rows}+=0; + $value->{Data_length}+=0; + $value->{Index_length}+=0; - # check for Views - if it is a view the comment starts with "VIEW" - if (defined $value->{Comment} && uc(substr($value->{Comment},0,4)) eq 'VIEW') - { - $value->{skip_data}=1; - } + } + $sth->finish; - $db_tables{$value->{Name}}=$value; - } - $sth->finish; + @tablenames=sort keys(%db_tables); + # add VIEW at the end as they need all tables to be created before + @tablenames = (@tablenames,sort keys(%db_tables_views)); + %db_tables = (%db_tables,%db_tables_views); + + $tablename=''; + if (@tablenames<1) + { + PrintOut("There are no tables inside database ".$dbname."! It doesn't make sense to backup an empty database. Skipping this one."); + return; + } + if($optimize_tables_beforedump==1) + { + optimise_tables(); + } + + $st_e.="-- TABLE-INFO\n"; + foreach $tablename (@tablenames) + { + my $dump_table=1; + if ($dbpraefix ne "") + { + if (substr($tablename,0,length($dbpraefix)) ne $dbpraefix) + { + # exclude table from backup because it doesn't fit to praefix + $dump_table=0; + } + } + + if ($dump_table==1) + { + $r+=$db_tables{$tablename}{Rows}; #calculate nr of records + push(@tables,$db_tables{$tablename}{Name}); # add tablename to backuped tables + $t++; + if (!defined $db_tables{$tablename}{Update_time}) + { + $db_tables{$tablename}{Update_time}=0; + } + + $st_e.=$mysql_commentstring."TABLE\|$db_tables{$tablename}{Name}\|$db_tables{$tablename}{Rows}\|".($db_tables{$tablename}{Data_length}+$db_tables{$tablename}{Index_length})."\|$db_tables{$tablename}{Update_time}|$db_tables{$tablename}{Engine}\n"; + } + } + $st_e.="-- EOF TABLE-INFO"; + + PrintOut("Found ".(@tables)." tables with $r records."); - @tablenames=sort keys(%db_tables); - $tablename=''; - if (@tablenames<1) - { - PrintOut("There are no tables inside database ".$dbname."! It doesn't make sense to backup an empty database. Skipping this one."); - return; - } - if($optimize_tables_beforedump==1) - { - optimise_tables(); - } - - $st_e.="-- TABLE-INFO\n"; - foreach $tablename (@tablenames) - { - my $dump_table=1; - if ($dbpraefix ne "") - { - if (substr($tablename,0,length($dbpraefix)) ne $dbpraefix) - { - # eclude tabel from backup because it doesn't fit to praefix - $dump_table=0; - } - } - - if ($dump_table==1) - { - $r+=$db_tables{$tablename}{Rows}; #calculate nr of records - push(@tables,$db_tables{$tablename}{Name}); # add tablename to backupped tables - $t++; - if (!defined $db_tables{$tablename}{Update_time}) - { - $db_tables{$tablename}{Update_time}=0; - } - - $st_e.=$mysql_commentstring."TABLE\|$db_tables{$tablename}{Name}\|$db_tables{$tablename}{Rows}\|".($db_tables{$tablename}{Data_length}+$db_tables{$tablename}{Index_length})."\|$db_tables{$tablename}{Update_time}|$db_tables{$tablename}{Engine}\n"; - } - } - $st_e.="-- EOF TABLE-INFO"; - - PrintOut("Found ".(@tables)." tables with $r records."); - - #AUFBAU der Statuszeile: - # -- Status:tabellenzahl:datensaetze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:EXTINFO - # Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt) - # (complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables) - # - $status_start=$mysql_commentstring."Status:$t:$r:"; - my $flags="1$optimize_tables_beforedump"; - $status_end=":$dbname:perl:$pcd_version:$my_comment:$mysql_version[0]:$flags"; - $status_end.=":$command_beforedump:$command_afterdump:$character_set:EXTINFO$st_e\n".$mysql_commentstring."Dump created on $CTIME_String by PERL Cron-Script\n".$mysql_commentstring."Dump by MySQLDumper (http://www.mysqldumper.de/)\n\n"; + #AUFBAU der Statuszeile: + # -- Status:tabellenzahl:datensaetze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:EXTINFO + # Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt) + # (complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables) + # + $status_start=$mysql_commentstring."Status:$t:$r:"; + my $flags="1$optimize_tables_beforedump"; + $status_end=":$dbname:perl:$pcd_version:$my_comment:$mysql_version[0]:$flags"; + $status_end.=":$command_beforedump:$command_afterdump:$character_set:EXTINFO$st_e\n".$mysql_commentstring."Dump created on $CTIME_String by PERL Cron-Script\n".$mysql_commentstring."Dump by MySQLDumper (http://www.mysqldumper.net/)\n\n"; - if($mp>0) - { - $sql_text=$status_start."MP_$mp".$status_end; - } - else - { - $sql_text=$status_start.$status_end; - } - NewFilename(); - - $totalrecords=0; - foreach $tablename (@tables) - { - # first get CREATE TABLE Statement - if($dbpraefix eq "" || ($dbpraefix ne "" && substr($tablename,0,length($dbpraefix)) eq $dbpraefix)) - { - PrintOut("Dumping table `$tablename` "); - $a="\n\n$mysql_commentstring\n$mysql_commentstring Create Table `$tablename`\n$mysql_commentstring\n\nDROP TABLE IF EXISTS `$tablename`;\n"; - $sql_text.=$a; - $sql_create="SHOW CREATE TABLE `$tablename`"; - $sth = $dbh->prepare($sql_create); - if (!$sth) - { - err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); - } + if($mp>0) + { + $sql_text=$status_start."MP_$mp".$status_end; + } + else + { + $sql_text=$status_start.$status_end; + } + NewFilename(); + + $totalrecords=0; + foreach $tablename (@tables) + { + # first get CREATE TABLE Statement + if($dbpraefix eq "" || ($dbpraefix ne "" && substr($tablename,0,length($dbpraefix)) eq $dbpraefix)) + { + PrintOut("Dumping table `$tablename` (Type ".$db_tables{$tablename}{Engine}."):"); + $a="\n\n$mysql_commentstring\n$mysql_commentstring"."Table structure for table `$tablename`\n$mysql_commentstring\n"; + if ($db_tables{$tablename}{Engine} ne 'VIEW' ) { + $a.="DROP TABLE IF EXISTS `$tablename`;\n"; + } else { + $a.="DROP VIEW IF EXISTS `$tablename`;\n"; + } + $sql_text.=$a; + $sql_create="SHOW CREATE TABLE `$tablename`"; + $sth = $dbh->prepare($sql_create); + if (!$sth) + { + err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); + } - $sth->execute || err_trap("Couldn't execute ".$sql_create); - @ergebnis=$sth->fetchrow; - $sth->finish; - $a=$ergebnis[1].";\n"; - if (length($a)<10) - { - err_trap("Fatal error! Couldn't read CREATE-Statement of table `$tabelle`! This backup might be incomplete! Check your database for errors.",1); - $skip=1; - } - else - { - $sql_text.=$a; - } - - if ($db_tables{$tablename}{skip_data} == 0) - { - $sql_text.="\n$mysql_commentstring\n$mysql_commentstring Data for Table `$tablename`\n$mysql_commentstring\n"; - $sql_text.="\n/*!40000 ALTER TABLE `$tablename` DISABLE KEYS */;"; + $sth->execute || err_trap("Couldn't execute ".$sql_create); + @ergebnis=$sth->fetchrow; + $sth->finish; + $a=$ergebnis[1].";\n"; + if (length($a)<10) + { + err_trap("Fatal error! Couldn't read CREATE-Statement of table `$tabelle`! This backup might be incomplete! Check your database for errors."."' MySQL-Error: ".$DBI::errstr,1); + $skip=1; + } + else + { + $sql_text.=$a; + } + + if ($db_tables{$tablename}{skip_data} == 0) + { + $sql_text.="\n$mysql_commentstring\n$mysql_commentstring"."Dumping data for table `$tablename`\n$mysql_commentstring\n"; + $sql_text.="/*!40000 ALTER TABLE `$tablename` DISABLE KEYS */;"; - WriteToFile($sql_text,0); - $sql_text=""; - $punktzaehler=0; - $fieldlist="("; - $sql_create="SHOW FIELDS FROM `$tablename`"; - $sth = $dbh->prepare($sql_create); - if (!$sth) - { - err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); - } - - $sth->execute || err_trap("Couldn't execute ".$sql_create); - while ( @ar=$sth->fetchrow) { - $fieldlist.="`".$ar[0]."`,"; - } - $sth->finish; - $fieldlist=substr($fieldlist,0,length($fieldlist)-1).")"; + WriteToFile($sql_text,0); + $sql_text=""; + $punktzaehler=0; - # daten auslesen - $rct=$db_tables{$tablename}{Rows}; + # build fieldlist + $fieldlist="("; + $sql_create="SHOW FIELDS FROM `$tablename`"; + $sth = $dbh->prepare($sql_create); + if (!$sth) + { + err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); + } + + $sth->execute || err_trap("Couldn't execute ".$sql_create); + while ( @ar=$sth->fetchrow) { + $fieldlist.="`".$ar[0]."`,"; + } + $sth->finish; + + # remove trailing ',' and add ')' + $fieldlist=substr($fieldlist,0,length($fieldlist)-1).")"; - for (my $ttt=0;$ttt<$rct;$ttt+=$perlspeed) - { - $insert = "INSERT INTO `$tablename` $fieldlist VALUES ("; - $first_insert=0; - $sql_daten="SELECT * FROM `$tablename` LIMIT ".$ttt.",".$perlspeed.";"; - $sth = $dbh->prepare($sql_daten); - if (!$sth) - { - err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); - } - $sth->execute || err_trap("Couldn't execute \"".$sql_daten."\" - MySQL-Error: ".$DBI::errstr); - while ( @ar=$sth->fetchrow) - { - #Start the insert - if($first_insert==0) - { - $a="\n$insert"; - } - else - { - $a="\n("; - } - foreach $inhalt(@ar) { $a.= $dbh->quote($inhalt).","; } - $a=substr($a,0, length($a)-1).");"; - $sql_text.= $a; - if($memory_limit>0 && length($sql_text)>$memory_limit) - { - WriteToFile($sql_text); - $sql_text=""; - if($mp>0 && $filesize>$multipart_groesse) {NewFilename();} - } - } - $sth->finish; - } - $sql_text.="\n/*!40000 ALTER TABLE `$tablename` ENABLE KEYS */;"; - } + # how many rows + $rct=$db_tables{$tablename}{Rows}; - #jetzt wegschreiben - WriteToFile($sql_text); - $sql_text=""; - PrintOut("\n
$db_tables{$tablename}{Rows} inserted records (size of backupfile now: ".byte_output($filesize).")"); - $totalrecords+=$db_tables{$tablename}{Rows}; - if($mp>0 && $filesize>$multipart_groesse) {NewFilename();} - } - } - # Ende - WriteToFile("\nSET FOREIGN_KEY_CHECKS=1;\n"); - WriteToFile($mysql_commentstring."EOB\n"); - PrintOut("\n
Finished backup of database `$dbname`."); - write_log("Finished backup of database `$dbname`.\n"); + for (my $ttt=0;$ttt<$rct;$ttt+=$perlspeed) + { + # default beginning for INSERT-String + $insert = "INSERT INTO `$tablename` $fieldlist VALUES ("; + $first_insert=0; + + # get rows (parts) + $sql_daten="SELECT * FROM `$tablename` LIMIT ".$ttt.",".$perlspeed.";"; + $sth = $dbh->prepare($sql_daten); + if (!$sth) + { + err_trap("Fatal error sending Query '".$sql_create."'! MySQL-Error: ".$DBI::errstr); + } + $sth->execute || err_trap("Couldn't execute \"".$sql_daten."\" - MySQL-Error: ".$DBI::errstr); + while ( @ar=$sth->fetchrow) + { + #Start the insert + if($first_insert==0) + { + $a="\n$insert"; + } + else + { + $a="\n("; + } + + # quote all values + foreach $inhalt(@ar) { $a.= $dbh->quote($inhalt).","; } + + # remove trailing ',' and add end-sql + $a=substr($a,0, length($a)-1).");"; + $sql_text.= $a; + if($memory_limit>0 && length($sql_text)>$memory_limit) + { + WriteToFile($sql_text); + $sql_text=""; + if($mp>0 && $filesize>$multipart_groesse) {NewFilename();} + } + } + $sth->finish; + } + $sql_text.="\n/*!40000 ALTER TABLE `$tablename` ENABLE KEYS */;\n"; + } - # Jetzt der Versand per Mail - if($cronmail==1) { - PrintOut("Sending E-Mail ..."); - $ret=send_mail(); - if ($ret) - { - write_log("Recipient/s: $cronmailto $cronmailto_cc\n"); - PrintOut("Recipient/s: $cronmailto $cronmailto_cc\n"); - } - } + # write sql commands to file + WriteToFile($sql_text); + $sql_text=""; - # Jetzt der Versand per FTP - send_ftp(); + if ($db_tables{$tablename}{skip_data} == 0) + { + PrintOut("\n
$db_tables{$tablename}{Rows} inserted records (size of backupfile: ".byte_output($filesize).")"); + $totalrecords+=$db_tables{$tablename}{Rows}; + } + else + { + PrintOut("\n
Dumping structure of `$tablename` (Type ".$db_tables{$tablename}{Engine}." ) (size of backupfile: ".byte_output($filesize).")"); + } + + if($mp>0 && $filesize>$multipart_groesse) {NewFilename();} + } + } + # end + WriteToFile("\nSET FOREIGN_KEY_CHECKS=1;\n"); + WriteToFile($mysql_commentstring."EOB\n"); + PrintOut("\n
Finished backup of database `$dbname`.\n"); + write_log("Finished backup of database `$dbname`.\n"); + + # sent via email + if($cronmail==1) { + PrintOut("Sending E-Mail ..."); + $ret=send_mail(); + if ($ret) + { + write_log("Recipient/s: $cronmailto $cronmailto_cc\n"); + PrintOut("Recipient/s: $cronmailto $cronmailto_cc\n"); + } + } + + # sent to ftp-server + send_ftp(); } -#Wird aufgerufen, wenn Fehler passieren +#print error message and optional exit sub err_trap { - $error_message = shift(@_); - my $continue = shift(@_); - PrintOut("Perl Cronscript ERROR: $error_message
"); - write_log("Perl Cronscript ERROR: $error_message
"); - if (!defined $continue) - { - PrintOut("Stopping script because of this fatal error!
"); - write_log("Stopping script because of this fatal error!
"); - exit(1); - } + my $error_message = shift(@_); + + #continue instead of exit + my $continue = shift(@_); + + #don't write to logfile, if we did not read config before + my $nolog = shift(@_); + + PrintOut("Perl Cronscript ERROR: $error_message
\n"); + write_log("Perl Cronscript ERROR: $error_message
\n") if !defined $nolog; + if (!defined $continue || $continue ==0) + { + PrintOut("Stopping script because of this fatal error!
\n"); + write_log("Stopping script because of this fatal error!
\n") if !defined $nolog; + exit(1); + } } sub PrintHeader { - my $cgi = new CGI; - if ($html_output==1) - { - print $cgi->header(-type => 'text/html; charset=utf-8', -cache_control => 'no-cache, no-store, must-revalidate'); - print "\n"; - print "MySQLDumper - Perl CronDump [Version $pcd_version]"; - print ""; - print "

MySQLDumper - Perl CronDump [Version $pcd_version]

\n"; - } - else - { - #Mini-Ausgabe fuer externe Cronjob-Dienste, die eine kleine Rueckgabe erwarten - print "MySQLDumper - Perl CronDump [Version $pcd_version] started successfully\n"; - } + my $cgi = new CGI; + my $perlversion = GetPerlVersion(); + + if ($html_output==1) + { + print $cgi->header(-type => 'text/html; charset=utf-8', -cache_control => 'no-cache, no-store, must-revalidate'); + print "\n"; + print "\n\nMySQLDumper - Perl CronDump [Version $pcd_version (using perl $perlversion)]\n"; + print "\n"; + print "\n

MySQLDumper - Perl CronDump [Version $pcd_version (using perl $perlversion)]

\n"; + } + else + { + #small output for external cronjobs, which expect a small returnvalue + print "MySQLDumper - Perl CronDump [Version $pcd_version] started successfully (using perl $perlversion)\n"; + } } sub PrintOut { - $print_out = shift(@_); + $print_out = shift(@_); - if (defined $print_out && length(trim($print_out))>0) - { - if($complete_log==1) - { - my $logsize=0; - ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - $Jahr+=1900; $Monat+=1;$Jahrestag+=1; - $dt=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".sprintf("%02d",$Jahr)." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); - if (-e $completelogdatei) - { - $logsize=(stat($completelogdatei))[7]; - unlink($completelogdatei) if($logsize + length($print_out)>$log_maxsize && $log_maxsize>0); - } - my $output=$print_out; - #$output =~ s/<(.*?)>//gi; - $output =~ s/\n//gi; - $output =~ s/\r//gi; - $output =~ s/
//gi; - $output=trim($output); - - if ( ($logcompression==0) || ($mod_gz==0)) - { - open(DATEI,">>$completelogdatei") || err_trap('can\'t open mysqldump_perl.complete.log ('.$completelogdatei.').'); - print DATEI "$dt $output\n" || err_trap('can\'t write to mysqldump_perl.complete.log ('.$completelogdatei.').'); - close(DATEI)|| err_trap('can\'t close mysqldump_perl.complete.log ('.$completelogdatei.').'); - chmod(0777,$completelogdatei); - } - else - { - $gz = gzopen($completelogdatei, "ab") || err_trap("Cannot open mysqldump_perl.complete.log. "); - $gz->gzwrite("$dt $output\n") || err_trap("Error writing mysqldump_perl.complete.log. "); - $gz->gzclose ; - chmod(0777,$completelogdatei); - } - } - if($cron_printout==1) - { - local ($oldbar) = $|; - $cfh = select (STDOUT); - $| = 1; - if($html_output==0) - { - $print_out =~ s/<(.*?)>//gi; - } - - print $print_out; - if ($html_output==1){ print "
\n"; } else { print "\n"; }; - $| = $oldbar; - select ($cfh); - } - } + if (defined $print_out && length(trim($print_out))>0) + { + if($complete_log==1) + { + my $logsize=0; + ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + $Jahr+=1900; $Monat+=1;$Jahrestag+=1; + $dt=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".sprintf("%02d",$Jahr)." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); + if (-e $completelogdatei) + { + $logsize=(stat($completelogdatei))[7]; + unlink($completelogdatei) if($logsize + length($print_out)>$log_maxsize && $log_maxsize>0); + } + my $output=$print_out; + #$output =~ s/<(.*?)>//gi; + $output =~ s/\n//gi; + $output =~ s/\r//gi; + $output =~ s/
//gi; + $output=trim($output); + + if ( ($logcompression==0) || ($mod_gz==0)) + { + open(DATEI,">>$completelogdatei") || err_trap('can\'t open mysqldump_perl.complete.log ('.$completelogdatei.').'); + print DATEI "$dt $output\n" || err_trap('can\'t write to mysqldump_perl.complete.log ('.$completelogdatei.').'); + close(DATEI)|| err_trap('can\'t close mysqldump_perl.complete.log ('.$completelogdatei.').'); + chmod(0777,$completelogdatei); + } + else + { + $gz = gzopen($completelogdatei, "ab") || err_trap("Cannot open mysqldump_perl.complete.log.gz. "); + $gz->gzwrite("$dt $output\n") || err_trap("Error writing mysqldump_perl.complete.log.gz. "); + $gz->gzclose ; + chmod(0777,$completelogdatei); + } + } + if($cron_printout==1) + { + #save current autoflush-setting + local ($oldbar) = $|; + + #save current output filehandle and change it to STDOUT + $cfh = select (STDOUT); + + #set autoflush on + $| = 1; + + #remove html-tags + if($html_output==0) + { + $print_out =~ s/<(.*?)>//gi; + } + + print $print_out; + + #TODO don't print
with the last printout (-> wrong html-syntax) + if ($html_output==1){ print "
\n"; } else { print "\n"; }; + + #restore old autoflush-setting + $| = $oldbar; + + #set default output back to old filehandle + select ($cfh); + } + } } sub write_log { - $msg = shift(@_); - ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - $Jahr+=1900; $Monat+=1;$Jahrestag+=1; - $dt=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".sprintf("%02d",$Jahr)." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); + $msg = shift(@_); + ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + $Jahr+=1900; $Monat+=1;$Jahrestag+=1; + #$dt=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".sprintf("%02d",$Jahr)." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); + $dt=sprintf("%02d.%02d.%02d %02d:%02d:%02d",$Monatstag,$Monat,$Jahr,$Stunden,$Minuten,$Sekunden); - my $logsize=0; - if (-e $logdatei) - { - $logsize=(stat($logdatei))[7]; - unlink($logdatei) if($logsize+200>$log_maxsize && $log_maxsize>0); - } + my $logsize=0; + if (-e $logdatei) + { + $logsize=(stat($logdatei))[7]; + unlink($logdatei) if($logsize+200>$log_maxsize && $log_maxsize>0); + } - if ( ($logcompression==0) || ($mod_gz==0)) - { - open(DATEI,">>$logdatei") || err_trap("Can't open file ($logdatei)."); - print DATEI "$dt $msg" || err_trap("Can't write to file ($logdatei)."); - close(DATEI)|| err_trap("can't close file ($logdatei)."); - chmod(0777,$logdatei); - } - else - { - $gz = gzopen($logdatei, "ab") || err_trap("Can't open $logdatei."); - $gz->gzwrite("$dt $msg") || err_trap("Can't write to $logdatei. "); - $gz->gzclose ; - chmod(0777,$logdatei); - } + if ( ($logcompression==0) || ($mod_gz==0)) + { + open(DATEI,">>$logdatei") || err_trap("Can't open file ($logdatei)."); + print DATEI "$dt $msg" || err_trap("Can't write to file ($logdatei)."); + close(DATEI)|| err_trap("can't close file ($logdatei)."); + chmod(0777,$logdatei); + } + else + { + $gz = gzopen($logdatei, "ab") || err_trap("Can't open $logdatei."); + $gz->gzwrite("$dt $msg") || err_trap("Can't write to $logdatei. "); + $gz->gzclose ; + chmod(0777,$logdatei); + } } sub send_ftp { - my $ret=0; - my $x=0; - for(my $i = 0; $i <3; $i++) - { - if ($ftp_transfer[$i]==1) - { - if ($ftp_timeout[$i]<1) { $ftp_timeout[$i]=30; }; - $ftp = Net::FTP->new($ftp_server[$i], Port => $ftp_port[$i], Timeout => $ftp_timeout[$i], Debug => 1,Passive => $ftp_mode[$i]) or err_trap( "FTP-ERROR: Can't connect: $@\n",1); - $ftp->login($ftp_user[$i], $ftp_pass[$i]) or err_trap("FTP-ERROR: Couldn't login\n",1); - $ftp->binary(); - $ftp->cwd($ftp_dir[$i]) or err_trap("FTP-ERROR: Couldn't change directory: ".$ftp_dir[$i],1); - if($mp==0) - { - PrintOut("FTP: transferring `$backupfile` to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]); - $ret=$ftp->put($sql_file); - if (!$ret) - { - err_trap("FTP-Error: Couldn't put $backupfile to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]."\n",1); - } - else - { - write_log("FTP: transferring of `$backupfile` to $ftp_server[$i] finished successfully.\n"); - PrintOut("FTP: transferring `$backupfile` to $ftp_server[$i] was successful."); - } - } - else - { - PrintOut("FTP: starting Transfer of Multipart backup to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]); - $dateistamm=substr($backupfile,0,index($backupfile,"part_"))."part_"; - $dateiendung=($compression==1)?".sql.gz":".sql"; - $mpdatei=""; - for ($x=1;$x<$mp;$x++) - { - $mpdatei=$dateistamm.$x.$dateiendung; - $ret=$ftp->put($backup_path.$mpdatei); - if (!$ret) - { - err_trap("Couldn't put $backup_path.$mpdatei to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]."\n",1); - } - else - { - write_log("FTP: transferring of `$mpdatei` to ".$ftp_server[$i]." finished successfully.\n"); - PrintOut("FTP: transferring of `$mpdatei` to $ftp_server[$i] finished successfully."); - } - } - } - } - } + #save files to ftp-server + my $ret=0; + my $x=0; + for(my $i = 0; $i <3; $i++) + { + if ($ftp_transfer[$i]==1) + { + if ($ftp_timeout[$i]<1) { $ftp_timeout[$i]=30; }; + if (${ftp_useSSL[$i]}==1 && $mod_ftpssl==1) + { #use ftp-ssl + $ftp = Net::FTPSSL->new($ftp_server[$i], Encryption => Net::FTPSSL->EXP_CRYPT, Port => $ftp_port[$i], DataProtLevel =>Net::FTPSSL->DATA_PROT_CLEAR, Timeout => $ftp_timeout[$i], Debug => 0) or err_trap( "FTP-SSL-ERROR: Can't connect: $@\n",1); + } + else + { #use 'plain' ftp + $ftp = Net::FTP->new($ftp_server[$i], Port => $ftp_port[$i], Timeout => $ftp_timeout[$i], Debug => 1,Passive => $ftp_mode[$i]) or err_trap( "FTP-ERROR: Can't connect: $@\n",1); + } + $ftp->login($ftp_user[$i], $ftp_pass[$i]) or err_trap("FTP-ERROR: Couldn't login\n",1); + $ftp->binary(); + $ftp->cwd($ftp_dir[$i]) or err_trap("FTP-ERROR: Couldn't change directory: ".$ftp_dir[$i],1); + + if($mp==0) + { + PrintOut("FTP: transferring `$backupfile`"); + $ret=$ftp->put($sql_file); + if (!$ret) + { + err_trap("FTP-Error: Couldn't put $backupfile to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]."\n",1); + } + else + { + write_log("FTP: transferred `$backupfile` to $ftp_server[$i] into dir $ftp_dir[$i] successfully\n"); + PrintOut(" to $ftp_server[$i] into dir $ftp_dir[$i] was successful.\n"); + } + } + else + { + $dateistamm=substr($backupfile,0,index($backupfile,"part_"))."part_"; + $dateiendung=($compression==1)?".sql.gz":".sql"; + $mpdatei=""; + for ($x=1;$x<$mp;$x++) + { + $mpdatei=$dateistamm.$x.$dateiendung; + PrintOut("FTP: transferring multipart $mpdatei"); + + $ret=$ftp->put($backup_path.$mpdatei); + if (!$ret) + { + err_trap("Couldn't put $backup_path.$mpdatei to ".$ftp_server[$i]." into dir ".$ftp_dir[$i]."\n",1); + } + else + { + #write_log("FTP: transferring of `$mpdatei` to ".$ftp_server[$i]." finished successfully.\n"); + #PrintOut("FTP: transferring of `$mpdatei` to $ftp_server[$i] finished successfully."); + write_log("FTP: transferred multipart '$mpdatei' to $ftp_server[$i] into dir $ftp_dir[$i] successfully\n"); + PrintOut(" to $ftp_server[$i] into dir $ftp_dir[$i] was successful.\n"); + } + } + } + } + } } sub send_mail { - $BodyNormal='The attachement is your backup of your database `'.$dbname.'`.'; - $BodyMultipart="A multipart backup has been made.
You will receive one or more emails with the backup-files attached.
The database `".$dbname."` has been backupped.
The following files have been created:"; - $BodyToBig="The backup is bigger than the allowed max-limit of ".byte_output($email_maxsize)." and has not been attached.
Backup of database ".$dbname."

The following files have been created:"; - $BodyNoAttach="The backup has not been attached.
I saved your database `".$dbname."` to file
"; - $BodyAttachOnly="Here is your backup."; - $Body=""; - $DoAttach=1; - my @mparray; - my $ret=0; - if($mp==0) - { - if(($email_maxsize>0 && $filesize>$email_maxsize) || $cronmail_dump==0) - { - if($cronmail_dump==0) - { - $Body=$BodyNoAttach.$backupfile." (".byte_output($filesize).")"; - } - else - { - $Body=$BodyToBig.$backupfile." (".byte_output($filesize).")" - } - $DoAttach=0; - } - else - { - $Body=$BodyNormal; - } - } - else - { - $Body=$BodyMultipart; - $dateistamm=substr($backupfile,0,index($backupfile,"part_"))."part_"; - $dateiendung=($compression==1)?".sql.gz":".sql"; - $mpdatei=""; - for ($i=1;$i<$mp;$i++) - { - $mpdatei=$dateistamm.$i.$dateiendung; - push(@mparray,"$mpdatei|$i"); - $filesize=(stat($backup_path.$mpdatei))[7]; - $Body.="\n
$mpdatei (".(byte_output($filesize))." )"; - } - } - $Body.="\n\n

Best regards,

MySQLDumper
If you have any questions, feel free and visit the support board at:
http://forum.mysqldumper.de"; + #sent email w/o files + $BodyNormal='Find attached a backup of your database `'.$dbname.'`.'; + $BodyMultipart="A multipart backup has been made.
You will receive one or more emails with the backup-files attached.
The database `".$dbname."` has been backuped.
The following files have been created:"; + $BodyToBig="The backup is bigger than the allowed max-limit of ".byte_output($email_maxsize)." and has not been attached.
Backup of database ".$dbname."

The following files have been created:"; + $BodyNoAttach="The backup has not been attached.
I saved your database `".$dbname."` to file
"; + $BodyAttachOnly="Here is your backup."; + $Body=""; + $DoAttach=1; + my @mparray; + my $ret=0; + if($mp==0) + { #no multipart + if(($email_maxsize>0 && $filesize>$email_maxsize) || $cronmail_dump==0) + { + #attache files + if($cronmail_dump==0) + { #The backup has not been attached + $Body=$BodyNoAttach.$backupfile." (".byte_output($filesize).")"; + } + else + { #The backup is bigger than the allowed max-limit + $Body=$BodyToBig.$backupfile." (".byte_output($filesize).")"; + } + $DoAttach=0; + } + else + { #Find attached your backup + $Body=$BodyNormal." File ".$backupfile." (".byte_output($filesize).")"; + } + } + else + { #multipart + $Body=$BodyMultipart; + $dateistamm=substr($backupfile,0,index($backupfile,"part_"))."part_"; + $dateiendung=($compression==1)?".sql.gz":".sql"; + $mpdatei=""; + for ($i=1;$i<$mp;$i++) + { + $mpdatei=$dateistamm.$i.$dateiendung; + push(@mparray,"$mpdatei|$i"); + $filesize=(stat($backup_path.$mpdatei))[7]; + $Body.="\n
$mpdatei (".(byte_output($filesize))." )"; + } + } + $Body.="\n\n

Best regards,

MySQLDumper
If you have any questions, feel free and visit the support board at:
http://forum.mysqldumper.de"; - if ($cron_use_sendmail==1) - { - MIME::Lite->send("sendmail", $sendmail_call) || err_trap("Error setting sendmail call!",1); - } - else - { - MIME::Lite->send('smtp', $cron_smtp, Timeout=>60) || err_trap("Error setting smtp call !",1); - } + if ($cron_use_sendmail==1) + { + MIME::Lite->send("sendmail", $sendmail_call) || err_trap("Error setting sendmail call!",1); + } + else + { + MIME::Lite->send('smtp', $cron_smtp, Timeout=>60) || err_trap("Error setting smtp call !",1); + } - $msg = MIME::Lite->new( - From => $cronmailfrom, - To => $cronmailto, - Cc => $cronmailto_cc, - Subject => "MSD (Perl) - Backup of DB ".$dbname, - Type => 'text/html; charset=iso-8859-1', - Data => "\n".$Body."\n" - ); + $msg = MIME::Lite->new( + From => $cronmailfrom, + To => $cronmailto, + Cc => $cronmailto_cc, + Subject => "MSD (Perl) - Backup of DB ".$dbname, + Type => 'text/html; charset=iso-8859-1', + Data => "\n".$Body."\n" + ); - if($DoAttach==1 && $mp==0) - { - $msg->attach( - Type => "BINARY", - Path => "$sql_file", - Encoding => "base64", - Filename => "$backupfile" - ); - $ret=$msg->send; - if (!$ret) - { - err_trap("Error 1 sending mail with backup ".$backupfile."!",1); - } - else - { - PrintOut("E-Mail with backup ".$backupfile." sent successfully."); - write_log("E-Mail with backup ".$backupfile." sent successfully.\n"); - } - return $ret; - } - - if($DoAttach==1 && $mp>0 && $cronmail_dump>0) - { - foreach $datei(@mparray) - { - @str=split(/\|/,$datei); - $msg = MIME::Lite->new( - From => $cronmailfrom, - To => $cronmailto, - Cc => $cronmailto_cc, - Subject => "MSD (Perl) - Backup of DB $dbname File ".$str[1]." of ".@mparray , - Type => 'text/html; charset=iso-8859-1', - Data => "\n".$Body."\n" - ); + if($DoAttach==1 && $mp==0) + { #attach files, no multipart + $msg->attach( + Type => "BINARY", + Path => "$sql_file", + Encoding => "base64", + Filename => "$backupfile" + ); + $ret=$msg->send; + if (!$ret) + { + err_trap("Error 1 sending mail with backup ".$backupfile."!",1); + } + else + { + PrintOut("E-Mail with backup ".$backupfile." sent successfully."); + write_log("E-Mail with backup ".$backupfile." sent successfully.\n"); + } + return $ret; + } + + if($DoAttach==1 && $mp>0 && $cronmail_dump>0) + { #attach files, multipart + foreach $datei(@mparray) + { + @str=split(/\|/,$datei); + $msg = MIME::Lite->new( + From => $cronmailfrom, + To => $cronmailto, + Cc => $cronmailto_cc, + Subject => "MSD (Perl) - Backup of DB $dbname File ".$str[1]." of ".@mparray , + Type => 'text/html; charset=iso-8859-1', + Data => "\n".$Body."\n" + ); - $msg->attach( - Type => "BINARY", - Path => $backup_path.$str[0], - Encoding => "base64", - Filename => $str[0] - ); - $ret=$msg->send; - if (!$ret) - { - err_trap("Error 2 sending mail with backup ".$str[0]."!",1); - } - else - { - PrintOut("E-Mail with backup ".$str[0]." sent successfully."); - write_log("E-Mail with backup ".$str[0]." sent successfully.\n"); - } - } - return $ret; - } + $msg->attach( + Type => "BINARY", + Path => $backup_path.$str[0], + Encoding => "base64", + Filename => $str[0] + ); + $ret=$msg->send; + if (!$ret) + { + err_trap("Error 2 sending mail with backup ".$str[0]."!",1); + } + else + { + PrintOut("E-Mail with backup ".$str[0]." sent successfully."); + write_log("E-Mail with backup ".$str[0]." sent successfully.\n"); + } + } + return $ret; + } - $ret=$msg->send; - if (!$ret) - { - err_trap("Error 3 sending E-Mail!
",1); - } - else - { - PrintOut("E-Mail sent successfully."); - write_log("E-Mail sent successfully.\n"); - } - return $ret; + $ret=$msg->send; + if (!$ret) + { + err_trap("Error 3 sending E-Mail!
",1); + } + else + { + PrintOut("E-Mail sent successfully."); + write_log("E-Mail sent successfully.\n"); + } + return $ret; } sub NewFilename { - $part=""; - if($mp>0) - { - $part="_part_$mp"; - $mp++; - } - if($compression==0) - { - $sql_file=$backup_path.$dbname."_".$time_stamp.$part.".sql"; - $backupfile=$dbname."_".$time_stamp.$part.".sql"; - } - else - { - $sql_file=$backup_path.$dbname."_".$time_stamp.$part.".sql.gz"; - $backupfile=$dbname."_".$time_stamp.$part.".sql.gz"; - } - if($mp==0) - { - PrintOut("\n
Starting to dump data into file `$backupfile`"); - write_log("Dumping data into file `$backupfile` \n"); - } - if($mp==2) - { - PrintOut("\n
Starting to dump data into multipart-file `$backupfile`"); - write_log("Start Perl Multipart-Dump with file `$backupfile` \n"); - } - if($mp>2) - { - PrintOut("\n
Continuing Multipart-Dump with file `$backupfile`"); - write_log("Continuing Multipart-Dump with file `$backupfile` \n"); - } - if($mp>0) - { - $sql_text=$status_start."MP_".($mp-1).$status_end; - } - else - { - $sql_text=$status_start.$status_end; - } - $sql_text.="/*!40101 SET NAMES '".$character_set."' */;\n"; - $sql_text.="SET FOREIGN_KEY_CHECKS=0;\n"; - - WriteToFile($sql_text,1); - chmod(0777,$sql_file); - $sql_text=""; - $first_insert=0; - $punktzaehler=0; - push(@backupfiles_name,$sql_file); + $part=""; + if($mp>0) + { + $part="_part_$mp"; + $mp++; + } + if($compression==0) + { + $sql_file=$backup_path.$dbname."_".$time_stamp.$part.".sql"; + $backupfile=$dbname."_".$time_stamp.$part.".sql"; + } + else + { + $sql_file=$backup_path.$dbname."_".$time_stamp.$part.".sql.gz"; + $backupfile=$dbname."_".$time_stamp.$part.".sql.gz"; + } + if($mp==0) + { + PrintOut("\n
Starting to dump data into file `$backupfile`"); + write_log("Dumping data into file `$backupfile` \n"); + } + if($mp==2) + { + PrintOut("\n
Starting to dump data into multipart-file `$backupfile`"); + write_log("Start Perl Multipart-Dump with file `$backupfile` \n"); + } + if($mp>2) + { + PrintOut("\n
Continuing Multipart-Dump with file `$backupfile`"); + write_log("Continuing Multipart-Dump with file `$backupfile` \n"); + } + if($mp>0) + { + $sql_text=$status_start."MP_".($mp-1).$status_end; + } + else + { + $sql_text=$status_start.$status_end; + } + $sql_text.="/*!40101 SET NAMES '".$character_set."' */;\n"; + $sql_text.="SET FOREIGN_KEY_CHECKS=0;\n"; + + WriteToFile($sql_text,1); + chmod(0777,$sql_file); + $sql_text=""; + $first_insert=0; + $punktzaehler=0; + push(@backupfiles_name,$sql_file); } sub WriteToFile { - $inh=shift; - my $points=shift; - if (!defined($points)) { $points=2; } - - if(length($inh)>0) { - if($compression==0){ - open(DATEI,">>$sql_file"); - print DATEI $inh; - close(DATEI); - } else { - $gz = gzopen($sql_file, "ab") || err_trap("Cannot open ".$sql_file); - $gz->gzwrite($inh) || err_trap("Error writing ".$sql_file); - $gz->gzclose ; - } - if ($points>1) - { - print "."; - } - $filesize= (stat($sql_file))[7]; - $punktzaehler++; - if($punktzaehler>120) - { - if ($html_output==1) { print "
"; } else { print "\n"; }; - $punktzaehler=0; - } - } + $inh=shift; + my $points=shift; + if (!defined($points)) { $points=2; } + + if(length($inh)>0) { + if($compression==0){ + open(DATEI,">>$sql_file"); + print DATEI $inh; + close(DATEI); + } else { + $gz = gzopen($sql_file, "ab") || err_trap("Cannot open ".$sql_file); + $gz->gzwrite($inh) || err_trap("Error writing ".$sql_file); + $gz->gzclose ; + } + if ($points>1) + { + print "."; + } + $filesize= (stat($sql_file))[7]; + $punktzaehler++; + if($punktzaehler>120) + { + if ($html_output==1) { print "
"; } else { print "\n"; }; + $punktzaehler=0; + } + } } sub AutoDeleteCount { - $fpath=$File::Find::name; - $fname=basename($fpath); - my @fileparts=split(/\./,"$fname"); - my $partcount=@fileparts; - if ($partcount>1) - { - my $end=$fileparts[(@fileparts-1)]; -#print "
Filename $fname
Dateiendung: $end"; - - # Read Statusline and extract info - my $line=''; - if ($end eq 'sql') - { - if (open(DATEI,"<$fpath")) - { - $line=; - close(DATEI); - } - else - { - print "
Error: couldn\'t open file: ".$fpath; - } - } - if ($end eq 'gz') - { - $gz = gzopen("$fpath", "rb"); - if ($gz) - { - $gz->gzreadline($line); - $gz->gzclose; - } - else - { - print "
Error: couldn\'t open file: ".$fpath; - } - } -#print "
Line: ".$line; - if (length($line)>0) - { - #statusline read - my @infos=split(/\:/,$line); - my $file_multipart=$infos[3]; - $file_multipart=~ s/MP_/ /g; - $file_multipart=trim($file_multipart); -#print "
File: ".$fname." MP: '".$file_multipart."'"; - my $file_databasename=$infos[4]; - if ($file_multipart eq "" || substr($file_multipart,0,1) eq "0") - { -#print "
Kein Multipartfile
"; - push(@filearr,"$fname|$file_databasename"); - } - else - { -#print "
\nMultipart: ".$file_multipart.' '.$file_databasename.'
'; - push(@filearr,"$fname|$file_databasename|$file_multipart"); - } - - } - else - { -#print "
No Statusline found. Seems not to be a MySQLDumper file. Skipping file..

"; - } - } + $fpath=$File::Find::name; + $fname=basename($fpath); + my @fileparts=split(/\./,"$fname"); + my $partcount=@fileparts; + if ($partcount>1) + { + my $end=$fileparts[(@fileparts-1)]; + # Read Statusline and extract info + my $line=''; + if ($end eq 'sql') + { + if (open(DATEI,"<$fpath")) + { + $line=; + close(DATEI); + } + else + { + print "
Error: couldn\'t open file: ".$fpath; + } + } + if ($end eq 'gz') + { + $gz = gzopen("$fpath", "rb"); + if ($gz) + { + $gz->gzreadline($line); + $gz->gzclose; + } + else + { + print "
Error: couldn\'t open file: ".$fpath; + } + } + if (length($line)>0 && (substr($line,0,10) eq "-- Status:" ||substr($line,0,11) eq "-- Status:")) + { + #statusline read + my @infos=split(/\:/,$line); + my $file_multipart=($infos[3])?$infos[3]:''; + $file_multipart=~ s/MP_/ /g; + $file_multipart=trim($file_multipart); + my $file_databasename=($infos[4])?$infos[4]:''; + if ($file_multipart eq "" || substr($file_multipart,0,1) eq "0") + { + #no multipartfile + push(@filearr,"$fname|$file_databasename"); + } + else + { + push(@filearr,"$fname|$file_databasename|$file_multipart"); + } + } + else + { + PrintOut("No Statusline in `$fname` found. Seems not to be a MySQLDumper file. Skipping file."); + } + } } sub DoAutoDeleteCount { - my @str; - my @dbarray; - my $item; - my $item2; - my %dbanz; - my $anz=@filearr; - # sort filearr descending -> so the latest backups are at top - # multipartfiles sorting is also descending -> part3, part2, part1 - @filearr=sort{"$b" cmp "$a"}(@filearr); - @multipartfiles=(); - if ($anz>0) - { - foreach $item (@filearr) - { - @str=split(/\|/,$item); - # str[0]=filename, str[1]=databasename, str[2]=multipart number - - #init db-counter if this index doesn't exist yet - if (!defined $dbanz{$str[1]}) - { - $dbanz{$str[1]}=0; - @multipartfiles=(); - } - #PrintOut($max_backup_files.': '.$dbanz{$str[1]}.' -> '.$str[0].' - '.$str[1].' - '.$str[2]); - - #no multipart file -> update db counter - if(!defined $str[2]) - { - # handling for non multipart files - $dbanz{$str[1]}++; - # is the max number of backups for this database reached? - # if yes -> push the actual filename into trash_files - if($dbanz{$str[1]}>$max_backup_files) - { - push(@trash_files, $str[0]); - } - } - else - { - # keep multipartz filename - if($dbanz{$str[1]}>=$max_backup_files) - { - push(@multipartfiles,$str[0]); - } - - # if it is a multipart file and it is part_1 -> update db counter - # multiparts with higher numbers already passed the loop, so we can use - # part1 to increase the db-counter - if(defined $str[2] && $str[2]==1) - { - $dbanz{$str[1]}++; - # now check if we have reached the limit - if($dbanz{$str[1]}>$max_backup_files) - { - foreach $item2 (@multipartfiles) - { - push(@trash_files, $item2); - } - } - # clear array for next multipart backup - @multipartfiles=(); - } - } - } - } + my @str; + my @dbarray; + my $item; + my $item2; + my %dbanz; + my $anz=@filearr; + # sort filearr descending -> so the latest backups are at top + # multipartfiles sorting is also descending -> part3, part2, part1 + @filearr=sort{"$b" cmp "$a"}(@filearr); + @multipartfiles=(); + if ($anz>0) + { + foreach $item (@filearr) + { + @str=split(/\|/,$item); + # str[0]=filename, str[1]=databasename, str[2]=multipart number + + #init db-counter if this index doesn't exist yet + if (defined $str[1] && !defined $dbanz{$str[1]}) + { + $dbanz{$str[1]}=0; + @multipartfiles=(); + } + #PrintOut($max_backup_files.': '.$dbanz{$str[1]}.' -> '.$str[0].' - '.$str[1].' - '.$str[2]); + + #no multipart file -> update db counter + if(defined $str[1] && !defined $str[2]) + { + # handling for non multipart files + $dbanz{$str[1]}++; + # is the max number of backups for this database reached? + # if yes -> push the actual filename into trash_files + if($dbanz{$str[1]}>$max_backup_files) + { + push(@trash_files, $str[0]); + } + } + else + { + # keep multipartz filename + if(defined $str[1] && $dbanz{$str[1]}>=$max_backup_files) + { + push(@multipartfiles,$str[0]); + } + + # if it is a multipart file and it is part_1 -> update db counter + # multiparts with higher numbers already passed the loop, so we can use + # part1 to increase the db-counter + if(defined $str[2] && $str[2]==1) + { + $dbanz{$str[1]}++; + # now check if we have reached the limit + if($dbanz{$str[1]}>$max_backup_files) + { + foreach $item2 (@multipartfiles) + { + push(@trash_files, $item2); + } + } + # clear array for next multipart backup + @multipartfiles=(); + } + } + } + } } sub DeleteFiles { - my $res=0; - if(@trash_files==0) - { - PrintOut("No file to delete."); - } - else - { - foreach $datei(@trash_files) - { - my $file_to_delete = $backup_path.$datei; - $res=unlink($file_to_delete); - if ($res) - { - PrintOut("Autodelete: old backup file ".$datei." deleted."); - write_log( "Autodelete: old backup file $datei deleted.\n" ) ; - } - else - { - err_trap("Autodelete: Error deleting old backup file ".$datei."!
",1); - } - } - undef(@trash_files); - } + my $res=0; + if(@trash_files==0) + { + PrintOut("No file to delete."); + } + else + { + foreach $datei(@trash_files) + { + my $file_to_delete = $backup_path.$datei; + $res=unlink($file_to_delete); + if ($res) + { + PrintOut("Autodelete: old backup file ".$datei." deleted."); + write_log( "Autodelete: old backup file $datei deleted.\n" ) ; + } + else + { + err_trap("Autodelete: Error deleting old backup file ".$datei."!
",1); + } + } + undef(@trash_files); + } } sub ExecuteCommand { - my $cmt = shift(@_); - my $command = shift(@_); - my (@cad, $errText, $succText, $cd2, $commandDump); - my $err=''; - $commandDump=$command; - if($cmt==1) - { #before dump - $errText="Error while executing Query before Dump"; - $succText="Executing Query before Dump was successful"; - } - else - { - $errText="Error while executing Query after Dump"; - $succText="executing Query after Dump was successful"; - } - - if(defined $commandDump && length($commandDump)>0) - { - if(substr($commandDump,0,7) ne "system:") - { - if (trim($dbsocket) eq "") - { - $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; - } - else - { - $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport;mysql_socket=$dbsocket","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; - } - if(index($commandDump,";")>0) - { - # more than 1 query - @cad=split(/;/,$commandDump); - } - else - { - @cad=array($commandDump); - } + my $cmt = shift(@_); + my $command = shift(@_); + my (@cad, $errText, $succText, $cd2, $commandDump); + my $err=''; + $commandDump=$command; + if($cmt==1) + { #before dump + $errText="Error while executing Query before Dump"; + $succText="Executing Query before Dump was successful"; + } + else + { + $errText="Error while executing Query after Dump"; + $succText="executing Query after Dump was successful"; + } + + if(defined $commandDump && length($commandDump)>0) + { + if(substr($commandDump,0,7) ne "system:") + { + # prepare command + $commandDump = replaceQueryStringSimple($commandDump); + if (trim($dbsocket) eq "") + { + $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport","$dbuser","$dbpass") || err_trap("Database connection not made: $DBI::errstr"); + } + else + { + $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:$dbport;mysql_socket=$dbsocket","$dbuser","$dbpass") || die "Database connection not made: $DBI::errstr"; + } - for($i=0;$i<@cad;$i++) - { - if($cad[$i] ne '') - { - $err=''; - $sth = $dbh->prepare($cad[$i]); - $sth->execute or $err=$sth->errstr(); - if ($err ne '') - { - write_log("Executing Query '$cad[$i]' caused an error! MySQL returns: '$err'\n"); - PrintOut("Executing Query '$cad[$i]' caused an error! MySQL returns: '$err'\n"); - } - else - { - write_log("Successfully executed Query: $cad[$i]\n"); - PrintOut("Successfully executed Query: $cad[$i]\n"); - } - $sth->finish; - } - } - } - else - { - #Systembefehl - $commandDump=substr($commandDump,7); - system($commandDump); - PrintOut("

$succText ($commandDump)

"); - write_log("$succText ($commandDump)\n"); - } - } + if(index($commandDump,";")>0) + { + # more than 1 query + @cad=split(/;/,$commandDump); + } + else + { + @cad=$commandDump; + } + + for($i=0;$i<@cad;$i++) + { + if($cad[$i] ne '') + { + $err=''; + # replace $$MSD$$ back to ';' + $cad[$i] =~ s/\$\$MSD\$\$/\;/g; + $sth = $dbh->prepare($cad[$i]); + $sth->execute or $err=$sth->errstr(); + if ($err ne '') + { + write_log("Executing Query '$cad[$i]' caused an error! MySQL returns: '$err'\n"); + PrintOut("Executing Query '$cad[$i]' caused an error! MySQL returns: '$err'\n"); + } + else + { + write_log("Successfully executed Query: $cad[$i]\n"); + PrintOut("Successfully executed Query: $cad[$i]\n"); + } + $sth->finish; + } + } + } + else + { + #Systembefehl + $commandDump=substr($commandDump,7); + system($commandDump); + PrintOut("

$succText ($commandDump)

"); + write_log("$succText ($commandDump)\n"); + } + } } sub closeScript { - my ($Start, $Jetzt, $Totalzeit); - $Start = $^T; $Jetzt = (time); - $Totalzeit=$Jetzt - $Start; - ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - $Jahr+=1900;$Monat+=1;$Jahrestag+=1; - $starttime=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".$Jahr." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); - PrintOut("Everythings is done: closing script $starttime"); - PrintOut("total time used: $Totalzeit sec."); - PrintOut("#EOS (End of script)
"); - # Datenbankverbindung schliessen - $sth->finish() if (defined $sth); - ($dbh->disconnect() || warn $dbh->errstr) if (defined $dbh); + my ($Start, $Jetzt, $Totalzeit); + $Start = $^T; $Jetzt = (time); + $Totalzeit=$Jetzt - $Start; + ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + $Jahr+=1900;$Monat+=1;$Jahrestag+=1; + $starttime=sprintf("%02d",$Monatstag).".".sprintf("%02d",$Monat).".".$Jahr." ".sprintf("%02d",$Stunden).":".sprintf("%02d",$Minuten).":".sprintf("%02d",$Sekunden); + PrintOut("
Everythings is done: closing script $starttime"); + PrintOut("total time used: $Totalzeit sec."); + PrintOut("#EOS (End of script)
"); + # Datenbankverbindung schliessen + $sth->finish() if (defined $sth); + ($dbh->disconnect() || warn $dbh->errstr) if (defined $dbh); } -sub trim +sub trim { my $string = shift; if (defined($string)) @@ -1186,39 +1328,51 @@ sub trim sub byte_output { - my $bytes= shift; - my $suffix="Bytes"; - if ($bytes>=1024) { $suffix="KB"; $bytes=sprintf("%.2f",($bytes/1024));}; - if ($bytes>=1024) { $suffix="MB"; $bytes=sprintf("%.2f",($bytes/1024));}; - my $ret=sprintf "%.2f",$bytes; - $ret.=' '.$suffix; - return $ret; + my $bytes= shift; + my $suffix="Bytes"; + if ($bytes>=1024) { $suffix="KB"; $bytes=sprintf("%.2f",($bytes/1024));}; + if ($bytes>=1024) { $suffix="MB"; $bytes=sprintf("%.2f",($bytes/1024));}; + my $ret=sprintf "%.2f",$bytes; + $ret.=' '.$suffix; + return $ret; } sub optimise_tables { - my $engine=''; - my $ret=0; - $opttbl=0; - PrintOut("Optimizing tables:"); - foreach $tablename (@tablenames) - { - #optimize table if engine supports optimization - $engine=uc($db_tables{$tablename}{Engine}); - if ( $engine eq "MYISAM" or $engine eq "BDB" or $engine eq "INNODB") - { - my $sth_to = $dbh->prepare("OPTIMIZE TABLE `$tablename`"); - $ret=$sth_to->execute; - if ($ret) - { - PrintOut("- Table ".($opttbl+1)." `$tablename` optimized successfully."); - $opttbl++; - } - else - { - err_trap("  Error optimizing table `$tablename`",1); - } - } - } - PrintOut("$opttbl tables have been optimized") if($opttbl>0) ; + my $engine=''; + my $ret=0; + $opttbl=0; + PrintOut("Optimizing tables:"); + foreach $tablename (@tablenames) + { + #optimize table if engine supports optimization + $engine=uc($db_tables{$tablename}{Engine}); + if ( $engine eq "MYISAM" or $engine eq "BDB" or $engine eq "INNODB") + { + my $sth_to = $dbh->prepare("OPTIMIZE TABLE `$tablename`"); + $ret=$sth_to->execute; + if ($ret) + { + PrintOut("Table ".($opttbl+1)." `$tablename` optimized successfully."); + $opttbl++; + } + else + { + err_trap("  Error optimizing table `$tablename`",1); + } + } + } + PrintOut("$opttbl tables have been optimized
") if($opttbl>0) ; +} + +# replace in querystring all ';' in VALUES with '$$MSD$$' +sub replaceQueryStringSimple{ + my $string = shift(@_); + + if ($string =~ m#(.*)\'(.*)\;(.*)\'(.*)#){ + # if found search for more ';' + return replaceQueryStringSimple($1.'\''.$2.'$$MSD$$'.$3.'\''.$4);; + }else{ + return $string; + } } \ No newline at end of file diff --git a/msd_cron/perltest.pl b/msd_cron/perltest.pl index 74447e3..cb6f7c9 100644 --- a/msd_cron/perltest.pl +++ b/msd_cron/perltest.pl @@ -1,11 +1,17 @@ #!/usr/bin/perl -w +# This file is part of MySQLDumper released under the GNU/GPL 2 license +# http://www.mysqldumper.net +# @package MySQLDumper +# @version $Rev: 1351 $ +# @author $Author: jtietz $ +# @lastmodified $Date: 2011-01-16 20:55:42 +0100 (So, 16. Jan 2011) $ +# @filesource $URL: https://mysqldumper.svn.sourceforge.net/svnroot/mysqldumper/branches/msd1.24.3/msd_cron/perltest.pl $ + use strict; use Socket; use Config; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use CGI; -my $cgi = CGI->new(); -print $cgi->header(); warningsToBrowser(1); # dies ist ganz wichtig! my $eval_in_died; @@ -15,6 +21,7 @@ my $mod_fb=0; my $mod_gz=0; my $mod_ftp=0; my $mod_mime=0; +my $mod_ftpssl=0; my $dbi_driver; my $dbi_mysql_exists=0; my $get_options=0; @@ -22,8 +29,11 @@ my $ok=''; my $err=''; my $zlib_version='unknown'; -print "MySQLDumper Perltest\n"; -print ''; +my $cgi = CGI->new(); +print $cgi->header(-type => 'text/html; charset=utf-8', -cache_control => 'no-cache, no-store, must-revalidate'); +print "\n"; +print "MySQLDumper Perl modul test\n"; +print ''; print "

Testing needed Perl-Moduls in order to run the Perl script crondump.pl

\n"; print "

Necessary Modules for crondump.pl

"; print "testing DBI ...\n"; @@ -33,7 +43,7 @@ eval { $eval_in_died = 1; require DBI; }; import DBI; } if($mod_dbi!=1){ - print $err."Couldn't findDBI!
crondump.pl can't establih a connection to the MySQL database!
\n"; + print $err."
Couldn't find DBI!
crondump.pl can't establish a connection to the MySQL database!
\n"; } else { print $ok."Found modul DBI. OK.
\n"; my @available_drivers = DBI->available_drivers('quiet'); @@ -42,7 +52,7 @@ if($mod_dbi!=1){ print "
Found modul DBI::$dbi_driver\n"; if ( $dbi_driver eq 'mysql' ) { $dbi_mysql_exists=1; } ; } - if ($dbi_mysql_exists !=1 ) { print $err."Critical error: modul DBI::mysql not found! crondump.pl can't establish a connection to the MySQL-Databse if this modul isn't installed! Please install DBI::mysql!
"; } + if ($dbi_mysql_exists !=1 ) { print $err."
Critical error: modul DBI::mysql not found! crondump.pl can't establish a connection to the MySQL-Database if this modul isn't installed! Please install DBI::mysql!
"; } else { print "
".$ok."Found modul DBI::mysql. OK. crondump.pl can connect to MySQL-Database.
"; } } @@ -58,7 +68,6 @@ if($mod_ff!=1){ print $ok."Found modul File::Find. OK.

\n"; } - print "testing File::Basename ...\n"; eval { $eval_in_died = 1; require File::Basename; }; if(!$@){ @@ -110,6 +119,19 @@ if($mod_ftp!=1){ print $ok."Found modul Net::FTP. OK - crondump.pl can send backups via FTP.

\n"; } +print "
testing Net::FTPSSL (needed if you want to transfer backups to another server with ssl encryption)...
\n"; +eval { $eval_in_died = 1; require Net::FTPSSL; }; + if(!$@){ + $mod_ftpssl = 1; + import Net::FTPSSL; + } +if($mod_ftpssl !=1){ +print $err."Error: modul Net::FTPSSL not found! crondump.pl can't transfer data via FTP with ssl encryption.
\n"; +} else { + print $ok."Found modul Net::FTPSSL. OK - crondump.pl can send backups via FTP with ssl encryption.
\n"; +} + + print "
testing MIME::Lite (needed if you want to send backups via email)...
\n"; eval { $eval_in_died = 1; require MIME::Lite; }; if(!$@){ diff --git a/msd_cron/simpletest.pl b/msd_cron/simpletest.pl index 345a121..fde6703 100644 --- a/msd_cron/simpletest.pl +++ b/msd_cron/simpletest.pl @@ -1,21 +1,36 @@ #!/usr/bin/perl -w +# +# ERROR / FEHLER !! +# +++++++++++++++++ +# If you can read this line Perl is not executed. +# Ask your hoster how to activate Perl. +# +# Wenn Du diese Zeile hier siehst, dann wird Perl nicht ausgefuehrt. +# Frage Deinen Hoster, ob und wie Du Perl aktivieren kannst. +# +# Sample Apache-Config: +# +# Options ExecCGI +# AddHandler cgi-script cgi pl +# +# +# This file is part of MySQLDumper released under the GNU/GPL 2 license +# http://www.mysqldumper.net +# @package MySQLDumper +# @version $Rev: 1351 $ +# @author $Author: jtietz $ +# @lastmodified $Date: 2011-01-16 20:55:42 +0100 (So, 16. Jan 2011) $ +# @filesource $URL: https://mysqldumper.svn.sourceforge.net/svnroot/mysqldumper/branches/msd1.24.3/msd_cron/simpletest.pl $ + use strict; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); warningsToBrowser(1); print "Content-type: text/html\n\n"; -print '', "\n"; -print "Testausgabe\n"; -print "\n"; - -print "Wenn Du das siehst, funktioniert Perl auf Deinem System !

"; -print "If you see this perl works fine on your system !"; -print "\n"; - - -# Wenn Du diese Zeile hier siehst, dann wird Perl nicht ausgefuehrt. -# Frage Deinen Hoster, ob und wie Du Perl aktivieren kannst. -# -# If you can read this line Perl is not executed. -# Ask your hoster how to activate Perl. -# +print "\n"; +print "MySQLDumper - simple Perl test\n"; +print ''; +print "\n\n"; +print "

If you see this perl works fine on your system !

"; +print "Wenn Du das siehst, funktioniert Perl auf Deinem System !

"; +print "\n"; \ No newline at end of file diff --git a/refresh_dblist.php b/refresh_dblist.php index 5c70d8b..e12bf77 100644 --- a/refresh_dblist.php +++ b/refresh_dblist.php @@ -1,25 +1,64 @@ '); +} + +date_default_timezone_set('Europe/Berlin'); +define('APPLICATION_PATH', __DIR__); +chdir(APPLICATION_PATH); +include(APPLICATION_PATH . '/inc/functions.php'); +include(APPLICATION_PATH . '/inc/mysql.php'); +include('language/en/lang.php'); +// load default configuration +include('work/config/mysqldumper.php'); +GetLanguageArray(); + +$configFiles = get_config_filenames(); +foreach ($configFiles as $configFile) { + if (in_array($configFile, $excludedConfigurationFiles)) { + continue; + } + output('Refreshing database list for configuration file: ' . $configFile, $verbose); + $config['config_file'] = $configFile; + include($config['paths']['config'] . $configFile . '.php'); + $out = ''; + if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) { + ((is_null($___mysqli_res = mysqli_close($config['dbconnection']))) ? false : $___mysqli_res); + $config['dbconnection'] = false; + } + SetDefault(); + output($out, $verbose); +} + +/** + * @param string $message + * @param boolean $verbose + */ +function output($message, $verbose) +{ + if ($verbose) { + $message = str_replace("\n", NEWLINE, $message); + echo $message . NEWLINE; + } } -?> \ No newline at end of file diff --git a/restore.php b/restore.php index 819b163..4745649 100644 --- a/restore.php +++ b/restore.php @@ -78,7 +78,7 @@ $pageheader=MSDheader().headline($lang['L_RESTORE']); $aus1=$page_parameter=''; $RestoreFertig=$eingetragen=$dauer=$filegroesse=0; MSD_mysql_connect($restore['dump_encoding'],true,$restore['actual_table']); -@mysql_select_db($databases['db_actual']) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']); +@mysqli_select_db($GLOBALS["___mysqli_ston"], $databases['db_actual']) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']); // open backup file $restore['filehandle']=($restore['compressed']==1) ? gzopen($config['paths']['backup'].$restore['filename'],'r') : fopen($config['paths']['backup'].$restore['filename'],'r'); @@ -118,9 +118,9 @@ if ($restore['filehandle']) // Disable Keys of actual table to speed up restoring if (is_array($restore['tables_to_restore'])&&sizeof($restore['tables_to_restore'])>0&&in_array($restore['actual_table'],$restore['tables_to_restore'])) { - @mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']); + @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;'); } - elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']); + elseif ((!is_array($restore['tables_to_restore'])||sizeof($restore['tables_to_restore'])==0)&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;'); WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB']) { @@ -128,22 +128,22 @@ if ($restore['filehandle']) if ($sql_command>'') { //WriteLog(htmlspecialchars($sql_command)); - $res=mysql_query($sql_command,$config['dbconnection']); + $res=mysqli_query($config['dbconnection'], $sql_command); if (!$res===false) { - $anzsql=mysql_affected_rows($config['dbconnection']); + $anzsql=mysqli_affected_rows($config['dbconnection']); // Anzahl der eingetragenen Datensaetze ermitteln (Indexaktionen nicht zaehlen) $command=strtoupper(substr($sql_command,0,7)); if ($command=='INSERT ') { - $anzsql=mysql_affected_rows($config['dbconnection']); + $anzsql=mysqli_affected_rows($config['dbconnection']); if ($anzsql>0) $restore['eintraege_ready']+=$anzsql; } } else { // Bei MySQL-Fehlern sofort abbrechen und Info ausgeben - $meldung=@mysql_error($config['dbconnection']); + $meldung=@((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!='') { if (strtolower(substr($meldung,0,15))=='duplicate entry') @@ -306,4 +306,4 @@ else } echo $complete_page; ob_end_flush(); -?> \ No newline at end of file +?> diff --git a/sql.php b/sql.php index 9ad68e8..cd93531 100644 --- a/sql.php +++ b/sql.php @@ -124,7 +124,7 @@ if ($sql_to_display_data==1) if (isset($_POST['tableselect'])&&$_POST['tableselect']!='1') $tablename=$_POST['tableselect']; MSD_mysql_connect(); -mysql_select_db($db,$config['dbconnection']); +mysqli_select_db($config['dbconnection'], $db); ///*** EDIT / UPDATES / INSERTS ***/// ///*** ***/// @@ -208,10 +208,6 @@ if ($search==0&&!$download) { if ($showtables==0) { - if (strpos($rk,"|")!=false) - { - $rk=str_replace('|',' AND ',$rk); - } $sqlk="DELETE FROM `$tablename` WHERE ".$rk." LIMIT 1"; $res=MSD_query($sqlk); //echo "
".$sqlk; @@ -299,4 +295,4 @@ function FormHiddenParams() $s.=''; $s.=''; return $s; -} \ No newline at end of file +} diff --git a/tpl/dump_select_tables.tpl b/tpl/dump_select_tables.tpl index 57fa609..471486d 100644 --- a/tpl/dump_select_tables.tpl +++ b/tpl/dump_select_tables.tpl @@ -1,58 +1,58 @@ -
{PAGETITLE}
-
{L_DATABASE}: {DATABASE}
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - -
#{L_NAME}{L_ROWS}{L_SIZE}{L_LAST_UPDATE}{L_TABLE_TYPE}
{ROW.NR}. {ROW.RECORDS}{ROW.SIZE}{ROW.LAST_UPDATE}{ROW.TABLETYPE}
-
-
-
-
-
-
- -
- +
{PAGETITLE}
+
{L_DATABASE}: {DATABASE}
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
#{L_NAME}{L_ROWS}{L_SIZE}{L_LAST_UPDATE}{L_TABLE_TYPE}
{ROW.NR}. {ROW.RECORDS}{ROW.SIZE}{ROW.LAST_UPDATE}{ROW.TABLETYPE}
+
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/tpl/home/databases_list_dbs.tpl b/tpl/home/databases_list_dbs.tpl index aa7594a..0de5498 100644 --- a/tpl/home/databases_list_dbs.tpl +++ b/tpl/home/databases_list_dbs.tpl @@ -1,47 +1,47 @@ -
{L_INFO_DATABASES}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#{L_DBS}{L_TABLES}
{DB_NOT_FOUND.NR}.{DB_NOT_FOUND.DB_NAME}{L_INFO_NODB}
{ROW.NR}. - - - {ROW.DB_NAME} - - {ROW.TABLE_COUNT} - - {L_TABLE} - - - {L_TABLES} - -
-
- -

-
+
{L_INFO_DATABASES}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#{L_DBS}{L_TABLES}
{DB_NOT_FOUND.NR}.{DB_NOT_FOUND.DB_NAME}{L_INFO_NODB}
{ROW.NR}. + + + {ROW.DB_NAME} + + {ROW.TABLE_COUNT} + + {L_TABLE} + + + {L_TABLES} + +
+
+ +

+
diff --git a/tpl/home/databases_list_tables.tpl b/tpl/home/databases_list_tables.tpl index eba382d..86ba6f0 100644 --- a/tpl/home/databases_list_tables.tpl +++ b/tpl/home/databases_list_tables.tpl @@ -1,80 +1,109 @@ - -
{L_INFO_DBDETAIL} "{DB_NAME}"
- - -{L_INFO_DBEMPTY}
- - - -1 {L_TABLE} - - - -{TABLE_COUNT} {L_TABLES} - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#{L_TABLE}{L_INFO_RECORDS}{L_INFO_SIZE}{L_INFO_LASTUPDATE}{L_ENGINE}{L_INFO_OPTIMIZED}{L_STATUS}
{ROW.NR}. - {ROW.TABLE_NAME}{ROW.RECORDS}{ROW.SIZE}{ROW.LAST_UPDATE}{ROW.ENGINE} - - - - - - - - - - {L_CHECK} - - - - - - - -  repair  - -
{L_INFO_SUM}{SUM.RECORDS}{SUM.SIZE}{SUM.LAST_UPDATE} 
- -
-
- - - - -
+ + +
{L_INFO_DBDETAIL} "{DB_NAME}"
+{MESSAGE} + +
+ Found MyISAM tables with disabled keys! For better performance you should enable them.
+
+
+ + + +{L_INFO_DBEMPTY}
+ + + +1 {L_TABLE} + + + +{TABLE_COUNT} {L_TABLES} + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#{L_TABLE}{L_INFO_RECORDS}{L_INFO_SIZE}{L_INFO_LASTUPDATE}{L_ENGINE}{L_INFO_OPTIMIZED}{L_STATUS}Key {L_STATUS}
{ROW.NR}. + {ROW.TABLE_NAME}{ROW.RECORDS}{ROW.SIZE}{ROW.LAST_UPDATE}{ROW.ENGINE} + + + + + + + + + + {L_CHECK} + + + + + + + +  repair  + + + + +  Enable keys + + + + + +
{L_INFO_SUM}{SUM.RECORDS}{SUM.SIZE}{SUM.LAST_UPDATE} 
+ +
+ +
+ Found MyISAM tables with disabled keys! For better performance you should enable them.
+

+
+ +
+ + + + + + + +
+


\ No newline at end of file diff --git a/tpl/home/headnavi.tpl b/tpl/home/headnavi.tpl index 427ffb2..7bf0616 100644 --- a/tpl/home/headnavi.tpl +++ b/tpl/home/headnavi.tpl @@ -1,9 +1,9 @@ -{HEADER} -{HEADLINE} - -
+{HEADER} +{HEADLINE} + +
diff --git a/tpl/home/home.tpl b/tpl/home/home.tpl index 2b524a3..8e4ec1b 100644 --- a/tpl/home/home.tpl +++ b/tpl/home/home.tpl @@ -1,54 +1,54 @@ -
{L_STATUSINFORMATIONEN}
- - {DIRECTORY_WARNINGS.MSD} - - - - {L_HTACC_EDIT}  - {L_DELETE_HTACCESS}
- - - - {L_HTACC_PROPOSED}:   - {L_HTACC_CREATE}
- - -
{L_VERSIONSINFORMATIONEN}
-love your data -{L_MSD_VERSION}: {MSD_VERSION}
-{L_OS}: {OS} ({OS_EXT})
-{L_MYSQL_VERSION}: {MYSQL_VERSION}
-{L_PHP_VERSION}: {PHP_VERSION}  {L_MEMORY}: {MEMORY}   -{L_MAX_EXECUTION_TIME}: {MAX_EXECUTION_TIME} {L_SECONDS}   -PHP-Info
- - {L_PHPBUG}
- - - - {L_NOFTPPOSSIBLE}
- - - - {L_NOGZPOSSIBLE}
- - -{L_PHP_EXTENSIONS}: {PHP_EXTENSIONS}
- -
- {L_DISABLEDFUNCTIONS}: {DISABLED_FUNCTIONS.PHP_DISABLED_FUNCTIONS}
- - -
- -
{L_MSD_INFO}
-{L_INFO_LOCATION} "{SERVER_NAME}" ({MSD_PATH})
-{L_INFO_ACTDB}: {DB}
-{L_BACKUPFILESANZAHL} {NR_OF_BACKUP_FILES} -{L_BACKUPS} ({SIZE_BACKUPS})
-{L_FM_FREESPACE}: {FREE_DISKSPACE}
- - - {L_LASTBACKUP} {L_VOM} {LAST_BACKUP.LAST_BACKUP_INFO}
-      {LAST_BACKUP.LAST_BACKUP_NAME}
+
{L_STATUSINFORMATIONEN}
+ + {DIRECTORY_WARNINGS.MSD} + + + + {L_HTACC_EDIT}  + {L_DELETE_HTACCESS}
+ + + + {L_HTACC_PROPOSED}:   + {L_HTACC_CREATE}
+ + +
{L_VERSIONSINFORMATIONEN}
+love your data +{L_MSD_VERSION}: {MSD_VERSION}
+{L_OS}: {OS} ({OS_EXT})
+{L_MYSQL_VERSION}: {MYSQL_VERSION}
+{L_PHP_VERSION}: {PHP_VERSION}  {L_MEMORY}: {MEMORY}   +{L_MAX_EXECUTION_TIME}: {MAX_EXECUTION_TIME} {L_SECONDS}   +PHP-Info
+ + {L_PHPBUG}
+ + + + {L_NOFTPPOSSIBLE}
+ + + + {L_NOGZPOSSIBLE}
+ + +{L_PHP_EXTENSIONS}: {PHP_EXTENSIONS}
+ +
+ {L_DISABLEDFUNCTIONS}: {DISABLED_FUNCTIONS.PHP_DISABLED_FUNCTIONS}
+ + +
+ +
{L_MSD_INFO}
+{L_INFO_LOCATION} "{SERVER_NAME}" ({MSD_PATH})
+{L_INFO_ACTDB}: {DB}
+{L_BACKUPFILESANZAHL} {NR_OF_BACKUP_FILES} +{L_BACKUPS} ({SIZE_BACKUPS})
+{L_FM_FREESPACE}: {FREE_DISKSPACE}
+ + + {L_LASTBACKUP} {L_VOM} {LAST_BACKUP.LAST_BACKUP_INFO}
+      {LAST_BACKUP.LAST_BACKUP_NAME}
\ No newline at end of file diff --git a/tpl/home/protection_create.tpl b/tpl/home/protection_create.tpl index 3f6093c..f7a5094 100644 --- a/tpl/home/protection_create.tpl +++ b/tpl/home/protection_create.tpl @@ -1,191 +1,191 @@ - - - - - - MySqlDumper - - - - - - - -{HEADLINE} - -{MSG.TEXT}

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
{L_USERNAME}:
{L_PASSWORD}: - -
{L_PASSWORD_REPEAT}: - -
{L_PASSWORD_STRENGTH}: -
-
{L_ENCRYPTION_TYPE}: - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
-
-
- -

-
-
- - - - {L_HTACC_CONTENT} .htaccess:

- {CREATE_SUCCESS.HTACCESS} - -
{L_HTACC_CONTENT} .htpasswd:

- {CREATE_SUCCESS.HTPASSWD} -

- {L_HOME} - - - -

{L_HTACC_CREATE_ERROR}:

- - {L_HTACC_CONTENT} .htaccess:

- - -
{L_HTACC_CONTENT} .htpasswd:

- - -

- {L_HOME} - + + + + + + MySqlDumper + + + + + + + +{HEADLINE} + +{MSG.TEXT}

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}:
{L_PASSWORD}: + +
{L_PASSWORD_REPEAT}: + +
{L_PASSWORD_STRENGTH}: +
+
{L_ENCRYPTION_TYPE}: + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+
+
+ +

+
+
+ + + + {L_HTACC_CONTENT} .htaccess:

+ {CREATE_SUCCESS.HTACCESS} + +

{L_HTACC_CONTENT} .htpasswd:

+ {CREATE_SUCCESS.HTPASSWD} +

+ {L_HOME} + + + +

{L_HTACC_CREATE_ERROR}:

+ + {L_HTACC_CONTENT} .htaccess:

+ + +
{L_HTACC_CONTENT} .htpasswd:

+ + +

+ {L_HOME} + diff --git a/tpl/menu/footer.tpl b/tpl/menu/footer.tpl index 120660d..f33eea0 100644 --- a/tpl/menu/footer.tpl +++ b/tpl/menu/footer.tpl @@ -1,10 +1,10 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/tpl/menu/header.tpl b/tpl/menu/header.tpl index 14a5a7b..9bc9dae 100644 --- a/tpl/menu/header.tpl +++ b/tpl/menu/header.tpl @@ -1,33 +1,33 @@ -{MSD_HEADER} -{MSD_HEADLINE} - - {CONFIG_REFRESH} - - - - - - - - - -MySQLDumper - Homepage - - +{MSD_HEADER} +{MSD_HEADLINE} + + {CONFIG_REFRESH} + + + + + + + + + +MySQLDumper - Homepage + + diff --git a/tpl/restore_select_tables.tpl b/tpl/restore_select_tables.tpl index 2054fbb..5180f5e 100644 --- a/tpl/restore_select_tables.tpl +++ b/tpl/restore_select_tables.tpl @@ -1,65 +1,65 @@ -
{PAGETITLE}
-
{L_DATABASE}: {DATABASE}
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#{L_NAME}{L_RESTORE}{L_ROWS}{L_SIZE}{L_LAST_UPDATE}{L_TABLE_TYPE}
{L_NO_MSD_BACKUP}
{ROW.NR}. - - - - - - {ROW.RECORDS} - {ROW.SIZE}{ROW.LAST_UPDATE}{ROW.TABLETYPE}
-
-
-
-
-
-
- - - -
-
- +
{PAGETITLE}
+
{L_DATABASE}: {DATABASE}
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#{L_NAME}{L_RESTORE}{L_ROWS}{L_SIZE}{L_LAST_UPDATE}{L_TABLE_TYPE}
{L_NO_MSD_BACKUP}
{ROW.NR}. + + + + + + {ROW.RECORDS} + {ROW.SIZE}{ROW.LAST_UPDATE}{ROW.TABLETYPE}
+
+
+
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/tpl/sqlbrowser/mysql_search.tpl b/tpl/sqlbrowser/mysql_search.tpl index d987e70..ee9b095 100644 --- a/tpl/sqlbrowser/mysql_search.tpl +++ b/tpl/sqlbrowser/mysql_search.tpl @@ -1,73 +1,73 @@ -
-
-
- {LANG_SQLSEARCH} - {LANG_SQL_SEARCHWORDS}: - - - {LANG_SEARCH_EXPLAIN}
-
- {LANG_SEARCH_OPTIONS} - - -
- - -
- - -
- {LANG_SEARCH_IN_TABLE}:   - - - {HIDDEN_FIELDS} -
-
-
- - {HITS.LANG_SEARCH_RESULTS}:
- -    - -    - {HITS.LANG_ACCESS_KEYS} - -

- - - - - - - - - - - - - - - - - -
 #{HITS.TABLEHEAD.KEY}
- {HITS.TABLEROW.ICON_EDIT}{HITS.TABLEROW.ICON_DELETE} - {HITS.TABLEROW.NR}. {HITS.TABLEROW.TABLEDATA.VAL}
- - - - {NO_RESULTS.LANG_SEARCH_NO_RESULTS} - - - - {NO_ENTRIES.LANG_NO_ENTRIES} - -
- - +
+
+
+ {LANG_SQLSEARCH} + {LANG_SQL_SEARCHWORDS}: + + + {LANG_SEARCH_EXPLAIN}
+
+ {LANG_SEARCH_OPTIONS} + + +
+ + +
+ + +
+ {LANG_SEARCH_IN_TABLE}:   + + + {HIDDEN_FIELDS} +
+
+
+ + {HITS.LANG_SEARCH_RESULTS}:
+ +    + +    + {HITS.LANG_ACCESS_KEYS} + +

+ + + + + + + + + + + + + + + + + +
 #{HITS.TABLEHEAD.KEY}
+ {HITS.TABLEROW.ICON_EDIT}{HITS.TABLEROW.ICON_DELETE} + {HITS.TABLEROW.NR}. {HITS.TABLEROW.TABLEDATA.VAL}
+ + + + {NO_RESULTS.LANG_SEARCH_NO_RESULTS} + + + + {NO_ENTRIES.LANG_NO_ENTRIES} + +
+ + diff --git a/tpl/sqlbrowser/sql_record_insert_inputmask.tpl b/tpl/sqlbrowser/sql_record_insert_inputmask.tpl index c688d78..f543cb4 100644 --- a/tpl/sqlbrowser/sql_record_insert_inputmask.tpl +++ b/tpl/sqlbrowser/sql_record_insert_inputmask.tpl @@ -1,52 +1,52 @@ - -
- - -{HIDDEN_FIELDS} - - - - - - - - - - - - - - - -
{L_SQL_RECORDNEW}
{L_NAME}NULL{L_INHALT}
{ROW.FIELD_NAME} -   - - -   - - - - - - - - - - -
-
- - -     -     -

-
+ + + + +{HIDDEN_FIELDS} + + + + + + + + + + + + + + + +
{L_SQL_RECORDNEW}
{L_NAME}NULL{L_INHALT}
{ROW.FIELD_NAME} +   + + +   + + + + + + + + + + +
+
+ + +     +     +

+
\ No newline at end of file diff --git a/tpl/sqlbrowser/sql_record_update_inputmask.tpl b/tpl/sqlbrowser/sql_record_update_inputmask.tpl index 61d880a..dd6c323 100644 --- a/tpl/sqlbrowser/sql_record_update_inputmask.tpl +++ b/tpl/sqlbrowser/sql_record_update_inputmask.tpl @@ -1,53 +1,53 @@ - -
- - -{HIDDEN_FIELDS} - - - - - - - - - - - - - - - -
{L_SQL_RECORDEDIT}
{L_NAME}NULL{L_INHALT}
{ROW.FIELD_NAME} -   - - -   - - - - - - - - - - -
-
- - -     -     -

-
+ + + + +{HIDDEN_FIELDS} + + + + + + + + + + + + + + + +
{L_SQL_RECORDEDIT}
{L_NAME}NULL{L_INHALT}
{ROW.FIELD_NAME} +   + + +   + + + + + + + + + + +
+
+ + +     +     +

+
\ No newline at end of file diff --git a/tpl/sqlbrowser/sqlbox.tpl b/tpl/sqlbrowser/sqlbox.tpl index 36a534e..53a51db 100644 --- a/tpl/sqlbrowser/sqlbox.tpl +++ b/tpl/sqlbrowser/sqlbox.tpl @@ -1,56 +1,56 @@ -

- - - - [{LANG_TOOLS}] -  {LANG_DB}: - `{DB}` - -  {LANG_TABLE}: `{TABLENAME}` - -

- -
- - - - - - - -
{SQLUPLOAD.LANG_OPENSQLFILE}{SQLUPLOAD.LANG_SQL_MAXSIZE}: {SQLUPLOAD.MAX_FILESIZE}
-
- - -
-
-
- -    - - show less -  show more -     - - - {SQLCOMBO.SQL_COMBOBOX}   - - {TABLE_COMBOBOX}  -   -   - -   {ICON_UPLOAD} -   {ICON_SEARCH} -   {ICON_MYSQL_HELP} -
- -
- -
{LANG_SQL_WARNING}
- - - -
-
-
-
+

+ + + + [{LANG_TOOLS}] +  {LANG_DB}: + `{DB}` + +  {LANG_TABLE}: `{TABLENAME}` + +

+ +
+ + + + + + + +
{SQLUPLOAD.LANG_OPENSQLFILE}{SQLUPLOAD.LANG_SQL_MAXSIZE}: {SQLUPLOAD.MAX_FILESIZE}
+
+ + +
+
+
+ +    + + show less +  show more +     + + + {SQLCOMBO.SQL_COMBOBOX}   + + {TABLE_COMBOBOX}  +   +   + +   {ICON_UPLOAD} +   {ICON_SEARCH} +   {ICON_MYSQL_HELP} +
+ +
+ +
{LANG_SQL_WARNING}
+ + + +
+
+
+