Skip to content

Commit

Permalink
Feature 928 resolved.
Browse files Browse the repository at this point in the history
Replace include/mysql.inc.php by include/config_database.inc.php to be independant of database engine
Rename database configurations variables by ones in $conf array.

git-svn-id: http://piwigo.org/svn/trunk@4280 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Nov 16, 2009
1 parent 9a773f0 commit 8a29965
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 43 deletions.
2 changes: 1 addition & 1 deletion admin/include/functions_upgrade.php
Expand Up @@ -159,7 +159,7 @@ function check_upgrade_access_rights($current_release, $username, $password)
{
$query = '
SELECT u.password, ui.status
FROM '.$conf['users_table'].' AS u
FROM '.USERS_TABLE.' AS u
INNER JOIN '.USER_INFOS_TABLE.' AS ui
ON u.'.$conf['user_fields']['id'].'=ui.user_id
WHERE '.$conf['user_fields']['username'].'="'.$username.'"
Expand Down
6 changes: 3 additions & 3 deletions include/common.inc.php
Expand Up @@ -70,7 +70,7 @@ function sanitize_mysql_kv(&$v, $k)
$header_notes = array();
$filter = array();

@include(PHPWG_ROOT_PATH .'include/mysql.inc.php');
@include(PHPWG_ROOT_PATH .'include/config_database.inc.php');
if (!defined('PHPWG_INSTALLED'))
{
header('Location: install.php');
Expand Down Expand Up @@ -104,8 +104,8 @@ function sanitize_mysql_kv(&$v, $k)
include( PHPWG_ROOT_PATH .'include/template.class.php');

// Database connection
@mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or my_error( 'mysql_connect', true );
@mysql_select_db( $cfgBase ) or my_error( 'mysql_select_db', true );
@mysql_connect( $conf['db_host'], $conf['db_user'], $conf['db_password'] ) or my_error( 'mysql_connect', true );
@mysql_select_db( $conf['db_base'] ) or my_error( 'mysql_select_db', true );

defined('PWG_CHARSET') and defined('DB_CHARSET')
or fatal_error('PWG_CHARSET and/or DB_CHARSET is not defined');
Expand Down
5 changes: 4 additions & 1 deletion include/config_default.inc.php
Expand Up @@ -494,7 +494,10 @@
//
// All informations contained in these tables and column are related to
// piwigo_users table.
$conf['users_table'] = $prefixeTable.'users';
//
// You can use a different table for users, if you define associated constant
// default configuration :
// define('USERS_TABLE', $prefixeTable.'users');

// Other tables can be changed, if you define associated constants
// Example:
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Expand Up @@ -68,7 +68,7 @@
if (!defined('USER_GROUP_TABLE'))
define('USER_GROUP_TABLE', $prefixeTable.'user_group');
if (!defined('USERS_TABLE'))
define('USERS_TABLE', $conf['users_table']);
define('USERS_TABLE', $prefixeTable.'users');
if (!defined('USER_INFOS_TABLE'))
define('USER_INFOS_TABLE', $prefixeTable.'user_infos');
if (!defined('USER_FEED_TABLE'))
Expand Down
10 changes: 5 additions & 5 deletions install.php
Expand Up @@ -168,7 +168,7 @@ function execute_sqlfile($filepath, $replaced, $replacing)
$errors = array();

// Open config.php ... if it exists
$config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
$config_file = PHPWG_ROOT_PATH.'include/config_database.inc.php';
if (@file_exists($config_file))
{
include($config_file);
Expand Down Expand Up @@ -291,10 +291,10 @@ function execute_sqlfile($filepath, $replaced, $replacing)
{
$step = 2;
$file_content = '<?php
$cfgBase = \''.$dbname.'\';
$cfgUser = \''.$dbuser.'\';
$cfgPassword = \''.$dbpasswd.'\';
$cfgHote = \''.$dbhost.'\';
$conf[\'db_base\'] = \''.$dbname.'\';
$conf[\'db_user\'] = \''.$dbuser.'\';
$conf[\'db_password\'] = \''.$dbpasswd.'\';
$conf[\'db_host\'] = \''.$dbhost.'\';
$prefixeTable = \''.$table_prefix.'\';
Expand Down
2 changes: 1 addition & 1 deletion install/db/65-database.php
Expand Up @@ -255,7 +255,7 @@ function upgrade65_change_table_to_charset($table, $field_definitions, $db_chars


// +-----------------------------------------------------------------------+
// changes to write in mysql.inc.php
// changes to write in config_database.inc.php
array_push($mysql_changes,
'define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
define(\'DB_CHARSET\', \''.$db_charset.'\');
Expand Down
6 changes: 3 additions & 3 deletions install/db/80-database.php
Expand Up @@ -173,7 +173,7 @@
'include_phpwebgallery',
'include_phpwebgallery/config.php',
'include_phpwebgallery/index.htm',
'include_phpwebgallery/mysql.inc.php',
'include_phpwebgallery/config_database.inc.php',
'index.htm',
// Comparison between phpwebgallery-1.2.1 and phpwebgallery-1.1.0
'admin/isadmin.php',
Expand Down Expand Up @@ -927,7 +927,7 @@
// Comparison between trunk-r3105 and phpwebgallery-2.0.0RC4
'admin/template/goto/theme/roma/images/bottom-left-bg.png',
'admin/template/goto/theme/roma/images/top-left-bg.png',
'include/mysql.inc.php',
'include/config_database.inc.php',
'template-common/lib/ui/ui.accordion.packed.js',
'template-common/lib/ui/ui.core.packed.js',
'template-common/lib/ui/ui.datepicker.css',
Expand All @@ -943,7 +943,7 @@
);

$list_exlude_files = array(
'include/mysql.inc.php',
'include/config_database.inc.php',
);


Expand Down
4 changes: 2 additions & 2 deletions install/upgrade_1.3.1.php
Expand Up @@ -579,7 +579,7 @@
}

// load the config file
$config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
$config_file = PHPWG_ROOT_PATH.'include/config_database.inc.php';
$config_file_contents = @file_get_contents($config_file);
if ($config_file_contents === false)
{
Expand All @@ -595,7 +595,7 @@
die('FILE NOT WRITABLE '.$config_file);
}

// changes to write in mysql.inc.php
// changes to write in config_database.inc.php
array_push($mysql_changes, 'define(\'PHPWG_INSTALLED\', true);');

// Send infos
Expand Down
2 changes: 1 addition & 1 deletion language/de_DE/install.lang.php
Expand Up @@ -54,7 +54,7 @@
$lang['step2_pwd_info'] = 'Administratorpasswort';
$lang['step2_pwd_conf'] = 'Passwort [Best&auml;tigung]';
$lang['step2_pwd_conf_info'] = 'Wiederholen Sie das eingegebene Passwort';
$lang['step1_err_copy'] = 'Kopieren Sie den rosa Text ohne die Bindestriche und fügen Sie ihn in die Datei "include / mysql.inc.php" auf dem Webserver ein (Warnung: die Datei "mysql.inc.php" darf nur die rosa Zeichen enthalten, nicht mehr und nicht weniger)';
$lang['step1_err_copy'] = 'Kopieren Sie den rosa Text ohne die Bindestriche und fügen Sie ihn in die Datei "include / config_database.inc.php" auf dem Webserver ein (Warnung: die Datei "config_database.inc.php" darf nur die rosa Zeichen enthalten, nicht mehr und nicht weniger)';
$lang['install_help'] = 'Brauchen Sie Hilfe? Stellen Sie Ihre Frage auf der <a href="%s"> Forum Piwigo </a>.';
$lang['install_end_message'] = 'Die Konfiguration der Piwigo abgeschlossen ist, hier ist der n&auml;chste Schritt<br><br>
* Gehen Sie zum Anmelden auf die Startseite: [ <a href="./identification.php">Identifizierung</a> ] und verwenden Sie die Login / Passwort für Webmaster<br>
Expand Down
2 changes: 1 addition & 1 deletion language/de_DE/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'Als Vorsichtsmaßnahme folgenden Plugins wurden deaktiviert. Sie müssen prüfen, ob Plugins aktualisieren, bevor sie reactiving:';
$lang['upgrade login message'] = 'Nur Administrator können Upgrade ausführen : Bitte melden Sie sich an unter.';
$lang['You do not have access rights to run upgrade'] = 'Sie haben nicht das Recht auf Zugang zum Upgrade ausführen';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, vor <b>?></b>, wird Folgendes eingefügt:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'In <i>include/config_database.inc.php</i>, vor <b>?></b>, wird Folgendes eingefügt:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Alle Unter-Kategorien von privaten Gruppen wirden privaten';
Expand Down
2 changes: 1 addition & 1 deletion language/en_UK/install.lang.php
Expand Up @@ -37,7 +37,7 @@
$lang['step1_err_server'] = 'Can\'t connect to server';
$lang['step1_err_copy_2'] = 'The next step of the installation is now possible';
$lang['step1_err_copy_next'] = 'next step';
$lang['step1_err_copy'] = 'Copy the text in pink between hyphens and paste it into the file "include/mysql.inc.php"(Warning : mysql.inc.php must only contain what is in pink, no line return or space character)';
$lang['step1_err_copy'] = 'Copy the text in pink between hyphens and paste it into the file "include/config_database.inc.php"(Warning : config_database.inc.php must only contain what is in pink, no line return or space character)';

$lang['step1_host'] = 'MySQL host';
$lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
Expand Down
2 changes: 1 addition & 1 deletion language/en_UK/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'In <i>include/config_database.inc.php</i>, before <b>?></b>, insert:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'All sub-categories of private categories become private';
Expand Down
2 changes: 1 addition & 1 deletion language/es_ES/install.lang.php
Expand Up @@ -54,7 +54,7 @@
$lang['step2_pwd_info'] = 'Debe quedar confidencial, permite acceder al tabla de administración.';
$lang['step2_pwd_conf'] = 'Palabra de paso [Confirmar]';
$lang['step2_pwd_conf_info'] = 'Comprobación';
$lang['step1_err_copy'] = 'Copie el texto en rosa entre las rayas y pegúelo en el fichero mysql.inc.php que se encuentra en el repertorio " include " a la base del lugar donde usted instaló a Piwigo (el fichero mysql.inc.php debe contener SÓLO lo que está en rosa entre las rayas, ninguna vuelta a la línea o espacio es autorizado)';
$lang['step1_err_copy'] = 'Copie el texto en rosa entre las rayas y pegúelo en el fichero config_database.inc.php que se encuentra en el repertorio " include " a la base del lugar donde usted instaló a Piwigo (el fichero config_database.inc.php debe contener SÓLO lo que está en rosa entre las rayas, ninguna vuelta a la línea o espacio es autorizado)';
$lang['install_help'] = '¿ Necesidad de ayudante? Plantee su cuestión sobre él <a href="%s">foro de Piwigo</a>.';
$lang['install_end_message'] = 'La configuración de la aplicación correctamente se celebró, coloca en la etapa próxima<br><br>
* Vaya sobre la página de identificación y conéctese con pseudo dado para el webmaster<br>
Expand Down
2 changes: 1 addition & 1 deletion language/es_ES/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'Por precaución, el plugins siguiente han sido desactivados. Verifique si existen unas posturas al día antes de reactivarlas:';
$lang['upgrade login message'] = 'Sólo un administrador puede lanzar la puesta al día: por favor, identifiqúese más abajo.';
$lang['You do not have access rights to run upgrade'] = 'Usted no tiene los derechos necessaires para lanzar la puesta al día.';
/* TODO */$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
/* TODO */$lang['in include/config_database.inc.php, before ?>, insert:'] = 'In <i>include/config_database.inc.php</i>, before <b>?></b>, insert:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Todas las subcategorías de categorías privadas se vuelven privadas';
Expand Down
2 changes: 1 addition & 1 deletion language/fr_FR/install.lang.php
Expand Up @@ -54,7 +54,7 @@
$lang['step2_pwd_info'] = 'Il doit rester confidentiel, il permet d\'accéder au panneau d\'administration.';
$lang['step2_pwd_conf'] = 'Mot de passe [ Confirmer ]';
$lang['step2_pwd_conf_info'] = 'Vérification';
$lang['step1_err_copy'] = 'Copiez le texte en rose entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé Piwigo (le fichier mysql.inc.php ne doit comporter QUE ce qui est en rose entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)';
$lang['step1_err_copy'] = 'Copiez le texte en rose entre les tirets et collez-le dans le fichier config_database.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé Piwigo (le fichier config_database.inc.php ne doit comporter QUE ce qui est en rose entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)';
$lang['install_help'] = 'Besoin d\'aide ? Posez votre question sur le <a href="%s">forum de Piwigo</a>.';
$lang['install_end_message'] = 'La configuration de l\'application s\'est correctement déroulée, place à la prochaine étape<br><br>
* allez sur la page d\'identification et connectez-vous avec le pseudo donné pour le webmaster<br>
Expand Down
2 changes: 1 addition & 1 deletion language/fr_FR/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'Par précaution, les plugins suivants ont été désactivés. Vérifiez s\'il existe des mises à jour avant de les réactiver:';
$lang['upgrade login message'] = 'Seul un administrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
$lang['You do not have access rights to run upgrade'] = 'Vous n\'avez pas les droits necessaires pour lancer la mise à jour.';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'Dans le fichier <i>include/mysql.inc.php</i>, avant <b>?></b>, insérez:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'Dans le fichier <i>include/config_database.inc.php</i>, avant <b>?></b>, insérez:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Toutes les sous-catégories de catégories privées deviennent privées';
Expand Down
2 changes: 1 addition & 1 deletion language/it_IT/install.lang.php
Expand Up @@ -54,7 +54,7 @@
$lang['step2_pwd_info'] = 'da conservare con cura. Permette l\'accesso al pannello di amministrazione';
$lang['step2_pwd_conf'] = 'Password [confermare]';
$lang['step2_pwd_conf_info'] = 'verifica';
$lang['step1_err_copy'] = 'Copiate il testo in rosa trà i trattini e mettetelo nel file mysql.inc.php che si trova nella directory "include" alla base del vostro sito dove aveto installato Piwigo (il file mysql.inc.php non deve contenere altro che ciò che è in rosa tra i trattini, nessun ritorno a capo o spazio è autorizzato)';
$lang['step1_err_copy'] = 'Copiate il testo in rosa trà i trattini e mettetelo nel file config_database.inc.php che si trova nella directory "include" alla base del vostro sito dove aveto installato Piwigo (il file config_database.inc.php non deve contenere altro che ciò che è in rosa tra i trattini, nessun ritorno a capo o spazio è autorizzato)';
$lang['install_help'] = 'Bisogno di un aiuto? Visitate il <a href="%s">forum di Piwigo</a>.';
$lang['install_end_message'] = 'La configurazione di Piwigo è conclusa. Procedete al prossimo step<br><br>
* collegatevi alla pagina d\'accesso e usare come nome d\'utente e password quello del Webmaster<br>
Expand Down
2 changes: 1 addition & 1 deletion language/it_IT/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'Per precauzione, i plugins sono stati disattivati. Verificate se non esistono degli aggiornamenti prima di riattivarli:';
$lang['upgrade login message'] = 'Solo un\'amministratore può eseguire l\'aggiornamento: identificatevi.';
$lang['You do not have access rights to run upgrade'] = 'Non avete le autorizzazioni necessarie per effettuare l\'aggiornamento';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'Nel file <i>include/mysql.inc.php</i>, prima di <b>?></b>, inserire:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'Nel file <i>include/config_database.inc.php</i>, prima di <b>?></b>, inserire:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Tutte le sottocategorie delle categorie private diventono private';
Expand Down
2 changes: 1 addition & 1 deletion language/nl_NL/install.lang.php
Expand Up @@ -37,7 +37,7 @@
$lang['step1_err_server'] = 'Geen verbinding met de server';
$lang['step1_err_copy_2'] = 'Het is nu mogelijk om verder te gaan met de volgende stap van de installatie';
$lang['step1_err_copy_next'] = 'volgende stap';
$lang['step1_err_copy'] = 'Kopieer de tekst tussen de lijnen en plak deze in het bestand "include/mysql.inc.php"(Waarschuwing: mysql.inc.php mag alleen het roze gedeelte bevatten, geen return of extra spatie). Dit moet alleen wanneer dit bestand geen schrijfrechten';
$lang['step1_err_copy'] = 'Kopieer de tekst tussen de lijnen en plak deze in het bestand "include/config_database.inc.php"(Waarschuwing: config_database.inc.php mag alleen het roze gedeelte bevatten, geen return of extra spatie). Dit moet alleen wanneer dit bestand geen schrijfrechten';

$lang['step1_host'] = 'MySQL host';
$lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
Expand Down
2 changes: 1 addition & 1 deletion language/nl_NL/upgrade.lang.php
Expand Up @@ -35,7 +35,7 @@
$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'In <i>include/config_database.inc.php</i>, before <b>?></b>, insert:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'All sub-categories of private categories become private';
Expand Down
2 changes: 1 addition & 1 deletion language/pl_PL/install.lang.php
Expand Up @@ -37,7 +37,7 @@
$lang['step1_err_server'] = 'Nie można połączyć sie do serwera';
$lang['step1_err_copy_2'] = 'Teraz mozliwy jest następny krok instalacji';
$lang['step1_err_copy_next'] = 'następny krok';
$lang['step1_err_copy'] = 'Skopiuj tekst zaznaczony na różowo pomiędzy cudzysłowiami i wklej do pliku "include/mysql.inc.php"(Uwaga : mysql.inc.php musi zawierać tylko to co jest na różowo bez żadnych znaków końca linii czy spacji)';
$lang['step1_err_copy'] = 'Skopiuj tekst zaznaczony na różowo pomiędzy cudzysłowiami i wklej do pliku "include/config_database.inc.php"(Uwaga : config_database.inc.php musi zawierać tylko to co jest na różowo bez żadnych znaków końca linii czy spacji)';

$lang['step1_host'] = 'MySQL host';
$lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
Expand Down
2 changes: 1 addition & 1 deletion language/pl_PL/upgrade.lang.php
Expand Up @@ -34,7 +34,7 @@
$lang['deactivated plugins'] = 'W ramach zabezpieczenia zostąły deaktywowane następujące wtyczki. Przed ich ponowną aktywacją musisz sprawdzić dostępność aktualizacji dla nich:';
$lang['upgrade login message'] = 'Tylko administrator może wykonać aktualizację: zaloguj się poniżej.';
$lang['You do not have access rights to run upgrade'] = 'Nie masz uprawnień do wykonania aktualizacji';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'W pliku <i>include/mysql.inc.php</i>, przed <b>?></b>, wstaw:';
$lang['in include/config_database.inc.php, before ?>, insert:'] = 'W pliku <i>include/config_database.inc.php</i>, przed <b>?></b>, wstaw:';

// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Wszystkie podkategorie kategorii prywatnych staną się prywatne';
Expand Down
6 changes: 3 additions & 3 deletions tools/pwg_rel_create.sh
Expand Up @@ -34,9 +34,9 @@ mkdir $version

# cvs export -r $tag -d $version phpwebgallery
svn export http://piwigo.org/svn/tags/$tag $name
# creating mysql.inc.php empty and writeable
touch $name/include/mysql.inc.php
chmod a+w $name/include/mysql.inc.php
# creating config_database.inc.php empty and writeable
touch $name/include/config_database.inc.php
chmod a+w $name/include/config_database.inc.php

# find $name -name "*.php" \
# | xargs grep -l 'branch 1.7' \
Expand Down

0 comments on commit 8a29965

Please sign in to comment.