CString CTemplateLoopContext::GetValue(const CString& sName, bool bFromIf) { CTemplate* pTemplate = GetCurRow(); if (!pTemplate) { DEBUG("Loop [" + GetName() + "] has no row index [" + CString(GetRowIndex()) + "]"); return ""; } if (sName.Equals("__ID__")) { return CString(GetRowIndex() +1); } else if (sName.Equals("__COUNT__")) { return CString(GetRowCount()); } else if (sName.Equals("__ODD__")) { return ((GetRowIndex() %2) ? "" : "1"); } else if (sName.Equals("__EVEN__")) { return ((GetRowIndex() %2) ? "1" : ""); } else if (sName.Equals("__FIRST__")) { return ((GetRowIndex() == 0) ? "1" : ""); } else if (sName.Equals("__LAST__")) { return ((GetRowIndex() == m_pvRows->size() -1) ? "1" : ""); } else if (sName.Equals("__OUTER__")) { return ((GetRowIndex() == 0 || GetRowIndex() == m_pvRows->size() -1) ? "1" : ""); } else if (sName.Equals("__INNER__")) { return ((GetRowIndex() == 0 || GetRowIndex() == m_pvRows->size() -1) ? "" : "1"); } return pTemplate->GetValue(sName, bFromIf); }
// Deletes all models in the scene. void CSceneManager::DeleteAllModels() { for(TUInt32 templateID=0; templateID < m_TemplateList.size(); templateID++) { CTemplate* temp = m_TemplateList[templateID]; temp->DeleteAllModels(); } }
// Creates a new model template. The UID of the template is returned. TUInt32 CSceneManager::CreateTemplate(const char* meshFileName, bool tangents/*=false*/) { CTemplate* temp = new CTemplate( m_NumTemplates ); temp->Load( m_pRenderDevice->GetDevice(), m_pRender->GetTechnique(), meshFileName, tangents ); m_TemplateList.push_back( temp ); return m_NumTemplates++; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "index") { bool bSubmitted = (WebSock.GetParam("submitted").ToInt() != 0); if (bSubmitted) { CString FormUsername = WebSock.GetParam("user"); if (!FormUsername.empty()) SetUsername(FormUsername); CString FormPassword = WebSock.GetParam("password"); if (!FormPassword.empty()) SetPassword(FormPassword); SetUseCloakedHost(WebSock.GetParam("usecloakedhost").ToBool()); SetUseChallenge(WebSock.GetParam("usechallenge").ToBool()); SetRequestPerms(WebSock.GetParam("requestperms").ToBool()); SetJoinOnInvite(WebSock.GetParam("joinoninvite").ToBool()); } Tmpl["Username"] = m_sUsername; CTemplate& o1 = Tmpl.AddRow("OptionLoop"); o1["Name"] = "usecloakedhost"; o1["DisplayName"] = "UseCloakedHost"; o1["Tooltip"] = "Whether to cloak your hostname (+x) automatically on connect."; o1["Checked"] = CString(m_bUseCloakedHost); CTemplate& o2 = Tmpl.AddRow("OptionLoop"); o2["Name"] = "usechallenge"; o2["DisplayName"] = "UseChallenge"; o2["Tooltip"] = "Whether to use the CHALLENGEAUTH mechanism to avoid sending passwords in cleartext."; o2["Checked"] = CString(m_bUseChallenge); CTemplate& o3 = Tmpl.AddRow("OptionLoop"); o3["Name"] = "requestperms"; o3["DisplayName"] = "RequestPerms"; o3["Tooltip"] = "Whether to request voice/op from Q on join/devoice/deop."; o3["Checked"] = CString(m_bRequestPerms); CTemplate& o4 = Tmpl.AddRow("OptionLoop"); o4["Name"] = "joinoninvite"; o4["DisplayName"] = "JoinOnInvite"; o4["Tooltip"] = "Whether to join channels when Q invites you."; o4["Checked"] = CString(m_bJoinOnInvite); if (bSubmitted) { WebSock.GetSession()->AddSuccess("Changes have been saved!"); } return true; } return false; }
void CWebSession::FillMessageLoops(CTemplate& Tmpl) { for (const CString& sMessage : m_vsErrorMsgs) { CTemplate& Row = Tmpl.AddRow("ErrorLoop"); Row["Message"] = sMessage; } for (const CString& sMessage : m_vsSuccessMsgs) { CTemplate& Row = Tmpl.AddRow("SuccessLoop"); Row["Message"] = sMessage; } }
void CWebSession::FillMessageLoops(CTemplate& Tmpl) { for (unsigned int a = 0; a < m_vsErrorMsgs.size(); a++) { CTemplate& Row = Tmpl.AddRow("ErrorLoop"); Row["Message"] = m_vsErrorMsgs[a]; } for (unsigned int b = 0; b < m_vsSuccessMsgs.size(); b++) { CTemplate& Row = Tmpl.AddRow("SuccessLoop"); Row["Message"] = m_vsSuccessMsgs[b]; } }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName.empty() || sPageName == "index") { bool bSubmitted = (WebSock.GetParam("submitted").ToInt() != 0); const vector<CChan*>& Channels = m_pUser->GetChans(); for (unsigned int c = 0; c < Channels.size(); c++) { const CString sChan = Channels[c]->GetName(); bool bStick = FindNV(sChan) != EndNV(); if(bSubmitted) { bool bNewStick = WebSock.GetParam("stick_" + sChan).ToBool(); if(bNewStick && !bStick) SetNV(sChan, ""); // no password support for now unless chansaver is active too else if(!bNewStick && bStick) { MCString::iterator it = FindNV(sChan); if(it != EndNV()) DelNV(it); } bStick = bNewStick; } CTemplate& Row = Tmpl.AddRow("ChannelLoop"); Row["Name"] = sChan; Row["Sticky"] = CString(bStick); } if(bSubmitted) { WebSock.GetSession()->AddSuccess("Changes have been saved!"); } return true; } return false; }
// Basic Constructor. CSceneManager::CSceneManager() { m_pRender = NULL; m_pRenderDevice = new CRenderDevice(); m_NumTemplates = 0; m_NumModels = 0; m_ClearColour = CVector4( 0.0f, 0.0f, 0.0f, 0.0f ); // Insert Placeholders for the future implementation of the model + template creation. CTemplate* baseTemplate = new CTemplate( m_NumTemplates++ ); CModel* baseModel = new CModel( m_NumModels, baseTemplate->GetUID() ); m_TemplateList.push_back( baseTemplate ); m_ModelList.insert( pair< TUInt32, TUInt32 >( m_NumModels++, baseTemplate->GetUID() ) ); }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override { if (sPageName == "index") { if (CZNC::Get().GetManager().empty()) { return false; } std::priority_queue<CSocketSorter> socks = GetSockets(); while (!socks.empty()) { Csock* pSocket = socks.top().GetSock(); socks.pop(); CTemplate& Row = Tmpl.AddRow("SocketsLoop"); Row["Name"] = pSocket->GetSockName(); Row["Created"] = GetCreatedTime(pSocket); Row["State"] = GetSocketState(pSocket); Row["SSL"] = pSocket->GetSSL() ? "Yes" : "No"; Row["Local"] = GetLocalHost(pSocket, true); Row["Remote"] = GetRemoteHost(pSocket, true); Row["In"] = CString::ToByteStr(pSocket->GetBytesRead()); Row["Out"] = CString::ToByteStr(pSocket->GetBytesWritten()); } return true; } return false; }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override { if (sPageName == "index") { CModules& GModules = CZNC::Get().GetModules(); Tmpl["WebAdminLoaded"] = CString(GModules.FindModule("webadmin") != nullptr); MTimeMulti mmSorted; const MUsers& mUsers = CZNC::Get().GetUserMap(); for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) { mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second)); } for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) { CUser *pUser = it->second; CTemplate& Row = Tmpl.AddRow("UserLoop"); Row["Username"] = pUser->GetUserName(); Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser()); Row["LastSeen"] = FormatLastSeen(pUser, "never"); } return true; } return false; }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override { if (sPageName != "index") { // only accept requests to index return false; } if (WebSock.IsPost()) { SetNV("username", WebSock.GetParam("username")); CString sPassword = WebSock.GetParam("password"); if (!sPassword.empty()) { SetNV("password", sPassword); } SetNV(NV_REQUIRE_AUTH, WebSock.GetParam("require_auth")); SetNV(NV_MECHANISMS, WebSock.GetParam("mechanisms")); } Tmpl["Username"] = GetNV("username"); Tmpl["Password"] = GetNV("password"); Tmpl["RequireAuth"] = GetNV(NV_REQUIRE_AUTH); Tmpl["Mechanisms"] = GetMechanismsString(); for (const auto& it : SupportedMechanisms) { CTemplate& Row = Tmpl.AddRow("MechanismLoop"); CString sName(it.szName); Row["Name"] = sName; Row["Description"] = CString(it.szDescription); } return true; }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override { if (sPageName != "index") { // only accept requests to index return false; } if (WebSock.IsPost()) { VCString vsPerf; WebSock.GetRawParam("perform", true).Split("\n", vsPerf, false); m_vPerform.clear(); for (const CString& sPerf : vsPerf) m_vPerform.push_back(ParsePerform(sPerf)); Save(); } for (const CString& sPerf : m_vPerform) { CTemplate& Row = Tmpl.AddRow("PerformLoop"); Row["Perform"] = sPerf; } return true; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "index") { if (WebSock.IsPost()) { CUser *pUser = CZNC::Get().FindUser(WebSock.GetParam("user")); bool bOutgoing = WebSock.GetParam("direction") == "out"; const CString sLine = WebSock.GetParam("line"); if (!pUser) { Tmpl["user"] = WebSock.GetParam("user"); Tmpl[bOutgoing ? "direction_out" : "direction_in"] = "true"; Tmpl["line"] = sLine; WebSock.GetSession()->AddError("User not found"); return true; } if (bOutgoing) { pUser->PutIRC(sLine); } else { pUser->PutUser(sLine); } WebSock.GetSession()->AddSuccess("Line sent"); } const map<CString,CUser*>& msUsers = CZNC::Get().GetUserMap(); for (map<CString,CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) { CTemplate& l = Tmpl.AddRow("UserLoop"); l["Username"] = (*it->second).GetUserName(); } return true; } return false; }
vector<CTemplate*>* CTemplate::GetLoop(const CString& sName) { CTemplateLoopContext* pContext = GetCurLoopContext(); if (pContext) { CTemplate* pTemplate = pContext->GetCurRow(); if (pTemplate) { return pTemplate->GetLoop(sName); } } map<CString, vector<CTemplate*> >::iterator it = m_mvLoops.find(sName); if (it != m_mvLoops.end()) { return &(it->second); } return NULL; }
// Renders the scene. void CSceneManager::Render() { m_pRenderDevice->ClearScreen( m_ClearColour ); CVector3 camPos = m_pCamera->GetPosition(); m_pRender->RenderStart( &camPos );// place holder only. CTemplate* temp = 0; for(TUInt32 i = 0; i < m_TemplateList.size(); i++) { temp = m_TemplateList[i]; temp->Render( m_pRenderDevice->GetDevice() ); ID3D10ShaderResourceView* tex = temp->GetTexture(); for(TUInt32 model=0; model < temp->ModelCount(); model++) { CModel* current = temp->GetModelByIndex( model ); m_pRender->RenderModel( current->GetWorldMatrix(), tex ); m_pRenderDevice->DrawIndexed( temp->IndexCount() ); } } m_pRenderDevice->Present(); }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "index") { if (WebSock.IsPost()) { CUser *pUser = CZNC::Get().FindUser(WebSock.GetParam("user").Token(0, false, "/")); if (!pUser) { WebSock.GetSession()->AddError("User not found"); return true; } CIRCNetwork *pNetwork = pUser->FindNetwork(WebSock.GetParam("user").Token(1, false, "/")); if (!pNetwork) { WebSock.GetSession()->AddError("Network not found"); return true; } bool bToServer = WebSock.GetParam("send_to") == "server"; const CString sLine = WebSock.GetParam("line"); Tmpl["user"] = pUser->GetUserName(); Tmpl[bToServer ? "to_server" : "to_client"] = "true"; Tmpl["line"] = sLine; if (bToServer) { pNetwork->PutIRC(sLine); } else { pNetwork->PutUser(sLine); } WebSock.GetSession()->AddSuccess("Line sent"); } const map<CString,CUser*>& msUsers = CZNC::Get().GetUserMap(); for (map<CString,CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) { CTemplate& l = Tmpl.AddRow("UserLoop"); l["Username"] = (*it->second).GetUserName(); vector<CIRCNetwork*> vNetworks = (*it->second).GetNetworks(); for (vector<CIRCNetwork*>::const_iterator it2 = vNetworks.begin(); it2 != vNetworks.end(); ++it2) { CTemplate& NetworkLoop = l.AddRow("NetworkLoop"); NetworkLoop["Username"] = (*it->second).GetUserName(); NetworkLoop["Network"] = (*it2)->GetName(); } } return true; } return false; }
bool ChanPage(CWebSock& WebSock, CTemplate& Tmpl, CIRCNetwork* pNetwork, CChan* pChan = NULL) { CSmartPtr<CWebSession> spSession = WebSock.GetSession(); Tmpl.SetFile("add_edit_chan.tmpl"); CUser* pUser = pNetwork->GetUser(); if (!pUser) { WebSock.PrintErrorPage("That user doesn't exist"); return true; } if (!WebSock.GetParam("submitted").ToUInt()) { Tmpl["User"] = pUser->GetUserName(); Tmpl["Network"] = pNetwork->GetName(); if (pChan) { Tmpl["Action"] = "editchan"; Tmpl["Edit"] = "true"; Tmpl["Title"] = "Edit Channel" + CString(" [" + pChan->GetName() + "]"); Tmpl["ChanName"] = pChan->GetName(); Tmpl["BufferCount"] = CString(pChan->GetBufferCount()); Tmpl["DefModes"] = pChan->GetDefaultModes(); Tmpl["Key"] = pChan->GetKey(); if (pChan->InConfig()) { Tmpl["InConfig"] = "true"; } } else { Tmpl["Action"] = "addchan"; Tmpl["Title"] = "Add Channel" + CString(" for User [" + pUser->GetUserName() + "]"); Tmpl["BufferCount"] = CString(pUser->GetBufferCount()); Tmpl["DefModes"] = CString(pUser->GetDefaultChanModes()); Tmpl["InConfig"] = "true"; } // o1 used to be AutoCycle which was removed CTemplate& o2 = Tmpl.AddRow("OptionLoop"); o2["Name"] = "keepbuffer"; o2["DisplayName"] = "Keep Buffer"; if ((pChan && pChan->KeepBuffer()) || (!pChan && pUser->KeepBuffer())) { o2["Checked"] = "true"; } CTemplate& o3 = Tmpl.AddRow("OptionLoop"); o3["Name"] = "detached"; o3["DisplayName"] = "Detached"; if (pChan && pChan->IsDetached()) { o3["Checked"] = "true"; } FOR_EACH_MODULE(i, pUser) { CTemplate& mod = Tmpl.AddRow("EmbeddedModuleLoop"); mod.insert(Tmpl.begin(), Tmpl.end()); mod["WebadminAction"] = "display"; if ((*i)->OnEmbeddedWebRequest(WebSock, "webadmin/channel", mod)) { mod["Embed"] = WebSock.FindTmpl(*i, "WebadminChan.tmpl"); mod["ModName"] = (*i)->GetModName(); } }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "index") { CModules& GModules = CZNC::Get().GetModules(); Tmpl["WebAdminLoaded"] = CString(GModules.FindModule("webadmin") != NULL); MTimeMulti mmSorted; const MUsers& mUsers = CZNC::Get().GetUserMap(); for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) { mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second)); } for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) { CUser *pUser = it->second; CTemplate& Row = Tmpl.AddRow("UserLoop"); Row["Username"] = pUser->GetUserName(); Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser()); Row["LastSeen"] = FormatLastSeen(pUser, "never"); Row["Info"] = CString(pUser->GetClients().size()) + " client" + CString(pUser->GetClients().size() == 1 ? "" : "s"); if (!pUser->IsIRCConnected()) { Row["Info"] += ", not connected to IRC"; } else { unsigned int uChans = 0; const vector<CChan*>& vChans = pUser->GetChans(); for (unsigned int a = 0; a < vChans.size(); ++a) { if (vChans[a]->IsOn()) ++uChans; } unsigned int n = uChans; Row["Info"] += ", joined to " + CString(uChans); if(uChans != vChans.size()) { Row["Info"] += " out of " + CString(vChans.size()) + " configured"; n = vChans.size(); } Row["Info"] += " channel" + CString(n == 1 ? "" : "s"); } } return true; } return false; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "index") { for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { CTemplate& Row = Tmpl.AddRow("NotesLoop"); Row["Key"] = it->first; Row["Note"] = it->second; } return true; } else if (sPageName == "delnote") { DelNote(WebSock.GetParam("key", false)); WebSock.Redirect("/mods/notes/"); return true; } else if (sPageName == "addnote") { AddNote(WebSock.GetParam("key"), WebSock.GetParam("note")); WebSock.Redirect("/mods/notes/"); return true; } return false; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { CUser *pUser = WebSock.GetSession()->GetUser(); if (sPageName == "index") { MSCString::iterator it = m_PubKeys.find(pUser->GetUserName()); if (it != m_PubKeys.end()) { SCString::iterator it2; for (it2 = it->second.begin(); it2 != it->second.end(); ++it2) { CTemplate& row = Tmpl.AddRow("KeyLoop"); row["Key"] = *it2; } } return true; } else if (sPageName == "add") { AddKey(pUser, WebSock.GetParam("key")); WebSock.Redirect(GetWebPath()); return true; } else if (sPageName == "delete") { MSCString::iterator it = m_PubKeys.find(pUser->GetUserName()); if (it != m_PubKeys.end()) { if (it->second.erase(WebSock.GetParam("key", false))) { if (it->second.size() == 0) { m_PubKeys.erase(it); } Save(); } } WebSock.Redirect(GetWebPath()); return true; } return false; }
bool CLogMod::OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { CFile LogFile(m_sLogPath); CDir LogDir (LogFile.GetDir()); for(std::vector<CFile*>::iterator it = LogDir.begin(); it != LogDir.end(); ++it) { CTemplate& Row = Tmpl.AddRow("LogsLoop"); Row["File"] = (**it).GetShortName(); } if (WebSock.HasParam("file", false)) { CString path = CDir::CheckPathPrefix(GetSavePath(), LogFile.GetDir() + WebSock.GetParam("file", false)); if (path.empty()) { WebSock.PrintErrorPage("Invalid Path"); return true; } CFile DisplayFile(path); CString content; DisplayFile.Open(); int PageSize = 1024 * 1024; int Page = 0; if (WebSock.HasParam("page", false)) { Page = WebSock.GetParam("page", false).ToInt(); DisplayFile.Seek(Page * PageSize); } Tmpl["Prev"] = CString(Page - 1); Tmpl["Next"] = CString(Page + 1); Tmpl["Curr"] = WebSock.GetParam("file", false); DisplayFile.ReadFile(content, PageSize); DisplayFile.Close(); Tmpl["Log"] = content; } return true; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName != "index") { // only accept requests to /mods/perform/ return false; } if (WebSock.IsPost()) { VCString vsPerf; WebSock.GetRawParam("perform", true).Split("\n", vsPerf, false); m_vPerform.clear(); for (VCString::const_iterator it = vsPerf.begin(); it != vsPerf.end(); ++it) m_vPerform.push_back(ParsePerform(*it)); Save(); } for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); ++it) { CTemplate& Row = Tmpl.AddRow("PerformLoop"); Row["Perform"] = *it; } return true; }
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { CSmartPtr<CWebSession> spSession = WebSock.GetSession(); if (sPageName == "settings") { // Admin Check if (!spSession->IsAdmin()) { return false; } return SettingsPage(WebSock, Tmpl); } else if (sPageName == "adduser") { // Admin Check if (!spSession->IsAdmin()) { return false; } return UserPage(WebSock, Tmpl); } else if (sPageName == "editchan") { CUser* pUser = SafeGetUserFromParam(WebSock); // Admin||Self Check if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) { return false; } if (!pUser) { WebSock.PrintErrorPage("No such username"); return true; } CString sChan = WebSock.GetParam("name"); if(sChan.empty() && !WebSock.IsPost()) { sChan = WebSock.GetParam("name", false); } CChan* pChan = pUser->FindChan(sChan); if (!pChan) { WebSock.PrintErrorPage("No such channel"); return true; } return ChanPage(WebSock, Tmpl, pUser, pChan); } else if (sPageName == "addchan") { CUser* pUser = SafeGetUserFromParam(WebSock); // Admin||Self Check if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) { return false; } if (pUser) { return ChanPage(WebSock, Tmpl, pUser); } WebSock.PrintErrorPage("No such username"); return true; } else if (sPageName == "delchan") { CUser* pUser = CZNC::Get().FindUser(WebSock.GetParam("user", false)); // Admin||Self Check if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) { return false; } if (pUser) { return DelChan(WebSock, pUser); } WebSock.PrintErrorPage("No such username"); return true; } else if (sPageName == "deluser") { if (!spSession->IsAdmin()) { return false; } if (!WebSock.IsPost()) { // Show the "Are you sure?" page: CString sUser = WebSock.GetParam("user", false); CUser* pUser = CZNC::Get().FindUser(sUser); if (!pUser) { WebSock.PrintErrorPage("No such username"); return true; } Tmpl.SetFile("del_user.tmpl"); Tmpl["Username"] = sUser; return true; } // The "Are you sure?" page has been submitted with "Yes", // so we actually delete the user now: CString sUser = WebSock.GetParam("user"); CUser* pUser = CZNC::Get().FindUser(sUser); if (pUser && pUser == spSession->GetUser()) { WebSock.PrintErrorPage("Please don't delete yourself, suicide is not the answer!"); return true; } else if (CZNC::Get().DeleteUser(sUser)) { WebSock.Redirect("listusers"); return true; } WebSock.PrintErrorPage("No such username"); return true; } else if (sPageName == "edituser") { CString sUserName = SafeGetUserNameParam(WebSock); CUser* pUser = CZNC::Get().FindUser(sUserName); if(!pUser) { if(sUserName.empty()) { pUser = spSession->GetUser(); } // else: the "no such user" message will be printed. } // Admin||Self Check if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) { return false; } if (pUser) { return UserPage(WebSock, Tmpl, pUser); } WebSock.PrintErrorPage("No such username"); return true; } else if (sPageName == "listusers" && spSession->IsAdmin()) { return ListUsersPage(WebSock, Tmpl); } else if (sPageName == "traffic" && spSession->IsAdmin()) { return TrafficPage(WebSock, Tmpl); } else if (sPageName.empty() || sPageName == "index") { return true; } return false; }