db_Select("user", "*", "user_id='".$_POST['a_id']."' ");
$row = $sql->db_Fetch();
$a_name = $row['user_name'];
$perm = "";
foreach($_POST['perms'] as $value)
{
if ($value == "0")
{
if (!getperms('0')) { $value = ""; break; }
$perm = "0."; break;
}
if ($value)
{
$perm .= $value.".";
}
}
admin_update($sql -> db_Update("user", "user_perms='$perm' WHERE user_name='$a_name' "), 'update', ADMSLAN_56." ".$_POST['ad_name']." ".ADMSLAN_2."
");
unset($ad_name, $a_perms);
}
if ($_POST['edit_admin'] || $action == "edit")
{
$edid = array_keys($_POST['edit_admin']);
$theid = ($edid[0]) ? $edid[0] : $sub_action;
$sql->db_Select("user", "*", "user_id=".$theid);
$row = $sql->db_Fetch();
if ($a_perms == "0")
{
$text = "
".$row['user_name']." ".ADMSLAN_6."
".ADMSLAN_4."";
$ns->tablerender(ADMSLAN_5, $text);
require_once("footer.php");
exit;
}
admin_update($sql -> db_Update("user", "user_admin=0, user_perms='' WHERE user_id= ".$delid[0]), 'update', ADMSLAN_61, LAN_DELETED_FAILED);
}
if($_POST['edit_admin'] || $action == "edit"){
edit_administrator($row);
}else{
show_admins();
}
function show_admins(){
global $sql,$tp,$ns,$pref;
$sql->db_Select("user", "*", "user_admin='1'");
$text = "
";
$ns->tablerender(ADMSLAN_13, $text);
}
function edit_administrator($row){
global $sql,$tp,$ns,$pref;
$lanlist = explode(",",e_LANLIST);
$a_id = $row['user_id'];
$ad_name = $row['user_name'];
$a_perms = $row['user_perms'];
$text = "
";
$text .= "
";
$ns->tablerender(ADMSLAN_52, $text);
}
require_once("footer.php");
function checkb($arg, $perms)
{
if (getperms($arg, $perms))
{
$par = "
\n";
}
else
{
$par = "
\n";
}
return $par;
}
function renderperms($perm,$id){
global $pref,$sql,$pt;
if($perm == "0"){
return ADMSLAN_58;
}
$sql2 = new db;
$lanlist = explode(",",e_LANLIST);
if(!$pt){
$pt["1"] = ADMSLAN_19;
$pt["2"] = ADMSLAN_20;
$pt["3"] = ADMSLAN_21;
$pt["4"] = ADMSLAN_22; // Moderate users/bans etc
$pt["5"] = ADMSLAN_23; // create/edit custom pages/menus
$pt["Q"] = ADMSLAN_24; // Manage download categories
$pt["6"] = ADMSLAN_25; // Upload /manage files
$pt["Y"] = ADMSLAN_67; // file inspector
$pt["O"] = ADMSLAN_68; // notify
$pt["7"] = ADMSLAN_26;
$pt["8"] = ADMSLAN_27;
$pt["C"] = ADMSLAN_64;
$pt["9"] = ADMSLAN_28;
$pt["W"] = ADMSLAN_65;
$pt["D"] = ADMSLAN_29;
$pt["E"] = ADMSLAN_30;
$pt["F"] = ADMSLAN_31;
$pt["G"] = ADMSLAN_32;
$pt["S"] = ADMSLAN_33;
$pt["T"] = ADMSLAN_34;
$pt["V"] = ADMSLAN_35;
$pt["X"] = ADMSLAN_66;
$pt["A"] = ADMSLAN_36; // Configure Image Settings
$pt["B"] = ADMSLAN_37;
$pt["H"] = ADMSLAN_39;
$pt["I"] = ADMSLAN_40;
$pt["L"] = ADMSLAN_43;
$pt["R"] = ADMSLAN_44;
$pt["U"] = ADMSLAN_45;
$pt["M"] = ADMSLAN_46;
$pt["N"] = ADMSLAN_47;
$pt["Z"] = ADMSLAN_62;
// foreach($lanlist as $lan){
// $pt[$lan] = $lan;
// }
$sql2->db_Select("plugin", "*", "plugin_installflag='1'");
while ($row2 = $sql2->db_Fetch()){
$pt[("P".$row2['plugin_id'])] = LAN_PLUGIN." - ".$row2['plugin_name'];
}
}
$tmp = explode(".", $perm);
$langperm = "";
foreach($tmp as $pms){
if(in_array($pms, $lanlist)){
$langperm .= $pms." ";
}else{
$permtxt[] = $pms;
if($pt[$pms]){
$ptext[] = $pt[$pms];
}
}
}
$ret = implode(" ",$permtxt);
if($pref['multilanguage']){
$ret .= ", ". $langperm;
}
$text = "
$ret
".implode("
",$ptext)."
";
return $text;
}
?>