diff --git a/collaboration/index.cpp b/collaboration/index.cpp index f273bbf21..4abd5d56f 100644 --- a/collaboration/index.cpp +++ b/collaboration/index.cpp @@ -32,10 +32,9 @@ #include #include #include -using namespace std; -string collaboration_index_url () +std::string collaboration_index_url () { return "collaboration/index"; } @@ -47,11 +46,11 @@ bool collaboration_index_acl (void * webserver_request) } -string collaboration_index (void * webserver_request) +std::string collaboration_index (void * webserver_request) { Webserver_Request * request = static_cast(webserver_request); - string page; + std::string page {}; Assets_Header header = Assets_Header (translate("Repository"), request); header.add_bread_crumb (menu_logic_settings_menu (), menu_logic_settings_text ()); page = header.run (); @@ -61,14 +60,14 @@ string collaboration_index (void * webserver_request) #ifdef HAVE_CLOUD - string object = request->query ["object"]; + std::string object = request->query ["object"]; if (request->query.count ("select")) { - string select = request->query["select"]; - if (select == "") { + const std::string& select = request->query["select"]; + if (select.empty()) { Dialog_List dialog_list = Dialog_List ("index", translate("Which Bible are you going to use?"), "", ""); dialog_list.add_query ("object", object); - vector bibles = request->database_bibles()->get_bibles(); - for (auto & value : bibles) { + const std::vector & bibles = request->database_bibles()->get_bibles(); + for (const auto& value : bibles) { dialog_list.add_row (value, "select", value); } page += dialog_list.run (); @@ -81,14 +80,14 @@ string collaboration_index (void * webserver_request) if (!object.empty ()) view.enable_zone ("objectactive"); - string repositoryfolder = filter_git_directory (object); + const std::string& repositoryfolder = filter_git_directory (object); if (request->query.count ("disable")) { Database_Config_Bible::setRemoteRepositoryUrl (object, ""); filter_url_rmdir (repositoryfolder); } - string url = Database_Config_Bible::getRemoteRepositoryUrl (object); + const std::string& url = Database_Config_Bible::getRemoteRepositoryUrl (object); view.set_variable ("url", url); if (url.empty ()) { view.enable_zone ("urlinactive"); @@ -104,7 +103,7 @@ string collaboration_index (void * webserver_request) // And the standard error output is needed in case of failures. // So the following is used instead. if (!object.empty ()) { - string statusoutput, statuserror; + std::string statusoutput, statuserror; filter_shell_run (repositoryfolder, "git", {"status"}, &statusoutput, &statuserror); view.set_variable ("status", statusoutput + " " + statuserror); }