X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fpeertrustpage.cpp;h=92f804cdec64667fb9708bb10e602c794633d0b6;hb=dec33c63afafabf83c3039e916725cac6faef9b3;hp=dc689bf460e6a73d945b255a960ceb1e26e524c9;hpb=bae54a5dae027ad0a6b0126ec9eeecd3bd2739eb;p=fms.git diff --git a/src/http/pages/peertrustpage.cpp b/src/http/pages/peertrustpage.cpp index dc689bf..92f804c 100644 --- a/src/http/pages/peertrustpage.cpp +++ b/src/http/pages/peertrustpage.cpp @@ -119,16 +119,33 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s { localidentityidstr=(*queryvars.find("localidentityid")).second; StringFunctions::Convert(localidentityidstr,localidentityid); + // insert the ID into the temporary table so we remember the identity if we load the page later + m_db->Execute("DELETE FROM tmpLocalIdentityPeerTrustPage;"); + SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tmpLocalIdentityPeerTrustPage(LocalIdentityID) VALUES(?);"); + st.Bind(0,localidentityid); + st.Step(); } else { - SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity;"); + // try to get the localidentityid if it exists in the temp table, otherwise load the first identity in the database + SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tmpLocalIdentityPeerTrustPage;"); st.Step(); if(st.RowReturned()) { st.ResultInt(0,localidentityid); StringFunctions::Convert(localidentityid,localidentityidstr); } + else + { + st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity;"); + st.Step(); + if(st.RowReturned()) + { + st.ResultInt(0,localidentityid); + StringFunctions::Convert(localidentityid,localidentityidstr); + } + st.Finalize(); + } } if(localidentityid!=-1 && queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="update") @@ -239,8 +256,9 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s } content+="