diff --git a/code/nel/rcerror/rcerror_data.h b/code/nel/rcerror/rcerror_data.h
new file mode 100644
index 000000000..146102038
--- /dev/null
+++ b/code/nel/rcerror/rcerror_data.h
@@ -0,0 +1,33 @@
+// Ryzom Core MMORPG framework - Error Reporter
+//
+// Copyright (C) 2015 Laszlo Kis-Adam
+// Copyright (C) 2010 Ryzom Core
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+
+#ifndef RCERROR_DATA
+#define RCERROR_DATA
+
+#include
+
+
+struct RCErrorData
+{
+ QString description;
+ QString report;
+ QString email;
+};
+
+#endif
diff --git a/code/nel/rcerror/rcerror_socket.cpp b/code/nel/rcerror/rcerror_socket.cpp
index f39946423..d84f69ec8 100644
--- a/code/nel/rcerror/rcerror_socket.cpp
+++ b/code/nel/rcerror/rcerror_socket.cpp
@@ -17,4 +17,50 @@
// along with this program. If not, see .
#include "rcerror_socket.h"
+#include
+#include
+#include
+
+namespace
+{
+ static const char *BUG_URL = "http://192.168.2.67/dfighter/r.php";
+}
+
+class RCErrorSocketPvt
+{
+public:
+ QNetworkAccessManager mgr;
+};
+
+RCErrorSocket::RCErrorSocket( QObject *parent ) :
+QObject( parent )
+{
+ m_pvt = new RCErrorSocketPvt();
+
+ connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished() ) );
+}
+
+RCErrorSocket::~RCErrorSocket()
+{
+ delete m_pvt;
+}
+
+void RCErrorSocket::sendReport( const RCErrorData &data )
+{
+ QUrl params;
+ params.addQueryItem( "report", data.report );
+ params.addQueryItem( "descr", data.description );
+ params.addQueryItem( "email", data.email );
+
+ QUrl url( BUG_URL );
+ QNetworkRequest request( url );
+ request.setRawHeader( "Connection", "close" );
+
+ m_pvt->mgr.post( request, params.encodedQuery() );
+}
+
+void RCErrorSocket::onFinished()
+{
+ Q_EMIT reportSent();
+}
diff --git a/code/nel/rcerror/rcerror_socket.h b/code/nel/rcerror/rcerror_socket.h
index 8cd9f54ad..ee0f510b1 100644
--- a/code/nel/rcerror/rcerror_socket.h
+++ b/code/nel/rcerror/rcerror_socket.h
@@ -19,5 +19,31 @@
#ifndef RCERROR_SOCKET
#define RCERROR_SOCKET
+
+#include
+#include "rcerror_data.h"
+
+class RCErrorSocketPvt;
+
+class RCErrorSocket : public QObject
+{
+ Q_OBJECT
+
+public:
+ RCErrorSocket( QObject *parent );
+ ~RCErrorSocket();
+
+ void sendReport( const RCErrorData &data );
+
+Q_SIGNALS:
+ void reportSent();
+
+private Q_SLOTS:
+ void onFinished();
+
+private:
+ RCErrorSocketPvt *m_pvt;
+};
+
#endif
diff --git a/code/nel/rcerror/rcerror_widget.cpp b/code/nel/rcerror/rcerror_widget.cpp
index a50b273d3..faded0afa 100644
--- a/code/nel/rcerror/rcerror_widget.cpp
+++ b/code/nel/rcerror/rcerror_widget.cpp
@@ -18,23 +18,32 @@
#include "rcerror_widget.h"
+#include "rcerror_socket.h"
+#include "rcerror_data.h"
#include
#include
#include
+#include
RCErrorWidget::RCErrorWidget( QWidget *parent ) :
QWidget( parent )
{
m_ui.setupUi( this );
+
+ m_socket = new RCErrorSocket( this );
+
QTimer::singleShot( 1, this, SLOT( onLoad() ) );
connect( m_ui.sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
connect( m_ui.canceButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
+
+ connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) );
}
RCErrorWidget::~RCErrorWidget()
{
+ m_socket = NULL;
}
void RCErrorWidget::onLoad()
@@ -53,7 +62,14 @@ void RCErrorWidget::onLoad()
void RCErrorWidget::onSendClicked()
{
- close();
+ m_ui.sendButton->setEnabled( false );
+
+ RCErrorData data;
+ data.description = m_ui.descriptionEdit->toPlainText();
+ data.report = m_ui.reportEdit->toPlainText();
+ data.email = m_ui.emailEdit->text();
+
+ m_socket->sendReport( data );
}
void RCErrorWidget::onCancelClicked()
@@ -66,5 +82,12 @@ void RCErrorWidget::onCBClicked()
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
}
+void RCErrorWidget::onReportSent()
+{
+ QMessageBox::information( this,
+ tr( "Report sent" ),
+ tr( "The report has been sent." ) );
+ close();
+}
diff --git a/code/nel/rcerror/rcerror_widget.h b/code/nel/rcerror/rcerror_widget.h
index ae5629e55..869838e41 100644
--- a/code/nel/rcerror/rcerror_widget.h
+++ b/code/nel/rcerror/rcerror_widget.h
@@ -18,11 +18,13 @@
#ifndef RCERROR_WIDGET
-#define RCERROR_SOCKET
+#define RCERROR_WIDGET
#include "ui_rcerror_widget.h"
+class RCErrorSocket;
+
class RCErrorWidget : public QWidget
{
Q_OBJECT
@@ -37,10 +39,13 @@ private Q_SLOTS:
void onSendClicked();
void onCancelClicked();
void onCBClicked();
+
+ void onReportSent();
private:
Ui::RCErrorWidget m_ui;
QString m_fileName;
+ RCErrorSocket *m_socket;
};
#endif
diff --git a/code/web/rcerror_web/config.inc.php b/code/web/rcerror_web/config.inc.php
new file mode 100644
index 000000000..fe4b3e928
--- /dev/null
+++ b/code/web/rcerror_web/config.inc.php
@@ -0,0 +1,30 @@
+
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+class BugReportConfig
+{
+ static public $dbhost = "localhost";
+ static public $dbport = "3306";
+ static public $dbdb = "bugs";
+ static public $dbuser = "bugs";
+ static public $dbpw = "bugs";
+}
+
+?>
diff --git a/code/web/rcerror_web/log.inc.php b/code/web/rcerror_web/log.inc.php
new file mode 100644
index 000000000..71deee24f
--- /dev/null
+++ b/code/web/rcerror_web/log.inc.php
@@ -0,0 +1,45 @@
+
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+/// Simple file logger class
+class Logger
+{
+ private $lf = NULL;
+
+ function __construct()
+ {
+ $this->lf = fopen( 'log.txt', 'a' );
+ if( $this->lf === FALSE )
+ exit( 1 );
+ }
+
+ function __destruct()
+ {
+ fclose( $this->lf );
+ }
+
+ public function log( $msg )
+ {
+ $date = date( "[M d, Y H:i:s] " );
+ fwrite( $this->lf, $date . $msg . "\n" );
+ }
+}
+
+?>
diff --git a/code/web/rcerror_web/rcerror.php b/code/web/rcerror_web/rcerror.php
new file mode 100644
index 000000000..d20214d11
--- /dev/null
+++ b/code/web/rcerror_web/rcerror.php
@@ -0,0 +1,112 @@
+
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+require_once( 'config.inc.php' );
+require_once( 'log.inc.php' );
+
+/// Example web application that takes bug reports from the bug reporter Qt app
+class BugReportGatherApp
+{
+ private $db = NULL;
+ private $logger = NULL;
+
+ function __construct()
+ {
+ $this->logger = new Logger();
+ }
+
+ private function logPOSTVars()
+ {
+ $report = "";
+ $descr = "";
+ $email = "";
+
+ if( isset( $_POST[ 'report' ] ) )
+ $report = $_POST[ 'report' ];
+
+ if( isset( $_POST[ 'descr' ] ) )
+ $descr = $_POST[ 'descr' ];
+
+ if( isset( $_POST[ 'email' ] ) )
+ $email = $_POST[ 'email' ];
+
+ $this->logger->log( 'report: ' . "\n" . $report );
+ $this->logger->log( 'description: ' . "\n" . $descr );
+ $this->logger->log( 'email: ' . "\n" . $email );
+ }
+
+ private function buildQuery()
+ {
+ $report = "";
+ $descr = "";
+ $email = "";
+
+ if( isset( $_POST[ 'report' ] ) )
+ $report = $_POST[ 'report' ];
+
+ if( isset( $_POST[ 'descr' ] ) )
+ $descr = $_POST[ 'descr' ];
+
+ if( isset( $_POST[ 'email' ] ) )
+ $email = $_POST[ 'email' ];
+
+ $report = $this->db->real_escape_string( $report );
+ $descr = $this->db->real_escape_string( $descr );
+ $email = $this->db->real_escape_string( $email );
+
+
+ $q = "INSERT INTO `bugs` (`report`,`description`,`email`) VALUES (";
+ $q .= "'$report',";
+ $q .= "'$descr',";
+ $q .= "'$email')";
+
+ return $q;
+ }
+
+ public function exec()
+ {
+ //$this->logPOSTVars();
+
+ $this->db = new mysqli( BugReportConfig::$dbhost, BugReportConfig::$dbuser, BugReportConfig::$dbpw, BugReportConfig::$dbdb, BugReportConfig::$dbport );
+ if( mysqli_connect_error() )
+ {
+ $this->logger->log( "Connection error :(" );
+ $this->logger->log( mysqli_connect_error() );
+ return;
+ }
+
+ $q = $this->buildQuery();
+ $result = $this->db->query( $q );
+ if( $result !== TRUE )
+ {
+ $this->logger->log( "Query failed :(" );
+ $this->logger->log( 'Query: ' . $q );
+ $this->logPOSTVars();
+ }
+
+ $this->db->close();
+ }
+}
+
+
+$app = new BugReportGatherApp();
+$app->exec();
+
+?>
diff --git a/code/web/rcerror_web/rcerror_test.htm b/code/web/rcerror_web/rcerror_test.htm
new file mode 100644
index 000000000..eb314d3f7
--- /dev/null
+++ b/code/web/rcerror_web/rcerror_test.htm
@@ -0,0 +1,19 @@
+
+Ryzom Core Error Report Web application test harness
+
+
+
+