Skip to content
Snippets Groups Projects
Commit 04637992 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

actionlog class: fix linebraek; reformat code

parent 9f45eeb3
No related branches found
No related tags found
1 merge request!62V2.0
......@@ -6,7 +6,8 @@ require_once 'user.class.php';
*
* @author hahn
*/
class Actionlog {
class Actionlog
{
private $_dbfile = '';
private $_aLoglevels = array("info", "warning", "error", "success"); // array of valid loglevels
......@@ -44,7 +45,8 @@ class Actionlog {
* @global array $aConfig settings
* @param string $sProject project ID
*/
public function __construct($sProject = false) {
public function __construct($sProject = false)
{
global $aConfig;
if (!isset($aConfig["appRootDir"])) {
die(__CLASS__ . "::" . __FUNCTION__ . " ERROR: configuration with \$aConfig was not loaded.");
......@@ -71,7 +73,8 @@ class Actionlog {
/**
* 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";
return $this->_makeQuery($this->_sCreate);
}
......@@ -81,7 +84,8 @@ class Actionlog {
* @param string $sSql sql statement
* @return database object
*/
private function _makeQuery($sSql) {
private function _makeQuery($sSql)
{
// $this->_log(__FUNCTION__."($sSql)");
// echo "<pre>".htmlentities($sSql)."</pre>";
$db = new PDO("sqlite:" . $this->_dbfile);
......@@ -102,7 +106,8 @@ class Actionlog {
* @param string $sLoglevel loglevel
* @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) {
die(__class__ . ": loglevel $sLoglevel is invalid");
}
......@@ -143,7 +148,8 @@ class Actionlog {
* @param string $sOKChars good chars to keep
* @return string
*/
private function _filterAllowedChars($sVal, $sOKChars){
private function _filterAllowedChars($sVal, $sOKChars)
{
return preg_replace('/[^' . $sOKChars . ']/i', '', $sVal);
}
......@@ -157,7 +163,8 @@ class Actionlog {
* 'limit' - limit clausel - part behind "LIMIT "
* @return array
*/
public function getLogs($aFilter = array()) {
public function getLogs($aFilter = array())
{
// var_dump(R::findAll( 'log' ));
$aReturn = array();
......@@ -203,7 +210,8 @@ class Actionlog {
* 'limit' - limit clausel - part behind "LIMIT "
* @return string
*/
public function renderLogs($aFilter = array(), $bIsFullsearch=false) {
public function renderLogs($aFilter = array(), $bIsFullsearch = false)
{
$sReturn = '';
static $bWasShown;
......@@ -239,7 +247,8 @@ class Actionlog {
),
'validate' => array(),
'form' => array(),
));
)
);
// generate filter for log table
// $bIsFullsearch: true = show all inputs; false: no interactive search
......@@ -280,12 +289,12 @@ class Actionlog {
'options' => $aLimits,
'inline' => true,
);
// force a line break
$aForms["filter"]["form"]['line'] = array(
'type' => 'markup',
'value' => '',
'value' => '<div class="col-sm-12"></div>',
);
} else {
// write filters as hidden fields
......@@ -310,7 +319,7 @@ class Actionlog {
'onkeyup' => 'filterLogTable();',
'onkeypress' => 'filterLogTable();',
'onchange' => 'filterLogTable();',
'size' => 20,
//'size' => 20,
);
if (!$bIsFullsearch) {
$aForms["filter"]["form"]['btnalllogs'] = array(
......@@ -386,5 +395,4 @@ class Actionlog {
}
return $sReturn;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment