1 | <?php
|
---|
2 |
|
---|
3 | /***************************************************************************
|
---|
4 | * Dolphin Smart Community Builder
|
---|
5 | * -----------------
|
---|
6 | * begin : Mon Mar 23 2006
|
---|
7 | * copyright : (C) 2006 BoonEx Group
|
---|
8 | * website : http://www.boonex.com/
|
---|
9 | * This file is part of Dolphin - Smart Community Builder
|
---|
10 | *
|
---|
11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
---|
12 | * http://creativecommons.org/licenses/by/3.0/
|
---|
13 | *
|
---|
14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
---|
15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
16 | * See the Creative Commons Attribution 3.0 License for more details.
|
---|
17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
---|
18 | * see license.txt file; if not, write to marketing@boonex.com
|
---|
19 | ***************************************************************************/
|
---|
20 |
|
---|
21 | require_once( 'inc/header.inc.php' );
|
---|
22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
---|
23 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
---|
24 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolEmailTemplates.php' );
|
---|
25 |
|
---|
26 | $_page['name_index'] = 44;
|
---|
27 |
|
---|
28 | $logged['member'] = member_auth(0);
|
---|
29 |
|
---|
30 | $sourceID = ( isset($_COOKIE['memberID']) ) ? (int) $_COOKIE['memberID'] : 0 ;
|
---|
31 | $targetID = ( isset($_GET['ID']) ) ? (int) $_GET['ID'] : 0;
|
---|
32 | $action = ( isset($_GET['action']) ) ? $_GET['action'] : exit ;
|
---|
33 |
|
---|
34 | $sMenuPosition = ( isset($_POST['menu_settings']) ) ? $_POST['menu_settings'] : null;
|
---|
35 |
|
---|
36 | $_ni = $_page['name_index'];
|
---|
37 |
|
---|
38 | $bAjxMod = ($_REQUEST['mode']=='ajax') ? true : false;
|
---|
39 | $sJQueryJS = genAjaxyPopupJS($targetID);
|
---|
40 |
|
---|
41 | switch ($action)
|
---|
42 | {
|
---|
43 | case 'extra_menu':
|
---|
44 | $sPageCaption = _t( '_Member menu position' );
|
---|
45 | $_page['header'] = $sPageCaption;
|
---|
46 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption, getMemberMenuSettings($sMenuPosition), $oTemplConfig -> PageListPop_db_num);
|
---|
47 | break;
|
---|
48 |
|
---|
49 | case 'block':
|
---|
50 |
|
---|
51 | if ($bAjxMod) {
|
---|
52 | echo PageListBlock($sourceID, $targetID) . $sJQueryJS; exit;
|
---|
53 | }
|
---|
54 |
|
---|
55 | $sPageCaption = _t( '_Block list' );
|
---|
56 | $_page['header'] = $sPageCaption;
|
---|
57 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption, PageListBlock($sourceID, $targetID), $oTemplConfig -> PageListPop_db_num );
|
---|
58 | break;
|
---|
59 |
|
---|
60 | case 'hot':
|
---|
61 |
|
---|
62 | if ($bAjxMod) {
|
---|
63 | echo PageListHot($sourceID, $targetID) . $sJQueryJS; exit;
|
---|
64 | }
|
---|
65 |
|
---|
66 | $sPageCaption = _t( '_Hot list' );
|
---|
67 | $_page['header'] = $sPageCaption;
|
---|
68 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption, PageListHot($sourceID, $targetID), $oTemplConfig -> PageListPop_db_num );
|
---|
69 | break;
|
---|
70 |
|
---|
71 | case 'friend':
|
---|
72 |
|
---|
73 | if ($bAjxMod) {
|
---|
74 | echo PageListFriend($sourceID, $targetID) . $sJQueryJS; exit;
|
---|
75 | }
|
---|
76 |
|
---|
77 | $sPageCaption = _t( '_Friend list' );
|
---|
78 | $_page['header'] = $sPageCaption;
|
---|
79 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption, PageListFriend($sourceID, $targetID), $oTemplConfig -> PageListPop_db_num );
|
---|
80 | break;
|
---|
81 |
|
---|
82 | case 'spam':
|
---|
83 | if ($bAjxMod) {
|
---|
84 | echo PageListSpam($sourceID, $targetID) . $sJQueryJS; exit;
|
---|
85 | }
|
---|
86 |
|
---|
87 | $sPageCaption = _t( '_Spam report' );
|
---|
88 | $_page['header'] = $sPageCaption;
|
---|
89 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $sPageCaption, PageListSpam($sourceID, $targetID), $oTemplConfig -> PageListPop_db_num);
|
---|
90 | break;
|
---|
91 |
|
---|
92 | case 'change_status':
|
---|
93 | if ($bAjxMod) {
|
---|
94 | $sStatus = ( isset($_GET['status']) ) ? $_GET['status'] : null;
|
---|
95 | if ($sStatus) {
|
---|
96 | echo ActionChangeStatus($sourceID, $sStatus); exit;
|
---|
97 | }
|
---|
98 | }
|
---|
99 | break;
|
---|
100 |
|
---|
101 | case 'change_status_message':
|
---|
102 | if ($bAjxMod && isset($_COOKIE['memberID']) ) {
|
---|
103 | echo ActionChangeStatusMessage();
|
---|
104 | exit;
|
---|
105 | }
|
---|
106 | break;
|
---|
107 | }
|
---|
108 |
|
---|
109 | PageCode();
|
---|
110 |
|
---|
111 | function ActionChangeStatus($iMemberID, $sStatus)
|
---|
112 | {
|
---|
113 | $sStatus = process_db_input ($sStatus, BX_TAGS_STRIP);
|
---|
114 | $oUserStatus = new BxDolUserStatusView();
|
---|
115 | if ( $oUserStatus -> getRegisteredStatus($sStatus) ) {
|
---|
116 | $sUpdateSQL = "UPDATE `Profiles` SET `UserStatus`='{$sStatus}' WHERE `ID` = '{$iMemberID}'";
|
---|
117 | db_res($sUpdateSQL);
|
---|
118 |
|
---|
119 | // update the date of last navigate;
|
---|
120 | $sQuery = "UPDATE `Profiles` SET `DateLastNav` = NOW() WHERE `ID` = '{$iMemberID}'";
|
---|
121 | db_res($sQuery);
|
---|
122 |
|
---|
123 | require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
|
---|
124 | $oZ = new BxDolAlerts('profile', 'edit_status', $iMemberID, $iMemberID);
|
---|
125 | $oZ->alert();
|
---|
126 |
|
---|
127 | createUserDataFile($iMemberID);
|
---|
128 |
|
---|
129 | $sStatusImg = getTemplateIcon( $oUserStatus -> getStatusIcon($iMemberID) );
|
---|
130 | }
|
---|
131 |
|
---|
132 | return $sStatusImg;
|
---|
133 | }
|
---|
134 |
|
---|
135 | function ActionChangeStatusMessage($iMemberIdForce = 0)
|
---|
136 | {
|
---|
137 | if ($iMemberIdForce)
|
---|
138 | $iMemberID = $iMemberIdForce;
|
---|
139 | else
|
---|
140 | $iMemberID = (isset($_COOKIE['memberID']) && isMember() ) ? (int) $_COOKIE['memberID'] : 0;
|
---|
141 | if($iMemberID) {
|
---|
142 | $sNewStatusMessage = process_db_input($_REQUEST['status_message'], BX_TAGS_STRIP);
|
---|
143 |
|
---|
144 | $sUpdateSQL = "UPDATE `Profiles` SET `UserStatusMessage`='{$sNewStatusMessage}', `UserStatusMessageWhen`=UNIX_TIMESTAMP() WHERE `ID` = '{$iMemberID}'";
|
---|
145 | db_res($sUpdateSQL, 0);
|
---|
146 |
|
---|
147 | require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
|
---|
148 | $oZ = new BxDolAlerts('profile', 'edit_status_message', $iMemberID, $iMemberID, array ($sNewStatusMessage));
|
---|
149 | $oZ->alert();
|
---|
150 |
|
---|
151 | createUserDataFile($iMemberID);
|
---|
152 | }
|
---|
153 | }
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Function will set member's menu position ;
|
---|
157 | *
|
---|
158 | * @param : $sValue (string) - selected position name;
|
---|
159 | * @return : (text) - Html presentation data ;
|
---|
160 | */
|
---|
161 | function getMemberMenuSettings( $sRadioValue = null )
|
---|
162 | {
|
---|
163 | $sParameters = null;
|
---|
164 | $sOutputHtml = null;
|
---|
165 | $sDefaultValue = null;
|
---|
166 |
|
---|
167 | $aLangugeKeys = array (
|
---|
168 | 'top' => _t( '_Top' ),
|
---|
169 | 'bottom' => _t( '_Bottom' ),
|
---|
170 | 'static' => _t( '_Static' ),
|
---|
171 | 'save' => _t( '_Save Changes' ),
|
---|
172 | 'saved' => _t( '_Saved' ),
|
---|
173 | );
|
---|
174 |
|
---|
175 | // define from glParam ;
|
---|
176 | if ( !$sRadioValue )
|
---|
177 | {
|
---|
178 | if ( isset($_COOKIE['menu_position']) ) {
|
---|
179 | $sDefaultValue = $_COOKIE['menu_position'];
|
---|
180 | }
|
---|
181 | else {
|
---|
182 | $sDefaultValue = getParam( 'ext_nav_menu_top_position' );
|
---|
183 | }
|
---|
184 | }
|
---|
185 |
|
---|
186 | // set menu position
|
---|
187 | if ( $sRadioValue ) {
|
---|
188 | $sOutputHtml = _t_action( $aLangugeKeys['saved'] );
|
---|
189 | $sOutputHtml .=
|
---|
190 | '
|
---|
191 | <script type="text/javascript">
|
---|
192 | opener.location.reload();
|
---|
193 | window.close();
|
---|
194 | </script>
|
---|
195 | ';
|
---|
196 |
|
---|
197 | setcookie("menu_position", $sRadioValue, time() + 60 * 60 * 24 * 180);
|
---|
198 | }
|
---|
199 |
|
---|
200 | // collect all received get parameters ;
|
---|
201 | foreach( $_GET as $sKey => $sValue )
|
---|
202 | {
|
---|
203 | $sParameters .= '&' . $sKey . '=' . $sValue;
|
---|
204 | }
|
---|
205 |
|
---|
206 | $aForm = array (
|
---|
207 | 'form_attrs' => array (
|
---|
208 | 'action' => $_SERVER['PHP_SELF'] . '?' . $sParameters,
|
---|
209 | 'method' => 'post',
|
---|
210 | 'name' => 'menu_position_form'
|
---|
211 | ),
|
---|
212 | 'inputs' => array(
|
---|
213 | array(
|
---|
214 | 'type' => 'radio_set',
|
---|
215 | 'name' => 'menu_settings',
|
---|
216 | 'caption' => 'Position',
|
---|
217 | 'dv' => '<br />',
|
---|
218 | 'values' => array(
|
---|
219 | 'top' => $aLangugeKeys['top'],
|
---|
220 | 'bottom' => $aLangugeKeys['bottom'],
|
---|
221 | 'static' => $aLangugeKeys['static'],
|
---|
222 | ),
|
---|
223 | 'value' => ( $sRadioValue ) ? $sRadioValue : $sDefaultValue
|
---|
224 | ),
|
---|
225 | array(
|
---|
226 | 'type' => 'submit',
|
---|
227 | 'name' => 'do_submit',
|
---|
228 | 'value' => $aLangugeKeys['save'],
|
---|
229 | 'colspan' => true,
|
---|
230 | )
|
---|
231 | ),
|
---|
232 | );
|
---|
233 |
|
---|
234 | $oForm = new BxTemplFormView($aForm);
|
---|
235 | $sOutputHtml .= $oForm->getCode();
|
---|
236 |
|
---|
237 | return $sOutputHtml;
|
---|
238 | }
|
---|
239 |
|
---|
240 | function PageListBlock( $sourceID, $targetID )
|
---|
241 | {
|
---|
242 | $targetID = (int) $targetID;
|
---|
243 | $ret = '';
|
---|
244 | $query = "REPLACE INTO `sys_block_list` SET `ID` = '$sourceID', `Profile` = '$targetID';";
|
---|
245 | if( db_res($query, 0) )
|
---|
246 | {
|
---|
247 | $ret = MsgBox(_t('_User was added to block list'));
|
---|
248 | }
|
---|
249 | else
|
---|
250 | {
|
---|
251 | $ret = _t_err('_Failed to apply changes');
|
---|
252 | }
|
---|
253 |
|
---|
254 | return $ret;
|
---|
255 | }
|
---|
256 |
|
---|
257 | function PageListHot($sourceID, $targetID)
|
---|
258 | {
|
---|
259 | $targetID = (int) $targetID;
|
---|
260 | $ret = '';
|
---|
261 |
|
---|
262 | $query = "REPLACE INTO `sys_fave_list` SET `ID` = '$sourceID', `Profile` = '$targetID';";
|
---|
263 | if( db_res($query, 0) )
|
---|
264 | {
|
---|
265 | $ret = MsgBox(_t('_User was added to hot list'));
|
---|
266 | }
|
---|
267 | else
|
---|
268 | {
|
---|
269 | $ret = _t_err('_Failed to apply changes');
|
---|
270 | }
|
---|
271 |
|
---|
272 | return $ret;
|
---|
273 | }
|
---|
274 |
|
---|
275 | function PageListFriend($sourceID, $targetID) {
|
---|
276 | $sourceID = (int)$sourceID;
|
---|
277 | $targetID = (int)$targetID;
|
---|
278 |
|
---|
279 | // block members
|
---|
280 | if( isBlocked($targetID, $sourceID) ) {
|
---|
281 | return MsgBox( _t('_You have blocked by this profile') );
|
---|
282 | }
|
---|
283 |
|
---|
284 | $temp = db_assoc_arr("SELECT * FROM `sys_friend_list` WHERE (`ID`='$sourceID' AND `Profile`='$targetID') OR (`ID`='$targetID' AND `Profile` = '$sourceID')");
|
---|
285 |
|
---|
286 | $ret = '';
|
---|
287 | if($temp['Check'] == 1)
|
---|
288 | $ret = MsgBox(_t('_already_in_friend_list'));
|
---|
289 | else if($sourceID == $temp['ID'] && $temp['Check'] == 0)
|
---|
290 | $ret = MsgBox(_t('_pending_friend_request'));
|
---|
291 | else if($targetID == $temp['ID'] && $temp['Check'] == 0) {
|
---|
292 | $query = "UPDATE `sys_friend_list` SET `Check` = '1' WHERE `ID` = '$targetID' AND `Profile` = '$sourceID';";
|
---|
293 | if(db_res($query)) {
|
---|
294 | $ret = MsgBox(_t('_User was added to friend list'));
|
---|
295 |
|
---|
296 | require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
|
---|
297 | $oZ = new BxDolAlerts('friend', 'accept', $targetID, $sourceID);
|
---|
298 | $oZ->alert();
|
---|
299 | }
|
---|
300 | else
|
---|
301 | $ret = _t_err('_Failed to apply changes');
|
---|
302 | }
|
---|
303 | else {
|
---|
304 | $query = "INSERT INTO `sys_friend_list` SET `ID` = '$sourceID', `Profile` = '$targetID', `Check` = '0';";
|
---|
305 | if(db_res($query)) {
|
---|
306 | $ret = MsgBox(_t('_User was invited to friend list'));
|
---|
307 |
|
---|
308 | require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
|
---|
309 | $oZ = new BxDolAlerts('friend', 'request', $targetID, $sourceID);
|
---|
310 | $oZ->alert();
|
---|
311 |
|
---|
312 | // send email notification
|
---|
313 | $oEmailTemplate = new BxDolEmailTemplates();
|
---|
314 | $aTemplate = $oEmailTemplate -> getTemplate('t_FriendRequest') ;
|
---|
315 |
|
---|
316 | $aRecipient = getProfileInfo($targetID);
|
---|
317 |
|
---|
318 | $aPlus = array(
|
---|
319 | 'Recipient' => $aRecipient['NickName'],
|
---|
320 | 'SenderLink' => getProfileLink($sourceID),
|
---|
321 | 'Sender' => getNickName($sourceID),
|
---|
322 | 'RequestLink' => BX_DOL_URL_ROOT . 'communicator.php?communicator_mode=friends_requests',
|
---|
323 | );
|
---|
324 |
|
---|
325 | sendMail( $aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus );
|
---|
326 | }
|
---|
327 | else
|
---|
328 | $ret = _t_err('_Failed to apply changes');
|
---|
329 | }
|
---|
330 | return $ret;
|
---|
331 | }
|
---|
332 |
|
---|
333 | function PageListSpam($reporterID, $aSpamers)
|
---|
334 | {
|
---|
335 | global $site;
|
---|
336 |
|
---|
337 | // init some nedded variables ;
|
---|
338 |
|
---|
339 | $ret = _t_err('_Report about spam failed to sent');
|
---|
340 |
|
---|
341 | $oEmailTemplate = new BxDolEmailTemplates();
|
---|
342 | $aTemplate = $oEmailTemplate -> getTemplate( 't_SpamReport' ) ;
|
---|
343 |
|
---|
344 | // reporter information ;
|
---|
345 | $aReporter = getProfileInfo( $reporterID );
|
---|
346 |
|
---|
347 | $aPlus = array();
|
---|
348 | $aPlus['reporterID'] = $reporterID;
|
---|
349 | $aPlus['reporterNick'] = $aReporter['NickName'];
|
---|
350 |
|
---|
351 | // try to define as Array ;
|
---|
352 | $aSpamers = explode(',', $aSpamers);
|
---|
353 | if ( is_array($aSpamers) and !empty($aSpamers) )
|
---|
354 | {
|
---|
355 | $aSpamers = array_unique($aSpamers);
|
---|
356 | foreach($aSpamers AS $spamerID)
|
---|
357 | { $aSpamerInfo = getProfileInfo( $spamerID );
|
---|
358 |
|
---|
359 | $aPlus['spamerID'] = $spamerID;
|
---|
360 | $aPlus['spamerNick'] = $aSpamerInfo['NickName'];
|
---|
361 |
|
---|
362 | $mail_result = sendMail( $site['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus );
|
---|
363 |
|
---|
364 | if ( $mail_result )
|
---|
365 | $ret = MsgBox(_t('_Report about spam was sent'));
|
---|
366 | }
|
---|
367 | }
|
---|
368 |
|
---|
369 | return $ret;
|
---|
370 | }
|
---|
371 |
|
---|
372 | ?>
|
---|