Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1161763
system_log_tp.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Sep 20, 1:22 PM
Size
5 KB
Mime Type
text/x-php
Expires
Mon, Sep 22, 1:22 PM (6 h, 29 m)
Engine
blob
Format
Raw Data
Handle
751564
Attached To
rINP In-Portal
system_log_tp.php
View Options
<?php
/**
* @version $Id: system_log_tp.php 16843 2025-08-31 16:33:29Z alex $
* @package In-Portal
* @copyright Copyright (C) 1997 - 2012 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
class
SystemLogTagProcessor
extends
kDBTagProcessor
{
/**
* Displays filename
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
Filename
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$filename
=
$object
->
GetDBField
(
'LogSourceFilename'
);
if
(
!
$filename
)
{
return
''
;
}
return
preg_replace
(
'/^'
.
preg_quote
(
FULL_PATH
,
'/'
)
.
'/'
,
'...'
,
$filename
,
1
);
}
/**
* Displays filename
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
RequestURI
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$request_uri
=
$object
->
GetDBField
(
'LogRequestURI'
);
if
(
!
$request_uri
)
{
return
''
;
}
return
preg_replace
(
'/^'
.
preg_quote
(
BASE_PATH
,
'/'
)
.
'/'
,
'...'
,
$request_uri
,
1
);
}
/**
* Displays used memory
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
MemoryUsage
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
return
kUtil
::
formatSize
(
$object
->
GetDBField
(
'LogMemoryUsed'
));
}
/**
* Prints serialized array
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
PrintArray
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$field
=
$params
[
'field'
];
$value
=
$object
->
GetDBField
(
$field
);
if
(
!
$value
)
{
return
''
;
}
return
kUtil
::
varDumpColorized
(
unserialize
(
$value
),
'system-log-edit'
);
}
/**
* Prints backtrace result
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
PrintBacktrace
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$value
=
$object
->
GetDBField
(
'LogBacktrace'
);
if
(
!
$value
)
{
return
''
;
}
$ret
=
''
;
$trace
=
unserialize
(
$value
);
$include_args
=
isset
(
$params
[
'include_args'
])
?
$params
[
'include_args'
]
:
false
;
$include_code_fragment
=
isset
(
$params
[
'include_code_fragment'
])
?
$params
[
'include_code_fragment'
]
:
false
;
$strip_tags
=
isset
(
$params
[
'strip_tags'
])
?
$params
[
'strip_tags'
]
:
false
;
$block_params
=
$this
->
prepareTagParams
(
$params
);
$block_params
[
'name'
]
=
$params
[
'render_as'
];
foreach
(
$trace
as
$index
=>
$trace_info
)
{
$block_params
[
'index'
]
=
$index
;
if
(
isset
(
$trace_info
[
'file'
])
)
{
$function_name
=
isset
(
$trace_info
[
'class'
])
?
$trace_info
[
'class'
]
.
$trace_info
[
'type'
]
.
$trace_info
[
'function'
]
:
$trace_info
[
'function'
];
$block_params
[
'file_info'
]
=
$function_name
.
' in <b>'
.
basename
(
$trace_info
[
'file'
])
.
'</b> on line <b>'
.
$trace_info
[
'line'
]
.
'</b>'
;
if
(
$strip_tags
)
{
$block_params
[
'file_info'
]
=
strip_tags
(
$block_params
[
'file_info'
]);
}
}
else
{
$block_params
[
'file_info'
]
=
'no file information available'
;
}
$block_params
[
'has_args'
]
=
isset
(
$trace_info
[
'args'
]);
$block_params
[
'has_code_fragment'
]
=
isset
(
$trace_info
[
'code_fragment'
]);
if
(
$include_args
)
{
if
(
$block_params
[
'has_args'
]
)
{
$block_params
[
'args'
]
=
kUtil
::
varDumpColorized
(
$trace_info
[
'args'
],
'system-log-edit'
);
}
else
{
$block_params
[
'args'
]
=
''
;
}
}
if
(
$include_code_fragment
)
{
if
(
$block_params
[
'has_code_fragment'
]
)
{
$block_params
[
'code_fragment'
]
=
$this
->
highlightString
(
$trace_info
[
'code_fragment'
]);
}
else
{
$block_params
[
'code_fragment'
]
=
''
;
}
}
$ret
.=
$this
->
Application
->
ParseBlock
(
$block_params
);
}
return
$ret
;
}
/**
* Prints a code fragment.
*
* @param array $params Tag params.
*
* @return string
*/
protected
function
PrintCodeFragment
(
array
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$code_fragment
=
$object
->
GetDBField
(
'LogCodeFragment'
);
if
(
$code_fragment
)
{
return
$this
->
highlightString
(
$code_fragment
);
}
return
''
;
}
/**
* Prints backtrace record index
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
BacktraceIndex
(
$params
)
{
$index
=
$this
->
Application
->
Parser
->
GetParam
(
'index'
)
+
1
;
return
str_pad
(
$index
,
3
,
' '
,
STR_PAD_LEFT
);
}
public
function
highlightString
(
$string
)
{
$string
=
str_replace
(
Array
(
'
\\
'
,
'/'
),
Array
(
'_nms1_'
,
'_nms2_'
),
$string
);
$string
=
highlight_string
(
'<?php '
.
$string
.
' ?>'
,
true
);
$string
=
str_replace
(
Array
(
'_nms1_'
,
'_nms2_'
),
Array
(
'
\\
'
,
'/'
),
$string
);
return
str_replace
(
Array
(
'<?php '
,
'?>'
),
''
,
$string
);
}
}
Event Timeline
Log In to Comment