<?php

/**
 * session.php
 */
$conf = new Configurations();
$conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');

echo '<style>
    table {
        border-collapse: collapse;
        width: 100%;
        margin: 20px 20px;
        font-family: Arial, sans-serif;
        font-size: 13px;
    }
    th, td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
        word-wrap: break-word;
        max-width: 300px;
    }
    th {
        background-color: #f4f4f4;
        font-weight: bold;
    }
    tr:nth-child(even) {
        background-color:rgba(249, 249, 249, 0.91);
    }
    tr:nth-child(odd) {
        background-color: #ffffff;
    }
    tr:hover {
        background-color:rgba(202, 228, 181, 0.93);
    }
</style>';

echo '<table>';
echo '<tr><th>Variable</th><th>Key</th><th>Value</th></tr>';

foreach (['_SESSION' => $_SESSION, '_COOKIE' => $_COOKIE, '_ENV' => $_ENV] as $varName => $varData) {
    foreach ($varData as $key => $value) {
        echo '<tr>';
        echo '<td>' . htmlspecialchars($varName) . '</td>';
        echo '<td>' . htmlspecialchars($key) . '</td>';
        echo '<td>' . htmlspecialchars(is_array($value) ? json_encode($value) : $value) . '</td>';
        echo '</tr>';
    }
}

echo '</table>';
die;

if (isset($conf->aConfig["login_enableForgotPassword"]) && $conf->aConfig["login_enableForgotPassword"] == "1") {
    $G_PUBLISH = new Publisher();
    $version = explode('.', trim(file_get_contents(PATH_GULLIVER . 'VERSION')));
    $version = isset($version[0]) ? intval($version[0]) : 0;
    if ($version >= 3) {
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/forgotPasswordpm3', '', array(), 'retrivePassword.php');
    } else {
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
    }
    G::RenderPage("publish");
} else {
    G::header('Location: /errors/error403.php');
    die();
}
