Merged in hotfix (pull request #118)
Merge hotfix branch --HG-- branch : compatibilityhg/compatibility
commit
1715cf7efe
@ -0,0 +1,39 @@
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES})
|
||||
FILE(GLOB RCERROR_SRC *.cpp)
|
||||
FILE(GLOB RCERROR_HDR *h)
|
||||
|
||||
SET(RCERROR_MOC_HDR
|
||||
rcerror_socket.h
|
||||
rcerror_widget.h
|
||||
)
|
||||
|
||||
SET(RCERROR_UI
|
||||
rcerror_widget.ui
|
||||
)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTMAIN TRUE)
|
||||
SET(QT_USE_QTOPENGL FALSE)
|
||||
SET(QT_USE_QTXML FALSE)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ADD_DEFINITIONS(${QT_DEFINITIONS})
|
||||
|
||||
QT4_WRAP_CPP(RCERROR_MOC_SRC ${RCERROR_MOC_HDR})
|
||||
QT4_WRAP_UI(RCERROR_UI_HDR ${RCERROR_UI})
|
||||
|
||||
SOURCE_GROUP(QtResources FILES ${RCERROR_UI})
|
||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${RCERROR_UI_HDR})
|
||||
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${RCERROR_MOC_SRC})
|
||||
SOURCE_GROUP("source files" FILES ${RCERROR_SRC})
|
||||
SOURCE_GROUP("header files" FILES ${RCERROR_HDR})
|
||||
|
||||
ADD_EXECUTABLE(rcerror WIN32 MACOSX_BUNDLE ${RCERROR_SRC} ${RCERROR_MOC_HDR} ${RCERROR_MOC_SRC} ${RCERROR_UI_HDR})
|
||||
TARGET_LINK_LIBRARIES(rcerror ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
|
||||
|
||||
NL_DEFAULT_PROPS(rcerror "Ryzom Core Error Reporter")
|
||||
NL_ADD_RUNTIME_FLAGS(rcerror)
|
||||
|
||||
INSTALL(TARGETS rcerror RUNTIME DESTINATION ${NL_BIN_PREFIX})
|
||||
|
@ -0,0 +1,33 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "rcerror_widget.h"
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
|
||||
RCErrorWidget w;
|
||||
w.setFileName( "rcerrorlog.txt" );
|
||||
w.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_DATA
|
||||
#define RCERROR_DATA
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
struct RCErrorData
|
||||
{
|
||||
QString description;
|
||||
QString report;
|
||||
QString email;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,70 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "rcerror_socket.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
namespace
|
||||
{
|
||||
static const char *BUG_URL = "http://192.168.2.66/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( QNetworkReply* ) ) );
|
||||
}
|
||||
|
||||
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( QNetworkReply *reply )
|
||||
{
|
||||
if( reply->error() != QNetworkReply::NoError )
|
||||
Q_EMIT reportFailed();
|
||||
else
|
||||
Q_EMIT reportSent();
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_SOCKET
|
||||
#define RCERROR_SOCKET
|
||||
|
||||
#include <QObject>
|
||||
#include "rcerror_data.h"
|
||||
|
||||
class RCErrorSocketPvt;
|
||||
class QNetworkReply;
|
||||
|
||||
class RCErrorSocket : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RCErrorSocket( QObject *parent );
|
||||
~RCErrorSocket();
|
||||
|
||||
void sendReport( const RCErrorData &data );
|
||||
|
||||
Q_SIGNALS:
|
||||
void reportSent();
|
||||
void reportFailed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFinished( QNetworkReply *reply );
|
||||
|
||||
private:
|
||||
RCErrorSocketPvt *m_pvt;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,110 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "rcerror_widget.h"
|
||||
#include "rcerror_socket.h"
|
||||
#include "rcerror_data.h"
|
||||
#include <QTimer>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
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() ) );
|
||||
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
|
||||
}
|
||||
|
||||
RCErrorWidget::~RCErrorWidget()
|
||||
{
|
||||
m_socket = NULL;
|
||||
}
|
||||
|
||||
void RCErrorWidget::onLoad()
|
||||
{
|
||||
QFile f( m_fileName );
|
||||
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
||||
if( !b )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "No log file found" ),
|
||||
tr( "There was no log file found, therefore nothing to report. Exiting..." ) );
|
||||
close();
|
||||
}
|
||||
|
||||
QTextStream ss( &f );
|
||||
m_ui.reportEdit->setPlainText( ss.readAll() );
|
||||
f.close();
|
||||
}
|
||||
|
||||
void RCErrorWidget::onSendClicked()
|
||||
{
|
||||
m_ui.sendButton->setEnabled( false );
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
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()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void RCErrorWidget::onCBClicked()
|
||||
{
|
||||
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
||||
}
|
||||
|
||||
void RCErrorWidget::onReportSent()
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||
|
||||
QMessageBox::information( this,
|
||||
tr( "Report sent" ),
|
||||
tr( "The report has been sent." ) );
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void RCErrorWidget::onReportFailed()
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||
|
||||
QMessageBox::information( this,
|
||||
tr( "Report failed" ),
|
||||
tr( "Failed to send the report..." ) );
|
||||
|
||||
close();
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_WIDGET
|
||||
#define RCERROR_WIDGET
|
||||
|
||||
|
||||
#include "ui_rcerror_widget.h"
|
||||
|
||||
class RCErrorSocket;
|
||||
|
||||
class RCErrorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RCErrorWidget( QWidget *parent = NULL );
|
||||
~RCErrorWidget();
|
||||
|
||||
void setFileName( const char *fn ){ m_fileName = fn; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onLoad();
|
||||
void onSendClicked();
|
||||
void onCancelClicked();
|
||||
void onCBClicked();
|
||||
|
||||
void onReportSent();
|
||||
void onReportFailed();
|
||||
|
||||
private:
|
||||
Ui::RCErrorWidget m_ui;
|
||||
QString m_fileName;
|
||||
RCErrorSocket *m_socket;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RCErrorWidget</class>
|
||||
<widget class="QWidget" name="RCErrorWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>407</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Ryzom Core error report</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>What were you doing when the crash occured?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="descriptionEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Contents of the report ( automatically generated )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="reportEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="emailCB">
|
||||
<property name="text">
|
||||
<string>Email me if you have further questions, or updates on this issue</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="emailEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter your email address here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QPushButton" name="sendButton">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="canceButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
class BugReportConfig
|
||||
{
|
||||
static public $dbhost = "localhost";
|
||||
static public $dbport = "3306";
|
||||
static public $dbdb = "bugs";
|
||||
static public $dbuser = "bugs";
|
||||
static public $dbpw = "bugs";
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
/// 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" );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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();
|
||||
|
||||
?>
|
@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head><title>Ryzom Core Error Report Web application test harness</title></head>
|
||||
<body>
|
||||
<form action="r.php" method="post">
|
||||
<table border="0">
|
||||
<tr><td>Description</td></tr>
|
||||
<tr><td><textarea name="descr">Something something dark side</textarea></td></tr>
|
||||
<tr><td>Report</td></tr>
|
||||
<tr><td><textarea name="report">Mani bad crashes :(</textarea></td></tr>
|
||||
<tr><td>Email</td></tr>
|
||||
<tr><td>
|
||||
<input type="text" name="email" value="e@ma.il"/>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><input type="submit" value="report"/></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue