From c1eba34009a78291b3a1ab5a3e1cefd73140224e Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Tue, 16 Aug 2016 23:57:24 +0200 Subject: [PATCH] php7 fixes (assign by ref) --- inside/ActionGroupRelationship.php | 2 +- inside/ActionGroupRelationships.php | 10 ++-------- inside/Actions.php | 10 ++-------- inside/DocumentCategories.php | 8 +------- inside/Group.php | 10 ++-------- inside/Groups.php | 8 +------- inside/JobCategories.php | 10 ++-------- inside/User.php | 8 +------- inside/UserGroupRelationship.php | 8 +------- inside/UserGroupRelationships.php | 10 ++-------- inside/file.php | 2 +- inside/membershipcard_db.php | 6 +++--- 12 files changed, 19 insertions(+), 73 deletions(-) diff --git a/inside/ActionGroupRelationship.php b/inside/ActionGroupRelationship.php index ac7e13f..d4d273f 100644 --- a/inside/ActionGroupRelationship.php +++ b/inside/ActionGroupRelationship.php @@ -17,7 +17,7 @@ class ActionGroupRelationship { $this->__construct($action_id, $group_id); } public function __construct($action_id = NULL, $group_id = NULL){ - $this->conn =& DB_connect(); + $this->conn = db_connect(); $this->action_id = $action_id; $this->group_id = $group_id; diff --git a/inside/ActionGroupRelationships.php b/inside/ActionGroupRelationships.php index db85f65..3a27d8c 100644 --- a/inside/ActionGroupRelationships.php +++ b/inside/ActionGroupRelationships.php @@ -9,13 +9,7 @@ class ActionGroupRelationships { } function __construct(){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("ActionGroupRelationships: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); } public function getJoinedList($group_id, $type = "array", $exclude = 1){ @@ -85,4 +79,4 @@ class ActionGroupRelationships { } } -?> \ No newline at end of file +?> diff --git a/inside/Actions.php b/inside/Actions.php index bb58652..6ababe3 100644 --- a/inside/Actions.php +++ b/inside/Actions.php @@ -9,13 +9,7 @@ class Actions { } function __construct(){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("Actions: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); $sql = "SELECT id, name FROM din_action @@ -53,4 +47,4 @@ class Actions { } } -?> \ No newline at end of file +?> diff --git a/inside/DocumentCategories.php b/inside/DocumentCategories.php index 1560163..8a21d85 100644 --- a/inside/DocumentCategories.php +++ b/inside/DocumentCategories.php @@ -9,13 +9,7 @@ class DocumentCategories { } function __construct(){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("DocumentCategories: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = $conn; $sql = "SELECT id, title FROM din_documentcategory ORDER BY title ASC"; $result = $this->conn->query($sql); diff --git a/inside/Group.php b/inside/Group.php index f5bfb77..3a3e426 100644 --- a/inside/Group.php +++ b/inside/Group.php @@ -20,13 +20,7 @@ class Group { } public function __construct($id = NULL, $data = NULL){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - print("error: ".$conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); $this->id = $id; @@ -184,4 +178,4 @@ class Group { } } -?> \ No newline at end of file +?> diff --git a/inside/Groups.php b/inside/Groups.php index 1d0e7b1..21be811 100644 --- a/inside/Groups.php +++ b/inside/Groups.php @@ -9,13 +9,7 @@ class Groups { } function __construct($restriction = NULL){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("Groups: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); if (!checkAuth("view-protected-users")){ $condition = "AND id != 1"; diff --git a/inside/JobCategories.php b/inside/JobCategories.php index d2752c0..c903530 100644 --- a/inside/JobCategories.php +++ b/inside/JobCategories.php @@ -9,13 +9,7 @@ class JobCategories { } function __construct(){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("JobCategories: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); $sql = "SELECT id, title FROM din_jobcategory"; $result = $this->conn->query($sql); @@ -44,4 +38,4 @@ class JobCategories { print(" "); } } -?> \ No newline at end of file +?> diff --git a/inside/User.php b/inside/User.php index 8547c93..c61e036 100644 --- a/inside/User.php +++ b/inside/User.php @@ -41,13 +41,7 @@ class User { } public function __construct($id, $data = NULL) { - $conn = & DB :: connect(getDSN()); - if (DB :: isError($conn)) { - print ("error: " . $conn->toString()); - exit (); - } else { - $this->conn = $conn; - } + $this->conn = db_connect(); $action = scriptParam("action"); $this->id = $id; diff --git a/inside/UserGroupRelationship.php b/inside/UserGroupRelationship.php index e2f1445..c8ecf97 100644 --- a/inside/UserGroupRelationship.php +++ b/inside/UserGroupRelationship.php @@ -20,13 +20,7 @@ class UserGroupRelationship { public function __construct($user_id = NULL, $group_id = NULL) { - $conn = & DB :: connect(getDSN()); - if (DB :: isError($conn)) { - print ("error: ".$conn->toString()); - exit (); - } else { - $this->conn = $conn; - } + $this->conn = db_connect(); $this->user_id = $user_id; $this->group_id = $group_id; diff --git a/inside/UserGroupRelationships.php b/inside/UserGroupRelationships.php index 018e3ea..f778224 100644 --- a/inside/UserGroupRelationships.php +++ b/inside/UserGroupRelationships.php @@ -9,13 +9,7 @@ class UserGroupRelationships { } function __construct(){ - $conn =& DB::connect(getDSN()); - if (DB::isError($conn)){ - error("UserGroupRelationships: " . $conn->toString()); - exit(); - }else { - $this->conn = $conn; - } + $this->conn = db_connect(); } public function getJoinedList($group_id, $type = "array"){ @@ -76,4 +70,4 @@ class UserGroupRelationships { } } -?> \ No newline at end of file +?> diff --git a/inside/file.php b/inside/file.php index ad1c192..fce7198 100644 --- a/inside/file.php +++ b/inside/file.php @@ -3,7 +3,7 @@ require_once "includes.php"; -$conn =& DB_connect(); +$conn = db_connect(); $id = $_GET['id']; diff --git a/inside/membershipcard_db.php b/inside/membershipcard_db.php index e56adc7..0fb1f35 100644 --- a/inside/membershipcard_db.php +++ b/inside/membershipcard_db.php @@ -3,10 +3,10 @@ header("Content-type: Text/plain"); require_once "includes.php"; -$conn = & DB :: connect(getDSN()); +$conn = db_connect(); if (DB :: isError($conn)) { print ("error: " . $conn->toString()); - exit (); + exit(); } $i = 0; @@ -98,4 +98,4 @@ if (DB :: isError($result) != true) { } } -print "\n\nInsert $i rows\nUpdated $u rows"; \ No newline at end of file +print "\n\nInsert $i rows\nUpdated $u rows";