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:  * Copyright 2001-2012 Horde LLC (http://www.horde.org/)
  4:  *
  5:  * See the enclosed file COPYING for license information (LGPL). If you
  6:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  7:  *
  8:  * @author  Eric Jon Rostetter <eric.rostetter@physics.utexas.edu>
  9:  * @author  Jan Schneider <jan@horde.org>
 10:  * @package Horde
 11:  */
 12: class Horde_Block_Account extends Horde_Core_Block
 13: {
 14:     /**
 15:      */
 16:     public function __construct($app, $params = array())
 17:     {
 18:         parent::__construct($app, $params);
 19:         $this->_name = _("Account Information");
 20:     }
 21: 
 22:     /**
 23:      */
 24:     protected function _title()
 25:     {
 26:         return _("My Account Information");
 27:     }
 28: 
 29:     /**
 30:      */
 31:     protected function _content()
 32:     {
 33:         global $registry, $conf;
 34: 
 35:         $params = array_merge(
 36:             (array)$conf['accounts']['params'],
 37:             array('user' => $registry->getAuth()));
 38: 
 39:         switch ($conf['accounts']['driver']) {
 40:         case 'null':
 41:             $mydriver = new Horde_Block_Account_Base($params);
 42:             break;
 43: 
 44:         case 'localhost':
 45:         case 'finger':
 46:         //case 'kolab':
 47:             $class = 'Horde_Block_Account_' . Horde_String::ucfirst($conf['accounts']['driver']);
 48:             $mydriver = new $class($params);
 49:             break;
 50: 
 51:         case 'ldap':
 52:             $params = Horde::getDriverConfig('accounts', 'ldap');
 53:             $params['ldap'] = $GLOBALS['injector']
 54:                 ->getInstance('Horde_Core_Factory_Ldap')
 55:                 ->create('horde', 'accounts');
 56:             $params['user'] = $registry->getAuth($params['strip'] ? 'bare' : null);
 57:             $mydriver = new Horde_Block_Account_Ldap($params);
 58:             break;
 59: 
 60:         default:
 61:             return '';
 62:         }
 63: 
 64:         try {
 65:             // Check for password status.
 66:             $status = $mydriver->checkPasswordStatus();
 67: 
 68:             $table = array(_("User Name") => $mydriver->getUsername());
 69:             if ($fullname = $mydriver->getFullname()) {
 70:                 $table[_("Full Name")] = $fullname;
 71:             }
 72:             if ($home = $mydriver->getHome()) {
 73:                 $table[_("Home Directory")] = $home;
 74:             }
 75:             if ($shell = $mydriver->getShell()) {
 76:                 $table[_("Default Shell")] = $shell;
 77:             }
 78:             if ($quota = $mydriver->getQuota()) {
 79:                 $table[_("Quota")] = sprintf(
 80:                     _("%.2fMB used of %.2fMB allowed (%.2f%%)"),
 81:                     $quota['used'] / ( 1024 * 1024.0),
 82:                     $quota['limit'] / ( 1024 * 1024.0),
 83:                     ($quota['used'] * 100.0) / $quota['limit']);
 84:             }
 85:             if ($lastchange = $mydriver->getPasswordChange()) {
 86:                 $table[_("Last Password Change")] = $lastchange;
 87:             }
 88:         } catch (Horde_Exception $e) {
 89:             return $e->getMessage();
 90:         }
 91: 
 92:         $output = '<table class="item" width="100%" cellspacing="1">';
 93: 
 94:         if ($status) {
 95:             $output .= '<tr><td colspan="2"><p class="notice">' .
 96:                 Horde::img('alerts/warning.png', _("Warning")) .
 97:                 '&nbsp;&nbsp;' . $status . '</p></td></tr>';
 98:         }
 99: 
100:         foreach ($table as $key => $value) {
101:             $output .= "<tr class=\"text\"><td>$key</td><td>$value</td></tr>\n";
102:         }
103:         $output .= "</table>\n";
104: 
105:         if (!$registry->isInactive('forwards') &&
106:             $registry->hasMethod('summary', 'forwards')) {
107:             try {
108:                 $summary = $registry->callByPackage('forwards', 'summary');
109:                 $output .= '<br />' . $summary . "\n";
110:             } catch (Exception $e) {
111:             }
112:         }
113: 
114:         if (!$registry->isInactive('vacation') &&
115:             $registry->hasMethod('summary', 'vacation')) {
116:             try {
117:                 $summary = $registry->callByPackage('vacation', 'summary');
118:                 $output .= '<br />' . $summary . "\n";
119:             } catch (Exception $e) {
120:             }
121:         }
122: 
123:         return $output;
124:     }
125: }
126: 
API documentation generated by ApiGen