コード例 #1
0
ファイル: unsubscribe.php プロジェクト: hughnguy/php
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('survey', true);
if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) {
    $l10n->setLanguage($SESSION->corr_lang);
    \Locale::setDefault($SESSION->corr_lang);
}
//============================================================================================
// Model and Header and L10N Includes, Authentication
//============================================================================================
$model = new Unsubscribe($dbo);
require FS_INCLUDES . '/l10n/header-external.php';
//============================================================================================
// Load the content
//============================================================================================
if (!isset($_GET['user']) || !$model->checkUserExists($_GET['user'])) {
    $l10n->addResource(__DIR__ . '/l10n/error.json');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/error.php';
    require_once FS_PHP . '/footer-external.php';
} else {
    $user = $_GET['user'];
    $student = $model->fetchStudentByHashCode($user);
    if (!isset($_GET['page'])) {
        if ($model->checkUnsubscribe($student[0]['student_id'])) {
            header("Location: unsubscribe.php?page=complete&user={$user}");
        }
        $l10n->addResource(__DIR__ . '/l10n/unsubscribe.json');
        require_once FS_PHP . '/header-external.php';
        require_once 'views/unsubscribe.php';
        require_once FS_PHP . '/footer-external.php';