| 105 | } |
| 106 | |
| 107 | void 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 | |
| 159 | void WebAdmin::fillPageList(std::vector<std::string> &pages) { |
| 160 | std::vector<std::string> templateDirs = templateSystem.getSearchPaths(); |
no test coverage detected