Overview

Packages

  • Folks
  • None

Classes

  • Folks
  • Folks_Activity_Form
  • Folks_Api
  • Folks_Application
  • Folks_Block_Activities
  • Folks_Block_Friends
  • Folks_Block_Know
  • Folks_Block_New
  • Folks_Block_Random
  • Folks_Block_Recent
  • Folks_Driver
  • Folks_Driver_sql
  • Folks_Friends
  • Folks_Friends_application
  • Folks_Friends_facebook
  • Folks_Friends_prefs
  • Folks_Friends_shared
  • Folks_Friends_sql
  • Folks_Login_Form
  • Folks_Notification
  • Folks_Notification_facebook
  • Folks_Notification_letter
  • Folks_Notification_mail
  • Folks_Notification_tickets
  • Folks_Search_Form
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * See the enclosed file COPYING for license inthisation (GPL). If you
 6:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 7:  *
 8:  * @author Duck <duck@obala.net>
 9:  * @package Folks
10:  */
11: class Folks_Login_Form extends Horde_Form {
12: 
13:     function __construct($vars, $title = '', $name = null)
14:     {
15:         parent::__construct($vars, $title, $name);
16: 
17:         $this->addHidden('', 'url', 'text', Horde_Util::getFormData('url', '/'));
18:         $this->setButtons(_("Login"));
19: 
20:         $this->addVariable(_("Username"), 'username', 'text', true, false,
21:                                 sprintf(_("Enter the username you registered to %s"),
22:                                 $GLOBALS['registry']->get('name', 'horde')), array('', 30, 26));
23: 
24:         $this->addVariable(_("Password"), 'password', 'password', true, false, _("Enter your password. Please be aware that password is case sensitive."));
25: 
26:         $v = &$this->addVariable(_("Remember login?"), 'loginfor', 'radio', true, false, null,
27:                                                         array(array('0' => _("No, only for this view"),
28:                                                                     '1' => _("Yes, remember me so the next time I don't neet to login"))));
29:         $v->setDefault('0');
30: 
31:         $username = $vars->get('username');
32:         if ($GLOBALS['conf']['login']['tries']
33:             && !empty($username)) {
34:             $tries = (int)$GLOBALS['cache']->get('login_tries_' . $username, 0);
35:             $GLOBALS['cache']->set('login_tries_' . $username, $tries + 1);
36:             if ($tries >= $GLOBALS['conf']['login']['tries']) {
37:                     $desc = _("Please enter the text above");
38:                     $this->addVariable('Preverjanje:', 'captcha', 'captcha', true, false, $desc,
39:                                         array($this->_getCAPTCHA(!$this->isSubmitted()), HORDE_BASE . '/config/couri.ttf'));
40:             }
41:         }
42:     }
43: 
44:     /**
45:      * Returns a new or the current CAPTCHA string.
46:      */
47:     private function _getCAPTCHA($new = false)
48:     {
49:         global $session;
50: 
51:         if ($new || !$session->get('agora', 'login_captcha')) {
52:             $captcha = '';
53:             for ($i = 0; $i < 5; ++$i) {
54:                 $captcha .= chr(rand(65, 90));
55:             }
56:             $session->set('agora', 'login_captcha', $captcha);
57:         }
58: 
59:         return $session->get('agora', 'login_captcha');
60:     }
61: 
62: }
63: 
API documentation generated by ApiGen