2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/core.php' ;
$pageTitle = 'Bug' ;
2017-09-22 14:37:18 +02:00
$jscript_modules [] = $js . '/ckeditor/ckeditor.js' ;
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
// Mittente
2017-09-14 11:40:13 +02:00
$mail -> From = $post [ 'email_from' ];
2017-08-04 16:28:16 +02:00
$mail -> FromName = $_SESSION [ 'username' ];
2017-09-14 11:40:13 +02:00
$mail -> AddReplyTo ( $post [ 'email_from' ]);
2017-08-04 16:28:16 +02:00
// Destinatario
2017-09-14 11:40:13 +02:00
$mail -> AddAddress ( $post [ 'email_to' ]);
2017-08-04 16:28:16 +02:00
// Copia
2017-09-14 11:40:13 +02:00
if ( ! empty ( $post [ 'email_cc' ])) {
$mail -> AddCC ( $post [ 'email_cc' ]);
2017-08-04 16:28:16 +02:00
}
// Copia nascosta
2017-09-14 11:40:13 +02:00
if ( ! empty ( $post [ 'email_bcc' ])) {
$mail -> AddBCC ( $post [ 'email_bcc' ]);
2017-08-04 16:28:16 +02:00
}
2017-09-04 12:02:29 +02:00
$mail -> Subject = 'Segnalazione bug OSM ' . $version . ' (' . ( ! empty ( $revision ) ? 'R' . $revision : tr ( 'In sviluppo' )) . ')' ;
2017-08-04 16:28:16 +02:00
// Se ho scelto di inoltrare i file di log, allego
if ( ! empty ( $post [ 'log' ]) && file_exists ( $docroot . '/logs/error.log' )) {
$mail -> AddAttachment ( $docroot . '/logs/error.log' );
}
// Se ho scelto di inoltrare copia del db
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' ;
backup_tables ( $backup_file );
2017-08-04 16:28:16 +02:00
2017-09-10 14:35:41 +02:00
$mail -> AddAttachment ( $backup_file );
$_SESSION [ 'infos' ][] = tr ( 'Backup del database eseguito ed allegato correttamente!' );
2017-08-04 16:28:16 +02:00
}
2017-09-14 11:40:13 +02:00
$body = $post [ 'body' ] . '<hr><br>' . tr ( 'IP' ) . ': ' . get_client_ip ();
2017-08-04 16:28:16 +02:00
// Se ho scelto di inoltrare le INFO del mio sistema
if ( ! empty ( $post [ 'info' ])) {
$body .= $_SERVER [ 'HTTP_USER_AGENT' ] . ' - ' . getOS ();
}
$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 ()) {
2017-09-04 12:02:29 +02:00
$_SESSION [ 'errors' ][] = tr ( " Errore durante l'invio della segnalazione " ) . ': ' . $mail -> ErrorInfo ;
2017-08-04 16:28:16 +02:00
} else {
2017-09-04 12:02:29 +02:00
$_SESSION [ 'infos' ][] = tr ( 'Email inviata correttamente!' );
2017-08-04 16:28:16 +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 ();
}
if ( file_exists ( $docroot . '/include/custom/top.php' )) {
include $docroot . '/include/custom/top.php' ;
} else {
include $docroot . '/include/top.php' ;
}
2017-09-22 15:16:56 +02:00
$email_to = Settings :: get ( 'Destinatario' );
$email_from = Settings :: get ( 'Indirizzo per le email in uscita' );
2017-08-04 16:28:16 +02:00
2017-09-22 15:16:56 +02:00
$mail = Mail :: get ();
2017-08-04 16:28:16 +02:00
2017-09-22 15:16:56 +02:00
if ( empty ( $email_to ) || empty ( $email_from ) || empty ( $mail [ 'server' ])) {
2017-08-04 16:28:16 +02:00
echo '
< div class = " alert alert-warning " >
< i class = " fa fa-warning " ></ i >
2017-09-22 15:16:56 +02:00
< b > '.tr(' Attenzione ! ').' </ b > '.tr(' Per utilizzare correttamente il modulo di segnalazione bug devi configurare alcuni parametri riguardanti le impostazione delle email ').' . ' ;
if ( empty ( $email_to ) || empty ( $email_from )) {
echo Modules :: link ( 'Impostazioni' , $dbo -> fetchArray ( " SELECT `idimpostazione` FROM `zz_settings` WHERE sezione='Email' " )[ 0 ][ 'idimpostazione' ], tr ( 'Correggi impostazioni' ), null , 'class="btn btn-warning pull-right"' );
}
if ( empty ( $mail [ 'server' ])) {
echo Modules :: link ( 'Account email' , $mail [ 'id' ], tr ( 'Correggi account' ), null , 'class="btn btn-warning pull-right"' );
}
echo '
2017-08-04 16:28:16 +02:00
< div class = " clearfix " ></ div >
</ div > ' ;
}
echo '
< div class = " box " >
< div class = " box-header " >
2017-09-04 12:02:29 +02:00
< h3 class = " box-title " >< i class = " fa fa-bug " ></ i > '.tr(' Segnalazione bug ').' </ h3 ></ h3 >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " box-body " >
< form method = " post " action = " '. $rootdir .'/bug.php?op=send " >
< table class = " table table-bordered table-condensed table-striped table-hover " >
< tr >
2017-09-04 12:02:29 +02:00
< th width = " 150 " class = " text-right " > '.tr(' Da ').' :</ th >
2017-08-04 16:28:16 +02:00
< td >
2017-09-04 12:02:29 +02:00
{[ " type " : " email " , " placeholder " : " '.tr('Mittente').' " , " name " : " email_from " , " value " : " '. $email_from .' " , " required " : 1 ]}
2017-08-04 16:28:16 +02:00
</ td >
</ tr >
<!-- A -->
< tr >
2017-09-04 12:02:29 +02:00
< th class = " text-right " > '.tr(' A ').' :</ th >
2017-08-04 16:28:16 +02:00
< td >
2017-09-04 12:02:29 +02:00
{[ " type " : " email " , " placeholder " : " '.tr('Destinatario').' " , " name " : " email_to " , " value " : " '. $email_to .' " , " required " : 1 ]}
2017-08-04 16:28:16 +02:00
</ td >
</ tr >
<!-- Cc -->
< tr >
2017-09-04 12:02:29 +02:00
< th class = " text-right " > '.tr(' Cc ').' :</ th >
2017-08-04 16:28:16 +02:00
< td >
2017-09-04 12:02:29 +02:00
{[ " type " : " email " , " placeholder " : " '.tr('Copia a').'... " , " name " : " email_cc " ]}
2017-08-04 16:28:16 +02:00
</ td >
</ tr >
<!-- Bcc -->
< tr >
2017-09-04 12:02:29 +02:00
< th class = " text-right " > '.tr(' Bcc ').' :</ th >
2017-08-04 16:28:16 +02:00
< td >
2017-09-04 12:02:29 +02:00
{[ " type " : " email " , " placeholder " : " '.tr('Copia nascosta a').'... " , " name " : " email_bcc " ]}
2017-08-04 16:28:16 +02:00
</ td >
</ tr >
<!-- Versione -->
< tr >
2017-09-04 12:02:29 +02:00
< th class = " text-right " > '.tr(' Versione OSM ').' :</ th >
2017-08-04 16:28:16 +02:00
< td >
2017-09-11 18:50:56 +02:00
{[ " type " : " span " , " placeholder " : " '.tr('Versione OSM').' " , " value " : " '. $version .' ('.(!empty( $revision ) ? $revision : tr('In sviluppo')).') " ]}
2017-08-04 16:28:16 +02:00
</ td >
</ tr >
</ table >
< div class = " row " >
< div class = " col-xs-12 col-md-4 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega file di log').' " , " name " : " log " , " value " : " 1 " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-xs-12 col-md-4 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega copia del database').' " , " name " : " sql " , " value " : " 0 " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-xs-12 col-md-4 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " checkbox " , " placeholder " : " '.tr('Allega informazioni sul PC').' " , " name " : " info " , " value " : " 1 " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " clearfix " ></ div >
< br >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " '.tr('Descrizione del bug').' " , " name " : " body " ]}
2017-08-04 16:28:16 +02:00
<!-- PULSANTI -->
< div class = " row " >
< div class = " col-md-12 text-right " >
2017-09-04 12:02:29 +02:00
< 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 >
</ div >
</ form >
</ div >
</ div >
< script >
$ ( document ) . ready ( function (){
2017-09-04 12:02:29 +02:00
var html = " <p>'.tr('Se hai riscontrato un bug ricordati di specificare').':</p> " +
2017-08-04 16:28:16 +02:00
" <ul> " +
2017-09-04 12:02:29 +02:00
" <li>'.tr('Modulo esatto (o pagina relativa) in cui questi si è verificato').';</li> " +
" <li>'.tr('Dopo quali specifiche operazioni hai notato il malfunzionameto').'.</li> " +
2017-08-04 16:28:16 +02:00
" </ul> " +
2017-09-04 12:02:29 +02:00
" <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> " ;
2017-08-04 16:28:16 +02:00
var firstFocus = 1 ;
CKEDITOR . replace ( " body " , {
toolbar : [
{ name : " document " , items : [ " NewPage " , " Preview " , " - " , " Templates " ] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups
[ " Bold " , " Italic " , " Underline " , " Superscript " , " - " , " NumberedList " , " BulletedList " , " Outdent " , " Indent " , " Blockquote " , " - " , " Format " ,], // Defines toolbar group without name
]
});
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 ;
}
});
});
</ script > ' ;
if ( file_exists ( $docroot . '/include/custom/bottom.php' )) {
include $docroot . '/include/custom/bottom.php' ;
} else {
include $docroot . '/include/bottom.php' ;
}