Added patch for eventlog

This commit is contained in:
jengo 2001-08-05 06:48:42 +00:00
parent 29c4a9500c
commit 775e55fc86
12 changed files with 1060 additions and 3 deletions

80
admin/inc/class.bolog.inc.php Executable file
View File

@ -0,0 +1,80 @@
<?php
/***************************************************************************\
* phpGroupWare - log *
* http://www.phpgroupware.org *
* Written by : Jerry Westrick [jerry@westrick.com] *
* ------------------------------------------------- *
* 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 bolog
{
var $public_functions = array
(
'read_log' => True
);
function bolog($session=False)
{
global $phpgw;
$this->so = CreateObject('admin.solog');
}
function get_error_cols()
{
$fields = $this->so->get_error_cols();
// boAccounts
$fields['account_pwd']['include'] = false;
return $fields;
}
function get_error_cols_e()
{
$fields = $this->so->get_error_cols_e();
$fields['log_date_e'] = array();
$fields['log_msg_date_e'] = array();
$fields['log_full_name'] = array();
// boAccounts
$fields['account_pwd']['include'] = false;
$fields['account_lastlogin_e'] = array();
$fields['account_lastloginfrom_e'] = array();
$fields['account_lastpwd_change_e'] = array();
return $fields;
}
function get_error($values='')
{
$rows = $this->so->get_error($values);
// should remove the accounts_pwd
return $rows;
}
function get_error_e($values='')
{
$rows = $this->so->get_error_e($values);
// Enhance the fields
reset($rows);
while(list($rno,$r)=each($rows))
{
unset($r['acount_pwd']); // remove the accounts_pwd
$r['log_date_e'] = date('Y.n.d:H.i.s',$r['log_date']);
$r['log_msg_date_e'] = date('Y.n.d:H.i.s',$r['log_msg_date']);
$r['log_full_name'] = $r['account_lastname'] . ', ' .$r['account_firstname'];
$r['account_lastlogin_e'] = date('Y.n.d:H.i.s',$r['account_lastlogin']);
$r['account_lastpwd_change_e'] = date('Y.n.d:H.i.s',$r['account_lastpwd_change']);
$r['account_lastloginfrom_e'] = 'www.nowhere.com';
$r['log_msg_text'] = lang($r['log_msg_msg'],explode('|',$r['log_msg_parms']));
$rows[$rno]=$r;
}
return $rows;
}
}
?>

194
admin/inc/class.html.inc.php Executable file
View File

@ -0,0 +1,194 @@
<?php
/**************************************************************************\
* phpGroupWare - html *
* http://www.phpgroupware.org *
* Written by Jerry Westrick <jerry@westrick.com> *
* -------------------------------------------- *
* 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 html
{
function hash_table($rows,$head='',$obj, $frtn)
{
global $phpgw;
$html = '';
$edittable =$head['_edittable'];
if (isset($edittable))
{
if ($edittable)
{
// Generate the customization table...
return $this->edit_table($rows,$head,$obj,$frtn);
}
else
{
$html .= "<form method=\"post\" action=\""
. $phpgw->link()
. "&editable=true\">\n";
$html .= "<input type=\"submit\" name=\"submit\" value=\"Edit Table Format\">";
}
}
$params = $head['_table_parms'];
if ($head == '')
{
$frow = $rows[0];
$cnam = array_keys($frow);
while(list(,$fn)=each($cnam))
{
$head[$fn] = array();
}
};
if ( gettype($head['_cols'])=="NULL")
{
$cols = array_keys($rows[0]);
}
else
{
$cols = $head['_cols'];
};
$html .= "<table $params>\n";
// Build Header Row...
$html .= "\t<tr> ";
reset($cols);
while (list(,$name) = each($cols))
{
$values = $head[$name];
$title = $values['title'];
if ($title == '')
{
$title = $name;
}
$html .= "\t\t<td ".$values['parms_hdr'].">".$title."</td>\n";
}
$html .= "\t</tr>\n";
reset($rows);
while(list($rno,$r)=each($rows))
{
$row = $obj->$frtn($rno,$r);
$rparms = $row['_rparms'];
$html .= "\t<tr $rparms> ";
reset($cols);
while (list(,$name) = each($cols))
{
$values = $head[$name];
$parms = $values['parms'];
$fparms = $row['_'.$name];
$html .= "\t\t<td ".$parms.$fparms.">".$row[$name]."</td>\n";
}
$html .= "\t</tr>\n";
}
$html .= "</table>\n";
$html .= "</form>";
return $html;
}
function edit_table($rows,$head='',$obj, $frtn)
{
global $phpgw, $nocols;
$html = '';
$html .= "<form method=\"post\" action=\""
. $phpgw->link()
. "&editable=true"
. "\">\n";
$params = $head['_table_parms'];
$frow = $rows[0];
$cnam = array_keys($frow);
if ($head == '')
{
while(list(,$fn)=each($cnam))
{
$head[$fn] = array();
}
};
if ( gettype($head['_cols'])=="NULL")
{
$cols = array_keys($rows[0]);
}
else
{
$cols = $head['_cols'];
};
if (!isset($nocols))
{
$nocols = count($cols);
}
// Build Header Row...
$html .= "<p>Number of Columns: ";
$html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">";
$html .= "<input type=\"submit\" name=\"submit\" value=\"Update Display\">";
$html .= "</p>\n";
$html .= "\t<tr> ";
$html .= "<table width=\"98%\", bgcolor=\"D3DCFF\">\n";
$html .= "\t\t<td width=\"2%\", align=\"center\">Del</td>\n";
$html .= "\t\t<td width=\"5%\">Column</td>\n";
$html .= "\t\t<td>Value</td>\n";
$html .= "\t</tr>\n";
// Add Table Rows...
reset($cols);
// while (list($cno,$name) = each($cols))
for ($cno=0;$cno<$nocols;$cno++)
{
$name = $cols[$cno];
$values = $head[$name];
$title = $values['title'];
if ($title == '')
{
$title = $name;
}
$html .= "\t</tr>\n";
$html .= "\t\t<td bgcolor=\"FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$cno\"></td>\n";
$html .= "\t\t<td bgcolor=\"FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n";
$value = $rows[0][$name];
$html .= "\t\t<td bgcolor=\"FFFFFF\">$value</td>\n";
$html .= "\t</tr>\n";
}
$html .= "</table>\n";
$html .= "<input type=\"submit\" name=\"modifytable\" value=\"Save Changes\">";
$html .= "</form>";
return $html;
}
function dropdown($opts,$name='',$sel='')
{
$items = $opts;
$html = '<select ';
if ($name != '')
{
$html .= 'name="'.$name.'"';
}
$html .= ">\n";
while (list(,$itm)=each($opts))
{
$html .= '\t<option value="'.$itm.'" ';
if ($itm == $sel)
{
$html .= 'selected ';
}
$html .= '>'.$itm."</option>\n";
}
$html .= "</select>\n";
return $html;
}
}

164
admin/inc/class.solog.inc.php Executable file
View File

@ -0,0 +1,164 @@
<?php
/**************************************************************************\
* phpGroupWare - solog *
* http://www.phpgroupware.org *
* This application written by Jerry Westrick <jerry@westrick.com> *
* -------------------------------------------- *
* Funding for this program was provided by http://www.checkwithmom.com *
* -------------------------------------------- *
* 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 solog
{
var $db;
var $owner;
var $error_cols = '';
var $error_cols_e = '';
var $public_functions = array
('get_error_cols' => True
,'get_error_cols_e'=> True
,'get_error' => True
,'get_error_e' => True
);
function solog()
{
global $phpgw;
$this->db = $phpgw->db;
}
function get_error_cols()
{
if ($this->error_cols == '')
{
$this->error_cols = array();
// fields from phpgw_log table
$clist = $this->db->metadata('phpgw_log');
for ($i=0; $i<count($clist); $i++)
{
$name = $clist[$i]['name'];
$this->error_cols[$name] = array();
}
// fields from phpgw_log_msg table
$clist = $this->db->metadata('phpgw_log_msg');
for ($i=0; $i<count($clist); $i++)
{
$name = $clist[$i]['name'];
$this->error_cols[$name] = array();
}
}
return $this->error_cols;
}
function get_error_cols_e()
{
if ($this->task_cols_e == '')
{
// Get Columns for Errors
$this->error_cols_e = $this->get_error_cols();
// Enhance with Columns for phpgw_accounts
$clist = $this->db->metadata('phpgw_accounts');
for ($i=0; $i<count($clist); $i++)
{
$name = $clist[$i]['name'];
$this->error_cols_e[$name] = array();
}
}
return $this->error_cols_e;
}
function get_error_e($parms)
{
// Fixed From
if ($parms['from'] == '')
{
$parms['from'] = array('phpgw_accounts');
}
else
{
$parms['from'][] = 'phpgw_accounts';
}
// Fix Where
if ($parms['where'] == '')
{
$parms['where'] = array('phpgw_log.log_user = phpgw_accounts.account_id');
}
else
{
$parms['where'][] = 'phpgw_log.log_id = phpgw_accounts.account_id';
}
// Fix Default Fields
if ($parms['fields'] == '')
{
$parms['fields'] = $this->get_error_cols_e();
}
return $this->get_error($parms);
}
function get_error($parms)
{ // Get paramenter values
$from = $parms['from'];
$where = $parms['where'];
$orderby = $parms['orderby'];
$fields = $parms['fields'];
// Build From_Clause
$from_clause = 'FROM phpgw_log, phpgw_log_msg ';
if ($from != '')
{
$from[] = 'phpgw_log';
$from[] = 'phpgw_log_msg';
$from_clause = 'FROM '.implode(', ' , $from).' ';
}
// Build Where_Clause
$where_clause = 'WHERE phpgw_log.log_id = phpgw_log_msg.log_msg_log_id ';
if ($where != '')
{
$where[] = 'phpgw_log.log_id = phpgw_log_msg.log_msg_log_id';
$where_clause = 'WHERE ' . implode(' AND ',$where) . ' ';
}
// Build Order_By_Clause
$orderby_clause = 'Order By phpgw_log.log_id, phpgw_log_msg.log_msg_seq_no ';
if ($orderby != '')
{
$orderby_clause = 'Order By ' . implode(', ',$orderby);
}
// If no Fields specified default to *
if ($fields == '')
{
$fields = $this->error_cols;
}
$rows = array();
$rowno = 0;
// Do Select
$this->db->query("select ". implode(', ',array_keys($fields)).' '.$from_clause.$where_clause.$orderby_clause,__LINE__,__FILE__);
while($this->db->next_record())
{
reset($fields);
while(list($fname,$fopt) = each($fields))
{
$this_row[$fname] = $this->db->f($fname);
};
$rows[$rowno] = $this_row;
$rowno++;
};
return $rows;
}
}

View File

@ -0,0 +1,257 @@
<?php
/***************************************************************************\
* phpGroupWare - uilog *
* http://www.phpgroupware.org *
* Written by : jerry westrick [jerry@westrick.com] *
* ------------------------------------------------- *
* 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 uilog
{
var $grants;
var $cat_id;
var $start;
var $search;
var $filter;
var $public_functions = array
(
'list_log' => True
);
function uilog()
{
global $phpgw, $_cols, $editable, $modifytable, $nocols, $_delcol, $phpgw_info;
$this->bolog = CreateObject('admin.bolog',True);
$this->html = createobject('admin.html');
$this->t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
$this->lastid = "";
$this->editmode = false;
// Handle the Edit Table Button
if (isset($editable))
{
$this->editmode = $editable;
};
// Handle return from Modify Table form...
if (isset($modifytable))
{
// the delete column must not be empty
if (!isset($_delcol))
{
$_delcol = array();
};
// Build New fields_inc array...
if (isset($_cols))
{
$c = array();
for ($i=0;$i<$nocols;$i++)
{
if (!in_array($i, $_delcol))
{
$c[] = $_cols[$i];
};
}
$this->fields_inc = $c;
};
// Reset Mode to display...
$this->editmode = false;
// Save the fields_inc values in Session and User Preferences...
$data = array('fields_inc'=>$this->fields_inc);
$phpgw->session->appsession('session_data','log',$data);
$phpgw->preferences->read_repository();
$phpgw->preferences->delete('log','fields_inc');
$phpgw->preferences->add('log','fields_inc',$this->fields_inc);
$phpgw->preferences->save_repository();
}
// Make sure that $this->fields_inc is filled
if ( !isset($this->field_inc))
{
// Need to fill from Session Data...
$data = $phpgw->session->appsession('session_data','log');
if (isset($data) && isset($data['fields_inc']))
{
$this->fields_inc = $data['fields_inc'];
}
else
{
$phpgw->preferences->read_repository();
// Get From User Profile...
if (@$phpgw_info['user']['preferences']['log']['fields_inc'])
{
$fields_inc = $phpgw_info['user']['preferences']['log']['fields_inc'];
$this->fields_inc = $fields_inc;
$phpgw->session->appsession('session_data','log',array('fields_inc',$fields_inc));
}
else
{
// Use defaults...
$this->fields_inc = array ('log_severity',
'log_id',
'log_date_e',
'log_app',
'log_full_name',
'log_msg_seq_no',
'log_msg_date_e',
'log_msg_severity',
'log_msg_code',
'log_msg_text'
);
// Store defaults in session data...
$phpgw->session->appsession ('session_data',
'log',
array ('fields_inc'
=>$this->fields_inc
)
);
}
}
} // Values already filled...
}
function list_log()
{
global $phpgw, $phpgw_info;
/*
$phpgw->log->message('I-TestMsg, msg: %1','This message should appear in log');
$phpgw->log->error('I-TestInfo, info: %1','This Informational should not be in log');
$phpgw->log->clearstack();
$phpgw->log->error('I-TestInfo, info: %1','This Informational should be in log');
$phpgw->log->error('W-TestWarn, warn: %1','This is a test Warning');
$phpgw->log->error('E-TestError, err: %1','This is a test Error');
$phpgw->log->error('F-Abend, abort: %1','Force abnormal termination');
$phpgw->log->commit(); // commit error stack to log...
*/
$this->t->set_file(array('log_list_t' => 'log.tpl'));
// Get list of Possible Columns
$header = $this->bolog->get_error_cols_e();
// Set Table formating parameters
$header['_table_parms']='width="98%", bgcolor="D3DCFF"';
// Set User Configured List of columns to show
$header['_cols']= $this->fields_inc;
// Column Log_ID
$header['log_id']['parms_hdr'] = 'align="center", width="2%"';
$header['log_id']['title'] = 'Id';
$header['log_id']['parms'] = 'align="center"';
// Column Log_Severity
$header['log_severity']['parms_hdr'] = 'align="center", width="2%"';
$header['log_severity']['title'] = 'S';
$header['log_severity']['parms'] = 'align="center"';
// Column Trans Date
$header['log_date_e']['title'] = 'Tans. Date';
$header['log_date_e']['parms'] = '';
// Column Application
$header['log_app']['title'] = 'Application';
$header['log_app']['parms'] = '';
// Column FullName
$header['log_full_name']['title'] = 'User';
$header['log_full_name']['parms'] = 'align="center"';
// Column log_msg_seq_no
$header['log_msg_seq_no']['parms_hdr'] = 'align="center"';
$header['log_msg_seq_no']['title'] = 'Sno';
$header['log_msg_seq_no']['parms'] = 'align="center"';
// Column log_msg_seq_no
$header['log_msg_date_e']['title'] = 'TimeStamp';
$header['log_msg_severity']['title'] = 'S';
$header['log_msg_code']['title'] = 'Code';
$header['log_msg_text']['title'] = 'Error Msg';
// Hack Get All Rows
$rows = $this->bolog->get_error_e(array('orderby'=>array('log_id','log_msg_log_id')));
$header['_edittable']=$this->editmode;
$table = $this->html->hash_table($rows,$header,$this, 'format_row');
$this->t->set_var('event_list',$table);
$this->t->pfp('out','log_list_t');
$phpgw->common->phpgw_footer();
// $this->set_app_langs();
}
function format_row($rno, $row)
{
if ($rno == 0)
{
$this->lastid = '';
}
if ($this->lastid != $row['log_id'])
{
$this->lastid = $row['log_id'];
}
else
{
$row['log_id'] = '&nbsp ';
$row['log_severity'] = '&nbsp ';
$row['log_date_e'] = '&nbsp ';
$row['log_app'] = '&nbsp ';
$row['log_full_name'] = '&nbsp ';
}
switch($row['log_severity'])
{
case 'I': $lcolor = 'C0FFC0'; break;
case 'W': $lcolor = 'FFFFC0'; break;
case 'E': $lcolor = 'FFC0C0'; break;
case 'F': $lcolor = 'FF0909'; break;
}
switch($row['log_msg_severity'])
{
case 'I': $color = 'C0FFC0'; break;
case 'W': $color = 'FFFFC0'; break;
case 'E': $color = 'FFC0C0'; break;
case 'F': $color = 'FF0909'; break;
}
reset($this->fields_inc);
while(list(,$fld) = each($this->fields_inc))
{
if (substr($fld,0,7) == 'log_msg')
{
$c = $color;
}
else
{
if ($fld == 'log_severity' && $row['log_severity'] != '&nbsp ')
{
$c = $lcolor;
}
else
{
$c = "FFFFFF";
}
};
$parms = 'bgcolor="' . $c . '"';
$row['_'.$fld] = $parms;
}
return $row;
}
}
?>

View File

@ -23,9 +23,10 @@
'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'),
'View Sessions' => $phpgw->link('/admin/currentusers.php'),
'View Access Log' => $phpgw->link('/index.php','menuaction=admin.uiaccess_history.list_history'),
'View Error Log' => $phpgw->link('/admin/log.php'), //j3rry
'phpInfo' => $phpgw->link('/admin/phpinfo.php')
);
//Do not modify below this line
display_section($appname,$title,$file);
}
?>
?>

21
admin/log.php Executable file
View File

@ -0,0 +1,21 @@
<?php
/**************************************************************************\
* phpGroupWare - log *
* http://www.phpgroupware.org *
* Written by jerry westrick [jerry@westrick.com] *
* ----------------------------------------------- *
* 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$ */
$phpgw_info['flags'] = array
(
'currentapp' => 'admin'
);
include('../header.inc.php');
$obj = CreateObject('admin.uilog');
$obj->list_log();
?>

View File

@ -0,0 +1,8 @@
<!-- $Id$ -->
{app_header}
<center>
{event_list}
</center>
{save_preferences}

View File

@ -0,0 +1,74 @@
<?php
/**************************************************************************\
* phpGroupWare - eventlog *
* http://www.phpgroupware.org *
* This application written by jerry westrick <jerry@westrick.com> *
* -------------------------------------------- *
* 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 error
{
/***************************\
* Instance Variables... *
\***************************/
var $severity = 'E';
var $code = 'Unknown';
var $msg = 'Unknown error';
var $parms = array();
var $ismsg = 0;
var $timestamp;
var $public_functions = array();
/*******************************************\
* Constructor *
* to be accessed as new error() *
\*******************************************/
// Translate Message into Language
function langmsg()
{
return lang($this->msg,$this->parms);
}
function error($etext, $parms, $ismsg)
{
global $phpgw;
if (eregi('([IWEF])-(.*)[\,](.*)',$etext,$match))
{
$this->severity = strtoupper($match[1]);
$this->code = $match[2];
$this->msg = trim($match[3]);
}
else
{
$this->msg = trim($etext);
}
$this->timestamp = time();
$this->parms = $parms;
$this->ismsg = $ismsg;
$phpgw->log->errorstack[] = $this;
if ($this->severity == 'F')
{
// This is it... Don't return
// do rollback...
// Hmmm this only works if UI!!!!
// What Do we do if it's a SOAP/XML?
echo "<Center>";
echo "<h1>Fatal Error</h1>";
echo "<h2>Error Stack</h2>";
echo $phpgw->log->astable();
echo "</center>";
// Commit stack to log
$phpgw->log->commit();
exit();
}
}
}

View File

@ -0,0 +1,175 @@
<?php
/**************************************************************************\
* phpGroupWare - log *
* http://www.phpgroupware.org *
* This application written by jerry westrick <jerry@westrick.com> *
* -------------------------------------------- *
* 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 log
{
/***************************\
* Instance Variables... *
\***************************/
var $errorstack = array();
var $public_functions = array('message',
'error',
'iserror',
'severity',
'commit',
'clearstack',
'astable',
);
function message($etext,$p0='',$p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='')
{
$parms = array($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9);
CreateObject('phpgwapi.error',$etext,$parms,1);
}
function error($etext,$p0='',$p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='')
{
$parms = array($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9);
CreateObject('phpgwapi.error',$etext,$parms,false);
}
function iserror($ecode)
{
$errorstack = $this->errorstack;
reset($errorstack);
while(list(,$err)=each($errorstack))
{
if ($ecode == $err->code)
{
return true;
}
}
return false;
}
function severity()
{
$max = 'I';
$errorstack = $this->errorstack;
reset($errorstack);
while(list(,$err)=each($errorstack))
{
switch($err->severity)
{
case 'F': return 'F'; break;
case 'E': $max = 'E'; break;
case 'W': if ($max == 'I')
{
$max = 'W';
}
break;
}
}
return $max;
}
function commit()
{
global $phpgw, $phpgw_info;
$db = $phpgw->db;
$db->query ('insert into phpgw_log (log_date, log_user, log_app, log_severity) values '
.'('.time()
.','.$phpgw->session->account_id
.',"'.$phpgw_info['flags']['currentapp'].'"'
.',"'.$this->severity().'"'
.')'
,__LINE__,__FILE__);
$db->query ('select max(log_id) log_id from phpgw_log',__LINE__,__FILE__);
$db->next_record();
$log_id = $db->f('log_id');
$errorstack = $this->errorstack;
for ($i = 0; $i < count($errorstack); $i++)
{
$err = $errorstack[$i];
$db->query ("insert into phpgw_log_msg "
."(log_msg_log_id, log_msg_seq_no, log_msg_date, "
."log_msg_severity, log_msg_code, log_msg_msg, log_msg_parms) values "
."( " . $log_id
.", " . $i
.", " . $err->timestamp
.", '". $err->severity . "'"
.", '". $err->code . "'"
.", '". $err->msg . "'"
.", '". addslashes(implode('|',$err->parms)). "'"
.")"
,__LINE__,__FILE__);
};
unset ($errorstack);
unset ($this->errorstack);
$this->errorstack = array();
}
function clearstack()
{
$new = array();
reset($this->errorstack);
for ($i = 0; $i < count($this->errorstack); $i++)
{
$err = $this->errorstack[$i];
if ($err->ismsg)
{
$new[] = $err;
};
}
unset ($this->errorstack);
$this->errorstack = $new;
}
function astable()
{
global $phpgw;
$html = "<center>\n";
$html .= "<table width=\"98%\">\n";
$html .= "\t<tr bgcolor=\"D3DCFF\">\n";
$html .= "\t\t<td width=\"2%\">No</td>\n";
$html .= "\t\t<td width=\"16%\">Date</td>\n";
$html .= "\t\t<td width=\"15%\">App</td>\n";
$html .= "\t\t<td align=\"center\", width=\"2%\">S</td>\n";
$html .= "\t\t<td width=\"10%\">Error Code</td>\n";
$html .= "\t\t<td >Msg</td>\n";
$html .= "\t</tr>\n";
$errorstack = $this->errorstack;
for ($i = 0; $i < count($errorstack); $i++)
{
$err = $errorstack[$i];
switch ($err->severity)
{
case 'I': $color = 'C0FFC0'; break;
case 'W': $color = 'FFFFC0'; break;
case 'E': $color = 'FFC0C0'; break;
case 'F': $color = 'FF0909'; break;
}
$html .= "\t<tr bgcolor=".'"'.$color.'"'.">\n";
$html .= "\t\t<td align=center>".$i."</td>\n";
$html .= "\t\t<td>".date('Y.n.d:H.i.s',$err->timestamp)."</td>\n";
$html .= "\t\t<td>".$phpgw_info['flags']['currentapp']."&nbsp </td>\n";
$html .= "\t\t<td align=center>".$err->severity."</td>\n";
$html .= "\t\t<td>".$err->code."</td>\n";
$html .= "\t\t<td>".$err->langmsg()."</td>\n";
$html .= "\t</tr>\n";
};
$html .= "</table>\n";
$html .= "</center>\n";
return $html;
}
}

View File

@ -14,7 +14,7 @@
/* Basic information about this app */
$setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi';
$setup_info['phpgwapi']['version'] = '0.9.13.006';
$setup_info['phpgwapi']['version'] = '0.9.13.007';
$setup_info['phpgwapi']['versions']['current_header'] = '1.16';
$setup_info['phpgwapi']['enable'] = 3;
$setup_info['phpgwapi']['app_order'] = 1;
@ -35,6 +35,8 @@
$setup_info['phpgwapi']['tables'][] = 'phpgw_nextid';
$setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook';
$setup_info['phpgwapi']['tables'][] = 'phpgw_addressbook_extra';
$setup_info['phpgwapi']['tables'][] = 'phpgw_log';
$setup_info['phpgwapi']['tables'][] = 'phpgw_log_msg';
/* Basic information about this app */
$setup_info['notifywindow']['name'] = 'notifywindow';

View File

@ -257,6 +257,38 @@
'fk' => array(),
'ix' => array(),
'uc' => array()
),
// Begin j3rry
'phpgw_log' => array(
'fd' => array(
'log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False),
'log_date' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_user' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_app' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False),
'log_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False)
),
'pk' => array('log_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
),
'phpgw_log_msg' => array(
'fd' => array(
'log_msg_log_id' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_seq_no' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_date' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_tx_fid' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_tx_id' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False),
'log_msg_code' => array('type' => 'varchar', 'precision' => 30, 'nullable' => False),
'log_msg_msg' => array('type' => 'text', 'nullable' => False),
'log_msg_parms' => array('type' => 'text', 'nullable' => False)
),
'pk' => array('log_msg_log_id', 'log_msg_seq_no'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
// End j3rry
);
?>

View File

@ -1632,7 +1632,7 @@
'phpgw_nextid', array(
'fd' => array(
'appname' => array('type' => 'varchar', 'precision' => 25, 'nullable' => False),
'id' => array('type' => 'int', 'precision' => 4)
'id' => array('type' => 'int', 'precision' => 4),
),
'pk' => array(),
'fk' => array(),
@ -1905,6 +1905,7 @@
$phpgw_setup->oProc->AddColumn('phpgw_access_log','account_id',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False));
global $phpgw;
class phpgw
{
var $common;
@ -1977,4 +1978,52 @@
$setup_info['phpgwapi']['currentver'] = '0.9.13.006';
return $setup_info['phpgwapi']['currentver'];
}
// begin j3rry
$test[] = '0.9.13.006'; // version number?
function phpgwapi_upgrade0_9_13_006()
{
global $setup_info, $phpgw_setup;
$phpgw_setup->oProc->CreateTable(
'phpgw_log', array(
'fd' => array(
'log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False),
'log_date' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_user' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_app' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False),
'log_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False)
),
'pk' => array('log_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$phpgw_setup->oProc->CreateTable(
'phpgw_log_msg', array(
'fd' => array(
'log_msg_log_id' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_seq_no' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_date' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'log_msg_tx_fid' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_tx_id' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True),
'log_msg_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False),
'log_msg_code' => array('type' => 'varchar', 'precision' => 30, 'nullable' => False),
'log_msg_msg' => array('type' => 'text', 'nullable' => False),
'log_msg_parms' => array('type' => 'text', 'nullable' => False)
),
'pk' => array('log_msg_log_id', 'log_msg_seq_no'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
$setup_info['phpgwapi']['currentver'] = '0.9.13.007';
return $setup_info['phpgwapi']['currentver'];
}
?>