mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-20 20:13:40 +03:00
Moved a few functions to misc, moved where permissions is included as it's needed everywhere.
This commit is contained in:
parent
6033bc12aa
commit
a57af479b8
4 changed files with 46 additions and 45 deletions
|
@ -111,16 +111,6 @@ function get_group_members($id) {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move to misc?
|
|
||||||
function get_user_id($user) {
|
|
||||||
$info=get_user_info($user);
|
|
||||||
if($info) {
|
|
||||||
return $info['id'];
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_group_id($group) {
|
function get_group_id($group) {
|
||||||
$info=get_group_info($group);
|
$info=get_group_info($group);
|
||||||
if($info) {
|
if($info) {
|
||||||
|
|
|
@ -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 functions for group management
|
||||||
include_once('groups.inc.php');
|
include_once('groups.inc.php');
|
||||||
|
// Include functions for permissions management
|
||||||
|
include_once('permissions.inc.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -31,40 +31,6 @@ define('PERM_UPDATE',0x02);
|
||||||
define('PERM_UPDATESPECIAL',0x04);
|
define('PERM_UPDATESPECIAL',0x04);
|
||||||
define('PERM_ADMIN',0x08);
|
define('PERM_ADMIN',0x08);
|
||||||
|
|
||||||
|
|
||||||
// move to misc?
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// move to misc?
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interface function - Return an array of permissions for the zone
|
// Interface function - Return an array of permissions for the zone
|
||||||
function get_zone_permissions($zone) {
|
function get_zone_permissions($zone) {
|
||||||
$db = get_db();
|
$db = get_db();
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
include_once('includes/config.inc.php');
|
include_once('includes/config.inc.php');
|
||||||
include_once('includes/session.inc.php');
|
include_once('includes/session.inc.php');
|
||||||
include_once('includes/misc.inc.php');
|
include_once('includes/misc.inc.php');
|
||||||
include_once('includes/permissions.inc.php');
|
|
||||||
|
|
||||||
if (!is_csrf_safe()) {
|
if (!is_csrf_safe()) {
|
||||||
header('Status: 403');
|
header('Status: 403');
|
||||||
|
|
Loading…
Add table
Reference in a new issue