Merge pull request #3 from LeOSW42/copilot/create-database-file-connection

Centralize PostgreSQL connection setup across models
This commit is contained in:
2026-01-24 14:03:54 +01:00
committed by GitHub
7 changed files with 66 additions and 76 deletions

View File

@@ -10,6 +10,8 @@ namespace Kabano;
***********************************************************
**********************************************************/
require_once($config['includes_folder']."database.php");
class Locale
{
public $name = 0;
@@ -22,8 +24,7 @@ class Locale
public function checkName($name) {
global $config;
$con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
or die ("Could not connect to server\n");
$con = sql_connect();
$query = "SELECT * FROM locales WHERE name=$1";
@@ -83,8 +84,7 @@ class Locales
public function getAll() {
global $config;
$con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
or die ("Could not connect to server\n");
$con = sql_connect();
$query = "SELECT * FROM locales";