Skip to content

Commit

Permalink
20230523 Closes #205
Browse files Browse the repository at this point in the history
         Wrok om #129 #134 #139 #146
         Code Cleanup.

     File(s): base_common.php
            : base_conf.php.dist
            : base_maintenance.php
            : includes/base_capabilities.php
            : includes/base_output_html.inc.php
            : includes/base_state_citems.inc.php
            : includes/base_state_criteria.inc.php
            : setup/base_conf_contents.php
              Code Cleanup.
     File(s): includes/base_action.inc.php
    Issue(s): #134 #205
              Code Cleanup.
     File(s): includes/base_auth.inc.php
              Code Cleanup.
 Function(s): ARC( $roleneeded )
              AuthorizedRole Core, Returns true if the role
              of current user is authorized, false otherwise.
     File(s): includes/base_db.inc.php
 Function(s): filterSql( $item, $force_alert_db, $db )
              Moved from includes/base_state_common.inc.php
     File(s): includes/base_krnl.php
              Code Cleanup.
              Bumped Kernel Version to 0.0.4
              Provides additional:
              Base Include Path: Global: $BKI_Path
                                  Const: BASE_IPath
              Routines Loaded: (available at page load):
              BASE Constants.
              BASE DB system.
     File(s): includes/base_log_error.inc.php
    Issue(s): #134 #146
              Code Cleanup.
 Function(s): ErrorMessage( $message, $color, $br )
            : returnErrorMessage( $message, $color, $br )
              Moved from RTL.
            : DDT( $Items, $Desc, $title, $tab, $wd, $vf, $XSS )
              Add XSS Flag for table items.
            : PrintPageHeader()
              Issue #134 work.
     File(s): includes/base_log_timing.inc.php
    Issue(s): #146
              Code Cleanup.
     File(s): includes/base_output_query.inc.php
            : styles/*.css
    Issue(s): #129 #139
              Code Cleanup.
     File(s): includes/base_rtl.php
              Bumped RTL Version to 0.0.8
              Code Cleanup.
 Function(s): ErrorMessage( $message, $color, $br )
            : returnErrorMessage( $message, $color, $br )
              Removed from RTL.
     File(s): includes/base_state_common.inc.php
              Code Cleanup.
 Function(s): filterSql( $item, $force_alert_db, $db )
              Moved to includes/base_db.inc.php
     File(s): scripts/BASEcli
              Bumped BASEcli Version to 1.2.2
              Added 'debug' and 'dbg' interactive commands
              to toggle connection debugging mode.
              Code Cleanup.
Unit Test(s): Covers ARC() BaseUser::Authenticate*()
  • Loading branch information
NathanGibbs3 committed May 24, 2023
1 parent 53f1ca1 commit 8cf446d
Show file tree
Hide file tree
Showing 42 changed files with 1,503 additions and 1,588 deletions.
50 changes: 20 additions & 30 deletions base_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -1024,78 +1024,68 @@ function ChkLib ( $path = '', $LibLoc = '', $LibFile = '' ){
GLOBAL $debug_mode;
$EMPfx = __FUNCTION__ . ': ';
$Ret = '';
if ( LoadedString($LibFile) ){
if( LoadedString($LibFile) ){
$sc = DIRECTORY_SEPARATOR;
$tmp = $LibFile;
// Strip leading or trailing seperators from Lib file.
$ReqRE = "(^\\$sc|\\$sc\$)";
$LibFile = preg_replace("/".$ReqRE."/", '', $LibFile);
if ( $debug_mode > 1 && $tmp != $LibFile ){
ErrorMessage('Req Lib: ' . XSSPrintSafe($tmp), 0, 1);
ErrorMessage('Mod Lib: ' . XSSPrintSafe($LibFile), 0, 1);
if ( $tmp != $LibFile ){
KML($EMPfx . "Req Lib: $tmp", 3);
KML($EMPfx . "Mod Lib: $LibFile", 3);
}
if ( LoadedString($path) ){ // Path to Lib
if( LoadedString($path) ){ // Path to Lib
$tmp = $path; // Strip trailing seperator from path.
$ReqRE = "\\$sc\$";
$path = preg_replace("/".$ReqRE."/", '', $path);
if ( $debug_mode > 1 && $tmp != $path ){
ErrorMessage('Req Loc: ' . XSSPrintSafe($tmp), 0, 1);
ErrorMessage('Mod Loc: ' . XSSPrintSafe($path), 0, 1);
if( $tmp != $path ){
KML($EMPfx . "Req Loc: $tmp", 3);
KML($EMPfx . "Mod Loc: $path", 3);
}
$LibFile .= '.php';
$FinalLib = implode( $sc, array($path, $LibFile) );
if ( $debug_mode > 1 ){
ErrorMessage(
XSSPrintSafe($EMPfx . "Chk: $FinalLib"),'black',1
);
}
KML($EMPfx . "Chk: $FinalLib", 3);
$tmp = ChkAccess($FinalLib);
$Msg = $EMPfx . "Lib: $FinalLib ";
$clr = 'red';
if ( $tmp == 1 ){
if( $tmp == 1 ){
$Msg .= 'found';
$clr = 'black';
$Ret = $FinalLib;
}else{
$Msg .= 'not ';
}
if ( $tmp == -1 ){
if( $tmp == -1 ){
$Msg .= 'found';
}elseif ( $tmp == -2 ){
}elseif( $tmp == -2 ){
$Msg .= 'readable';
}
$Msg .= '.';
if ( $debug_mode > 1 ){
ErrorMessage($Msg, $clr, 1);
}
KML($Msg, 3);
}else{ // Relative path to Lib.
if ( LoadedString($LibLoc) ){
if( LoadedString($LibLoc) ){
$tmp = $LibLoc; // Strip leading seperators from Loc.
$ReqRE = "^\\$sc";
$LibLoc = preg_replace("/".$ReqRE."/", '', $LibLoc);
if ( $debug_mode > 1 && $tmp != $LibLoc ){
ErrorMessage('Req Loc: ' . XSSPrintSafe($tmp), 0, 1);
ErrorMessage('Mod Loc: ' . XSSPrintSafe($LibLoc), 0, 1);
if( $tmp != $LibLoc ){
KML($EMPfx . "Req Loc: $tmp", 3);
KML($EMPfx . "Mod Loc: $LibLoc", 3);
}
}
$PSPath = explode(PATH_SEPARATOR, ini_get('include_path'));
foreach( $PSPath as $single_path ){
if ( LoadedString($LibLoc) ){
if( LoadedString($LibLoc) ){
$FinalLoc = implode( $sc, array($single_path, $LibLoc) );
}else{
$FinalLoc = $single_path;
}
$tmp = ChkLib( $FinalLoc, '', $LibFile);
if ( LoadedString($tmp) ){
if( LoadedString($tmp) ){
$Ret = $tmp;
break;
}
}
}
}else{
if ( $debug_mode > 0 ){
ErrorMessage($EMPfx . 'No Lib specified.', 0, 1);
}
KML($EMPfx . 'No Lib specified.', 1);
}
return $Ret;
}
Expand Down
28 changes: 22 additions & 6 deletions base_conf.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,39 @@ $freq_num_alerts = 5;
$freq_num_uaddr = 15;
$freq_num_uports = 15;

/* Number of scroll buttons to use when displaying query results */
// Number of scroll buttons to use when displaying query results.
$max_scroll_buttons = 12;

/* Debug mode - how much debugging information should be shown
* Timing mode - display timing information
// Debug mode - How much debugging information should be shown.
// 0: UI: No extra information.
// Log: Kernel & UI Page Start.
// 1: Session management & request information.
// 2: UI: extended debugging information for admin users.
// Log: Kernel boot messages.
// Criteria State management.
// 3: More than you ever wanted to know.

$debug_mode = 0;

// Timing mode - Display timing information
// 0: No information.
// 1: Page Load Time.
// 2: Runtime Telemetry, detail level dependent on $debug_mode setting.

$debug_time_mode = 1;

/*
* SQL trace mode - log SQL statements
* 0 : no extra information
* 1 : debugging information
* 1 : debugging information.
* 2 : extended debugging information
*
* HTML no cache - whether a no-cache directive should be sent
* to the browser (should be = 1 for IE)
*
* SQL trace file - file to log SQL traces
*/
$debug_mode = 0;
$debug_time_mode = 1;

$html_no_cache = 1;
$sql_trace_mode = 0;
$sql_trace_file = '';
Expand Down
Loading

0 comments on commit 8cf446d

Please sign in to comment.