Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../var/softacul.../humogen
File: db_login.php
<?php
[0] Fix | Delete
// *** To make HuMo-genealogy work, fill these lines properly! ***
[1] Fix | Delete
// *** Om HuMo-genealogy werkend te krijgen onderstaande regels GOED invullen! ***
[2] Fix | Delete
define("DATABASE_HOST", '[[softdbhost]]');
[3] Fix | Delete
define("DATABASE_USERNAME", '[[softdbuser]]');
[4] Fix | Delete
define("DATABASE_PASSWORD", '[[softdbpass]]');
[5] Fix | Delete
define("DATABASE_NAME", '[[softdb]]');
[6] Fix | Delete
[7] Fix | Delete
// *** Needed for Docker ***
[8] Fix | Delete
$DATABASE_HOST= '';
[9] Fix | Delete
$DATABASE_USERNAME='';
[10] Fix | Delete
$DATABASE_PASSWORD='';
[11] Fix | Delete
$DATABASE_NAME= '';
[12] Fix | Delete
$USE_ENV_FOR_DB= true;
[13] Fix | Delete
[14] Fix | Delete
// *** DON'T CHANGE ANYTHING BELOW THIS LINE! ***
[15] Fix | Delete
// *** HIERONDER NIETS WIJZIGEN! ***
[16] Fix | Delete
[17] Fix | Delete
// *** Check if PDO driver is available ***
[18] Fix | Delete
if (!defined('PDO::ATTR_DRIVER_NAME')) {
[19] Fix | Delete
echo '<html>
[20] Fix | Delete
<header><title>ERROR</title><body>
[21] Fix | Delete
<h2>ERROR: The PDO driver is unavailable!</h2>
[22] Fix | Delete
Possible solutions:<br><br>
[23] Fix | Delete
1) Update PHP to 7.x<br>
[24] Fix | Delete
2) Check if the PDO driver is enabled.<br>
[25] Fix | Delete
3) If the PDO driver is enabled but you receive this message from the Admin screen, try adding these three lines to the admin/php.ini file:<br>
[26] Fix | Delete
extension=pdo.so<br>
[27] Fix | Delete
extension=pdo_sqlite.so<br>
[28] Fix | Delete
extension=pdo_mysql.so<br>
[29] Fix | Delete
[30] Fix | Delete
<p>If it\'s not possible to use PDO, you have to downgrade to HuMo-genealogy 4.9.4!<br>
[31] Fix | Delete
1) Download HuMo-genealogy 4.9.4 at: <a href="https://sourceforge.net/projects/humo-gen/files">Sourceforge</a><br>
[32] Fix | Delete
2) Follow <a href="https://sourceforge.net/projects/humo-gen/files/HuMo-gen_Manual/">HuMo-gen installation</a> instructions.
[33] Fix | Delete
</body></html>
[34] Fix | Delete
';
[35] Fix | Delete
exit();
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
// *** Override the database connection values with environment variables ***
[39] Fix | Delete
$temp_db_value = getenv("MYSQL_DATABASE", true);
[40] Fix | Delete
if ($USE_ENV_FOR_DB && $temp_db_value != false && $temp_db_value != '') {
[41] Fix | Delete
$DATABASE_NAME=$temp_db_value;
[42] Fix | Delete
[43] Fix | Delete
//$temp_db_value = getenv("MYSQL_HOST", true);
[44] Fix | Delete
//if ($USE_ENV_FOR_DB && $temp_db_value != false && $temp_db_value != '') {
[45] Fix | Delete
// $DATABASE_HOST=$temp_db_value;
[46] Fix | Delete
$DATABASE_HOST='mariadb';
[47] Fix | Delete
[48] Fix | Delete
$temp_db_value = getenv("MYSQL_USER", true);
[49] Fix | Delete
if ($USE_ENV_FOR_DB && $temp_db_value != false && $temp_db_value != '') {
[50] Fix | Delete
$DATABASE_USERNAME=$temp_db_value;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$temp_db_value = getenv("MYSQL_PASSWORD", true);
[54] Fix | Delete
if ($USE_ENV_FOR_DB && $temp_db_value != false && $temp_db_value != '') {
[55] Fix | Delete
$DATABASE_PASSWORD=$temp_db_value;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
// *** Open database using PDO **
[59] Fix | Delete
$conn = 'mysql:host='.$DATABASE_HOST.';dbname='.$DATABASE_NAME.';charset=utf8';
[60] Fix | Delete
try {
[61] Fix | Delete
$dbh = new PDO($conn,$DATABASE_USERNAME,$DATABASE_PASSWORD);
[62] Fix | Delete
@$database_check=1;
[63] Fix | Delete
} catch (PDOException $e) {
[64] Fix | Delete
unset($database_check);
[65] Fix | Delete
if(!isset($ADMIN)) {
[66] Fix | Delete
echo '<br><font color=red><b>
[67] Fix | Delete
Database is not yet installed! Possible problems:<br>
[68] Fix | Delete
- Login file not yet configured.<br>
[69] Fix | Delete
- Database not yet installed.<br>
[70] Fix | Delete
Go to the <a href="admin">administration area</a> to solve this problem.
[71] Fix | Delete
<p>De database is nog niet bereikbaar! Mogelijke oorzaken:<br>
[72] Fix | Delete
- Het login bestand is niet goed ingevuld.<br>
[73] Fix | Delete
- De database is nog niet gemaakt.<br>
[74] Fix | Delete
Ga naar het <a href="admin">administratie scherm</a> om dit probleem op te lossen.
[75] Fix | Delete
</b></font>';
[76] Fix | Delete
exit();
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
else{
[81] Fix | Delete
// *** Open database using PDO **
[82] Fix | Delete
//$conn = 'mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME;
[83] Fix | Delete
$conn = 'mysql:host='.DATABASE_HOST.';dbname='.DATABASE_NAME.';charset=utf8';
[84] Fix | Delete
try {
[85] Fix | Delete
//$dbh = new PDO($conn,DATABASE_USERNAME,DATABASE_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
[86] Fix | Delete
$dbh = new PDO($conn,DATABASE_USERNAME,DATABASE_PASSWORD);
[87] Fix | Delete
@$database_check=1;
[88] Fix | Delete
} catch (PDOException $e) {
[89] Fix | Delete
unset($database_check);
[90] Fix | Delete
//echo $e->getMessage() . "<br/>";
[91] Fix | Delete
if(!isset($ADMIN)) {
[92] Fix | Delete
echo '<br><font color=red><b>
[93] Fix | Delete
Database is not yet installed! Possible problems:<br>
[94] Fix | Delete
- Login file not yet configured.<br>
[95] Fix | Delete
- Database not yet installed.<br>
[96] Fix | Delete
Go to the <a href="admin">administration area</a> to solve this problem.
[97] Fix | Delete
<p>De database is nog niet bereikbaar! Mogelijke oorzaken:<br>
[98] Fix | Delete
- Het login bestand is niet goed ingevuld.<br>
[99] Fix | Delete
- De database is nog niet gemaakt.<br>
[100] Fix | Delete
Ga naar het <a href="admin">administratie scherm</a> om dit probleem op te lossen.
[101] Fix | Delete
</b></font>';
[102] Fix | Delete
exit();
[103] Fix | Delete
}
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
if (isset($database_check) and $database_check == 1) {
[108] Fix | Delete
// TODO improve genealogical dates in database, then remove this code.
[109] Fix | Delete
// *** Added in mar. 2022: disable NO_ZERO_DATE and NO_ZERO_IN_DATE. To solve sorting problems in genealogical dates. ***
[110] Fix | Delete
$dbh->query("SET SESSION sql_mode=(SELECT
[111] Fix | Delete
REPLACE(
[112] Fix | Delete
REPLACE(@@SESSION.sql_mode,'NO_ZERO_DATE','')
[113] Fix | Delete
,'NO_ZERO_IN_DATE',''));");
[114] Fix | Delete
[115] Fix | Delete
// TODO improve queries, then remove this code.
[116] Fix | Delete
// *** Added in mar. 2023. To prevent double results in search results ***
[117] Fix | Delete
$dbh->query("SET SESSION sql_mode=(SELECT
[118] Fix | Delete
REPLACE(
[119] Fix | Delete
REPLACE(@@SESSION.sql_mode,'ONLY_FULL_GROUP_BY','')
[120] Fix | Delete
,'NO_ZERO_IN_DATE',''));");
[121] Fix | Delete
}
[122] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function