Skip to content

Commit

Permalink
grunt install from branch dev commit 025d83c
Browse files Browse the repository at this point in the history
  • Loading branch information
potsky committed Apr 27, 2017
1 parent 740ea98 commit 2fed8c1
Show file tree
Hide file tree
Showing 32 changed files with 108 additions and 75 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cfg/apache.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/apache.paths.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/config.example.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/iis.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/iis.paths.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/nginx.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/nginx.paths.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/php.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/php.paths.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/pimpmylog.config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion cfg/softwares.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "potsky/pimp-my-log",
"description" : "Log viewer for your web server",
"version" : "1.7.13",
"version" : "1.7.14",
"license" : "GPL-3.0+",
"type" : "project",
"homepage" : "http://pimpmylog.com",
Expand Down
2 changes: 1 addition & 1 deletion css/config.inc.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
5 changes: 3 additions & 2 deletions inc/configure.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down Expand Up @@ -44,7 +44,8 @@
|--------------------------------------------------------------------------
|
*/
set_error_handler( function($errno, $errstr, $errfile, $errline, array $errcontext) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); });
function pml_error_handler($errno, $errstr, $errfile, $errline, array $errcontext) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); };
set_error_handler("pml_error_handler");
$a = date('U');
restore_error_handler();

Expand Down
2 changes: 1 addition & 1 deletion inc/error.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion inc/favicon.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion inc/getlog.pml.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion inc/global.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion inc/login.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
108 changes: 66 additions & 42 deletions inc/rss.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand All @@ -17,10 +17,11 @@
|--------------------------------------------------------------------------
|
*/
if ( ! isset( $_GET['f'] ) ) {
if ( ! isset( $_GET[ 'f' ] ) )
{
http404();
}
$file_id = $_GET['f'];
$file_id = $_GET[ 'f' ];


/*
Expand All @@ -31,35 +32,40 @@
*/
$user = null;

if ( ( isset( $_GET['t'] ) ) && ( isset( $_GET['h'] ) ) ) {
if ( ( isset( $_GET[ 't' ] ) ) && ( isset( $_GET[ 'h' ] ) ) )
{

if ( Sentinel::isAuthSet() ) { // perhaps auth has been deactivated since link generation
$accesstoken = $_GET['t'];
if ( Sentinel::isAuthSet() )
{ // perhaps auth has been deactivated since link generation
$accesstoken = $_GET[ 't' ];
$username = Sentinel::getUsernameFromAccessToken( $accesstoken );

if ( is_null( $username ) ) { // User does not exist anymore
if ( is_null( $username ) )
{ // User does not exist anymore
http404();
}

// Sign in user
$user = Sentinel::signInWithAccessToken( $accesstoken );

// Check the security hash
if ( ! Sentinel::isSignValid( $_GET['h'] , array( 'f' => $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
Expand All @@ -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();
}

Expand All @@ -87,33 +96,34 @@
|--------------------------------------------------------------------------
|
*/
$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 );

/*
|--------------------------------------------------------------------------
| Error while getting logs
|--------------------------------------------------------------------------
|
*/
if ( ! is_array( $logs ) ) {
if ( ! is_array( $logs ) )
{
http500();
}

Expand All @@ -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;
Expand All @@ -153,44 +164,57 @@
$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 .= '<strong>' . h( $key ) . '</strong> : ' . h( $value ) . '<br/>';
}
}
$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 );
break;

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 version="1.0" encoding="UTF-8" ?>'; $xml .= '<pml>'; $xml .= generate_xml_from_array( $logs , 'log' ); $xml .= '</pml>'; 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; } ?>
header( 'Content-type: application/xml' , true );
$xml = '<?xml version="1.0" encoding="UTF-8" ?>'; $xml .= '<pml>'; $xml .= generate_xml_from_array( $logs , 'log' ); $xml .= '</pml>'; 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; } ?>
2 changes: 1 addition & 1 deletion inc/rss.pml.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
2 changes: 1 addition & 1 deletion inc/test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/*! pimpmylog - 1.7.13 - ff070626847cc3e56b93b84fc5434e1687022488*/
/*! pimpmylog - 1.7.14 - 025d83c29c6cf8dbb697aa966c9e9f8713ec92f1*/
/*
* pimpmylog
* http://pimpmylog.com
Expand Down
Loading

0 comments on commit 2fed8c1

Please sign in to comment.