mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Show list of timezones in webadmin.
This commit is contained in:
@@ -75,6 +75,7 @@ public:
|
||||
|
||||
static CString CTime(time_t t, const CString& sTZ);
|
||||
static CString FormatTime(time_t t, const CString& sFormat, const CString& sTZ);
|
||||
static SCString GetTimezones();
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
@@ -213,11 +213,18 @@
|
||||
<div class="sectionbody">
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Timestamp Format:</div>
|
||||
<div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ?>" class="half" /></div>
|
||||
<div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ?>" class="full" /></div>
|
||||
</div>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Timezone:</div>
|
||||
<div><input type="text" name="timezone" value="<? VAR Timezone ?>" class="half" /></div>
|
||||
<div>
|
||||
<input type="text" name="timezone" value="<? VAR Timezone ?>" class="half" list="timezone_list" />
|
||||
<datalist id="timezone_list">
|
||||
<? LOOP TZLoop ?>
|
||||
<option value="<? VAR TZ ?>"/>
|
||||
<? ENDLOOP ?>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Join Tries:</div>
|
||||
|
||||
@@ -945,6 +945,12 @@ public:
|
||||
Tmpl["StatusPrefix"] = "*";
|
||||
}
|
||||
|
||||
SCString ssTimezones = CUtils::GetTimezones();
|
||||
for (SCString::iterator i = ssTimezones.begin(); i != ssTimezones.end(); ++i) {
|
||||
CTemplate& l = Tmpl.AddRow("TZLoop");
|
||||
l["TZ"] = *i;
|
||||
}
|
||||
|
||||
// To change BindHosts be admin or don't have DenySetBindHost
|
||||
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
|
||||
const VCString& vsBindHosts = CZNC::Get().GetBindHosts();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <znc/MD5.h>
|
||||
#include <znc/main.h>
|
||||
#include <znc/ZNCDebug.h>
|
||||
#include <znc/FileUtils.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_LIBSSL
|
||||
#include <openssl/ssl.h>
|
||||
@@ -397,6 +398,35 @@ CString CUtils::FormatTime(time_t t, const CString& sFormat, const CString& sTZ)
|
||||
return s;
|
||||
}
|
||||
|
||||
namespace {
|
||||
void FillTimezones(const CString& sPath, SCString& result, const CString& sPrefix) {
|
||||
CDir Dir;
|
||||
Dir.Fill(sPath);
|
||||
for (unsigned int a = 0; a < Dir.size(); ++a) {
|
||||
CFile& File = *Dir[a];
|
||||
CString sName = File.GetShortName();
|
||||
CString sFile = File.GetLongName();
|
||||
if (sName == "posix" || sName == "right") continue; // these 2 dirs contain the same filenames
|
||||
if (sName.Right(4) == ".tab" || sName == "posixrules" || sName == "localtime") continue;
|
||||
if (File.IsDir()) {
|
||||
if (sName == "Etc") {
|
||||
FillTimezones(sFile, result, sPrefix);
|
||||
} else {
|
||||
FillTimezones(sFile, result, sPrefix + sName + "/");
|
||||
}
|
||||
} else {
|
||||
result.insert(sPrefix + sName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCString CUtils::GetTimezones() {
|
||||
SCString result;
|
||||
FillTimezones("/usr/share/zoneinfo", result, "");
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CTable::AddColumn(const CString& sName) {
|
||||
for (unsigned int a = 0; a < m_vsHeaders.size(); a++) {
|
||||
if (m_vsHeaders[a].Equals(sName)) {
|
||||
|
||||
Reference in New Issue
Block a user