Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
04637992
Commit
04637992
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
actionlog class: fix linebraek; reformat code
parent
9f45eeb3
No related branches found
No related tags found
1 merge request
!62
V2.0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/deployment/classes/actionlog.class.php
+114
-106
114 additions, 106 deletions
public_html/deployment/classes/actionlog.class.php
with
114 additions
and
106 deletions
public_html/deployment/classes/actionlog.class.php
+
114
−
106
View file @
04637992
...
@@ -6,7 +6,8 @@ require_once 'user.class.php';
...
@@ -6,7 +6,8 @@ require_once 'user.class.php';
*
*
* @author hahn
* @author hahn
*/
*/
class
Actionlog
{
class
Actionlog
{
private
$_dbfile
=
''
;
private
$_dbfile
=
''
;
private
$_aLoglevels
=
array
(
"info"
,
"warning"
,
"error"
,
"success"
);
// array of valid loglevels
private
$_aLoglevels
=
array
(
"info"
,
"warning"
,
"error"
,
"success"
);
// array of valid loglevels
...
@@ -44,7 +45,8 @@ class Actionlog {
...
@@ -44,7 +45,8 @@ class Actionlog {
* @global array $aConfig settings
* @global array $aConfig settings
* @param string $sProject project ID
* @param string $sProject project ID
*/
*/
public
function
__construct
(
$sProject
=
false
)
{
public
function
__construct
(
$sProject
=
false
)
{
global
$aConfig
;
global
$aConfig
;
if
(
!
isset
(
$aConfig
[
"appRootDir"
]))
{
if
(
!
isset
(
$aConfig
[
"appRootDir"
]))
{
die
(
__CLASS__
.
"::"
.
__FUNCTION__
.
" ERROR: configuration with
\$
aConfig was not loaded."
);
die
(
__CLASS__
.
"::"
.
__FUNCTION__
.
" ERROR: configuration with
\$
aConfig was not loaded."
);
...
@@ -71,7 +73,8 @@ class Actionlog {
...
@@ -71,7 +73,8 @@ class Actionlog {
/**
/**
* create sqlite database - called in constructor if the file does not exist
* create sqlite database - called in constructor if the file does not exist
*/
*/
private
function
_createDb
()
{
private
function
_createDb
()
{
echo
"try to create file
$this->_dbfile
...<br>
\n
"
;
echo
"try to create file
$this->_dbfile
...<br>
\n
"
;
return
$this
->
_makeQuery
(
$this
->
_sCreate
);
return
$this
->
_makeQuery
(
$this
->
_sCreate
);
}
}
...
@@ -81,7 +84,8 @@ class Actionlog {
...
@@ -81,7 +84,8 @@ class Actionlog {
* @param string $sSql sql statement
* @param string $sSql sql statement
* @return database object
* @return database object
*/
*/
private
function
_makeQuery
(
$sSql
)
{
private
function
_makeQuery
(
$sSql
)
{
// $this->_log(__FUNCTION__."($sSql)");
// $this->_log(__FUNCTION__."($sSql)");
// echo "<pre>".htmlentities($sSql)."</pre>";
// echo "<pre>".htmlentities($sSql)."</pre>";
$db
=
new
PDO
(
"sqlite:"
.
$this
->
_dbfile
);
$db
=
new
PDO
(
"sqlite:"
.
$this
->
_dbfile
);
...
@@ -102,7 +106,8 @@ class Actionlog {
...
@@ -102,7 +106,8 @@ class Actionlog {
* @param string $sLoglevel loglevel
* @param string $sLoglevel loglevel
* @return type
* @return type
*/
*/
public
function
add
(
$sMessage
,
$sAction
=
""
,
$sLoglevel
=
"info"
,
$sTimeStart
=
false
)
{
public
function
add
(
$sMessage
,
$sAction
=
""
,
$sLoglevel
=
"info"
,
$sTimeStart
=
false
)
{
if
(
array_search
(
$sLoglevel
,
$this
->
_aLoglevels
)
===
false
)
{
if
(
array_search
(
$sLoglevel
,
$this
->
_aLoglevels
)
===
false
)
{
die
(
__class__
.
": loglevel
$sLoglevel
is invalid"
);
die
(
__class__
.
": loglevel
$sLoglevel
is invalid"
);
}
}
...
@@ -143,7 +148,8 @@ class Actionlog {
...
@@ -143,7 +148,8 @@ class Actionlog {
* @param string $sOKChars good chars to keep
* @param string $sOKChars good chars to keep
* @return string
* @return string
*/
*/
private
function
_filterAllowedChars
(
$sVal
,
$sOKChars
){
private
function
_filterAllowedChars
(
$sVal
,
$sOKChars
)
{
return
preg_replace
(
'/[^'
.
$sOKChars
.
']/i'
,
''
,
$sVal
);
return
preg_replace
(
'/[^'
.
$sOKChars
.
']/i'
,
''
,
$sVal
);
}
}
...
@@ -157,7 +163,8 @@ class Actionlog {
...
@@ -157,7 +163,8 @@ class Actionlog {
* 'limit' - limit clausel - part behind "LIMIT "
* 'limit' - limit clausel - part behind "LIMIT "
* @return array
* @return array
*/
*/
public
function
getLogs
(
$aFilter
=
array
())
{
public
function
getLogs
(
$aFilter
=
array
())
{
// var_dump(R::findAll( 'log' ));
// var_dump(R::findAll( 'log' ));
$aReturn
=
array
();
$aReturn
=
array
();
...
@@ -203,7 +210,8 @@ class Actionlog {
...
@@ -203,7 +210,8 @@ class Actionlog {
* 'limit' - limit clausel - part behind "LIMIT "
* 'limit' - limit clausel - part behind "LIMIT "
* @return string
* @return string
*/
*/
public
function
renderLogs
(
$aFilter
=
array
(),
$bIsFullsearch
=
false
)
{
public
function
renderLogs
(
$aFilter
=
array
(),
$bIsFullsearch
=
false
)
{
$sReturn
=
''
;
$sReturn
=
''
;
static
$bWasShown
;
static
$bWasShown
;
...
@@ -239,7 +247,8 @@ class Actionlog {
...
@@ -239,7 +247,8 @@ class Actionlog {
),
),
'validate'
=>
array
(),
'validate'
=>
array
(),
'form'
=>
array
(),
'form'
=>
array
(),
));
)
);
// generate filter for log table
// generate filter for log table
// $bIsFullsearch: true = show all inputs; false: no interactive search
// $bIsFullsearch: true = show all inputs; false: no interactive search
...
@@ -280,12 +289,12 @@ class Actionlog {
...
@@ -280,12 +289,12 @@ class Actionlog {
'options'
=>
$aLimits
,
'options'
=>
$aLimits
,
'inline'
=>
true
,
'inline'
=>
true
,
);
);
// force a line break
$aForms
[
"filter"
][
"form"
][
'line'
]
=
array
(
$aForms
[
"filter"
][
"form"
][
'line'
]
=
array
(
'type'
=>
'markup'
,
'type'
=>
'markup'
,
'value'
=>
''
,
'value'
=>
'
<div class="col-sm-12"></div>
'
,
);
);
}
else
{
}
else
{
// write filters as hidden fields
// write filters as hidden fields
...
@@ -310,7 +319,7 @@ class Actionlog {
...
@@ -310,7 +319,7 @@ class Actionlog {
'onkeyup'
=>
'filterLogTable();'
,
'onkeyup'
=>
'filterLogTable();'
,
'onkeypress'
=>
'filterLogTable();'
,
'onkeypress'
=>
'filterLogTable();'
,
'onchange'
=>
'filterLogTable();'
,
'onchange'
=>
'filterLogTable();'
,
'size'
=>
20
,
//
'size' => 20,
);
);
if
(
!
$bIsFullsearch
)
{
if
(
!
$bIsFullsearch
)
{
$aForms
[
"filter"
][
"form"
][
'btnalllogs'
]
=
array
(
$aForms
[
"filter"
][
"form"
][
'btnalllogs'
]
=
array
(
...
@@ -386,5 +395,4 @@ class Actionlog {
...
@@ -386,5 +395,4 @@ class Actionlog {
}
}
return
$sReturn
;
return
$sReturn
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment