[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sitemgr/modules class.module_logout.inc.php, 1.1.2.1
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] sitemgr/modules class.module_logout.inc.php, 1.1.2.1 class.module_login.inc.php, 1.1.2.1.4.1 class.module_external_html.inc.php, 1.1.4.2 class.module_contactus.inc.php, 1.1.2.2 |
Date: |
Sun, 13 Nov 2005 05:08:00 +0100 |
Update of sitemgr/modules
Added Files:
Branch: skwashd-16-compat
class.module_logout.inc.php lines: +68 -0
Modified Files:
Branch: skwashd-16-compat
class.module_login.inc.php lines: +108 -31
class.module_external_html.inc.php lines: +2 -1
class.module_contactus.inc.php lines: +1 -0
Log Message:
more modules and more changes and updates
====================================================
Index: class.module_logout.inc.php
<?php
/*******************************************************************************\
* phpGroupWare - sitemgr - login handler, based on logout.php
*
* http://www.phpgroupware.org
*
* Written by Dave Hall skwashd at phpgroupware.org
*
* Copyright (C) 2005 Free Software Foundation Inc.
*
* --------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by
the *
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\*******************************************************************************/
/* $Id: class.module_logout.inc.php,v 1.1.2.1 2005/11/13 04:08:17
skwashd Exp $ */
class module_logout extends Module
{
function module_logout()
{
$this->properties = array();
$this->title = lang('Logout');
$this->description = lang('This module logs a user out
of phpgw and sitemgr');
}
function get_content(&$arguments,$properties)
{
$site_info =
$GLOBALS['Common_BO']->sites->get_currentsiteinfo();
/* Lifted from logout.php */
$GLOBALS['sessionid'] =
get_var('sessionid',array('GET','COOKIE'));
$GLOBALS['kp3'] = get_var('kp3',array('GET','COOKIE'));
$verified = $GLOBALS['phpgw']->session->verify();
if ($verified)
{
if
(file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['sessionid']))
{
$dh =
opendir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['sessionid']);
while ($file = readdir($dh))
{
if ($file != '.' && $file !=
'..')
{
unlink($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['sessionid'] . SEP . $file);
}
}
rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP .
$GLOBALS['sessionid']);
}
$GLOBALS['phpgw']->hooks->process('logout');
$GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
}
else
{
if(is_object($GLOBALS['phpgw']->log))
{
$GLOBALS['phpgw']->log->write(array(
'text' => 'W-VerifySession,
could not verify session during logout',
'line' => __LINE__,
'file' => __FILE__
));
}
}
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
Header("Location: {$site_info['site_url']}");
exit;
}
}
?>
====================================================
Index: sitemgr/modules/class.module_login.inc.php
diff -u sitemgr/modules/class.module_login.inc.php:1.1
sitemgr/modules/class.module_login.inc.php:1.1.2.1.4.1
--- sitemgr/modules/class.module_login.inc.php:1.1 Tue Mar 4 17:57:00 2003
+++ sitemgr/modules/class.module_login.inc.php Sun Nov 13 04:08:17 2005
@@ -1,37 +1,114 @@
-<?php
+<?php
+
/*******************************************************************************\
+ * phpGroupWare - sitemgr - login handler, based on login.php
*
+ * http://www.phpgroupware.org
*
+ * Written by Dave Hall skwashd at phpgroupware.org
*
+ * Copyright (C) 2005 Free Software Foundation Inc.
*
+ * --------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
the *
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\*******************************************************************************/
+ /* $Id */
-class module_login extends Module
-{
- function module_login()
+ class module_login extends Module
{
- $this->arguments = array(
- 'registration' => array(
- 'type' => 'checkbox',
- 'label' => 'Display link to autoregistration
below login form?'
- )
- );
- $this->properties = array();
- $this->title = "Login";
- $this->description = "This module displays a login form";
- }
+ function module_login()
+ {
+ $this->arguments = array(
+ 'registration' => array(
+ 'type' => 'checkbox',
+ 'label' => lang('Display link to
autoregistration below login form?')
+ )
+ );
+ $this->properties = array();
+ $this->title = lang('Login');
+ $this->description = lang('This module displays a login
form');
+ }
- function get_content(&$arguments,$properties)
- {
- $content = '<form name="login"
action="'.phpgw_link('/login.php').'" method="post">';
- $content .= '<input type="hidden" name="passwd_type"
value="text">';
- $content .= '<input type="hidden" name="phpgw_forward"
value="/sitemgr/">';
- $content .= '<center><font class="content">' . lang('Login
Name') .'<br>';
- $content .= '<input type="text" name="login" size="8"
value=""><br>';
- $content .= lang('Password') . '<br>';
- $content .= '<input name="passwd" size="8"
type="password"><br>';
- $content .= '<input type="submit" value="' . lang('Login') .'"
name="submitit">';
- $content .= '</font></center></form>';
- if ($arguments['registration'])
+ //We disregard the normal form builder system in order to make
this simpler
+ function get_content(&$arguments,$properties)
+ {
+ $err = '';
+ if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
+ {
+ $login = $_POST['login'];
+ if ( strstr($login, '@') === False )
+ {
+ $login .=
"@{$sitemgr_info['phpgw_domain']}";
+ }
+ $GLOBALS['sessionid'] =
$GLOBALS['phpgw']->session->create($login,$_POST['passwd'],$_POST['passwd_type']);
+
+ if ( isset($GLOBALS['sessionid']) &&
$GLOBALS['sessionid'] )
+ {
+ $url = $_SERVER['REQUEST_URI'];
//"index.php?{$_SERVER['QUERY_STRING']}";
+ Header('Location: ' . $url);
+ exit;
+ }
+ else
+ {
+ $err =
$this->check_logoutcode($GLOBALS['phpgw']->session->cd_reason);
+ }
+ }
+
+ $content = '';
+ if ( $err )
+ {
+ $content .= "<div style=\"color: #f00;
text-align: center;\">{$err}</div>\n";
+ }
+
+ $url = $_SERVER['REQUEST_URI'];
+
+ $content .= '<form name="login" action="' . $url . '"
method="POST">';
+ $content .= '<input type="hidden" name="passwd_type"
value="text" />';
+ $content .= '<label for"sitemgr_login_login">' .
lang('Login Name') ."</label>";
+ $content .= '<input type="text" name="login"
value=""><br />' . "\n";
+ $content .= '<label for="sitemgr_login_passwd">' .
lang('Password') . "</label>";
+ $content .= '<input name="passwd" size="8"
type="password"><br />' . "\n";
+ $content .= '<button type="submit" name="submitit"
value="1">' . lang('Login') .'</button">';
+ $content .= '</div></form>';
+ if ($arguments['registration'])
+ {
+ $content .= '<center><font class="content">' .
lang("Don't have an account?") .' ';
+ $content .= '<a
href="'.phpgw_link('/registration/index.php').'">';
+ $content .= lang('Register for one now.') .
'</a></font></center>';
+ }
+ return $content;
+ }
+
+ function check_logoutcode($code)
{
- $content .= '<center><font class="content">' .
lang("Don't have an account?") .' ';
- $content .= '<a
href="'.phpgw_link('/registration/index.php').'">';
- $content .= lang('Register for one now.') .
'</a></font></center>';
+ switch($code)
+ {
+ case 1:
+ return lang('You have been successfully
logged out');
+ break;
+ case 2:
+ return lang('Sorry, your login has
expired');
+ break;
+ case 5:
+ return '<span style="color: f00;">' .
lang('Bad login or password') . '</font>';
+ break;
+ case 99:
+ return '<span style="color: f00;">' .
lang('Blocked, too many attempts') . '</font>';
+ break;
+ case 10:
+
$GLOBALS['phpgw']->sessions->phpgw_setcookie('sessionid');
+
$GLOBALS['phpgw']->sessions->phpgw_setcookie('kp3');
+
$GLOBALS['phpgw']->sessions->phpgw_setcookie('domain');
+
+ //fix for bug php4 expired sessions bug
+
if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4')
+ {
+
$GLOBALS['phpgw']->sessions->phpgw_setcookie(PHPGW_PHPSESSID);
+ }
+
+ return '<font color=#FF0000>' .
lang('Your session could not be verified.') . '</font>';
+ break;
+ default:
+ return ' ';
+ }
}
- return $content;
}
-}
\ No newline at end of file
+?>
====================================================
Index: sitemgr/modules/class.module_external_html.inc.php
diff -u sitemgr/modules/class.module_external_html.inc.php:1.1.4.1
sitemgr/modules/class.module_external_html.inc.php:1.1.4.2
--- sitemgr/modules/class.module_external_html.inc.php:1.1.4.1 Sun Nov 13
01:36:00 2005
+++ sitemgr/modules/class.module_external_html.inc.php Sun Nov 13 04:08:17 2005
@@ -10,6 +10,7 @@
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\*******************************************************************************/
+ /* $Id$ */
class module_external_html extends Module
{
@@ -35,7 +36,7 @@
if( $page )
{
- if( strpos($page, '<html>') )
+ if( stripos($page, '<html') ) /// just in case
it is <HTML or a variant
{
$page = preg_replace('/\r/', '', $page);
$page = preg_replace('/\n/', '', $page);
====================================================
Index: sitemgr/modules/class.module_contactus.inc.php
diff -u sitemgr/modules/class.module_contactus.inc.php:1.1.2.1
sitemgr/modules/class.module_contactus.inc.php:1.1.2.2
--- sitemgr/modules/class.module_contactus.inc.php:1.1.2.1 Sun Nov 13
01:36:00 2005
+++ sitemgr/modules/class.module_contactus.inc.php Sun Nov 13 04:08:17 2005
@@ -10,6 +10,7 @@
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\*******************************************************************************/
+ /* $Id$ */
class module_contactus extends Module
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sitemgr/modules class.module_logout.inc.php, 1.1.2.1 class.module_login.inc.php, 1.1.2.1.4.1 class.module_external_html.inc.php, 1.1.4.2 class.module_contactus.inc.php, 1.1.2.2,
skwashd <=