DIBuilder::setupNormal($container); $config = $container->get('config'); /* @var $config Config */ $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : null; $code = isset($_REQUEST['code']) ? $_REQUEST['code'] : null; $validation = null; if (!$email || !$code) { exit; } $form = new Form(); $form->import($_REQUEST); $form->addRule(ActivationsDAO::EMAIL, Rules::email(), 'email в таком формате не может существовать.', 'emailPattern')->addRule(ActivationsDAO::EMAIL, function ($val) { $user = UserDAO::create()->getByEmail($val); return (bool) $user->getId(); }, 'Такой email не найден в системе.', 'userSearch'); $validation = $form->validate(); if (!$validation) { $heading = 'Ошибка!'; $message = 'Email невалиден.'; require_once "pages/common_page.php"; exit; } $activation = ActivationsDAO::create(); $result = $activation->getActivation($email, $code); $activation = $result[0]; /* @var $activation ActivationsDAO */ if (!$activation->getId() || $activation->getIsUsed()) { $heading = 'Ошибка!'; $message = 'Извините, но код невалиден.'; require_once "pages/common_page.php"; exit;