コード例 #1
0
ファイル: shop.php プロジェクト: jvillasante/wildvapor
    }
    $params['attributes'] = $attributes;
    if (isset($params['cart'])) {
        add_to_cart($app, $db, $params);
    } elseif (isset($params['wishlist'])) {
        add_to_wish_list($app, $db, $params);
    }
});
$app->get('/shop/checkout', $require_ssl, function () use($app, $db) {
    $app->view()->set_template('layouts/basic.php');
    $app->render('shop/checkout.php', array('page_title' => 'Checkout Options'));
});
$app->get('/shop/cccheckout', $require_ssl, function () use($app, $db) {
    $flash = $app->view()->getData('flash');
    if (!isset($flash['data'])) {
        $user = \Data\UserRepository::get_user_by_id($db, $_SESSION['user_id']);
        if ($user) {
            \Helpers\User::copy_user_to_flash($user);
        }
    }
    $checkout_errors = isset($flash['checkout_errors']) ? $flash['checkout_errors'] : array();
    $app->view()->set_template('layouts/basic.php');
    $app->render('shop/cccheckout.php', array('page_title' => 'Checkout', 'checkout_errors' => $checkout_errors));
});
$app->post('/shop/cccheckout', $require_ssl, function () use($app, $db, $config) {
    $cart = $app->view()->getData('cart');
    $data = $app->request()->post();
    if (isset($cart['messages']) && count($cart['messages'])) {
        $app->flash('checkout_errors', $cart['messages']);
        $app->flash('data', $data);
        $app->redirect($app->view()->url_secure('/shop/checkout'));
コード例 #2
0
ファイル: users.php プロジェクト: jvillasante/wildvapor
            $app->redirect($app->view()->url('/users/' . $id));
        } else {
            $app->error(new \Exception($app->view()->tr('session.change.system.error')));
        }
    } else {
        $app->flash('error', $app->view()->tr('session.change.password.error'));
        $app->redirect($app->view()->url_secure('/session/' . $id . '/changepassword'));
    }
});
$app->get('/users/:id/account', $require_ssl, $authenticate, function ($id) use($app, $db) {
    if ($id != $_SESSION['user_id']) {
        $app->notFound();
    }
    $flash = $app->view()->getData('flash');
    if (!isset($flash['data'])) {
        $user = \Data\UserRepository::get_user_by_id($db, $id);
        $_SESSION['slim.flash']['data'] = $user;
    }
    $errors = isset($flash['errors']) ? $flash['errors'] : array();
    $app->view()->set_template('layouts/basic.php');
    $app->render('users/profile.php', array('page_title' => $app->view()->tr('pages.changepassword'), 'errors' => $errors));
});
$app->post('/users/:id/account', $require_ssl, $authenticate, function ($id) use($app, $db) {
    if ($id != $_SESSION['user_id']) {
        $app->notFound();
    }
    include BASE_URI . DS . 'routes' . DS . 'validators' . DS . 'profile.php';
    $data = $app->request()->post();
    $errors = validate($data);
    if ($errors) {
        $app->flash('errors', $errors);