IniValue * IniParser::getValue (const char *section, const char *valueName) { IniSection *sect = getSection (section, verboseEntry); if (!sect) { return NULL; } return sect->getValue (valueName, verboseEntry); }
void suPHP::Configuration::readFromFile(File& file) throw (IOException, ParsingException) { IniFile ini; ini.parse(file); if (ini.hasSection("global")) { const IniSection& sect = ini.getSection("global"); const std::vector<std::string> keys = sect.getKeys(); std::vector<std::string>::const_iterator i; for (i = keys.begin(); i < keys.end(); i++) { std::string key = *i; std::string value = sect.getValue(key); if (key == "logfile") this->logfile = value; else if (key == "webserver_user") this->webserver_user = value; else if (key == "docroot") { this->docroots = sect.getValues(key); } else if (key == "allow_file_group_writeable") this->allow_file_group_writeable = this->strToBool(value); else if (key == "allow_directory_group_writeable") this->allow_directory_group_writeable = this->strToBool(value); else if (key == "allow_file_others_writeable") this->allow_file_others_writeable = this->strToBool(value); else if (key == "allow_directory_others_writeable") this->allow_directory_others_writeable = this->strToBool(value); else if (key == "check_vhost_docroot") this->check_vhost_docroot = this->strToBool(value); else if (key == "errors_to_browser") this->errors_to_browser = this->strToBool(value); else if (key == "env_path") this->env_path = value; else if (key == "loglevel") this->loglevel = this->strToLogLevel(value); else if (key == "min_uid") this->min_uid = Util::strToInt(value); else if (key == "min_gid") this->min_gid = Util::strToInt(value); else if (key == "umask") this->umask = Util::octalStrToInt(value); else if (key == "chroot") this->chroot_path = value; else throw ParsingException("Unknown option \"" + key + "\" in section [global]", __FILE__, __LINE__); } } // Get handlers / interpreters if (ini.hasSection("handlers")) { IniSection sect = ini.getSection("handlers"); const std::vector<std::string> keys = sect.getKeys(); std::vector<std::string>::const_iterator i; for (i = keys.begin(); i < keys.end(); i++) { std::string key = *i; std::string value = sect.getValue(key); std::pair<std::string, std::string> p; p.first = key; p.second = value; this->handlers.insert(p); } } }