<?php
            session_start();
            ?>

            <!DOCTYPE html>
            <html lang="it">
            <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>Modello - Tralegraffe.it</title>
                <meta name="description" content="Descrizione della pagina modello.">
                <style>
                    /* Stili CSS qui... */
                </style>
            </head>
            <body>
                <div class="window">
                    <div class="title-bar">
                        Modello Pagina
                        <div class="right-items">
                            <img src="img/eth.png" alt="ETH" class="eth-icon">
                            <div class="clock" id="clock"></div>
                        </div>
                    </div>
                    <div class="menu-bar">
                        <div class="menu">
                            <button class="menu-button">File</button>
                            <div class="menu-content">
                                <div class="menu-item">
                                    <a href="#">Apri</a>
                                    <div class="submenu">
                                        <a href="xxxxxxxx">Area riservata</a>
                                    </div>
                                </div>
                                <a href="index.php">Back</a>
                                <a href="#" onclick="addToFavorites()">Salva</a>
                            </div>
                        </div>
                        <div class="menu">
                            <button class="menu-button">Modifica</button>
                            <div class="menu-content">
                                <a href="#" style="color: #808080; pointer-events: none;">Taglia</a>
                                <a href="#" style="color: #808080; pointer-events: none;">Copia</a>
                                <a href="#" style="color: #808080; pointer-events: none;">Incolla</a>
                            </div>
                        </div>
                        <div class="menu">
                            <button class="menu-button">Visualizza</button>
                            <div class="menu-content">
                                <a href="software.php">Software</a>
                                <a href="hardware.php">Hardware</a>
                                <a href="index.php">Ripristina</a>
                            </div>
                        </div>
                        <div class="menu">
                            <button class="menu-button">?</button>
                            <div class="menu-content">
                                <a href="about.php">Chi siamo</a>
                                <a href="privacy.php">Privacy Policy</a>
                                <a href="im.php">IncognitoMetrica</a>
                            </div>
                        </div>
                    </div>
                    <div class="content">
                        <!-- Contenuto della pagina modello -->
                    </div>
                    <!-- Immagine finger.png con posizione assoluta, dimensioni 80x100, senza bordi e cliccabile -->
                    <a href="index.php" style="position: absolute; top: 80px; left: 10px;">
                        <img src="img/finger.png" alt="Finger Icon" style="width: 80px; height: 40px; border: none;"></a>
                    <!-- Immagine trash.png con posizione assoluta, dimensioni 80x80, senza bordi e cliccabile -->
                    <a href="trash.php" style="position: absolute; bottom: 36px; right: 10px;">
                        <img src="img/trash.png" alt="Trash Icon" style="width: 60px; height: 60px; border: none;"></a>
                    <div class="source-window">
                        <div class="source-title-bar">Source Code</div>
                        <div class="source-content">
                            <?php
                                $filePath = 'index.php'; // Percorso del file sorgente da visualizzare
                                $fileContent = htmlspecialchars(file_get_contents($filePath)); // Legge il contenuto e lo "sanitizza"
                                echo $fileContent;
                            ?>
                        </div>
                    </div>
                    <footer style="text-align: right; padding: 10px; font-family: 'Chicago', 'Courier New', Courier, monospace;">
                        &copy; <?php echo date("Y"); ?> Tralegraffe.it. Tutti i diritti riservati.
                    </footer>
                </div>
            
                <script>
                    function updateClock() {
                        const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
                        const now = new Date();
                        const day = days[now.getDay()];
                        const hours = now.getHours().toString().padStart(2, '0');
                        const minutes = now.getMinutes().toString().padStart(2, '0');
                        const timeString = `${day} ${hours}:${minutes}`;
                        document.getElementById('clock').textContent = timeString;
                    }

                    function addToFavorites() {
                        const title = document.title;
                        const url = window.location.href;
                        if (window.sidebar && window.sidebar.addPanel) { // Firefox <23
                            window.sidebar.addPanel(title, url, '');
                        } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorites
                            window.external.AddFavorite(url, title);
                        } else if (window.opera && window.print) { // Opera Hotlist
                            this.title = title;
                            return true;
                        } else { // Other browsers (mainly WebKit - Chrome/Safari)
                            alert('Premi ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D per aggiungere ai preferiti.');
                        }
                    }

                    window.onload = function() {
                        updateClock();
                        setInterval(updateClock, 1000); // Aggiorna l'orologio ogni secondo
                    }
                </script>
            </body>
            </html>