No regular expressions were active.
|
|
1 |
|
<?
|
|
|
2 |
|
|
|
|
3 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. 'BxDolCm
ts.php' );
|
|
|
4 |
|
|
|
|
5 |
|
class BxBa
seCmtsView
extends B
xDolCmts
|
|
|
6 |
|
{
|
|
|
7 |
|
functi
on BxBaseC
mtsView( $
sSystem, $
iId, $iIni
t = 1 )
|
|
|
8 |
|
{
|
|
|
9 |
|
Bx
DolCmts::B
xDolCmts(
$sSystem,
$iId, $iIn
it );
|
|
|
10 |
|
$t
his->_sJsO
bjName = '
oCmts' . u
cfirst($sS
ystem);
|
|
|
11 |
|
}
|
|
|
12 |
|
|
|
|
13 |
|
/**
|
|
|
14 |
|
* get
full comm
ents block
with init
ialization
s
|
|
|
15 |
|
*/
|
|
|
16 |
|
functi
on getComm
entsFirst
()
|
|
|
17 |
|
{
|
|
|
18 |
|
$s
Ret = '<d
iv id="cmt
s-box-'.$t
his->getId
().'">';
|
|
|
19 |
|
|
|
|
20 |
|
$i
Overflow =
$iCountTo
tal = 0;
|
|
|
21 |
|
$s
Ret .= $th
is->getCom
ments (0,
$iOverflow
, $iCountT
otal);
|
|
|
22 |
|
|
|
|
23 |
|
if
(1 == $iO
verflow)
|
|
|
24 |
|
$sRet .=
'<div cla
ss="cmt-sh
ow-more"><
a href="#"
onclick="
' . $this-
>_sJsObjNa
me . '.sho
wMore(this
, ' . $thi
s->getPerV
iew () . '
); return
false;">'.
_t('_Show
<b>N</b>-<
u>N</u> of
N discuss
ions', $th
is->getPer
View ()+1,
$this->ge
tPerView (
)*2 > $iCo
untTotal ?
$iCountTo
tal : $thi
s->getPerV
iew ()*2,
$iCountTot
al).'</a><
/div>';
|
|
|
25 |
|
|
|
|
26 |
|
if
($this->i
sPostReply
Allowed ()
)
|
|
|
27 |
|
$sRet .=
$this->_g
etPostRepl
yBox();
|
|
|
28 |
|
|
|
|
29 |
|
$s
Ret .= '</
div>';
|
|
|
30 |
|
|
|
|
31 |
|
$s
Ret .= $th
is->getCmt
sInit ();
|
|
|
32 |
|
|
|
|
33 |
|
re
turn $sRet
;
|
|
|
34 |
|
}
|
|
|
35 |
|
|
|
|
36 |
|
/**
|
|
|
37 |
|
* get
comments
list for s
pecified p
arent comm
ent
|
|
|
38 |
|
*
|
|
|
39 |
|
* @pa
ram int $i
CmtsParent
Id - paren
t comment
to get chi
ld comment
s from
|
|
|
40 |
|
*/
|
|
|
41 |
|
functi
on getComm
ents ($iCm
tsParentId
= 0, &$iO
verflow, &
$iCountTot
al)
|
|
|
42 |
|
{
|
|
|
43 |
|
gl
obal $site
;
|
|
|
44 |
|
|
|
|
45 |
|
$i
PerView =
$this->get
PerView ()
;
|
|
|
46 |
|
|
|
|
47 |
|
$s
Ret = '<ul
class="cm
ts">';
|
|
|
48 |
|
|
|
|
49 |
|
$a
Cmts = $th
is->getCom
mentsArray
($iCmtsPa
rentId);
|
|
|
50 |
|
if
(!$aCmts)
|
|
|
51 |
|
{
|
|
|
52 |
|
$sRet .=
'<li clas
s="cmt-no"
>' . _t('_
There are
no comment
s yet') .
'</li>';
|
|
|
53 |
|
}
|
|
|
54 |
|
el
se
|
|
|
55 |
|
{
|
|
|
56 |
|
$i = 0;
|
|
|
57 |
|
for ( re
set($aCmts
) ; list (
$k, $r) =
each ($aCm
ts) ; ++$
i)
|
|
|
58 |
|
{
|
|
|
59 |
|
$sCl
ass = "";
|
|
|
60 |
|
$isO
wnComment
= $r['cmt_
author_id'
] == $this
->_getAuth
orId();
|
|
|
61 |
|
if (
$isOwnComm
ent)
|
|
|
62 |
|
$sClass =
' cmt-mine
';
|
|
|
63 |
|
|
|
|
64 |
|
$sRe
t .= '<li
id="cmt'.$
r['cmt_id'
].'" class
="cmt' . $
sClass . '
" ' . ( 0
== $iCmtsP
arentId &&
$i >= $iP
erView ? '
style="dis
play:none"
' : '') .
'>';
|
|
|
65 |
|
|
|
|
66 |
|
$sRe
t .= $this
->_getComm
entHeadBox
($r);
|
|
|
67 |
|
|
|
|
68 |
|
$sSt
yle = '';
|
|
|
69 |
|
if (
-1 == $r['
cmt_rated'
] || $r['c
mt_rate']
< $this->_
aSystem['v
iewing_thr
eshold'])
|
|
|
70 |
|
$sStyle =
' style="d
isplay:non
e" ';
|
|
|
71 |
|
|
|
|
72 |
|
$sRe
t .= '<div
class="cm
t-cont" '
. $sStyle
. '>';
|
|
|
73 |
|
|
|
|
74 |
|
$sRe
t .= $this
->_getComm
entBodyBox
($r);
|
|
|
75 |
|
|
|
|
76 |
|
if (
$r['cmt_re
plies'])
|
|
|
77 |
|
$sRet .= $
this->_get
RepliesBox
($r);
|
|
|
78 |
|
else
if ($this
->isPostRe
plyAllowed
())
|
|
|
79 |
|
$sRet .= $
this->_get
PostReplyB
oxTo($r);
|
|
|
80 |
|
|
|
|
81 |
|
$sRe
t .= '</di
v>';
|
|
|
82 |
|
|
|
|
83 |
|
$sRe
t .= '</li
>';
|
|
|
84 |
|
}
|
|
|
85 |
|
}
|
|
|
86 |
|
|
|
|
87 |
|
if
($aCmts &
& 0 != $iC
mtsParentI
d && $this
->isPostRe
plyAllowed
())
|
|
|
88 |
|
{
|
|
|
89 |
|
$aCmtPar
ent = $thi
s->getCOmm
entRow($iC
mtsParentI
d);
|
|
|
90 |
|
$sRet .=
'<li clas
s="cmt-rep
ly-to">';
|
|
|
91 |
|
$sRet .=
'<a href=
"#" onclic
k="' . $th
is->_sJsOb
jName . '.
toggleRepl
y(this, \'
' . $iCmts
ParentId .
'\'); ret
urn false;
">' . _t('
_Reply to
Someone co
mment', $a
CmtParent[
'cmt_autho
r_name'])
. '</a>';
|
|
|
92 |
|
$sRet .=
'</li>';
|
|
|
93 |
|
}
|
|
|
94 |
|
|
|
|
95 |
|
$s
Ret .= '</
ul>';
|
|
|
96 |
|
|
|
|
97 |
|
if
(null !==
$iOverflo
w && $i >
$iPerView)
|
|
|
98 |
|
$iOverfl
ow = 1;
|
|
|
99 |
|
|
|
|
100 |
|
if
(null !==
$iCountTo
tal)
|
|
|
101 |
|
$iCountT
otal = cou
nt($aCmts)
;
|
|
|
102 |
|
|
|
|
103 |
|
re
turn $sRet
;
|
|
|
104 |
|
}
|
|
|
105 |
|
|
|
|
106 |
|
/**
|
|
|
107 |
|
* get
one just
posted com
ment
|
|
|
108 |
|
*
|
|
|
109 |
|
* @pa
ram int $i
CmtId - co
mment id
|
|
|
110 |
|
* @re
turn strin
g
|
|
|
111 |
|
*/
|
|
|
112 |
|
functi
on getComm
ent ($iCmt
Id)
|
|
|
113 |
|
{
|
|
|
114 |
|
$r
= $this->
getComment
Row ($iCmt
Id);
|
|
|
115 |
|
|
|
|
116 |
|
$s
Ret = '<li
id="cmt'.
$r['cmt_id
'].'" clas
s="cmt cmt
-mine cmt-
just-poste
d">';
|
|
|
117 |
|
|
|
|
118 |
|
$s
Ret .= $th
is->_getCo
mmentHeadB
ox ($r, tr
ue);
|
|
|
119 |
|
|
|
|
120 |
|
$s
Style = ''
;
|
|
|
121 |
|
if
(-1 == $r
['cmt_rate
d'] || $r[
'cmt_rate'
] < $this-
>_aSystem[
'viewing_t
hreshold']
)
|
|
|
122 |
|
$sStyle
= ' style=
"display:n
one" ';
|
|
|
123 |
|
$s
Ret .= '<d
iv class="
cmt-cont"
' . $sStyl
e . '>';
|
|
|
124 |
|
|
|
|
125 |
|
$s
Ret .= $th
is->_getCo
mmentBodyB
ox ($r);
|
|
|
126 |
|
|
|
|
127 |
|
if
($r['cmt_
replies'])
|
|
|
128 |
|
$sRet .=
$this->_g
etRepliesB
ox($r);
|
|
|
129 |
|
|
|
|
130 |
|
$s
Ret .= '</
div>';
|
|
|
131 |
|
|
|
|
132 |
|
$s
Ret .= '</
li>';
|
|
|
133 |
|
|
|
|
134 |
|
re
turn $sRet
;
|
|
|
135 |
|
}
|
|
|
136 |
|
|
|
|
137 |
|
/**
|
|
|
138 |
|
* Get
comments
css file s
tring
|
|
|
139 |
|
*
|
|
|
140 |
|
* @re
turn strin
g
|
|
|
141 |
|
*/
|
|
|
142 |
|
functi
on getExtr
aCss ()
|
|
|
143 |
|
{
|
|
|
144 |
|
gl
obal $site
;
|
|
|
145 |
|
gl
obal $tmpl
;
|
|
|
146 |
|
re
turn '<lin
k href="'.
$site['url
'].'templa
tes/tmpl_'
.$tmpl.'/c
ss/cmts.cs
s" rel="st
ylesheet"
type="text
/css" />';
|
|
|
147 |
|
}
|
|
|
148 |
|
|
|
|
149 |
|
/**
|
|
|
150 |
|
* Get
comments
js file st
ring
|
|
|
151 |
|
*
|
|
|
152 |
|
* @re
turn strin
g
|
|
|
153 |
|
*/
|
|
|
154 |
|
functi
on getExtr
aJs ()
|
|
|
155 |
|
{
|
|
|
156 |
|
gl
obal $site
;
|
|
|
157 |
|
re
turn '<scr
ipt src="'
.$site['ur
l'].'inc/j
s/classes/
BxDolCmts.
js" type="
text/javas
cript" lan
guage="jav
ascript"><
/script>';
|
|
|
158 |
|
}
|
|
|
159 |
|
|
|
|
160 |
|
/**
|
|
|
161 |
|
* Get
initializ
ation sect
ion of com
ments box
|
|
|
162 |
|
*
|
|
|
163 |
|
* @re
turn strin
g
|
|
|
164 |
|
*/
|
|
|
165 |
|
functi
on getCmts
Init ()
|
|
|
166 |
|
{
|
|
|
167 |
|
gl
obal $site
;
|
|
|
168 |
|
|
|
|
169 |
|
$r
et = "
|
|
|
170 |
|
<script>
|
|
|
171 |
|
var
" . $this-
>_sJsObjNa
me . " = n
ew BxDolCm
ts({
|
|
|
172 |
|
sObjName :
'".$this-
>_sJsObjNa
me."',
|
|
|
173 |
|
sBaseUrl :
'" . $sit
e['url'] .
"',
|
|
|
174 |
|
sSystem :
'" . $this
->getSyste
mName() .
"',
|
|
|
175 |
|
iObjId : '
" . $this-
>getId ()
. "',
|
|
|
176 |
|
sDefaultEr
rMsg : '".
_t('_Error
occured')
."',
|
|
|
177 |
|
sConfirmMs
g : '"._t(
'_Are you
sure?')."'
,
|
|
|
178 |
|
sAnimation
Effect : '
" . $this-
>_aSystem[
'animation
_effect']
. "',
|
|
|
179 |
|
sAnimation
Speed : '"
. $this->
_aSystem['
animation_
speed'] .
"',
|
|
|
180 |
|
isEditAllo
wed : ".(
$this->isE
ditAllowed
() || $thi
s->isEditA
llowedAll(
) ? 1 : 0)
.",
|
|
|
181 |
|
isRemoveAl
lowed : ".
( $this->i
sRemoveAll
owed() ||
$this->isR
emoveAllow
edAll() ?
1 : 0).",
|
|
|
182 |
|
iSecsToEdi
t : ".(int
)$this->ge
tAllowedEd
itTime()."
});
|
|
|
183 |
|
" .
$this->_sJ
sObjName .
".oCmtEle
ments = {"
;
|
|
|
184 |
|
|
|
|
185 |
|
fo
r (reset($
this->_aCm
tElements)
; list($k,
$r) = each
($this->_
aCmtElemen
ts) ; )
|
|
|
186 |
|
{
|
|
|
187 |
|
$ret .=
"\n'$k' :
{ 'reg' :
'{$r['reg'
]}', 'msg'
: '{$r['m
sg']}' },"
;
|
|
|
188 |
|
}
|
|
|
189 |
|
$r
et = subst
r($ret, 0,
-1);
|
|
|
190 |
|
$r
et .= "\n}
;
|
|
|
191 |
|
</script
>";
|
|
|
192 |
|
|
|
|
193 |
|
re
turn $this
->getExtra
Js() . $re
t;
|
|
|
194 |
|
}
|
|
|
195 |
|
|
|
|
196 |
|
/** pr
ivate func
tions
|
|
|
197 |
|
******
**********
**********
**********
*********/
|
|
|
198 |
|
|
|
|
199 |
|
functi
on _getCom
mentHeadBo
x (&$a, $i
sJustPoste
d = false)
|
|
|
200 |
|
{
|
|
|
201 |
|
if
($a['cmt_
author_id'
] && $a['c
mt_author_
name'])
|
|
|
202 |
|
$sAuthor
= '<a hre
f="' . get
ProfileLin
k($a['cmt_
author_id'
]) . '">'
. $a['cmt_
author_nam
e'] . '</a
>';
|
|
|
203 |
|
el
se
|
|
|
204 |
|
$sAuthor
= _t('_An
onymous');
|
|
|
205 |
|
|
|
|
206 |
|
$s
Ret = '<di
v class="c
mt-head">'
. $this->
_getAuthor
Icon ($a)
. _t('_By'
) . ' ' .
$sAuthor .
' ' . $a[
'cmt_ago']
;
|
|
|
207 |
|
if
($this->i
sRatable()
)
|
|
|
208 |
|
$sRet .=
$this->_g
etRateBox(
$a);
|
|
|
209 |
|
$s
Ret .= '</
div>';
|
|
|
210 |
|
|
|
|
211 |
|
if
($isJustP
osted || $
a['cmt_aut
hor_id'] =
= $this->_
getAuthorI
d() || $th
is->isEdit
AllowedAll
() || $thi
s->isRemov
eAllowedAl
l())
|
|
|
212 |
|
$sRet .=
$this->_g
etActionsB
ox ($a, $i
sJustPoste
d);
|
|
|
213 |
|
|
|
|
214 |
|
re
turn $sRet
;
|
|
|
215 |
|
}
|
|
|
216 |
|
|
|
|
217 |
|
functi
on _getCom
mentBodyBo
x (&$a)
|
|
|
218 |
|
{
|
|
|
219 |
|
re
turn '<div
class="cm
t-body">'
. $a['cmt_
text'] . '
</div>';
|
|
|
220 |
|
}
|
|
|
221 |
|
|
|
|
222 |
|
functi
on _getRat
eBox(&$a)
|
|
|
223 |
|
{
|
|
|
224 |
|
$s
Class = ''
;
|
|
|
225 |
|
if
($a['cmt_
rated'] ||
$a['cmt_r
ate'] < $t
his->_aSys
tem['viewi
ng_thresho
ld'])
|
|
|
226 |
|
$sClass
= ' cmt-ra
te-disable
d';
|
|
|
227 |
|
|
|
|
228 |
|
$s
Hidden = '
';
|
|
|
229 |
|
if
(-1 == $a
['cmt_rate
d'] || $a[
'cmt_rate'
] < $this-
>_aSystem[
'viewing_t
hreshold']
)
|
|
|
230 |
|
$sHidden
= '<u>' .
_t ('_bur
ied') . '
(<a href="
#" id="cmt
-hid-'.$a[
'cmt_id'].
'" class="
cmt-hid">'
. _t('_to
ggle') . '
</a>)</u>'
;
|
|
|
231 |
|
|
|
|
232 |
|
re
turn '<div
class="cm
t-rate'.$s
Class.'">
' . $sHidd
en . '
|
|
|
233 |
|
'._t( (1
== $a['cm
t_rate'] |
| -1 == $a
['cmt_rate
']) ? '_N
point' :
'_N points
', $a['cmt
_rate']).'
|
|
|
234 |
|
<a title
="'._t('_T
humb Up').
'" href="#
" id="cmt-
pos-'.$a['
cmt_id'].'
" class="c
mt-pos">&#
160;</a>
|
|
|
235 |
|
<a title
="'._t('_T
humb Down'
).'" href=
"#" id="cm
t-neg-'.$a
['cmt_id']
.'" class=
"cmt-neg">
 </a>
|
|
|
236 |
|
</div>';
|
|
|
237 |
|
}
|
|
|
238 |
|
|
|
|
239 |
|
functi
on _getAct
ionsBox (&
$a, $isJus
tPosted)
|
|
|
240 |
|
{
|
|
|
241 |
|
$n
= $this->
getAllowed
EditTime()
;
|
|
|
242 |
|
$i
sEditAllow
edPermanen
tly = $thi
s->isEditA
llowed() |
| $this->i
sEditAllow
edAll();
|
|
|
243 |
|
$i
sRemoveAll
owedPerman
ently = $t
his->isRem
oveAllowed
() || $thi
s->isRemov
eAllowedAl
l();
|
|
|
244 |
|
if
(!($n &&
$isJustPos
ted) && !$
isEditAllo
wedPermane
ntly) retu
rn '';
|
|
|
245 |
|
|
|
|
246 |
|
$s
Ret = '<d
iv id="cmt
-jp-'.$a['
cmt_id'].'
" class="c
mt-jp">';
|
|
|
247 |
|
|
|
|
248 |
|
if
($isEditA
llowedPerm
anently ||
($isJustP
osted && $
n))
|
|
|
249 |
|
$sRet .=
'<a title
="'._t('_E
dit').'" h
ref="#" on
click="' .
$this->_s
JsObjName
. '.cmtEdi
t(this, \'
' . $a['cm
t_id'] . '
\'); retur
n false;">
'._t('_Edi
t').'</a>'
;
|
|
|
250 |
|
|
|
|
251 |
|
if
($isRemov
eAllowedPe
rmanently
|| ($isJus
tPosted &&
$n))
|
|
|
252 |
|
$sRet .=
'<a title
="'._t('_R
emove').'"
href="#"
onclick="'
. $this->
_sJsObjNam
e . '.cmtR
emove(this
, \'' . $a
['cmt_id']
. '\'); r
eturn fals
e;">'._t('
_Remove').
'</a>';
|
|
|
253 |
|
|
|
|
254 |
|
if
($isJustP
osted && $
n && !$isE
ditAllowed
Permanentl
y) $sRet .
= _t('_(av
ailable fo
r <span>N<
/span> sec
onds)', $n
);
|
|
|
255 |
|
|
|
|
256 |
|
$s
Ret .= '</
div>';
|
|
|
257 |
|
|
|
|
258 |
|
re
turn $sRet
;
|
|
|
259 |
|
}
|
|
|
260 |
|
|
|
|
261 |
|
functi
on _getRep
liesBox (&
$a)
|
|
|
262 |
|
{
|
|
|
263 |
|
$s
Ret = '<d
iv class="
cmt-replie
s">';
|
|
|
264 |
|
$s
Ret .= '<a
class="cm
t-replies-
show" href
="#" oncli
ck="' . $t
his->_sJsO
bjName . '
.toggleCmt
s(this, \'
' . $a['cm
t_id'] . '
\'); retur
n false;">
' . _t('_S
how N repl
ies', $a['
cmt_replie
s']) . '</
a>';
|
|
|
265 |
|
$s
Ret .= '<a
class="cm
t-replies-
hide" href
="#" oncli
ck="' . $t
his->_sJsO
bjName . '
.toggleCmt
s(this, \'
' . $a['cm
t_id'] . '
\'); retur
n false;">
' . _t('_H
ide N repl
ies', $a['
cmt_replie
s']) . '</
a>';
|
|
|
266 |
|
re
turn ($sRe
t .= '</di
v>');
|
|
|
267 |
|
}
|
|
|
268 |
|
|
|
|
269 |
|
functi
on _getPos
tReplyBoxT
o (&$a)
|
|
|
270 |
|
{
|
|
|
271 |
|
re
turn '<div
class="cm
t-post-rep
ly-to">
|
|
|
272 |
|
<a href="#
" onclick=
"' . $this
->_sJsObjN
ame . '.to
ggleReply(
this, \''.
$a['cmt_id
'].'\'); r
eturn fals
e;">' . _t
('_Reply t
o this com
ment') . '
</a>
|
|
|
273 |
|
</di
v>';
|
|
|
274 |
|
}
|
|
|
275 |
|
|
|
|
276 |
|
functi
on _getPos
tReplyBox
()
|
|
|
277 |
|
{
|
|
|
278 |
|
re
turn '
|
|
|
279 |
|
<div
class="cm
t-post-rep
ly">
|
|
|
280 |
|
<div class
="cmt-repl
y-head">
|
|
|
281 |
|
<a hre
f="#" oncl
ick="' . $
this->_sJs
ObjName .
'.toggleRe
ply(this,
\'0\'); re
turn false
;">' . _t(
'_Add Your
Comment')
. '</a>
|
|
|
282 |
|
</div>
|
|
|
283 |
|
' . $this-
>_getFormB
ox() . '
|
|
|
284 |
|
</di
v>';
|
|
|
285 |
|
}
|
|
|
286 |
|
|
|
|
287 |
|
functi
on _getFor
mBox ($sTe
xt = '', $
iCmtParent
Id = 0, $s
Func = 'su
bmitCommen
t(this)')
|
|
|
288 |
|
{
|
|
|
289 |
|
re
turn '<for
m name="cm
t-post-rep
ly" onsubm
it="' . $t
his->_sJsO
bjName . '
.' . $sFun
c . '; ret
urn false;
">
|
|
|
290 |
|
<textarea
name="CmtT
ext">'.$sT
ext.'</tex
tarea>
|
|
|
291 |
|
<input typ
e="hidden"
name="Cmt
Parent" va
lue="'.$iC
mtParentId
.'" />
|
|
|
292 |
|
<br />
|
|
|
293 |
|
<input typ
e="submit"
value="'.
_t('_Submi
t Comment'
).'" />
|
|
|
294 |
|
</fo
rm>';
|
|
|
295 |
|
|
|
|
296 |
|
}
|
|
|
297 |
|
|
|
|
298 |
|
functi
on _getAut
horIcon ($
a)
|
|
|
299 |
|
{
|
|
|
300 |
|
gl
obal $site
, $tmpl;
|
|
|
301 |
|
if
($a['cmt_
author_ico
n'])
|
|
|
302 |
|
return '
<img class
="cmt-icon
" alt="'.$
a['cmt_aut
hor_name']
.'" src="'
. $site['
profileIma
ge'] . $a[
'cmt_autho
r_id'] . '
/' . 'icon
_' . $a['c
mt_author_
icon'] . '
" />';
|
|
|
303 |
|
el
se
|
|
|
304 |
|
return '
<img class
="cmt-icon
" alt="'.$
a['cmt_aut
hor_name']
.'" src="'
. $site['
url'] . "t
emplates/t
mpl_{$tmpl
}/images/i
cons/cmt-m
ale.gif\"
/>";
|
|
|
305 |
|
}
|
|
|
306 |
|
}
|
|
|
307 |
|
?>
|