mirror of
https://github.com/znc/znc.git
synced 2026-08-07 17:33:34 +02:00
webadmin: Add DCCBindHost
Before this commit, editing some user in webadmin cleared their DCCBindHost. That's definitely not what we want. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2226 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+21
-2
@@ -233,11 +233,16 @@ public:
|
|||||||
sArg = WebSock.GetParam("bindhost");
|
sArg = WebSock.GetParam("bindhost");
|
||||||
// To change BindHosts be admin or don't have DenySetBindHost
|
// To change BindHosts be admin or don't have DenySetBindHost
|
||||||
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
|
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
|
||||||
|
CString sArg2 = WebSock.GetParam("dccbindhost");
|
||||||
if (!sArg.empty()) {
|
if (!sArg.empty()) {
|
||||||
pNewUser->SetBindHost(sArg);
|
pNewUser->SetBindHost(sArg);
|
||||||
}
|
}
|
||||||
|
if (!sArg2.empty()) {
|
||||||
|
pNewUser->SetDCCBindHost(sArg2);
|
||||||
|
}
|
||||||
} else if (pUser){
|
} else if (pUser){
|
||||||
pNewUser->SetBindHost(pUser->GetBindHost());
|
pNewUser->SetBindHost(pUser->GetBindHost());
|
||||||
|
pNewUser->SetDCCBindHost(pUser->GetDCCBindHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
// First apply the old limit in case the new one is too high
|
// First apply the old limit in case the new one is too high
|
||||||
@@ -681,19 +686,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To change BindHosts be admin or don't have DenySetBindHost
|
// To change BindHosts be admin or don't have DenySetBindHost
|
||||||
const VCString& vsBindHosts = CZNC::Get().GetBindHosts();
|
|
||||||
bool bFoundBindHost = false;
|
|
||||||
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
|
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
|
||||||
|
const VCString& vsBindHosts = CZNC::Get().GetBindHosts();
|
||||||
|
bool bFoundBindHost = false;
|
||||||
|
bool bFoundDCCBindHost = false;
|
||||||
for (unsigned int b = 0; b < vsBindHosts.size(); b++) {
|
for (unsigned int b = 0; b < vsBindHosts.size(); b++) {
|
||||||
const CString& sBindHost = vsBindHosts[b];
|
const CString& sBindHost = vsBindHosts[b];
|
||||||
CTemplate& l = Tmpl.AddRow("BindHostLoop");
|
CTemplate& l = Tmpl.AddRow("BindHostLoop");
|
||||||
|
CTemplate& k = Tmpl.AddRow("DCCBindHostLoop");
|
||||||
|
|
||||||
l["BindHost"] = sBindHost;
|
l["BindHost"] = sBindHost;
|
||||||
|
k["BindHost"] = sBindHost;
|
||||||
|
|
||||||
if (pUser && pUser->GetBindHost() == sBindHost) {
|
if (pUser && pUser->GetBindHost() == sBindHost) {
|
||||||
l["Checked"] = "true";
|
l["Checked"] = "true";
|
||||||
bFoundBindHost = true;
|
bFoundBindHost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pUser && pUser->GetDCCBindHost() == sBindHost) {
|
||||||
|
k["Checked"] = "true";
|
||||||
|
bFoundDCCBindHost = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our current bindhost is not in the global list...
|
// If our current bindhost is not in the global list...
|
||||||
@@ -703,6 +716,12 @@ public:
|
|||||||
l["BindHost"] = pUser->GetBindHost();
|
l["BindHost"] = pUser->GetBindHost();
|
||||||
l["Checked"] = "true";
|
l["Checked"] = "true";
|
||||||
}
|
}
|
||||||
|
if (pUser && !bFoundDCCBindHost && !pUser->GetDCCBindHost().empty()) {
|
||||||
|
CTemplate& l = Tmpl.AddRow("DCCBindHostLoop");
|
||||||
|
|
||||||
|
l["BindHost"] = pUser->GetDCCBindHost();
|
||||||
|
l["Checked"] = "true";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<CFile> vDirs;
|
vector<CFile> vDirs;
|
||||||
|
|||||||
@@ -82,6 +82,17 @@
|
|||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<? ENDIF ?>
|
<? ENDIF ?>
|
||||||
|
|
||||||
|
<? IF DCCBindHostLoop ?>
|
||||||
|
<div class="subsection">
|
||||||
|
<div class="inputlabel">DCCBindHost:</div>
|
||||||
|
<select name="dccbindhost">
|
||||||
|
<option value="">- Default -</option>
|
||||||
|
<? LOOP DCCBindHostLoop ?><option value="<? VAR BindHost ?>"<? IF Checked ?> selected="selected"<? ENDIF ?>><? VAR BindHost ?></option><? ENDLOOP ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<? ENDIF ?>
|
||||||
|
|
||||||
<div class="subsection">
|
<div class="subsection">
|
||||||
<div class="inputlabel">Quit Message:</div>
|
<div class="inputlabel">Quit Message:</div>
|
||||||
<div><input type="text" name="quitmsg" value="<? VAR QuitMsg ?>" class="full" maxlength="256" /></div>
|
<div><input type="text" name="quitmsg" value="<? VAR QuitMsg ?>" class="full" maxlength="256" /></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user