aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys/db.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-26 21:03:08 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-26 21:13:51 +0200
commitade9edeb849803082856f7633194913ad4df93a0 (patch)
treea864c593f92851678d7ab9fe4e7e9cfdefb539c8 /ratatoeskr/sys/db.php
parentc3cc300a952a793b9655226db1aad050daaa3803 (diff)
downloadratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.tar.gz
ratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.tar.bz2
ratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.zip
Automatic code formatting
Diffstat (limited to 'ratatoeskr/sys/db.php')
-rw-r--r--ratatoeskr/sys/db.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/ratatoeskr/sys/db.php b/ratatoeskr/sys/db.php
index a833cd6..17a8b8a 100644
--- a/ratatoeskr/sys/db.php
+++ b/ratatoeskr/sys/db.php
@@ -10,12 +10,13 @@
* See "ratatoeskr/licenses/ratatoeskr" for more information.
*/
-if(!defined("SETUP"))
+if (!defined("SETUP")) {
require_once(dirname(__FILE__) . "/../config.php");
+}
require_once(dirname(__FILE__) . "/utils.php");
-$db_con = Null;
+$db_con = null;
/*
* Function: db_connect
@@ -31,9 +32,10 @@ function db_connect()
"mysql:host=" . $config["mysql"]["server"] . ";dbname=" . $config["mysql"]["db"] . ";charset=utf8",
$config["mysql"]["user"],
$config["mysql"]["passwd"],
- array(
+ [
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
- ));
+ ]
+ );
$db_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
@@ -78,8 +80,9 @@ function prep_stmt($q)
function qdb()
{
$args = func_get_args();
- if(count($args) < 1)
+ if (count($args) < 1) {
throw new InvalidArgumentException("qdb needs at least 1 argument");
+ }
$stmt = prep_stmt($args[0]);
$stmt->execute(array_slice($args, 1));
@@ -104,8 +107,9 @@ class Transaction
{
global $db_con;
$this->startedhere = !($db_con->inTransaction());
- if($this->startedhere)
+ if ($this->startedhere) {
$db_con->beginTransaction();
+ }
}
/*
@@ -117,8 +121,9 @@ class Transaction
{
global $db_con;
- if($this->startedhere)
+ if ($this->startedhere) {
$db_con->commit();
+ }
}
/*
@@ -130,7 +135,8 @@ class Transaction
{
global $db_con;
- if($this->startedhere)
+ if ($this->startedhere) {
$db_con->rollBack();
+ }
}
}