diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 6f72064..25eddc0 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -121,6 +121,7 @@ class LogStreamDB extends LogStream { { if ($this->_dbhandle) mysql_close($this->_dbhandle); + $this->_dbhandle = null; return SUCCESS; } @@ -242,7 +243,7 @@ class LogStreamDB extends LogStream { } } - if ( $ret == SUCCESS ) + if ( $ret == SUCCESS && $this->_arrProperties != null ) { // Init and set variables foreach ( $this->_arrProperties as $property ) diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index 1791256..3d7ae46 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -288,8 +288,11 @@ class LogStreamDisk extends LogStream { // Init variables dynamically $line = ''; - foreach ( $this->_arrProperties as $property ) - $arrProperitesOut[$property] = ''; + if ( $this->_arrProperties != null ) + { + foreach ( $this->_arrProperties as $property ) + $arrProperitesOut[$property] = ''; + } do { $pos = -1; diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index c57d8df..dc12f46 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -271,7 +271,7 @@ class LogStreamPDO extends LogStream { } } - if ( $ret == SUCCESS ) + if ( $ret == SUCCESS && $this->_arrProperties != null ) { // Init and set variables foreach ( $this->_arrProperties as $property ) diff --git a/src/details.php b/src/details.php index 7266fe3..41fd3a5 100644 --- a/src/details.php +++ b/src/details.php @@ -64,6 +64,8 @@ else $content['uid_fromgetrequest'] = $content['uid_current']; // Init Pager variables +$content['uid_previous'] = UID_UNKNOWN; +$content['uid_next'] = UID_UNKNOWN; $content['uid_first'] = UID_UNKNOWN; $content['uid_last'] = UID_UNKNOWN; $content['main_pagerenabled'] = false; @@ -71,11 +73,13 @@ $content['main_pager_first_found'] = false; $content['main_pager_previous_found'] = false; $content['main_pager_next_found'] = false; $content['main_pager_last_found'] = false; +// --- -// Set Default reading direction +// --- If set read direction property! + +// Set direction default $content['read_direction'] = EnumReadDirection::Backward; -// If set read direction property! if ( isset($_GET['direction']) ) { if ( $_GET['direction'] == "next" ) @@ -88,7 +92,12 @@ if ( isset($_GET['direction']) ) $content['skiprecords'] = 1; $content['read_direction'] = EnumReadDirection::Forward; } + else if ( $_GET['direction'] == "desc" ) + { + $content['read_direction'] = EnumReadDirection::Forward; + } } +// --- // Init Sorting variables $content['sorting'] = ""; @@ -122,7 +131,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' $res = $stream->Open( $content['AllColumns'], true ); if ( $res == SUCCESS ) { - // TODO Implement ORDER + // Set Read direction $stream->SetReadDirection($content['read_direction']); // Set current ID and init Counter @@ -279,9 +288,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' { // Enable Pager in any case here! $content['main_pagerenabled'] = true; -/* + // --- Handle uid_first page button - if ( $content['uid_fromgetrequest'] == $content['uid_first'] ) + if ( $content['uid_fromgetrequest'] == $content['uid_first'] && $content['read_direction'] != EnumReadDirection::Forward ) $content['main_pager_first_found'] = false; else { @@ -293,32 +302,71 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' $content['main_pager_first_found'] = false; } // --- -*/ + // --- Handle uid_last page button // Option the last UID from the stream! $content['uid_last'] = $stream->GetLastPageUID(); $content['uid_first'] = $stream->GetFirstPageUID(); - // --- Handle uid_first page button - if ( $content['uid_current'] == $content['uid_first'] ) + // --- Handle uid_first and uid_previousbutton + if ( $content['uid_current'] == $content['uid_first'] || !$content['main_pager_first_found'] ) + { $content['main_pager_first_found'] = false; + $content['main_pager_previous_found'] = false; + } else + { $content['main_pager_first_found'] = true; + $content['main_pager_previous_found'] = true; + } // --- - - // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! - if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current']) - $content['main_pager_last_found'] = true; - else + // --- Handle uid_next and uid_last button + if ( $content['uid_current'] == $content['uid_last'] ) + { + $content['main_pager_next_found'] = false; $content['main_pager_last_found'] = false; + } + else + { + $content['main_pager_next_found'] = true; + $content['main_pager_last_found'] = true; + } + // --- + +/* + // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! + if ( $content['read_direction'] == EnumReadDirection::Forward ) + { + if ( $content['uid_last'] != UID_UNKNOWN ) + $content['main_pager_last_found'] = true; + else + $content['main_pager_last_found'] = false; + } + else + { + if ( $content['uid_last'] != $content['uid_current']) + $content['main_pager_last_found'] = true; + else + $content['main_pager_last_found'] = false; + } // --- // --- Handle uid_next page button - if ( $content['uid_current'] != $content['uid_last'] ) - $content['main_pager_next_found'] = true; + if ( $content['read_direction'] == EnumReadDirection::Forward ) + { + if ( $content['uid_current'] != UID_UNKNOWN ) + $content['main_pager_next_found'] = true; + else + $content['main_pager_next_found'] = false; + } else - $content['main_pager_next_found'] = false; + { + if ( $content['uid_current'] != $content['uid_last'] ) + $content['main_pager_next_found'] = true; + else + $content['main_pager_next_found'] = false; + } // --- // --- Handle uid_previous page button @@ -327,6 +375,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' else $content['main_pager_previous_found'] = false; // --- + +*/ + } else // Disable pager in this case! $content['main_pagerenabled'] = false; diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index f288124..10c7961 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -234,13 +234,17 @@ function GetFormatedDate($evttimearray) function OutputDebugMessage($szDbg, $szDbgLevel = DEBUG_INFO) { + global $content; + // Check if we should print the Error! if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) { - print("
Debugmessage: | "); - print("" . $szDbg . " |
{LN_DEBUGLEVEL} | +{LN_DEBUGMESSAGE} | +
{DBGLEVELTXT} | +
+ {DBGMSG}
+ |
+