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 |
|
* begi
n
: F
r Nov 10 2
006
|
|
5 |
|
* begi
n
: F
r Nov 10 2
006
|
6 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
|
6 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
7 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
|
7 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
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 softw
are. This
work is li
censed und
er a Creat
ive Common
s Attribut
ion 3.0 Li
cense.
|
|
10 |
|
* Orca is
free softw
are. This
work is li
censed und
er a Creat
ive Common
s Attribut
ion 3.0 Li
cense.
|
11 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
|
11 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
12 |
|
*
|
|
12 |
|
*
|
13 |
|
* 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;
|
14 |
|
* 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.
|
15 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
|
15 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
16 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Orca,
|
|
16 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Orca,
|
17 |
|
* 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
|
18 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
18 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
19 |
|
|
|
19 |
|
|
20 |
|
|
|
20 |
|
|
21 |
|
// util fu
nctions
|
|
21 |
|
// util fu
nctions
|
22 |
|
|
|
22 |
|
|
23 |
|
/**
|
|
23 |
|
/**
|
24 |
|
* Output
XML or mak
e XSL tran
sformation
and outpu
t ready HT
ML
|
|
24 |
|
* Output
XML or mak
e XSL tran
sformation
and outpu
t ready HT
ML
|
25 |
|
* @param
$code
XML code
|
|
25 |
|
* @param
$code
XML code
|
26 |
|
* @param
$xsl
file name
|
|
26 |
|
* @param
$xsl
file name
|
27 |
|
* @param
$trans
make xsl t
ransformat
ion or not
|
|
27 |
|
* @param
$trans
make xsl t
ransformat
ion or not
|
28 |
|
*/
|
|
28 |
|
*/
|
29 |
|
function t
ransCheck
($xml, $xs
l, $trans,
$browser_
transform
= 0)
|
|
29 |
|
function t
ransCheck
($xml, $xs
l, $trans,
$browser_
transform
= 0)
|
30 |
|
{
|
|
30 |
|
{
|
31 |
|
global
$gConf;
|
|
31 |
|
global
$gConf;
|
32 |
|
|
|
32 |
|
|
33 |
|
if ('s
erver' ==
$gConf['xs
l_mode'] &
& $trans)
|
|
33 |
|
if ('s
erver' ==
$gConf['xs
l_mode'] &
& $trans)
|
34 |
|
{
|
|
34 |
|
{
|
35 |
|
$n
ow = gmdat
e('D, d M
Y H:i:s')
. ' GMT';
|
|
35 |
|
$n
ow = gmdat
e('D, d M
Y H:i:s')
. ' GMT';
|
36 |
|
he
ader("Expi
res: $now"
);
|
|
36 |
|
he
ader("Expi
res: $now"
);
|
37 |
|
he
ader("Last
-Modified:
$now");
|
|
37 |
|
he
ader("Last
-Modified:
$now");
|
38 |
|
he
ader("Cach
e-Control:
no-cache,
must-reva
lidate");
|
|
38 |
|
he
ader("Cach
e-Control:
no-cache,
must-reva
lidate");
|
39 |
|
he
ader("Prag
ma: no-cac
he");
|
|
39 |
|
he
ader("Prag
ma: no-cac
he");
|
40 |
|
|
|
40 |
|
|
41 |
|
$x
slt = new
BxXslTrans
form ($xml
, $xsl, BX
XSLTRANSFO
RM_SF);
|
|
41 |
|
$x
slt = new
BxXslTrans
form ($xml
, $xsl, BX
XSLTRANSFO
RM_SF);
|
42 |
|
$x
slt->setHe
ader ('Con
tent-Type:
text/html
; charset=
UTF-8');
|
|
42 |
|
$x
slt->setHe
ader ('Con
tent-Type:
text/html
; charset=
UTF-8');
|
43 |
|
$s
= $xslt->
process ()
;
|
|
43 |
|
$s
= $xslt->
process ()
;
|
44 |
|
$s
= '<'.'?x
ml version
="1.0" enc
oding="UTF
-8"?'.'>'
. $s;
|
|
44 |
|
$s
= '<'.'?x
ml version
="1.0" enc
oding="UTF
-8"?'.'>'
. $s;
|
45 |
|
|
|
45 |
|
|
46 |
|
$i
1 = strpos
($s, '<?x
ml');
|
|
46 |
|
$i
1 = strpos
($s, '<?x
ml');
|
47 |
|
if
(FALSE !=
= $i1)
|
|
47 |
|
if
(FALSE !=
= $i1)
|
48 |
|
{
|
|
48 |
|
{
|
49 |
|
$i2 = st
rpos ($s,
'?>') + 2;
|
|
49 |
|
$i2 = st
rpos ($s,
'?>') + 2;
|
50 |
|
echo sub
str ($s, 0
, $i1);
|
|
50 |
|
echo sub
str ($s, 0
, $i1);
|
51 |
|
echo sub
str ($s, $
i2);
|
|
51 |
|
echo sub
str ($s, $
i2);
|
52 |
|
}
|
|
52 |
|
}
|
53 |
|
el
se
|
|
53 |
|
el
se
|
54 |
|
{
|
|
54 |
|
{
|
55 |
|
echo $s;
|
|
55 |
|
echo $s;
|
56 |
|
}
|
|
56 |
|
}
|
57 |
|
}
|
|
57 |
|
}
|
58 |
|
else
|
|
58 |
|
else
|
59 |
|
{
|
|
59 |
|
{
|
60 |
|
he
ader ('Con
tent-Type:
applicati
on/xml; ch
arset=UTF-
8');
|
|
60 |
|
he
ader ('Con
tent-Type:
applicati
on/xml; ch
arset=UTF-
8');
|
61 |
|
ec
ho '<' . '
?xml versi
on="1.0" e
ncoding="U
TF-8"?' .
'>';
|
|
61 |
|
ec
ho '<' . '
?xml versi
on="1.0" e
ncoding="U
TF-8"?' .
'>';
|
62 |
|
if
('client'
== $gConf
['xsl_mode
'] && $xsl
)
|
|
62 |
|
if
('client'
== $gConf
['xsl_mode
'] && $xsl
)
|
63 |
|
{
|
|
63 |
|
{
|
64 |
|
echo '<'
. '?xml-s
tylesheet
type="text
/xsl" href
="'.str_re
place($gCo
nf['dir'][
'xsl'],$gC
onf['url']
['xsl'],$x
sl).'"?'.'
>';
|
|
64 |
|
echo '<'
. '?xml-s
tylesheet
type="text
/xsl" href
="'.str_re
place($gCo
nf['dir'][
'xsl'],$gC
onf['url']
['xsl'],$x
sl).'"?'.'
>';
|
65 |
|
}
|
|
65 |
|
}
|
66 |
|
ec
ho $xml;
|
|
66 |
|
ec
ho $xml;
|
67 |
|
}
|
|
67 |
|
}
|
68 |
|
}
|
|
68 |
|
}
|
69 |
|
|
|
69 |
|
|
70 |
|
|
|
70 |
|
|
71 |
|
/**
|
|
71 |
|
/**
|
72 |
|
* Convert
array to
XML format
|
|
72 |
|
* Convert
array to
XML format
|
73 |
|
*
|
|
73 |
|
*
|
74 |
|
* @param
$arr arra
y with dat
a
|
|
74 |
|
* @param
$arr arra
y with dat
a
|
75 |
|
* @param
$tag main
tag <main
tag>XML d
ata</main
tag>
|
|
75 |
|
* @param
$tag main
tag <main
tag>XML d
ata</main
tag>
|
76 |
|
* @return
XML prese
ntation of
data
|
|
76 |
|
* @return
XML prese
ntation of
data
|
77 |
|
*/
|
|
77 |
|
*/
|
78 |
|
function a
rray2xml($
arr, $tag
= false)
|
|
78 |
|
function a
rray2xml($
arr, $tag
= false)
|
79 |
|
{
|
|
79 |
|
{
|
80 |
|
$res =
'';
|
|
80 |
|
$res =
'';
|
81 |
|
foreac
h($arr as
$k=>$v)
|
|
81 |
|
foreac
h($arr as
$k=>$v)
|
82 |
|
{
|
|
82 |
|
{
|
83 |
|
if
(is_array(
$v))
|
|
83 |
|
if
(is_array(
$v))
|
84 |
|
{
|
|
84 |
|
{
|
85 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
|
85 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
86 |
|
$res
.= count(
$v) ? '<'.
$k.'>'.arr
ay2xml($v)
.'</'.$k.'
>' : '<'.$
k.'/>';
|
|
86 |
|
$res
.= count(
$v) ? '<'.
$k.'>'.arr
ay2xml($v)
.'</'.$k.'
>' : '<'.$
k.'/>';
|
87 |
|
elseif($
tag)
|
|
87 |
|
elseif($
tag)
|
88 |
|
$res
.= '<'.$t
ag.'>'.arr
ay2xml($v)
.'</'.$tag
.'>';
|
|
88 |
|
$res
.= '<'.$t
ag.'>'.arr
ay2xml($v)
.'</'.$tag
.'>';
|
89 |
|
else
|
|
89 |
|
else
|
90 |
|
$res
.= array2
xml($v);
|
|
90 |
|
$res
.= array2
xml($v);
|
91 |
|
}
|
|
91 |
|
}
|
92 |
|
el
se
|
|
92 |
|
el
se
|
93 |
|
{
|
|
93 |
|
{
|
94 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
|
94 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
95 |
|
$res
.= strlen
(trim($v))
? '<'.$k.
'>'.$v.'</
'.$k.'>' :
'<'.$k.'/
>';//'<'.$
k.'>'.$v.'
</'.$k.'>'
;
|
|
95 |
|
$res
.= strlen
(trim($v))
? '<'.$k.
'>'.$v.'</
'.$k.'>' :
'<'.$k.'/
>';//'<'.$
k.'>'.$v.'
</'.$k.'>'
;
|
96 |
|
elseif($
tag)
|
|
96 |
|
elseif($
tag)
|
97 |
|
$res
.= '<'.$t
ag.'>'.$v.
'</'.$tag.
'>';//trim
($v) ? '<'
.$tag.'>'.
$v.'</'.$t
ag.'>' : '
<'.$tag.'/
>';
|
|
97 |
|
$res
.= '<'.$t
ag.'>'.$v.
'</'.$tag.
'>';//trim
($v) ? '<'
.$tag.'>'.
$v.'</'.$t
ag.'>' : '
<'.$tag.'/
>';
|
98 |
|
else
|
|
98 |
|
else
|
99 |
|
{
|
|
99 |
|
{
|
100 |
|
echo
'Error: a
rray witho
ut tag';
|
|
100 |
|
echo
'Error: a
rray witho
ut tag';
|
101 |
|
exit
;
|
|
101 |
|
exit
;
|
102 |
|
}
|
|
102 |
|
}
|
103 |
|
}
|
|
103 |
|
}
|
104 |
|
}
|
|
104 |
|
}
|
105 |
|
return
$res;
|
|
105 |
|
return
$res;
|
106 |
|
}
|
|
106 |
|
}
|
107 |
|
|
|
107 |
|
|
108 |
|
|
|
108 |
|
|
109 |
|
/**
|
|
109 |
|
/**
|
110 |
|
* check i
f magick q
uotes is d
isables
|
|
110 |
|
* check i
f magick q
uotes is d
isables
|
111 |
|
*/
|
|
111 |
|
*/
|
112 |
|
function c
heckMagicQ
uotes ()
|
|
112 |
|
function c
heckMagicQ
uotes ()
|
113 |
|
{
|
|
113 |
|
{
|
114 |
|
if (0
== get_mag
ic_quotes_
gpc())
|
|
114 |
|
if (0
== get_mag
ic_quotes_
gpc())
|
115 |
|
{
|
|
115 |
|
{
|
116 |
|
ad
dSlashesAr
ray ($_COO
KIE);
|
|
116 |
|
ad
dSlashesAr
ray ($_COO
KIE);
|
117 |
|
ad
dSlashesAr
ray ($_GET
);
|
|
117 |
|
ad
dSlashesAr
ray ($_GET
);
|
118 |
|
ad
dSlashesAr
ray ($_POS
T);
|
|
118 |
|
ad
dSlashesAr
ray ($_POS
T);
|
119 |
|
}
|
|
119 |
|
}
|
120 |
|
}
|
|
120 |
|
}
|
121 |
|
|
|
121 |
|
|
122 |
|
/**
|
|
122 |
|
/**
|
123 |
|
* add sla
shes to ev
ery value
of array
|
|
123 |
|
* add sla
shes to ev
ery value
of array
|
124 |
|
*/
|
|
124 |
|
*/
|
125 |
|
function a
ddSlashesA
rray (&$a)
|
|
125 |
|
function a
ddSlashesA
rray (&$a)
|
126 |
|
{
|
|
126 |
|
{
|
127 |
|
for (
reset ($a)
; list ($k
, $v) = ea
ch ($a);
)
|
|
127 |
|
for (
reset ($a)
; list ($k
, $v) = ea
ch ($a);
)
|
128 |
|
{
|
|
128 |
|
{
|
129 |
|
if
(is_array
($v))
|
|
129 |
|
if
(is_array
($v))
|
130 |
|
addSlash
esArray ($
v);
|
|
130 |
|
addSlash
esArray ($
v);
|
131 |
|
el
se
|
|
131 |
|
el
se
|
132 |
|
$a[$k] =
addslashe
s ($v);
|
|
132 |
|
$a[$k] =
addslashe
s ($v);
|
133 |
|
}
|
|
133 |
|
}
|
134 |
|
}
|
|
134 |
|
}
|
135 |
|
|
|
135 |
|
|
136 |
|
|
|
136 |
|
|
137 |
|
function p
repare_to_
db(&$s, $i
AllowHTML
= 1)
|
|
137 |
|
function p
repare_to_
db(&$s, $i
AllowHTML
= 1)
|
138 |
|
{
|
|
138 |
|
{
|
139 |
|
if ($i
AllowHTML)
|
|
139 |
|
if ($i
AllowHTML)
|
140 |
|
cl
eanPost($s
);
|
|
140 |
|
cl
eanPost($s
);
|
141 |
|
}
|
|
141 |
|
}
|
142 |
|
|
|
142 |
|
|
143 |
|
|
|
143 |
|
|
144 |
|
/**
|
|
144 |
|
/**
|
145 |
|
* check h
tml messag
e, remove
unknown ta
gs, chech
for xhtml
errors
|
|
145 |
|
* check h
tml messag
e, remove
unknown ta
gs, chech
for xhtml
errors
|
146 |
|
*/
|
|
146 |
|
*/
|
147 |
|
function c
leanPost (
&$s)
|
|
147 |
|
function c
leanPost (
&$s)
|
148 |
|
{
|
|
148 |
|
{
|
149 |
|
|
|
149 |
|
|
150 |
|
functi
on makeSty
le ($s)
|
|
150 |
|
functi
on makeSty
le ($s)
|
151 |
|
{
|
|
151 |
|
{
|
152 |
|
gl
obal $gCon
f;
|
|
152 |
|
gl
obal $gCon
f;
|
153 |
|
|
|
153 |
|
|
154 |
|
if
($s == ">
") return
'';
|
|
154 |
|
if
($s == ">
") return
'';
|
155 |
|
|
|
155 |
|
|
156 |
|
$s
tyle = '';
|
|
156 |
|
$s
tyle = '';
|
157 |
|
$r
et = '';
|
|
157 |
|
$r
et = '';
|
158 |
|
|
|
158 |
|
|
159 |
|
if
(preg_mat
ch("/\bbol
d\b/", $s)
) $style .
= "font-we
ight:bold;
";
|
|
159 |
|
if
(preg_mat
ch("/\bbol
d\b/", $s)
) $style .
= "font-we
ight:bold;
";
|
160 |
|
if
(preg_mat
ch("/\bund
erline\b/"
, $s)) $st
yle .= "te
xt-decorat
ion:underl
ine;";
|
|
160 |
|
if
(preg_mat
ch("/\bund
erline\b/"
, $s)) $st
yle .= "te
xt-decorat
ion:underl
ine;";
|
161 |
|
if
(preg_mat
ch("/\bita
lic\b/", $
s)) $style
.= "font-
style:ital
ic;";
|
|
161 |
|
if
(preg_mat
ch("/\bita
lic\b/", $
s)) $style
.= "font-
style:ital
ic;";
|
162 |
|
if
(preg_mat
ch("/\bmar
gin-left[:
\s]+([0-9a
-z]+)/", $
s, $m)) $s
tyle .= "m
argin-left
:{$m[1]};"
;
|
|
162 |
|
if
(preg_mat
ch("/\bmar
gin-left[:
\s]+([0-9a
-z]+)/", $
s, $m)) $s
tyle .= "m
argin-left
:{$m[1]};"
;
|
163 |
|
|
|
163 |
|
|
164 |
|
if
(preg_mat
ch("/\bhre
f=\\\\\\\\
\"([0-9A-Z
a-z:@_\.\/
?=&;-]+)/"
, $s, $m))
|
|
164 |
|
if
(preg_mat
ch("/\bhre
f=\\\\\\\\
\"([0-9A-Z
a-z:@_\.\/
?=&;-]+)/"
, $s, $m))
|
165 |
|
$ret = "
" . (preg
_match ('#
^' . $gCon
f['url']['
base'] . '
#', $m[1])
? "" : "t
arget=\"_b
lank\"") .
" href=\"
{$m[1]}\""
;
|
|
165 |
|
$ret = "
" . (preg
_match ('#
^' . $gCon
f['url']['
base'] . '
#', $m[1])
? "" : "t
arget=\"_b
lank\"") .
" href=\"
{$m[1]}\""
;
|
166 |
|
|
|
166 |
|
|
167 |
|
if
(preg_mat
ch("/\bsrc
=\\\\\\\\\
"([0-9A-Za
-z:@_\.\/?
=&;-]+)/",
$s, $m))
|
|
167 |
|
if
(preg_mat
ch("/\bsrc
=\\\\\\\\\
"([0-9A-Za
-z:@_\.\/?
=&;-]+)/",
$s, $m))
|
168 |
|
$ret = "
src=\"{$m
[1]}\" /";
|
|
168 |
|
$ret = "
src=\"{$m
[1]}\" /";
|
169 |
|
|
|
169 |
|
|
170 |
|
if
($style)
$ret .= "
style=\"$s
tyle\"";
|
|
170 |
|
if
($style)
$ret .= "
style=\"$s
tyle\"";
|
171 |
|
|
|
171 |
|
|
172 |
|
re
turn $ret;
|
|
172 |
|
re
turn $ret;
|
173 |
|
}
|
|
173 |
|
}
|
174 |
|
|
|
174 |
|
|
175 |
|
|
|
175 |
|
|
176 |
|
$s = s
tr_replace
(" "
, " "
, $s);
|
|
176 |
|
$s = s
tr_replace
(" "
, " "
, $s);
|
177 |
|
|
|
177 |
|
|
178 |
|
|
|
178 |
|
|
179 |
|
$s = s
trip_tags
($s, '<spa
n><br><pre
><ul><ol><
li><div><p
><strong><
em><u><str
ike><block
quote><a><
img><addre
ss><font><
sup><sub><
table><tbo
dy><tr><td
><hr><H1><
H2><H3><H4
><H5><H6><
object><em
bed><param
>');
|
|
179 |
|
$s = s
trip_tags
($s, '<spa
n><br><pre
><ul><ol><
li><div><p
><strong><
em><u><str
ike><block
quote><a><
img><addre
ss><font><
sup><sub><
table><tbo
dy><tr><td
><hr><H1><
H2><H3><H4
><H5><H6><
object><em
bed><param
>');
|
180 |
|
}
|
|
180 |
|
}
|
181 |
|
|
|
181 |
|
|
182 |
|
function e
ncode_post
_text (&$s
, $wp = 0,
$utf8_dec
ode = 0)
|
|
182 |
|
function e
ncode_post
_text (&$s
, $wp = 0,
$utf8_dec
ode = 0)
|
183 |
|
{
|
|
183 |
|
{
|
184 |
|
global
$gConf;
|
|
184 |
|
global
$gConf;
|
185 |
|
|
|
185 |
|
|
186 |
|
if ('s
erver' ==
$gConf['xs
l_mode'])
|
|
186 |
|
if ('s
erver' ==
$gConf['xs
l_mode'])
|
187 |
|
{
|
|
187 |
|
{
|
188 |
|
|
|
188 |
|
|
189 |
|
}
|
|
189 |
|
}
|
190 |
|
elseif
('client'
== $gConf
['xsl_mode
'])
|
|
190 |
|
elseif
('client'
== $gConf
['xsl_mode
'])
|
191 |
|
{
|
|
191 |
|
{
|
192 |
|
|
|
192 |
|
|
193 |
|
$s
= str_rep
lace (arra
y('&',
'>','&l
t;'), arra
y('&','>',
'<'), $s);
|
|
193 |
|
$s
= str_rep
lace (arra
y('&',
'>','&l
t;'), arra
y('&','>',
'<'), $s);
|
194 |
|
}
|
|
194 |
|
}
|
195 |
|
|
|
195 |
|
|
196 |
|
$s = "
<![CDATA[{
$s}]]>";
|
|
196 |
|
$s = "
<![CDATA[{
$s}]]>";
|
197 |
|
}
|
|
197 |
|
}
|
198 |
|
|
|
198 |
|
|
199 |
|
|
|
199 |
|
|
200 |
|
function u
nicode_url
decode($ur
l)
|
|
200 |
|
function u
nicode_url
decode($ur
l)
|
201 |
|
{
|
|
201 |
|
{
|
202 |
|
preg_m
atch_all('
/%u([[:aln
um:]]{4})/
', $url, $
a);
|
|
202 |
|
preg_m
atch_all('
/%u([[:aln
um:]]{4})/
', $url, $
a);
|
203 |
|
|
|
203 |
|
|
204 |
|
foreac
h ($a[1] a
s $uniord)
|
|
204 |
|
foreac
h ($a[1] a
s $uniord)
|
205 |
|
{
|
|
205 |
|
{
|
206 |
|
$d
ec = hexde
c($uniord)
;
|
|
206 |
|
$d
ec = hexde
c($uniord)
;
|
207 |
|
$u
tf = '';
|
|
207 |
|
$u
tf = '';
|
208 |
|
|
|
208 |
|
|
209 |
|
if
($dec < 1
28)
|
|
209 |
|
if
($dec < 1
28)
|
210 |
|
{
|
|
210 |
|
{
|
211 |
|
$utf = c
hr($dec);
|
|
211 |
|
$utf = c
hr($dec);
|
212 |
|
}
|
|
212 |
|
}
|
213 |
|
el
se if ($de
c < 2048)
|
|
213 |
|
el
se if ($de
c < 2048)
|
214 |
|
{
|
|
214 |
|
{
|
215 |
|
$utf = c
hr(192 + (
($dec - ($
dec % 64))
/ 64));
|
|
215 |
|
$utf = c
hr(192 + (
($dec - ($
dec % 64))
/ 64));
|
216 |
|
$utf .=
chr(128 +
($dec % 64
));
|
|
216 |
|
$utf .=
chr(128 +
($dec % 64
));
|
217 |
|
}
|
|
217 |
|
}
|
218 |
|
el
se
|
|
218 |
|
el
se
|
219 |
|
{
|
|
219 |
|
{
|
220 |
|
$utf = c
hr(224 + (
($dec - ($
dec % 4096
)) / 4096)
);
|
|
220 |
|
$utf = c
hr(224 + (
($dec - ($
dec % 4096
)) / 4096)
);
|
221 |
|
$utf .=
chr(128 +
((($dec %
4096) - ($
dec % 64))
/ 64));
|
|
221 |
|
$utf .=
chr(128 +
((($dec %
4096) - ($
dec % 64))
/ 64));
|
222 |
|
$utf .=
chr(128 +
($dec % 64
));
|
|
222 |
|
$utf .=
chr(128 +
($dec % 64
));
|
223 |
|
}
|
|
223 |
|
}
|
224 |
|
|
|
224 |
|
|
225 |
|
$u
rl = str_r
eplace('%u
'.$uniord,
$utf, $ur
l);
|
|
225 |
|
$u
rl = str_r
eplace('%u
'.$uniord,
$utf, $ur
l);
|
226 |
|
}
|
|
226 |
|
}
|
227 |
|
|
|
227 |
|
|
228 |
|
return
urldecode
($url);
|
|
228 |
|
return
urldecode
($url);
|
229 |
|
}
|
|
229 |
|
}
|
230 |
|
|
|
230 |
|
|
231 |
|
|
|
231 |
|
|
232 |
|
|
|
232 |
|
|
233 |
|
function v
alidate_un
icode (&$s
)
|
|
233 |
|
function v
alidate_un
icode (&$s
)
|
234 |
|
{
|
|
234 |
|
{
|
235 |
|
if (functi
on_exists(
'iconv'))
|
|
235 |
|
if (functi
on_exists(
'iconv'))
|
236 |
|
$s = i
conv("UTF-
8","UTF-8/
/IGNORE",$
s);
|
|
236 |
|
$s = i
conv("UTF-
8","UTF-8/
/IGNORE",$
s);
|
237 |
|
}
|
|
237 |
|
}
|
238 |
|
|
|
238 |
|
|
239 |
|
function g
etConfigPa
ram ($sNam
e)
|
|
239 |
|
function g
etConfigPa
ram ($sNam
e)
|
240 |
|
{
|
|
240 |
|
{
|
241 |
|
global
$gConf;
|
|
241 |
|
global
$gConf;
|
242 |
|
|
|
242 |
|
|
243 |
|
if (!$
gConf['par
ams'])
|
|
243 |
|
if (!$
gConf['par
ams'])
|
244 |
|
ge
tConfig ()
;
|
|
244 |
|
ge
tConfig ()
;
|
245 |
|
|
|
245 |
|
|
246 |
|
if (!i
sset($gCon
f['params'
]) || !$gC
onf['param
s'][$sName
])
|
|
246 |
|
if (!i
sset($gCon
f['params'
]) || !$gC
onf['param
s'][$sName
])
|
247 |
|
re
turn false
;
|
|
247 |
|
re
turn false
;
|
248 |
|
|
|
248 |
|
|
249 |
|
return
$gConf['p
arams'][$s
Name];
|
|
249 |
|
return
$gConf['p
arams'][$s
Name];
|
250 |
|
}
|
|
250 |
|
}
|
251 |
|
|
|
251 |
|
|
252 |
|
function s
etConfigPa
ram ($sNam
e, $sValue
)
|
|
252 |
|
function s
etConfigPa
ram ($sNam
e, $sValue
)
|
253 |
|
{
|
|
253 |
|
{
|
254 |
|
global
$gConf;
|
|
254 |
|
global
$gConf;
|
255 |
|
|
|
255 |
|
|
256 |
|
if (!$
gConf['par
ams'])
|
|
256 |
|
if (!$
gConf['par
ams'])
|
257 |
|
ge
tConfig ()
;
|
|
257 |
|
ge
tConfig ()
;
|
258 |
|
|
|
258 |
|
|
259 |
|
$gConf
['params']
[$sName] =
$sValue;
|
|
259 |
|
$gConf
['params']
[$sName] =
$sValue;
|
260 |
|
|
|
260 |
|
|
261 |
|
$s = b
ase64_enco
de(@serial
ize($gConf
['params']
));
|
|
261 |
|
$s = b
ase64_enco
de(@serial
ize($gConf
['params']
));
|
262 |
|
|
|
262 |
|
|
263 |
|
$f = f
open($gCon
f['dir']['
config'],
'w');
|
|
263 |
|
$f = f
open($gCon
f['dir']['
config'],
'w');
|
264 |
|
if (!$
f) return
false;
|
|
264 |
|
if (!$
f) return
false;
|
265 |
|
if (!f
write($f,
$s))
|
|
265 |
|
if (!f
write($f,
$s))
|
266 |
|
{
|
|
266 |
|
{
|
267 |
|
fc
lose ($f);
|
|
267 |
|
fc
lose ($f);
|
268 |
|
re
turn false
;
|
|
268 |
|
re
turn false
;
|
269 |
|
}
|
|
269 |
|
}
|
270 |
|
fclose
($f);
|
|
270 |
|
fclose
($f);
|
271 |
|
|
|
271 |
|
|
272 |
|
return
true;
|
|
272 |
|
return
true;
|
273 |
|
}
|
|
273 |
|
}
|
274 |
|
|
|
274 |
|
|
275 |
|
function g
etConfig (
)
|
|
275 |
|
function g
etConfig (
)
|
276 |
|
{
|
|
276 |
|
{
|
277 |
|
global
$gConf;
|
|
277 |
|
global
$gConf;
|
278 |
|
|
|
278 |
|
|
279 |
|
$s = @
file_get_c
ontents($g
Conf['dir'
]['config'
]);
|
|
279 |
|
$s = @
file_get_c
ontents($g
Conf['dir'
]['config'
]);
|
280 |
|
if (!$
s) return
false;
|
|
280 |
|
if (!$
s) return
false;
|
281 |
|
|
|
281 |
|
|
282 |
|
$aPara
ms = @unse
rialize(ba
se64_decod
e($s));
|
|
282 |
|
$aPara
ms = @unse
rialize(ba
se64_decod
e($s));
|
283 |
|
|
|
283 |
|
|
284 |
|
if ($a
Params &&
is_array($
aParams))
|
|
284 |
|
if ($a
Params &&
is_array($
aParams))
|
285 |
|
{
|
|
285 |
|
{
|
286 |
|
$g
Conf['para
ms'] = $aP
arams;
|
|
286 |
|
$g
Conf['para
ms'] = $aP
arams;
|
287 |
|
re
turn true;
|
|
287 |
|
re
turn true;
|
288 |
|
}
|
|
288 |
|
}
|
289 |
|
return
false;
|
|
289 |
|
return
false;
|
290 |
|
}
|
|
290 |
|
}
|
291 |
|
|
|
291 |
|
|
|
|
292 |
|
function e
cho_utf8 (
$s)
|
|
|
293 |
|
{
|
|
|
294 |
|
header
('Content
-Type: tex
t/html; ch
arset=UTF-
8');
|
|
|
295 |
|
echo $
s;
|
|
|
296 |
|
}
|
|
|
297 |
|
|
292 |
|
?>
|
|
298 |
|
?>
|