mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-29 08:40:34 +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
|
||||
|
||||
|
||||
### 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*
|
||||
|
||||
* added PHP implementation! (should work with PHP 5.2+)
|
||||
|
@@ -3,7 +3,7 @@ custom = true
|
||||
|
||||
# project
|
||||
project.name = h5ai
|
||||
project.version = 0.13
|
||||
project.version = 0.14.1
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
###########################################
|
||||
# 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
|
||||
<IfModule headers_module>
|
||||
<FilesMatch "\.png$">
|
||||
@@ -12,5 +28,8 @@ AddType text/html .php
|
||||
<FilesMatch "\.js$">
|
||||
Header set Cache-Control "max-age=31449600, public"
|
||||
</FilesMatch>
|
||||
<FilesMatch "thumb-.*\.jpg$">
|
||||
Header set Cache-Control "max-age=31449600, public"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
|
@@ -116,6 +116,18 @@
|
||||
width: 80px;
|
||||
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 {
|
||||
@@ -170,8 +182,8 @@
|
||||
display: block;
|
||||
|
||||
img {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
min-width: 48px;
|
||||
min-height: 48px;
|
||||
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 {
|
||||
|
@@ -153,6 +153,17 @@ body > footer {
|
||||
padding: 0 8px;
|
||||
float: right
|
||||
}
|
||||
.status {
|
||||
&.default {
|
||||
}
|
||||
&.dynamic {
|
||||
display: none;
|
||||
span {
|
||||
display: inline-block;
|
||||
padding: 0 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
#langSelector {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
@@ -17,9 +17,13 @@
|
||||
</span>
|
||||
<span class="center">
|
||||
<span class="hideOnNoJs">
|
||||
<span class="folderCount"></span> <span class="l10n-folders">folders</span>
|
||||
·
|
||||
<span class="fileCount"></span> <span class="l10n-files">files</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>
|
||||
<span class="status dynamic">
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</footer>
|
||||
|
@@ -43,9 +43,13 @@
|
||||
</span>
|
||||
</span>
|
||||
<span class="center">
|
||||
<?php echo $extended->getFolderCount(); ?> <span class="l10n-folders">folders</span>
|
||||
·
|
||||
<?php echo $extended->getFileCount(); ?> <span class="l10n-files">files</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>
|
||||
</span>
|
||||
<span class="status dynamic">
|
||||
</span>
|
||||
</span>
|
||||
</footer>
|
||||
<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 = {
|
||||
defaultSortOrder: "C=N;O=A",
|
||||
customHeader: "h5ai.header.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 );
|
||||
|
||||
// header sort icons
|
||||
var order = document.location.search;
|
||||
if ( order === "" ) {
|
||||
order = this.config.defaultSortOrder;
|
||||
var sortquery = document.location.search;
|
||||
var order = {
|
||||
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;
|
||||
if ( order.indexOf( "O=A" ) >= 0 ) {
|
||||
if ( order.ascending ) {
|
||||
$icon = $( "<img src='/h5ai/images/ascending.png' class='sort' alt='ascending' />" );
|
||||
} else {
|
||||
$icon = $( "<img src='/h5ai/images/descending.png' class='sort' alt='descending' />" );
|
||||
};
|
||||
if ( order.indexOf( "C=N" ) >= 0 ) {
|
||||
$li.find( "a.label" ).append( $icon );
|
||||
} else if ( order.indexOf( "C=M" ) >= 0 ) {
|
||||
if ( order.column === "date" ) {
|
||||
$li.find( "a.date" ).prepend( $icon );
|
||||
} else if ( order.indexOf( "C=S" ) >= 0 ) {
|
||||
} else if ( order.column === "size" ) {
|
||||
$li.find( "a.size" ).prepend( $icon );
|
||||
} else {
|
||||
$li.find( "a.label" ).append( $icon );
|
||||
};
|
||||
|
||||
$.timer.log( "start entries" );
|
||||
// entries
|
||||
$( "#table td" ).closest( "tr" ).each( function () {
|
||||
var path = pathCache.getPathForTableRow( document.location.pathname, this );
|
||||
$ul.append( path.updateExtendedHtml() );
|
||||
} );
|
||||
$.timer.log( "end entries" );
|
||||
|
||||
$( "#extended" ).append( $ul );
|
||||
$.log( document.location.pathname, "folders:", $( "#extended .folder" ).size() , "files:", $( "#extended .file" ).size() );
|
||||
|
@@ -16,7 +16,12 @@ var H5ai = function ( options, langs ) {
|
||||
},
|
||||
|
||||
viewmodes: [ "details", "icons" ],
|
||||
sortorder: {
|
||||
column: "name",
|
||||
ascending: true
|
||||
},
|
||||
showTree: true,
|
||||
slideTree: true,
|
||||
folderStatus: {
|
||||
},
|
||||
lang: null,
|
||||
@@ -165,6 +170,33 @@ var H5ai = function ( options, langs ) {
|
||||
.click( $.proxy( function () {
|
||||
this.applyViewmode( "icons" );
|
||||
}, 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
|
||||
*******************************/
|
||||
|
||||
this.initTree = function () {
|
||||
this.shiftTree = function ( forceVisible, dontAnimate ) {
|
||||
|
||||
var $tree = $( "#tree" );
|
||||
var $extended = $( "#extended" );
|
||||
var shiftTree = function ( forceVisible, dontAnimate ) {
|
||||
if ( $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
|
||||
if ( dontAnimate === true ) {
|
||||
$tree.stop().css( { left: 0 } );
|
||||
} else {
|
||||
$tree.stop().animate( { left: 0 } );
|
||||
};
|
||||
|
||||
if ( this.config.slideTree && $tree.outerWidth() < $extended.offset().left || forceVisible === true ) {
|
||||
if ( dontAnimate === true ) {
|
||||
$tree.stop().css( { left: 0 } );
|
||||
} else {
|
||||
if ( dontAnimate === true ) {
|
||||
$tree.stop().css( { left: 18 - $tree.outerWidth() } );
|
||||
} else {
|
||||
$tree.stop().animate( { left: 18 - $tree.outerWidth() } );
|
||||
};
|
||||
$tree.stop().animate( { left: 0 } );
|
||||
};
|
||||
} else {
|
||||
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 ) {
|
||||
event.preventDefault();
|
||||
var clickFrac = ( event.pageY - $scrollbar.offset().top - mouseOffsetY ) / $scrollbar.height();
|
||||
$wrapper.scrollTop( $content.outerHeight() * clickFrac );
|
||||
update();
|
||||
@@ -74,7 +75,8 @@
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
right: 0,
|
||||
overflow: "hidden"
|
||||
overflow: "hidden",
|
||||
cursor: "pointer"
|
||||
} )
|
||||
.mousedown( function ( event ) {
|
||||
mouseOffsetY = $drag.outerHeight() / 2;
|
||||
@@ -88,10 +90,8 @@
|
||||
scroll( event );
|
||||
event.stopPropagation();
|
||||
} );
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
} )
|
||||
.attr( "unselectable", "on" )
|
||||
.css( "-moz-user-select", "none" )
|
||||
.each( function () {
|
||||
this.onselectstart = function () {
|
||||
return false;
|
||||
|
@@ -40,6 +40,7 @@ var Tree = function ( pathCache, h5ai ) {
|
||||
.append( path.updateTreeHtml() )
|
||||
.scrollpanel()
|
||||
.show();
|
||||
h5ai.shiftTree( false, true );
|
||||
h5ai.linkHoverStates();
|
||||
pathCache.storeCache();
|
||||
setTimeout( function () {
|
||||
|
@@ -14,11 +14,9 @@
|
||||
* create
|
||||
*******************************/
|
||||
|
||||
$.timer.log( "start pathcache" );
|
||||
var pathCache = new PathCache();
|
||||
$.timer.log( "end pathcache" );
|
||||
var extended = new Extended( pathCache );
|
||||
var h5ai = new H5ai( h5aiOptions, h5aiLangs );
|
||||
var extended = new Extended( pathCache, h5ai );
|
||||
var tree = new Tree( pathCache, h5ai );
|
||||
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
h5ai.init();
|
||||
$( "#tree" ).scrollpanel();
|
||||
h5ai.shiftTree( false, true );
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
@@ -1,83 +1,108 @@
|
||||
/*
|
||||
* h5ai %BUILD_VERSION%
|
||||
* Options and localization
|
||||
* Options and localization
|
||||
*/
|
||||
|
||||
h5aiOptions = {
|
||||
|
||||
/*
|
||||
* An array of view modes the user may choose from. Currently there
|
||||
* are two possible values: "details" and "icons". The first value
|
||||
* indicates the default view mode. If only one value is given the
|
||||
* view mode is fixed and the selector buttons are hidden.
|
||||
* The user selected view mode is also stored local in modern browsers
|
||||
* so that it will be persistent.
|
||||
*/
|
||||
"viewmodes": [ "details", "icons" ],
|
||||
/*
|
||||
* An array of view modes the user may choose from. Currently there
|
||||
* are two possible values: "details" and "icons". The first value
|
||||
* indicates the default view mode. If only one value is given the
|
||||
* view mode is fixed and the selector buttons are hidden.
|
||||
* The user selected view mode is also stored local in modern browsers
|
||||
* so that it will be persistent.
|
||||
*/
|
||||
"viewmodes": [ "details", "icons" ],
|
||||
|
||||
/*
|
||||
* Show a folder tree, boolean.
|
||||
* Note that this tree might have side effects as it sends HEAD requests
|
||||
* to the folders, and therefore will invoke index.php scripts. Use
|
||||
* folderStatus below to avoid such requests.
|
||||
* It might also affect performance significantly.
|
||||
*/
|
||||
"showTree": true,
|
||||
/*
|
||||
* Default sort order. Valid values for column are "name", "date" and
|
||||
* "size".
|
||||
* If you are using the JavaScript version please make sure to change
|
||||
* IndexOrderDefault in js.htaccess as well.
|
||||
*/
|
||||
"sortorder": {
|
||||
"column": "name",
|
||||
"ascending": true
|
||||
},
|
||||
|
||||
/*
|
||||
* Associative array of folders and their HTTP status codes to
|
||||
* avoid HEAD requests to that folders. The key (folder) must start
|
||||
* and end with a slash (/).
|
||||
* For example:
|
||||
* "/some/folder/": 200
|
||||
* will always return HTTP status 200 (OK), which will be interpreted
|
||||
* as a non auto indexed folder, that means a folder containing an
|
||||
* appropriate default index file.
|
||||
*/
|
||||
"folderStatus": {
|
||||
/*
|
||||
* for example:
|
||||
* "/some/folder/": 200
|
||||
*/
|
||||
},
|
||||
/*
|
||||
* Show a folder tree, boolean.
|
||||
* Note that this tree might have side effects as it sends HEAD requests
|
||||
* to the folders, and therefore will invoke index.php scripts. Use
|
||||
* folderStatus below to avoid such requests.
|
||||
* It might also affect performance significantly.
|
||||
*/
|
||||
"showTree": true,
|
||||
|
||||
/*
|
||||
* Localization, for example "en", "de" etc. - see h5aiLangs below for
|
||||
* possible values. Adjust it to your needs. If lang is not found in
|
||||
* h5aiLangs it defaults to "en".
|
||||
*/
|
||||
"lang": null,
|
||||
/*
|
||||
* Slide tree bar into viewport if there is enough space, boolean.
|
||||
*/
|
||||
"slideTree": true,
|
||||
|
||||
/*
|
||||
* Try to use browser language, falls back to previous specified lang.
|
||||
*/
|
||||
"useBrowserLang": true,
|
||||
|
||||
/*
|
||||
* Set parent folder labels to real folder names.
|
||||
*/
|
||||
"setParentFolderLabels": true,
|
||||
|
||||
/*
|
||||
* Link the hover effects between crumb, extended view and tree.
|
||||
*/
|
||||
"linkHoverStates": true,
|
||||
/*
|
||||
* Associative array of folders and their HTTP status codes to
|
||||
* avoid HEAD requests to that folders. The key (folder) must start
|
||||
* and end with a slash (/).
|
||||
* For example:
|
||||
* "/some/folder/": 200
|
||||
* will always return HTTP status 200 (OK), which will be interpreted
|
||||
* as a non auto indexed folder, that means a folder containing an
|
||||
* appropriate default index file.
|
||||
*/
|
||||
"folderStatus": {
|
||||
/*
|
||||
* for example:
|
||||
* "/some/folder/": 200
|
||||
*/
|
||||
},
|
||||
|
||||
/*
|
||||
* 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",
|
||||
/*
|
||||
* Localization, for example "en", "de" etc. - see h5aiLangs below for
|
||||
* possible values. Adjust it to your needs. If lang is not found in
|
||||
* h5aiLangs it defaults to "en".
|
||||
*/
|
||||
"lang": null,
|
||||
|
||||
/*
|
||||
* 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": [ "/^\\./" ]
|
||||
/*
|
||||
* Try to use browser language, falls back to previous specified lang.
|
||||
*/
|
||||
"useBrowserLang": true,
|
||||
|
||||
/*
|
||||
* Set parent folder labels to real folder names.
|
||||
*/
|
||||
"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 = {
|
||||
|
||||
"en": {
|
||||
"lang": "english",
|
||||
"details": "details",
|
||||
"icons": "icons",
|
||||
"name": "Name",
|
||||
"lastModified": "Last modified",
|
||||
"size": "Size",
|
||||
"parentDirectory": "Parent Directory",
|
||||
"empty": "empty",
|
||||
"folders": "folders",
|
||||
"files": "files"
|
||||
},
|
||||
"en": {
|
||||
"lang": "english",
|
||||
"details": "details",
|
||||
"icons": "icons",
|
||||
"name": "Name",
|
||||
"lastModified": "Last modified",
|
||||
"size": "Size",
|
||||
"parentDirectory": "Parent Directory",
|
||||
"empty": "empty",
|
||||
"folders": "folders",
|
||||
"files": "files"
|
||||
},
|
||||
|
||||
"de": {
|
||||
"lang": "deutsch",
|
||||
"details": "Details",
|
||||
"icons": "Icons",
|
||||
"name": "Name",
|
||||
"lastModified": "Geändert",
|
||||
"size": "Größe",
|
||||
"parentDirectory": "Übergeordnetes Verzeichnis",
|
||||
"empty": "leer",
|
||||
"folders": "Ordner",
|
||||
"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?]"
|
||||
},
|
||||
"de": {
|
||||
"lang": "deutsch",
|
||||
"details": "Details",
|
||||
"icons": "Icons",
|
||||
"name": "Name",
|
||||
"lastModified": "Geändert",
|
||||
"size": "Größe",
|
||||
"parentDirectory": "Übergeordnetes Verzeichnis",
|
||||
"empty": "leer",
|
||||
"folders": "Ordner",
|
||||
"files": "Dateien"
|
||||
},
|
||||
|
||||
"nl": {
|
||||
"lang": "nederlands",
|
||||
"details": "details",
|
||||
"icons": "iconen",
|
||||
"name": "Naam",
|
||||
"lastModified": "Laatste wijziging",
|
||||
"size": "Grootte",
|
||||
"parentDirectory": "Bovenliggende map",
|
||||
"empty": "lege",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"fr": {
|
||||
"lang": "français",
|
||||
"details": "détails",
|
||||
"icons": "icônes",
|
||||
"name": "Nom",
|
||||
"lastModified": "Dernière modification",
|
||||
"size": "Taille",
|
||||
"parentDirectory": "Dossier parent",
|
||||
"empty": "vide",
|
||||
"folders": "Répertoires",
|
||||
"files": "Fichiers"
|
||||
},
|
||||
|
||||
"sv": {
|
||||
"lang": "svenska",
|
||||
"details": "detaljerad",
|
||||
"icons": "ikoner",
|
||||
"name": "Filnamn",
|
||||
"lastModified": "Senast ändrad",
|
||||
"size": "Filstorlek",
|
||||
"parentDirectory": "Till överordnad mapp",
|
||||
"empty": "tom",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"nl": {
|
||||
"lang": "nederlands",
|
||||
"details": "details",
|
||||
"icons": "iconen",
|
||||
"name": "Naam",
|
||||
"lastModified": "Laatste wijziging",
|
||||
"size": "Grootte",
|
||||
"parentDirectory": "Bovenliggende map",
|
||||
"empty": "lege",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
|
||||
"cs": {
|
||||
"lang": "[?lang?]",
|
||||
"details": "podrobnosti",
|
||||
"icons": "ikony",
|
||||
"name": "Název",
|
||||
"lastModified": "Upraveno",
|
||||
"size": "Velikost",
|
||||
"parentDirectory": "Nadřazený adresář",
|
||||
"empty": "prázdný",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"sv": {
|
||||
"lang": "svenska",
|
||||
"details": "detaljerad",
|
||||
"icons": "ikoner",
|
||||
"name": "Filnamn",
|
||||
"lastModified": "Senast ändrad",
|
||||
"size": "Filstorlek",
|
||||
"parentDirectory": "Till överordnad mapp",
|
||||
"empty": "tom",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
|
||||
"sk": {
|
||||
"lang": "[?lang?]",
|
||||
"details": "podrobnosti",
|
||||
"icons": "ikony",
|
||||
"name": "Názov",
|
||||
"lastModified": "Upravené",
|
||||
"size": "Velkosť",
|
||||
"parentDirectory": "Nadriadený priečinok",
|
||||
"empty": "prázdny",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"cs": {
|
||||
"lang": "čeština",
|
||||
"details": "podrobnosti",
|
||||
"icons": "ikony",
|
||||
"name": "Název",
|
||||
"lastModified": "Upraveno",
|
||||
"size": "Velikost",
|
||||
"parentDirectory": "Nadřazený adresář",
|
||||
"empty": "prázdný",
|
||||
"folders": "složek",
|
||||
"files": "souborů"
|
||||
},
|
||||
|
||||
"es": {
|
||||
"lang": "español",
|
||||
"details": "Detalles",
|
||||
"icons": "Íconos",
|
||||
"name": "Nombre",
|
||||
"lastModified": "Última modificación",
|
||||
"size": "Tamaño",
|
||||
"parentDirectory": "Directorio superior",
|
||||
"empty": "vacío",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"sk": {
|
||||
"lang": "slovenčina",
|
||||
"details": "podrobnosti",
|
||||
"icons": "ikony",
|
||||
"name": "Názov",
|
||||
"lastModified": "Upravené",
|
||||
"size": "Velkosť",
|
||||
"parentDirectory": "Nadriadený priečinok",
|
||||
"empty": "prázdny",
|
||||
"folders": "priečinkov",
|
||||
"files": "súborov"
|
||||
},
|
||||
|
||||
"tr": {
|
||||
"lang": "türkçe",
|
||||
"details": "detaylar",
|
||||
"icons": "ikonlar",
|
||||
"name": "İsim",
|
||||
"lastModified": "Son Düzenleme",
|
||||
"size": "Boyut",
|
||||
"parentDirectory": "Üst Dizin",
|
||||
"empty": "boş",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"es": {
|
||||
"lang": "español",
|
||||
"details": "Detalles",
|
||||
"icons": "Íconos",
|
||||
"name": "Nombre",
|
||||
"lastModified": "Última modificación",
|
||||
"size": "Tamaño",
|
||||
"parentDirectory": "Directorio superior",
|
||||
"empty": "vacío",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
|
||||
"pt": {
|
||||
"lang": "português",
|
||||
"details": "detalhes",
|
||||
"icons": "ícones",
|
||||
"name": "Nome",
|
||||
"lastModified": "Última modificação",
|
||||
"size": "Tamanho",
|
||||
"parentDirectory": "Diretório superior",
|
||||
"empty": "vazio",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
"tr": {
|
||||
"lang": "türkçe",
|
||||
"details": "detaylar",
|
||||
"icons": "ikonlar",
|
||||
"name": "İsim",
|
||||
"lastModified": "Son Düzenleme",
|
||||
"size": "Boyut",
|
||||
"parentDirectory": "Üst Dizin",
|
||||
"empty": "boş",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
},
|
||||
|
||||
"bg": {
|
||||
"lang": "[?lang?]",
|
||||
"details": "детайли",
|
||||
"icons": "икони",
|
||||
"name": "Име",
|
||||
"lastModified": "Последна промяна",
|
||||
"size": "Размер",
|
||||
"parentDirectory": "Предходна директория",
|
||||
"empty": "празно",
|
||||
"folders": "[?folders?]",
|
||||
"files": "[?files?]"
|
||||
}
|
||||
"pt": {
|
||||
"lang": "português",
|
||||
"details": "detalhes",
|
||||
"icons": "ícones",
|
||||
"name": "Nome",
|
||||
"lastModified": "Última modificação",
|
||||
"size": "Tamanho",
|
||||
"parentDirectory": "Diretório superior",
|
||||
"empty": "vazio",
|
||||
"folders": "pastas",
|
||||
"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
|
||||
|
||||
require_once "thumbnail.php";
|
||||
|
||||
|
||||
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 ) {
|
||||
|
||||
@@ -20,6 +23,8 @@ class Entry {
|
||||
$this->type = $type !== null ? $type : $this->h5ai->getType( $this->absPath );
|
||||
$this->size = filesize( $this->absPath );
|
||||
}
|
||||
|
||||
$this->thumbTypes = array( "bmp", "gif", "ico", "image", "jpg", "png", "tiff" );
|
||||
}
|
||||
|
||||
public function isFolder() {
|
||||
@@ -54,6 +59,8 @@ class Entry {
|
||||
|
||||
$classes = "entry " . $this->type;
|
||||
$img = $this->type;
|
||||
$smallImg = "/h5ai/icons/16x16/" . $this->type . ".png";
|
||||
$bigImg = "/h5ai/icons/48x48/" . $this->type . ".png";
|
||||
$hint = "";
|
||||
$dateLabel = date( $dateFormat, $this->date );
|
||||
|
||||
@@ -63,17 +70,28 @@ class Entry {
|
||||
if ( $code !== "h5ai" ) {
|
||||
if ( $code === 200 ) {
|
||||
$img = "folder-page";
|
||||
$smallImg = "/h5ai/icons/16x16/folder-page.png";
|
||||
$bigImg = "/h5ai/icons/48x48/folder-page.png";
|
||||
} else {
|
||||
$classes .= " error";
|
||||
$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\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 big'><img src='/h5ai/icons/48x48/" . $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='" . $bigImg . "' alt='" . $img . "' /></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='size'>" . $this->formatSize( $this->size ) . "</span>\n";
|
||||
|
@@ -22,9 +22,11 @@ class H5ai {
|
||||
|
||||
$this->ignore = $this->options["options"]["ignore"];
|
||||
$this->ignoreRE = $this->options["options"]["ignoreRE"];
|
||||
|
||||
$defaultSortOrder = $this->options["options"]["sortorder"];
|
||||
$this->sortOrder = array(
|
||||
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : H5ai::$SORT_ORDER["column"],
|
||||
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : H5ai::$SORT_ORDER["ascending"]
|
||||
"column" => array_key_exists( "col", $_REQUEST ) ? $_REQUEST["col"] : $defaultSortOrder["column"],
|
||||
"ascending" => array_key_exists( "asc", $_REQUEST ) ? $_REQUEST["asc"] !== "false" : $defaultSortOrder["ascending"]
|
||||
);
|
||||
$this->dateFormat = $this->options["options"]["dateFormat"];
|
||||
$this->view = array_key_exists( "view", $_REQUEST ) ? $_REQUEST["view"] : $this->options["options"]["viewmodes"][0];
|
||||
@@ -81,7 +83,7 @@ class H5ai {
|
||||
|
||||
public function getOptions() {
|
||||
|
||||
return $this->options["options"] ;
|
||||
return $this->options["options"];
|
||||
}
|
||||
|
||||
public function getLangs() {
|
||||
@@ -115,6 +117,11 @@ class H5ai {
|
||||
return $this->dateFormat;
|
||||
}
|
||||
|
||||
public function showThumbs() {
|
||||
|
||||
return $this->options["options"]["showThumbs"] === true;
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
|
||||
$title = $this->domain . rawurldecode( $this->absHref );
|
||||
@@ -185,12 +192,12 @@ class H5ai {
|
||||
|
||||
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 ) {
|
||||
|
||||
return substr( $sequence, -strlen( $end ) ) === $end;
|
||||
return strcasecmp( substr( $sequence, -strlen( $end ) ), $end ) === 0;
|
||||
}
|
||||
|
||||
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
|
||||
# if you're running XAMPP you might need to replace the
|
||||
# following line with
|
||||
# <IfModule autoindex_color_module>
|
||||
# h5ai header and footer
|
||||
################################
|
||||
<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
|
||||
ReadmeName /h5ai/footer.html
|
||||
IndexIgnore h5ai h5ai.header.html 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%
|
||||
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=*
|
||||
|
||||
|
||||
################################
|
||||
# icon mapping
|
||||
################################
|
||||
|
||||
AddIcon /h5ai/icons/16x16/folder-parent.png ..
|
||||
AddIcon /h5ai/icons/16x16/folder.png ^^DIRECTORY^^
|
||||
AddIcon /h5ai/icons/16x16/blank.png ^^BLANKICON^^
|
||||
|
||||
AddIcon /h5ai/icons/16x16/readme.png README
|
||||
AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
|
||||
AddIcon /h5ai/icons/16x16/install.png INSTALL
|
||||
AddIcon /h5ai/icons/16x16/authors.png AUTHORS
|
||||
AddIcon /h5ai/icons/16x16/log.png LOG Log log
|
||||
|
||||
AddIcon /h5ai/icons/16x16/css.png .less
|
||||
AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
|
||||
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
|
||||
AddIcon /h5ai/icons/16x16/bin.png .so .o
|
||||
|
||||
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
|
||||
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
|
||||
AddIcon /h5ai/icons/16x16/rpm.png .rpm
|
||||
AddIcon /h5ai/icons/16x16/cd.png .iso .cue
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/png.png image/png
|
||||
AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg
|
||||
AddIconByType /h5ai/icons/16x16/gif.png image/gif
|
||||
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon
|
||||
AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/html.png text/html
|
||||
AddIconByType /h5ai/icons/16x16/css.png text/css
|
||||
AddIconByType /h5ai/icons/16x16/xml.png application/xml
|
||||
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json
|
||||
AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/py.png text/x-python
|
||||
AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby
|
||||
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>
|
||||
AddIcon /h5ai/icons/16x16/readme.png README
|
||||
AddIcon /h5ai/icons/16x16/copying.png COPYING LICENSE
|
||||
AddIcon /h5ai/icons/16x16/install.png INSTALL
|
||||
AddIcon /h5ai/icons/16x16/authors.png AUTHORS
|
||||
AddIcon /h5ai/icons/16x16/log.png LOG Log log
|
||||
|
||||
AddIcon /h5ai/icons/16x16/css.png .less
|
||||
AddIcon /h5ai/icons/16x16/script.png .conf .ini .sh .shar .csh .ksh .tcl
|
||||
AddIcon /h5ai/icons/16x16/makefile.png .pom pom.xml build.xml
|
||||
AddIcon /h5ai/icons/16x16/bin.png .so .o
|
||||
|
||||
AddIcon /h5ai/icons/16x16/archive.png .tar.gz .tgz .tar.bz2
|
||||
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
|
||||
AddIcon /h5ai/icons/16x16/rpm.png .rpm
|
||||
AddIcon /h5ai/icons/16x16/cd.png .iso .cue
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/png.png image/png
|
||||
AddIconByType /h5ai/icons/16x16/jpg.png image/jpeg
|
||||
AddIconByType /h5ai/icons/16x16/gif.png image/gif
|
||||
AddIconByType /h5ai/icons/16x16/ico.png image/x-icon
|
||||
AddIconByType /h5ai/icons/16x16/bmp.png image/x-ms-bmp
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/html.png text/html
|
||||
AddIconByType /h5ai/icons/16x16/css.png text/css
|
||||
AddIconByType /h5ai/icons/16x16/xml.png application/xml
|
||||
AddIconByType /h5ai/icons/16x16/js.png application/javascript application/json
|
||||
AddIconByType /h5ai/icons/16x16/php.png application/x-httpd-php
|
||||
|
||||
AddIconByType /h5ai/icons/16x16/py.png text/x-python
|
||||
AddIconByType /h5ai/icons/16x16/rb.png application/x-ruby
|
||||
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
|
||||
|
||||
|
||||
|
@@ -8,22 +8,12 @@
|
||||
# Options +FollowSymLinks
|
||||
|
||||
|
||||
################################
|
||||
# IMPORTANT FOR XAMPP
|
||||
# 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
|
||||
ReadmeName /h5ai/footer.php
|
||||
|
||||
HeaderName /h5ai/header.php
|
||||
ReadmeName /h5ai/footer.php
|
||||
IndexIgnore *
|
||||
|
||||
IndexIgnore *
|
||||
|
||||
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
||||
IndexOptions Charset=UTF-8
|
||||
IndexOptions SuppressHTMLPreamble
|
||||
|
||||
</IfModule>
|
||||
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
|
||||
IndexOptions Charset=UTF-8
|
||||
IndexOptions SuppressHTMLPreamble
|
||||
|
||||
|
Reference in New Issue
Block a user