public function export()
 {
     $databaseManager = new DatabaseManager();
     $tables = ['users', 'categories', 'definitions', 'examples', 'terms'];
     $table = $databaseManager->findAllTables($tables);
     $this->showJson($table);
 }
Example #2
0
<?php

namespace ajax;

use Manager\DatabaseManager;
header('Content-type: text/html; charset="UTF-8";');
if (count($_POST) > 0) {
    session_start();
    include_once '../translations/label_' . $_SESSION['locale'] . '.php';
    require_once '../Model/InitConsts.php';
    require_once '../Manager/DatabaseManager.php';
    $dm = new DatabaseManager();
    $output = $dm->updateUserPassword(['password' => trim($_POST['password']), 'email' => $_POST['email']]);
    if (is_bool($output)) {
        $userDatas = $dm->fetchUser($_POST['email'], trim($_POST['password']));
        if (is_array($userDatas)) {
            $_SESSION['customer_email'] = $userDatas['email'];
            $_SESSION['customer_id'] = $userDatas['id'];
            echo '<a href="../order">' . CONNECTION . '</a>';
        } else {
            $errorMsg = $userDatas;
        }
    } else {
        $errorMsg = $output;
    }
    if (isset($errorMsg)) {
        echo 'e<a href="#" onclick="updatePasswd();">' . UPDATE . '</a><br><font color="red">' . $errorMsg . '</font>';
    }
}
Example #3
0
//entry const file translation
if (isset($_SESSION['customer_email']) && !empty($_SESSION['customer_email'])) {
    header('Location: ../');
}
if (isset($_GET['do']) && trim($_GET['do']) === 'logout') {
    //logout
    unset($_SESSION['customer_email']);
    unset($_SESSION['customer_id']);
}
if (count($_POST) > 0) {
    require_once '../Model/InitConsts.php';
    require_once '../Manager/UtilitiesManager.php';
    $a_cleaned_values = UtilitiesManager::checkEmptyDatasPost($_POST);
    if (is_array($a_cleaned_values)) {
        require_once '../Manager/DatabaseManager.php';
        $dm = new DatabaseManager();
        $output = $dm->fetchUser($a_cleaned_values['email'], $a_cleaned_values['password']);
        if (is_array($output)) {
            if ($output['password'] !== InitConsts::HASH_PASSWD) {
                $_SESSION['customer_email'] = $output['email'];
                $_SESSION['customer_id'] = $output['id'];
                header('Location: ../');
            } else {
                $errorMsg = WRONG_LOGIN_PAGE . ' <a href="../firstLogin">login</a>';
            }
            //if user try to login with PSK as password in classic login page
        } else {
            $errorMsg = $output;
        }
    } else {
        $errorMsg = INPUTS_MANDATORIES;
Example #4
0
<?php

namespace ajax;

use Manager\DatabaseManager;
if (count($_POST) > 0) {
    $isEmptyField = FALSE;
    foreach ($_POST as $k => $v) {
        $cleanedValue = trim($v);
        if (!empty($cleanedValue)) {
            $a[$k] = $cleanedValue;
        } else {
            $isEmptyField = TRUE;
            break;
        }
    }
    if (!$isEmptyField) {
        require_once '../Manager/DatabaseManager.php';
        $dbm = new DatabaseManager();
        $outputDBM = $dbm->updateUserPassword($_POST);
        if ($outputDBM) {
            $sucessMsg = 'Password updated!';
        } else {
            $errorMsg = $outputDBM;
        }
    } else {
        $errorMsg = 'All inputs are mandatories';
    }
    echo isset($errorMsg) ? 'e<font color="red">' . $errorMsg . '</font>' : '<font color="green">' . $sucessMsg . '</font>';
}
Example #5
0
use Model\InitConsts as IC;
if (count($_POST) > 0) {
    session_start();
    require_once '../Model/InitConsts.php';
    //ENTRY POINT of execution => first class to be called then no need to require again IC
    include_once '../translations/label_' . (isset($_SESSION['locale']) ? $_SESSION['locale'] : 'fr') . '.php';
    if (isset($_SESSION['customer_email']) && !empty($_SESSION['customer_email'])) {
        foreach ($_POST as $k => $v) {
            $cleanedValues = trim($v);
            if (!empty($cleanedValues)) {
                $datasPost[$k] = $cleanedValues;
            }
        }
        $errorMsg = '';
        include_once '../Manager/DatabaseManager.php';
        $dbm = new DatabaseManager();
        include_once '../Manager/FileManager.php';
        $fm = new FileManager($_SESSION['customer_email'], $dbm->dateOrder);
        $outputCSV = $fm->formatAndWriteCSV($_POST);
        // here we still pass all the original POST array to retrieve even empty ref
        if (is_string($outputCSV)) {
            $errorMsg .= $outputCSV . '<br>';
        }
        $outputPDF = $fm->formatAndWritePDF($datasPost, $_SESSION['customer_email']);
        if (is_string($outputPDF)) {
            $errorMsg .= $outputPDF . '<br>';
        }
        $savedOrder = $dbm->saveOrder($datasPost, is_bool($outputPDF) && is_bool($outputCSV), $_SESSION['customer_id']);
        if (is_string($savedOrder)) {
            $errorMsg .= $savedOrder . '<br>';
        }
Example #6
0
namespace ajax;

header('Content-type: text/html; charset="UTF-8";');
use Manager\DatabaseManager;
use Manager\UtilitiesManager;
if (isset($_POST) && count($_POST) > 0) {
    session_start();
    include_once '../translations/label_' . (isset($_SESSION['locale']) ? $_SESSION['locale'] : 'fr') . '.php';
    require_once '../Model/InitConsts.php';
    require_once '../Manager/UtilitiesManager.php';
    $a_cleaned_values = UtilitiesManager::checkEmptyDatasPost($_POST);
    if (is_array($a_cleaned_values)) {
        if (FALSE !== stripos($a_cleaned_values['email'], '@') && FALSE !== stripos($a_cleaned_values['email'], '.')) {
            require_once '../Model/InitConsts.php';
            require_once '../Manager/DatabaseManager.php';
            $mm = new DatabaseManager();
            $output = $mm->fetchUser($a_cleaned_values['email']);
            if (is_bool($output)) {
                if ($output) {
                    echo '<br><input type="password" name="password" placeholder="' . PASSWD . ' 6 ' . CHARS . '">';
                    echo '<br><br><a href="#" onclick="document.getElementById(\'the_form\').submit();">' . CONNECTION . '</a>';
                } else {
                    echo '<input type="hidden" name="first_login" value="true">';
                    echo '<br><input type="password" name="psk" placeholder="' . PSK . '">';
                    echo '<br><input type="password" name="new_password" placeholder="' . PASSWD . ' 6 ' . CHARS . '">';
                    echo '<br><br><a href="#" onclick="document.getElementById(\'the_form\').submit();">' . CONNECTION . '</a>';
                }
            } else {
                echo 'e<font color="red">' . $output . '</font>';
            }
        }
<?php

namespace ajax;

use Manager\DatabaseManager;
use Manager\MailManager;
use Model\InitConsts;
header('Content-type: text/html; charset="UTF-8";');
if (count($_POST) > 0) {
    $rescueEmail = trim($_POST['email_rescue']);
    if (strlen($rescueEmail) > 5) {
        session_start();
        include_once '../translations/label_' . $_SESSION['locale'] . '.php';
        require_once '../Model/InitConsts.php';
        require_once '../Manager/DatabaseManager.php';
        $dm = new DatabaseManager();
        $outputdm = $dm->fetchUser($rescueEmail);
        if (is_bool($outputdm)) {
            //using redis to store temporary hash and email info
            $hash = sha1(microtime(TRUE));
            $redis = new \Redis();
            $redis->connect('127.0.0.1');
            $redis->set($rescueEmail, $hash, 60 * 60);
            require_once '../Manager/MailManager.php';
            $resetLink = 'http://tampoon.net/resetPassword/?email=' . $rescueEmail . '&hash=' . $hash;
            $msg = '<html><body><br><a href="' . $resetLink . '">' . CLICK_TO_RESET_PASSWD . '</a>';
            $msg .= '<br>' . COPY_RESET_PASSWD_URL;
            $msg .= '<br>' . $resetLink;
            $msg .= '<br><font color="red>"' . AVAILABLE_24H . '</font>';
            $msg .= '</body></html>';
            $mm = new MailManager($rescueEmail, InitConsts::GMAIL_BOX, RESET_PASSWORD, $msg);
Example #8
0
session_start();
include_once '../translations/label_' . (isset($_SESSION['locale']) ? $_SESSION['locale'] : 'fr') . '.php';
//entry const file translation
if (isset($_SESSION['customer_email']) && !empty($_SESSION['customer_email'])) {
    header('Location: ../order');
}
if (count($_POST) > 0) {
    require_once '../Model/InitConsts.php';
    require_once '../Manager/UtilitiesManager.php';
    $a_cleaned_values = UtilitiesManager::checkEmptyDatasPost($_POST);
    if (is_array($a_cleaned_values)) {
        $firstLoginRequirements = UtilitiesManager::checkUserFirstLoginRequirement($a_cleaned_values);
        //especially that the passwd != PSK otherwise failure on affected_rows sql
        if (is_bool($firstLoginRequirements)) {
            require_once '../Manager/DatabaseManager.php';
            $dm = new DatabaseManager();
            $output = $dm->fetchUser($a_cleaned_values['email'], $a_cleaned_values['new_password']);
            //careful: new_password
            if (is_string($output)) {
                $output2 = $dm->updatePasswdAndlogin($a_cleaned_values);
                if (is_array($output2)) {
                    $_SESSION['customer_email'] = $output2['email'];
                    $_SESSION['customer_id'] = $output2['id'];
                    header('Location: ../');
                } else {
                    $errorMsg = $output2;
                }
            } else {
                $errorMsg = WRONG_LOGIN_PAGE . ' <a href="../login">login</a>';
            }
            //array: if user already exists in db with another password than PSK need to redirect
Example #9
0
    echo UNITS;
    ?>
</label>&nbsp;<input type="radio" value="2" name="standing_unit">
        </p>
    </div>
<?php 
}
?>
    <div id="infos"><p id="return_from_makeSum" style="margin-bottom: 0;"></p></div>

</div>
<div id="main">
    <form method="post" name="the_form">
        <?php 
require_once 'Manager/DatabaseManager.php';
$dbm = new DatabaseManager();
$outputDBM = $dbm->fetchItemInfos($_SESSION['item'], FALSE);
foreach ($outputDBM as $rows) {
    $icon = 'icon/' . $_SESSION['item'] . '/' . $rows['reference'] . '.jpg';
    echo '<div class="container_icon" id="container_' . $rows['reference'] . '"><table><tr><td><img class="icon" src="' . $icon . '" /></td></tr>';
    echo '<tr><td>' . $rows['reference'] . '</td></tr>';
    echo '<tr><td>';
    echo '<input placeholder="' . ($rows['quantity'] < 0 ? 0 : $rows['quantity']) . '" type="number" min="0" max="99"';
    echo ' id="' . $rows['reference'] . '" name="' . $rows['reference'] . '" onclick="makeSum(this);" onkeyup="makeSum(this);" ';
    echo 'onchange="switchDivDisplay(this.value, \'container_' . $rows['reference'] . '\')" ';
    echo 'onfocus="if(document.getElementById(\'checkvalues\').style.visibility === \'visible\') document.getElementById(\'checkvalues\').style.visibility = \'hidden\';"/>';
    echo '&nbsp;<span id="span_' . $rows['reference'] . '"' . ($rows['quantity'] > 0 ? '>dispo' : 'class="asterisk">*') . '</span>';
    echo '</td></tr>';
    echo '</table></div>';
}
?>