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 |
|
// util fu
nctions
|
|
21 |
|
// util fu
nctions
|
24 |
|
|
|
22 |
|
|
25 |
|
/**
|
|
23 |
|
/**
|
26 |
|
* 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
|
27 |
|
* @param
$code
XML code
|
|
25 |
|
* @param
$code
XML code
|
28 |
|
* @param
$xsl
file name
|
|
26 |
|
* @param
$xsl
file name
|
29 |
|
* @param
$trans
make xsl t
ransformat
ion or not
|
|
27 |
|
* @param
$trans
make xsl t
ransformat
ion or not
|
30 |
|
*/
|
|
28 |
|
*/
|
31 |
|
function t
ransCheck
($xml, $xs
l, $trans,
$browser_
transform
= 0)
|
|
29 |
|
function t
ransCheck
($xml, $xs
l, $trans,
$browser_
transform
= 0)
|
32 |
|
{
|
|
30 |
|
{
|
33 |
|
global
$gConf;
|
|
31 |
|
global
$gConf;
|
34 |
|
|
|
32 |
|
|
35 |
|
if ('s
erver' ==
$gConf['xs
l_mode'] &
& $trans)
|
|
33 |
|
if ('s
erver' ==
$gConf['xs
l_mode'] &
& $trans)
|
36 |
|
{
|
|
34 |
|
{
|
37 |
|
$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';
|
38 |
|
he
ader("Expi
res: $now"
);
|
|
36 |
|
he
ader("Expi
res: $now"
);
|
39 |
|
he
ader("Last
-Modified:
$now");
|
|
37 |
|
he
ader("Last
-Modified:
$now");
|
40 |
|
he
ader("Cach
e-Control:
no-cache,
must-reva
lidate");
|
|
38 |
|
he
ader("Cach
e-Control:
no-cache,
must-reva
lidate");
|
41 |
|
he
ader("Prag
ma: no-cac
he");
|
|
39 |
|
he
ader("Prag
ma: no-cac
he");
|
42 |
|
|
|
40 |
|
|
43 |
|
$x
slt = new
BxXslTrans
form ($xml
, $xsl, BX
XSLTRANSFO
RM_SF);
|
|
41 |
|
$x
slt = new
BxXslTrans
form ($xml
, $xsl, BX
XSLTRANSFO
RM_SF);
|
44 |
|
$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');
|
45 |
|
$s
= $xslt->
process ()
;
|
|
43 |
|
$s
= $xslt->
process ()
;
|
46 |
|
$s
= '<'.'?x
ml version
="1.0" enc
oding="UTF
-8"?'.'>'
. $s;
|
|
44 |
|
$s
= '<'.'?x
ml version
="1.0" enc
oding="UTF
-8"?'.'>'
. $s;
|
47 |
|
|
|
45 |
|
|
48 |
|
$i
1 = strpos
($s, '<?x
ml');
|
|
46 |
|
$i
1 = strpos
($s, '<?x
ml');
|
49 |
|
if
(FALSE !=
= $i1)
|
|
47 |
|
if
(FALSE !=
= $i1)
|
50 |
|
{
|
|
48 |
|
{
|
51 |
|
$i2 = st
rpos ($s,
'?>') + 2;
|
|
49 |
|
$i2 = st
rpos ($s,
'?>') + 2;
|
52 |
|
echo sub
str ($s, 0
, $i1);
|
|
50 |
|
echo sub
str ($s, 0
, $i1);
|
53 |
|
echo sub
str ($s, $
i2);
|
|
51 |
|
echo sub
str ($s, $
i2);
|
54 |
|
}
|
|
52 |
|
}
|
55 |
|
el
se
|
|
53 |
|
el
se
|
56 |
|
{
|
|
54 |
|
{
|
57 |
|
ec
ho $s;
|
|
55 |
|
echo $s;
|
58 |
|
}
|
|
56 |
|
}
|
59 |
|
}
|
|
57 |
|
}
|
60 |
|
else
|
|
58 |
|
else
|
61 |
|
{
|
|
59 |
|
{
|
62 |
|
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');
|
63 |
|
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"?' .
'>';
|
64 |
|
if
('client'
== $gConf
['xsl_mode
'] && $xsl
)
|
|
62 |
|
if
('client'
== $gConf
['xsl_mode
'] && $xsl
)
|
65 |
|
{
|
|
63 |
|
{
|
66 |
|
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).'"?'.'
>';
|
67 |
|
}
|
|
65 |
|
}
|
68 |
|
ec
ho $xml;
|
|
66 |
|
ec
ho $xml;
|
69 |
|
}
|
|
67 |
|
}
|
70 |
|
}
|
|
68 |
|
}
|
71 |
|
|
|
69 |
|
|
72 |
|
|
|
70 |
|
|
73 |
|
/**
|
|
71 |
|
/**
|
74 |
|
* Convert
array to
XML format
|
|
72 |
|
* Convert
array to
XML format
|
75 |
|
*
|
|
73 |
|
*
|
76 |
|
* @param
$arr arra
y with dat
a
|
|
74 |
|
* @param
$arr arra
y with dat
a
|
77 |
|
* @param
$tag main
tag <main
tag>XML d
ata</main
tag>
|
|
75 |
|
* @param
$tag main
tag <main
tag>XML d
ata</main
tag>
|
78 |
|
* @return
XML prese
ntation of
data
|
|
76 |
|
* @return
XML prese
ntation of
data
|
79 |
|
*/
|
|
77 |
|
*/
|
80 |
|
function a
rray2xml($
arr, $tag
= false)
|
|
78 |
|
function a
rray2xml($
arr, $tag
= false)
|
81 |
|
{
|
|
79 |
|
{
|
82 |
|
$res =
'';
|
|
80 |
|
$res =
'';
|
83 |
|
foreac
h($arr as
$k=>$v)
|
|
81 |
|
foreac
h($arr as
$k=>$v)
|
84 |
|
{
|
|
82 |
|
{
|
85 |
|
if
(is_array(
$v))
|
|
83 |
|
if
(is_array(
$v))
|
86 |
|
{
|
|
84 |
|
{
|
87 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
|
85 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
88 |
|
$res
.= count(
$v) ? '<'.
$k.'>'.arr
ay2xml($v)
.'</'.$k.'
>' : '<'.$
k.'/>';
|
|
86 |
|
$res
.= count(
$v) ? '<'.
$k.'>'.arr
ay2xml($v)
.'</'.$k.'
>' : '<'.$
k.'/>';
|
89 |
|
elseif($
tag)
|
|
87 |
|
elseif($
tag)
|
90 |
|
$res
.= '<'.$t
ag.'>'.arr
ay2xml($v)
.'</'.$tag
.'>';
|
|
88 |
|
$res
.= '<'.$t
ag.'>'.arr
ay2xml($v)
.'</'.$tag
.'>';
|
91 |
|
else
|
|
89 |
|
else
|
92 |
|
$res
.= array2
xml($v);
|
|
90 |
|
$res
.= array2
xml($v);
|
93 |
|
}
|
|
91 |
|
}
|
94 |
|
el
se
|
|
92 |
|
el
se
|
95 |
|
{
|
|
93 |
|
{
|
96 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
|
94 |
|
if(!is_n
umeric($k)
&& trim($
k))//
|
97 |
|
$res
.= strlen
(trim($v))
? '<'.$k.
'>'.$v.'</
'.$k.'>' :
'<'.$k.'/
>';//'<'.$
k.'>'.$v.'
</'.$k.'>'
;
|
|
95 |
|
$res
.= strlen
(trim($v))
? '<'.$k.
'>'.$v.'</
'.$k.'>' :
'<'.$k.'/
>';//'<'.$
k.'>'.$v.'
</'.$k.'>'
;
|
98 |
|
elseif($
tag)
|
|
96 |
|
elseif($
tag)
|
99 |
|
$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.'/
>';
|
100 |
|
else
|
|
98 |
|
else
|
101 |
|
{
|
|
99 |
|
{
|
102 |
|
echo
'Error: a
rray witho
ut tag';
|
|
100 |
|
echo
'Error: a
rray witho
ut tag';
|
103 |
|
exit
;
|
|
101 |
|
exit
;
|
104 |
|
}
|
|
102 |
|
}
|
105 |
|
}
|
|
103 |
|
}
|
106 |
|
}
|
|
104 |
|
}
|
107 |
|
return
$res;
|
|
105 |
|
return
$res;
|
108 |
|
}
|
|
106 |
|
}
|
109 |
|
|
|
107 |
|
|
110 |
|
|
|
108 |
|
|
111 |
|
/**
|
|
109 |
|
/**
|
112 |
|
* check i
f magick q
uotes is d
isables
|
|
110 |
|
* check i
f magick q
uotes is d
isables
|
113 |
|
*/
|
|
111 |
|
*/
|
114 |
|
function c
heckMagicQ
uotes ()
|
|
112 |
|
function c
heckMagicQ
uotes ()
|
115 |
|
{
|
|
113 |
|
{
|
116 |
|
if (0
== get_mag
ic_quotes_
gpc())
|
|
114 |
|
if (0
== get_mag
ic_quotes_
gpc())
|
117 |
|
{
|
|
115 |
|
{
|
118 |
|
ad
dSlashesAr
ray ($_COO
KIE);
|
|
116 |
|
ad
dSlashesAr
ray ($_COO
KIE);
|
119 |
|
ad
dSlashesAr
ray ($_GET
);
|
|
117 |
|
ad
dSlashesAr
ray ($_GET
);
|
120 |
|
ad
dSlashesAr
ray ($_POS
T);
|
|
118 |
|
ad
dSlashesAr
ray ($_POS
T);
|
121 |
|
}
|
|
119 |
|
}
|
122 |
|
}
|
|
120 |
|
}
|
123 |
|
|
|
121 |
|
|
124 |
|
/**
|
|
122 |
|
/**
|
125 |
|
* add sla
shes to ev
ery value
of array
|
|
123 |
|
* add sla
shes to ev
ery value
of array
|
126 |
|
*/
|
|
124 |
|
*/
|
127 |
|
function a
ddSlashesA
rray (&$a)
|
|
125 |
|
function a
ddSlashesA
rray (&$a)
|
128 |
|
{
|
|
126 |
|
{
|
129 |
|
for (
reset ($a)
; list ($k
, $v) = ea
ch ($a);
)
|
|
127 |
|
for (
reset ($a)
; list ($k
, $v) = ea
ch ($a);
)
|
130 |
|
{
|
|
128 |
|
{
|
131 |
|
if
(is_array
($v))
|
|
129 |
|
if
(is_array
($v))
|
132 |
|
addSlash
esArray ($
v);
|
|
130 |
|
addSlash
esArray ($
v);
|
133 |
|
el
se
|
|
131 |
|
el
se
|
134 |
|
$a[$k] =
addslashe
s ($v);
|
|
132 |
|
$a[$k] =
addslashe
s ($v);
|
135 |
|
}
|
|
133 |
|
}
|
136 |
|
}
|
|
134 |
|
}
|
137 |
|
|
|
135 |
|
|
138 |
|
|
|
136 |
|
|
139 |
|
function p
repare_to_
db(&$s, $i
AllowHTML
= 1)
|
|
137 |
|
function p
repare_to_
db(&$s, $i
AllowHTML
= 1)
|
140 |
|
{
|
|
138 |
|
{
|
141 |
|
if ($i
AllowHTML)
|
|
139 |
|
if ($i
AllowHTML)
|
142 |
|
cl
eanPost($s
);
|
|
140 |
|
cl
eanPost($s
);
|
143 |
|
}
|
|
141 |
|
}
|
144 |
|
|
|
142 |
|
|
145 |
|
|
|
143 |
|
|
146 |
|
/**
|
|
144 |
|
/**
|
147 |
|
* che
ck html me
ssage, rem
ove unknow
n tags, ch
ech for xh
tml errors
|
|
145 |
|
* check h
tml messag
e, remove
unknown ta
gs, chech
for xhtml
errors
|
148 |
|
*/
|
|
146 |
|
*/
|
149 |
|
functi
on cleanPo
st (&$s)
|
|
147 |
|
function c
leanPost (
&$s)
|
150 |
|
{
|
|
148 |
|
{
|
151 |
|
|
|
149 |
|
|
152 |
|
fu
nction mak
eStyle ($s
)
|
|
150 |
|
functi
on makeSty
le ($s)
|
153 |
|
{
|
|
151 |
|
{
|
154 |
|
global $
gConf;
|
|
152 |
|
gl
obal $gCon
f;
|
155 |
|
|
|
153 |
|
|
156 |
|
if ($s =
= ">") ret
urn '';
|
|
154 |
|
if
($s == ">
") return
'';
|
157 |
|
|
|
155 |
|
|
158 |
|
$style =
'';
|
|
156 |
|
$s
tyle = '';
|
159 |
|
$ret = '
';
|
|
157 |
|
$r
et = '';
|
160 |
|
|
|
158 |
|
|
161 |
|
if (preg
_match("/\
bbold\b/",
$s)) $sty
le .= "fon
t-weight:b
old;";
|
|
159 |
|
if
(preg_mat
ch("/\bbol
d\b/", $s)
) $style .
= "font-we
ight:bold;
";
|
162 |
|
if (preg
_match("/\
bunderline
\b/", $s))
$style .=
"text-dec
oration:un
derline;";
|
|
160 |
|
if
(preg_mat
ch("/\bund
erline\b/"
, $s)) $st
yle .= "te
xt-decorat
ion:underl
ine;";
|
163 |
|
if (preg
_match("/\
bitalic\b/
", $s)) $s
tyle .= "f
ont-style:
italic;";
|
|
161 |
|
if
(preg_mat
ch("/\bita
lic\b/", $
s)) $style
.= "font-
style:ital
ic;";
|
164 |
|
if (preg
_match("/\
bmargin-le
ft[:\s]+([
0-9a-z]+)/
", $s, $m)
) $style .
= "margin-
left:{$m[1
]};";
|
|
162 |
|
if
(preg_mat
ch("/\bmar
gin-left[:
\s]+([0-9a
-z]+)/", $
s, $m)) $s
tyle .= "m
argin-left
:{$m[1]};"
;
|
165 |
|
|
|
163 |
|
|
166 |
|
if (preg
_match("/\
bhref=\\\\
\\\\\"([0-
9A-Za-z:@_
\.\/?=&;-]
+)/", $s,
$m))
|
|
164 |
|
if
(preg_mat
ch("/\bhre
f=\\\\\\\\
\"([0-9A-Z
a-z:@_\.\/
?=&;-]+)/"
, $s, $m))
|
167 |
|
$ret
= " " . (
preg_match
('#^' . $
gConf['url
']['base']
. '#', $m
[1]) ? ""
: "target=
\"_blank\"
") . " hre
f=\"{$m[1]
}\"";
|
|
165 |
|
$ret = "
" . (preg
_match ('#
^' . $gCon
f['url']['
base'] . '
#', $m[1])
? "" : "t
arget=\"_b
lank\"") .
" href=\"
{$m[1]}\""
;
|
168 |
|
|
|
166 |
|
|
169 |
|
if (preg
_match("/\
bsrc=\\\\\
\\\\"([0-9
A-Za-z:@_\
.\/?=&;-]+
)/", $s, $
m))
|
|
167 |
|
if
(preg_mat
ch("/\bsrc
=\\\\\\\\\
"([0-9A-Za
-z:@_\.\/?
=&;-]+)/",
$s, $m))
|
170 |
|
$ret
= " src=\
"{$m[1]}\"
/";
|
|
168 |
|
$ret = "
src=\"{$m
[1]}\" /";
|
171 |
|
|
|
169 |
|
|
172 |
|
if ($sty
le) $ret .
= " style=
\"$style\"
";
|
|
170 |
|
if
($style)
$ret .= "
style=\"$s
tyle\"";
|
173 |
|
|
|
171 |
|
|
174 |
|
return $
ret;
|
|
172 |
|
re
turn $ret;
|
175 |
|
}
|
|
173 |
|
}
|
176 |
|
|
|
174 |
|
|
177 |
|
|
|
175 |
|
|
178 |
|
$s
= str_rep
lace ("&nb
sp;", "
60;", $s);
|
|
176 |
|
$s = s
tr_replace
(" "
, " "
, $s);
|
179 |
|
|
|
177 |
|
|
180 |
|
|
|
178 |
|
|
181 |
|
$s
=
strip_tags
($s,
'<span><br
><pre><ul>
<ol><li><d
iv><p><str
ong><em><u
><strike><
blockquote
><a><img><
address><f
ont><sup><
sub><table
><tbody><t
r><td><hr>
<H1><H2><H
3><H4><H5>
<H6>
');
|
|
179 |
|
$s
=
strip_tags
($s,
'<span><br
><pre><ul>
<ol><li><d
iv><p><str
ong><em><u
><strike><
blockquote
><a><img><
address><f
ont><sup><
sub><table
><tbody><t
r><td><hr>
<H1><H2><H
3><H4><H5>
<H6>
<object><e
mbed><para
m>
');
|
182 |
|
}
|
|
180 |
|
}
|
183 |
|
|
|
181 |
|
|
184 |
|
functi
on encode_
post_text
(&$s, $wp
= 0, $utf8
_decode =
0)
|
|
182 |
|
function e
ncode_post
_text (&$s
, $wp = 0,
$utf8_dec
ode = 0)
|
185 |
|
{
|
|
183 |
|
{
|
186 |
|
gl
obal $gCon
f;
|
|
184 |
|
global
$gConf;
|
187 |
|
|
|
185 |
|
|
188 |
|
if ('s
erver' ==
$gConf['xs
l_mode'])
|
|
186 |
|
if ('s
erver' ==
$gConf['xs
l_mode'])
|
189 |
|
{
|
|
187 |
|
{
|
190 |
|
|
|
188 |
|
|
191 |
|
}
|
|
189 |
|
}
|
192 |
|
elseif
('client'
== $gConf
['xsl_mode
'])
|
|
190 |
|
elseif
('client'
== $gConf
['xsl_mode
'])
|
193 |
|
{
|
|
191 |
|
{
|
194 |
|
|
|
192 |
|
|
195 |
|
$s
= str_rep
lace (arra
y('&',
'>','&l
t;'), arra
y('&','>',
'<'), $s);
|
|
193 |
|
$s
= str_rep
lace (arra
y('&',
'>','&l
t;'), arra
y('&','>',
'<'), $s);
|
196 |
|
}
|
|
194 |
|
}
|
197 |
|
|
|
195 |
|
|
198 |
|
$s = "<!
[CDATA[{$s
}]]>";
|
|
196 |
|
$s = "
<![CDATA[{
$s}]]>";
|
199 |
|
}
|
|
197 |
|
}
|
200 |
|
|
|
198 |
|
|
201 |
|
|
|
199 |
|
|
202 |
|
function u
nicode_url
decode($ur
l)
|
|
200 |
|
function u
nicode_url
decode($ur
l)
|
203 |
|
{
|
|
201 |
|
{
|
204 |
|
preg_m
atch_all('
/%u([[:aln
um:]]{4})/
', $url, $
a);
|
|
202 |
|
preg_m
atch_all('
/%u([[:aln
um:]]{4})/
', $url, $
a);
|
205 |
|
|
|
203 |
|
|
206 |
|
foreac
h ($a[1] a
s $uniord)
|
|
204 |
|
foreac
h ($a[1] a
s $uniord)
|
207 |
|
{
|
|
205 |
|
{
|
208 |
|
$d
ec = hexde
c($uniord)
;
|
|
206 |
|
$d
ec = hexde
c($uniord)
;
|
209 |
|
$u
tf = '';
|
|
207 |
|
$u
tf = '';
|
210 |
|
|
|
208 |
|
|
211 |
|
if
($dec < 1
28)
|
|
209 |
|
if
($dec < 1
28)
|
212 |
|
{
|
|
210 |
|
{
|
213 |
|
$utf = c
hr($dec);
|
|
211 |
|
$utf = c
hr($dec);
|
214 |
|
}
|
|
212 |
|
}
|
215 |
|
el
se if ($de
c < 2048)
|
|
213 |
|
el
se if ($de
c < 2048)
|
216 |
|
{
|
|
214 |
|
{
|
217 |
|
$utf = c
hr(192 + (
($dec - ($
dec % 64))
/ 64));
|
|
215 |
|
$utf = c
hr(192 + (
($dec - ($
dec % 64))
/ 64));
|
218 |
|
$utf .=
chr(128 +
($dec % 64
));
|
|
216 |
|
$utf .=
chr(128 +
($dec % 64
));
|
219 |
|
}
|
|
217 |
|
}
|
220 |
|
el
se
|
|
218 |
|
el
se
|
221 |
|
{
|
|
219 |
|
{
|
222 |
|
$utf = c
hr(224 + (
($dec - ($
dec % 4096
)) / 4096)
);
|
|
220 |
|
$utf = c
hr(224 + (
($dec - ($
dec % 4096
)) / 4096)
);
|
223 |
|
$utf .=
chr(128 +
((($dec %
4096) - ($
dec % 64))
/ 64));
|
|
221 |
|
$utf .=
chr(128 +
((($dec %
4096) - ($
dec % 64))
/ 64));
|
224 |
|
$utf .=
chr(128 +
($dec % 64
));
|
|
222 |
|
$utf .=
chr(128 +
($dec % 64
));
|
225 |
|
}
|
|
223 |
|
}
|
226 |
|
|
|
224 |
|
|
227 |
|
$u
rl = str_r
eplace('%u
'.$uniord,
$utf, $ur
l);
|
|
225 |
|
$u
rl = str_r
eplace('%u
'.$uniord,
$utf, $ur
l);
|
228 |
|
}
|
|
226 |
|
}
|
229 |
|
|
|
227 |
|
|
230 |
|
return
urldecode
($url);
|
|
228 |
|
return
urldecode
($url);
|
231 |
|
}
|
|
229 |
|
}
|
232 |
|
|
|
230 |
|
|
233 |
|
|
|
231 |
|
|
234 |
|
|
|
232 |
|
|
235 |
|
function v
alidate_un
icode (&$s
)
|
|
233 |
|
function v
alidate_un
icode (&$s
)
|
236 |
|
{
|
|
234 |
|
{
|
237 |
|
if (functi
on_exists(
'iconv'))
|
|
235 |
|
if (functi
on_exists(
'iconv'))
|
238 |
|
$s = i
conv("UTF-
8","UTF-8/
/IGNORE",$
s);
|
|
236 |
|
$s = i
conv("UTF-
8","UTF-8/
/IGNORE",$
s);
|
239 |
|
}
|
|
237 |
|
}
|
240 |
|
|
|
238 |
|
|
241 |
|
function g
etConfigPa
ram ($sNam
e)
|
|
239 |
|
function g
etConfigPa
ram ($sNam
e)
|
242 |
|
{
|
|
240 |
|
{
|
243 |
|
global
$gConf;
|
|
241 |
|
global
$gConf;
|
244 |
|
|
|
242 |
|
|
245 |
|
if (!$
gConf['par
ams'])
|
|
243 |
|
if (!$
gConf['par
ams'])
|
246 |
|
ge
tConfig ()
;
|
|
244 |
|
ge
tConfig ()
;
|
247 |
|
|
|
245 |
|
|
248 |
|
if (!i
sset($gCon
f['params'
]) || !$gC
onf['param
s'][$sName
])
|
|
246 |
|
if (!i
sset($gCon
f['params'
]) || !$gC
onf['param
s'][$sName
])
|
249 |
|
re
turn false
;
|
|
247 |
|
re
turn false
;
|
250 |
|
|
|
248 |
|
|
251 |
|
return
$gConf['p
arams'][$s
Name];
|
|
249 |
|
return
$gConf['p
arams'][$s
Name];
|
252 |
|
}
|
|
250 |
|
}
|
253 |
|
|
|
251 |
|
|
254 |
|
function s
etConfigPa
ram ($sNam
e, $sValue
)
|
|
252 |
|
function s
etConfigPa
ram ($sNam
e, $sValue
)
|
255 |
|
{
|
|
253 |
|
{
|
256 |
|
global
$gConf;
|
|
254 |
|
global
$gConf;
|
257 |
|
|
|
255 |
|
|
258 |
|
if (!$
gConf['par
ams'])
|
|
256 |
|
if (!$
gConf['par
ams'])
|
259 |
|
ge
tConfig ()
;
|
|
257 |
|
ge
tConfig ()
;
|
260 |
|
|
|
258 |
|
|
261 |
|
$gConf
['params']
[$sName] =
$sValue;
|
|
259 |
|
$gConf
['params']
[$sName] =
$sValue;
|
262 |
|
|
|
260 |
|
|
263 |
|
$s = b
ase64_enco
de(@serial
ize($gConf
['params']
));
|
|
261 |
|
$s = b
ase64_enco
de(@serial
ize($gConf
['params']
));
|
264 |
|
|
|
262 |
|
|
265 |
|
$f = f
open($gCon
f['dir']['
config'],
'w');
|
|
263 |
|
$f = f
open($gCon
f['dir']['
config'],
'w');
|
266 |
|
if (!$
f) return
false;
|
|
264 |
|
if (!$
f) return
false;
|
267 |
|
if (!f
write($f,
$s))
|
|
265 |
|
if (!f
write($f,
$s))
|
268 |
|
{
|
|
266 |
|
{
|
269 |
|
fc
lose ($f);
|
|
267 |
|
fc
lose ($f);
|
270 |
|
re
turn false
;
|
|
268 |
|
re
turn false
;
|
271 |
|
}
|
|
269 |
|
}
|
272 |
|
fclose
($f);
|
|
270 |
|
fclose
($f);
|
273 |
|
|
|
271 |
|
|
274 |
|
return
true;
|
|
272 |
|
return
true;
|
275 |
|
}
|
|
273 |
|
}
|
276 |
|
|
|
274 |
|
|
277 |
|
function g
etConfig (
)
|
|
275 |
|
function g
etConfig (
)
|
278 |
|
{
|
|
276 |
|
{
|
279 |
|
global
$gConf;
|
|
277 |
|
global
$gConf;
|
280 |
|
|
|
278 |
|
|
281 |
|
$s = @
file_get_c
ontents($g
Conf['dir'
]['config'
]);
|
|
279 |
|
$s = @
file_get_c
ontents($g
Conf['dir'
]['config'
]);
|
282 |
|
if (!$
s) return
false;
|
|
280 |
|
if (!$
s) return
false;
|
283 |
|
|
|
281 |
|
|
284 |
|
$aPara
ms = @unse
rialize(ba
se64_decod
e($s));
|
|
282 |
|
$aPara
ms = @unse
rialize(ba
se64_decod
e($s));
|
285 |
|
|
|
283 |
|
|
286 |
|
if ($a
Params &&
is_array($
aParams))
|
|
284 |
|
if ($a
Params &&
is_array($
aParams))
|
287 |
|
{
|
|
285 |
|
{
|
288 |
|
$g
Conf['para
ms'] = $aP
arams;
|
|
286 |
|
$g
Conf['para
ms'] = $aP
arams;
|
289 |
|
re
turn true;
|
|
287 |
|
re
turn true;
|
290 |
|
}
|
|
288 |
|
}
|
291 |
|
return
false;
|
|
289 |
|
return
false;
|
292 |
|
}
|
|
290 |
|
}
|
293 |
|
|
|
291 |
|
|
294 |
|
?>
|
|
292 |
|
?>
|