mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Fixed issues as db can't be closed now.
This commit is contained in:
parent
e9b6a49e5a
commit
f978e784d5
3 changed files with 1 additions and 9 deletions
|
@ -51,8 +51,7 @@ function get_db() {
|
|||
global $authdb, $db;
|
||||
|
||||
if (!isset($db)) {
|
||||
$db = new SQLite3($authdb, SQLITE3_OPEN_READWRITE);
|
||||
$db->exec('PRAGMA foreign_keys = 1');
|
||||
open_db();
|
||||
}
|
||||
|
||||
return $db;
|
||||
|
|
|
@ -17,7 +17,6 @@ function get_group_info($name) {
|
|||
$q->bindValue(1, $name);
|
||||
$result = $q->execute();
|
||||
$groupinfo = $result->fetchArray(SQLITE3_ASSOC);
|
||||
$db->close();
|
||||
|
||||
return $groupinfo;
|
||||
}
|
||||
|
@ -28,7 +27,6 @@ function get_group_name($id) {
|
|||
$q->bindValue(1, $id, SQLITE3_INTEGER);
|
||||
$r = $q->execute();
|
||||
$ret = $r->fetchArray(SQLITE3_NUM);
|
||||
$db->close();
|
||||
|
||||
return $ret[0];
|
||||
}
|
||||
|
@ -43,7 +41,6 @@ function add_group($name, $desc) {
|
|||
$q->bindValue(1, $name, SQLITE3_TEXT);
|
||||
$q->bindValue(2, $desc, SQLITE3_TEXT);
|
||||
$ret = $q->execute();
|
||||
$db->close();
|
||||
|
||||
writelog("Added group $name ($desc).");
|
||||
return $ret;
|
||||
|
@ -65,7 +62,6 @@ function update_group($id, $name, $desc) {
|
|||
$q->bindValue(3, $id, SQLITE3_INTEGER);
|
||||
writelog("Updating group $oldname to: $name ($desc) ");
|
||||
$ret = $q->execute();
|
||||
$db->close();
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
@ -83,7 +79,6 @@ function delete_group($id) {
|
|||
$q = $db->prepare('DELETE FROM groups WHERE id = ?');
|
||||
$q->bindValue(1, $id, SQLITE3_INTEGER);
|
||||
$ret = $q->execute();
|
||||
$db->close();
|
||||
|
||||
writelog("Deleted group " . $groupinfo['name'] . ".");
|
||||
return $ret;
|
||||
|
@ -166,7 +161,6 @@ function remove_group_member($id) {
|
|||
$q = $db->prepare('DELETE FROM groupmembers WHERE id=?');
|
||||
$q->bindValue(1, $id, SQLITE3_INTEGER);
|
||||
$ret = $q->execute();
|
||||
$db->close();
|
||||
|
||||
if($ret) {
|
||||
writelog("Removed user $user from group $group.");
|
||||
|
|
|
@ -110,7 +110,6 @@ function get_usernames_filtered($term, $num = 10) {
|
|||
while ($row = $r->fetchArray(SQLITE3_NUM)) {
|
||||
array_push($ret, $row[0]);
|
||||
}
|
||||
$db->close();
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue