MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / init

Method init

plugins/webadmin/webadmin.cpp:107–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void WebAdmin::init(const char* cmdln) {
108 actions.clear();
109
110 if (cmdln && strlen(cmdln)) {
111 templateSystem.addSearchPath(cmdln);
112 serviceMimeResources = true;
113 resourceRootPath = cmdln;
114 }
115 else if (binRoot.size()) {
116 // ok make a heroic effort to find the 404 item, cus if we can find that we got us a template dir
117 std::string searchpath = concatPaths(binRoot, "templates/");
118 if (!fileExists(searchpath + "404.tmpl")) {
119 searchpath = concatPaths(binRoot, "webadmin/templates/");
120 if (!fileExists(searchpath + "404.tmpl")) {
121 searchpath = concatPaths(binRoot, "plugins/webadmin/templates/");
122 if (!fileExists(searchpath + "404.tmpl")) {
123 searchpath = "";
124 }
125 }
126 }
127
128 if (searchpath.size()) {
129 bz_debugMessagef(1, "webadmin: using template path %s", searchpath.c_str());
130
131 templateSystem.addSearchPath(searchpath.c_str());
132 serviceMimeResources = true;
133 resourceRootPath = searchpath;
134 }
135 }
136 else {
137 bz_debugMessage(0, "No paths found, unable to run, BLAAAAGGGGG!");
138 }
139
140 initLoops(templateSystem);
141 initCommonItems(templateSystem);
142
143 addAction(new UpdateBZDBVars());
144 addAction(new SendChatMessage());
145 addAction(new SaveLogFile());
146 addAction(new ClearLogFile());
147 addAction(new AddBan());
148 addAction(new RemoveBan());
149 addAction(new RemoveReport());
150 addAction(new AddReport());
151
152 buildAuthPermsFromPages();
153
154 templateSystem.setPluginName("webadmin", getBaseURL().c_str());
155
156 setupAuth();
157}
158
159void WebAdmin::fillPageList(std::vector<std::string> &pages) {
160 std::vector<std::string> templateDirs = templateSystem.getSearchPaths();

Callers 1

bz_LoadFunction · 0.45

Calls 11

bz_debugMessagefFunction · 0.85
bz_debugMessageFunction · 0.85
initLoopsFunction · 0.85
initCommonItemsFunction · 0.85
addSearchPathMethod · 0.80
c_strMethod · 0.80
setPluginNameMethod · 0.80
concatPathsFunction · 0.50
fileExistsFunction · 0.50
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected