forked from boonex/dolphin.pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_pop.php
754 lines (641 loc) · 22.1 KB
/
list_pop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*/
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolEmailTemplates.php' );
$_page['name_index'] = 44;
$_ni = $_page['name_index'];
// check logged
$logged['member'] = member_auth(0);
//get logged profile's id
$iProfileId = getLoggedId();
//-- process some internal vars --//
$iTargetId = (int)bx_get('ID');
$sTargetsId = isset($_POST['list_id']) ? $_POST['list_id'] : '';
$sAction = false != bx_get('action')? bx_get('action') : '';
//--
//define ajax mode
$bAjxMod = isset($_SERVER['HTTP_X_REQUESTED_WITH'])
&& $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
$sJQueryJS = '';
if($bAjxMod) {
$sJQueryJS = genAjaxyPopupJS($iTargetId);
header('Content-Type: text/html; charset=utf-8');
}
//-- process actions --//
switch ($sAction) {
//generate member menu position settings
case 'extra_menu' :
$sPageCaption = _t( '_Member menu position' );
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListMemberMenuSettings($iProfileId, $sAction)
, $oTemplConfig -> PageListPop_db_num);
break;
//block profile
case 'block':
if ($bAjxMod) {
echo PageListBlock($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t( '_Block list' );
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListBlock($iProfileId, $iTargetId)
, $oTemplConfig -> PageListPop_db_num );
break;
//unblock profile
case 'unblock':
if ($bAjxMod) {
echo PageListUnBlock($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_Unblock');
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListUnBlock($iProfileId, $iTargetId)
, $oTemplConfig -> PageListPop_db_num );
break;
//add to hot list
case 'hot':
if ($bAjxMod) {
echo PageListHot($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_sys_cnts_bcpt_fave');
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent($sPageCaption, PageListHot($iProfileId, $iTargetId), $oTemplConfig->PageListPop_db_num);
break;
//remove from hot list
case 'remove_hot':
if ($bAjxMod) {
echo PageListHotRemove($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_sys_cnts_bcpt_fave_remove');
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent($sPageCaption, PageListHotRemove($iProfileId, $iTargetId), $oTemplConfig->PageListPop_db_num);
break;
//add to friends list
case 'friend':
if ($bAjxMod) {
echo PageListFriend($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_Friend list');
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListFriend($iProfileId, $iTargetId)
, $oTemplConfig -> PageListPop_db_num );
break;
//remove from friends list
case 'remove_friend':
if ($bAjxMod) {
echo PageListFriendRemove($iProfileId, $iTargetId) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_Remove friend');
$_page['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListFriendRemove($iProfileId, $iTargetId)
, $oTemplConfig -> PageListPop_db_num );
break;
//report about spam
case 'spam':
$mTarget = $sTargetsId ? $sTargetsId : $iTargetId;
if ($bAjxMod) {
echo PageListSpam($iProfileId, $mTarget) . $sJQueryJS;
exit;
}
$sPageCaption = _t('_Spam report');
$GLOBALS['_page']['header'] = $sPageCaption;
$GLOBALS['_page_cont'][$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption
, PageListSpam($iProfileId, $mTarget)
, $oTemplConfig -> PageListPop_db_num);
break;
//changes profile status
case 'change_status':
if ( $bAjxMod && isset($_POST['status']) ) {
echo ActionChangeStatus($iProfileId, $_POST['status']);
}
return;
//change profile's status message
case 'change_status_message':
if ($bAjxMod) {
echo ActionChangeStatusMessage();
}
return;
default:
if ($bAjxMod AND $iTargetId)
{
$mixedRes = PageListControl($sAction, $iProfileId, $iTargetId);
if ($mixedRes)
{
echo $mixedRes . genAjaxyPopupJS($iTargetId);
exit;
}
}
$GLOBALS['_page']['header'] = _t('_Error occured');;
$GLOBALS['_page_cont'][$GLOBALS['_ni']]['page_main_code'] = _t('_Error occured');
break;
}
//--
PageCode();
//-- FUNCTIONS --//
/**
* Change status message
*
* @param $iMemberIdForce integer
* @return void
*/
function ActionChangeStatusMessage($iMemberIdForce = 0)
{
if ($iMemberIdForce) {
$iMemberID = (int) $iMemberIdForce;
} else {
$iMemberID = getLoggedId();
}
if( $iMemberID && isset($_POST['status_message']) ) {
$sNewStatusMessage = process_db_input($_POST['status_message']
, BX_TAGS_STRIP, BX_SLASHES_AUTO);
$sQuery = "UPDATE `Profiles` SET `UserStatusMessage`='{$sNewStatusMessage}'
, `UserStatusMessageWhen` = UNIX_TIMESTAMP() WHERE `ID` = '{$iMemberID}'";
if( db_res($sQuery, 0) ) {
//send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('profile', 'edit_status_message'
, $iMemberID, $iMemberID, array ($sNewStatusMessage));
$oZ -> alert();
createUserDataFile($iMemberID);
}
}
}
/**
* Change profile status
*
* @param $iProfileId integer
* @param $sStatus text
* @return text
*/
function ActionChangeStatus($iProfileId, $sStatus = '')
{
$iProfileId = (int) $iProfileId;
$sOutputCode = '';
$oUserStatus = new BxDolUserStatusView();
if ( $oUserStatus -> getRegisteredStatus($sStatus) ) {
//process status
$sStatus = process_db_input($sStatus, BX_TAGS_STRIP, BX_SLASHES_AUTO);
$sQuery = "UPDATE `Profiles` SET `UserStatus`='{$sStatus}', `DateLastNav` = NOW()
WHERE `ID` = '{$iProfileId}'";
if( db_res($sQuery, 0) ) {
// send system event
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('profile', 'edit_status', $iProfileId, $iProfileId);
$oZ -> alert();
bx_import('BxTemplMemberMenu');
$oMemberMenu = new BxTemplMemberMenu();
$oMemberMenu -> deleteMemberMenuKeyFile($iProfileId);
createUserDataFile($iProfileId);
$sOutputCode = $oUserStatus -> getStatusIcon($iProfileId);
}
}
return $sOutputCode;
}
/**
* Send report about spam
*
* @param $iProfileId integer
* @param $mMembers mixed
* @return text - html presentation data
*/
function PageListSpam($iProfileId, $mMembers = '')
{
$iProfileId = (int) $iProfileId;
//define list of members
if( is_int($mMembers) ) {
$sActionResult = _sendSpamReport($iProfileId, $mMembers);
} else {
//work with string
$aMembers = explode(',', $mMembers);
for($i = 0, $iCountMembers = count($aMembers); $i <= $iCountMembers; $i++) {
if($aMembers[$i]) {
if( '' != $sActionResult = _sendSpamReport($iProfileId, $aMembers[$i]) ) {
break;
}
}
}
}
if(!$sActionResult) {
$sActionResult = MsgBox( _t('_Report about spam was sent') );
}
return $sActionResult;
}
/**
* Delete from friends list
*
* @param $iProfileId integer
* @param $iMemberId integer
* @return text - html presentation data
*/
function PageListFriendRemove($iProfileId, $iMemberId = 0)
{
$sOutputCode = '';
$iProfileId = (int) $iProfileId;
$iMemberId = (int) $iMemberId;
if(!$iMemberId || !getProfileInfo($iMemberId))
return MsgBox( _t('_Failed to apply changes'));
bx_import('BxTemplCommunicator');
$oCommunicator = new BxTemplCommunicator(array('member_id' => $iProfileId));
$aParams = array($iMemberId);
$oCommunicator -> execFunction( '_deleteRequest', 'sys_friend_list', $aParams, array(1, 1));
return MsgBox( _t('_Friend was removed') );
}
/**
* Put to friends list
*
* @param $iProfileId integer
* @param $iMemberId integer
* @return text - html presentation data
*/
function PageListFriend($iProfileId, $iMemberId = 0)
{
$sOutputCode = '';
$iProfileId = (int) $iProfileId;
$iMemberId = (int) $iMemberId;
if( !$iMemberId || !getProfileInfo($iMemberId) ) {
return MsgBox( _t('_Failed to apply changes') );
}
// block members
if ( isBlocked($iMemberId, $iProfileId) ) {
return MsgBox( _t('_You have blocked by this profile') );
}
//check friends pair
$aFriendsInfo = db_assoc_arr("SELECT * FROM `sys_friend_list`
WHERE (`ID`='{$iProfileId}' AND `Profile`='{$iMemberId}')
OR (`ID`='{$iMemberId}' AND `Profile` = '{$iProfileId}')");
//-- process friend request --//
if($aFriendsInfo) {
if( isset($aFriendsInfo['Check']) && $aFriendsInfo['Check'] == 1) {
$sOutputCode = MsgBox( _t('_already_in_friend_list') );
} else if( isset($aFriendsInfo['ID'], $aFriendsInfo['Check']) ) {
if ($iProfileId == $aFriendsInfo['ID'] && $aFriendsInfo['Check'] == 0) {
$sOutputCode = MsgBox( _t('_pending_friend_request') );
} else {
//make paier as friends
$sQuery = "UPDATE `sys_friend_list` SET `Check` = '1'
WHERE `ID` = '{$iMemberId}' AND `Profile` = '{$iProfileId}';";
if ( db_res($sQuery, 0) ) {
$sOutputCode = MsgBox( _t('_User was added to friend list') );
//send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('friend', 'accept', $iMemberId, $iProfileId);
$oZ->alert();
} else {
$sOutputCode = MsgBox( _t('_Failed to apply changes') );
}
}
} else {
$sOutputCode = MsgBox( _t('_Failed to apply changes') );
}
} else {
//create new friends request
$sQuery = "INSERT INTO `sys_friend_list` SET
`ID` = '{$iProfileId}', `Profile` = '{$iMemberId}', `Check` = '0'";
if ( db_res($sQuery, 0) ) {
$sOutputCode = MsgBox( _t('_User was invited to friend list') );
//send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('friend', 'request', $iMemberId, $iProfileId);
$oZ -> alert();
// send email notification
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate -> getTemplate('t_FriendRequest', $iMemberId);
$aRecipient = getProfileInfo($iMemberId);
$aPlus = array(
'Recipient' => getNickName($aRecipient['ID']),
'SenderLink' => getProfileLink($iProfileId),
'Sender' => getNickName($iProfileId),
'RequestLink' => BX_DOL_URL_ROOT
. 'communicator.php?communicator_mode=friends_requests',
);
sendMail( $aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus );
} else {
$sOutputCode = MsgBox( _t('_Failed to apply changes') );
}
}
//--
return $sOutputCode;
}
/**
* Put to hot list
*
* @param integer $iId profile initiating the action
* @param integer $iProfileId target profile
* @return text - html presentation data
*/
function PageListHot($iId, $iProfileId = 0)
{
$sOutputCode = '';
$iId = (int) $iId;
$iProfileId = (int) $iProfileId;
if(!$iProfileId || !getProfileInfo($iProfileId))
return MsgBox(_t('_Failed to apply changes'));
$sQuery = "INSERT IGNORE INTO `sys_fave_list` SET `ID` = '{$iId}', `Profile` = '{$iProfileId}'";
if((int)$GLOBALS['MySQL']->query($sQuery) > 0) {
$sOutputCode = MsgBox( _t('_User was added to favourites') );
//send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('fave', 'add', $iProfileId, $iId);
$oZ -> alert();
} else
$sOutputCode = MsgBox(_t('_Failed to apply changes'));
return $sOutputCode;
}
/**
* Remove to hot list
*
* @param integer $iId profile initiating the action
* @param integer $iProfileId target profile
* @return text - html presentation data
*/
function PageListHotRemove($iId, $iProfileId = 0)
{
$sOutputCode = '';
$iId = (int)$iId;
$iProfileId = (int)$iProfileId;
if(!$iProfileId || !getProfileInfo($iProfileId))
return MsgBox(_t('_Failed to apply changes'));
$sQuery = "DELETE FROM `sys_fave_list` WHERE `ID`='{$iId}' AND `Profile`='{$iProfileId}'";
if((int)$GLOBALS['MySQL']->query($sQuery) > 0) {
$sOutputCode = MsgBox(_t('_User was removed from favourites'));
//send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('fave', 'remove', $iProfileId, $iId);
$oZ -> alert();
} else
$sOutputCode = MsgBox(_t('_Failed to apply changes'));
return $sOutputCode;
}
/**
* Unblock profile
*
* @param $sourceID
* @param $targetID
* @return unknown_type
*/
function PageListUnBlock($iProfileId, $iMemberId = 0)
{
$sOutputCode = '';
$iProfileId = (int) $iProfileId;
$iMemberId = (int) $iMemberId;
if( !$iMemberId || !getProfileInfo($iMemberId) ) {
return MsgBox( _t('_Failed to apply changes') );
}
bx_import('BxDolCommunicator');
$oCommunicator = new BxDolCommunicator(array('member_id' => $iMemberId));
if( $oCommunicator -> _deleteRequest('sys_block_list', $iProfileId) ){
$sOutputCode = MsgBox( _t('_User was removed from block list') );
} else {
$sOutputCode = MsgBox( _t('_Failed to apply changes') );
}
return $sOutputCode;
}
/**
* Block profile
*
* @param $iProfileId integer
* @param $iMemberId integer
* @return text - html presentation data
*/
function PageListBlock($iProfileId, $iMemberId = 0)
{
$sOutputCode = '';
$iProfileId = (int) $iProfileId;
$iMemberId = (int) $iMemberId;
if( !$iMemberId || !getProfileInfo($iMemberId) ) {
return MsgBox( _t('_Failed to apply changes') );
}
$sQuery = "REPLACE INTO `sys_block_list`
SET `ID` = '{$iProfileId}', `Profile` = '{$iMemberId}'";
if( db_res($sQuery, 0) ) {
$sOutputCode = MsgBox( _t('_User was added to block list') );
// send system alert
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('block', 'add', $iMemberId, $iProfileId);
$oZ->alert();
//delete from friends
$sQuery = "DELETE FROM `sys_friend_list` WHERE
(`ID`='{$iProfileId}' AND `Profile`='{$iMemberId}') OR (`ID`='{$iMemberId}'
AND `Profile`='{$iProfileId}')";
db_res($sQuery);
} else {
$sOutputCode = MsgBox( _t('_Failed to apply changes') );
}
return $sOutputCode;
}
/**
* Change member's menu position ;
*
* @param $iProfileId integer
* @param $sMenuPosition string
* @param $sAction string
* @return text - html presentation data
*/
function PageListMemberMenuSettings($iProfileId, $sAction)
{
$iProfileId = (int) $iProfileId;
// define default menu position;
if ( isset($_COOKIE['menu_position']) ) {
$sDefaultValue = clear_xss($_COOKIE['menu_position']);
} else {
$sDefaultValue = getParam('ext_nav_menu_top_position');
}
//get form
$aForm = array (
'form_attrs' => array (
'action' => BX_DOL_URL_ROOT . 'list_pop.php?action=' . clear_xss($sAction),
'method' => 'post',
'name' => 'menu_position_form'
),
'params' => array (
'db' => array(
'submit_name' => 'do_submit',
),
),
'inputs' => array(
array(
'type' => 'radio_set',
'name' => 'menu_settings',
'caption' => 'Position',
'dv' => '<br />',
'values' => array(
'top' => _t('_Top'),
'bottom' => _t('_Bottom'),
'static' => _t('_Static'),
),
'required' => true,
'checker' => array (
'func' => 'length',
'params' => array(3, 6),
'error' => _t('_Error occured'),
),
'value' => $sDefaultValue,
'db' => array (
'pass' => 'Xss',
),
),
array(
'type' => 'submit',
'name' => 'do_submit',
'value' => _t('_Save Changes'),
)
),
);
$oForm = new BxTemplFormView($aForm);
$oForm -> initChecker();
if ( $oForm -> isSubmittedAndValid() ) {
$sCode = MsgBox( _t('_Saved') );
$sCode .=
'
<script type="text/javascript">
opener.location.reload();
window.close();
</script>
';
//change menu position
setcookie("menu_position", $oForm -> getCleanValue('menu_settings')
, time() + 60 * 60 * 24 * 180);
//clear member menu cache
bx_import('BxDolMemberMenu');
$oMemberMenu = new BxDolMemberMenu();
$oMemberMenu -> deleteMemberMenuKeyFile($iProfileId);
} else {
$sCode = $oForm->getCode();
}
return $sCode;
}
/**
* Perform admin or moderator actions
*
* @param $sAction string
* @param $iViewerId integer
* @param $iTargetId integer
* @return mixed - HTML code or FALSE
*/
function PageListControl($sAction, $iViewerId, $iTargetId)
{
$sAction = clear_xss($sAction);
$iViewerId = (int)$iViewerId;
$iTargetId = (int)$iTargetId;
$mixedRes = FALSE;
$sMsg = '_Error';
if (isAdmin($iViewerId) OR (isModerator($iViewerId) AND $iViewerId != $iTargetId))
{
switch ($sAction)
{
case 'activate':
case 'deactivate':
$mixedRes = _setStatus($iTargetId, $sAction);
break;
case 'ban':
if (bx_admin_profile_ban_control($iTargetId))
$sMsg = '_Success';
$mixedRes = MsgBox(_t($sMsg));
break;
case 'unban':
if (bx_admin_profile_ban_control($iTargetId, FALSE))
$sMsg = '_Success';
$mixedRes = MsgBox(_t($sMsg));
break;
case 'featured':
case 'unfeatured':
$mixedRes = _setFeature($iTargetId, $sAction);
break;
case 'delete':
profile_delete($iTargetId);
$mixedRes = MsgBox(_t('_Success')) . genAjaxyPopupJS($iTargetId, 'ajaxy_popup_result_div', BX_DOL_URL_ROOT . 'browse.php');
break;
case 'delete_spam':
profile_delete($iTargetId, TRUE);
$mixedRes = MsgBox(_t('_Success')) . genAjaxyPopupJS($iTargetId, 'ajaxy_popup_result_div', BX_DOL_URL_ROOT . 'browse.php');
break;
default:
}
}
return $mixedRes;
}
/**
* Change profile status
*
* @param $iTargetId integer
* @param $sAction string
* @return HTML - code for ajax popup
*/
function _setStatus($iTargetId, $sAction)
{
$sStatus = 'Approval';
$bSendActMail = FALSE;
$sMsg = '_Error';
if ($sAction == 'activate')
{
$sStatus = 'Active';
$bSendActMail = TRUE;
}
if (bx_admin_profile_change_status($iTargetId, $sStatus, $bSendActMail))
$sMsg = '_Success';
return MsgBox(_t($sMsg));
}
/**
* Change featured status
*
* @param $iTargetId integer
* @param $sType string
* @return HTML - code for ajax popup
*/
function _setFeature($iTargetId, $sType)
{
$bFeature = $sType == 'featured' ? TRUE : FALSE;
$sMsg = '_Error';
if (bx_admin_profile_featured_control($iTargetId, $bFeature))
$sMsg = '_Success';
return MsgBox(_t($sMsg));
}
/**
* Send spam report
*
* @param $iProfileId integer
* @param $iMemberId integer
* @return text - error message
*/
function _sendSpamReport($iProfileId, $iMemberId)
{
global $site;
$iProfileId = (int) $iProfileId;
$iMemberId = $iMemberId ? (int) $iMemberId : -1;
if( !$iMemberId || !getProfileInfo($iMemberId) ) {
return MsgBox( _t('_Failed to apply changes') );
}
//get email template
$oEmailTemplate = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplate -> getTemplate('t_SpamReport');
//-- get reporter information --//
$aReporter = getProfileInfo($iProfileId);
$aPlus = array();
$aPlus['reporterID'] = $iProfileId;
$aPlus['reporterNick'] = getNickName($aReporter['ID']);
//--
//-- get spamer info --//
$aSpamerInfo = getProfileInfo($iMemberId);
$aPlus['spamerID'] = $iMemberId;
$aPlus['spamerNick'] = getNickName($aSpamerInfo['ID']);
//--
//send message about spam
if( !sendMail( $site['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus ) ) {
return MsgBox( _t('_Report about spam failed to sent') );
}
}
//--