mirror of
https://github.com/znc/znc.git
synced 2026-08-10 10:52:59 +02:00
Fix #624: Can´t rename network via webinterface
This commit is contained in:
@@ -10,19 +10,17 @@
|
||||
<div class="section">
|
||||
<input type="hidden" name="submitted" value="1" />
|
||||
<input type="hidden" name="user" value="<? VAR Username ?>" />
|
||||
<? IF Edit ?><input type="hidden" name="network" value="<? VAR Name ?>" /><? ENDIF ?>
|
||||
<input type="hidden" name="network" value="<? VAR Name ?>" />
|
||||
|
||||
<h3>Network Info</h3>
|
||||
<span class="info">Nick, AltNick, Ident, RealName, BindHost can be left empty to use the value from the user.</span>
|
||||
<div class="sectionbg">
|
||||
<div class="sectionbody">
|
||||
<? IF !Edit ?>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Network Name:</div>
|
||||
<input type="text" name="network" value="<? VAR Name ?>" class="half" maxlength="128"
|
||||
<input type="text" name="name" value="<? VAR Name ?>" class="half" maxlength="128"
|
||||
title="The name of the IRC network." />
|
||||
</div>
|
||||
<? ENDIF ?>
|
||||
</div>
|
||||
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Nickname:</div>
|
||||
|
||||
+15
-11
@@ -867,27 +867,31 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
CString sName = WebSock.GetParam("network").Trim_n();
|
||||
CString sName = WebSock.GetParam("name").Trim_n();
|
||||
if (sName.empty()) {
|
||||
WebSock.PrintErrorPage("Network name is a required argument");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pNetwork) {
|
||||
if (!spSession->IsAdmin() && !pUser->HasSpaceForNewNetwork()) {
|
||||
WebSock.PrintErrorPage("Network number limit reached. Ask an admin to increase the limit for you, or delete few old ones from Your Settings");
|
||||
return true;
|
||||
}
|
||||
if (!CIRCNetwork::IsValidNetwork(sName)) {
|
||||
WebSock.PrintErrorPage("Network name should be alphanumeric");
|
||||
return true;
|
||||
}
|
||||
if (!pNetwork && !spSession->IsAdmin() && !pUser->HasSpaceForNewNetwork()) {
|
||||
WebSock.PrintErrorPage("Network number limit reached. Ask an admin to increase the limit for you, or delete few old ones from Your Settings");
|
||||
return true;
|
||||
}
|
||||
if (!pNetwork || pNetwork->GetName() != sName) {
|
||||
CString sNetworkAddError;
|
||||
CIRCNetwork* pOldNetwork = pNetwork;
|
||||
pNetwork = pUser->AddNetwork(sName, sNetworkAddError);
|
||||
if (!pNetwork) {
|
||||
WebSock.PrintErrorPage(sNetworkAddError);
|
||||
return true;
|
||||
}
|
||||
if (pOldNetwork) {
|
||||
for (CModule* pModule : pOldNetwork->GetModules()) {
|
||||
CString sPath = pUser->GetUserPath() + "/networks/" + sName + "/moddata/" + pModule->GetModName();
|
||||
pModule->MoveRegistry(sPath);
|
||||
}
|
||||
pNetwork->Clone(*pOldNetwork, false);
|
||||
pUser->DeleteNetwork(pOldNetwork->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
CString sArg;
|
||||
|
||||
Reference in New Issue
Block a user