From 8736d83d10ecb527fd4739cc58f92aa175237da7 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 12 Oct 2016 08:43:10 -0400 Subject: [PATCH] Updating the db connection. Option if the site doesn't have the class that we would use for PDO. This will create it's own PDO connection to the database. --- index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index a1ecb80..8a6730e 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,14 @@ $smarty->setCompileDir('./tmp_c/'); $smarty->setConfigDir('./configs/'); $smarty->setCacheDir('./cache/'); -$dbh = Toolkit_Database::getInstance(); +if ( class_exists( Toolkit_Database ) ) { + $dbh = Toolkit_Database::getInstance(); +} else { + $dsn = 'pgsql:' . CONN_STR; + $driverOptions = array( PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH ); + $dbh = new PDO($dsn, null, null, $driverOptions); + $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); +} $sql = " SELECT * -- 2.17.1