Skip to content

Commit

Permalink
Merge branch 'cryol-2.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Dickert committed Jun 12, 2020
2 parents 45a4e44 + c7ee281 commit ff9e256
Show file tree
Hide file tree
Showing 47 changed files with 1,102 additions and 9,965 deletions.
14 changes: 7 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ifm.php -diff
ifm.min.php -diff
build/* -diff
dist/ifm.php -diff
dist/ifm.min.php -diff
dist/* -diff
src/includes/ace.js -diff

src export-ignore
compiler.php export-ignore
.gitignore export-ignore
.gitattributes export-ignore
src export-ignore
compiler.php export-ignore
.gitignore export-ignore
.gitattributes export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.zip
misc
src/includes/ace/*
sftp-config.json
dist/*
4,686 changes: 0 additions & 4,686 deletions build/libifm.php

This file was deleted.

45 changes: 28 additions & 17 deletions compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,32 @@

chdir( realpath( dirname( __FILE__ ) ) );

// output files and common attrs
define( "IFM_CDN", true );
define( "IFM_VERSION", "<a href='https://github.com/misterunknown/ifm/tree/cryol-2.6.1' target=_blank>v2.6.1</a>" );
define( "IFM_RELEASE_DIR", "dist/");
define( "IFM_STANDALONE", "ifm.php" );
define( "IFM_STANDALONE_GZ", "ifm.min.php" );
define( "IFM_LIB", "libifm.php" );

if( IFM_CDN ){
$IFM_ASSETS = "src/assets.cdn.part";
} else {
$IFM_ASSETS = "src/assets.part";
}

// php source files
$IFM_SRC_PHP = array(
0 => "src/main.php",
1 => "src/ifmarchive.php",
2 => "src/htpasswd.php"
);

// output files
define( "IFM_STANDALONE", "ifm.php" );
define( "IFM_STANDALONE_GZ", "build/ifm.min.php" );
define( "IFM_LIB", "build/libifm.php" );

// get options
$options = getopt( null, array( "language::" ) );

// process languages
$vars['languages'] = isset( $options['language'] ) ? explode( ',', $options['language'] ) : array( "en" );
$vars['languages'] = isset( $options['language'] ) ? explode( ',', $options['language'] ) : array( "en", "ru" );
$vars['defaultlanguage'] = $vars['languages'][0];
$vars['languageincludes'] = "";
foreach( $vars['languages'] as $l ) {
Expand All @@ -49,6 +58,7 @@
}
$compiled = join( $compiled );

$compiled = str_replace( "IFM_ASSETS", file_get_contents( $IFM_ASSETS ), $compiled );
/**
* Process file includes
*/
Expand Down Expand Up @@ -82,26 +92,27 @@
foreach( $includes as $var )
$compiled = str_replace( $var[0], $vars[$var[1]], $compiled );

/**
* Build versions
*/
$compiled = str_replace( 'IFM_VERSION', IFM_VERSION, $compiled );

if (!is_dir(IFM_RELEASE_DIR)){
mkdir(IFM_RELEASE_DIR);
}

// build standalone ifm
file_put_contents( IFM_STANDALONE, $compiled );
file_put_contents( IFM_STANDALONE, '
file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_STANDALONE, $compiled );
file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_STANDALONE, '
/**
* start IFM
*/
$ifm = new IFM();
$ifm->run();
', FILE_APPEND );

/* // build compressed ifm
// build compressed ifm
file_put_contents(
IFM_STANDALONE_GZ,
IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_STANDALONE_GZ,
'<?php eval( gzdecode( file_get_contents( __FILE__, false, null, 85 ) ) ); exit(0); ?>'
. gzencode( file_get_contents( "ifm.php", false, null, 5 ) )
. gzencode( file_get_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') .IFM_STANDALONE, false, null, 5 ) )
);
*/

// build lib
file_put_contents( IFM_LIB, $compiled );
file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_LIB, $compiled );
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ff9e256

Please sign in to comment.