function authenticate() { global $MDL, $DIRS, $GV, $CURRENT_USER, $_SESSION; if ($MDL->IsModuleExists('users')) { $MDL->Load("users"); $USR = new CUsers($DIRS["users_data"], $DIRS["users_list"], $DIRS["users_private"], $DIRS["users_groups"], $DIRS["users_online"]); $USR->SetSeparators($GV["sep1"], $GV["sep2"]); } else { $USR = NULL; } if (check_auth() && $USR && !_isrootdef()) { $CURRENT_USER["login"] = $_SESSION["login"]; $CURRENT_USER["passwd"] = $_SESSION["passwd"]; $CURRENT_USER["id"] = $USR->GetUserId($_SESSION["login"]); $data = $USR->GetUserData($CURRENT_USER["id"]); $CURRENT_USER["nick"] = $data["nick"]; $CURRENT_USER["email"] = $data["email"]; $CURRENT_USER["url"] = $data["url"]; $CURRENT_USER["level"] = $USR->GetUserLevel($CURRENT_USER["id"]); if ($CURRENT_USER["level"] >= 8) { $_SESSION["rootacc"] = true; } else { $_SESSION["rootacc"] = false; } } elseif (_isrootdef()) { $CURRENT_USER["level"] = 10; $CURRENT_USER["nick"] = $GV["site_owner"]; $CURRENT_USER["id"] = "!ROOT!"; } else { $CURRENT_USER["level"] = 0; $CURRENT_USER["id"] = "!GUEST!"; } $CURRENT_USER["ip"] = get_ip_address(); $CURRENT_USER["browser"] = $_SERVER['HTTP_USER_AGENT']; if ($USR) { $MDL->Load("users"); $USR->UpdateOnline($CURRENT_USER); } }
//-------------------------// //-------------------------// //----------EDIT-----------// //-------------------------// case "edit": global $MDL; $news_info = $news->get_news_info($id); $fulltext = $news->get_news_text($id); $author = $news_info["name"]; if (!isset($editor)) { $editor = "html"; } if ($MDL->IsModuleExists("users")) { $MDL->Load("users"); $USR = new CUsers($DIRS["users_data"], $DIRS["users_list"], $DIRS["users_private"], $DIRS["users_groups"], $DIRS["users_online"]); $USR->SetSeparators($GV["sep1"], $GV["sep2"]); if ($USR->GetUserLevel($author) < $CURRENT_USER["level"] || $author == $CURRENT_USER["id"]) { $authorselect = "<select name=art style=\"width:100%\">"; $udata = $USR->GetUsers(); for ($j = 0; $j < count($udata); ++$j) { if ($udata[$j]["id"] == $author) { $sel = " selected"; } else { $sel = ""; } if ($USR->GetUserLevel($udata[$j]["id"]) < $CURRENT_USER["level"] || $udata[$j]["id"] == $CURRENT_USER["id"]) { $authorselect .= "<option value=\"" . $udata[$j]["id"] . "\"{$sel}>" . $udata[$j]["nick"] . "</option>"; } } $authorselect .= "</select>"; } else {
function is_group_allowed($group, $uid) { global $GV, $CURRENT_USER, $MDL, $DIRS; if (_isroot()) { return true; } $MDL->Load("users"); $USR = new CUsers($DIRS["users_data"], $DIRS["users_list"], $DIRS["users_private"], $DIRS["users_groups"], $DIRS["users_online"]); $USR->SetSeparators($GV["sep1"], $GV["sep2"]); $gdata = $USR->GetGroupData($group); return $CURRENT_USER["level"] >= $gdata["level"] || $CURRENT_USER["id"] == $uid; }