No regular expressions were active.
1 |
|
<?php
|
|
1 |
|
<?php
|
2 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
|
2 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
3 |
|
*
O
rca Intera
ctive Foru
m Script
|
|
3 |
|
*
O
rca Intera
ctive Foru
m Script
|
4 |
|
*
----------
-----
|
|
4 |
|
*
----------
-----
--
|
5 |
|
*
Start
e
d
:
Fr
Nov
10
2006
|
|
5 |
|
*
b
e
gin
:
Fr
Nov
10
2006
|
6 |
|
*
C
opyright
:
(C)
200
7
BoonEx
Group
|
|
6 |
|
*
c
opyright
:
(C)
200
6
BoonEx
Group
|
7 |
|
*
W
ebsite
:
http://www
.boonex.co
m
|
|
7 |
|
*
w
ebsite
:
http://www
.boonex.co
m
/
|
8 |
|
* This fil
e is part
of Orca -
Interactiv
e Forum Sc
ript
|
|
8 |
|
* This fil
e is part
of Orca -
Interactiv
e Forum Sc
ript
|
9 |
|
*
|
|
9 |
|
*
|
10 |
|
*
Orca
is
free
software
;
y
o
u
c
a
n
r
ed
i
s
tribut
e
i
t
and/
o
r
modify
i
t
u
n
d
e
r
|
|
10 |
|
*
Orca
is
free
software
.
This
w
o
rk
is
li
c
e
n
s
ed
under
a
Creat
i
ve
Common
s
At
tribut
i
o
n
3.0
L
i
ce
n
s
e
.
|
11 |
|
* the term
s of the G
NU General
Public Li
cense as p
ublished b
y the
|
|
11 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
12 |
|
* Free Sof
tware Foun
dation; ei
ther versi
on 2 of th
e
|
|
|
13 |
|
* License,
or any la
ter versio
n.
|
|
|
14 |
|
*
|
|
12 |
|
*
|
15 |
|
* Orca is
distribute
d in the h
ope that i
t will be
useful, bu
t WITHOUT
ANY WARRAN
TY;
|
|
13 |
|
* Orca is
distribute
d in the h
ope that i
t will be
useful, bu
t WITHOUT
ANY WARRAN
TY;
|
16 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
|
14 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
17 |
|
*
See
the
GNU
G
e
n
e
r
al
Pu
b
l
i
c
License
for
more
details.
|
|
15 |
|
*
See
the
Cr
e
ativ
e
Commons
Att
r
i
b
ut
i
on
3.0
License
for
more
details.
|
18 |
|
*
You
should
have
received
a
copy
of
the
GNU
G
e
n
e
r
al
Pu
b
l
i
c
License
along
with
Orca,
|
|
16 |
|
*
You
should
have
received
a
copy
of
the
Cr
e
ativ
e
Commons
Att
r
i
b
ut
i
on
3.0
License
along
with
Orca,
|
19 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
|
17 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
20 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
18 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
21 |
|
|
|
19 |
|
|
22 |
|
|
|
20 |
|
|
23 |
|
class BxJs
GzipLoader
|
|
21 |
|
class BxJs
GzipLoader
|
24 |
|
{
|
|
22 |
|
{
|
25 |
|
/**
|
|
23 |
|
/**
|
26 |
|
* @pa
ram $sType
ty
pe (d - di
rectory (t
o read js
files from
), ja - js
array, )
|
|
24 |
|
* @pa
ram $sType
ty
pe (d - di
rectory (t
o read js
files from
), ja - js
array, )
|
27 |
|
* @pa
ram $p
de
pents on t
|
|
25 |
|
* @pa
ram $p
de
pents on t
|
28 |
|
* @pa
ram $sJsUr
l js
base url
|
|
26 |
|
* @pa
ram $sJsUr
l js
base url
|
29 |
|
* @pa
ram $sCach
eDir ca
che dir
|
|
27 |
|
* @pa
ram $sCach
eDir ca
che dir
|
30 |
|
*/
|
|
28 |
|
*/
|
31 |
|
functi
on BxJsGzi
pLoader ($
sType, $p,
$sJsDir =
'', $sCac
heDir = ''
)
|
|
29 |
|
functi
on BxJsGzi
pLoader ($
sType, $p,
$sJsDir =
'', $sCac
heDir = ''
)
|
32 |
|
{
|
|
30 |
|
{
|
33 |
|
$t
his->_sTyp
e = $sType
;
|
|
31 |
|
$t
his->_sTyp
e = $sType
;
|
34 |
|
$t
his->_p =
$p;
|
|
32 |
|
$t
his->_p =
$p;
|
35 |
|
$t
his->_a =
array ();
// array o
f js files
|
|
33 |
|
$t
his->_a =
array ();
// array o
f js files
|
36 |
|
$t
his->_sJsD
ir = $sJsD
ir;
|
|
34 |
|
$t
his->_sJsD
ir = $sJsD
ir;
|
37 |
|
|
|
35 |
|
|
38 |
|
$t
his->_sCac
heDir = $s
CacheDir;
|
|
36 |
|
$t
his->_sCac
heDir = $s
CacheDir;
|
39 |
|
$t
his->_bCac
he = $sCac
heDir ? tr
ue : false
;
|
|
37 |
|
$t
his->_bCac
he = $sCac
heDir ? tr
ue : false
;
|
40 |
|
$t
his->_sCac
heFilename
= '';
|
|
38 |
|
$t
his->_sCac
heFilename
= '';
|
41 |
|
|
|
39 |
|
|
42 |
|
$t
his->_bGzi
p = false;
// gzip s
upported
|
|
40 |
|
$t
his->_bGzi
p = false;
// gzip s
upported
|
43 |
|
$t
his->_sEnc
= ''; //
encoding
|
|
41 |
|
$t
his->_sEnc
= ''; //
encoding
|
44 |
|
|
|
42 |
|
|
45 |
|
$t
his->_c =
''; // con
tent;
|
|
43 |
|
$t
his->_c =
''; // con
tent;
|
46 |
|
$t
his->_zc =
''; // gz
ip content
;
|
|
44 |
|
$t
his->_zc =
''; // gz
ip content
;
|
47 |
|
|
|
45 |
|
|
48 |
|
$t
his->sendh
eaders ();
|
|
46 |
|
$t
his->sendh
eaders ();
|
49 |
|
$t
his->build
JsList ();
|
|
47 |
|
$t
his->build
JsList ();
|
50 |
|
$t
his->check
Encoding (
);
|
|
48 |
|
$t
his->check
Encoding (
);
|
51 |
|
if
($this->c
acheRead()
) exit;
|
|
49 |
|
if
($this->c
acheRead()
) exit;
|
52 |
|
$t
his->readC
ontent ();
|
|
50 |
|
$t
his->readC
ontent ();
|
53 |
|
$t
his->outpu
tContent (
);
|
|
51 |
|
$t
his->outpu
tContent (
);
|
54 |
|
}
|
|
52 |
|
}
|
55 |
|
|
|
53 |
|
|
56 |
|
functi
on buildJs
List ()
|
|
54 |
|
functi
on buildJs
List ()
|
57 |
|
{
|
|
55 |
|
{
|
58 |
|
if
( 'ja' ==
$this->_s
Type)
|
|
56 |
|
if
( 'ja' ==
$this->_s
Type)
|
59 |
|
{
|
|
57 |
|
{
|
60 |
|
foreach
($this->_p
as $sJsFi
le)
|
|
58 |
|
foreach
($this->_p
as $sJsFi
le)
|
61 |
|
{
|
|
59 |
|
{
|
62 |
|
$thi
s->_a[] =
$this->_sJ
sDir . $sJ
sFile;
|
|
60 |
|
$thi
s->_a[] =
$this->_sJ
sDir . $sJ
sFile;
|
63 |
|
$thi
s->_sCache
Filename .
= $sJsFile
;
|
|
61 |
|
$thi
s->_sCache
Filename .
= $sJsFile
;
|
64 |
|
}
|
|
62 |
|
}
|
65 |
|
$this->_
sCacheFile
name = md5
($this->_
sCacheFile
name);
|
|
63 |
|
$this->_
sCacheFile
name = md5
($this->_
sCacheFile
name);
|
66 |
|
return;
|
|
64 |
|
return;
|
67 |
|
}
|
|
65 |
|
}
|
68 |
|
|
|
66 |
|
|
69 |
|
if
('d' == $
this->_sTy
pe && is_d
ir ($this-
>_p))
|
|
67 |
|
if
('d' == $
this->_sTy
pe && is_d
ir ($this-
>_p))
|
70 |
|
{
|
|
68 |
|
{
|
71 |
|
|
|
69 |
|
|
72 |
|
if (!($d
h = opendi
r($this->_
p))) retur
n;
|
|
70 |
|
if (!($d
h = opendi
r($this->_
p))) retur
n;
|
73 |
|
|
|
71 |
|
|
74 |
|
|
|
72 |
|
|
75 |
|
|
|
73 |
|
|
76 |
|
while ((
$sJsFile =
readdir($
dh)) !== f
alse)
|
|
74 |
|
while ((
$sJsFile =
readdir($
dh)) !== f
alse)
|
77 |
|
{
|
|
75 |
|
{
|
78 |
|
if (
strtolower
(substr($s
JsFile, -3
)) != '.js
') continu
e;
|
|
76 |
|
if (
strtolower
(substr($s
JsFile, -3
)) != '.js
') continu
e;
|
79 |
|
$thi
s->_a[] =
$this->_p
. $sJsFile
;
|
|
77 |
|
$thi
s->_a[] =
$this->_p
. $sJsFile
;
|
80 |
|
$thi
s->_sCache
Filename .
= $sJsFile
;
|
|
78 |
|
$thi
s->_sCache
Filename .
= $sJsFile
;
|
81 |
|
}
|
|
79 |
|
}
|
82 |
|
|
|
80 |
|
|
83 |
|
$this->_
sCacheFile
name = md5
($this->_
sCacheFile
name);
|
|
81 |
|
$this->_
sCacheFile
name = md5
($this->_
sCacheFile
name);
|
84 |
|
|
|
82 |
|
|
85 |
|
closedir
($dh);
|
|
83 |
|
closedir
($dh);
|
86 |
|
|
|
84 |
|
|
87 |
|
//print_
r ($this->
_a); exit;
|
|
85 |
|
//print_
r ($this->
_a); exit;
|
88 |
|
}
|
|
86 |
|
}
|
89 |
|
el
se
|
|
87 |
|
el
se
|
90 |
|
{
|
|
88 |
|
{
|
91 |
|
die ("al
ert ('Wron
g js direc
tory')");
|
|
89 |
|
die ("al
ert ('Wron
g js direc
tory')");
|
92 |
|
}
|
|
90 |
|
}
|
93 |
|
}
|
|
91 |
|
}
|
94 |
|
|
|
92 |
|
|
95 |
|
/**
|
|
93 |
|
/**
|
96 |
|
* ch
eck if cli
ent browse
r supports
gzip
|
|
94 |
|
* ch
eck if cli
ent browse
r supports
gzip
|
97 |
|
*/
|
|
95 |
|
*/
|
98 |
|
functi
on checkEn
coding ()
|
|
96 |
|
functi
on checkEn
coding ()
|
99 |
|
{
|
|
97 |
|
{
|
100 |
|
$e
ncodings =
array ();
|
|
98 |
|
$e
ncodings =
array ();
|
101 |
|
if
(isset($_
SERVER['HT
TP_ACCEPT_
ENCODING']
))
|
|
99 |
|
if
(isset($_
SERVER['HT
TP_ACCEPT_
ENCODING']
))
|
102 |
|
$encodin
gs = explo
de(',', st
rtolower(p
reg_replac
e("/\s+/",
"", $_SER
VER['HTTP_
ACCEPT_ENC
ODING'])))
;
|
|
100 |
|
$encodin
gs = explo
de(',', st
rtolower(p
reg_replac
e("/\s+/",
"", $_SER
VER['HTTP_
ACCEPT_ENC
ODING'])))
;
|
103 |
|
|
|
101 |
|
|
104 |
|
if
((in_arra
y('gzip',
$encodings
) || in_ar
ray('x-gzi
p', $encod
ings) || i
sset($_SER
VER['-----
----------
'])) && fu
nction_exi
sts('ob_gz
handler')
&& !ini_ge
t('zlib.ou
tput_compr
ession') &
& ini_get(
'output_ha
ndler') !=
'ob_gzhan
dler')
|
|
102 |
|
if
((in_arra
y('gzip',
$encodings
) || in_ar
ray('x-gzi
p', $encod
ings) || i
sset($_SER
VER['-----
----------
'])) && fu
nction_exi
sts('ob_gz
handler')
&& !ini_ge
t('zlib.ou
tput_compr
ession') &
& ini_get(
'output_ha
ndler') !=
'ob_gzhan
dler')
|
105 |
|
{
|
|
103 |
|
{
|
106 |
|
$this->_
sEnc = in_
array('x-g
zip', $enc
odings) ?
"x-gzip" :
"gzip";
|
|
104 |
|
$this->_
sEnc = in_
array('x-g
zip', $enc
odings) ?
"x-gzip" :
"gzip";
|
107 |
|
$this->_
bGzip = tr
ue;
|
|
105 |
|
$this->_
bGzip = tr
ue;
|
108 |
|
}
|
|
106 |
|
}
|
109 |
|
}
|
|
107 |
|
}
|
110 |
|
|
|
108 |
|
|
111 |
|
functi
on readCon
tent ()
|
|
109 |
|
functi
on readCon
tent ()
|
112 |
|
{
|
|
110 |
|
{
|
113 |
|
fo
reach ($th
is->_a as
$sFile)
|
|
111 |
|
fo
reach ($th
is->_a as
$sFile)
|
114 |
|
$this->_
c .= $this
->getFile(
$sFile);
|
|
112 |
|
$this->_
c .= $this
->getFile(
$sFile);
|
115 |
|
}
|
|
113 |
|
}
|
116 |
|
|
|
114 |
|
|
117 |
|
functi
on outputC
ontent ()
|
|
115 |
|
functi
on outputC
ontent ()
|
118 |
|
{
|
|
116 |
|
{
|
119 |
|
if
(!$this->
_bGzip)
|
|
117 |
|
if
(!$this->
_bGzip)
|
120 |
|
{
|
|
118 |
|
{
|
121 |
|
echo $th
is->_c;
|
|
119 |
|
echo $th
is->_c;
|
122 |
|
return;
|
|
120 |
|
return;
|
123 |
|
}
|
|
121 |
|
}
|
124 |
|
|
|
122 |
|
|
125 |
|
|
|
123 |
|
|
126 |
|
he
ader("Cont
ent-Encodi
ng: " . $t
his->_sEnc
);
|
|
124 |
|
he
ader("Cont
ent-Encodi
ng: " . $t
his->_sEnc
);
|
127 |
|
$t
his->_cz =
gzencode
($this->_c
, 9, FORCE
_GZIP);
|
|
125 |
|
$t
his->_cz =
gzencode
($this->_c
, 9, FORCE
_GZIP);
|
128 |
|
|
|
126 |
|
|
129 |
|
$t
his->cache
Write();
|
|
127 |
|
$t
his->cache
Write();
|
130 |
|
|
|
128 |
|
|
131 |
|
|
|
129 |
|
|
132 |
|
//
Stream to
client
|
|
130 |
|
//
Stream to
client
|
133 |
|
ec
ho $this->
_cz;
|
|
131 |
|
ec
ho $this->
_cz;
|
134 |
|
}
|
|
132 |
|
}
|
135 |
|
|
|
133 |
|
|
136 |
|
functi
on getFile
($s)
|
|
134 |
|
functi
on getFile
($s)
|
137 |
|
{
|
|
135 |
|
{
|
138 |
|
$p
ath = real
path($s);
|
|
136 |
|
$p
ath = real
path($s);
|
139 |
|
|
|
137 |
|
|
140 |
|
if
(!$path |
| !@is_fil
e($s))
|
|
138 |
|
if
(!$path |
| !@is_fil
e($s))
|
141 |
|
return "
";
|
|
139 |
|
return "
";
|
142 |
|
|
|
140 |
|
|
143 |
|
if
(function
_exists("f
ile_get_co
ntents"))
|
|
141 |
|
if
(function
_exists("f
ile_get_co
ntents"))
|
144 |
|
return @
file_get_c
ontents($p
ath);
|
|
142 |
|
return @
file_get_c
ontents($p
ath);
|
145 |
|
|
|
143 |
|
|
146 |
|
$c
ontent = "
";
|
|
144 |
|
$c
ontent = "
";
|
147 |
|
$f
p = @fopen
($path, "r
");
|
|
145 |
|
$f
p = @fopen
($path, "r
");
|
148 |
|
if
(!$fp)
|
|
146 |
|
if
(!$fp)
|
149 |
|
return "
";
|
|
147 |
|
return "
";
|
150 |
|
|
|
148 |
|
|
151 |
|
wh
ile (!feof
($fp))
|
|
149 |
|
wh
ile (!feof
($fp))
|
152 |
|
$content
.= fgets(
$fp);
|
|
150 |
|
$content
.= fgets(
$fp);
|
153 |
|
|
|
151 |
|
|
154 |
|
fc
lose($fp);
|
|
152 |
|
fc
lose($fp);
|
155 |
|
|
|
153 |
|
|
156 |
|
re
turn $cont
ent;
|
|
154 |
|
re
turn $cont
ent;
|
157 |
|
}
|
|
155 |
|
}
|
158 |
|
|
|
156 |
|
|
159 |
|
functi
on putFile
($s, $c)
|
|
157 |
|
functi
on putFile
($s, $c)
|
160 |
|
{
|
|
158 |
|
{
|
161 |
|
if
(function
_exists("f
ile_put_co
ntents"))
|
|
159 |
|
if
(function
_exists("f
ile_put_co
ntents"))
|
162 |
|
return @
file_put_c
ontents($s
, $c);
|
|
160 |
|
return @
file_put_c
ontents($s
, $c);
|
163 |
|
|
|
161 |
|
|
164 |
|
$f
= @fopen(
$s, "wb");
|
|
162 |
|
$f
= @fopen(
$s, "wb");
|
165 |
|
if
($f)
|
|
163 |
|
if
($f)
|
166 |
|
{
|
|
164 |
|
{
|
167 |
|
fwrite($
f, $c);
|
|
165 |
|
fwrite($
f, $c);
|
168 |
|
fclose($
f);
|
|
166 |
|
fclose($
f);
|
169 |
|
}
|
|
167 |
|
}
|
170 |
|
}
|
|
168 |
|
}
|
171 |
|
|
|
169 |
|
|
172 |
|
functi
on sendhea
ders ()
|
|
170 |
|
functi
on sendhea
ders ()
|
173 |
|
{
|
|
171 |
|
{
|
174 |
|
he
ader("Cont
ent-type:
text/javas
cript");
|
|
172 |
|
he
ader("Cont
ent-type:
text/javas
cript");
|
175 |
|
he
ader("Vary
: Accept-E
ncoding");
// Handl
e proxies
|
|
173 |
|
he
ader("Vary
: Accept-E
ncoding");
// Handl
e proxies
|
176 |
|
he
ader("Expi
res: " . g
mdate("D,
d M Y H:i:
s", time()
+ $expire
sOffset) .
" GMT");
|
|
174 |
|
he
ader("Expi
res: " . g
mdate("D,
d M Y H:i:
s", time()
+ $expire
sOffset) .
" GMT");
|
177 |
|
}
|
|
175 |
|
}
|
178 |
|
|
|
176 |
|
|
179 |
|
functi
on cacheRe
ad()
|
|
177 |
|
functi
on cacheRe
ad()
|
180 |
|
{
|
|
178 |
|
{
|
181 |
|
if
(!$this->
_bGzip) re
turn false
;
|
|
179 |
|
if
(!$this->
_bGzip) re
turn false
;
|
182 |
|
|
|
180 |
|
|
183 |
|
if
(!$this->
_bCache) r
eturn fals
e;
|
|
181 |
|
if
(!$this->
_bCache) r
eturn fals
e;
|
184 |
|
|
|
182 |
|
|
185 |
|
$f
n = $this-
>_sCacheDi
r . $this-
>_sCacheFi
lename;
|
|
183 |
|
$f
n = $this-
>_sCacheDi
r . $this-
>_sCacheFi
lename;
|
186 |
|
|
|
184 |
|
|
187 |
|
if
(!file_ex
ists($fn))
return fa
lse;
|
|
185 |
|
if
(!file_ex
ists($fn))
return fa
lse;
|
188 |
|
|
|
186 |
|
|
189 |
|
he
ader("Cont
ent-Encodi
ng: " . $t
his->_sEnc
);
|
|
187 |
|
he
ader("Cont
ent-Encodi
ng: " . $t
his->_sEnc
);
|
190 |
|
|
|
188 |
|
|
191 |
|
ec
ho $this->
getFile($f
n);
|
|
189 |
|
ec
ho $this->
getFile($f
n);
|
192 |
|
|
|
190 |
|
|
193 |
|
re
turn true;
|
|
191 |
|
re
turn true;
|
194 |
|
}
|
|
192 |
|
}
|
195 |
|
|
|
193 |
|
|
196 |
|
functi
on cacheWr
ite()
|
|
194 |
|
functi
on cacheWr
ite()
|
197 |
|
{
|
|
195 |
|
{
|
198 |
|
if
(!$this->
_bCache) r
eturn;
|
|
196 |
|
if
(!$this->
_bCache) r
eturn;
|
199 |
|
|
|
197 |
|
|
200 |
|
$f
n = $this-
>_sCacheDi
r . $this-
>_sCacheFi
lename;
|
|
198 |
|
$f
n = $this-
>_sCacheDi
r . $this-
>_sCacheFi
lename;
|
201 |
|
|
|
199 |
|
|
202 |
|
$t
his->putFi
le($fn, $t
his->_cz);
|
|
200 |
|
$t
his->putFi
le($fn, $t
his->_cz);
|
203 |
|
}
|
|
201 |
|
}
|
204 |
|
}
|
|
202 |
|
}
|
205 |
|
|
|
203 |
|
|
206 |
|
?>
|
|
204 |
|
?>
|