mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +01:00
* Admin/API: remove old database based error-log
This commit is contained in:
parent
ada3b84386
commit
5ba884f4a6
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
/***************************************************************************\
|
||||
* eGroupWare - log *
|
||||
* http://www.egroupware.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)
|
||||
{
|
||||
$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_no_errors()
|
||||
{
|
||||
$rows = $this->so->get_no_errors();
|
||||
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']['value'] = $GLOBALS['egw']->common->show_date($GLOBALS['egw']->db->from_timestamp($r['log_date']['value']));
|
||||
$r['log_msg_date_e']['value'] = $GLOBALS['egw']->common->show_date($GLOBALS['egw']->db->from_timestamp($r['log_msg_date']['value']));
|
||||
$r['log_full_name']['value'] = $r['account_lastname']['value'] . ', ' .$r['account_firstname']['value'];
|
||||
$r['account_lastlogin_e']['value'] = $GLOBALS['egw']->common->show_date($GLOBALS['egw']->db->from_timestamp($r['account_lastlogin']['value']));
|
||||
$r['account_lastpwd_change_e']['value'] = $GLOBALS['egw']->common->show_date($GLOBALS['egw']->db->from_timestamp($r['account_lastpwd_change']['value']));
|
||||
$r['account_lastloginfrom_e']['value'] = 'www.nowhere.com';
|
||||
|
||||
$r['log_msg_text']['value'] = lang($r['log_msg_msg']['value'],explode('|',$r['log_msg_parms']['value']));
|
||||
|
||||
$rows[$rno]=$r;
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,541 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - html *
|
||||
* http://www.egroupware.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_tables
|
||||
{
|
||||
function hash_table($rows,$head='',$obj, $frtn)
|
||||
{
|
||||
$start = $_POST['start'] ? $_POST['start'] : $_GET['start'];
|
||||
|
||||
$html = '';
|
||||
$edittable = $head['_edittable'];
|
||||
if(isset($edittable))
|
||||
{
|
||||
if($edittable)
|
||||
{
|
||||
// Generate the customization table...
|
||||
return $this->edit_table($rows,$head,$obj,$frtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$bo =& CreateObject('admin.bolog',True);
|
||||
if(!isset($start))
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
$num_rows = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$stop = $start + $num_rows;
|
||||
if($stop > count($rows))
|
||||
{
|
||||
$stop = count($rows);
|
||||
}
|
||||
$nextmatchs =& CreateObject('phpgwapi.nextmatchs');
|
||||
$total_records = count($rows);//$bo->get_no_errors();
|
||||
$left = $nextmatchs->left('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
||||
$right = $nextmatchs->right('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
||||
$hits = $nextmatchs->show_hits($total_records,$start);
|
||||
|
||||
$html .= '<table width="98%"><tr>';
|
||||
$html .= $left;
|
||||
$html .= '<td align="right"> ' . $hits . ' </td>';
|
||||
$html .= '<td align="left"> <a href=' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true') .'> ' . lang('Edit Table format') . '</a></td>';
|
||||
$html .= $right;
|
||||
$html .= '</tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
if($head == '')
|
||||
{
|
||||
$frow = $rows[0];
|
||||
$cnam = $this->arr_keys($frow);
|
||||
while(list(,$fn)=each($cnam))
|
||||
{
|
||||
$head[$fn] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if(@is_null($head['_cols']))
|
||||
{
|
||||
$cols = $this->arr_keys($rows[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cols = $head['_cols'];
|
||||
}
|
||||
|
||||
// Build Header Row...
|
||||
|
||||
// First Get the layout arrays...
|
||||
$layout = $head['#layout'];
|
||||
if(!is_array($layout))
|
||||
{
|
||||
$layout = $this->arr_keys($cols);
|
||||
}
|
||||
|
||||
// printlist, a list of all columns in a logical row,
|
||||
// with Row/ColSpawn values, in print order...
|
||||
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
|
||||
// $table contains data for header row....
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
|
||||
// get GroupBy
|
||||
$groupby = $head['_groupby'];
|
||||
$supres = $head['_supres'];
|
||||
$lastgroup = '';
|
||||
|
||||
// build actual Rows...
|
||||
$rparms = array();
|
||||
$mrow = $stop;
|
||||
for($rno=0;$rno<$mrow;$rno++)
|
||||
{
|
||||
// Build GroupKey
|
||||
if(isset($groupby))
|
||||
{
|
||||
$gkey = '';
|
||||
reset($groupby);
|
||||
while(list($gname,)=each($groupby))
|
||||
{
|
||||
$gkey .= $rows[$rno][$gname]['value'];
|
||||
}
|
||||
$rows[$rno]['#gkey'] = $gkey;
|
||||
}
|
||||
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$cparms = $this->arr_merge($head[$cname],$pcol,array('bgcolor'=>'#FFFFFF'),$rows[$rno][$cname]);
|
||||
$rows[$rno][$cname] = $cparms;
|
||||
}
|
||||
}
|
||||
|
||||
// Grouping Suppression
|
||||
|
||||
if(isset($groupby))
|
||||
{
|
||||
$grno = $start;
|
||||
$gkey = $rows[$start]['#gkey'];
|
||||
for($rno=$start+1;$rno<$stop;$rno++)
|
||||
{
|
||||
$rowspan = 1;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
|
||||
while( $gkey == $rkey)
|
||||
{
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are equal</p>";
|
||||
$rowspan = $rowspan + 1;
|
||||
$row = $rows[$rno];
|
||||
|
||||
for($pc=0;$pc<count($row);$pc++)
|
||||
{
|
||||
$c = $row[$cols[$pc]];
|
||||
$cno = $c['#colno'];
|
||||
$cname = $c['#name'];
|
||||
|
||||
if($supres[$cname])
|
||||
{
|
||||
$rows[$rno][$cname]['#supres']='yes';
|
||||
$rows[$rno][$cname]['value']='  ';
|
||||
$rows[$grno][$cname]['rowspan']=$printlist[$cno]['rowspan']*$rowspan;
|
||||
}
|
||||
}
|
||||
$rno++;
|
||||
$rkey = $rows[$rno]['#gkey'];
|
||||
}
|
||||
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are not equal</p>";
|
||||
$grno=$rno;
|
||||
$gkey=$rkey;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Now Generate the Html For the Table Header
|
||||
*/
|
||||
//print_r($table);
|
||||
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
/*
|
||||
** Now (finally) Generate the Html For the Table
|
||||
*/
|
||||
//print_r($rows);
|
||||
for($rno=$start;$rno<$stop;$rno++)
|
||||
{
|
||||
// let user have a hack at the row...
|
||||
$row = $obj->$frtn($rno,$rows[$rno]);
|
||||
// $row = $rows[$rno];
|
||||
|
||||
// $rp = $this->makeparms($row[$rno]['#row_parms']);
|
||||
$rp = '';
|
||||
$gkey = $row['#gkey'];
|
||||
// $html .= "\t<tr $rp> <comment $gkey>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
|
||||
$cp = $this->makeparms($row[$cname]);
|
||||
if($row[$cname]['#supres'] != 'yes')
|
||||
{
|
||||
$html .= "\t\t<td $cp>".$row[$cname]['value']."</td>\n";
|
||||
}
|
||||
if($pcol['#eor']=='1')
|
||||
{
|
||||
$html .= "\t</tr>\n"; // \t<tr $rp>\n
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
#$html .= "</form>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function makeparms($parmlist)
|
||||
{
|
||||
$html = '';
|
||||
$comma = ' ';
|
||||
if(!is_array($parmlist))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
reset($parmlist);
|
||||
while(list($pname,$pvalue)=each($parmlist))
|
||||
{
|
||||
switch($pname)
|
||||
{
|
||||
case 'value':
|
||||
break;
|
||||
case 'colspan':
|
||||
case 'rowspan':
|
||||
if($pvalue != 1)
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
#$comma = ', ';
|
||||
$comma = ' ';
|
||||
};
|
||||
break;
|
||||
default:
|
||||
if(substr($pname,0,1) != '#')
|
||||
{
|
||||
$html .= $comma . $pname . '="' . $pvalue . '"';
|
||||
#$comma = ', ';
|
||||
$comma = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function edit_table($rows,$head='',$obj, $frtn)
|
||||
{
|
||||
$nocols = $_POST['nocols'];
|
||||
$noflds = $_POST['noflds'];
|
||||
$norows = $_POST['norows'];
|
||||
$layout = $_POST['layout'];
|
||||
$_cols = $_POST['_cols'];
|
||||
|
||||
$html = '';
|
||||
$html .= '<form method="post" action="'
|
||||
. $GLOBALS['egw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true')
|
||||
. '">' . "\n";
|
||||
|
||||
$params = $head['_table_parms'];
|
||||
$frow = $rows[0];
|
||||
$cnam = $this->arr_keys($frow);
|
||||
if($head == '')
|
||||
{
|
||||
while(list(,$fn)=each($cnam))
|
||||
{
|
||||
$head[$fn] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_cols))
|
||||
{
|
||||
$cols = $_cols;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(@is_null($head['_cols']))
|
||||
{
|
||||
$cols = $this->arr_keys($rows[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cols = $head['_cols'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($noflds))
|
||||
{
|
||||
$noflds = count($cols);
|
||||
}
|
||||
if(!isset($layout))
|
||||
{
|
||||
$layout = $head['#layout'];
|
||||
}
|
||||
if(!isset($norows))
|
||||
{
|
||||
$norows = count($layout);
|
||||
}
|
||||
if(!isset($nocols))
|
||||
{
|
||||
$nocols = count($layout[0]);
|
||||
}
|
||||
// Table Excmple
|
||||
|
||||
// Build Header Row...
|
||||
$html .= "<h2>Table Size</h2>";
|
||||
// $html .= "<p>";
|
||||
$html .= "Rows: ";
|
||||
$html .= "<input type=\"input\" name=\"norows\" value=\"$norows\">";
|
||||
$html .= "Columns: ";
|
||||
$html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">";
|
||||
$html .= "Fields: ";
|
||||
$html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">";
|
||||
// $html .= "\t<tr> ";
|
||||
|
||||
// Column Defintions...
|
||||
$html .= "<h2>Column Definition</h2>";
|
||||
$html .= "<table width=\"98%\" bgcolor=\"#000000\">\n";
|
||||
$f = array();
|
||||
for($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$f[]=$fno;
|
||||
}
|
||||
// Column Headings
|
||||
$html .= "\t<tr bgcolor=\"#D3DCFF\">\n";
|
||||
for($cno=0;$cno<$nocols;$cno++)
|
||||
{
|
||||
$html .= "\t\t<td align=\"center\">$cno</td>\n";
|
||||
}
|
||||
$html .= "\t</tr >\n";
|
||||
for($rno=0;$rno<$norows;$rno++)
|
||||
{
|
||||
$html .= "\t<tr bgcolor=\"#D3DCFF\">\n";
|
||||
for($cno=0;$cno<$nocols;$cno++)
|
||||
{
|
||||
$c = $layout[$rno][$cno];
|
||||
$tname = "layout[$rno][]";
|
||||
$t = $this->DropDown($f,$tname,$c);
|
||||
$html .= "\t\t<td align=\"center\">$t</td>\n";
|
||||
}
|
||||
$html .= "\t</tr >\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "<p>\n";
|
||||
|
||||
// Header of Table...
|
||||
$printlist = $this->make_printlist($layout,$cols);
|
||||
$table = $this->make_tblhead($printlist,$head);
|
||||
$html .= $this->html_head($head,$table,$printlist);
|
||||
$html .= "</table>\n";
|
||||
|
||||
$html .= "<input type=\"submit\" name=\"submit\" value=\"Update\">";
|
||||
//Field Definitions
|
||||
$html .= "<h2>Field Definitions</h2>";
|
||||
$html .= "<table width=\"98%\" bgcolor=\"#D3DCFF\">\n";
|
||||
$html .= "\t\t<td width=\"2%\" align=\"center\">No</td>\n";
|
||||
$html .= "\t\t<td width=\"2%\" align=\"center\">Del</td>\n";
|
||||
$html .= "\t\t<td width=\"5%\">Field</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($fno=0;$fno<$noflds;$fno++)
|
||||
{
|
||||
$name = $cols[$fno];
|
||||
$values = $head[$name];
|
||||
$title = $values['title'];
|
||||
if($title == '')
|
||||
{
|
||||
$title = $name;
|
||||
}
|
||||
$html .= "\t</tr>\n";
|
||||
$html .= "\t\t<td bgcolor=\"#FFFFFF\">$fno</td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"#FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$fno\"></td>\n";
|
||||
$html .= "\t\t<td bgcolor=\"#FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n";
|
||||
$value = $rows[0][$name]['value'];
|
||||
$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 .= '<option value="'.$itm.'" ';
|
||||
if($itm == $sel)
|
||||
{
|
||||
$html .= 'selected ';
|
||||
}
|
||||
$html .= '>'.$itm."</option>\n";
|
||||
}
|
||||
$html .= "</select>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function make_printlist($layout,$cols)
|
||||
{
|
||||
// Build Printlist... (Col and Row Spans...)
|
||||
$tlayout = $layout;
|
||||
$printlist = array();
|
||||
$mrows = count($tlayout);
|
||||
$mcols = count($tlayout[0]);
|
||||
for($pr=0;$pr<$mrows;$pr++)
|
||||
{
|
||||
for($pc=0;$pc<$mcols;$pc++)
|
||||
{
|
||||
if(isset($tlayout[$pr][$pc]))
|
||||
{
|
||||
$cno = $tlayout[$pr][$pc];
|
||||
$cname = $cols[$cno];
|
||||
$colspan=1;
|
||||
$rowspan=1;
|
||||
while(($pr + $rowspan < $mrows) && ($tlayout[$pr + $rowspan][$pc] == $cno))
|
||||
{
|
||||
unset($tlayout[$pr + $rowspan][$pc]);
|
||||
$rowspan++;
|
||||
}
|
||||
while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno))
|
||||
{
|
||||
unset($tlayout[$pr][$pc+$colspan]);
|
||||
$colspan++;
|
||||
}
|
||||
if($colspan > 1 && $rowspan > 1)
|
||||
{
|
||||
for($r=$pr+1;$r<$pr+$rowspan;$r++)
|
||||
{
|
||||
for($c=$pc+1;$c<$pc+$colspan;$c++)
|
||||
{
|
||||
unset($tlayout[$r][$c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$printlist[] = array(
|
||||
'#name' =>$cname,
|
||||
'rowspan' =>$rowspan,
|
||||
'colspan' =>$colspan,
|
||||
'valign' =>'top',
|
||||
'#colno' =>$cno,
|
||||
'#eor' =>0
|
||||
);
|
||||
}
|
||||
}
|
||||
$printlist[count($printlist)-1]['#eor'] = '1';
|
||||
}
|
||||
return $printlist;
|
||||
}
|
||||
|
||||
function make_tblhead($printlist,$head)
|
||||
{
|
||||
// Build Title Row
|
||||
$table = array();
|
||||
reset($printlist);
|
||||
while(list($pc,$pcol)=each($printlist))
|
||||
{
|
||||
$cname = $pcol['#name'];
|
||||
$values = $head[$cname];
|
||||
$title = $values['#title'];
|
||||
if($title == '')
|
||||
{
|
||||
$title = $cname;
|
||||
}
|
||||
$cparms = $this->arr_merge($values['#parms_hdr'],$pcol);
|
||||
$cparms['value']=$title;
|
||||
$table[0][$pc] = $cparms;
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
function html_head($head,$table,$printlist)
|
||||
{
|
||||
$html = '';
|
||||
$tparams = $this->makeparms($head['#table_parms']);
|
||||
$html .= "<table $tparams>\n";
|
||||
$rp = $this->makeparms($head['#head_parms']);
|
||||
// $html .= "\t<tr $rp> <comment header>\n";
|
||||
$html .= "\t<tr $rp> \n";
|
||||
|
||||
$row = $table[0];
|
||||
reset($row);
|
||||
$intr = true;
|
||||
while(list(,$col)=each($row))
|
||||
{
|
||||
if(!$intr)
|
||||
{
|
||||
$html .= "\t<tr $rp>\n";
|
||||
$intr = true;
|
||||
}
|
||||
$cname = $col['#name'];
|
||||
$cp = $this->makeparms($col);
|
||||
$html .= "\t\t<td $cp>".$col['value']."</td>\n";
|
||||
if($col['#eor']=='1')
|
||||
{
|
||||
$html .= "\t</tr>\n";
|
||||
$intr = false;
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function arr_merge($a1='',$a2='',$a3='',$a4='',$a5='',$a6='',$a7='',$a8='')
|
||||
{
|
||||
$out = array();
|
||||
$test = array($a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8);
|
||||
while(list(,$val) = each($test))
|
||||
{
|
||||
if(is_array($val))
|
||||
{
|
||||
$out += $val;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
function arr_keys($fields,$array=True)
|
||||
{
|
||||
@reset($fields);
|
||||
while(list($key,$val) = @each($fields))
|
||||
{
|
||||
$fkeys .= $key . ',';
|
||||
}
|
||||
$fkeys = substr($fkeys,0,-1);
|
||||
if($array)
|
||||
{
|
||||
$ex = explode(',',$fkeys);
|
||||
return $ex;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $fkeys;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - solog *
|
||||
* http://www.egroupware.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 $accounts_table = 'egw_accounts';
|
||||
var $log_table = 'egw_log';
|
||||
var $msg_table = 'egw_log_msg';
|
||||
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()
|
||||
{
|
||||
$this->db = clone($GLOBALS['egw']->db);
|
||||
}
|
||||
|
||||
function get_error_cols()
|
||||
{
|
||||
if ($this->error_cols == '')
|
||||
{
|
||||
$this->error_cols = array();
|
||||
|
||||
/* fields from log table */
|
||||
$clist = $this->db->metadata($this->log_table);
|
||||
for ($i=0; $i<count($clist); $i++)
|
||||
{
|
||||
$name = $clist[$i]['name'];
|
||||
$this->error_cols[$name] = array();
|
||||
}
|
||||
|
||||
/* fields from msg table */
|
||||
$clist = $this->db->metadata($this->msg_table);
|
||||
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 from accounts-table */
|
||||
$clist = $this->db->metadata($this->accounts_table);
|
||||
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 (!isset($parms['from']))
|
||||
{
|
||||
$parms['from'] = array($this->accounts_table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$parms['from'][] = $this->accounts_table;
|
||||
}
|
||||
|
||||
/* Fix Where */
|
||||
if (!isset($parms['where']))
|
||||
{
|
||||
$parms['where'] = array("$this->log_table.log_user = $this->accounts_table.account_id");
|
||||
}
|
||||
else
|
||||
{
|
||||
$parms['where'][] = "$this->log_table.log_user = $this->accounts_table.account_id";
|
||||
}
|
||||
|
||||
/* Fix Default Fields */
|
||||
if (!isset($parms['fields']))
|
||||
{
|
||||
$parms['fields'] = $this->get_error_cols_e();
|
||||
}
|
||||
|
||||
return $this->get_error($parms);
|
||||
}
|
||||
|
||||
function get_no_errors()
|
||||
{
|
||||
/* Get max ErrorId */
|
||||
$this->db->query("select count(*) as max_id from $this->log_table, $this->msg_table WHERE $this->log_table.log_id = $this->msg_table.log_msg_log_id",__LINE__,__FILE__);
|
||||
|
||||
return $this->db->next_record() ? $this->db->f('max_id') : 0;
|
||||
}
|
||||
|
||||
function get_error($parms)
|
||||
{
|
||||
/* Get parameter values */
|
||||
$from = $parms['from'];
|
||||
$where = $parms['where'];
|
||||
$orderby = $parms['orderby'];
|
||||
$fields = $parms['fields'];
|
||||
|
||||
/* Build From_Clause */
|
||||
$from_clause = "FROM $this->log_table , $this->msg_table ";
|
||||
if (isset($from))
|
||||
{
|
||||
$from[] = $this->log_table;
|
||||
$from[] = $this->msg_table;
|
||||
$from_clause = 'FROM '.implode(', ' , $from).' ';
|
||||
}
|
||||
|
||||
/* Build Where_Clause */
|
||||
$where_clause = "WHERE $this->log_table.log_id = $this->msg_table.log_msg_log_id ";
|
||||
if (isset($where))
|
||||
{
|
||||
$where[] = "$this->log_table.log_id = $this->msg_table.log_msg_log_id";
|
||||
$where_clause = 'WHERE ' . implode(' AND ',$where) . ' ';
|
||||
}
|
||||
|
||||
/* Build Order_By_Clause */
|
||||
$orderby_clause = "ORDER BY $this->log_table.log_id, $this->msg_table.log_msg_seq_no ";
|
||||
if (isset($orderby))
|
||||
{
|
||||
$orderby_clause = 'ORDER BY ' . implode(', ',$orderby);
|
||||
}
|
||||
|
||||
/* If no Fields specified default to * */
|
||||
if (!isset($fields))
|
||||
{
|
||||
$fields = $this->get_error_cols();
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
|
||||
$select = 'SELECT ' . implode(',',array_keys($fields)) . ' ' . $from_clause . $where_clause . $orderby_clause;
|
||||
$this->db->query($select,__LINE__,__FILE__);
|
||||
while($this->db->next_record())
|
||||
{
|
||||
foreach($fields as $fname => $fopt)
|
||||
{
|
||||
$this_row[$fname]['value'] = $this->db->f($fname);
|
||||
}
|
||||
$rows[] = $this_row;
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
<?php
|
||||
/***************************************************************************\
|
||||
* eGroupWare - uilog *
|
||||
* http://www.egroupware.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()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('error_log_access',1,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
|
||||
$_cols = $_POST['_cols'];
|
||||
$nocols = $_POST['nocols'];
|
||||
$_delcol = $_POST['_delcol'];
|
||||
$layout = $_POST['layout'];
|
||||
$editable = $_GET['editable'];
|
||||
$modifytable = $_GET['modifytable'] ? $_GET['modifytable'] : $_POST['modifytable'];
|
||||
|
||||
$this->bolog =& CreateObject('admin.bolog',True);
|
||||
$this->html =& CreateObject('admin.html_tables');
|
||||
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->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 ($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<count($_cols);$i++)
|
||||
{
|
||||
if (!in_array($i, $_delcol))
|
||||
{
|
||||
$c[] = $_cols[$i];
|
||||
}
|
||||
}
|
||||
$this->fields_inc = $c;
|
||||
}
|
||||
|
||||
// Reset Mode to display...
|
||||
$this->editmode = False;
|
||||
$this->layout = $layout;
|
||||
|
||||
// Save the fields_inc values in Session and User Preferences...
|
||||
$data = array('fields_inc'=>$this->fields_inc,'layout'=>$layout);
|
||||
$GLOBALS['egw']->session->appsession('session_data','log',$data);
|
||||
$GLOBALS['egw']->preferences->read_repository();
|
||||
$GLOBALS['egw']->preferences->delete('log','fields_inc');
|
||||
$GLOBALS['egw']->preferences->add('log','fields_inc',$this->fields_inc);
|
||||
$GLOBALS['egw']->preferences->delete('log','layout');
|
||||
$GLOBALS['egw']->preferences->add('log','layout',$this->layout);
|
||||
$GLOBALS['egw']->preferences->save_repository();
|
||||
}
|
||||
|
||||
// Make sure that $this->fields_inc is filled
|
||||
if ( !isset($this->field_inc))
|
||||
{
|
||||
// Need to fill from Session Data...
|
||||
$data = $GLOBALS['egw']->session->appsession('session_data','log');
|
||||
if (isset($data) && isset($data['fields_inc']))
|
||||
{
|
||||
$this->fields_inc = $data['fields_inc'];
|
||||
$this->layout = $data['layout'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->preferences->read_repository();
|
||||
// Get From User Profile...
|
||||
if (@$GLOBALS['egw_info']['user']['preferences']['log']['fields_inc'])
|
||||
{
|
||||
$fields_inc = $GLOBALS['egw_info']['user']['preferences']['log']['fields_inc'];
|
||||
$this->fields_inc = $fields_inc;
|
||||
$layout = $GLOBALS['egw_info']['user']['preferences']['log']['layout'];
|
||||
$this->layout = $layout;
|
||||
$GLOBALS['egw']->session->appsession('session_data','log',array('fields_inc'=>$fields_inc,'layout'=>$layout));
|
||||
}
|
||||
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',
|
||||
'log_msg_file',
|
||||
'log_msg_line'
|
||||
);
|
||||
$this->layout[]= array(0,1,2,3,4,5,6,7,8,9);
|
||||
$this->layout[]= array(0,1,2,3,4,5,6,7,10,11);
|
||||
|
||||
// Store defaults in session data...
|
||||
$GLOBALS['egw']->session->appsession(
|
||||
'session_data',
|
||||
'log',
|
||||
array(
|
||||
'fields_inc'=>$this->fields_inc,
|
||||
'layout'=>$this->layout
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} // Values already filled...
|
||||
reset($this->fields_inc);
|
||||
while(list($cno,$cname)=each($this->fields_inc))
|
||||
{
|
||||
$this->column[$cname]=$cno;
|
||||
}
|
||||
}
|
||||
|
||||
function list_log()
|
||||
{
|
||||
if (False) // add some errors to the log...
|
||||
{
|
||||
// Test 1: single Error line immedeately to errorlog
|
||||
// (could be type Debug, Info, Warning, or Error)
|
||||
$GLOBALS['egw']->log->write(array('text'=>'I-TestWrite, write: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
|
||||
// Test 2: A message should appear in log even if clearstack is called
|
||||
$GLOBALS['egw']->log->message(array('text'=>'I-TestMsg, msg: %1','p1'=>'This message should appear in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should not be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->clearstack();
|
||||
$GLOBALS['egw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 3: one debug message
|
||||
$GLOBALS['egw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 3: debug and one informational
|
||||
$GLOBALS['egw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 4: an informational and a Warning
|
||||
$GLOBALS['egw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 5: and an error
|
||||
$GLOBALS['egw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->commit(); // commit error stack to log...
|
||||
|
||||
// Test 6: and finally a fatal...
|
||||
$GLOBALS['egw']->log->error(array('text'=>'D-Debug, dbg: %1','p1'=>'This debug statment should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'I-TestInfo, info: %1','p1'=>'This Informational should be in log','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'W-TestWarn, warn: %1','p1'=>'This is a test Warning','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'E-TestError, err: %1','p1'=>'This is a test Error','file'=>__FILE__,'line'=>__LINE__));
|
||||
$GLOBALS['egw']->log->error(array('text'=>'F-Abend, abort: %1','p1'=>'Force abnormal termination','file'=>__FILE__,'line'=>__LINE__));
|
||||
}
|
||||
$this->t->set_file(array('log_list_t' => 'log.tpl'));
|
||||
|
||||
// -------------------------- Layout Description -------------------------------
|
||||
$phycols = array('2%', '2%', '15%', '10%', '15%', '2%', '20%', '2%', '7%', '25%');
|
||||
// -------------------------- end Layout Description ---------------------------
|
||||
|
||||
// Get list of Possible Columns
|
||||
$header = $this->bolog->get_error_cols_e();
|
||||
|
||||
// Describe table layout...
|
||||
$header['#phycols'] = $phycols;
|
||||
$header['#layout'] = $this->layout;
|
||||
|
||||
// Set User Configured List of columns to show
|
||||
$header['_cols']= $this->fields_inc;
|
||||
|
||||
// Set Table formating parameters
|
||||
$header['#table_parms']=array('width'=>"98%", 'bgcolor'=>"#000000", 'border'=>"0");
|
||||
|
||||
// Set Header formating parameters
|
||||
$header['#head_parms']=array('bgcolor'=>"#D3DCFF");
|
||||
|
||||
// Column Log_ID
|
||||
$header['log_id']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_id']['#title'] = 'Id';
|
||||
$header['log_id']['align'] = 'center';
|
||||
|
||||
// Column Log_Severity
|
||||
$header['log_severity']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_severity']['#title'] = 'S';
|
||||
$header['log_severity']['align'] = 'center';
|
||||
|
||||
// Column Trans Date
|
||||
$header['log_date_e']['#title'] = 'Tans. Date';
|
||||
|
||||
// Column Application
|
||||
$header['log_app']['#title'] = 'App.';
|
||||
|
||||
// Column FullName
|
||||
$header['log_full_name']['#title'] = 'User';
|
||||
$header['log_full_name']['align'] = 'center';
|
||||
|
||||
// Column log_msg_seq_no
|
||||
$header['log_msg_seq_no']['#parms_hdr'] = array('align'=>"center");
|
||||
$header['log_msg_seq_no']['#title'] = 'Sno';
|
||||
$header['log_msg_seq_no']['align'] = 'center';
|
||||
|
||||
// Column log_msg_seq_no
|
||||
$header['log_msg_date_e']['#title'] = 'TimeStamp';
|
||||
$header['log_msg_severity']['#title'] = 'S';
|
||||
$header['log_msg_severity']['align'] = 'center';
|
||||
$header['log_msg_code']['#title'] = 'Code';
|
||||
$header['log_msg_text']['#title'] = 'Error Msg';
|
||||
$header['log_msg_file']['#title'] = 'File';
|
||||
$header['log_msg_line']['#title'] = 'Line';
|
||||
|
||||
// Set up Grouping, Suppression...
|
||||
$header['_groupby']=array('log_id'=>1);
|
||||
$header['_supres']=array('log_id'=>1,'log_severity'=>1,'log_date_e'=>1,'log_app'=>1,'log_full_name'=>1);
|
||||
|
||||
// Hack Get All Rows
|
||||
$rows = $this->bolog->get_error_e(array('orderby'=>array('log_id','log_msg_log_id')));
|
||||
$norows = count($rows);
|
||||
$header['_edittable']=$this->editmode;
|
||||
$table = $this->html->hash_table($rows,$header,$this, 'format_row');
|
||||
$this->t->set_var('event_list',$table);
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.($this->editmode?lang('Edit Table format') : lang('View error log'));
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo parse_navbar();
|
||||
$this->t->pfp('out','log_list_t');
|
||||
// $this->set_app_langs();
|
||||
}
|
||||
|
||||
function format_row($rno, $row)
|
||||
{
|
||||
switch($row['log_severity']['value'])
|
||||
{
|
||||
case 'D': $row['log_severity']['bgcolor'] = '#D3DCFF'; break;
|
||||
case 'I': $row['log_severity']['bgcolor'] = '#C0FFC0'; break;
|
||||
case 'W': $row['log_severity']['bgcolor'] = '#FFFFC0'; break;
|
||||
case 'E': $row['log_severity']['bgcolor'] = '#FFC0C0'; break;
|
||||
case 'F': $row['log_severity']['bgcolor'] = '#FF0909'; break;
|
||||
}
|
||||
|
||||
switch($row['log_msg_severity']['value'])
|
||||
{
|
||||
case 'D': $color = '#D3DCFF'; break;
|
||||
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($cno,$fld) = each($this->fields_inc))
|
||||
{
|
||||
if (substr($fld,0,7) == 'log_msg')
|
||||
{
|
||||
$row[$fld]['bgcolor'] = $color;
|
||||
}
|
||||
else
|
||||
{
|
||||
// $row[$cno]['bgcolor'] = $lcolor;
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
?>
|
@ -47,8 +47,6 @@ class auth_ldap implements auth_backend
|
||||
|
||||
if(!$ldap = common::ldapConnect())
|
||||
{
|
||||
$GLOBALS['egw']->log->message('F-Abort, Failed connecting to LDAP server for authenication, execution stopped');
|
||||
$GLOBALS['egw']->log->commit();
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -167,8 +165,6 @@ class auth_ldap implements auth_backend
|
||||
|
||||
if(!$ldap = common::ldapConnect())
|
||||
{
|
||||
$GLOBALS['egw']->log->message('F-Abort, Failed connecting to LDAP server for authenication, execution stopped');
|
||||
$GLOBALS['egw']->log->commit();
|
||||
return False;
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ class egw extends egw_minimal
|
||||
* @param string The url ro redirect to
|
||||
* @param string $link_app=null appname to redirect for, default currentapp
|
||||
*/
|
||||
static function redirect($url, $link_app)
|
||||
static function redirect($url, $link_app=null)
|
||||
{
|
||||
// Determines whether the current output buffer should be flushed
|
||||
$do_flush = true;
|
||||
|
@ -543,16 +543,6 @@ class egw_session
|
||||
$GLOBALS['egw_info']['user'] = $this->read_repositories();
|
||||
if ($GLOBALS['egw']->accounts->is_expired($GLOBALS['egw_info']['user']))
|
||||
{
|
||||
if(is_object($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message(array(
|
||||
'text' => 'W-LoginFailure, account loginid %1 is expired',
|
||||
'p1' => $this->account_lid,
|
||||
'line' => __LINE__,
|
||||
'file' => __FILE__
|
||||
));
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
$this->reason = 'account is expired';
|
||||
$this->cd_reason = 98;
|
||||
|
||||
@ -951,16 +941,6 @@ class egw_session
|
||||
if ($GLOBALS['egw']->accounts->is_expired($GLOBALS['egw_info']['user']))
|
||||
{
|
||||
if (self::ERROR_LOG_DEBUG) error_log("*** session::verify($sessionid) accounts is expired");
|
||||
if(is_object($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message(array(
|
||||
'text' => 'W-VerifySession, account loginid %1 is expired',
|
||||
'p1' => $this->account_lid,
|
||||
'line' => __LINE__,
|
||||
'file' => __FILE__
|
||||
));
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$this->passwd = base64_decode(egw_cache::getSession('phpgwapi', 'password'));
|
||||
@ -972,17 +952,6 @@ class egw_session
|
||||
if ($this->account_domain != $GLOBALS['egw_info']['user']['domain'])
|
||||
{
|
||||
if (self::ERROR_LOG_DEBUG) error_log("*** session::verify($sessionid) wrong domain");
|
||||
if(is_object($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message(array(
|
||||
'text' => 'W-VerifySession, the domains %1 and %2 don\'t match',
|
||||
'p1' => $userid_array[1],
|
||||
'p2' => $GLOBALS['egw_info']['user']['domain'],
|
||||
'line' => __LINE__,
|
||||
'file' => __FILE__
|
||||
));
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -992,18 +961,6 @@ class egw_session
|
||||
$GLOBALS['egw_info']['user']['session_ip'] != $this->getuser_ip()))
|
||||
{
|
||||
if (self::ERROR_LOG_DEBUG) error_log("*** session::verify($sessionid) wrong IP");
|
||||
if(is_object($GLOBALS['egw']->log))
|
||||
{
|
||||
// This needs some better wording
|
||||
$GLOBALS['egw']->log->message(array(
|
||||
'text' => 'W-VerifySession, IP %1 doesn\'t match IP %2 in session table',
|
||||
'p1' => $this->getuser_ip(),
|
||||
'p2' => $GLOBALS['egw_info']['user']['session_ip'],
|
||||
'line' => __LINE__,
|
||||
'file' => __FILE__
|
||||
));
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1017,17 +974,6 @@ class egw_session
|
||||
if (!$this->account_lid)
|
||||
{
|
||||
if (self::ERROR_LOG_DEBUG) error_log("*** session::verify($sessionid) !account_lid");
|
||||
if(is_object($GLOBALS['egw']->log))
|
||||
{
|
||||
// This needs some better wording
|
||||
$GLOBALS['egw']->log->message(array(
|
||||
'text' => 'W-VerifySession, account_id is empty',
|
||||
'line' => __LINE__,
|
||||
'file' => __FILE__
|
||||
));
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
//echo 'DEBUG: Sessions: account_id is empty!<br>'."\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,114 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - eventlog *
|
||||
* http://www.egroupware.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 $fname;
|
||||
var $line;
|
||||
var $app;
|
||||
|
||||
var $public_functions = array();
|
||||
|
||||
// Translate Message into Language
|
||||
function langmsg()
|
||||
{
|
||||
return lang($this->msg,$this->parms);
|
||||
}
|
||||
|
||||
function error($parms)
|
||||
{
|
||||
if ($parms == '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
$etext = $parms['text'];
|
||||
$parray = Array();
|
||||
for($counter=1;$counter<=10;$counter++)
|
||||
{
|
||||
$str = 'p_'.$counter;
|
||||
if(isset($parms[$str]) && !empty($parms[$str]))
|
||||
{
|
||||
$parray[$counter] = $parms[$str];
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = 'p'.$counter;
|
||||
if(isset($parms[$str]) && !empty($parms[$str]))
|
||||
{
|
||||
$parray[$counter] = $parms[$str];
|
||||
}
|
||||
}
|
||||
}
|
||||
$fname = $parms['file'];
|
||||
$line = $parms['line'];
|
||||
if (preg_match('/([DIWEF])-([[:alnum:]]*)\, (.*)/i',$etext,$match))
|
||||
{
|
||||
$this->severity = strtoupper($match[1]);
|
||||
$this->code = $match[2];
|
||||
$this->msg = trim($match[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->msg = trim($etext);
|
||||
}
|
||||
|
||||
@reset($parray);
|
||||
while( list($key,$val) = each( $parray ) )
|
||||
{
|
||||
$this->msg = preg_replace( "/%$key/", "'".$val."'", $this->msg );
|
||||
}
|
||||
@reset($parray);
|
||||
|
||||
$this->timestamp = time();
|
||||
$this->parms = $parray;
|
||||
$this->ismsg = $parms['ismsg'];
|
||||
$this->fname = $fname;
|
||||
$this->line = $line;
|
||||
$this->app = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||
|
||||
if (!$this->fname or !$this->line)
|
||||
{
|
||||
$GLOBALS['phpgw']->log->error(array(
|
||||
'text'=>'W-PGMERR, Programmer failed to pass __FILE__ and/or __LINE__ in next log message',
|
||||
'file'=>__FILE__,'line'=>__LINE__
|
||||
));
|
||||
}
|
||||
|
||||
$GLOBALS['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 $GLOBALS['phpgw']->log->astable();
|
||||
echo "</center>";
|
||||
// Commit stack to log
|
||||
$GLOBALS['phpgw']->log->commit();
|
||||
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - errorlog *
|
||||
* http://www.egroupware.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 errorlog
|
||||
{
|
||||
/***************************\
|
||||
* Instance Variables... *
|
||||
\***************************/
|
||||
var $errorstack = array();
|
||||
var $public_functions = array(
|
||||
'message',
|
||||
'error',
|
||||
'iserror',
|
||||
'severity',
|
||||
'commit',
|
||||
'clearstack',
|
||||
'astable'
|
||||
);
|
||||
var $log_table = 'egw_log';
|
||||
var $msg_table = 'egw_log_msg';
|
||||
|
||||
function message($parms)
|
||||
{
|
||||
$parms['ismsg']=1;
|
||||
CreateObject('phpgwapi.error',$parms);
|
||||
return true;
|
||||
}
|
||||
|
||||
function error($parms)
|
||||
{
|
||||
$parms['ismsg']=0;
|
||||
CreateObject('phpgwapi.error',$parms);
|
||||
return true;
|
||||
}
|
||||
|
||||
function write($parms)
|
||||
{
|
||||
$parms['ismsg']=0;
|
||||
$save = $this->errorstack;
|
||||
$this->errorstack = array();
|
||||
CreateObject('phpgwapi.error',$parms);
|
||||
$this->commit();
|
||||
$this->errorstack = $save;
|
||||
return true;
|
||||
}
|
||||
|
||||
function iserror($parms)
|
||||
{
|
||||
$ecode = $parms['code'];
|
||||
foreach($this->errorstack as $err)
|
||||
{
|
||||
if ($ecode == $err->code)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function severity()
|
||||
{
|
||||
$max = 'D';
|
||||
foreach($this->errorstack as $err)
|
||||
{
|
||||
switch($err->severity)
|
||||
{
|
||||
case 'F':
|
||||
return 'F';
|
||||
break;
|
||||
case 'E':
|
||||
$max = 'E';
|
||||
break;
|
||||
case 'W':
|
||||
if ($max != 'E')
|
||||
{
|
||||
$max = 'W';
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
if ($max == 'D')
|
||||
{
|
||||
$max = 'I';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $max;
|
||||
}
|
||||
|
||||
function commit()
|
||||
{
|
||||
$db = clone($GLOBALS['egw']->db);
|
||||
|
||||
$db->insert($this->log_table,array(
|
||||
'log_date' => $GLOBALS['egw']->db->to_timestamp(time()),
|
||||
'log_user' => $GLOBALS['egw_info']['user']['account_id'],
|
||||
'log_app' => $GLOBALS['egw_info']['flags']['currentapp'],
|
||||
'log_severity' => $this->severity(),
|
||||
),false,__LINE__,__FILE__);
|
||||
|
||||
$log_id = $db->get_last_insert_id($this->log_table,'log_id');
|
||||
|
||||
foreach($this->errorstack as $i => $err)
|
||||
{
|
||||
$db->insert($this->msg_table,array(
|
||||
'log_msg_log_id' => $log_id,
|
||||
'log_msg_seq_no' => $i,
|
||||
'log_msg_date' => $GLOBALS['egw']->db->to_timestamp($err->timestamp),
|
||||
'log_msg_severity' => $err->severity,
|
||||
'log_msg_code' => $err->code,
|
||||
'log_msg_msg' => $err->msg,
|
||||
'log_msg_parms' => implode('|',(array)$err->parms),
|
||||
'log_msg_file' => $err->fname,
|
||||
'log_msg_line' => $err->line,
|
||||
),false,__LINE__,__FILE__);
|
||||
}
|
||||
$this->errorstack = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
||||
function astable()
|
||||
{
|
||||
$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\t<td >File</td>\n";
|
||||
$html .= "\t\t<td >Line</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
|
||||
$errorstack = $this->errorstack;
|
||||
for ($i = 0; $i < count($errorstack); $i++)
|
||||
{
|
||||
$err = $errorstack[$i];
|
||||
switch ($err->severity)
|
||||
{
|
||||
case 'D': $color = 'D3DCFF'; break;
|
||||
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>".$GLOBALS['egw']->common->show_date($err->timestamp)."</td>\n";
|
||||
$html .= "\t\t<td>".$err->app."  </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\t<td>".$err->fname."</td>\n";
|
||||
$html .= "\t\t<td>".$err->line."</td>\n";
|
||||
$html .= "\t</tr>\n";
|
||||
}
|
||||
$html .= "</table>\n";
|
||||
$html .= "</center>\n";
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
@ -129,12 +129,6 @@ class ldap
|
||||
{
|
||||
if(!function_exists('ldap_connect'))
|
||||
{
|
||||
/* log does not exist in setup(, yet) */
|
||||
if(isset($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message('F-Abort, LDAP support unavailable');
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
if ($this->exception_on_error) throw new egw_exception_assertion_failed('LDAP support unavailable!');
|
||||
|
||||
printf('<b>Error: LDAP support unavailable</b><br>',$host);
|
||||
@ -196,12 +190,6 @@ class ldap
|
||||
// connect to ldap server (never fails, as connection happens in bind!)
|
||||
if(!$this->ds = ldap_connect($host, $port))
|
||||
{
|
||||
/* log does not exist in setup(, yet) */
|
||||
if(isset($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message('F-Abort, Failed connecting to LDAP server');
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -220,7 +208,7 @@ class ldap
|
||||
$this->ldapServerInfo->host != $host)
|
||||
{
|
||||
//error_log("no ldap server info found");
|
||||
$ldapbind = @ldap_bind($this->ds, $GLOBALS['egw_info']['server']['ldap_root_dn'], $GLOBALS['egw_info']['server']['ldap_root_pw']);
|
||||
@ldap_bind($this->ds, $GLOBALS['egw_info']['server']['ldap_root_dn'], $GLOBALS['egw_info']['server']['ldap_root_pw']);
|
||||
|
||||
$this->ldapServerInfo = ldapserverinfo::get($this->ds, $host, $supportedLDAPVersion);
|
||||
$this->saveSessionData();
|
||||
@ -228,12 +216,6 @@ class ldap
|
||||
|
||||
if(!@ldap_bind($this->ds, $dn, $passwd))
|
||||
{
|
||||
if(isset($GLOBALS['egw']->log))
|
||||
{
|
||||
$GLOBALS['egw']->log->message('F-Abort, Failed binding to LDAP server');
|
||||
$GLOBALS['egw']->log->commit();
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@ $setup_info['phpgwapi']['tables'][] = 'egw_languages';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_lang';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_nextid';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_categories';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_log';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_log_msg';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_history_log';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_async';
|
||||
$setup_info['phpgwapi']['tables'][] = 'egw_api_content_history';
|
||||
|
@ -163,38 +163,6 @@ $phpgw_baseline = array(
|
||||
'ix' => array(array('cat_appname','cat_owner','cat_parent','cat_level')),
|
||||
'uc' => array()
|
||||
),
|
||||
'egw_log' => array(
|
||||
'fd' => array(
|
||||
'log_id' => array('type' => 'auto','precision' => '4','nullable' => False),
|
||||
'log_date' => array('type' => 'timestamp','nullable' => False),
|
||||
'log_user' => array('type' => 'int','meta' => 'account','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()
|
||||
),
|
||||
'egw_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' => 'timestamp','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),
|
||||
'log_msg_file' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'log_msg_line' => array('type' => 'int','precision' => '4','nullable' => False)
|
||||
),
|
||||
'pk' => array('log_msg_log_id','log_msg_seq_no'),
|
||||
'fk' => array(),
|
||||
'ix' => array(),
|
||||
'uc' => array()
|
||||
),
|
||||
'egw_history_log' => array(
|
||||
'fd' => array(
|
||||
'history_id' => array('type' => 'auto','precision' => '4','nullable' => False),
|
||||
|
@ -590,5 +590,9 @@ function phpgwapi_upgrade1_9_021()
|
||||
}
|
||||
}
|
||||
|
||||
// drop not used egw_log and egw_log_msg tables
|
||||
$GLOBALS['egw_setup']->oProc->DropTable('egw_log');
|
||||
$GLOBALS['egw_setup']->oProc->DropTable('egw_log_msg');
|
||||
|
||||
return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '14.1';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user