Modificare il chat save per selezionare luogo e ora
Pagine → 1 2
04/10/2021 14:34:52 e modificato da haruka il 04/10/2021 15:53:54
Sto preparando il pacchetto. Qualche gestore anima pia ha voglia di testarlo prima in modo che il pacchetto al portale sia debuggato? STEP 1La prima modifica va fatta nel file pages/frame_chat.inc.phpDove c'è:
<?php if($PARAMETERS['mode']['chatsave'] == 'ON') { ?> <span class="casella_info"> <a href="javascript:void(0);" onClick="window.open('chat_save.proc.php','Log','width=1,height=1,toolbar=no');"> Salva Chat </a> </span> <?php } ?>
subito dopo bisogna aggiungere<?php if( ($PARAMETERS['mode']['chatsave'] == 'ON') && ($_SESSION['permessi'] > GAMEMASTER)) { ?> <span class="casella_info"> | <a style="color:red; font-weight:bolder;" href="javascript:void(0);" onClick="window.open('chat_save_gestori.proc.php','Log','width=1,height=1,toolbar=no');"> Salva Gestione </a> </span> <?php } ?>
STEP 2uploadare nella cartella generale del gioco il filechat_save_gestori.proc.php<?php################################################################################## ### Save Chat HTML 1.3 - Author eLDiabolo ### ### e-mail: http://www.gdr-online.com/email.asp?email=eldiabolo ### #####################################################################################################################################################################session_start();/* Includo i file necessari */include ('includes/constant_values.inc.php');include ('config.inc.php');include ('vocabulary/' . $PARAMETERS['languages']['set'] . '.vocabulary.php');include ('includes/functions.inc.php');/* Eseguo la connessione al database */$handleDBConnection = gdrcd_connect();$typeOrder = ($PARAMETERS['mode']['chat_from_bottom'] == 'ON') ? 'DESC' : 'ASC';/*Query per caricamento dati dalla chat corrente, carica le azioni degli ultimi 240 min - 4 ore !! NON SALVA LE CHAT PRIVATE !!*/?>Usa il form seguente per selezionare la data e l'ora della chat da salvare <br><br><form action="chat_save_gestori.proc.php"method="post"><?php$result = gdrcd_query("SELECT nome, id FROM mappa WHERE chat=1 ORDER BY nome", 'result'); ?><div class='form_label'><?php echo gdrcd_filter('out',$MESSAGE['interface']['administration']['log']['chat']['begin']); ?></div><div class='form_field'><!-- Giorno --><select name="day_b" class="day"><?php for ($i = 1; $i <= 31; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select><!-- Mese --><select name="month_b" class="month"><?php for ($i = 1; $i <= 12; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select><!-- Anno --><select name="year_b" class="year"><?php for ($i = 2019; $i <= strftime('%Y') + 20; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select> -<!-- Ora --><select name="hour_b" class="month"><?php for ($i = 0; $i <= 23; $i++){ ?><option value="<?php echo $i; ?>"><?php echo sprintf('%02s', $i); ?></option><?php }//for?></select>:<!-- Minuto --><select name="minut_b" class="month"><?php for ($i = 0; $i <= 60; $i += 5){ ?><option value="<?php echo $i; ?>"><?php echo sprintf('%02s', $i); ?></option><?php }//for?></select></div><div class='form_label'><?php echo gdrcd_filter('out',$MESSAGE['interface']['administration']['log']['chat']['end']); ?></div><div class='form_field'><!-- Giorno --><select name="day_e" class="day"><?php for ($i = 1; $i <= 31; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select><!-- Mese --><select name="month_e" class="month"><?php for ($i = 1; $i <= 12; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select><!-- Anno --><select name="year_e" class="year"><?php for ($i = 2021; $i <= strftime('%Y') + 20; $i++){ ?><option value="<?php echo $i; ?>"><?php echo $i; ?></option><?php }//for?></select> -<!-- Ora --><select name="hour_e" class="month"><?php for ($i = 0; $i <= 23; $i++){ ?><option value="<?php echo $i; ?>"><?php echo sprintf('%02s', $i); ?></option><?php }//for?></select>:<!-- Minuto --><select name="minut_e" class="month"><?php for ($i = 0; $i <= 60; $i += 5){ ?><option value="<?php echo $i; ?>"><?php echo sprintf('%02s', $i); ?></option><?php }//for?></select></div><!-- bottoni --><div class='form_submit'><input type="hidden"value="view_date"name="op"/><input type="submit"value="<?php echo gdrcd_filter('out',$MESSAGE['interface']['forms']['submit']); ?>"/></div></form><?phpif ( ($PARAMETERS['mode']['chatsavepvt'] == 'ON') || ($_SESSION['permessi'] > MODERATOR)){ if (isset($_REQUEST['op']) == 'view_date') {$date_b = gdrcd_filter('num', $_REQUEST['year_b']) . '-' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['month_b'])) . '-' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['day_b'])) . ' ' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['hour_b'])) . ':' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['minut_b'])) . ':00';$date_e = gdrcd_filter('num', $_REQUEST['year_e']) . '-' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['month_e'])) . '-' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['day_e'])) . ' ' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['hour_e'])) . ':' . sprintf('%02s',gdrcd_filter('num', $_REQUEST['minut_e'])) . ':00'; $query = gdrcd_query(" SELECT chat.id, chat.imgs, chat.mittente, chat.destinatario, chat.tipo, chat.ora, chat.testo, personaggio.url_img_chat, mappa.ora_prenotazione, mappa.privataFROM chatINNER JOIN mappa ON mappa.id = chat.stanzaLEFT JOIN personaggio ON personaggio.nome = chat.mittenteWHERE stanza = " . $_SESSION['luogo'] . " AND ora >= '" . $date_b . "' AND ora <= '" . $date_e . "' ORDER BY id " . $typeOrder, 'result');}} else { $query = gdrcd_query(" SELECT chat.id, chat.imgs, chat.mittente, chat.destinatario, chat.tipo, chat.ora, chat.testo, personaggio.url_img_chat, mappa.ora_prenotazione, mappa.privata FROM chat INNER JOIN mappa ON mappa.id = chat.stanza LEFT JOIN personaggio ON personaggio.nome = chat.mittente WHERE stanza = " . $_SESSION['luogo'] . " AND mappa.privata = 0 AND DATE_SUB(NOW(), INTERVAL 240 MINUTE) < ora AND chat.ora > IFNULL(mappa.ora_prenotazione, '0000-00-00 00:00:00') ORDER BY id " . $typeOrder, 'result'); } /*Inizio a preparare il testo da inserire poi nel file da salvare.*/ $add_chat = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link rel="shortcut icon" href="favicon.gif" type="image/gif" /> <link rel="stylesheet" href="' . $PARAMETERS['info']['site_url'] . '/css/homepage.css" type="text/css" /> <link rel="stylesheet" href="' . $PARAMETERS['info']['site_url'] . '/themes/' . $PARAMETERS['themes']['current_theme'] . '/main.css" type="text/css" /> <link rel="stylesheet" href="' . $PARAMETERS['info']['site_url'] . '/themes/' . $PARAMETERS['themes']['current_theme'] . '/chat.css" type="text/css" /> <link rel="stylesheet" href="' . $PARAMETERS['info']['site_url'] . '/layouts/' . $PARAMETERS['themes']['kind_of_layout'] . '_frames.php?css=true" type="text/css" /> </head> <body class="main_body" style="height:1200px; overflow:auto; text-align:justify;"> '; $i = 0; /* Eseguo la query e le formattazioni */ while ($row = gdrcd_query($query, 'fetch')) { /** BEGIN "Icone di Chat by eLDiabolo" * * Modifica immagini di chat. Icone razza, genere e gilda. * Per farle apparire impostare i parametri relativi nel file config.inc.php * se impostato su On compaiono le icone di gilda, in automatico riempie gli spazi vuoti * per chi non ha raggiunto il limite dei simboli possibili così da avere la chat più ordinata * * v 1.3 * @author eLDiabolo */ $add_icon = ''; if ($PARAMETERS['mode']['chaticons'] == 'ON') { $add_icon .= '<span class="chat_icons">'; $icone_chat = explode(";", gdrcd_filter('out', $row['imgs'])); /*Aggiunta per rendere utilizzabile la chat anche in mancanza dell'installazione della patch Icone Chat * Save Chat HTML 1.3 *@author eLDiabolo */ if (isset($PARAMETERS['settings']['chat']['guilds'])) { if ($PARAMETERS['settings']['chat']['race'] == 'ON') { $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/themes/' . $PARAMETERS['themes']['current_theme'] . '/imgs/icons/races/' . $icone_chat[1] . '">'; } if ($PARAMETERS['settings']['chat']['gender'] == 'ON') { $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/imgs/icons/testamini' . $icone_chat[0] . '.png">'; } if ($PARAMETERS['settings']['chat']['guilds'] == 'ON') { $query_ruoli = "SELECT clgpersonaggioruolo.id_ruolo, ruolo.nome_ruolo, ruolo.immagine FROM clgpersonaggioruolo INNER JOIN ruolo ON ruolo.id_ruolo = clgpersonaggioruolo.id_ruolo WHERE clgpersonaggioruolo.personaggio='" . $row['mittente'] . "'"; $result_ruoli = gdrcd_query($query_ruoli, 'result'); $gilde = 0; if (gdrcd_query($result_ruoli, 'num_rows') > 0) { while ($ruoli = gdrcd_query($result_ruoli, 'fetch')) { $gilde++; $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/themes/' . $PARAMETERS['themes']['current_theme'] . '/imgs/guilds/' . $ruoli['immagine'] . '" alt="' . gdrcd_filter('out', $record3['nome_ruolo']) . '" title="' . gdrcd_filter('out', $ruoli['nome_ruolo']) . '" />'; } } for ($i = $PARAMETERS['settings']['guilds_limit']; $i > $gilde; $i--) { $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/imgs/icons/guilds/null.png" alt="" title="" />'; } } } else { /*Aggiunta per rendere utilizzabile la chat anche in mancanza dell'installazione della patch Icone Chat * Save Chat HTML 1.3 *@author eLDiabolo */ $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/themes/' . $PARAMETERS['themes']['current_theme'] . '/imgs/icons/races/' . $icone_chat[1] . '">'; $add_icon .= '<img class="presenti_ico" src="' . $PARAMETERS['info']['site_url'] . '/imgs/icons/testamini' . $icone_chat[0] . '.png">'; } /*Corretta la svista riportata nel pacchetto "Icone Chat v 1.1" *@author eLDiabolo */ $add_icon .= '</span>'; } /** END "Icone di Chat by eLDiabolo" * * @author eLDiabolo */ switch ($row['tipo']) { case 'P': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; /** * Avatar di chat * @author Blancks */ if ($PARAMETERS['mode']['chat_avatar'] == 'ON' && ! empty($row['url_img_chat'])) { $add_chat .= '<img src="' . $row['url_img_chat'] . '" class="chat_avatar" style="width:' . $PARAMETERS['settings']['chat_avatar']['width'] . 'px; height:' . $PARAMETERS['settings']['chat_avatar']['height'] . 'px;" />'; } $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; if ($PARAMETERS['mode']['chaticons'] == 'ON') { $add_chat .= $add_icon; } $add_chat .= '<span class="chat_name"><a href="#" onclick="Javascript: document.getElementById(\'tag\').value=\'' . $row['mittente'] . '\'; document.getElementById(\'type\')[2].selected = \'1\'; document.getElementById(\'message\').focus();">' . $row['mittente'] . '</a>'; if (empty ($row['destinatario']) === false) { $add_chat .= '<span class="chat_tag"> [' . gdrcd_filter('out', $row['destinatario']) . ']</span>'; } $add_chat .= ': </span> '; $add_chat .= '<span class="chat_msg">' . gdrcd_chatcolor(gdrcd_filter('out', $row['testo'])) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ if ($PARAMETERS['mode']['chat_avatar'] == 'ON') { $add_chat .= '<br style="clear:both;" />'; } $add_chat .= '</div>'; break; case 'A': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; /** * Avatar di chat * @author Blancks */ if ($PARAMETERS['mode']['chat_avatar'] == 'ON' && ! empty($row['url_img_chat'])) { $add_chat .= '<img src="' . $row['url_img_chat'] . '" class="chat_avatar" style="width:' . $PARAMETERS['settings']['chat_avatar']['width'] . 'px; height:' . $PARAMETERS['settings']['chat_avatar']['height'] . 'px;" />'; } $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; if ($PARAMETERS['mode']['chaticons'] == 'ON') { $add_chat .= $add_icon; } $add_chat .= '<span class="chat_name"><a href="#" onclick="Javascript: document.getElementById(\'tag\').value=\'' . $row['mittente'] . '\'; document.getElementById(\'type\')[2].selected = \'1\'; document.getElementById(\'message\').focus();">' . $row['mittente'] . '</a>'; if (empty ($row['destinatario']) === false) { $add_chat .= '<span class="chat_tag"> [' . gdrcd_filter('out', $row['destinatario']) . ']</span>'; } $add_chat .= '</span> '; $add_chat .= '<span class="chat_msg">' . gdrcd_chatcolor(gdrcd_filter('out', $row['testo'])) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ if ($PARAMETERS['mode']['chat_avatar'] == 'ON') { $add_chat .= '<br style="clear:both;" />'; } $add_chat .= '</div>'; break; case 'S': if ($_SESSION['login'] == $row['destinatario']) { /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_name">' . $row['mittente'] . ' ' . $MESSAGE['chat']['whisper']['by'] . ': </span> '; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; } else { if ($_SESSION['login'] == $row['mittente']) { /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_msg">' . $MESSAGE['chat']['whisper']['to'] . ' ' . gdrcd_filter('out', $row['destinatario']) . ': </span>'; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; } else { if (($_SESSION['permessi'] >= MODERATOR) && ($PARAMETERS['mode']['spyprivaterooms'] == 'ON')) { /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_msg">' . $row['mittente'] . ' ' . $MESSAGE['chat']['whisper']['from_to'] . ' ' . gdrcd_filter('out', $row['destinatario']) . ' </span>'; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; } } } break; case 'N': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; $add_chat .= '<span class="chat_name">' . $row['destinatario'] . '</span> '; $add_chat .= '<span class="chat_msg">' . gdrcd_chatcolor(gdrcd_filter('out', $row['testo'])) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; case 'M': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_master">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; case 'I': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<img class="chat_img" src="' . gdrcd_filter('out', $row['testo']) . '" />'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; case 'C': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; case 'D': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; case 'O': /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '<div class="chat_row_' . $row['tipo'] . '">'; $add_chat .= '<span class="chat_time">' . gdrcd_format_time($row['ora']) . '</span>'; $add_chat .= '<span class="chat_msg">' . gdrcd_filter('out', $row['testo']) . '</span>'; /** * Fix problema visualizzazione spazi vuoti con i sussurri * @author eLDiabolo */ $add_chat .= '</div>'; break; } $i++; $add_chat .= '#stop#'; } $add_chat .= ' </body> </html> '; /* Scrivo tutto in un file di testo */ $resultluogo = gdrcd_query("SELECT mappa.nome, mappa.descrizione, mappa.stato, mappa.immagine, mappa.stanza_apparente, mappa.scadenza FROM mappa_click LEFT JOIN mappa ON mappa_click.id_click = mappa.id_mappa WHERE id = ".$_SESSION['luogo'],'result'); $record_exists = gdrcd_query($resultluogo, 'num_rows'); $record = gdrcd_query($resultluogo, 'fetch'); date_default_timezone_set('Europe/Rome'); $start = gdrcd_format_datetime_cat($start_time); $end = gdrcd_format_datetime_cat($end_time); /* Scrivo tutto in un file di testo */ $file = date('Y-m-d(H-i-s)') . '_' . $_SESSION['login'] . '_' . $record['nome'] . ".html"; if($_SESSION['permessi'] > GAMEMASTER) { if (isset($_REQUEST['op']) == 'view_date') { if ($PARAMETERS['mode']['chatsave_link'] == 'ON') { $file = "giocate/" . $file; $fp = fopen($file, 'wb'); $message = str_replace("#stop#", "\r\n", $add_chat); fwrite($fp, $message, strlen($message)); fclose($fp); echo '<a href="' . $file . '">Link giocata</a>'; } if ($PARAMETERS['mode']['chatsave_download'] == 'ON') { $fp = fopen($file, "wb"); $message = str_replace("#stop#", "\r\n", $add_chat); fwrite($fp, $message, 65536); fclose($fp); /* Do le informazioni di download */ header("Content-Disposition: attachment; filename=" . urlencode($file)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file)); /* Passo le info del file al browser */ $fp = fopen($file, "r"); while ( ! feof($fp)) { print fread($fp, 65536); flush(); } fclose($fp); /* Elimino il file temporaneo */ unlink($file); /* Chiudo la finestra aperta */ } if ($PARAMETERS['mode']['chatsave_download'] == 'ON' && $PARAMETERS['mode']['chatsave_link'] == 'OFF') { ?> <script language="JavaScript1.2"> self.close(); </script> <?php } } } ?>
06/10/2021 10:54:10 e modificato da haruka il 06/10/2021 11:34:54
Grazie ad entrambi preparo il pacchetto ;)
Discussione seguita da
Pagine → 1 2
Rispondi alla Discussione Segui Discussione Inoltra Discussione Forum Programmazione, Open Source e Hosting Elenco Forum
Articoli, Interviste e altre Risorse!