Centralize SQL connections
Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user