From 2fed8c1fcedb023dfa0e63df48fb20996a40a76c Mon Sep 17 00:00:00 2001
From: Potsky
Date: Thu, 27 Apr 2017 12:46:08 +0200
Subject: [PATCH] grunt install from branch dev commit 025d83c
---
README.md | 3 +-
cfg/apache.config.php | 2 +-
cfg/apache.paths.php | 2 +-
cfg/config.example.php | 2 +-
cfg/iis.config.php | 2 +-
cfg/iis.paths.php | 2 +-
cfg/nginx.config.php | 2 +-
cfg/nginx.paths.php | 2 +-
cfg/php.config.php | 2 +-
cfg/php.paths.php | 2 +-
cfg/pimpmylog.config.php | 2 +-
cfg/softwares.inc.php | 2 +-
composer.json | 2 +-
css/config.inc.css | 2 +-
inc/configure.php | 5 +-
inc/error.inc.php | 2 +-
inc/favicon.inc.php | 2 +-
inc/getlog.pml.php | 2 +-
inc/global.inc.php | 2 +-
inc/login.inc.php | 2 +-
inc/rss.php | 108 ++++++++++++++++++++++++---------------
inc/rss.pml.php | 2 +-
inc/test.php | 2 +-
inc/upgrade.pml.php | 2 +-
inc/users.pml.php | 2 +-
index.php | 2 +-
js/configure.min.js | 2 +-
js/login.min.js | 2 +-
js/main.min.js | 2 +-
js/pml.min.js | 2 +-
js/test.min.js | 2 +-
version.js | 11 +++-
32 files changed, 108 insertions(+), 75 deletions(-)
diff --git a/README.md b/README.md
index 277fe5e6..03bb477b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
-![](http://pimpmylog.com/assets/PML.png)
+Pimp my Log
+===========
[![Latest Stable Version](https://poser.pugx.org/potsky/pimp-my-log/v/stable.svg)](https://packagist.org/packages/potsky/pimp-my-log) [![Build Status](https://travis-ci.org/potsky/PimpMyLog.svg)](https://travis-ci.org/potsky/PimpMyLog)
diff --git a/cfg/apache.config.php b/cfg/apache.config.php
index d03c4651..a695e60d 100644
--- a/cfg/apache.config.php
+++ b/cfg/apache.config.php
@@ -1,5 +1,5 @@
$file_id ) , $username ) ) {
+ if ( ! Sentinel::isSignValid( $_GET[ 'h' ] , array( 'f' => $file_id ) , $username ) )
+ {
http403();
}
}
}
-else if ( ( ! isset( $_GET['t'] ) ) && ( isset( $_GET['h'] ) ) ) {
+else if ( ( ! isset( $_GET[ 't' ] ) ) && ( isset( $_GET[ 'h' ] ) ) )
+{
http404();
}
-else if ( ( isset( $_GET['t'] ) ) && ( ! isset( $_GET['h'] ) ) ) {
+else if ( ( isset( $_GET[ 't' ] ) ) && ( ! isset( $_GET[ 'h' ] ) ) )
+{
http404();
}
-
/*
|--------------------------------------------------------------------------
| Load config
@@ -68,15 +74,18 @@
*/
list( $badges , $files , $tz ) = config_load();
-if ( ! isset( $files[ $file_id ] ) ) {
+if ( ! isset( $files[ $file_id ] ) )
+{
http403();
}
-if ( ( isset( $files[ $file_id ]['export'] ) ) && ( $files[ $file_id ]['export'] === false ) ) {
+if ( ( isset( $files[ $file_id ][ 'export' ] ) ) && ( $files[ $file_id ][ 'export' ] === false ) )
+{
http403();
}
-if ( ( EXPORT === false ) && ( ! isset( $files[ $file_id ]['export'] ) ) ) {
+if ( ( EXPORT === false ) && ( ! isset( $files[ $file_id ][ 'export' ] ) ) )
+{
http403();
}
@@ -87,25 +96,25 @@
|--------------------------------------------------------------------------
|
*/
-$search = ( isset( $_GET['search'] ) ) ? $_GET['search'] : '';
-$format = ( isset( $_GET['format'] ) ) ? $_GET['format'] : 'JSON';
-$count = ( isset( $_GET['count'] ) ) ? $_GET['count'] : ( ( isset( $files[ $file_id ][ 'max' ] ) ) ? $files[ $file_id ][ 'max' ] : LOGS_MAX );
-$timeout = ( isset( $_GET['timeout'] ) ) ? $_GET['timeout'] : MAX_SEARCH_LOG_TIME;
+$search = ( isset( $_GET[ 'search' ] ) ) ? $_GET[ 'search' ] : '';
+$format = ( isset( $_GET[ 'format' ] ) ) ? $_GET[ 'format' ] : 'JSON';
+$count = ( isset( $_GET[ 'count' ] ) ) ? $_GET[ 'count' ] : ( ( isset( $files[ $file_id ][ 'max' ] ) ) ? $files[ $file_id ][ 'max' ] : LOGS_MAX );
+$timeout = ( isset( $_GET[ 'timeout' ] ) ) ? $_GET[ 'timeout' ] : MAX_SEARCH_LOG_TIME;
$regex = $files[ $file_id ][ 'format' ][ 'regex' ];
$match = $files[ $file_id ][ 'format' ][ 'match' ];
$types = $files[ $file_id ][ 'format' ][ 'types' ];
$multiline = ( isset( $files[ $file_id ][ 'format' ][ 'multiline' ] ) ) ? $files[ $file_id ][ 'format' ][ 'multiline' ] : '';
-$exclude = ( isset( $files[ $file_id ][ 'format' ][ 'exclude' ] ) ) ? $files[ $file_id ][ 'format' ][ 'exclude' ] : array();
+$exclude = ( isset( $files[ $file_id ][ 'format' ][ 'exclude' ] ) ) ? $files[ $file_id ][ 'format' ][ 'exclude' ] : array();
$title = ( isset( $files[ $file_id ][ 'format' ][ 'export_title' ] ) ) ? $files[ $file_id ][ 'format' ][ 'export_title' ] : '';
-$file_path = $files[$file_id]['path'];
+$file_path = $files[ $file_id ][ 'path' ];
$start_offset = 0;
$start_from = SEEK_END;
$load_more = false;
$old_lastline = '';
$data_to_parse = filesize( $file_path );
$full = true;
-$logs = LogParser::getNewLines( $regex , $match , $types , $tz , $count , $exclude , $file_path , $start_offset , $start_from , $load_more , $old_lastline , $multiline , $search , $data_to_parse , $full , $timeout );
+$logs = LogParser::getNewLines( $regex , $match , $types , $tz , $count , $exclude , $file_path , $start_offset , $start_from , $load_more , $old_lastline , $multiline , $search , $data_to_parse , $full , $timeout );
/*
|--------------------------------------------------------------------------
@@ -113,7 +122,8 @@
|--------------------------------------------------------------------------
|
*/
-if ( ! is_array( $logs ) ) {
+if ( ! is_array( $logs ) )
+{
http500();
}
@@ -129,18 +139,19 @@
header( "Expires: 0" );
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
-switch ( $format ) {
+switch ( $format )
+{
case 'ATOM':
case 'RSS':
require( 'classes/Feedcreator.php' );
define( 'TIME_ZONE' , $tz );
- define( 'FEEDCREATOR_VERSION', 'Pimp My Log v' . get_current_pml_version() );
+ define( 'FEEDCREATOR_VERSION' , 'Pimp My Log v' . get_current_pml_version() );
$rss = new UniversalFeedCreator();
$rss->title = sprintf( __( "Pimp My Log : %s" ) , $files[ $file_id ][ 'display' ] );
$rss->description = ( empty( $search ) )
- ? sprintf( __( "Pimp logs for file %s" ), $files[ $file_id ][ 'path' ] )
- : sprintf( __( "Pimp logs for file %s with search %s" ), $files[ $file_id ][ 'path' ] , $search );
+ ? sprintf( __( "Pimp logs for file %s" ) , $files[ $file_id ][ 'path' ] )
+ : sprintf( __( "Pimp logs for file %s with search %s" ) , $files[ $file_id ][ 'path' ] , $search );
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;
$rss->link = $link;
@@ -153,32 +164,41 @@
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;
$rss->image = $image;
- if ( ( isset( $logs['logs'] ) ) && ( is_array( $logs['logs'] ) ) ) {
- foreach( array_reverse( $logs['logs'] ) as $log ) {
+ if ( ( isset( $logs[ 'logs' ] ) ) && ( is_array( $logs[ 'logs' ] ) ) )
+ {
+ foreach ( array_reverse( $logs[ 'logs' ] ) as $log )
+ {
$item = new FeedItem();
$description = '';
- foreach( $log as $key => $value ) {
- if ( substr( $key , 0 , 3) !== 'pml' ) {
+ foreach ( $log as $key => $value )
+ {
+ if ( substr( $key , 0 , 3 ) !== 'pml' )
+ {
$description .= '' . h( $key ) . ' : ' . h( $value ) . '
';
}
}
$item->description = $description;
- if ( isset( $log['pmld'] ) ) {
- $item->date = $log['pmld'];
+ if ( isset( $log[ 'pmld' ] ) )
+ {
+ $item->date = $log[ 'pmld' ];
}
- if ( isset( $log[ $title ] ) ) {
+ if ( isset( $log[ $title ] ) )
+ {
$item->title = $log[ $title ];
- } else {
+ }
+ else
+ {
$item->title = current( $log ) . ' - ' . sha1( serialize( $log ) );
}
- if ( $format === 'ATOM' ) {
+ if ( $format === 'ATOM' )
+ {
$item->author = 'PmL';
}
- $item->link = $link . '&' . $log['pmlo'];
- $item->guid = $link . '&' . $log['pmlo'];
+ $item->link = $link . '&' . $log[ 'pmlo' ];
+ $item->guid = $link . '&' . $log[ 'pmlo' ];
$item->descriptionTruncSize = 500;
$item->descriptionHtmlSyndicated = true;
- $rss->addItem($item);
+ $rss->addItem( $item );
}
}
$rss->outputFeed( $tz , $format );
@@ -186,11 +206,15 @@
case 'CSV':
header( "Content-Transfer-Encoding: binary" );
- header( "Content-Disposition: attachment;filename=PimpMyLog_" . get_slug( $file_id) . "_" . date( "Y-m-d-His" ) . '.csv' );
+ header( "Content-Disposition: attachment;filename=PimpMyLog_" . get_slug( $file_id ) . "_" . date( "Y-m-d-His" ) . '.csv' );
header( "Content-type: application/vnd.ms-excel; charset=UTF-16LE" );
- echo chr( 255 ) . chr( 254 ) . mb_convert_encoding( array2csv( $logs['logs'] ) , 'UTF-16LE' , 'UTF-8' );
+ echo chr( 255 ) . chr( 254 );
+ if ( ( isset( $logs[ 'logs' ] ) ) && ( is_array( $logs[ 'logs' ] ) ) )
+ {
+ echo mb_convert_encoding( array2csv( $logs[ 'logs' ] ) , 'UTF-16LE' , 'UTF-8' );
+ }
break;
case 'XML':
- header('Content-type: application/xml', true);
- $xml = ''; $xml .= ''; $xml .= generate_xml_from_array( $logs , 'log' ); $xml .= ''; echo $xml; break; case 'JSONPR': header('Content-type: application/json', true); if ( version_compare( PHP_VERSION , '5.4.0' ) >= 0 ) { echo json_encode( $logs , JSON_PRETTY_PRINT ); } else { echo json_indent( json_encode( $logs ) ); } break; case 'JSONP': header('Content-type: application/javascript', true); echo ( isset( $_GET['callback'] ) ) ? $_GET['callback'] : '?'; echo '('; echo json_encode( $logs ); echo ')'; break; case 'JSON': default: header('Content-type: application/json', true); echo json_encode( $logs ); break; } ?>
\ No newline at end of file
+ header( 'Content-type: application/xml' , true );
+ $xml = ''; $xml .= ''; $xml .= generate_xml_from_array( $logs , 'log' ); $xml .= ''; echo $xml; break; case 'JSONPR': header( 'Content-type: application/json' , true ); if ( version_compare( PHP_VERSION , '5.4.0' ) >= 0 ) { echo json_encode( $logs , JSON_PRETTY_PRINT ); } else { echo json_indent( json_encode( $logs ) ); } break; case 'JSONP': header( 'Content-type: application/javascript' , true ); echo ( isset( $_GET[ 'callback' ] ) ) ? $_GET[ 'callback' ] : '?'; echo '('; echo json_encode( $logs ); echo ')'; break; case 'JSON': default: header( 'Content-type: application/json' , true ); echo json_encode( $logs ); break; } ?>
\ No newline at end of file
diff --git a/inc/rss.pml.php b/inc/rss.pml.php
index 3af1e70a..bf54f76d 100644
--- a/inc/rss.pml.php
+++ b/inc/rss.pml.php
@@ -1,5 +1,5 @@
Hi folks!
Life has been really complicated this last year but I hope things will be fun again and I hope I will have time to update Pimp My Log.
",
"20141121" : "Thank you to people who have starred the project on GitHub !",
@@ -9,6 +9,13 @@
"20141011" : "This message will never be shown. Never Gonna Give You Up !"
},
"changelog" : {
+ "1.7.14" : {
+ "released" : "2017-04-27",
+ "fixed" : [
+ "unexpected T_FUNCTION, [PHP 5.2] (#118)",
+ "Undefined index: logs (more info)"
+ ]
+ },
"1.7.13" : {
"released" : "2017-02-23",
"new" : [