<?php
const ALTUMCODE = 66;
define('ROOT', realpath(__DIR__ . '/..') . '/');
require_once ROOT . 'app/includes/product.php';

if(file_exists(ROOT . 'install/installed')) {
    die();
}
?>
<!doctype html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/custom.css">
    <link rel="stylesheet" href="assets/css/rtl.css">

    <link rel="icon" href="./assets/favicons/favicon.ico">

    <title>Ù†ØµØ¨ Ø§Ø³Ú©Ø±ÛŒÙ¾Øª <?= PRODUCT_NAME ?></title>
</head>
<body>

<div class="container">
    <header class="card header mt-4">
        <div class="card-body d-flex">
            <div class="mr-3">
                <img src="./assets/images/logo.png" class="img-fluid logo" alt="AltumCode logo" />
            </div>

                <div class="d-flex flex-column justify-content-center">
                <h1>Ù†ØµØ¨ 66QR Ù†Ø³Ø®Ù‡ 45</h1>
                
            </div>
        
        </div>
    </header>
</div>

<main class="main mb-4">
    <div class="container">
        <div class="row">

            <div class="col col-md-3 d-none d-md-block">
                <div class="card">
                    <div class="card-body">
                        <nav class="nav sidebar-nav">
                              <ul class="sidebar mb-0" id="sidebar-ul">
                                <li class="nav-item">
                                    <a href="#welcome" class="navigator nav-link">Ø®ÙˆØ´ Ø¢Ù…Ø¯ÛŒØ¯</a>
                                </li>

                                <li class="nav-item">
                                    <a href="#requirements" class="navigator nav-link" style="display: none">Ø§Ù„Ø²Ø§Ù…Ø§Øª</a>
                                </li>

                                <li class="nav-item">
                                    <a href="#setup" class="navigator nav-link" style="display: none">ØªÙ†Ø¸ÛŒÙ…Ø§Øª</a>
                                </li>

                                <li class="nav-item">
                                    <a href="#finish" class="navigator nav-link" style="display: none">Ù¾Ø§ÛŒØ§Ù†</a>
                                </li>
                            </ul>
                        
                        </nav>
                    </div>
                </div>
            </div>

            <div class="col" id="content">
                <div class="card">
                    <div class="card-body">
                            <section id="welcome" style="display: none;direction: rtl;text-align: right;">
                            <h2>Ø®ÙˆØ´ Ø¢Ù…Ø¯ÛŒØ¯</h2>
                            <p>Ø§Ø² Ø§ÛŒÙ†Ú©Ù‡ Ø§ÛŒÙ† Ø§Ø³Ú©Ø±ÛŒÙ¾Øª Ø±Ø§ Ø§Ø² Ø³Ø§ÛŒØª Ø±Ø§Ø³ØªÚ†ÛŒÙ† Ø®Ø±ÛŒØ¯Ø§Ø±ÛŒ Ú©Ø±Ø¯Ù‡ Ø§ÛŒØ¯ØŒ Ø³Ù¾Ø§Ø³ Ú¯Ø²Ø§Ø±ÛŒÙ…!</p>
        
                            <p>Ø¨Ø§ Ø§Ø¯Ø§Ù…Ù‡ Ø±ÙˆÙ†Ø¯ Ù†ØµØ¨ØŒ Ø§Ø³Ú©Ø±ÛŒÙ¾Øª Ø´Ù…Ø§ Ø¨Ø§ ØªÙ†Ø¸ÛŒÙ…Ø§Øª Ù…ÙˆØ±Ø¯Ù†ÛŒØ§Ø² Ø¢Ù…Ø§Ø¯Ù‡ Ø®ÙˆØ§Ù‡Ø¯ Ø´Ø¯.</p>
        
                            <a href="#requirements" id="welcome_start" class="navigator btn btn-block btn-primary">Ø´Ø±ÙˆØ¹ Ù†ØµØ¨</a>
                            </section>


                        <section id="requirements" style="display: none;direction: ltr;">
                            <?php $requirements = true ?>
                            <h2 class="mb-4" style="
    text-align: right;
">Ø§Ù„Ø²Ø§Ù…Ø§Øª</h2>

                            <div class="table-responsive table-custom-container">
                                <table class="table table-custom" style="
    text-align: left;
">
                                    <thead>
                                    <tr>
                                        <th>Ù…ÙˆØ±Ø¯ Ù†ÛŒØ§Ø²</th>
                                        <th>Ø§Ù„Ø²Ø§Ù…ÛŒ</th>
                                        <th>Ø§Ú©Ù†ÙˆÙ†</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>PHP Version</td>
                                        <td>8.3 - 8.5</td>
                                        <td><?= PHP_VERSION ?></td>
                                        <td class="text-right">
                                            <?php if(version_compare(PHP_VERSION, '8.3.0', '>=') && version_compare(PHP_VERSION, '8.6', '<')): ?>
                                                âœ…
                                            <?php else: ?>
                                                âŒ
                                                <?php $requirements = false; ?>
                                            <?php endif ?>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>cURL</td>
                                        <td>Enabled</td>
                                        <td><?= function_exists('curl_version') ? 'Enabled' : 'Not Enabled' ?></td>
                                        <td class="text-right">
                                            <?php if(function_exists('curl_version')): ?>
                                                âœ…
                                            <?php else: ?>
                                                âŒ
                                                <?php $requirements = false; ?>
                                            <?php endif ?>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>OpenSSL</td>
                                        <td>Enabled</td>
                                        <td><?= extension_loaded('openssl') ? 'Enabled' : 'Not Enabled' ?></td>
                                        <td class="text-right">
                                            <?php if(extension_loaded('openssl')): ?>
                                                âœ…
                                            <?php else: ?>
                                                âŒ
                                                <?php $requirements = false; ?>
                                            <?php endif ?>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>mbstring</td>
                                        <td>Enabled</td>
                                        <td><?= extension_loaded('mbstring') && function_exists('mb_get_info') ? 'Enabled' : 'Not Enabled' ?></td>
                                        <td class="text-right">
                                            <?php if(extension_loaded('mbstring') && function_exists('mb_get_info')): ?>
                                                âœ…
                                            <?php else: ?>
                                                âŒ
                                                <?php $requirements = false; ?>
                                            <?php endif ?>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>MySQLi</td>
                                        <td>Enabled</td>
                                        <td><?= function_exists('mysqli_connect') ? 'Enabled' : 'Not Enabled' ?></td>
                                        <td class="text-right">
                                            <?php if(function_exists('mysqli_connect')): ?>
                                                âœ…
                                            <?php else: ?>
                                                âŒ
                                                <?php $requirements = false; ?>
                                            <?php endif ?>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>

                            <div class="table-responsive table-custom-container mt-5">
                                <table class="table table-custom" style="
    text-align: left;
">
                                    <thead>
                                    <tr>
                                        <th>Ø¢Ø¯Ø±Ø³ / ÙØ§ÛŒÙ„</th>
                                        <th>ÙˆØ¶Ø¹ÛŒØª</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php foreach(['config.php', 'uploads/main/', 'uploads/users/', 'uploads/cache/', 'uploads/cookie_consent', 'uploads/logs', 'uploads/offline_payment_proofs/', 'uploads/blog/', 'uploads/pwa/', 'uploads/dynamic_og_images/', 'uploads/ai_qr_codes', 'uploads/ai_qr_codes/temp', 'uploads/qr_codes/logo', 'uploads/favicons', 'uploads/barcodes', 'uploads/qr_code_background', 'uploads/qr_code_foreground'] as $key): ?>
                                        <tr>
                                            <td>/<?= $key ?></td>
                                            <td><?= is_writable(ROOT . $key) ? 'Writable' : 'Not Writable' ?></td>
                                            <td class="text-right">
                                                <?php if(is_writable(ROOT . $key)): ?>
                                                    âœ…
                                                <?php else: ?>
                                                    âŒ
                                                    <?php $requirements = false; ?>
                                                <?php endif ?>
                                            </td>
                                        </tr>
                                    <?php endforeach ?>
                                    </tbody>
                                </table>
                            </div>

                            <div class="mt-4">
                                <?php if($requirements): ?>
                                    <a href="#setup" class="navigator btn btn-block btn-primary">Ù…Ø±Ø­Ù„Ù‡ Ø¨Ø¹Ø¯</a>
                                <?php else: ?>
                                    <div class="alert alert-danger" role="alert" style="text-align: right;">
                                        Ù„Ø·ÙØ§Ù‹ Ù‚Ø¨Ù„ Ø§Ø² Ø§Ø¯Ø§Ù…Ù‡ØŒ Ù…Ø·Ù…Ø¦Ù† Ø´ÙˆÛŒØ¯ Ú©Ù‡ ØªÙ…Ø§Ù… Ø§Ù„Ø²Ø§Ù…Ø§Øª Ø°Ú©Ø± Ø´Ø¯Ù‡ Ø¯Ø± Ø§Ø³Ù†Ø§Ø¯ Ùˆ Ø¯Ø± Ø§ÛŒÙ† ØµÙØ­Ù‡ Ø¨Ø±Ø¢ÙˆØ±Ø¯Ù‡ Ø´Ø¯Ù‡ Ø§Ø³Øª!
                                    </div>
                                <?php endif ?>
                            </div>
                        </section>

                        <section id="setup" style="display: none;text-align: right;">
                            <?php
                            $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
                            $installation_url = preg_replace('/install\/$/', '', $actual_link);
                            ?>
                            <h2 class="mb-4">ØªÙ†Ø¸ÛŒÙ…Ø§Øª</h2>

                            <form id="setup_form" method="post" action="" role="form">
                              
                                <div class="form-group">
                                    <label for="license_key">Ú©Ø¯ ÙØ¹Ø§Ù„Ø³Ø§Ø²ÛŒ</label>
                                    <input type="text" class="form-control" id="license_key" name="license_key" required="required">
                                    <small class="form-text text-muted">Ú©Ø¯ÙØ¹Ø§Ù„Ø³Ø§Ø²ÛŒ Ø±Ø§Ø³ØªÚ†ÛŒÙ† Ø±Ø§ ÙˆØ§Ø±Ø¯ Ù†Ù…Ø§ÛŒÛŒØ¯</small>
                                </div>
                                
                                <div class="form-group">
                                    <label for="username_rtl">Ù†Ø§Ù… Ú©Ø§Ø±Ø¨Ø±ÛŒ Ø¯Ø± Ø±Ø§Ø³ØªÚ†ÛŒÙ†</label>
                                    <input type="text" class="form-control" id="username_rtl" name="username_rtl" required="required">
                                    <small class="form-text text-muted">Ù†Ø§Ù… Ú©Ø§Ø±Ø¨Ø±ÛŒ Ø±Ø§Ø³ØªÚ†ÛŒÙ† Ø®ÙˆØ¯ Ø±Ø§ ÙˆØ§Ø±Ø¯ Ù†Ù…Ø§ÛŒÛŒØ¯</small>       
                                    </div>

                                <div class="form-group">
                                <label for="installation_url">Ø¢Ø¯Ø±Ø³ Ø³Ø§ÛŒØª</label>
                                <input type="text" class="form-control" id="installation_url" name="installation_url" value="<?= $installation_url ?>" placeholder="https://example.com/" required="required" dir="ltr">
                                <small class="form-text text-muted">Ø­ØªÙ…Ø§ Ø¢Ø¯Ø±Ø³ Ú©Ø§Ù…Ù„ Ù…Ø³ÛŒØ± Ù†ØµØ¨ Ù…Ø­ØµÙˆÙ„ Ø±Ø§ Ù…Ø´Ø®Øµ Ú©Ù†ÛŒØ¯.<br /> Ù…Ø«Ø§Ù„ Ø³Ø§Ø¨ Ø¯Ø§Ù…ÛŒÙ†: <code>https://subdomain.domain.com/</code> <br />Ù…Ø«Ø§Ù„ Ø²ÛŒØ±Ù¾ÙˆØ´Ù‡: <code>https://domain.com/product/</code></small>
                                 </div>

                                <h3 class="mt-5">Ø§Ø·Ù„Ø§Ø¹Ø§Øª Ø¯ÛŒØªØ§Ø¨ÛŒØ³</h3>
                                <p>Ø§Ø·Ù„Ø§Ø¹Ø§Øª Ø¯ÛŒØªØ§Ø¨ÛŒØ³ Ø±Ø§ Ø¯Ø± Ø²ÛŒØ± ÙˆØ§Ø±Ø¯ Ù†Ù…Ø§ÛŒÛŒØ¯ ØªØ§ Ù†ØµØ¨ ØªÚ©Ù…ÛŒÙ„ Ú¯Ø±Ø¯Ø¯.</p>

                                <div class="form-group">
                                    <label for="database_host">Ù‡Ø§Ø³Øª (Host)</label>
                                    <input type="text" class="form-control" id="database_host" name="database_host" value="localhost" required="required">
                                </div>

                                <div class="form-group">
                                    <label for="database_name">Ù†Ø§Ù… Ø¯ÛŒØªØ§Ø¨ÛŒØ³</label>
                                    <input type="text" class="form-control" id="database_name" name="database_name" required="required">
                                </div>

                                <div class="form-group">
                                    <label for="database_username">Ù†Ø§Ù… Ú©Ø§Ø±Ø¨Ø±ÛŒ Ø¯ÛŒØªØ§Ø¨ÛŒØ³</label>
                                    <input type="text" class="form-control" id="database_username" name="database_username" required="required">
                                </div>

                                <div class="form-group">
                                    <label for="database_password">Ø±Ù…Ø² Ø¹Ø¨ÙˆØ± Ø¯ÛŒØªØ§Ø¨ÛŒØ³</label>
                                    <input type="password" class="form-control" id="database_password" name="database_password">
                                </div>


                                  <div style="display:none">
                                    <h3 class="mt-5">Keep in touch</h3>
                                    <p>Subscribe to the newsletter and you will receive email updates of <strong>new products</strong>, <strong>discounts</strong> and <strong>product updates</strong>.</p>
            
                                    <div class="form-group row">
                                        <label for="newsletter_email" class="col-sm-2 col-form-label">Email</label>
                                        <div class="col-sm-10">
                                            <input type="email" class="form-control" id="newsletter_email" name="newsletter_email" placeholder="Your valid email address" readonly="readonly" disabled="disabled">
                                        </div>
                                    </div>
            
                                    <div class="form-group row">
                                        <label for="newsletter_name" class="col-sm-2 col-form-label">Name</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="newsletter_name" name="newsletter_name" placeholder="Your full name" readonly="readonly" disabled="disabled">
                                        </div>
                                    </div>
            
                                    <p class="text-muted"><small>By subscribing, you agree with Revueâ€™s <a target="_blank" href="https://www.getrevue.co/terms">Terms of Service</a> and <a target="_blank" href="https://www.getrevue.co/privacy">Privacy Policy</a>. Leave the fields empty if you do not wish to subscribe to the newsletter.</small></p>
                                </div>
                                

                                <button type="submit" name="submit" class="btn btn-block btn-primary mt-4">Ø§ØªÙ…Ø§Ù… Ù†ØµØ¨</button>
                            </form>
                        </section>

                             <section id="finish" style="display:none ;text-align: right;">
                            <h2 class="mb-4">Ù†ØµØ¨ Ø¨Ù‡ Ø§ØªÙ…Ø§Ù… Ø±Ø³ÛŒØ¯!</h2>

                            <div class="alert alert-success">ØªØ¨Ø±ÛŒÚ©! Ù†ØµØ¨ Ø¨Ø§ Ù…ÙˆÙÙ‚ÛŒØª Ø§Ù†Ø¬Ø§Ù… Ú¯Ø±Ø¯ÛŒØ¯</div>
                            <p>Ù‡Ù… Ø§Ú©Ù†ÙˆÙ† Ù…ÛŒØªÙˆØ§Ù†ÛŒØ¯ Ø¨Ø§ Ø§Ø·Ù„Ø§Ø¹Ø§Øª Ú©Ø§Ø±Ø¨Ø±ÛŒ Ø²ÛŒØ± ÙˆØ§Ø±Ø¯ Ú©Ù†ØªØ±Ù„ Ù¾Ù†Ù„ Ù…Ø¯ÛŒØ±ÛŒØª Ø´ÙˆÛŒØ¯</p>
                            <div class="table-responsive table-custom-container mt-4">
                                <table class="table table-custom">
                                    <tbody>
                                    <tr>
                                        <td class="font-weight-bold">Ø¢Ø¯Ø±Ø³</td>
                                        <td><a href="" id="final_url"></a></td>
                                    </tr>
                                    <tr>
                                        <td class="font-weight-bold">Ù†Ø§Ù… Ú©Ø§Ø±Ø¨Ø±ÛŒ</td>
                                        <td>admin</td>
                                    </tr>
                                    <tr>
                                        <td class="font-weight-bold">Ø±Ù…Ø² Ø¹Ø¨ÙˆØ±</td>
                                        <td>admin</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </section>
                    
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-confetti@2.12.0/tsparticles.confetti.bundle.min.js"></script>
<script src="assets/js/main.js"></script>

</body>
</html>

