No regular expressions were active.
1 |
|
<?
|
|
|
2 |
|
|
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
|
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
|
|
5 |
|
*
---------
--------
|
|
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
|
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
|
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
|
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
|
|
10 |
|
*
|
|
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
|
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
|
|
13 |
|
*
|
|
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
|
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
|
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
|
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
|
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
|
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
|
20 |
|
|
|
|
21 |
|
require_on
ce( 'heade
r.inc.php'
);
|
|
|
22 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
b.inc.php'
);
|
|
|
23 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'u
tils.inc.p
hp' );
|
|
|
24 |
|
|
|
|
25 |
|
$dirGroups
= 'groups
/';
|
|
|
26 |
|
|
|
|
27 |
|
define( 'B
X_DIRECTOR
Y_PATH_GRO
UPS', BX_D
IRECTORY_P
ATH_ROOT .
$dirGroup
s );
|
|
|
28 |
|
define( 'B
X_DIRECTOR
Y_PATH_GRO
UPS_GALLER
Y', BX_DIR
ECTORY_PAT
H_GROUPS .
"gallery/
" );
|
|
|
29 |
|
|
|
|
30 |
|
$site['gro
ups']
= "{$s
ite['url']
}{$dirGrou
ps}";
|
|
|
31 |
|
$site['gro
ups_galler
y'] = "{$s
ite['group
s']}galler
y/";
|
|
|
32 |
|
|
|
|
33 |
|
function s
howMyGroup
s( $member
ID )
|
|
|
34 |
|
{
|
|
|
35 |
|
global
$site;
|
|
|
36 |
|
|
|
|
37 |
|
$membe
rID = (int
)$memberID
;
|
|
|
38 |
|
if ( !
$memberID
)
|
|
|
39 |
|
re
turn false
;
|
|
|
40 |
|
|
|
|
41 |
|
$arrGr
oups = get
MyGroups(
$memberID
);
|
|
|
42 |
|
|
|
|
43 |
|
ob_sta
rt();
|
|
|
44 |
|
if ( !
$arrGroups
)
|
|
|
45 |
|
{
|
|
|
46 |
|
?>
|
|
|
47 |
|
<div cla
ss="mygrou
ps_no"><?=
_t("_No my
groups fo
und")?></d
iv>
|
|
|
48 |
|
<?
php
|
|
|
49 |
|
}
|
|
|
50 |
|
else
|
|
|
51 |
|
{
|
|
|
52 |
|
?>
|
|
|
53 |
|
<div cla
ss="mygrou
ps_contain
er">
|
|
|
54 |
|
<div
class="cl
ear_both">
</div>
|
|
|
55 |
|
<?
php
|
|
|
56 |
|
fo
reach ( $a
rrGroups a
s $arrGrou
p )
|
|
|
57 |
|
{
|
|
|
58 |
|
$groupID
= $arrGro
up['ID'];
|
|
|
59 |
|
$groupUr
l = "{$sit
e['url']}g
roup.php?I
D=$groupID
";
|
|
|
60 |
|
|
|
|
61 |
|
if ( $ar
rGroup['th
umb'] and
file_exist
s(BX_DIREC
TORY_PATH_
GROUPS_GAL
LERY . "{$
arrGroup['
ID']}_{$ar
rGroup['th
umb']}_{$a
rrGroup['s
eed']}_.{$
arrGroup['
thumbExt']
}" ) )
|
|
|
62 |
|
$fil
eGroupThum
b = "{$sit
e['groups_
gallery']}
{$arrGroup
['ID']}_{$
arrGroup['
thumb']}_{
$arrGroup[
'seed']}_.
{$arrGroup
['thumbExt
']}";
|
|
|
63 |
|
else
|
|
|
64 |
|
$fil
eGroupThum
b = "{$sit
e['groups_
gallery']}
no_pic.gif
";
|
|
|
65 |
|
$sSpacer
Path = $si
te['url'].
'templates
/base/imag
es/icons/s
pacer.gif'
;
|
|
|
66 |
|
$sGrpImg
= <<<EOF
|
|
|
67 |
|
<img class
="photo1"
alt="{$arr
Group['Nam
e']}" src=
"{$sSpacer
Path}" sty
le="width:
110px; he
ight: 110p
x; backgro
und-image:
url({$fil
eGroupThum
b});"/>
|
|
|
68 |
|
EOF;
|
|
|
69 |
|
?>
|
|
|
70 |
|
<div
class="my
group_cont
ainer">
|
|
|
71 |
|
<div class
="mygroup_
name">
|
|
|
72 |
|
<a hre
f="<?=$gro
upUrl?>" c
lass="acti
ons">
|
|
|
73 |
|
<?
=htmlspeci
alchars_ad
v( $arrGro
up['Name']
)?>
|
|
|
74 |
|
</a>
|
|
|
75 |
|
</div>
|
|
|
76 |
|
<div class
="thumbnai
l_block">
|
|
|
77 |
|
<a hre
f="<?=$gro
upUrl?>">
|
|
|
78 |
|
<?
=$sGrpImg?
>
|
|
|
79 |
|
</a>
|
|
|
80 |
|
</div>
|
|
|
81 |
|
<?php
|
|
|
82 |
|
if ( (in
t)$arrGrou
p['isCreat
or'] )
|
|
|
83 |
|
{
|
|
|
84 |
|
?>
|
|
|
85 |
|
<div class
="mygroup_
leader_is"
><?=_t("_g
roup creat
or") ?></d
iv>
|
|
|
86 |
|
<?ph
p
|
|
|
87 |
|
}
|
|
|
88 |
|
?>
|
|
|
89 |
|
</di
v>
|
|
|
90 |
|
<?php
|
|
|
91 |
|
}
|
|
|
92 |
|
?>
|
|
|
93 |
|
<div
class="cl
ear_both">
</div>
|
|
|
94 |
|
</div>
|
|
|
95 |
|
<?
php
|
|
|
96 |
|
}
|
|
|
97 |
|
|
|
|
98 |
|
return
ob_get_cl
ean();
|
|
|
99 |
|
}
|
|
|
100 |
|
|
|
|
101 |
|
function g
etMyGroups
( $memberI
D )
|
|
|
102 |
|
{
|
|
|
103 |
|
$membe
rID = (int
)$memberID
;
|
|
|
104 |
|
if ( !
$memberID
)
|
|
|
105 |
|
re
turn null;
|
|
|
106 |
|
|
|
|
107 |
|
$query
= "
|
|
|
108 |
|
SE
LECT
|
|
|
109 |
|
`Groups`
.`ID`,
|
|
|
110 |
|
`Groups`
.`Name`,
|
|
|
111 |
|
IF( `Gro
ups`.`crea
torID` = $
memberID,
1, 0 ) AS
`isCreator
`,
|
|
|
112 |
|
`Groups`
.`thumb`,
|
|
|
113 |
|
`GroupsG
allery`.`s
eed`,
|
|
|
114 |
|
`GroupsG
allery`.`e
xt` AS `th
umbExt`
|
|
|
115 |
|
|
|
|
116 |
|
FR
OM `Groups
Members`,
`Groups`
|
|
|
117 |
|
LE
FT JOIN `G
roupsGalle
ry`
|
|
|
118 |
|
ON
`Groups`.
`thumb` =
`GroupsGal
lery`.`ID`
|
|
|
119 |
|
|
|
|
120 |
|
WH
ERE
|
|
|
121 |
|
`GroupsM
embers`.`m
emberID` =
$memberID
AND
|
|
|
122 |
|
`GroupsM
embers`.`g
roupID` =
`Groups`.
`ID` AND
|
|
|
123 |
|
`GroupsM
embers`.`s
tatus` =
'Active'
|
|
|
124 |
|
";
|
|
|
125 |
|
|
|
|
126 |
|
$resGr
oups = db_
res( $quer
y );
|
|
|
127 |
|
|
|
|
128 |
|
if ( !
$resGroups
or !mysql
_num_rows(
$resGroup
s ) )
|
|
|
129 |
|
re
turn null;
|
|
|
130 |
|
|
|
|
131 |
|
$arrGr
oups = arr
ay();
|
|
|
132 |
|
|
|
|
133 |
|
while
( $arrGrou
p = mysql_
fetch_asso
c( $resGro
ups ) )
|
|
|
134 |
|
{
|
|
|
135 |
|
$g
roupID = $
arrGroup['
ID'];
|
|
|
136 |
|
$a
rrGroups[
$groupID ]
= $arrGro
up;
|
|
|
137 |
|
}
|
|
|
138 |
|
|
|
|
139 |
|
return
$arrGroup
s;
|
|
|
140 |
|
}
|
|
|
141 |
|
|
|
|
142 |
|
function g
etGroupInf
o( $groupI
D )
|
|
|
143 |
|
{
|
|
|
144 |
|
$group
ID = (int)
$groupID;
|
|
|
145 |
|
if ( !
$groupID )
|
|
|
146 |
|
re
turn null;
|
|
|
147 |
|
|
|
|
148 |
|
$query
= "
|
|
|
149 |
|
SE
LECT
|
|
|
150 |
|
`Groups`
.*,
|
|
|
151 |
|
`GroupsC
ateg`.`Nam
e` AS `cat
egName`,
|
|
|
152 |
|
COUNT( `
GroupsMemb
ers`.`memb
erID` ) A
S `member
sCount`,
|
|
|
153 |
|
`GroupsG
allery`.`e
xt` AS `
thumbExt`,
|
|
|
154 |
|
`GroupsG
allery`.`s
eed`
|
|
|
155 |
|
FR
OM `Groups
`
|
|
|
156 |
|
IN
NER JOIN `
GroupsCate
g` ON
|
|
|
157 |
|
`GroupsC
ateg`.`ID`
= `Groups
`.`categID
`
|
|
|
158 |
|
LE
FT JOIN `G
roupsGalle
ry` ON
|
|
|
159 |
|
`Groups`
.`thumb` =
`GroupsGa
llery`.`ID
`
|
|
|
160 |
|
LE
FT JOIN `G
roupsMembe
rs` ON
|
|
|
161 |
|
`GroupsM
embers`.`g
roupID` =
`Groups`.`
ID` AND
|
|
|
162 |
|
`GroupsM
embers`.`s
tatus` = '
Active'
|
|
|
163 |
|
WH
ERE
|
|
|
164 |
|
`Groups`
.`ID` = $g
roupID
|
|
|
165 |
|
GR
OUP BY `Gr
oups`.`ID`
|
|
|
166 |
|
";
|
|
|
167 |
|
|
|
|
168 |
|
$arrGr
oup = db_a
ssoc_arr(
$query );
|
|
|
169 |
|
return
$arrGroup
;
|
|
|
170 |
|
}
|
|
|
171 |
|
|
|
|
172 |
|
function i
sGroupName
Exists( $N
ame )
|
|
|
173 |
|
{
|
|
|
174 |
|
$res =
db_res( "
SELECT `Na
me` FROM `
Groups` WH
ERE UPPER(
`Name`)='"
. addslas
hes(strtou
pper($Name
)) . "' LI
MIT 1" );
|
|
|
175 |
|
|
|
|
176 |
|
if( $r
es and mys
ql_num_row
s( $res )
)
|
|
|
177 |
|
re
turn true;
|
|
|
178 |
|
else
|
|
|
179 |
|
re
turn false
;
|
|
|
180 |
|
}
|
|
|
181 |
|
|
|
|
182 |
|
function i
sGroupMemb
er( $membe
rID, $grou
pID, $chec
kActiveSta
tus = true
)
|
|
|
183 |
|
{
|
|
|
184 |
|
/*glob
al $aMemSt
atusCache;
|
|
|
185 |
|
|
|
|
186 |
|
if( !i
s_array( $
aMemStatus
Cache ) )
|
|
|
187 |
|
{
|
|
|
188 |
|
$a
MemStatusC
ache = arr
ay();
|
|
|
189 |
|
$r
Status = d
b_res( "SE
LECT * FRO
M `GroupsM
embers` OR
DER BY `gr
oupID`,`me
mberID`" )
;
|
|
|
190 |
|
wh
ile( $aSta
tus = mysq
l_fetch_as
soc( $rSta
tus ) )
|
|
|
191 |
|
$aMemSta
tusCache[$
aStatus['g
roupID']][
$aStatus['
memberID']
] = $aStat
us['status
'];
|
|
|
192 |
|
}*/
|
|
|
193 |
|
|
|
|
194 |
|
$membe
rID = (int
)$memberID
;
|
|
|
195 |
|
$group
ID = (int)
$groupID;
|
|
|
196 |
|
|
|
|
197 |
|
if ( !
$memberID
or !$group
ID )
|
|
|
198 |
|
re
turn false
;
|
|
|
199 |
|
|
|
|
200 |
|
$query
= "SELECT
`Status`
FROM `Grou
psMembers`
|
|
|
201 |
|
WH
ERE `membe
rID` = $me
mberID AND
`groupID`
= $groupI
D" .
|
|
|
202 |
|
(
$checkActi
veStatus ?
" AND `St
atus`='Act
ive'" : ''
);
|
|
|
203 |
|
|
|
|
204 |
|
$res =
db_res( $
query );
|
|
|
205 |
|
if ( $
res and my
sql_num_ro
ws( $res )
)
|
|
|
206 |
|
re
turn true;
|
|
|
207 |
|
else
|
|
|
208 |
|
re
turn false
;
|
|
|
209 |
|
|
|
|
210 |
|
/*if(
isset( $aM
emStatusCa
che[$group
ID][$membe
rID] ) )
|
|
|
211 |
|
if
( $checkAc
tiveStatus
)
|
|
|
212 |
|
if( $aMe
mStatusCac
he[$groupI
D][$member
ID] == 'Ac
tive' )
|
|
|
213 |
|
retu
rn true;
|
|
|
214 |
|
else
|
|
|
215 |
|
retu
rn false;
|
|
|
216 |
|
el
se
|
|
|
217 |
|
return t
rue;*/
|
|
|
218 |
|
|
|
|
219 |
|
//retu
rn false;
|
|
|
220 |
|
|
|
|
221 |
|
//echo
"isMember
Results: .
$result. .
$result1."
;
|
|
|
222 |
|
|
|
|
223 |
|
}
|
|
|
224 |
|
|
|
|
225 |
|
function g
etDefaultG
roupEditAr
r()
|
|
|
226 |
|
{
|
|
|
227 |
|
$arr =
array(
|
|
|
228 |
|
'N
ame' => ar
ray(
|
|
|
229 |
|
'Name' =
> 'Name',
|
|
|
230 |
|
'Caption
' => 'Grou
p name',
|
|
|
231 |
|
'Type' =
> 'text',
|
|
|
232 |
|
'Len' =>
64
|
|
|
233 |
|
),
|
|
|
234 |
|
'c
ategID' =>
array(
|
|
|
235 |
|
'Name' =
> 'categID
',
|
|
|
236 |
|
'Caption
' => 'Cate
gory',
|
|
|
237 |
|
'Type' =
> 'dropdow
n'
|
|
|
238 |
|
),
|
|
|
239 |
|
'o
pen_join'
=> array(
|
|
|
240 |
|
'Name' =
> 'open_jo
in',
|
|
|
241 |
|
'Caption
' => 'Open
join',
|
|
|
242 |
|
'Type' =
> 'bool',
|
|
|
243 |
|
'Value'
=> true,
|
|
|
244 |
|
'HelpInd
ex' => 1
|
|
|
245 |
|
),
|
|
|
246 |
|
'h
idden_grou
p' => arra
y(
|
|
|
247 |
|
'Name' =
> 'hidden_
group',
|
|
|
248 |
|
'Caption
' => 'Hidd
en group',
|
|
|
249 |
|
'Type' =
> 'bool',
|
|
|
250 |
|
'Value'
=> false,
|
|
|
251 |
|
'HelpInd
ex' => 2
|
|
|
252 |
|
),
|
|
|
253 |
|
'm
embers_pos
t_images'
=> array(
|
|
|
254 |
|
'Name' =
> 'members
_post_imag
es',
|
|
|
255 |
|
'Caption
' => 'Memb
ers can po
st images'
,
|
|
|
256 |
|
'Type' =
> 'bool',
|
|
|
257 |
|
'Value'
=> true,
|
|
|
258 |
|
'HelpInd
ex' => 3
|
|
|
259 |
|
),
|
|
|
260 |
|
'm
embers_inv
ite' => ar
ray(
|
|
|
261 |
|
'Name' =
> 'members
_invite',
|
|
|
262 |
|
'Caption
' => 'Memb
ers can in
vite',
|
|
|
263 |
|
'Type' =
> 'bool',
|
|
|
264 |
|
'Value'
=> true,
|
|
|
265 |
|
'HelpInd
ex' => 4
|
|
|
266 |
|
),
|
|
|
267 |
|
'C
ountry' =>
array(
|
|
|
268 |
|
'Name' =
> 'Country
',
|
|
|
269 |
|
'Caption
' => 'Coun
try',
|
|
|
270 |
|
'Type' =
> 'dropdow
n'
|
|
|
271 |
|
),
|
|
|
272 |
|
'C
ity' => ar
ray(
|
|
|
273 |
|
'Name' =
> 'City',
|
|
|
274 |
|
'Caption
' => 'City
',
|
|
|
275 |
|
'Type' =
> 'text',
|
|
|
276 |
|
'Len' =>
64
|
|
|
277 |
|
),
|
|
|
278 |
|
'A
bout' => a
rray(
|
|
|
279 |
|
'Name' =
> 'About',
|
|
|
280 |
|
'Caption
' => 'Abou
t group',
|
|
|
281 |
|
'Type' =
> 'text',
|
|
|
282 |
|
'Len' =>
255
|
|
|
283 |
|
),
|
|
|
284 |
|
'D
esc' => ar
ray(
|
|
|
285 |
|
'Name' =
> 'Desc',
|
|
|
286 |
|
'Caption
' => 'Grou
p descript
ion',
|
|
|
287 |
|
'Type' =
> 'html'
|
|
|
288 |
|
)
|
|
|
289 |
|
);
|
|
|
290 |
|
|
|
|
291 |
|
return
$arr;
|
|
|
292 |
|
|
|
|
293 |
|
}
|
|
|
294 |
|
|
|
|
295 |
|
function g
enGroupsDr
opdown( $a
rrField, $
showChoose
= true )
|
|
|
296 |
|
{
|
|
|
297 |
|
global
$prof;
|
|
|
298 |
|
$res =
<<<EOJ
|
|
|
299 |
|
<s
elect name
="{$arrFie
ld['Name']
}" class="
group_edit
_dropdown"
>
|
|
|
300 |
|
EOJ;
|
|
|
301 |
|
switch
( $arrFie
ld['Name']
)
|
|
|
302 |
|
{
|
|
|
303 |
|
ca
se 'Countr
y':
|
|
|
304 |
|
$arrVals
= $prof['
countries'
];
|
|
|
305 |
|
foreach
( $arrVals
as $key =
> $val )
|
|
|
306 |
|
$arr
Vals[$key]
= htmlspe
cialchars_
adv( _t( "
__{$val}"
) );
|
|
|
307 |
|
br
eak;
|
|
|
308 |
|
ca
se 'categI
D':
|
|
|
309 |
|
$arrVals
= array()
;
|
|
|
310 |
|
$resVals
= db_res(
"SELECT *
FROM `Gro
upsCateg`
ORDER BY `
Name`" );
|
|
|
311 |
|
while (
$arrVal =
mysql_fetc
h_assoc( $
resVals )
)
|
|
|
312 |
|
$arr
Vals[ $arr
Val['ID']
] = htmlsp
ecialchars
_adv( $arr
Val['Name'
] );
|
|
|
313 |
|
br
eak;
|
|
|
314 |
|
}
|
|
|
315 |
|
|
|
|
316 |
|
$res .
= '<option
value=""
'. ( $arrF
ield['Valu
e'] ? '' :
'selected
="selected
"' ) .
|
|
|
317 |
|
'>'
. _t("_Cho
ose") . "<
/option>\n
";
|
|
|
318 |
|
|
|
|
319 |
|
|
|
|
320 |
|
foreac
h ( $arrVa
ls as $Val
=> $Opt )
|
|
|
321 |
|
{
|
|
|
322 |
|
$i
sSel = ( $
arrField['
Value'] ==
$Val ? 's
elected="s
elected"'
: '' );
|
|
|
323 |
|
$r
es .= "<op
tion value
=\"$Val\"
$isSel>$Op
t</option>
\n";
|
|
|
324 |
|
}
|
|
|
325 |
|
|
|
|
326 |
|
$res .
= "</selec
t>";
|
|
|
327 |
|
|
|
|
328 |
|
return
$res;
|
|
|
329 |
|
}
|
|
|
330 |
|
|
|
|
331 |
|
function g
enGroupEdi
tForm( $ar
rGroup, $a
rrErr = fa
lse, $show
SImg = fal
se, $group
ID = 0 )
|
|
|
332 |
|
{
|
|
|
333 |
|
ob_sta
rt();
|
|
|
334 |
|
?>
|
|
|
335 |
|
<form
action="<?
=$_SERVER[
'PHP_SELF'
]?>" metho
d="POST">
|
|
|
336 |
|
<t
able class
="group_ed
it_table">
|
|
|
337 |
|
<?php
|
|
|
338 |
|
if ( $
groupID )
|
|
|
339 |
|
{
|
|
|
340 |
|
?>
|
|
|
341 |
|
<input t
ype="hidde
n" name="I
D" value="
<?=$groupI
D?>" />
|
|
|
342 |
|
<?php
|
|
|
343 |
|
}
|
|
|
344 |
|
|
|
|
345 |
|
$check
ed = 'chec
ked="check
ed"';
|
|
|
346 |
|
$nowTR
= "odd";
|
|
|
347 |
|
|
|
|
348 |
|
foreac
h ( $arrGr
oup as $ar
rField )
|
|
|
349 |
|
{
|
|
|
350 |
|
?>
|
|
|
351 |
|
<tr clas
s="group_e
dit_tr_<?=
$nowTR?>">
|
|
|
352 |
|
<td
class="gro
up_edit_td
_label"><?
=_t( '_'.$
arrField['
Caption']
)?>:</td>
|
|
|
353 |
|
<td
class="gro
up_edit_td
_value">
|
|
|
354 |
|
<div class
="group_ed
it_error"
|
|
|
355 |
|
style="d
isplay:<?=
($arrErr[$
arrField['
Name']] ?
'block' :
'none')?>"
>
|
|
|
356 |
|
<?=($a
rrErr[$arr
Field['Nam
e']] ? _t(
'_'.$arrE
rr[$arrFie
ld['Name']
] ) : '' )
?>
|
|
|
357 |
|
</div>
|
|
|
358 |
|
<?
php
|
|
|
359 |
|
sw
itch( $arr
Field['Typ
e'] )
|
|
|
360 |
|
{
|
|
|
361 |
|
case 'te
xt':
|
|
|
362 |
|
?>
|
|
|
363 |
|
<input typ
e="text" n
ame="<?=$a
rrField['N
ame']?>" c
lass="grou
p_edit_tex
t" value="
<?=htmlspe
cialchars_
adv($arrFi
eld['Value
']);?>" ma
xlength="<
?=$arrFiel
d['Len']?>
" />
|
|
|
364 |
|
<?ph
p
|
|
|
365 |
|
break;
|
|
|
366 |
|
case 'bo
ol':
|
|
|
367 |
|
?>
|
|
|
368 |
|
<input typ
e="radio"
name="<?=$
arrField['
Name']?>"
value="yes
" id="<?=$
arrField['
Name']?>_y
es" <?=$ar
rField['Va
lue'] ? $c
hecked : '
'?>>
|
|
|
369 |
|
<label for
="<?=$arrF
ield['Name
']?>_yes">
<?=_t('_Ye
s')?></lab
el>
|
|
|
370 |
|
|
|
|
371 |
|
<input typ
e="radio"
name="<?=$
arrField['
Name']?>"
value="no"
id="<?=$
arrField['
Name']?>_n
o" <?=$arr
Field['Val
ue'] ? ''
: $checked
?>>
|
|
|
372 |
|
<label for
="<?=$arrF
ield['Name
']?>_no"><
?=_t('_No'
)?></label
>
|
|
|
373 |
|
<?ph
p
|
|
|
374 |
|
if(
$arrField[
'HelpIndex
'] )
|
|
|
375 |
|
{
|
|
|
376 |
|
?>
|
|
|
377 |
|
<sp
an class="
group_help
_link">(<a
href="<?=
"{$site['u
rl']}group
s_help.php
?i={$arrFi
eld['HelpI
ndex']}"?>
" target="
_blank" on
click="win
dow.open(t
his.href,'
helpwin','
width=350,
height=200
');return
false;" ><
?=_t('_hel
p')?></a>)
</span>
|
|
|
378 |
|
<?php
|
|
|
379 |
|
}
|
|
|
380 |
|
break;
|
|
|
381 |
|
case 'ht
ml':
|
|
|
382 |
|
?>
|
|
|
383 |
|
<textarea
name="<?=$
arrField['
Name']?>"
class="gro
up_edit_ht
ml"><?=htm
lspecialch
ars_adv($a
rrField['V
alue'])?><
/textarea>
|
|
|
384 |
|
<?ph
p
|
|
|
385 |
|
break;
|
|
|
386 |
|
case 'dr
opdown':
|
|
|
387 |
|
echo
genGroups
Dropdown(
$arrField
);
|
|
|
388 |
|
break;
|
|
|
389 |
|
}
|
|
|
390 |
|
?>
|
|
|
391 |
|
</td
>
|
|
|
392 |
|
</tr>
|
|
|
393 |
|
<?
php
|
|
|
394 |
|
|
|
|
395 |
|
$n
owTR = ($n
owTR == "o
dd") ? "ev
en" : "odd
";
|
|
|
396 |
|
}
|
|
|
397 |
|
|
|
|
398 |
|
if ( $
showSImg )
|
|
|
399 |
|
{
|
|
|
400 |
|
?>
|
|
|
401 |
|
<tr clas
s="group_e
dit_tr_<?=
$nowTR?>">
|
|
|
402 |
|
<td
class="gro
up_edit_td
_label"><?
=_t( '_Ent
er what yo
u see:' )?
></td>
|
|
|
403 |
|
<td
class="gro
up_edit_td
_value" st
yle="text-
align:cent
er;">
|
|
|
404 |
|
<div class
="group_ed
it_error"
|
|
|
405 |
|
style="d
isplay:<?=
($arrErr['
simg'] ? '
block' : '
none')?>">
|
|
|
406 |
|
<?=($a
rrErr['sim
g'] ? _t(
'_'.$arrEr
r['simg']
) : '' )?>
|
|
|
407 |
|
</div>
|
|
|
408 |
|
<img src="
<?=$site['
url']?>sim
g/simg.php
"><br />
|
|
|
409 |
|
<input typ
e="input"
name="simg
" class="g
roup_edit_
simg" maxl
ength="6"
/>
|
|
|
410 |
|
</td
>
|
|
|
411 |
|
</tr>
|
|
|
412 |
|
<?
php
|
|
|
413 |
|
$n
owTR = ($n
owTR == "o
dd") ? "ev
en" : "odd
";
|
|
|
414 |
|
}
|
|
|
415 |
|
?>
|
|
|
416 |
|
<tr clas
s="group_e
dit_tr_<?=
$nowTR?>">
|
|
|
417 |
|
<td
class="gro
up_edit_td
_label">&n
bsp;</td>
|
|
|
418 |
|
<td
class="gro
up_edit_td
_colspan">
|
|
|
419 |
|
<input typ
e="submit"
name="do_
submit" va
lue="<?=_t
('_Submit'
)?>" />
|
|
|
420 |
|
</td
>
|
|
|
421 |
|
</tr>
|
|
|
422 |
|
</
table>
|
|
|
423 |
|
</form
>
|
|
|
424 |
|
<?php
|
|
|
425 |
|
|
|
|
426 |
|
return
ob_get_cl
ean();
|
|
|
427 |
|
}
|
|
|
428 |
|
|
|
|
429 |
|
function f
illGroupAr
rByPostVal
ues( &$arr
Group )
|
|
|
430 |
|
{
|
|
|
431 |
|
foreac
h( $arrGro
up as $fie
ldName =>
$arrField
)
|
|
|
432 |
|
{
|
|
|
433 |
|
sw
itch( $arr
Field['Typ
e'] )
|
|
|
434 |
|
{
|
|
|
435 |
|
case 'te
xt':
|
|
|
436 |
|
case 'dr
opdown':
|
|
|
437 |
|
$arr
Group[$fie
ldName]['V
alue'] = t
rim( proce
ss_pass_da
ta( $_POST
[$fieldNam
e] ) );
|
|
|
438 |
|
break;
|
|
|
439 |
|
case 'ht
ml':
|
|
|
440 |
|
$arr
Group[$fie
ldName]['V
alue'] = c
lear_xss(
trim( proc
ess_pass_d
ata( $_POS
T[$fieldNa
me] ) ) );
|
|
|
441 |
|
break;
|
|
|
442 |
|
case 'bo
ol':
|
|
|
443 |
|
$arr
Group[$fie
ldName]['V
alue'] = (
bool)( $_P
OST[$field
Name] == '
yes' );
|
|
|
444 |
|
break;
|
|
|
445 |
|
}
|
|
|
446 |
|
}
|
|
|
447 |
|
}
|
|
|
448 |
|
|
|
|
449 |
|
function f
illGroupAr
rByDBValue
s( &$arrFi
elds, $arr
Group )
|
|
|
450 |
|
{
|
|
|
451 |
|
foreac
h( $arrFie
lds as $fi
eldName =>
$arrField
)
|
|
|
452 |
|
{
|
|
|
453 |
|
sw
itch( $arr
Field['Typ
e'] )
|
|
|
454 |
|
{
|
|
|
455 |
|
case 'te
xt':
|
|
|
456 |
|
case 'ht
ml':
|
|
|
457 |
|
case 'dr
opdown':
|
|
|
458 |
|
$arr
Fields[$fi
eldName]['
Value'] =
$arrGroup[
$fieldName
];
|
|
|
459 |
|
break;
|
|
|
460 |
|
case 'bo
ol':
|
|
|
461 |
|
$arr
Fields[$fi
eldName]['
Value'] =
(bool)(int
)$arrGroup
[$fieldNam
e];
|
|
|
462 |
|
break;
|
|
|
463 |
|
}
|
|
|
464 |
|
}
|
|
|
465 |
|
}
|
|
|
466 |
|
|
|
|
467 |
|
function c
heckGroupE
rrors( &$a
rrGroup )
|
|
|
468 |
|
{
|
|
|
469 |
|
global
$prof;
|
|
|
470 |
|
$arrEr
r = array(
);
|
|
|
471 |
|
|
|
|
472 |
|
foreac
h( $arrGro
up as $arr
Field )
|
|
|
473 |
|
{
|
|
|
474 |
|
$f
ieldName =
$arrField
['Name'];
|
|
|
475 |
|
|
|
|
476 |
|
sw
itch( $arr
Field['Typ
e'] )
|
|
|
477 |
|
{
|
|
|
478 |
|
case 'te
xt':
|
|
|
479 |
|
if(
!strlen( $
arrGroup[$
fieldName]
['Value']
) )
|
|
|
480 |
|
$arrErr[ $
fieldName
] = "{$fie
ldName} is
required"
;
|
|
|
481 |
|
else
|
|
|
482 |
|
{
|
|
|
483 |
|
if( $field
Name == 'N
ame' )
|
|
|
484 |
|
if( is
GroupNameE
xists( $ar
rGroup['Na
me']['Valu
e'] ) )
|
|
|
485 |
|
$a
rrErr[ $fi
eldName ]
= "Group n
ame alread
y exists";
|
|
|
486 |
|
}
|
|
|
487 |
|
break;
|
|
|
488 |
|
case 'dr
opdown':
|
|
|
489 |
|
swit
ch( $field
Name )
|
|
|
490 |
|
{
|
|
|
491 |
|
case 'Coun
try':
|
|
|
492 |
|
$arrGr
oup['Count
ry']['Valu
e'] = subs
tr( $arrGr
oup['Count
ry']['Valu
e'], 0, 2
);
|
|
|
493 |
|
if( !s
trlen( $ar
rGroup['Co
untry']['V
alue'] ) )
|
|
|
494 |
|
$a
rrErr['Cou
ntry'] = '
Country is
required'
;
|
|
|
495 |
|
else
|
|
|
496 |
|
if
( !isset(
$prof['co
untries'][
$arrGroup
['Country'
]['Value']
] ) )
|
|
|
497 |
|
{
|
|
|
498 |
|
$arrErr[
'Country']
= "Countr
y doesn't
exists";
|
|
|
499 |
|
unset( $
arrGroup['
Country'][
'Value'] )
;
|
|
|
500 |
|
}
|
|
|
501 |
|
break;
|
|
|
502 |
|
case 'cate
gID':
|
|
|
503 |
|
$arrGr
oup['categ
ID']['Valu
e'] = (int
)$arrGroup
['categID'
]['Value']
;
|
|
|
504 |
|
if( !$
arrGroup['
categID'][
'Value'] )
|
|
|
505 |
|
$a
rrErr['cat
egID'] = "
Category i
s required
";
|
|
|
506 |
|
else
|
|
|
507 |
|
if
( !isGroup
sCategExis
ts( $arrGr
oup['categ
ID']['Valu
e'] ) )
|
|
|
508 |
|
{
|
|
|
509 |
|
$arrErr[
'categID']
= "Catego
ry doesn't
exists";
|
|
|
510 |
|
unset( $
arrGroup['
categID'][
'Value'] )
;
|
|
|
511 |
|
}
|
|
|
512 |
|
break;
|
|
|
513 |
|
}
|
|
|
514 |
|
break;
|
|
|
515 |
|
case 'ht
ml':
|
|
|
516 |
|
//Co
mmented fo
r possible
modificat
ions
|
|
|
517 |
|
/*if
( !strlen(
$arrGroup
[$fieldNam
e]['Value'
] ) )
|
|
|
518 |
|
$arrErr[ $
fieldName
] = "{$fie
ldName} is
required"
;*/
|
|
|
519 |
|
break;
|
|
|
520 |
|
case 'bo
ol':
|
|
|
521 |
|
|
|
|
522 |
|
break;
|
|
|
523 |
|
}
|
|
|
524 |
|
}
|
|
|
525 |
|
|
|
|
526 |
|
return
$arrErr;
|
|
|
527 |
|
}
|
|
|
528 |
|
|
|
|
529 |
|
function i
sGroupsCat
egExists(
$ID )
|
|
|
530 |
|
{
|
|
|
531 |
|
$ID =
(int)$ID;
|
|
|
532 |
|
|
|
|
533 |
|
if( !$
ID )
|
|
|
534 |
|
re
turn false
;
|
|
|
535 |
|
|
|
|
536 |
|
$res =
db_res( "
SELECT `ID
` FROM `Gr
oupsCateg`
WHERE `ID
`=$ID" );
|
|
|
537 |
|
|
|
|
538 |
|
if( $r
es and mys
ql_num_row
s( $res )
)
|
|
|
539 |
|
re
turn true;
|
|
|
540 |
|
else
|
|
|
541 |
|
re
turn false
;
|
|
|
542 |
|
}
|
|
|
543 |
|
|
|
|
544 |
|
function s
aveGroup(
$arrGroup,
$groupID
= 0 )
|
|
|
545 |
|
{
|
|
|
546 |
|
$group
ID = (int)
$groupID;
|
|
|
547 |
|
$sqlSe
tStr = 'SE
T ';
|
|
|
548 |
|
|
|
|
549 |
|
foreac
h( $arrGro
up as $fie
ldName =>
$arrField
)
|
|
|
550 |
|
{
|
|
|
551 |
|
sw
itch( $arr
Field['Typ
e'] )
|
|
|
552 |
|
{
|
|
|
553 |
|
case 'te
xt':
|
|
|
554 |
|
case 'ht
ml':
|
|
|
555 |
|
case 'dr
opdown':
|
|
|
556 |
|
$set
Value = ad
dslashes(
$arrField[
'Value'] )
;
|
|
|
557 |
|
break;
|
|
|
558 |
|
case 'bo
ol':
|
|
|
559 |
|
$set
Value = (s
tring)(int
)$arrField
['Value'];
//convert
true -> 1
, false ->
0
|
|
|
560 |
|
break;
|
|
|
561 |
|
default:
|
|
|
562 |
|
$set
Value = ad
dslashes(
$arrField[
'Value'] )
;
|
|
|
563 |
|
}
|
|
|
564 |
|
$s
qlSetStr .
= "`{$arrF
ield['Name
']}`='$set
Value', ";
|
|
|
565 |
|
}
|
|
|
566 |
|
$sqlSe
tStr = sub
str( $sqlS
etStr, 0,
-2 ); // r
emove last
", "
|
|
|
567 |
|
|
|
|
568 |
|
if ( $
groupID >
0 )
|
|
|
569 |
|
{
|
|
|
570 |
|
$q
uery = "UP
DATE `Grou
ps` $sqlSe
tStr WHERE
`ID`=$gro
upID";
|
|
|
571 |
|
db
_res( $que
ry );
|
|
|
572 |
|
if
( mysql_af
fected_row
s() )
|
|
|
573 |
|
{
|
|
|
574 |
|
saveGrou
pForum( $g
roupID, $a
rrGroup );
|
|
|
575 |
|
return t
rue;
|
|
|
576 |
|
}
|
|
|
577 |
|
el
se
|
|
|
578 |
|
return f
alse;
|
|
|
579 |
|
}
|
|
|
580 |
|
else
|
|
|
581 |
|
{
|
|
|
582 |
|
$q
uery = "IN
SERT `Grou
ps` $sqlSe
tStr, `cre
ated`=NOW(
)";
|
|
|
583 |
|
db
_res( $que
ry );
|
|
|
584 |
|
$g
roupID = m
ysql_inser
t_id();
|
|
|
585 |
|
if
( $groupID
)
|
|
|
586 |
|
{
|
|
|
587 |
|
saveGrou
pForum( $g
roupID, $a
rrGroup, t
rue );
|
|
|
588 |
|
return $
groupID;
|
|
|
589 |
|
}
|
|
|
590 |
|
el
se
|
|
|
591 |
|
return f
alse;
|
|
|
592 |
|
}
|
|
|
593 |
|
}
|
|
|
594 |
|
|
|
|
595 |
|
function s
aveGroupFo
rum( $grou
pID, $arrG
roup, $isN
ew = false
)
|
|
|
596 |
|
{
|
|
|
597 |
|
$group
Id = (int)
$groupID;
|
|
|
598 |
|
|
|
|
599 |
|
$sqlSe
tStr = '';
|
|
|
600 |
|
|
|
|
601 |
|
foreac
h( $arrGro
up as $fie
ldName =>
$arrField
)
|
|
|
602 |
|
{
|
|
|
603 |
|
un
set( $setV
alue );
|
|
|
604 |
|
|
|
|
605 |
|
if
( $fieldNa
me == 'hid
den_group'
)
|
|
|
606 |
|
{
|
|
|
607 |
|
$setColu
mn = "foru
m_type";
|
|
|
608 |
|
$setValu
e = ( $ar
rField['Va
lue'] ) ?
'private'
: 'public'
;
|
|
|
609 |
|
}
|
|
|
610 |
|
el
seif( $fie
ldName ==
'Name' )
|
|
|
611 |
|
{
|
|
|
612 |
|
$setColu
mn = 'foru
m_title';
|
|
|
613 |
|
$setValu
e = addsl
ashes( htm
lspecialch
ars( $arrF
ield['Valu
e'] ) );
|
|
|
614 |
|
}
|
|
|
615 |
|
el
seif( $fie
ldName ==
'About' )
|
|
|
616 |
|
{
|
|
|
617 |
|
$setColu
mn = 'foru
m_desc';
|
|
|
618 |
|
$setValu
e = addsl
ashes( htm
lspecialch
ars( $arrF
ield['Valu
e'] ) );
|
|
|
619 |
|
}
|
|
|
620 |
|
|
|
|
621 |
|
if
( isset( $
setValue )
)
|
|
|
622 |
|
$sqlSetS
tr .= "`{$
setColumn}
` = '{$set
Value}', "
;
|
|
|
623 |
|
}
|
|
|
624 |
|
|
|
|
625 |
|
if( !s
trlen( $sq
lSetStr )
)
|
|
|
626 |
|
re
turn false
;
|
|
|
627 |
|
|
|
|
628 |
|
$sqlSe
tStr = "SE
T " . subs
tr( $sqlSe
tStr, 0, -
2 ); // re
move last
", "
|
|
|
629 |
|
|
|
|
630 |
|
if ( $
isNew )
|
|
|
631 |
|
$q
uery = "IN
SERT `grp_
forum` $sq
lSetStr, `
forum_id`=
$groupID,
`cat_id`=1
";
|
|
|
632 |
|
else
|
|
|
633 |
|
$q
uery = "UP
DATE `grp_
forum` $sq
lSetStr WH
ERE `forum
_id`=$grou
pID";
|
|
|
634 |
|
|
|
|
635 |
|
db_res
( $query )
;
|
|
|
636 |
|
}
|
|
|
637 |
|
|
|
|
638 |
|
function a
ddMember2G
roup( $mem
berID, $gr
oupID, $st
atus = 'Ac
tive' )
|
|
|
639 |
|
{
|
|
|
640 |
|
db_res
( "INSERT
`GroupsMem
bers` VALU
ES ( $memb
erID, $gro
upID, '$st
atus', NOW
() )" );
|
|
|
641 |
|
}
|
|
|
642 |
|
|
|
|
643 |
|
function r
esignGroup
Member( $m
emberID, $
groupID )
|
|
|
644 |
|
{
|
|
|
645 |
|
db_res
( "DELETE
FROM `Grou
psMembers`
WHERE `me
mberID`=$m
emberID AN
D `groupID
`=$groupID
" );
|
|
|
646 |
|
}
|
|
|
647 |
|
|
|
|
648 |
|
function c
ompareUpda
tedGroupFi
elds( $arr
OldFields,
$arrNewFi
elds )
|
|
|
649 |
|
{
|
|
|
650 |
|
$arrUp
dFields =
array();
|
|
|
651 |
|
|
|
|
652 |
|
foreac
h( $arrOld
Fields as
$fieldName
=> $arrOl
dField )
|
|
|
653 |
|
{
|
|
|
654 |
|
if
( $arrOldF
ield['Valu
e'] != $ar
rNewFields
[$fieldNam
e]['Value'
] )
|
|
|
655 |
|
$arrUpdF
ields[$fie
ldName] =
$arrNewFie
lds[$field
Name];
|
|
|
656 |
|
}
|
|
|
657 |
|
|
|
|
658 |
|
return
$arrUpdFi
elds;
|
|
|
659 |
|
}
|
|
|
660 |
|
|
|
|
661 |
|
function g
enUploadFo
rm( $group
ID, $back_
home = fal
se, $set_d
ef = false
)
|
|
|
662 |
|
{
|
|
|
663 |
|
global
$site;
|
|
|
664 |
|
|
|
|
665 |
|
ob_sta
rt();
|
|
|
666 |
|
?>
|
|
|
667 |
|
<d
iv class="
group_uplo
ad_form">
|
|
|
668 |
|
<form ac
tion="<?=$
site['url'
]?>group_a
ctions.php
" method="
POST" enct
ype="multi
part/form-
data">
|
|
|
669 |
|
<inp
ut type="h
idden" nam
e="ID" val
ue="<?=$gr
oupID?>" /
>
|
|
|
670 |
|
<inp
ut type="h
idden" nam
e="a" valu
e="upload"
/>
|
|
|
671 |
|
<?php
|
|
|
672 |
|
if( $b
ack_home )
|
|
|
673 |
|
{
|
|
|
674 |
|
?>
|
|
|
675 |
|
<inp
ut type="h
idden" nam
e="back" v
alue="home
" />
|
|
|
676 |
|
<?
php
|
|
|
677 |
|
}
|
|
|
678 |
|
|
|
|
679 |
|
if( $s
et_def )
|
|
|
680 |
|
{
|
|
|
681 |
|
?>
|
|
|
682 |
|
<inp
ut type="h
idden" nam
e="set_def
" value="y
es" />
|
|
|
683 |
|
<?
php
|
|
|
684 |
|
}
|
|
|
685 |
|
?>
|
|
|
686 |
|
<?=_
t( '_Selec
t file' )?
><br />
|
|
|
687 |
|
<inp
ut type="f
ile" name=
"file" />
|
|
|
688 |
|
<inp
ut type="s
ubmit" nam
e="do_subm
it" value=
"<?=_t('_S
ubmit')?>"
/>
|
|
|
689 |
|
</form>
|
|
|
690 |
|
</
div>
|
|
|
691 |
|
<?php
|
|
|
692 |
|
return
ob_get_cl
ean();
|
|
|
693 |
|
}
|
|
|
694 |
|
|
|
|
695 |
|
function s
etGroupThu
mb( $group
ID, $img )
|
|
|
696 |
|
{
|
|
|
697 |
|
$group
ID = (int)
$groupID;
|
|
|
698 |
|
$img =
(int)$img
;
|
|
|
699 |
|
|
|
|
700 |
|
if( $g
roupID and
$img )
|
|
|
701 |
|
{
|
|
|
702 |
|
$a
rrImg = db
_assoc_arr
( "SELECT
`ID` FROM
`GroupsGal
lery` WHER
E `groupID
`=$groupID
AND `ID`=
$img" );
|
|
|
703 |
|
if
( $arrImg[
'ID'] == $
img )
|
|
|
704 |
|
{
|
|
|
705 |
|
db_res(
"UPDATE `G
roups` SET
`thumb`=$
img WHERE
`ID`=$grou
pID" );
|
|
|
706 |
|
}
|
|
|
707 |
|
}
|
|
|
708 |
|
}
|
|
|
709 |
|
|
|
|
710 |
|
function d
eleteGroup
Image( $gr
oupID, $im
g )
|
|
|
711 |
|
{
|
|
|
712 |
|
$group
ID = (int)
$groupID;
|
|
|
713 |
|
$img =
(int)$img
;
|
|
|
714 |
|
|
|
|
715 |
|
if( $g
roupID and
$img )
|
|
|
716 |
|
{
|
|
|
717 |
|
$a
rrImg = db
_assoc_arr
( "SELECT
* FROM `Gr
oupsGaller
y` WHERE `
groupID`=$
groupID AN
D `ID`=$im
g" );
|
|
|
718 |
|
if
( $arrImg[
'ID'] == $
img )
|
|
|
719 |
|
{
|
|
|
720 |
|
db_res(
"DELETE FR
OM `Groups
Gallery` W
HERE `ID`=
$img AND `
groupID`=$
groupID" )
;
|
|
|
721 |
|
unlink(
BX_DIRECTO
RY_PATH_GR
OUPS_GALLE
RY . "{$gr
oupID}_{$i
mg}_{$arrI
mg['seed']
}_.{$arrIm
g['ext']}"
);
|
|
|
722 |
|
unlink(
BX_DIRECTO
RY_PATH_GR
OUPS_GALLE
RY . "{$gr
oupID}_{$i
mg}_{$arrI
mg['seed']
}.{$arrImg
['ext']}"
);
|
|
|
723 |
|
}
|
|
|
724 |
|
}
|
|
|
725 |
|
}
|
|
|
726 |
|
|
|
|
727 |
|
function g
etGroupsCa
tegList( $
sOrderBy =
'ID' )
|
|
|
728 |
|
{
|
|
|
729 |
|
$resCa
tegs = db_
res( "
|
|
|
730 |
|
SE
LECT
|
|
|
731 |
|
`GroupsC
ateg`.*,
|
|
|
732 |
|
COUNT(`G
roups`.`ID
`) AS `gro
upsCount`
|
|
|
733 |
|
FR
OM `Groups
Categ`
|
|
|
734 |
|
LE
FT JOIN `G
roups`
|
|
|
735 |
|
ON
( `Groups
`.`categID
` = `Group
sCateg`.`I
D` AND `Gr
oups`.`sta
tus` = 'Ac
tive' )
|
|
|
736 |
|
GR
OUP BY `Gr
oupsCateg`
.`ID`
|
|
|
737 |
|
OR
DER BY `Gr
oupsCateg`
.`$sOrderB
y`
|
|
|
738 |
|
"
);
|
|
|
739 |
|
$arrCa
tegs = fil
l_assoc_ar
ray( $resC
ategs );
|
|
|
740 |
|
return
$arrCateg
s;
|
|
|
741 |
|
}
|
|
|
742 |
|
|
|
|
743 |
|
function s
endRequest
ToCreator(
$groupID,
$memberID
)
|
|
|
744 |
|
{
|
|
|
745 |
|
global
$site;
|
|
|
746 |
|
|
|
|
747 |
|
$subje
ct = 'Grou
p join req
uest';
|
|
|
748 |
|
$msg =
getParam(
'group_cr
eator_requ
est' );
|
|
|
749 |
|
|
|
|
750 |
|
$query
Info = "
|
|
|
751 |
|
SE
LECT
|
|
|
752 |
|
`Groups`
.`Name` AS
`group`,
|
|
|
753 |
|
`Profile
s`.`ID` AS
`creatorI
D`,
|
|
|
754 |
|
`Profile
s`.`NickNa
me` AS `cr
eator`,
|
|
|
755 |
|
`Profile
s2`.`NickN
ame` AS `m
ember`
|
|
|
756 |
|
FR
OM `Groups
`
|
|
|
757 |
|
LE
FT JOIN `P
rofiles`
|
|
|
758 |
|
ON
`Profiles
`.`ID` = `
Groups`.`c
reatorID`
|
|
|
759 |
|
LE
FT JOIN `P
rofiles` A
S `Profile
s2`
|
|
|
760 |
|
ON
`Profiles
2`.`ID` =
$memberID
|
|
|
761 |
|
WH
ERE
|
|
|
762 |
|
`Groups`
.`ID` = $g
roupID
|
|
|
763 |
|
";
|
|
|
764 |
|
|
|
|
765 |
|
$arrIn
fo = db_ar
r( $queryI
nfo );
|
|
|
766 |
|
|
|
|
767 |
|
$creat
orID = $ar
rInfo['cre
atorID'];
|
|
|
768 |
|
|
|
|
769 |
|
$group
= htmls
pecialchar
s_adv( $ar
rInfo['gro
up'] );
|
|
|
770 |
|
$creat
or = htmls
pecialchar
s_adv( $ar
rInfo['cre
ator'] );
|
|
|
771 |
|
$membe
r = htmls
pecialchar
s_adv( $ar
rInfo['mem
ber'] );
|
|
|
772 |
|
|
|
|
773 |
|
$membe
r = "<a h
ref=\"{$si
te['url']}
$member\">
$member</a
>";
|
|
|
774 |
|
|
|
|
775 |
|
$appro
ve = "<a h
ref=\"{$si
te['url']}
group_acti
ons.php?a=
approve&am
p;ID=$grou
pID&me
m=$memberI
D\" >appro
ve</a>";
|
|
|
776 |
|
$rejec
t = "<a h
ref=\"{$si
te['url']}
group_acti
ons.php?a=
reject&
;ID=$group
ID&mem
=$memberID
\" >reject
</a>";
|
|
|
777 |
|
|
|
|
778 |
|
$msg =
str_repla
ce( '{grou
p}', $gr
oup, $ms
g );
|
|
|
779 |
|
$msg =
str_repla
ce( '{crea
tor}', $cr
eator, $ms
g );
|
|
|
780 |
|
$msg =
str_repla
ce( '{memb
er}', $me
mber, $ms
g );
|
|
|
781 |
|
$msg =
str_repla
ce( '{appr
ove}', $ap
prove, $ms
g );
|
|
|
782 |
|
$msg =
str_repla
ce( '{reje
ct}', $re
ject, $ms
g );
|
|
|
783 |
|
|
|
|
784 |
|
$msg =
addslashe
s( $msg );
|
|
|
785 |
|
|
|
|
786 |
|
db_res
( "INSERT
INTO `Mess
ages`
|
|
|
787 |
|
(
`Date`, `S
ender`, `R
ecipient`,
`Text`, `
Subject`,
`New` )
|
|
|
788 |
|
VA
LUES
|
|
|
789 |
|
(
NOW(), $me
mberID, $c
reatorID,
'$msg', '$
subject',
'1' )" );
|
|
|
790 |
|
}
|
|
|
791 |
|
|
|
|
792 |
|
function g
enAllCateg
sList()
|
|
|
793 |
|
{
|
|
|
794 |
|
global
$site;
|
|
|
795 |
|
|
|
|
796 |
|
$ret =
'';
|
|
|
797 |
|
|
|
|
798 |
|
$arrCa
tegs = get
GroupsCate
gList( 'Na
me' );
|
|
|
799 |
|
|
|
|
800 |
|
foreac
h( $arrCat
egs as $ar
rCateg )
|
|
|
801 |
|
{
|
|
|
802 |
|
$r
et .= '<di
v class="g
roups_cate
gory"><spa
n class="g
roups_cate
g_name">'
.
|
|
|
803 |
|
"<a href=\
"{$site['u
rl']}group
s_browse.p
hp?categID
={$arrCate
g['ID']}&a
mp;nf=1\">
" .
|
|
|
804 |
|
htmlspecia
lchars_adv
( $arrCate
g['Name']
) . '</a><
/span> '.
|
|
|
805 |
|
'<span cla
ss="groups
_categ_inf
o">(' .
|
|
|
806 |
|
_t('_group
s count',$
arrCateg['
groupsCoun
t']) .
|
|
|
807 |
|
")</span><
/div>\n";
|
|
|
808 |
|
}
|
|
|
809 |
|
return
$ret;
|
|
|
810 |
|
}
|
|
|
811 |
|
|
|
|
812 |
|
function P
ageCompGro
upsSearchR
esults( $k
eyword, $s
earchby, $
categID, $
Country, $
City, $sor
tby, $isTo
pGroupsPag
e = false
)
|
|
|
813 |
|
{
|
|
|
814 |
|
global
$oTemplCo
nfig;
|
|
|
815 |
|
global
$site;
|
|
|
816 |
|
global
$dir;
|
|
|
817 |
|
global
$tmpl;
|
|
|
818 |
|
global
$prof;
|
|
|
819 |
|
|
|
|
820 |
|
$date_
format_php
= getPara
m('php_dat
e_format')
;
|
|
|
821 |
|
|
|
|
822 |
|
if( $s
ortby == '
created' o
r $sortby
== 'member
sCount' )
|
|
|
823 |
|
$s
ortOrder =
'DESC';
|
|
|
824 |
|
else
|
|
|
825 |
|
$s
ortOrder =
'ASC';
|
|
|
826 |
|
|
|
|
827 |
|
$aQuer
yWhere = a
rray(); //
array will
contain s
earch cond
itions com
bined by A
ND
|
|
|
828 |
|
|
|
|
829 |
|
if( $k
eyword )
|
|
|
830 |
|
{
|
|
|
831 |
|
if
( $searchb
y == 'name
' )
|
|
|
832 |
|
$aQueryW
here[] = "
UPPER(`Gro
ups`.`Name
`) LIKE '%
{$keyword}
%'";
|
|
|
833 |
|
el
se
|
|
|
834 |
|
$aQueryW
here[] = "
(UPPER(`Gr
oups`.`Nam
e`) LIKE '
%{$keyword
}%') OR (U
PPER(`Grou
ps`.`About
`) LIKE '%
{$keyword}
%') OR (UP
PER(`Group
s`.`Desc`)
LIKE '%{$
keyword}%'
)";
|
|
|
835 |
|
}
|
|
|
836 |
|
|
|
|
837 |
|
if( $c
ategID )
|
|
|
838 |
|
$a
QueryWhere
[] = "`Gro
ups`.`cate
gID`='$cat
egID'";
|
|
|
839 |
|
|
|
|
840 |
|
if( $C
ountry )
|
|
|
841 |
|
$a
QueryWhere
[] = "`Gro
ups`.`Coun
try`='$Cou
ntry'";
|
|
|
842 |
|
|
|
|
843 |
|
if( $C
ity )
|
|
|
844 |
|
$a
QueryWhere
[] = "UPPE
R(`Groups`
.`City`) L
IKE '%{$Ci
ty}%'";
|
|
|
845 |
|
|
|
|
846 |
|
$aQuer
yWhere[] =
"`Groups`
.`status`
= 'Active'
";
|
|
|
847 |
|
|
|
|
848 |
|
$sQuer
yWhere = "
WHERE (" .
implode(
") AND (",
$aQueryWh
ere ) . ")
";
|
|
|
849 |
|
|
|
|
850 |
|
if( $i
sTopGroups
Page )
|
|
|
851 |
|
$S
RdbTitle =
_t( '_Top
Groups' )
;
|
|
|
852 |
|
else
|
|
|
853 |
|
$S
RdbTitle =
_t( '_Gro
ups search
results'
); //Searc
hResultDes
ignBoxTitl
e
|
|
|
854 |
|
|
|
|
855 |
|
$arrNu
m = db_arr
( "SELECT
COUNT(`ID`
) FROM `Gr
oups` $sQu
eryWhere"
);
|
|
|
856 |
|
|
|
|
857 |
|
$total
Num = (int
)$arrNum[0
];
|
|
|
858 |
|
if( $t
otalNum >
0 )
|
|
|
859 |
|
{
|
|
|
860 |
|
$r
esPerPage
= $oTemplC
onfig -> i
GroupsSear
chResPerPa
ge;
|
|
|
861 |
|
$p
agesNum =
ceil( $tot
alNum / $r
esPerPage
);
|
|
|
862 |
|
$p
age = (int
)$_REQUEST
['page'];
|
|
|
863 |
|
|
|
|
864 |
|
if
( $page <
1 )
|
|
|
865 |
|
$page =
1;
|
|
|
866 |
|
if
( $page >
$pagesNum
)
|
|
|
867 |
|
$page =
$pagesNum;
|
|
|
868 |
|
|
|
|
869 |
|
$s
qlFrom = (
( $page -
1 ) * $re
sPerPage )
;
|
|
|
870 |
|
|
|
|
871 |
|
$s
Query = "
|
|
|
872 |
|
SELECT
|
|
|
873 |
|
`Gro
ups`.*,
|
|
|
874 |
|
`Gro
upsCateg`.
`Name` AS
`categName
`,
|
|
|
875 |
|
COUN
T( `Groups
Members`.`
memberID`
) AS `memb
ersCount`,
|
|
|
876 |
|
`Gro
upsGallery
`.`seed`,
|
|
|
877 |
|
`Gro
upsGallery
`.`ext` AS
`thumbExt
`
|
|
|
878 |
|
FROM `Gr
oups`
|
|
|
879 |
|
INNER JO
IN `Groups
Categ` ON
`GroupsCat
eg`.`ID` =
`Groups`.
`categID`
|
|
|
880 |
|
LEFT JOI
N `GroupsM
embers`
|
|
|
881 |
|
ON (
`GroupsMem
bers`.`gro
upID` = `G
roups`.`ID
` AND `Gro
upsMembers
`.`status`
='Active')
|
|
|
882 |
|
LEFT JOI
N `GroupsG
allery`
|
|
|
883 |
|
ON (
`Groups`.`
thumb` = `
GroupsGall
ery`.`ID`)
|
|
|
884 |
|
$sQueryW
here
|
|
|
885 |
|
GROUP BY
`Groups`.
`ID`
|
|
|
886 |
|
ORDER BY
`$sortby`
$sortOrde
r, `Groups
`.`ID` DES
C
|
|
|
887 |
|
LIMIT $s
qlFrom, $r
esPerPage
|
|
|
888 |
|
";
|
|
|
889 |
|
|
|
|
890 |
|
$r
esGroups =
db_res( $
sQuery );
|
|
|
891 |
|
|
|
|
892 |
|
$n
umOnPage =
mysql_num
_rows( $re
sGroups );
|
|
|
893 |
|
$s
howingFrom
= $sqlFro
m + 1;
|
|
|
894 |
|
$s
howingTo
= $sqlFro
m + $numOn
Page;
|
|
|
895 |
|
|
|
|
896 |
|
$s
howingResu
lts = _t(
'_Showing
results:',
$showingF
rom, $show
ingTo, $to
talNum );
|
|
|
897 |
|
|
|
|
898 |
|
if
( $pagesNu
m > 1 and
!$isTopGro
upsPage )
|
|
|
899 |
|
{
|
|
|
900 |
|
$pagesUr
l = "javas
cript:void
(0);";
|
|
|
901 |
|
$pagesOn
click = "s
witchGroup
sSearchPag
e({page});
return fa
lse;";
|
|
|
902 |
|
$paginat
ion = genP
agination(
$pagesNum
, $page, $
pagesUrl,
$pagesOncl
ick );
|
|
|
903 |
|
}
|
|
|
904 |
|
|
|
|
905 |
|
$s
RowTmpl =
file_get_c
ontents("{
$dir['root
']}templat
es/tmpl_$t
mpl/search
row_group.
html");
|
|
|
906 |
|
|
|
|
907 |
|
$b
readCrumbs
= '';
|
|
|
908 |
|
if
( $categID
)
|
|
|
909 |
|
{
|
|
|
910 |
|
$arrCate
g = db_arr
( "SELECT
`Name` FRO
M `GroupsC
ateg` WHER
E `ID`=$ca
tegID" );
|
|
|
911 |
|
if( $arr
Categ['Nam
e'] )
|
|
|
912 |
|
{
|
|
|
913 |
|
$sCa
tegName =
_t( '_Cate
gory' ).':
'.htmlspe
cialchars_
adv( $arrC
ateg['Name
'] );
|
|
|
914 |
|
$SRd
bTitle = $
sCategName
;
|
|
|
915 |
|
|
|
|
916 |
|
$bcd
= getPara
m( 'breadC
rampDivide
r' );
|
|
|
917 |
|
$bre
adCrumbs =
<<<EOJ
|
|
|
918 |
|
<d
iv class="
groups_bre
adcrumbs">
|
|
|
919 |
|
<a href=
"{$site['u
rl']}">{$s
ite['title
']}</a> $b
cd
|
|
|
920 |
|
<a href=
"{$site['u
rl']}group
s_home.php
">__Groups
__</a> $bc
d
|
|
|
921 |
|
<span cl
ass="activ
e_link">$s
CategName<
/span>
|
|
|
922 |
|
</
div>
|
|
|
923 |
|
EOJ;
|
|
|
924 |
|
$bre
adCrumbs =
str_repla
ce( "__Gro
ups__", _t
( "_Groups
" ), $brea
dCrumbs );
|
|
|
925 |
|
}
|
|
|
926 |
|
}
|
|
|
927 |
|
|
|
|
928 |
|
ob
_start();
|
|
|
929 |
|
|
|
|
930 |
|
if
( !$isTopG
roupsPage
)
|
|
|
931 |
|
{
|
|
|
932 |
|
echo $br
eadCrumbs;
|
|
|
933 |
|
?>
|
|
|
934 |
|
<div cla
ss="groups
_showing_r
esults">
|
|
|
935 |
|
<?=$
showingRes
ults?>
|
|
|
936 |
|
</div>
|
|
|
937 |
|
<div cla
ss="groups
_paginatio
n">
|
|
|
938 |
|
<?=$
pagination
?>
|
|
|
939 |
|
</div>
|
|
|
940 |
|
<?
|
|
|
941 |
|
}
|
|
|
942 |
|
?>
|
|
|
943 |
|
<d
iv class="
groups_res
ult_wrappe
r">
|
|
|
944 |
|
<?
php
|
|
|
945 |
|
wh
ile( $arrG
roup = mys
ql_fetch_a
ssoc( $res
Groups ) )
|
|
|
946 |
|
{
|
|
|
947 |
|
$aRowTmp
l = array(
);
|
|
|
948 |
|
|
|
|
949 |
|
if ( $ar
rGroup['th
umb'] and
file_exist
s(BX_DIREC
TORY_PATH_
GROUPS_GAL
LERY . "{$
arrGroup['
ID']}_{$ar
rGroup['th
umb']}_{$a
rrGroup['s
eed']}_.{$
arrGroup['
thumbExt']
}" ) )
|
|
|
950 |
|
$gro
upImageUrl
= "{$site
['groups_g
allery']}{
$arrGroup[
'ID']}_{$a
rrGroup['t
humb']}_{$
arrGroup['
seed']}_.{
$arrGroup[
'thumbExt'
]}";
|
|
|
951 |
|
else
|
|
|
952 |
|
$gro
upImageUrl
= "{$site
['groups_g
allery']}n
o_pic.gif"
;
|
|
|
953 |
|
|
|
|
954 |
|
|
|
|
955 |
|
if( (int
)$arrGroup
['hidden_g
roup'] )
|
|
|
956 |
|
$typ
eHelp = 7;
|
|
|
957 |
|
else
|
|
|
958 |
|
if(
(int)$arrG
roup['open
_join'] )
|
|
|
959 |
|
$typeHelp
= 5;
|
|
|
960 |
|
else
|
|
|
961 |
|
$typeHelp
= 6;
|
|
|
962 |
|
|
|
|
963 |
|
$typeHel
pLink = "{
$site['url
']}groups_
help.php?i
=$typeHelp
";
|
|
|
964 |
|
|
|
|
965 |
|
$aRowTmp
l['group_n
ame_l']
= _t( '_G
roup name'
);
|
|
|
966 |
|
$aRowTmp
l['categor
y_l']
= _t( '_C
ategory' )
;
|
|
|
967 |
|
$aRowTmp
l['about_g
roup_l']
= _t( '_A
bout group
' );
|
|
|
968 |
|
$aRowTmp
l['members
_count_l']
= _t( '_M
embers cou
nt' );
|
|
|
969 |
|
$aRowTmp
l['created
_l']
= _t( '_C
reated' );
|
|
|
970 |
|
$aRowTmp
l['group_t
ype_l']
= _t( '_G
roup type'
);
|
|
|
971 |
|
$aRowTmp
l['locatio
n_l']
= _t( '_L
ocation' )
;
|
|
|
972 |
|
$aRowTmp
l['group_t
ype_help']
= '<a hre
f="'.$type
HelpLink.'
" target="
_blank" on
click="win
dow.open(t
his.href,\
'helpwin\'
,\'width=3
50,height=
200\');ret
urn false;
" >'._t( "
_help" ).'
</a>';
|
|
|
973 |
|
|
|
|
974 |
|
$sSpacer
Path = 'te
mplates/ba
se/images/
icons/spac
er.gif';
|
|
|
975 |
|
$sSpacer
Name = $si
te['url'].
$sSpacerPa
th;
|
|
|
976 |
|
$aRowTmp
l['thumbna
il'] =
"<!--<div
class=\"g
roup_thumb
\">--><a h
ref=\"{$si
te['url']}
group.php?
ID={$arrGr
oup['ID']}
\">
|
|
|
977 |
|
<!--<i
mg src=\"{
$groupImag
eUrl}\" />
-->
|
|
|
978 |
|
<img s
rc=\"{$sSp
acerName}\
" style=\"
width:110p
x;height:1
10px; back
ground-ima
ge: url({$
groupImage
Url});\" c
lass=\"pho
to1\"/>
|
|
|
979 |
|
</a><!
--</div>--
>";
|
|
|
980 |
|
$aRowTmp
l['group_n
ame'] =
"<a class
=\"actions
\" href=\"
{$site['ur
l']}group.
php?ID={$a
rrGroup['I
D']}\">".h
tmlspecial
chars_adv(
$arrGroup
['Name'] )
."</a>";
|
|
|
981 |
|
$aRowTmp
l['group_a
bout'] =
htmlspeci
alchars_ad
v( $arrGro
up['About'
] );
|
|
|
982 |
|
$aRowTmp
l['categor
y'] =
"<a href=
\"{$site['
url']}grou
ps_browse.
php?categI
D={$arrGro
up['categI
D']}\">".h
tmlspecial
chars_adv(
$arrGroup
['categNam
e'] )."</a
>";
|
|
|
983 |
|
$aRowTmp
l['members
_count'] =
$arrGroup
['membersC
ount'];
|
|
|
984 |
|
$aRowTmp
l['created
'] =
date( $da
te_format_
php, strto
time( $arr
Group['cre
ated'] ) )
;
|
|
|
985 |
|
$aRowTmp
l['group_t
ype'] =
_t( ( ( (
int)$arrGr
oup['open_
join'] and
!(int)$ar
rGroup['hi
dden_group
'] ) ? '_P
ublic grou
p' : '_Pri
vate group
' ) );
|
|
|
986 |
|
$aRowTmp
l['country
'] =
_t( '__'.
$prof['cou
ntries'][
$arrGroup[
'Country']
] );
|
|
|
987 |
|
$aRowTmp
l['city']
=
htmlspeci
alchars_ad
v( $arrGro
up['City']
);
|
|
|
988 |
|
|
|
|
989 |
|
$sRow =
$sRowTmpl;
|
|
|
990 |
|
foreach(
$aRowTmpl
as $what
=> $to )
|
|
|
991 |
|
$sRo
w = str_re
place( "__
{$what}__"
, $to, $sR
ow );
|
|
|
992 |
|
|
|
|
993 |
|
echo $sR
ow;
|
|
|
994 |
|
}
|
|
|
995 |
|
?>
|
|
|
996 |
|
<div
class="cl
ear_both">
</div>
|
|
|
997 |
|
</div>
|
|
|
998 |
|
<?
|
|
|
999 |
|
if
( !$isTopG
roupsPage
)
|
|
|
1000 |
|
{
|
|
|
1001 |
|
?>
|
|
|
1002 |
|
<div cla
ss="groups
_showing_r
esults">
|
|
|
1003 |
|
<?=$
showingRes
ults?>
|
|
|
1004 |
|
</div>
|
|
|
1005 |
|
<div cla
ss="groups
_paginatio
n">
|
|
|
1006 |
|
<?=$
pagination
?>
|
|
|
1007 |
|
</div>
|
|
|
1008 |
|
<?php
|
|
|
1009 |
|
}
|
|
|
1010 |
|
$r
et = ob_ge
t_clean();
|
|
|
1011 |
|
}
|
|
|
1012 |
|
else
|
|
|
1013 |
|
{
|
|
|
1014 |
|
$r
et = MsgBo
x(_t( '_So
rry, no gr
oups found
' ));
|
|
|
1015 |
|
}
|
|
|
1016 |
|
return
DesignBox
Content( $
SRdbTitle,
$ret, $oT
emplConfig
->iGroupsS
earchResul
ts_dbnum )
;
|
|
|
1017 |
|
}
|
|
|
1018 |
|
|
|
|
1019 |
|
?>
|
|
|