[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare SiteMgr - Web Content Management * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: class.module_login.inc.php 20295 2006-02-15 12:31:25Z $ */ 13 14 class module_login extends Module 15 { 16 function module_login() 17 { 18 $this->arguments = array( 19 'security_redirect'=>array( 20 'type' => 'textfield', 21 'label' => lang('If nonsecure redirect to:') . '<br>'. 22 lang('(leave blank to allow insecure logins)') 23 ), 24 'login_dest' => array( 25 'type' => 'select', 26 'label' => lang('Which application should be executed after login?'), 27 'options' => array() 28 ) 29 ); 30 if (file_exists(EGW_SERVER_ROOT . '/registration')) 31 { 32 $this->arguments['registration'] = array( 33 'type' => 'checkbox', 34 'label' => lang('Display link to autoregistration below login form?') 35 ); 36 } 37 $this->properties = array(); 38 $this->title = lang('Login'); 39 $this->description = lang('This module displays a login form'); 40 $this->html =& CreateObject('phpgwapi.html'); 41 } 42 43 function get_user_interface() 44 { 45 $installed_apps = array_keys($GLOBALS['egw_info']['apps']); 46 sort($installed_apps); 47 $installed_apps = array_flip($installed_apps); 48 $chooseable_apps = array( 49 false => lang('select one'), 50 // 'user' => lang('users choice') 51 ); 52 foreach($installed_apps as $app => $lang_app) 53 { 54 $chooseable_apps[$app] = lang($app); 55 } 56 // whipe out some weired apps for this content... 57 unset($chooseable_apps['emailadmin']); 58 unset($chooseable_apps['phpgwapi']); 59 unset($chooseable_apps['manual']); 60 unset($chooseable_apps['notifywindow']); 61 unset($chooseable_apps['phpsysinfo']); 62 unset($chooseable_apps['preferences']); 63 unset($chooseable_apps['notifywindow']); 64 unset($chooseable_apps['registration']); 65 unset($chooseable_apps['skel']); 66 unset($chooseable_apps['smfbridge']); 67 $this->arguments['login_dest']['options'] = $chooseable_apps; 68 69 $config =& CreateObject('phpgwapi.config','registration'); 70 $config = $config->read_repository(); 71 if (file_exists(EGW_SERVER_ROOT . '/registration') && $config['enable_registration'] != 'True') 72 { 73 $this->arguments['registration']['label'] .= '<br><font color="red">'. 74 lang('<b>Autoregistration is not enabled / configured in the registration app !!!</b><br>You need to do so, to get the autoregistration link working.'). 75 '</font>'; 76 } 77 return parent::get_user_interface(); 78 } 79 80 function get_content(&$arguments,$properties) 81 { 82 if($GLOBALS['phpgw_info']['user']['userid'] == $GLOBALS['sitemgr_info'][anonymous_user]) 83 { 84 if (empty($arguments['security_redirect']) || $_SERVER['HTTPS']){ 85 $content = '<form name="login" action="'.phpgw_link('/login.php').'" method="post">'; 86 $content .= '<input type="hidden" name="passwd_type" value="text">'; 87 $content .= '<input type="hidden" name="logindomain" value="'. $GLOBALS['egw_info']['user']['domain'] .'">'; 88 $content .= '<center><font class="content">' . lang('Login Name') .'<br>'; 89 $content .= '<input type="text" name="login" size="8" value=""><br>'; 90 $content .= lang('Password') . '<br>'; 91 $content .= '<input name="passwd" size="8" type="password"><br>'; 92 93 if($GLOBALS['egw_info']['server']['allow_cookie_auth']) 94 { 95 $content .= '<center><font class="content">' . lang("remember me"); 96 $content .= $this->html->select('remember_me', 'forever', array( 97 false => lang('not'), 98 '1hour' => lang('1 Hour'), 99 '1day' => lang('1 Day'), 100 '1week'=> lang('1 Week'), 101 '1month' => lang('1 Month'), 102 'forever' => lang('Forever')),true 103 ); 104 $content .= '</font></center><br>'; 105 } 106 107 switch($arguments['login_dest']) 108 { 109 case false : 110 $forward = '/home'; 111 break; 112 case 'sitemgr-link' : 113 $forward = '/sitemgr-link/index.php?location='. $this->link(); 114 break; 115 case 'user' : 116 break; 117 118 default : 119 $forward = '/'.$arguments['login_dest']; 120 } 121 $content .= '<input type="hidden" name="phpgw_forward" value="'. $forward. '">'; 122 $content .= '<input type="submit" value="' . lang('Login') .'" name="submitit">'; 123 $content .= '</font></center></form>'; 124 } 125 else { 126 $content .= '<center><font class="content">'. lang("Your connection is not safe.") .'<br> '; 127 $content .= '<a href="'.$arguments['security_redirect'].'">'; 128 $content .= lang('Click here to login through a safe connection.') . '</a></font></center><br><br>'; 129 } 130 if (file_exists(EGW_SERVER_ROOT . '/registration') && $arguments['registration']) 131 { 132 $content .= '<center><font class="content">' . lang("Don't have an account?") .' '; 133 $content .= '<a href="'.phpgw_link('/registration/index.php').'"><br/>'; 134 $content .= lang('Register for one now.') . '</a></font></center>'; 135 } 136 } 137 else 138 { 139 $content = '<form name="login" action="'.phpgw_link('/logout.php').'" method="post">'; 140 $content .= '<font class="content">'. lang('Loged in as:') .'<br>'; 141 $content .= ' ['.$GLOBALS['phpgw_info']['user']['userid']. '] '. $GLOBALS['phpgw_info']['user']['fullname']; 142 $content .= '</font><br><br><center>'; 143 $content .= '<input type="submit" value="' . lang('Logout') .'" name="submitit">'; 144 $content .= '</center></form>'; 145 } 146 return $content; 147 } 148 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |