Centralize SQL connections

Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-24 12:48:16 +00:00
parent 041e77246f
commit 92555ea2bf
7 changed files with 65 additions and 83 deletions

View File

@@ -1,5 +1,5 @@
<?
namespace Kabano;
/**********************************************************
@@ -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";
@@ -73,8 +74,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";
@@ -95,4 +95,4 @@ class Locales
}
}
?>
?>