addWarning(LAN_DEMO_FORBIDDEN); $ns->tablerender("Forbidden",$mes->render()); require_once("footer.php"); exit; } if (isset($_POST['update_admin'])) // Permissions updated { $prm->updatePerms($_POST['a_id'],$_POST['perms']); } if (isset($_POST['edit_admin']) || $action == "edit") { $edid = array_keys($_POST['edit_admin']); $theid = intval(($sub_action < 0) ? $edid[0] : $sub_action); if ((!$sql->select("user", "*", "user_id=".$theid)) || !($row = $sql->fetch())) { $mes->addDebug("Couldn't find user ID: {$theid}, {$sub_action}, {$edid[0]}"); // Debug code - shouldn't be executed } } if (isset($_POST['del_admin']) && count($_POST['del_admin'])) { $delid = array_keys($_POST['del_admin']); $aID = intval($delid[0]); $sql->select("user", "*", "user_id= ".$aID); $row = $sql->fetch(); if ($row['user_id'] == 1) { // Can't delete main admin $text = $row['user_name']." ".ADMSLAN_6."

".LAN_CONTINUE.""; $mes->addError($text); $ns->tablerender(LAN_ERROR, $mes->render()); require_once("footer.php"); exit; } $mes->addAuto($sql->update("user", "user_admin=0, user_perms='' WHERE user_id= ".$aID), 'update', ADMSLAN_61, LAN_DELETED_FAILED, false); $logMsg = str_replace(array('[x]', '[y]'),array($aID, $row['user_name']),ADMSLAN_73); e107::getLog()->add('ADMIN_02',$logMsg,E_LOG_INFORMATIVE,''); } if(isset($_POST['edit_admin']) || $action == "edit") { $prm->edit_administrator($row); } else { show_admins(); } function show_admins() { $sql = e107::getDb(); $frm = e107::getForm(); $ns = e107::getRender(); $mes = e107::getMessage(); $tp = e107::getParser(); $prm = e107::getUserPerms(); $sql->select("user", "*", "user_admin='1'"); $text = "
".ADMSLAN_13." "; while ($row = $sql->fetch()) { //$permtxt = ""; $text .= " "; } $text .= "
ID ".ADMSLAN_56." ".ADMSLAN_18." ".LAN_OPTIONS."
".$row['user_id']." $row['user_id'], 'name' => $row['user_name']))."'>".$row['user_name']." ".$prm->renderperms($row['user_perms'],$row['user_id'],"words")." "; if($row['user_id'] != "1" && intval($row['user_id']) !== USERID) { $text .= " ".$frm->submit_image("edit_admin[{$row['user_id']}]", 'edit', 'edit', LAN_EDIT)." ".$frm->submit_image("del_admin[{$row['user_id']}]", 'del', 'delete', ADMSLAN_59."? [".$row['user_name']."]")." "; } $text .= "
".$frm->hidden('del_administrator_confirm','1')."
"; $ns->tablerender(ADMSLAN_13, $mes->render().$text); } require_once("footer.php"); /** * Handle page DOM within the page header * * @return string JS source */ function headerjs() { return ''; /* require_once(e_HANDLER.'js_helper.php'); $ret = " "; return $ret;*/ } ?>