diff --git a/cfg/apache.config.php b/cfg/apache.config.php index 1277b49f..fcc96923 100644 --- a/cfg/apache.config.php +++ b/cfg/apache.config.php @@ -1,5 +1,5 @@ __('PHP'), 'desc' => __('PHP'), diff --git a/cfg/php.paths.php b/cfg/php.paths.php index a730568b..8170f256 100644 --- a/cfg/php.paths.php +++ b/cfg/php.paths.php @@ -1,5 +1,5 @@ $fpaths) { + $found = 1; + $tried[ $software ][ $path ] = true; - foreach ( $fpaths as $userfile ) { + foreach ( $files as $type => $fpaths) { - $gfiles = glob( $path . $userfile , GLOB_MARK | GLOB_NOCHECK ); + foreach ( $fpaths as $userfile ) { - foreach( $gfiles as $file ) { + $gfiles = glob( $path . $userfile , GLOB_MARK | GLOB_NOCHECK ); - $file = basename( $file ); - $allfiles[ $file ] = $file; + if ( is_array( $gfiles ) ) { - if ( ( is_readable( $path . $file ) ) && ( ! is_dir( $path . $file ) ) ) { + foreach( $gfiles as $file ) { - if ( ! is_array( $tried[ $software ][ $path ] ) ) { - $tried[ $software ][ $path ] = array(); - } + $file = basename( $file ); + $allfiles[ $file ] = $file; - $tried[ $software ][ $path ][ $type ][] = $file; - $found = 2; - } + if ( ( is_readable( $path . $file ) ) && ( ! is_dir( $path . $file ) ) ) { + + if ( ! is_array( $tried[ $software ][ $path ] ) ) { + $tried[ $software ][ $path ] = array(); + } + $tried[ $software ][ $path ][ $type ][] = $file; + $found = 2; + } + + } + } } } } @@ -459,9 +477,35 @@ } } catch (Exception $e) { - $return['error'] = $e->getMessage(); + // Error message for timezone not configured + if ( strpos( $e->getMessage() , 'date.timezone' ) ) { + $return[ 'error' ] = $e->getMessage() . '
' . sprintf( __('You should take a look on this %spage%s.') , '' , '' ); + } + // Other error messages + else { + $return[ 'error' ] = $e->getMessage() . '
' . sprintf( __('You should take a look on this %spage%s.') , '' , '' ); + } } + + /* + |-------------------------------------------------------------------------- + | Check if we have returned something + |-------------------------------------------------------------------------- + | + | If not, a command has stopped the execution and we need to alert user about + | its configuration + | + */ + $check = 0; + if ( $return['reload'] === true ) $check++; + if ( $return['next'] === true ) $check++; + + if ( count( $return ) === $check ) { + $return[ 'error' ] = __( 'Your PHP installation is not correctly configured to run Pimp My Log.' ) . '
' . sprintf( __('You should take a look on this %spage%s.') , '' , '' ); + } + + header( 'Content-type: application/json' ); echo json_encode( $return ); die(); @@ -491,6 +535,7 @@ 'notes' => __( 'Notes' ), 'choosesoftware' => __( 'You have to select at least one software to configure!' ), 'chooselog' => __( 'You have to select at least one log file or type the path of a log file!' ), + 'suhosin' => sprintf( __('You should take a look on this %spage%s.') , '' , '' ), ); @@ -502,7 +547,13 @@ */ ?><?php echo TITLE;?>