Overview

Packages

  • Horde
  • None

Classes

  • Horde_Ajax_Application
  • Horde_Api
  • Horde_Block_Account
  • Horde_Block_Account_Base
  • Horde_Block_Account_Finger
  • Horde_Block_Account_Ldap
  • Horde_Block_Account_Localhost
  • Horde_Block_Cloud
  • Horde_Block_FbStream
  • Horde_Block_Feed
  • Horde_Block_Fortune
  • Horde_Block_Google
  • Horde_Block_Iframe
  • Horde_Block_Metar
  • Horde_Block_Moon
  • Horde_Block_Sunrise
  • Horde_Block_Time
  • Horde_Block_TwitterTimeline
  • Horde_Block_Vatid
  • Horde_Block_Weather
  • Horde_LoginTasks_SystemTask_GarbageCollection
  • Horde_LoginTasks_SystemTask_Upgrade
  • Horde_LoginTasks_Task_AdminCheck
  • Horde_LoginTasks_Task_LastLogin
  • Horde_LoginTasks_Task_TosAgreement
  • Horde_Prefs_Ui
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Login tasks module that presents a TOS Agreement page to user.
 4:  * If user does not accept terms, user is not allowed to login.
 5:  *
 6:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file COPYING for license information (GPL). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/gpl.
10:  *
11:  * @author   Michael Slusarz <slusarz@horde.org>
12:  * @category Horde
13:  * @license  http://www.horde.org/licenses/gpl GPL
14:  * @package  Horde
15:  */
16: class Horde_LoginTasks_Task_TosAgreement extends Horde_LoginTasks_Task
17: {
18:     /**
19:      * The interval at which to run the task.
20:      *
21:      * @var integer
22:      */
23:     public $interval = Horde_LoginTasks::FIRST_LOGIN;
24: 
25:     /**
26:      * The style of the page output.
27:      *
28:      * @var integer
29:      */
30:     public $display = Horde_LoginTasks::DISPLAY_AGREE;
31: 
32:     /**
33:      * The priority of the task.
34:      *
35:      * @var integer
36:      */
37:     public $priority = Horde_LoginTasks::PRIORITY_HIGH;
38: 
39:     /**
40:      * Constructor.
41:      */
42:     public function __construct()
43:     {
44:         global $conf;
45: 
46:         $this->active = false;
47: 
48:         if (!empty($conf['tos']['file'])) {
49:             if (file_exists($conf['tos']['file'])) {
50:                 $this->active = true;
51:             } else {
52:                 Horde::logMessage('Terms of Service Agreement file was not found: ' . $conf['tos']['file'], 'ERR');
53:             }
54:         }
55:     }
56: 
57:     /**
58:      * Determine if user agreed with the terms or not.  If the user does not
59:      * agree, log him/her out immediately.
60:      */
61:     public function execute()
62:     {
63:         if (Horde_Util::getFormData('not_agree')) {
64:             $GLOBALS['registry']->authenticateFailure('horde', new Horde_Exception(_("You did not agree to the Terms of Service agreement, so you were not allowed to login."), Horde_Registry::PERMISSION_DENIED));
65:         }
66:     }
67: 
68:     /**
69:      * Returns the TOS agreement for display on the login tasks page.
70:      *
71:      * @return string  The terms of service agreement.
72:      */
73:     public function describe()
74:     {
75:         return file_get_contents($GLOBALS['conf']['tos']['file']);
76:     }
77: 
78: }
79: 
API documentation generated by ApiGen