2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/core.php' ;
2018-03-02 20:27:22 +01:00
$mail = Mail :: get ();
$bug_email = 'info@openstamanager.com' ;
$user = Auth :: user ();
2017-08-04 16:28:16 +02:00
if ( filter ( 'op' ) == 'send' ) {
// Preparazione email
2017-09-14 11:40:13 +02:00
$mail = new Mail ();
2017-08-04 16:28:16 +02:00
// Destinatario
2018-03-02 20:27:22 +01:00
$mail -> AddAddress ( $bug_email );
2017-08-04 16:28:16 +02:00
2018-03-02 20:27:22 +01:00
// Oggetto
$mail -> Subject = 'Segnalazione bug OSM ' . $version ;
2017-08-04 16:28:16 +02:00
2018-03-02 20:27:22 +01:00
// Aggiunta dei file di log (facoltativo)
2018-07-19 15:33:32 +02:00
if ( ! empty ( post ( 'log' )) && file_exists ( $docroot . '/logs/error.log' )) {
2017-08-04 16:28:16 +02:00
$mail -> AddAttachment ( $docroot . '/logs/error.log' );
}
2018-03-02 20:27:22 +01:00
// Aggiunta della copia del database (facoltativo)
2018-07-19 15:33:32 +02:00
if ( ! empty ( post ( 'sql' ))) {
2017-09-10 14:35:41 +02:00
$backup_file = $docroot . '/Backup OSM ' . date ( 'Y-m-d' ) . ' ' . date ( 'H_i_s' ) . '.sql' ;
2018-03-03 15:03:28 +01:00
Backup :: database ( $backup_file );
2017-08-04 16:28:16 +02:00
2017-09-10 14:35:41 +02:00
$mail -> AddAttachment ( $backup_file );
2018-07-19 17:29:21 +02:00
flash () -> info ( tr ( 'Backup del database eseguito ed allegato correttamente!' ));
2017-08-04 16:28:16 +02:00
}
2018-03-02 20:27:22 +01:00
// Aggiunta delle informazioni di base sull'installazione
$infos = [
'Utente' => $user [ 'username' ],
'IP' => get_client_ip (),
'Versione OSM' => $version . ' (' . ( ! empty ( $revision ) ? $revision : 'In sviluppo' ) . ')' ,
'PHP' => phpversion (),
];
2017-09-14 11:40:13 +02:00
2018-03-02 20:27:22 +01:00
// Aggiunta delle informazioni sul sistema (facoltativo)
2018-07-19 15:33:32 +02:00
if ( ! empty ( post ( 'info' ))) {
2018-03-02 20:27:22 +01:00
$infos [ 'Sistema' ] = $_SERVER [ 'HTTP_USER_AGENT' ] . ' - ' . getOS ();
}
// Completamento del body
2018-07-19 15:33:32 +02:00
$body = post ( 'body' ) . '<hr>' ;
2018-03-02 20:27:22 +01:00
foreach ( $infos as $key => $value ) {
$body .= '<p>' . $key . ': ' . $value . '</p>' ;
2017-08-04 16:28:16 +02:00
}
$mail -> Body = $body ;
2017-09-14 11:40:13 +02:00
$mail -> AltBody = 'Questa email arriva dal modulo bug di segnalazione bug di OSM' ;
2017-08-04 16:28:16 +02:00
// Invio mail
if ( ! $mail -> send ()) {
2018-07-19 17:29:21 +02:00
flash () -> error ( tr ( " Errore durante l'invio della segnalazione " ) . ': ' . $mail -> ErrorInfo );
2017-08-04 16:28:16 +02:00
} else {
2018-07-19 17:29:21 +02:00
flash () -> info ( tr ( 'Email inviata correttamente!' ));
2017-08-04 16:28:16 +02:00
}
2018-03-02 20:27:22 +01:00
// Rimozione del dump del database
2018-07-19 15:33:32 +02:00
if ( ! empty ( post ( 'sql' ))) {
2017-09-11 17:49:03 +02:00
delete ( $backup_file );
2017-08-04 16:28:16 +02:00
}
redirect ( $rootdir . '/bug.php' );
exit ();
}
2018-03-02 20:27:22 +01:00
$pageTitle = tr ( 'Bug' );
2018-06-26 09:41:43 +02:00
include_once App :: filepath ( 'include|custom|' , 'top.php' );
2017-08-04 16:28:16 +02:00
2018-03-02 20:27:22 +01:00
if ( empty ( $mail [ 'from_address' ]) || empty ( $mail [ 'server' ])) {
echo '
< div class = " alert alert-warning " >
< i class = " fa fa-warning " ></ i >
< b > '.tr(' Attenzione ! ').' </ b > '.tr(' Per utilizzare correttamente il modulo di segnalazione bug devi configurare alcuni parametri riguardanti le impostazione delle email ').' .
2017-08-04 16:28:16 +02:00
2018-03-02 20:27:22 +01:00
'.Modules::link(' Account email ', $mail[' id '], tr(' Correggi account '), null, ' class = " btn btn-warning pull-right " ').'
< div class = " clearfix " ></ div >
</ div > ' ;
}
2017-08-04 16:28:16 +02:00
2018-03-02 20:27:22 +01:00
echo '
< div class = " box " >
< div class = " box-header " >
< h3 class = " box-title " >< i class = " fa fa-bug " ></ i > '.tr(' Segnalazione bug ').' </ h3 >
</ div >
< div class = " box-body " >
< form method = " post " action = " " >
< input type = " hidden " name = " op " value = " send " >
< table class = " table table-bordered table-condensed table-striped table-hover " >
< tr >
< th width = " 150 " class = " text-right " > '.tr(' Da ').' :</ th >
< td > '.$mail[' from_address '].' </ td >
</ tr >
<!-- A -->
< tr >
< th class = " text-right " > '.tr(' A ').' :</ th >
< td > '.$bug_email.' </ td >
</ tr >
<!-- Versione -->
< tr >
< th class = " text-right " > '.tr(' Versione OSM ').' :</ th >
< td > '.$version.' ( '.(!empty($revision) ? $revision : tr(' In sviluppo ')).' ) </ td >
</ tr >
</ table >
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega file di log').' " , " name " : " log " , " value " : " 1 " ]}
</ div >
2017-09-22 15:16:56 +02:00
2018-03-02 20:27:22 +01:00
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega copia del database').' " , " name " : " sql " ]}
</ div >
2017-09-22 15:16:56 +02:00
2018-03-02 20:27:22 +01:00
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega informazioni sul PC').' " , " name " : " info " , " value " : " 1 " ]}
</ div >
</ div >
2017-09-22 15:16:56 +02:00
2018-03-02 20:27:22 +01:00
< div class = " clearfix " ></ div >
< br >
2017-08-04 16:28:16 +02:00
2018-09-07 17:43:52 +02:00
{[ " type " : " ckeditor " , " label " : " '.tr('Descrizione del bug').' " , " name " : " body " ]}
2018-03-02 20:27:22 +01:00
<!-- PULSANTI -->
< div class = " row " >
< div class = " col-md-12 text-right " >
< button type = " submit " class = " btn btn-primary " id = " send " disabled >
< i class = " fa fa-envelope " ></ i > '.tr(' Invia segnalazione ').'
</ button >
2017-08-04 16:28:16 +02:00
</ div >
2018-03-02 20:27:22 +01:00
</ div >
</ form >
</ div >
</ div >
< script >
$ ( document ) . ready ( function (){
var html = " <p>'.tr('Se hai riscontrato un bug ricordati di specificare').':</p> " +
" <ul> " +
" <li>'.tr('Modulo esatto (o pagina relativa) in cui questi si è verificato').';</li> " +
" <li>'.tr('Dopo quali specifiche operazioni hai notato il malfunzionameto').'.</li> " +
" </ul> " +
" <p>'.tr('Assicurati inoltre di controllare che il checkbox relativo ai file di log sia contrassegnato, oppure riporta qui l \ 'errore visualizzato').'.</p> " +
" <p>'.tr('Ti ringraziamo per il tuo contributo').',<br> " +
" '.tr('Lo staff di OSM').'</p> " ;
var firstFocus = 1 ;
CKEDITOR . instances . body . on ( " key " , function () {
setTimeout ( function (){
if ( CKEDITOR . instances . body . getData () == " " ){
$ ( " #send " ) . prop ( " disabled " , true );
}
else $ ( " #send " ) . prop ( " disabled " , false );
}, 10 );
});
CKEDITOR . instances . body . setData ( html , function () {});
CKEDITOR . instances . body . on ( " focus " , function () {
if ( firstFocus ){
CKEDITOR . instances . body . setData ( " " , function () {
CKEDITOR . instances . body . focus ();
});
firstFocus = 0 ;
}
});
});
2018-06-23 15:41:32 +02:00
</ script >
< script type = " text/javascript " charset = " utf-8 " src = " '.App::getPaths()['js'].'/ckeditor/ckeditor.js'.' " ></ script > ' ;
2017-08-04 16:28:16 +02:00
2018-06-26 09:41:43 +02:00
include_once App :: filepath ( 'include|custom|' , 'bottom.php' );