re-built the sessions class, and other connected classes

This commit is contained in:
seek3r 2000-09-03 07:56:11 +00:00
parent 1274d5e146
commit 8cb4dc8fba
2 changed files with 36 additions and 24 deletions

View File

@ -63,6 +63,12 @@
<?php
//echo '<a href="javascript:opennotifywindow()">Open notify window</a>';
switch($code){
case "5":
echo lang("You do not have permissions to that application");
break;
}
if ($phpgw_info["user"]["permissions"]["email"]
&& $phpgw_info["user"]["preferences"]["mainscreen_showmail"]) {
echo "<!-- Mailox info -->\n";
@ -90,7 +96,7 @@
echo "<!-- Birthday info -->\n";
$phpgw->db->query("select DISTINCT firstname,lastname from addressbook where "
. "bday like '" . $phpgw->common->show_date(time(),"n/d")
. "/%' and (owner='" . $phpgw->session->loginid . "' or access='"
. "/%' and (owner='" . $phpgw_info["user"]["userid"] . "' or access='"
. "public')");
while ($phpgw->db->next_record()) {
echo "<tr><td>" . lang_common("Today is x's birthday!", $phpgw->db->f("firstname") . " "
@ -102,7 +108,7 @@
$phpgw->common->show_date(time(),"Y")),"n/d" );
$phpgw->db->query("select firstname,lastname from addressbook where "
. "bday like '$tommorow/%' and (owner='"
. $phpgw->session->loginid . "' or access='public')");
. $phpgw_info["user"]["userid"] . "' or access='public')");
while ($phpgw->db->next_record()) {
echo "<tr><td>" . lang_common("Tommorow is x's birthday.", $phpgw->db->f("firstname") . " "
. $phpgw->db->f("lastname")) . "</td></tr>\n";
@ -119,10 +125,10 @@
&& $phpgw_info["user"]["preferences"]["mainscreen_showevents"]) {
echo "<!-- Calendar info -->\n";
include($phpgw_info["server"]["server_root"] . "/calendar/inc/functions.inc.php");
$repeated_events = read_repeated_events($phpgw->session->loginid);
$repeated_events = read_repeated_events($phpgw_info["user"]["userid"]);
$phpgw->db->query("select count(*) from webcal_entry,webcal_entry_user"
. " where cal_date='" . $phpgw->common->show_date(time(),"Ymd")
. "' and (webcal_entry_user.cal_login='" . $phpgw->session->loginid
. "' and (webcal_entry_user.cal_login='" . $phpgw_info["user"]["userid"]
. "' and webcal_entry.cal_id = webcal_entry_user.cal_id) and "
. "(cal_priority='3')");
$phpgw->db->next_record();

View File

@ -50,16 +50,21 @@
function check_logoutcode($code)
{
if ($code == "1") {
global $phpgw_info;
switch($code){
case "1":
return lang_login("You have been successfully logged out");
}
else if ($code == "2") {
break;
case "2":
return lang_login("Sorry, your login has expired");
}
else if ($code == "5") {
break;
case "5":
return "<font color=FF0000>" . lang_login("Bad login or password") . "</font>";
}
else {
break;
case "10":
return "<font color=FF0000>" . lang_login("Your session could not be verified.") . "</font>";
break;
default:
return "&nbsp;";
}
}
@ -72,17 +77,15 @@
if ($submit) {
if (getenv(REQUEST_METHOD) != "POST") {
Header("Location: " . $phpgw->link("", "cd=5"));
Header("Location: " . $phpgw->link("", "code=5"));
}
if (!($phpgw->auth->authenticate($login, $passwd))) {
$sessionid = $phpgw->session->create($login,$passwd);
if (!$sessionid) {
Header("Location: " . $phpgw_info["server"]["webserver_url"] . "/login.php?cd=5");
} else {
// Make sure the server allows us to use cookies
if (! $phpgw_info["server"]["usecookies"]) {
$usecookies = False;
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]) . "/", "cd=yes");
}
$phpgw->session->create($phpgw->db->f("loginid"),$passwd, $usecookies);
// Create the users private_dir if not exist
/*
@ -92,12 +95,15 @@
if(!is_dir($basedir . $phpgw->db->f("loginid")))
mkdir($basedir . $phpgw->db->f("loginid"), 0707);
*/
// Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]
// . "/", $usecookies));
/*
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]
. "/", $usecookies));
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]
. "/", "cd=yes"));
exit;
}
*/
} else {
if ($last_loginid) {
$phpgw->db->query("select value from preferences where owner='$last_loginid' "