Moved a few functions to misc, moved where permissions is included as it's needed everywhere.

This commit is contained in:
Richard Underwood 2017-01-06 14:05:12 +00:00
parent 6033bc12aa
commit a57af479b8
4 changed files with 46 additions and 45 deletions

View file

@ -475,7 +475,53 @@ if (!function_exists('hash_pbkdf2')) {
}
}
// get user id from name
function get_user_id($user) {
$info=get_user_info($user);
if($info) {
return $info['id'];
} else {
return null;
}
}
// get zone id from name
function get_zone_id($zone) {
$db = get_db();
$q = $db->prepare('SELECT id FROM zones WHERE zone=?');
$q->bindValue(1, $zone, SQLITE3_TEXT);
$r = $q->execute();
$ret = $r->fetchArray(SQLITE3_NUM);
if($ret) {
return $ret[0];
} else {
return null;
}
}
// get user name from id
function get_user_name($userid) {
$db = get_db();
$q = $db->prepare('SELECT emailAddress FROM users WHERE id = ?');
$q->bindValue(1, $userid, SQLITE3_INTEGER);
$r = $q->execute();
$ret = $r->fetchArray(SQLITE3_NUM);
if($ret) {
return $ret[0];
} else {
return null;
}
}
// Include functions for group management
include_once('groups.inc.php');
// Include functions for permissions management
include_once('permissions.inc.php');
?>