-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.inc.php
148 lines (138 loc) · 4.17 KB
/
functions.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
//Copyright (C) 2012 Antonio J. Delgado Linares
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with this program. If not, see <http://www.gnu.org/licenses/>.
include_once("config.inc.php");
function ShowHeader($HEADERS="") {
global $COLS,$FOLDER;
echo "<HTML>
<HEAD>
<TITLE>Fotos en '" . $FOLDER . "'</TITLE>
<link rel='stylesheet' type='text/css' href='style.css' />
<STYLE>
TD {
width:" . intval(100/$COLS) . "%;
</STYLE>
<SCRIPT type='text/javascript'>
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function f_clientHeight() {
return f_filterResults (
window.innerHeight ? window.innerHeight : 0,
document.documentElement ? document.documentElement.clientHeight : 0,
document.body ? document.body.clientHeight : 0
);
}
function f_clientWidth() {
return f_filterResults (
window.innerWidth ? window.innerWidth : 0,
document.documentElement ? document.documentElement.clientWidth : 0,
document.body ? document.body.clientWidth : 0
);
}
function f_scrollLeft() {
return f_filterResults (
window.pageXOffset ? window.pageXOffset : 0,
document.documentElement ? document.documentElement.scrollLeft : 0,
document.body ? document.body.scrollLeft : 0
);
}
function f_scrollTop() {
return f_filterResults (
window.pageYOffset ? window.pageYOffset : 0,
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
}
var w = screen.width;
var h = screen.height;
var dh = f_clientHeight();
var dw = f_clientWidth();
</SCRIPT>
<script type=\"text/javascript\">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11672883-1']);
_gaq.push(['_setDomainName', 'susurrando.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
".$HEADERS."
</HEAD>
<BODY>";
}
function ScanFilesRecursive($DIR) {
$TFILES=scandir($DIR);
foreach ($TFILES as $FILE) {
if ( ($FILE!=".") && ($FILE!="..") ) {
if (is_dir($DIR . "/" . $FILE)) {
$DIRS[]=$DIR . "/" . $FILE;
} else {
if (strpos($FILE,".thumb_")===False) {
$FILES[]=$DIR . "/" . $FILE;
}
}
}
}
while ( count($DIRS)>0 ) {
$CUR_DIR=array_pop($DIRS);
$TFILES=scandir($CUR_DIR);
foreach ($TFILES as $FILE) {
if (($FILE!=".") && ($FILE!="..")) {
if (is_dir($CUR_DIR . "/" . $FILE)) {
$DIRS[]=$CUR_DIR . "/" . $FILE;
} else {
if (strpos($FILE,".thumb_")===False) {
$FILES[]=$CUR_DIR . "/" . $FILE;
}
}
}
}
}
return $FILES;
}
function WhatFileType($FILE) {
$LASTLINE=exec("/usr/bin/file '" . $FILE . "'",$ARETURNED,$RESULT);
if ($RESULT != 0) {
return false;
}
foreach($ARETURNED as $RETURNED) {
$LASTLINE=$RETURNED;
}
$ALASTLINE=split(":",$LASTLINE);
return $ALASTLIE[1];
}
function IsWebImage($FILE) {
$LASTLINE=exec("/usr/bin/file '" . $FILE . "'",$ARETURNED,$RESULT);
if ($RESULT != 0) {
return false;
}
foreach ($ARETURNED as $RETURNED) {
if (strpos($RETURNED,"JPEG image data")>-1) {
return true;
} elseif (strpos($RETURNED,"PNG image")>-1) {
return true;
} elseif (strpos($RETURNED,"GIF image data")>-1) {
return true;
} elseif (strpos($RETURNED,"MPEG" )>-1) {
return true;
}
}
return false;
}
?>