BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Coding and development discussion => Topic started by: Wanuarmi on January 24, 2006, 08:43:40 pm

Title: new Admin.php function
Post by: Wanuarmi on January 24, 2006, 08:43:40 pm
Id like to suggest this function added to Admin.php

Code: [Select]
function upto_group($name, $group)
{
$name = ucfirst(strtolower($name));
$group = strtolower($group);
$in_group = 0;
$result = $this -> bot -> db -> select("SELECT * FROM admin_members WHERE name = $name");
foreach($result AS $entry) // same user can be in multiple groups
{
if (empty($in_group) || $in_group > $entry[1])
$in_group = $entry[1];
}
$result = $this -> bot -> db -> select("SELECT * FROM admin_groups WHERE name = $group");
if (empty($result))
return false;
if (!empty($in_group) && $in_group <= $result[0][0])
return true;
return false;
}

so you dont have to check multiple groups for commands, and so admins have all permissions raidleaders have. this would only work if the groups hierarchy was kept in the id column though...
SimplePortal 2.3.7 © 2008-2024, SimplePortal