mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-09-03 10:53:08 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a371ee2afd | ||
|
480c4aab79 | ||
|
745bff09cb | ||
|
7d6ced78da |
29
README.md
29
README.md
@@ -9,6 +9,35 @@ It uses the [Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-1733
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
|
||||||
|
### v0.14.1 · *2011-09-01*
|
||||||
|
|
||||||
|
* display meta information in bottom bar (icon view)
|
||||||
|
* added zh-cn translation by [Dongsheng Cai](http://github.com/dongsheng)
|
||||||
|
* added pl translation by Radosław Zając
|
||||||
|
* added ru translation by Богдан Илюхин
|
||||||
|
|
||||||
|
|
||||||
|
### v0.14 · *2011-08-16*
|
||||||
|
|
||||||
|
* added image thumbnails for PHP version
|
||||||
|
* new option `slideTree` to turn off auto slide in
|
||||||
|
|
||||||
|
|
||||||
|
### v0.13.2 · *2011-08-12*
|
||||||
|
|
||||||
|
* changes in `/h5ai/.htaccess` ... PHP configuration ...
|
||||||
|
|
||||||
|
|
||||||
|
### v0.13.1 · *2011-08-12*
|
||||||
|
|
||||||
|
* ~~hopefully fixed that PHP doesn't get interpreted~~ :/
|
||||||
|
* fixed initial tree display
|
||||||
|
* added sort order option
|
||||||
|
* added/fixed some translations
|
||||||
|
* added lv translation by Sandis Veinbergs
|
||||||
|
|
||||||
|
|
||||||
### v0.13 · *2011-08-06*
|
### v0.13 · *2011-08-06*
|
||||||
|
|
||||||
* added PHP implementation! (should work with PHP 5.2+)
|
* added PHP implementation! (should work with PHP 5.2+)
|
||||||
|
@@ -3,7 +3,7 @@ custom = true
|
|||||||
|
|
||||||
# project
|
# project
|
||||||
project.name = h5ai
|
project.name = h5ai
|
||||||
project.version = 0.13
|
project.version = 0.14.1
|
||||||
|
|
||||||
|
|
||||||
# src
|
# src
|
||||||
|
Binary file not shown.
BIN
release/h5ai-0.14.1.tar.gz
Normal file
BIN
release/h5ai-0.14.1.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
AddType text/html .php
|
AddType text/html .php
|
||||||
|
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
# if php doesn't get interpreted try to
|
||||||
|
# uncomment one of the following lines
|
||||||
|
###########################################
|
||||||
|
#AddHandler application/x-httpd-php .php
|
||||||
|
#AddHandler application/x-httpd-php5 .php
|
||||||
|
#AddHandler application/x-httpd-php52 .php
|
||||||
|
#AddHandler application/x-httpd-php53 .php
|
||||||
|
#AddHandler php-script .php
|
||||||
|
#AddHandler php5-script .php
|
||||||
|
#AddHandler php52-script .php
|
||||||
|
#AddHandler php53-script .php
|
||||||
|
|
||||||
|
|
||||||
# cache images, css and js for 52 weeks
|
# cache images, css and js for 52 weeks
|
||||||
<IfModule headers_module>
|
<IfModule headers_module>
|
||||||
<FilesMatch "\.png$">
|
<FilesMatch "\.png$">
|
||||||
@@ -12,5 +28,8 @@ AddType text/html .php
|
|||||||
<FilesMatch "\.js$">
|
<FilesMatch "\.js$">
|
||||||
Header set Cache-Control "max-age=31449600, public"
|
Header set Cache-Control "max-age=31449600, public"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
<FilesMatch "thumb-.*\.jpg$">
|
||||||
|
Header set Cache-Control "max-age=31449600, public"
|
||||||
|
</FilesMatch>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
|
@@ -116,6 +116,18 @@
|
|||||||
width: 80px;
|
width: 80px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
&.entry.thumb .icon.small {
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 5px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
background-color: #eee;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.empty {
|
.empty {
|
||||||
@@ -170,8 +182,8 @@
|
|||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 48px;
|
min-width: 48px;
|
||||||
height: 48px;
|
min-height: 48px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,6 +218,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.entry.thumb .icon.big {
|
||||||
|
width: 100px;
|
||||||
|
height: 58px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
img {
|
||||||
|
background-color: #eee;
|
||||||
|
min-width: 46px;
|
||||||
|
min-height: 46px;
|
||||||
|
min-width: 12px;
|
||||||
|
min-height: 12px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.empty {
|
.empty {
|
||||||
|
@@ -153,6 +153,17 @@ body > footer {
|
|||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
float: right
|
float: right
|
||||||
}
|
}
|
||||||
|
.status {
|
||||||
|
&.default {
|
||||||
|
}
|
||||||
|
&.dynamic {
|
||||||
|
display: none;
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#langSelector {
|
#langSelector {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@@ -17,9 +17,13 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="center">
|
<span class="center">
|
||||||
<span class="hideOnNoJs">
|
<span class="hideOnNoJs">
|
||||||
<span class="folderCount"></span> <span class="l10n-folders">folders</span>
|
<span class="status default">
|
||||||
·
|
<span class="folderCount"></span> <span class="l10n-folders">folders</span>
|
||||||
<span class="fileCount"></span> <span class="l10n-files">files</span>
|
·
|
||||||
|
<span class="fileCount"></span> <span class="l10n-files">files</span>
|
||||||
|
</span>
|
||||||
|
<span class="status dynamic">
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
|
@@ -43,9 +43,13 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="center">
|
<span class="center">
|
||||||
<?php echo $extended->getFolderCount(); ?> <span class="l10n-folders">folders</span>
|
<span class="status default">
|
||||||
·
|
<?php echo $extended->getFolderCount(); ?> <span class="l10n-folders">folders</span>
|
||||||
<?php echo $extended->getFileCount(); ?> <span class="l10n-files">files</span>
|
·
|
||||||
|
<?php echo $extended->getFileCount(); ?> <span class="l10n-files">files</span>
|
||||||
|
</span>
|
||||||
|
<span class="status dynamic">
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/h5ai/js/lib/jquery.min.js"></script>
|
<script src="/h5ai/js/lib/jquery.min.js"></script>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
var Extended = function ( pathCache ) {
|
var Extended = function ( pathCache, h5ai ) {
|
||||||
|
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
@@ -7,7 +7,6 @@ var Extended = function ( pathCache ) {
|
|||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
this.config = {
|
this.config = {
|
||||||
defaultSortOrder: "C=N;O=A",
|
|
||||||
customHeader: "h5ai.header.html",
|
customHeader: "h5ai.header.html",
|
||||||
customFooter: "h5ai.footer.html"
|
customFooter: "h5ai.footer.html"
|
||||||
};
|
};
|
||||||
@@ -78,31 +77,30 @@ var Extended = function ( pathCache ) {
|
|||||||
$( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-size'>" + $size.text() + "</span></a>" ).appendTo( $li );
|
$( "<a class='size' href='" + $size.attr( "href" ) + "'><span class='l10n-size'>" + $size.text() + "</span></a>" ).appendTo( $li );
|
||||||
|
|
||||||
// header sort icons
|
// header sort icons
|
||||||
var order = document.location.search;
|
var sortquery = document.location.search;
|
||||||
if ( order === "" ) {
|
var order = {
|
||||||
order = this.config.defaultSortOrder;
|
column: ( sortquery.indexOf( "C=N" ) >= 0 ) ? "name" : ( sortquery.indexOf( "C=M" ) >= 0 ) ? "date" : ( sortquery.indexOf( "C=S" ) >= 0 ) ? "size" : h5ai.config.sortorder.column,
|
||||||
|
ascending: ( sortquery.indexOf( "O=A" ) >= 0 ) ? true : ( sortquery.indexOf( "O=D" ) >= 0 ) ? false : h5ai.config.sortorder.ascending
|
||||||
};
|
};
|
||||||
var $icon;
|
var $icon;
|
||||||
if ( order.indexOf( "O=A" ) >= 0 ) {
|
if ( order.ascending ) {
|
||||||
$icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" );
|
$icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" );
|
||||||
} else {
|
} else {
|
||||||
$icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" );
|
$icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" );
|
||||||
};
|
};
|
||||||
if ( order.indexOf( "C=N" ) >= 0 ) {
|
if ( order.column === "date" ) {
|
||||||
$li.find( "a.label" ).append( $icon );
|
|
||||||
} else if ( order.indexOf( "C=M" ) >= 0 ) {
|
|
||||||
$li.find( "a.date" ).prepend( $icon );
|
$li.find( "a.date" ).prepend( $icon );
|
||||||
} else if ( order.indexOf( "C=S" ) >= 0 ) {
|
} else if ( order.column === "size" ) {
|
||||||
$li.find( "a.size" ).prepend( $icon );
|
$li.find( "a.size" ).prepend( $icon );
|
||||||
|
} else {
|
||||||
|
$li.find( "a.label" ).append( $icon );
|
||||||
};
|
};
|
||||||
|
|
||||||
$.timer.log( "start entries" );
|
|
||||||
// entries
|
// entries
|
||||||
$( "#table td" ).closest( "tr" ).each( function () {
|
$( "#table td" ).closest( "tr" ).each( function () {
|
||||||
var path = pathCache.getPathForTableRow( document.location.pathname, this );
|
var path = pathCache.getPathForTableRow( document.location.pathname, this );
|
||||||
$ul.append( path.updateExtendedHtml() );
|
$ul.append( path.updateExtendedHtml() );
|
||||||
} );
|
} );
|
||||||
$.timer.log( "end entries" );
|
|
||||||
|
|
||||||
$( "#extended" ).append( $ul );
|
$( "#extended" ).append( $ul );
|
||||||
$.log( document.location.pathname, "folders:", $( "#extended .folder" ).size() , "files:", $( "#extended .file" ).size() );
|
$.log( document.location.pathname, "folders:", $( "#extended .folder" ).size() , "files:", $( "#extended .file" ).size() );
|
||||||
|
@@ -16,7 +16,12 @@ var H5ai = function ( options, langs ) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
viewmodes: [ "details", "icons" ],
|
viewmodes: [ "details", "icons" ],
|
||||||
|
sortorder: {
|
||||||
|
column: "name",
|
||||||
|
ascending: true
|
||||||
|
},
|
||||||
showTree: true,
|
showTree: true,
|
||||||
|
slideTree: true,
|
||||||
folderStatus: {
|
folderStatus: {
|
||||||
},
|
},
|
||||||
lang: null,
|
lang: null,
|
||||||
@@ -165,6 +170,33 @@ var H5ai = function ( options, langs ) {
|
|||||||
.click( $.proxy( function () {
|
.click( $.proxy( function () {
|
||||||
this.applyViewmode( "icons" );
|
this.applyViewmode( "icons" );
|
||||||
}, this ) );
|
}, this ) );
|
||||||
|
|
||||||
|
$( "#extended .entry" ).hover(
|
||||||
|
function () {
|
||||||
|
if ( $( "#extended" ).hasClass( "icons-view" ) ) {
|
||||||
|
$this = $( this );
|
||||||
|
$( ".status.default" ).hide();
|
||||||
|
$( ".status.dynamic" )
|
||||||
|
.empty()
|
||||||
|
.append( $this.find( ".label" ).clone() )
|
||||||
|
.append( " · " )
|
||||||
|
.append( $this.find( ".date" ).clone() )
|
||||||
|
.show();
|
||||||
|
|
||||||
|
if ( ! $this.hasClass( "folder" ) ) {
|
||||||
|
$( ".status.dynamic" )
|
||||||
|
.append( " · " )
|
||||||
|
.append( $this.find( ".size" ).clone() );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
$( ".status.default" ).show();
|
||||||
|
$( ".status.dynamic" )
|
||||||
|
.empty()
|
||||||
|
.hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -173,32 +205,35 @@ var H5ai = function ( options, langs ) {
|
|||||||
* init tree
|
* init tree
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
this.initTree = function () {
|
this.shiftTree = function ( forceVisible, dontAnimate ) {
|
||||||
|
|
||||||
var $tree = $( "#tree" );
|
var $tree = $( "#tree" );
|
||||||
var $extended = $( "#extended" );
|
var $extended = $( "#extended" );
|
||||||
var shiftTree = function ( forceVisible, dontAnimate ) {
|
|
||||||
if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
|
if ( this.config.slideTree && $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
|
||||||
if ( dontAnimate === true ) {
|
if ( dontAnimate === true ) {
|
||||||
$tree.stop().css( { left: 0 } );
|
$tree.stop().css( { left: 0 } );
|
||||||
} else {
|
|
||||||
$tree.stop().animate( { left: 0 } );
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
if ( dontAnimate === true ) {
|
$tree.stop().animate( { left: 0 } );
|
||||||
$tree.stop().css( { left: 18 - $tree.outerWidth() } );
|
};
|
||||||
} else {
|
} else {
|
||||||
$tree.stop().animate( { left: 18 - $tree.outerWidth() } );
|
if ( dontAnimate === true ) {
|
||||||
};
|
$tree.stop().css( { left: 18 - $tree.outerWidth() } );
|
||||||
|
} else {
|
||||||
|
$tree.stop().animate( { left: 18 - $tree.outerWidth() } );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
$tree.hover( function () { shiftTree( true ); }, function () { shiftTree(); } );
|
|
||||||
$( window ).resize( function() {
|
|
||||||
shiftTree();
|
|
||||||
} );
|
|
||||||
|
|
||||||
shiftTree( false, true );
|
this.initTree = function () {
|
||||||
|
|
||||||
|
$( "#tree" ).hover(
|
||||||
|
$.proxy( function () { this.shiftTree( true ); }, this ),
|
||||||
|
$.proxy( function () { this.shiftTree(); }, this )
|
||||||
|
);
|
||||||
|
$( window ).resize( $.proxy( function () { this.shiftTree(); }, this ) );
|
||||||
|
this.shiftTree( false, true );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
var scroll = function ( event ) {
|
var scroll = function ( event ) {
|
||||||
|
event.preventDefault();
|
||||||
var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height();
|
var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height();
|
||||||
$wrapper.scrollTop( $content.outerHeight() * clickFrac );
|
$wrapper.scrollTop( $content.outerHeight() * clickFrac );
|
||||||
update();
|
update();
|
||||||
@@ -74,7 +75,8 @@
|
|||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
overflow: "hidden"
|
overflow: "hidden",
|
||||||
|
cursor: "pointer"
|
||||||
} )
|
} )
|
||||||
.mousedown( function ( event ) {
|
.mousedown( function ( event ) {
|
||||||
mouseOffsetY = $drag.outerHeight() / 2;
|
mouseOffsetY = $drag.outerHeight() / 2;
|
||||||
@@ -88,10 +90,8 @@
|
|||||||
scroll( event );
|
scroll( event );
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
} );
|
} );
|
||||||
event.stopPropagation();
|
event.preventDefault();
|
||||||
} )
|
} )
|
||||||
.attr( "unselectable", "on" )
|
|
||||||
.css( "-moz-user-select", "none" )
|
|
||||||
.each( function () {
|
.each( function () {
|
||||||
this.onselectstart = function () {
|
this.onselectstart = function () {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -40,6 +40,7 @@ var Tree = function ( pathCache, h5ai ) {
|
|||||||
.append( path.updateTreeHtml() )
|
.append( path.updateTreeHtml() )
|
||||||
.scrollpanel()
|
.scrollpanel()
|
||||||
.show();
|
.show();
|
||||||
|
h5ai.shiftTree( false, true );
|
||||||
h5ai.linkHoverStates();
|
h5ai.linkHoverStates();
|
||||||
pathCache.storeCache();
|
pathCache.storeCache();
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
|
@@ -14,11 +14,9 @@
|
|||||||
* create
|
* create
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
$.timer.log( "start pathcache" );
|
|
||||||
var pathCache = new PathCache();
|
var pathCache = new PathCache();
|
||||||
$.timer.log( "end pathcache" );
|
|
||||||
var extended = new Extended( pathCache );
|
|
||||||
var h5ai = new H5ai( h5aiOptions, h5aiLangs );
|
var h5ai = new H5ai( h5aiOptions, h5aiLangs );
|
||||||
|
var extended = new Extended( pathCache, h5ai );
|
||||||
var tree = new Tree( pathCache, h5ai );
|
var tree = new Tree( pathCache, h5ai );
|
||||||
|
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
h5ai.init();
|
h5ai.init();
|
||||||
$( "#tree" ).scrollpanel();
|
$( "#tree" ).scrollpanel();
|
||||||
|
h5ai.shiftTree( false, true );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
} )( jQuery );
|
} )( jQuery );
|
@@ -1,83 +1,108 @@
|
|||||||
/*
|
/*
|
||||||
* h5ai %BUILD_VERSION%
|
* h5ai %BUILD_VERSION%
|
||||||
* Options and localization
|
* Options and localization
|
||||||
*/
|
*/
|
||||||
|
|
||||||
h5aiOptions = {
|
h5aiOptions = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An array of view modes the user may choose from. Currently there
|
* An array of view modes the user may choose from. Currently there
|
||||||
* are two possible values: "details" and "icons". The first value
|
* are two possible values: "details" and "icons". The first value
|
||||||
* indicates the default view mode. If only one value is given the
|
* indicates the default view mode. If only one value is given the
|
||||||
* view mode is fixed and the selector buttons are hidden.
|
* view mode is fixed and the selector buttons are hidden.
|
||||||
* The user selected view mode is also stored local in modern browsers
|
* The user selected view mode is also stored local in modern browsers
|
||||||
* so that it will be persistent.
|
* so that it will be persistent.
|
||||||
*/
|
*/
|
||||||
"viewmodes": [ "details", "icons" ],
|
"viewmodes": [ "details", "icons" ],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show a folder tree, boolean.
|
* Default sort order. Valid values for column are "name", "date" and
|
||||||
* Note that this tree might have side effects as it sends HEAD requests
|
* "size".
|
||||||
* to the folders, and therefore will invoke index.php scripts. Use
|
* If you are using the JavaScript version please make sure to change
|
||||||
* folderStatus below to avoid such requests.
|
* IndexOrderDefault in js.htaccess as well.
|
||||||
* It might also affect performance significantly.
|
*/
|
||||||
*/
|
"sortorder": {
|
||||||
"showTree": true,
|
"column": "name",
|
||||||
|
"ascending": true
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Associative array of folders and their HTTP status codes to
|
* Show a folder tree, boolean.
|
||||||
* avoid HEAD requests to that folders. The key (folder) must start
|
* Note that this tree might have side effects as it sends HEAD requests
|
||||||
* and end with a slash (/).
|
* to the folders, and therefore will invoke index.php scripts. Use
|
||||||
* For example:
|
* folderStatus below to avoid such requests.
|
||||||
* "/some/folder/": 200
|
* It might also affect performance significantly.
|
||||||
* will always return HTTP status 200 (OK), which will be interpreted
|
*/
|
||||||
* as a non auto indexed folder, that means a folder containing an
|
"showTree": true,
|
||||||
* appropriate default index file.
|
|
||||||
*/
|
|
||||||
"folderStatus": {
|
|
||||||
/*
|
|
||||||
* for example:
|
|
||||||
* "/some/folder/": 200
|
|
||||||
*/
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Localization, for example "en", "de" etc. - see h5aiLangs below for
|
* Slide tree bar into viewport if there is enough space, boolean.
|
||||||
* possible values. Adjust it to your needs. If lang is not found in
|
*/
|
||||||
* h5aiLangs it defaults to "en".
|
"slideTree": true,
|
||||||
*/
|
|
||||||
"lang": null,
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to use browser language, falls back to previous specified lang.
|
* Associative array of folders and their HTTP status codes to
|
||||||
*/
|
* avoid HEAD requests to that folders. The key (folder) must start
|
||||||
"useBrowserLang": true,
|
* and end with a slash (/).
|
||||||
|
* For example:
|
||||||
/*
|
* "/some/folder/": 200
|
||||||
* Set parent folder labels to real folder names.
|
* will always return HTTP status 200 (OK), which will be interpreted
|
||||||
*/
|
* as a non auto indexed folder, that means a folder containing an
|
||||||
"setParentFolderLabels": true,
|
* appropriate default index file.
|
||||||
|
*/
|
||||||
/*
|
"folderStatus": {
|
||||||
* Link the hover effects between crumb, extended view and tree.
|
/*
|
||||||
*/
|
* for example:
|
||||||
"linkHoverStates": true,
|
* "/some/folder/": 200
|
||||||
|
*/
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only used in PHP implementation.
|
* Localization, for example "en", "de" etc. - see h5aiLangs below for
|
||||||
* Date format in PHP syntax, for example: "Y-m-d H:i:s"
|
* possible values. Adjust it to your needs. If lang is not found in
|
||||||
* http://www.php.net/manual/en/function.date.php
|
* h5aiLangs it defaults to "en".
|
||||||
*/
|
*/
|
||||||
"dateFormat": "Y-m-d H:i",
|
"lang": null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only used in PHP implementation.
|
* Try to use browser language, falls back to previous specified lang.
|
||||||
* Files/folders that should never be listed. Specified
|
*/
|
||||||
* by the complete filename or by a regular expression.
|
"useBrowserLang": true,
|
||||||
* http://www.php.net/manual/en/function.preg-match.php
|
|
||||||
*/
|
/*
|
||||||
"ignore": [ "h5ai", "h5ai.header.html", "h5ai.footer.html" ],
|
* Set parent folder labels to real folder names.
|
||||||
"ignoreRE": [ "/^\\./" ]
|
*/
|
||||||
|
"setParentFolderLabels": true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Link the hover effects between crumb, extended view and tree.
|
||||||
|
*/
|
||||||
|
"linkHoverStates": true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only used in PHP implementation.
|
||||||
|
* Date format in PHP syntax, for example: "Y-m-d H:i:s"
|
||||||
|
* http://www.php.net/manual/en/function.date.php
|
||||||
|
*/
|
||||||
|
"dateFormat": "Y-m-d H:i",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IMPORTANT: PHP implementation doesn't care about Apache's
|
||||||
|
* ignores, so you have to specify this here.
|
||||||
|
*
|
||||||
|
* Only used in PHP implementation.
|
||||||
|
* Files/folders that should never be listed. Specified
|
||||||
|
* by the complete filename or by a regular expression.
|
||||||
|
* http://www.php.net/manual/en/function.preg-match.php
|
||||||
|
*/
|
||||||
|
"ignore": [ "h5ai", "h5ai.header.html", "h5ai.footer.html" ],
|
||||||
|
"ignoreRE": [ "/^\\./" ],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only used in PHP implementation.
|
||||||
|
* Show thumbnails in Icons view.
|
||||||
|
*/
|
||||||
|
"showThumbs": true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -87,146 +112,198 @@ h5aiOptions = {
|
|||||||
*/
|
*/
|
||||||
h5aiLangs = {
|
h5aiLangs = {
|
||||||
|
|
||||||
"en": {
|
"en": {
|
||||||
"lang": "english",
|
"lang": "english",
|
||||||
"details": "details",
|
"details": "details",
|
||||||
"icons": "icons",
|
"icons": "icons",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"lastModified": "Last modified",
|
"lastModified": "Last modified",
|
||||||
"size": "Size",
|
"size": "Size",
|
||||||
"parentDirectory": "Parent Directory",
|
"parentDirectory": "Parent Directory",
|
||||||
"empty": "empty",
|
"empty": "empty",
|
||||||
"folders": "folders",
|
"folders": "folders",
|
||||||
"files": "files"
|
"files": "files"
|
||||||
},
|
},
|
||||||
|
|
||||||
"de": {
|
"de": {
|
||||||
"lang": "deutsch",
|
"lang": "deutsch",
|
||||||
"details": "Details",
|
"details": "Details",
|
||||||
"icons": "Icons",
|
"icons": "Icons",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"lastModified": "Geändert",
|
"lastModified": "Geändert",
|
||||||
"size": "Größe",
|
"size": "Größe",
|
||||||
"parentDirectory": "Übergeordnetes Verzeichnis",
|
"parentDirectory": "Übergeordnetes Verzeichnis",
|
||||||
"empty": "leer",
|
"empty": "leer",
|
||||||
"folders": "Ordner",
|
"folders": "Ordner",
|
||||||
"files": "Dateien"
|
"files": "Dateien"
|
||||||
},
|
},
|
||||||
|
|
||||||
"fr": {
|
|
||||||
"lang": "française",
|
|
||||||
"details": "détails",
|
|
||||||
"icons": "icônes",
|
|
||||||
"name": "Nom",
|
|
||||||
"lastModified": "Dernière modification",
|
|
||||||
"size": "Taille",
|
|
||||||
"parentDirectory": "Dossier parent",
|
|
||||||
"empty": "vide",
|
|
||||||
"folders": "[?folders?]",
|
|
||||||
"files": "[?files?]"
|
|
||||||
},
|
|
||||||
|
|
||||||
"nl": {
|
"fr": {
|
||||||
"lang": "nederlands",
|
"lang": "français",
|
||||||
"details": "details",
|
"details": "détails",
|
||||||
"icons": "iconen",
|
"icons": "icônes",
|
||||||
"name": "Naam",
|
"name": "Nom",
|
||||||
"lastModified": "Laatste wijziging",
|
"lastModified": "Dernière modification",
|
||||||
"size": "Grootte",
|
"size": "Taille",
|
||||||
"parentDirectory": "Bovenliggende map",
|
"parentDirectory": "Dossier parent",
|
||||||
"empty": "lege",
|
"empty": "vide",
|
||||||
"folders": "[?folders?]",
|
"folders": "Répertoires",
|
||||||
"files": "[?files?]"
|
"files": "Fichiers"
|
||||||
},
|
},
|
||||||
|
|
||||||
"sv": {
|
"nl": {
|
||||||
"lang": "svenska",
|
"lang": "nederlands",
|
||||||
"details": "detaljerad",
|
"details": "details",
|
||||||
"icons": "ikoner",
|
"icons": "iconen",
|
||||||
"name": "Filnamn",
|
"name": "Naam",
|
||||||
"lastModified": "Senast ändrad",
|
"lastModified": "Laatste wijziging",
|
||||||
"size": "Filstorlek",
|
"size": "Grootte",
|
||||||
"parentDirectory": "Till överordnad mapp",
|
"parentDirectory": "Bovenliggende map",
|
||||||
"empty": "tom",
|
"empty": "lege",
|
||||||
"folders": "[?folders?]",
|
"folders": "[?folders?]",
|
||||||
"files": "[?files?]"
|
"files": "[?files?]"
|
||||||
},
|
},
|
||||||
|
|
||||||
"cs": {
|
"sv": {
|
||||||
"lang": "[?lang?]",
|
"lang": "svenska",
|
||||||
"details": "podrobnosti",
|
"details": "detaljerad",
|
||||||
"icons": "ikony",
|
"icons": "ikoner",
|
||||||
"name": "Název",
|
"name": "Filnamn",
|
||||||
"lastModified": "Upraveno",
|
"lastModified": "Senast ändrad",
|
||||||
"size": "Velikost",
|
"size": "Filstorlek",
|
||||||
"parentDirectory": "Nadřazený adresář",
|
"parentDirectory": "Till överordnad mapp",
|
||||||
"empty": "prázdný",
|
"empty": "tom",
|
||||||
"folders": "[?folders?]",
|
"folders": "[?folders?]",
|
||||||
"files": "[?files?]"
|
"files": "[?files?]"
|
||||||
},
|
},
|
||||||
|
|
||||||
"sk": {
|
"cs": {
|
||||||
"lang": "[?lang?]",
|
"lang": "čeština",
|
||||||
"details": "podrobnosti",
|
"details": "podrobnosti",
|
||||||
"icons": "ikony",
|
"icons": "ikony",
|
||||||
"name": "Názov",
|
"name": "Název",
|
||||||
"lastModified": "Upravené",
|
"lastModified": "Upraveno",
|
||||||
"size": "Velkosť",
|
"size": "Velikost",
|
||||||
"parentDirectory": "Nadriadený priečinok",
|
"parentDirectory": "Nadřazený adresář",
|
||||||
"empty": "prázdny",
|
"empty": "prázdný",
|
||||||
"folders": "[?folders?]",
|
"folders": "složek",
|
||||||
"files": "[?files?]"
|
"files": "souborů"
|
||||||
},
|
},
|
||||||
|
|
||||||
"es": {
|
"sk": {
|
||||||
"lang": "español",
|
"lang": "slovenčina",
|
||||||
"details": "Detalles",
|
"details": "podrobnosti",
|
||||||
"icons": "Íconos",
|
"icons": "ikony",
|
||||||
"name": "Nombre",
|
"name": "Názov",
|
||||||
"lastModified": "Última modificación",
|
"lastModified": "Upravené",
|
||||||
"size": "Tamaño",
|
"size": "Velkosť",
|
||||||
"parentDirectory": "Directorio superior",
|
"parentDirectory": "Nadriadený priečinok",
|
||||||
"empty": "vacío",
|
"empty": "prázdny",
|
||||||
"folders": "[?folders?]",
|
"folders": "priečinkov",
|
||||||
"files": "[?files?]"
|
"files": "súborov"
|
||||||
},
|
},
|
||||||
|
|
||||||
"tr": {
|
"es": {
|
||||||
"lang": "türkçe",
|
"lang": "español",
|
||||||
"details": "detaylar",
|
"details": "Detalles",
|
||||||
"icons": "ikonlar",
|
"icons": "Íconos",
|
||||||
"name": "İsim",
|
"name": "Nombre",
|
||||||
"lastModified": "Son Düzenleme",
|
"lastModified": "Última modificación",
|
||||||
"size": "Boyut",
|
"size": "Tamaño",
|
||||||
"parentDirectory": "Üst Dizin",
|
"parentDirectory": "Directorio superior",
|
||||||
"empty": "boş",
|
"empty": "vacío",
|
||||||
"folders": "[?folders?]",
|
"folders": "[?folders?]",
|
||||||
"files": "[?files?]"
|
"files": "[?files?]"
|
||||||
},
|
},
|
||||||
|
|
||||||
"pt": {
|
"tr": {
|
||||||
"lang": "português",
|
"lang": "türkçe",
|
||||||
"details": "detalhes",
|
"details": "detaylar",
|
||||||
"icons": "ícones",
|
"icons": "ikonlar",
|
||||||
"name": "Nome",
|
"name": "İsim",
|
||||||
"lastModified": "Última modificação",
|
"lastModified": "Son Düzenleme",
|
||||||
"size": "Tamanho",
|
"size": "Boyut",
|
||||||
"parentDirectory": "Diretório superior",
|
"parentDirectory": "Üst Dizin",
|
||||||
"empty": "vazio",
|
"empty": "boş",
|
||||||
"folders": "[?folders?]",
|
"folders": "[?folders?]",
|
||||||
"files": "[?files?]"
|
"files": "[?files?]"
|
||||||
},
|
},
|
||||||
|
|
||||||
"bg": {
|
"pt": {
|
||||||
"lang": "[?lang?]",
|
"lang": "português",
|
||||||
"details": "детайли",
|
"details": "detalhes",
|
||||||
"icons": "икони",
|
"icons": "ícones",
|
||||||
"name": "Име",
|
"name": "Nome",
|
||||||
"lastModified": "Последна промяна",
|
"lastModified": "Última modificação",
|
||||||
"size": "Размер",
|
"size": "Tamanho",
|
||||||
"parentDirectory": "Предходна директория",
|
"parentDirectory": "Diretório superior",
|
||||||
"empty": "празно",
|
"empty": "vazio",
|
||||||
"folders": "[?folders?]",
|
"folders": "pastas",
|
||||||
"files": "[?files?]"
|
"files": "arquivos"
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"bg": {
|
||||||
|
"lang": "български",
|
||||||
|
"details": "детайли",
|
||||||
|
"icons": "икони",
|
||||||
|
"name": "Име",
|
||||||
|
"lastModified": "Последна промяна",
|
||||||
|
"size": "Размер",
|
||||||
|
"parentDirectory": "Предходна директория",
|
||||||
|
"empty": "празно",
|
||||||
|
"folders": "папки",
|
||||||
|
"files": "файлове"
|
||||||
|
},
|
||||||
|
|
||||||
|
"lv": {
|
||||||
|
"lang": "latviešu",
|
||||||
|
"details": "detaļas",
|
||||||
|
"icons": "ikonas",
|
||||||
|
"name": "Nosaukums",
|
||||||
|
"lastModified": "Pēdējoreiz modificēts",
|
||||||
|
"size": "Izmērs",
|
||||||
|
"parentDirectory": "Vecākdirektorijs",
|
||||||
|
"empty": "tukšs",
|
||||||
|
"folders": "mapes",
|
||||||
|
"files": "faili"
|
||||||
|
},
|
||||||
|
|
||||||
|
"zh-cn": {
|
||||||
|
"lang": "简体中文",
|
||||||
|
"details": "详情",
|
||||||
|
"icons": "图标",
|
||||||
|
"name": "文件名",
|
||||||
|
"lastModified": "上次修改",
|
||||||
|
"size": "大小",
|
||||||
|
"parentDirectory": "上层文件夹",
|
||||||
|
"empty": "空文件夹",
|
||||||
|
"folders": "文件夹",
|
||||||
|
"files": "文件"
|
||||||
|
},
|
||||||
|
|
||||||
|
"pl": {
|
||||||
|
"lang": "polski",
|
||||||
|
"details": "szczegóły",
|
||||||
|
"icons": "ikony",
|
||||||
|
"name": "Nazwa",
|
||||||
|
"lastModified": "Ostatnia modyfikacja",
|
||||||
|
"size": "Rozmiar",
|
||||||
|
"parentDirectory": "Katalog nadrzędny",
|
||||||
|
"empty": "pusty",
|
||||||
|
"folders": "foldery",
|
||||||
|
"files": "pliki"
|
||||||
|
},
|
||||||
|
|
||||||
|
"ru": {
|
||||||
|
"lang": "русский",
|
||||||
|
"details": "детали",
|
||||||
|
"icons": "иконки",
|
||||||
|
"name": "Имя",
|
||||||
|
"lastModified": "Последние изменения",
|
||||||
|
"size": "Размер",
|
||||||
|
"parentDirectory": "Главная директория",
|
||||||
|
"empty": "пусто",
|
||||||
|
"folders": "папки",
|
||||||
|
"files": "файлы"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require_once "thumbnail.php";
|
||||||
|
|
||||||
|
|
||||||
class Entry {
|
class Entry {
|
||||||
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size;
|
private $h5ai, $label, $absPath, $absHref, $date, $isFolder, $type, $size, $thumbTypes;
|
||||||
|
|
||||||
public function __construct( $h5ai, $absPath, $absHref, $type = null, $label = null ) {
|
public function __construct( $h5ai, $absPath, $absHref, $type = null, $label = null ) {
|
||||||
|
|
||||||
@@ -20,6 +23,8 @@ class Entry {
|
|||||||
$this->type = $type !== null ? $type : $this->h5ai->getType( $this->absPath );
|
$this->type = $type !== null ? $type : $this->h5ai->getType( $this->absPath );
|
||||||
$this->size = filesize( $this->absPath );
|
$this->size = filesize( $this->absPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->thumbTypes = array( "bmp", "gif", "ico", "image", "jpg", "png", "tiff" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isFolder() {
|
public function isFolder() {
|
||||||
@@ -54,6 +59,8 @@ class Entry {
|
|||||||
|
|
||||||
$classes = "entry " . $this->type;
|
$classes = "entry " . $this->type;
|
||||||
$img = $this->type;
|
$img = $this->type;
|
||||||
|
$smallImg = "/h5ai/icons/16x16/" . $this->type . ".png";
|
||||||
|
$bigImg = "/h5ai/icons/48x48/" . $this->type . ".png";
|
||||||
$hint = "";
|
$hint = "";
|
||||||
$dateLabel = date( $dateFormat, $this->date );
|
$dateLabel = date( $dateFormat, $this->date );
|
||||||
|
|
||||||
@@ -63,17 +70,28 @@ class Entry {
|
|||||||
if ( $code !== "h5ai" ) {
|
if ( $code !== "h5ai" ) {
|
||||||
if ( $code === 200 ) {
|
if ( $code === 200 ) {
|
||||||
$img = "folder-page";
|
$img = "folder-page";
|
||||||
|
$smallImg = "/h5ai/icons/16x16/folder-page.png";
|
||||||
|
$bigImg = "/h5ai/icons/48x48/folder-page.png";
|
||||||
} else {
|
} else {
|
||||||
$classes .= " error";
|
$classes .= " error";
|
||||||
$hint = "<span class='hint'> " . $code . " </span>";
|
$hint = "<span class='hint'> " . $code . " </span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( $this->h5ai->showThumbs() && in_array( $this->type, $this->thumbTypes ) ) {
|
||||||
|
$classes .= " thumb";
|
||||||
|
$thumbnail = new Thumbnail( $this->absPath, "square", 16, 16 );
|
||||||
|
$thumbnail->create();
|
||||||
|
$smallImg = file_exists( $thumbnail->getPath() ) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
|
||||||
|
$thumbnail = new Thumbnail( $this->absPath, "rational", 96, 46 );
|
||||||
|
$thumbnail->create();
|
||||||
|
$bigImg = file_exists( $thumbnail->getPath() ) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
|
||||||
|
}
|
||||||
|
|
||||||
$html = "\t<li class='" . $classes . "'>\n";
|
$html = "\t<li class='" . $classes . "'>\n";
|
||||||
$html .= "\t\t<a href='" . $this->absHref . "'>\n";
|
$html .= "\t\t<a href='" . $this->absHref . "'>\n";
|
||||||
$html .= "\t\t\t<span class='icon small'><img src='/h5ai/icons/16x16/" . $img . ".png' alt='" . $img . "' /></span>\n";
|
$html .= "\t\t\t<span class='icon small'><img src='" . $smallImg . "' alt='" . $img . "' /></span>\n";
|
||||||
$html .= "\t\t\t<span class='icon big'><img src='/h5ai/icons/48x48/" . $img . ".png' alt='" . $img . "' /></span>\n";
|
$html .= "\t\t\t<span class='icon big'><img src='" . $bigImg . "' alt='" . $img . "' /></span>\n";
|
||||||
$html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
|
$html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
|
||||||
$html .= "\t\t\t<span class='date'>" . $dateLabel . "</span>\n";
|
$html .= "\t\t\t<span class='date'>" . $dateLabel . "</span>\n";
|
||||||
$html .= "\t\t\t<span class='size'>" . $this->formatSize( $this->size ) . "</span>\n";
|
$html .= "\t\t\t<span class='size'>" . $this->formatSize( $this->size ) . "</span>\n";
|
||||||
|
@@ -22,9 +22,11 @@ class H5ai {
|
|||||||
|
|
||||||
$this->ignore = $this->options["options"]["ignore"];
|
$this->ignore = $this->options["options"]["ignore"];
|
||||||
$this->ignoreRE = $this->options["options"]["ignoreRE"];
|
$this->ignoreRE = $this->options["options"]["ignoreRE"];
|
||||||
|
|
||||||
|
$defaultSortOrder = $this->options["options"]["sortorder"];
|
||||||
$this->sortOrder = array(
|
$this->sortOrder = array(
|
||||||
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : H5ai::$SORT_ORDER["column"],
|
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : $defaultSortOrder["column"],
|
||||||
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : H5ai::$SORT_ORDER["ascending"]
|
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : $defaultSortOrder["ascending"]
|
||||||
);
|
);
|
||||||
$this->dateFormat = $this->options["options"]["dateFormat"];
|
$this->dateFormat = $this->options["options"]["dateFormat"];
|
||||||
$this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0];
|
$this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0];
|
||||||
@@ -81,7 +83,7 @@ class H5ai {
|
|||||||
|
|
||||||
public function getOptions() {
|
public function getOptions() {
|
||||||
|
|
||||||
return $this->options["options"] ;
|
return $this->options["options"];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLangs() {
|
public function getLangs() {
|
||||||
@@ -115,6 +117,11 @@ class H5ai {
|
|||||||
return $this->dateFormat;
|
return $this->dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showThumbs() {
|
||||||
|
|
||||||
|
return $this->options["options"]["showThumbs"] === true;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
|
|
||||||
$title = $this->domain . rawurldecode( $this->absHref );
|
$title = $this->domain . rawurldecode( $this->absHref );
|
||||||
@@ -185,12 +192,12 @@ class H5ai {
|
|||||||
|
|
||||||
public function startsWith( $sequence, $start ) {
|
public function startsWith( $sequence, $start ) {
|
||||||
|
|
||||||
return substr( $sequence, 0, strlen( $start ) ) === $start;
|
return strcasecmp( substr( $sequence, 0, strlen( $start ) ), $start ) === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function endsWith( $sequence, $end ) {
|
public function endsWith( $sequence, $end ) {
|
||||||
|
|
||||||
return substr( $sequence, -strlen( $end ) ) === $end;
|
return strcasecmp( substr( $sequence, -strlen( $end ) ), $end ) === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHttpCode( $absHref ) {
|
public function getHttpCode( $absHref ) {
|
||||||
|
202
src/h5ai/php/image.php
Normal file
202
src/h5ai/php/image.php
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Image {
|
||||||
|
|
||||||
|
private $sourceFile;
|
||||||
|
private $source;
|
||||||
|
private $width;
|
||||||
|
private $height;
|
||||||
|
private $type;
|
||||||
|
|
||||||
|
private $dest;
|
||||||
|
|
||||||
|
|
||||||
|
public static function isUsable() {
|
||||||
|
|
||||||
|
return GD_VERSION != "GD_VERSION";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct( $filename = null ) {
|
||||||
|
|
||||||
|
$this->sourceFile = null;
|
||||||
|
$this->source = null;
|
||||||
|
$this->width = null;
|
||||||
|
$this->height = null;
|
||||||
|
$this->type = null;
|
||||||
|
|
||||||
|
$this->dest = null;
|
||||||
|
|
||||||
|
$this->setSource( $filename );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function __destruct() {
|
||||||
|
|
||||||
|
$this->releaseSource();
|
||||||
|
$this->releaseDest();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setSource( $filename ) {
|
||||||
|
|
||||||
|
$this->releaseSource();
|
||||||
|
$this->releaseDest();
|
||||||
|
|
||||||
|
if ( is_null( $filename ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$this->sourceFile = $filename;
|
||||||
|
|
||||||
|
list( $this->width, $this->height, $this->type ) = getimagesize( $this->sourceFile );
|
||||||
|
|
||||||
|
$this->source = imagecreatefromstring( file_get_contents( $this->sourceFile ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function showDest() {
|
||||||
|
|
||||||
|
if ( !is_null( $this->dest ) ) {
|
||||||
|
header( "Content-type: image/jpeg" );
|
||||||
|
imagejpeg( $this->dest, null, 100 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function saveDest( $filename ) {
|
||||||
|
|
||||||
|
if ( !is_null( $this->dest ) ) {
|
||||||
|
@imagejpeg( $this->dest, $filename, 90 );
|
||||||
|
@chmod( $filename, 0775 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function releaseDest() {
|
||||||
|
|
||||||
|
if ( !is_null( $this->dest ) ) {
|
||||||
|
imagedestroy( $this->dest );
|
||||||
|
$this->dest = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function releaseSource() {
|
||||||
|
|
||||||
|
if ( !is_null( $this->source ) ) {
|
||||||
|
imagedestroy( $this->source );
|
||||||
|
$this->sourceFile = null;
|
||||||
|
$this->source = null;
|
||||||
|
$this->width = null;
|
||||||
|
$this->height = null;
|
||||||
|
$this->type = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function showImage( $filename ) {
|
||||||
|
|
||||||
|
$image = file_get_contents( $filename );
|
||||||
|
header( "content-type: image" );
|
||||||
|
echo $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function magic( $destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight, $canWidth = null, $canHeight = null, $color = null ) {
|
||||||
|
|
||||||
|
if ( !is_null( $canWidth ) && !is_null( $canHeight ) ) {
|
||||||
|
$this->dest = imagecreatetruecolor( $canWidth, $canHeight );
|
||||||
|
} else {
|
||||||
|
$this->dest = imagecreatetruecolor( $destWidth, $destHeight );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_null( $color ) ) {
|
||||||
|
$color = array( 255, 255, 255 );
|
||||||
|
}
|
||||||
|
$icol = imagecolorallocate( $this->dest, $color[0], $color[1], $color[2] );
|
||||||
|
imagefill( $this->dest, 0, 0, $icol );
|
||||||
|
|
||||||
|
imagecopyresampled( $this->dest, $this->source, $destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function thumb( $mode, $width, $height = null, $color = null ) {
|
||||||
|
|
||||||
|
if ( $height === null ) {
|
||||||
|
$height = $width;
|
||||||
|
}
|
||||||
|
if ( $mode === "square" ) {
|
||||||
|
$this->squareThumb( $width );
|
||||||
|
} elseif ( $mode === "rational" ) {
|
||||||
|
$this->rationalThumb( $width, $height );
|
||||||
|
} elseif ( $mode === "center" ) {
|
||||||
|
$this->centerThumb( $width, $height, $color );
|
||||||
|
} else {
|
||||||
|
$this->freeThumb( $width, $height );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function squareThumb( $width ) {
|
||||||
|
|
||||||
|
$a = min( $this->width, $this->height );
|
||||||
|
$x = intval( ( $this->width - $a ) / 2 );
|
||||||
|
$y = intval( ( $this->height - $a ) / 2 );
|
||||||
|
|
||||||
|
$this->magic( 0, 0, $x, $y, $width, $width, $a, $a );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function rationalThumb( $width, $height ) {
|
||||||
|
|
||||||
|
$r = 1.0 * $this->width / $this->height;
|
||||||
|
|
||||||
|
$h = $height;
|
||||||
|
$w = $r * $h;
|
||||||
|
|
||||||
|
if ( $w > $width ) {
|
||||||
|
|
||||||
|
$w = $width;
|
||||||
|
$h = 1.0 / $r * $w;
|
||||||
|
}
|
||||||
|
|
||||||
|
$w = intval( $w );
|
||||||
|
$h = intval( $h );
|
||||||
|
|
||||||
|
$this->magic( 0, 0, 0, 0, $w, $h, $this->width, $this->height );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function centerThumb( $width, $height, $color = null ) {
|
||||||
|
|
||||||
|
$r = 1.0 * $this->width / $this->height;
|
||||||
|
|
||||||
|
$h = $height;
|
||||||
|
$w = $r * $h;
|
||||||
|
|
||||||
|
if ( $w > $width ) {
|
||||||
|
|
||||||
|
$w = $width;
|
||||||
|
$h = 1.0 / $r * $w;
|
||||||
|
}
|
||||||
|
|
||||||
|
$w = intval( $w );
|
||||||
|
$h = intval( $h );
|
||||||
|
|
||||||
|
$x = intval( ( $width - $w ) / 2 );
|
||||||
|
$y = intval( ( $height - $h ) / 2 );
|
||||||
|
|
||||||
|
$this->magic( $x, $y, 0, 0, $w, $h, $this->width, $this->height, $width, $height, $color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function freeThumb( $width, $height ) {
|
||||||
|
|
||||||
|
$w = intval( $width );
|
||||||
|
$h = intval( $height );
|
||||||
|
|
||||||
|
$this->magic( 0, 0, 0, 0, $w, $h, $this->width, $this->height );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
26
src/h5ai/php/thumb.php
Normal file
26
src/h5ai/php/thumb.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "thumbnail.php";
|
||||||
|
|
||||||
|
$src = $_REQUEST["src"];
|
||||||
|
$width = $_REQUEST["width"];
|
||||||
|
$height = $_REQUEST["height"];
|
||||||
|
$mode = $_REQUEST["mode"];
|
||||||
|
|
||||||
|
if ( !Thumbnail::isUsable() ) {
|
||||||
|
Image::showImage( $src );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$thumbnail = new Thumbnail( $src, $mode, $width, $height );
|
||||||
|
$thumbnail->create( 1 );
|
||||||
|
if ( file_exists( $thumbnail->getPath() ) ) {
|
||||||
|
Image::showImage( $thumbnail->getPath() );
|
||||||
|
} else {
|
||||||
|
$image = new Image();
|
||||||
|
$image->setSource( $src );
|
||||||
|
$image->thumb( $mode, $width, $height );
|
||||||
|
$image->showDest();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
56
src/h5ai/php/thumbnail.php
Normal file
56
src/h5ai/php/thumbnail.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "image.php";
|
||||||
|
|
||||||
|
class Thumbnail {
|
||||||
|
|
||||||
|
private $src, $width, $height, $name, $href, $path;
|
||||||
|
|
||||||
|
public static function isUsable() {
|
||||||
|
|
||||||
|
return Image::isUsable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct( $src, $mode, $width, $height ) {
|
||||||
|
|
||||||
|
$this->src = $src;
|
||||||
|
$this->width = $width;
|
||||||
|
$this->height = $height;
|
||||||
|
$this->mode = $mode;
|
||||||
|
$this->name = sha1( "$this->src-$this->width-$this->height-$this->mode" );
|
||||||
|
$this->href = "/h5ai/cache/thumb-" . $this->name . ".jpg";
|
||||||
|
$this->path = getenv( "DOCUMENT_ROOT" ) . $this->href;
|
||||||
|
$this->liveHref = "/h5ai/php/thumb.php?src=" . $this->src . "&width=" . $this->width . "&height=" . $this->height . "&mode=" . $this->mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create( $force = 0 ) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
$force === 2
|
||||||
|
|| ( $force === 1 && !file_exists( $this->path ) )
|
||||||
|
|| ( file_exists( $this->path ) && filemtime( $this->src ) >= filemtime( $this->path ) )
|
||||||
|
) {
|
||||||
|
$image = new Image();
|
||||||
|
$image->setSource( $this->src );
|
||||||
|
$image->thumb( $this->mode, $this->width, $this->height );
|
||||||
|
$image->saveDest( $this->path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHref() {
|
||||||
|
|
||||||
|
return $this->href;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPath() {
|
||||||
|
|
||||||
|
return $this->path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLiveHref() {
|
||||||
|
|
||||||
|
return $this->liveHref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
188
src/js.htaccess
188
src/js.htaccess
@@ -9,115 +9,105 @@
|
|||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# IMPORTANT FOR XAMPP
|
# h5ai header and footer
|
||||||
# if you're running XAMPP you might need to replace the
|
|
||||||
# following line with
|
|
||||||
# <IfModule autoindex_color_module>
|
|
||||||
################################
|
################################
|
||||||
<IfModule autoindex_module>
|
|
||||||
|
HeaderName /h5ai/header.html
|
||||||
|
ReadmeName /h5ai/footer.html
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# h5ai header and footer
|
# hide h5ai folder and config files from index
|
||||||
################################
|
################################
|
||||||
|
|
||||||
HeaderName /h5ai/header.html
|
IndexIgnore h5ai h5ai.header.html h5ai.footer.html
|
||||||
ReadmeName /h5ai/footer.html
|
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# hide h5ai folder and config files from index
|
# table options
|
||||||
################################
|
################################
|
||||||
|
|
||||||
IndexIgnore h5ai h5ai.header.html h5ai.footer.html
|
# syntax for default sort order is: IndexOrderDefault Ascending|Descending Name|Date|Size
|
||||||
|
IndexOrderDefault Ascending Name
|
||||||
|
|
||||||
|
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
||||||
|
IndexOptions Charset=UTF-8
|
||||||
|
IndexOptions FancyIndexing
|
||||||
|
IndexOptions HTMLTable
|
||||||
|
IndexOptions XHTML
|
||||||
|
IndexOptions SuppressHTMLPreamble
|
||||||
|
IndexOptions SuppressRules
|
||||||
|
IndexOptions SuppressDescription
|
||||||
|
IndexOptions FoldersFirst
|
||||||
|
IndexOptions IgnoreCase
|
||||||
|
IndexOptions IconsAreLinks
|
||||||
|
IndexOptions VersionSort
|
||||||
|
IndexOptions NameWidth=*
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# table options
|
# icon mapping
|
||||||
################################
|
################################
|
||||||
|
|
||||||
IndexOrderDefault Ascending Name
|
AddIcon /h5ai/icons/16x16/folder-parent.png ..
|
||||||
|
AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^
|
||||||
|
AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^
|
||||||
|
|
||||||
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
AddIcon /h5ai/icons/16x16/readme.png README
|
||||||
IndexOptions Charset=UTF-8
|
AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
|
||||||
IndexOptions FancyIndexing
|
AddIcon /h5ai/icons/16x16/install.png INSTALL
|
||||||
IndexOptions HTMLTable
|
AddIcon /h5ai/icons/16x16/authors.png AUTHORS
|
||||||
IndexOptions XHTML
|
AddIcon /h5ai/icons/16x16/log.png LOG Log log
|
||||||
IndexOptions SuppressHTMLPreamble
|
|
||||||
IndexOptions SuppressRules
|
AddIcon /h5ai/icons/16x16/css.png .less
|
||||||
IndexOptions SuppressDescription
|
AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
|
||||||
IndexOptions FoldersFirst
|
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
|
||||||
IndexOptions IgnoreCase
|
AddIcon /h5ai/icons/16x16/bin.png .so .o
|
||||||
IndexOptions IconsAreLinks
|
|
||||||
IndexOptions VersionSort
|
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
|
||||||
IndexOptions NameWidth=*
|
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2
|
||||||
|
AddIcon /h5ai/icons/16x16/tar.png .tar
|
||||||
|
AddIcon /h5ai/icons/16x16/pdf.png .pdf
|
||||||
################################
|
AddIcon /h5ai/icons/16x16/deb.png .deb
|
||||||
# icon mapping
|
AddIcon /h5ai/icons/16x16/rpm.png .rpm
|
||||||
################################
|
AddIcon /h5ai/icons/16x16/cd.png .iso .cue
|
||||||
|
|
||||||
AddIcon /h5ai/icons/16x16/folder-parent.png ..
|
AddIconByType /h5ai/icons/16x16/png.png image/png
|
||||||
AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^
|
AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg
|
||||||
AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^
|
AddIconByType /h5ai/icons/16x16/gif.png image/gif
|
||||||
|
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon
|
||||||
AddIcon /h5ai/icons/16x16/readme.png README
|
AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp
|
||||||
AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
|
|
||||||
AddIcon /h5ai/icons/16x16/install.png INSTALL
|
AddIconByType /h5ai/icons/16x16/html.png text/html
|
||||||
AddIcon /h5ai/icons/16x16/authors.png AUTHORS
|
AddIconByType /h5ai/icons/16x16/css.png text/css
|
||||||
AddIcon /h5ai/icons/16x16/log.png LOG Log log
|
AddIconByType /h5ai/icons/16x16/xml.png application/xml
|
||||||
|
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json
|
||||||
AddIcon /h5ai/icons/16x16/css.png .less
|
AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
|
||||||
AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
|
|
||||||
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
|
AddIconByType /h5ai/icons/16x16/py.png text/x-python
|
||||||
AddIcon /h5ai/icons/16x16/bin.png .so .o
|
AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby
|
||||||
|
AddIconByType /h5ai/icons/16x16/java.png text/x-java
|
||||||
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
|
AddIconByType /h5ai/icons/16x16/cpp.png text/x-c++src
|
||||||
AddIcon /h5ai/icons/16x16/zip.png .zip .Z .z .jar .war .gz .bz2
|
AddIconByType /h5ai/icons/16x16/hpp.png text/x-c++hdr
|
||||||
AddIcon /h5ai/icons/16x16/tar.png .tar
|
AddIconByType /h5ai/icons/16x16/c.png text/x-csrc
|
||||||
AddIcon /h5ai/icons/16x16/pdf.png .pdf
|
AddIconByType /h5ai/icons/16x16/h.png text/x-chdr
|
||||||
AddIcon /h5ai/icons/16x16/deb.png .deb
|
|
||||||
AddIcon /h5ai/icons/16x16/rpm.png .rpm
|
AddIconByType /h5ai/icons/16x16/pdf.png application/pdf
|
||||||
AddIcon /h5ai/icons/16x16/cd.png .iso .cue
|
|
||||||
|
AddIconByType /h5ai/icons/16x16/rtf.png text/rtf application/rtf
|
||||||
AddIconByType /h5ai/icons/16x16/png.png image/png
|
AddIconByType /h5ai/icons/16x16/tex.png text/x-tex
|
||||||
AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg
|
AddIconByType /h5ai/icons/16x16/makefile.png text/x-makefile
|
||||||
AddIconByType /h5ai/icons/16x16/gif.png image/gif
|
|
||||||
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon
|
AddIconByType /h5ai/icons/16x16/bin.png application/java-vm
|
||||||
AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp
|
AddIconByType /h5ai/icons/16x16/exe.png application/x-executable application/x-msdos-program
|
||||||
|
|
||||||
AddIconByType /h5ai/icons/16x16/html.png text/html
|
AddIconByType /h5ai/icons/16x16/text.png text/*
|
||||||
AddIconByType /h5ai/icons/16x16/css.png text/css
|
AddIconByType /h5ai/icons/16x16/image.png image/*
|
||||||
AddIconByType /h5ai/icons/16x16/xml.png application/xml
|
AddIconByType /h5ai/icons/16x16/audio.png audio/*
|
||||||
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json
|
AddIconByType /h5ai/icons/16x16/video.png video/*
|
||||||
AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
|
|
||||||
|
AddIconByEncoding /h5ai/icons/16x16/zip.png x-compress x-gzip x-bzip2
|
||||||
AddIconByType /h5ai/icons/16x16/py.png text/x-python
|
|
||||||
AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby
|
DefaultIcon /h5ai/icons/16x16/unknown.png
|
||||||
AddIconByType /h5ai/icons/16x16/java.png text/x-java
|
|
||||||
AddIconByType /h5ai/icons/16x16/cpp.png text/x-c++src
|
|
||||||
AddIconByType /h5ai/icons/16x16/hpp.png text/x-c++hdr
|
|
||||||
AddIconByType /h5ai/icons/16x16/c.png text/x-csrc
|
|
||||||
AddIconByType /h5ai/icons/16x16/h.png text/x-chdr
|
|
||||||
|
|
||||||
AddIconByType /h5ai/icons/16x16/pdf.png application/pdf
|
|
||||||
|
|
||||||
AddIconByType /h5ai/icons/16x16/rtf.png text/rtf application/rtf
|
|
||||||
AddIconByType /h5ai/icons/16x16/tex.png text/x-tex
|
|
||||||
AddIconByType /h5ai/icons/16x16/makefile.png text/x-makefile
|
|
||||||
|
|
||||||
AddIconByType /h5ai/icons/16x16/bin.png application/java-vm
|
|
||||||
AddIconByType /h5ai/icons/16x16/exe.png application/x-executable application/x-msdos-program
|
|
||||||
|
|
||||||
AddIconByType /h5ai/icons/16x16/text.png text/*
|
|
||||||
AddIconByType /h5ai/icons/16x16/image.png image/*
|
|
||||||
AddIconByType /h5ai/icons/16x16/audio.png audio/*
|
|
||||||
AddIconByType /h5ai/icons/16x16/video.png video/*
|
|
||||||
|
|
||||||
AddIconByEncoding /h5ai/icons/16x16/zip.png x-compress x-gzip x-bzip2
|
|
||||||
|
|
||||||
DefaultIcon /h5ai/icons/16x16/unknown.png
|
|
||||||
|
|
||||||
</IfModule>
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,22 +8,12 @@
|
|||||||
# Options +FollowSymLinks
|
# Options +FollowSymLinks
|
||||||
|
|
||||||
|
|
||||||
################################
|
HeaderName /h5ai/header.php
|
||||||
# IMPORTANT FOR XAMPP
|
ReadmeName /h5ai/footer.php
|
||||||
# if you're running XAMPP you might need to replace the
|
|
||||||
# following line with
|
|
||||||
# <IfModule autoindex_color_module>
|
|
||||||
################################
|
|
||||||
<IfModule autoindex_module>
|
|
||||||
|
|
||||||
HeaderName /h5ai/header.php
|
IndexIgnore *
|
||||||
ReadmeName /h5ai/footer.php
|
|
||||||
|
|
||||||
IndexIgnore *
|
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
||||||
|
IndexOptions Charset=UTF-8
|
||||||
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
IndexOptions SuppressHTMLPreamble
|
||||||
IndexOptions Charset=UTF-8
|
|
||||||
IndexOptions SuppressHTMLPreamble
|
|
||||||
|
|
||||||
</IfModule>
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user