Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Hooks
  • Module
  • NonceLoginOperation
  • NonceLoginRequestOperation
  • NonceRequestForm
  • Ticket
  • TicketModel
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Users\NonceLogin;
13 
14 use ICanBoogie\Operation\ProcessEvent;
15 use ICanBoogie\I18n\Translator\Proxi;
16 use ICanBoogie\Mailer;
17 
18 class Hooks
19 {
20     /**
21      * Sends an email to the user requesting a nonce login.
22      *
23      * @param ProcessEvent $event
24      * @param NonceLoginRequestOperation $target
25      */
26     static public function on_nonce_login_request(ProcessEvent $event, NonceLoginRequestOperation $target)
27     {
28         global $core;
29 
30         $user = $target->user;
31         $ticket = $target->ticket;
32 
33         $route = $core->routes['api:nonce-login'];
34         $url = $core->site->url . $route->format($ticket);
35         $until = $ticket->expire_at->local->format('H:i');
36 
37         $t = new Proxi(array('scope' => \ICanBoogie\normalize($user->constructor, '_') . '.nonce_login_request.operation'));
38 
39         $core->mailer(array
40         (
41             Mailer::T_DESTINATION => $user->email,
42             Mailer::T_FROM => $core->site->title . ' <no-reply@icybee.org>', // TODO-20110709: customize to site domain
43             Mailer::T_SUBJECT => $t('message.subject'),
44             Mailer::T_MESSAGE => $t
45             (
46                 'message.template', array
47                 (
48                     ':url' => $url,
49                     ':until' => $until,
50                     ':ip' => $event->request->ip
51                 )
52             )
53         ));
54     }
55 }
Autodoc API documentation generated by ApiGen 2.8.0