mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-16 08:34:12 +02:00
2020-10-15 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDFormPost' to use 'QMap' instead of 'std::map'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
4bc6a54052
commit
d61f3ad32a
@ -20468,3 +20468,5 @@
|
|||||||
* Added a 'RDApplication::logAuthenticationFailure()' method.
|
* Added a 'RDApplication::logAuthenticationFailure()' method.
|
||||||
* Added a sample Fail2Ban jail filter for the WebAPI in
|
* Added a sample Fail2Ban jail filter for the WebAPI in
|
||||||
'conf/rivendell-webapi.conf'.
|
'conf/rivendell-webapi.conf'.
|
||||||
|
2020-10-15 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Modified 'RDFormPost' to use 'QMap' instead of 'std::map'.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Handle data from an HTML form.
|
// Handle data from an HTML form.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2009 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2009-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -123,10 +123,10 @@ RDFormPost::RDFormPost(RDFormPost::Encoding encoding,unsigned maxsize,
|
|||||||
RDFormPost::~RDFormPost()
|
RDFormPost::~RDFormPost()
|
||||||
{
|
{
|
||||||
if(post_auto_delete) {
|
if(post_auto_delete) {
|
||||||
for(std::map<QString,bool>::const_iterator ci=post_filenames.begin();
|
for(QMap<QString,bool>::const_iterator ci=post_filenames.begin();
|
||||||
ci!=post_filenames.end();ci++) {
|
ci!=post_filenames.end();ci++) {
|
||||||
if(ci->second) {
|
if(ci.value()) {
|
||||||
unlink(post_values.at(ci->first).toString());
|
unlink(post_values.value(ci.key()).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(post_tempdir!=NULL) {
|
if(post_tempdir!=NULL) {
|
||||||
@ -154,9 +154,9 @@ QHostAddress RDFormPost::clientAddress() const
|
|||||||
QStringList RDFormPost::names() const
|
QStringList RDFormPost::names() const
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
for(std::map<QString,QVariant>::const_iterator ci=post_values.begin();
|
for(QMap<QString,QVariant>::const_iterator ci=post_values.begin();
|
||||||
ci!=post_values.end();ci++) {
|
ci!=post_values.end();ci++) {
|
||||||
list.push_back(ci->first);
|
list.push_back(ci.key());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ QVariant RDFormPost::value(const QString &name,bool *ok)
|
|||||||
{
|
{
|
||||||
QVariant v;
|
QVariant v;
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
v=post_values.at(name);
|
v=post_values.value(name);
|
||||||
}
|
}
|
||||||
if(ok!=NULL) {
|
if(ok!=NULL) {
|
||||||
*ok=(post_values.count(name)>0);
|
*ok=(post_values.count(name)>0);
|
||||||
@ -193,7 +193,7 @@ bool RDFormPost::getValue(const QString &name,QHostAddress *addr,bool *ok)
|
|||||||
bool RDFormPost::getValue(const QString &name,QString *str,bool *ok)
|
bool RDFormPost::getValue(const QString &name,QString *str,bool *ok)
|
||||||
{
|
{
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
*str=post_values.at(name).toString();
|
*str=post_values.value(name).toString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -203,7 +203,7 @@ bool RDFormPost::getValue(const QString &name,QString *str,bool *ok)
|
|||||||
bool RDFormPost::getValue(const QString &name,int *n,bool *ok)
|
bool RDFormPost::getValue(const QString &name,int *n,bool *ok)
|
||||||
{
|
{
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
*n=post_values.at(name).toInt(ok);
|
*n=post_values.value(name).toInt(ok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -213,7 +213,7 @@ bool RDFormPost::getValue(const QString &name,int *n,bool *ok)
|
|||||||
bool RDFormPost::getValue(const QString &name,long *n,bool *ok)
|
bool RDFormPost::getValue(const QString &name,long *n,bool *ok)
|
||||||
{
|
{
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
*n=post_values.at(name).toLongLong(ok);
|
*n=post_values.value(name).toLongLong(ok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*n=0;
|
*n=0;
|
||||||
@ -224,7 +224,7 @@ bool RDFormPost::getValue(const QString &name,long *n,bool *ok)
|
|||||||
bool RDFormPost::getValue(const QString &name,unsigned *n,bool *ok)
|
bool RDFormPost::getValue(const QString &name,unsigned *n,bool *ok)
|
||||||
{
|
{
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
*n=post_values.at(name).toUInt(ok);
|
*n=post_values.value(name).toUInt(ok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -303,7 +303,7 @@ bool RDFormPost::getValue(const QString &name,QTime *time,bool *ok)
|
|||||||
bool RDFormPost::getValue(const QString &name,bool *state,bool *ok)
|
bool RDFormPost::getValue(const QString &name,bool *state,bool *ok)
|
||||||
{
|
{
|
||||||
if(post_values.count(name)>0) {
|
if(post_values.count(name)>0) {
|
||||||
*state=post_values.at(name).toInt(ok);
|
*state=post_values.value(name).toInt(ok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -349,13 +349,13 @@ void RDFormPost::dump()
|
|||||||
printf("<th align=\"center\">FILE</th>\n");
|
printf("<th align=\"center\">FILE</th>\n");
|
||||||
printf("</tr>\n");
|
printf("</tr>\n");
|
||||||
|
|
||||||
for(std::map<QString,QVariant>::const_iterator ci=post_values.begin();
|
for(QMap<QString,QVariant>::const_iterator ci=post_values.begin();
|
||||||
ci!=post_values.end();ci++) {
|
ci!=post_values.end();ci++) {
|
||||||
printf("<tr>\n");
|
printf("<tr>\n");
|
||||||
printf("<td align=\"left\">|%s|</td>\n",(const char *)ci->first.utf8());
|
printf("<td align=\"left\">|%s|</td>\n",ci.key().toUtf8().constData());
|
||||||
printf("<td align=\"left\">|%s|</td>\n",
|
printf("<td align=\"left\">|%s|</td>\n",
|
||||||
(const char *)ci->second.toString().utf8());
|
ci.value().toString().toUtf8().constData());
|
||||||
if(post_filenames[ci->first]) {
|
if(post_filenames[ci.key()]) {
|
||||||
printf("<td align=\"center\">Yes</td>\n");
|
printf("<td align=\"center\">Yes</td>\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Handle POST data from an HTML form.
|
// Handle POST data from an HTML form.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2009-2018 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2009-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -21,13 +21,12 @@
|
|||||||
#ifndef RDFORMPOST_H
|
#ifndef RDFORMPOST_H
|
||||||
#define RDFORMPOST_H
|
#define RDFORMPOST_H
|
||||||
|
|
||||||
#include <map>
|
#include <QDataStream>
|
||||||
|
#include <QMap>
|
||||||
#include <qdatastream.h>
|
#include <QString>
|
||||||
#include <qstring.h>
|
#include <QStringList>
|
||||||
#include <qstringlist.h>
|
#include <QVariant>
|
||||||
#include <qvariant.h>
|
#include <QHostAddress>
|
||||||
#include <qhostaddress.h>
|
|
||||||
|
|
||||||
#include <rdtempdirectory.h>
|
#include <rdtempdirectory.h>
|
||||||
|
|
||||||
@ -71,8 +70,8 @@ class RDFormPost
|
|||||||
QHostAddress post_client_address;
|
QHostAddress post_client_address;
|
||||||
RDFormPost::Encoding post_encoding;
|
RDFormPost::Encoding post_encoding;
|
||||||
RDFormPost::Error post_error;
|
RDFormPost::Error post_error;
|
||||||
std::map<QString,QVariant> post_values;
|
QMap<QString,QVariant> post_values;
|
||||||
std::map<QString,bool> post_filenames;
|
QMap<QString,bool> post_filenames;
|
||||||
RDTempDirectory *post_tempdir;
|
RDTempDirectory *post_tempdir;
|
||||||
bool post_auto_delete;
|
bool post_auto_delete;
|
||||||
unsigned post_content_length;
|
unsigned post_content_length;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user