source: trunk/member.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 26.5 KB
Line 
1<?php
2/***************************************************************************
3* Dolphin Smart Community Builder
4* -----------------
5* begin : Mon Mar 23 2006
6* copyright : (C) 2006 BoonEx Group
7* website : http://www.boonex.com/
8* This file is part of Dolphin - Smart Community Builder
9*
10* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
11* http://creativecommons.org/licenses/by/3.0/
12*
13* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15* See the Creative Commons Attribution 3.0 License for more details.
16* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
17* see license.txt file; if not, write to marketing@boonex.com
18***************************************************************************/
19
20define('BX_MEMBER_PAGE', 1);
21
22require_once( 'inc/header.inc.php' );
23require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
25require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
26
27bx_import('BxDolMemberMenu');
28bx_import('BxDolPageView');
29
30//--------------------------------------- member account class ------------------------------------------//
31class BxDolMember extends BxDolPageView {
32
33 // member ID
34 var $iMember;
35
36 // member info
37 var $aMemberInfo;
38
39 // config site array
40 var $aConfSite;
41
42 // config dir array
43 var $aConfDir;
44
45 /*
46 constructor
47 * @param int $iMember - member ID
48 */
49 function BxDolMember($iMember, &$aSite, &$aDir) {
50 $this->iMember = (int)$iMember;
51 $this->aMemberInfo = getProfileInfo($this->iMember);
52
53 $this->aConfSite = $aSite;
54 $this->aConfDir = $aDir;
55
56 parent::BxDolPageView('member');
57 }
58
59 function getBlockCode_Mailbox () {
60 $sInboxC = _t('_Inbox');
61 $sSentC = _t('_Sent');
62 $sWriteC = _t('_Write');
63 $sTrashC = _t('_Trash');
64 $sContactsC = _t('_Contacts');
65 $sLettersC = _t('_letters');
66 $sUnreadC = strtolower(_t('_Unread'));
67 $sUnopenedC = strtolower(_t('_Unopened'));
68 $sComposeNewLetterC = strtolower(_t('_COMPOSE_H'));
69 $sFriendsC = strtolower(_t('_Friends'));
70 $sFavesC = strtolower(_t('_Faves'));
71 $sContactedC = strtolower(_t('_Contacted'));
72
73 $sInboxIcon = getTemplateIcon('mailbox_inbox32.png');
74 $sSentIcon = getTemplateIcon('mailbox_sent32.png');
75 $sWriteIcon = getTemplateIcon('mailbox_write32.png');
76 $sTrashIcon = getTemplateIcon('mailbox_trash32.png');
77 $sContactsIcon = getTemplateIcon('mailbox_contacts32.png');
78
79 $iChMemberID = ($this->aMemberInfo['ID'] > 0) ? $this->aMemberInfo['ID'] : $this->iMember;
80
81 bx_import('BxTemplMailBox');
82
83 $iInboxAllCnt = BxDolMailBox::getCountInboxMessages($iChMemberID, '0');
84 $iInboxNewCnt = BxDolMailBox::getCountInboxMessages($iChMemberID, '1');
85
86 $iSentAllCnt = BxDolMailBox::getCountSentMessages($iChMemberID, '0');
87 $iSentNewCnt = BxDolMailBox::getCountSentMessages($iChMemberID, '1');
88
89 $iTrashAllCnt = BxDolMailBox::getCountTrashedMessages($iChMemberID, '0');
90 $iTrashNewCnt = BxDolMailBox::getCountTrashedMessages($iChMemberID, '1');
91
92 $aInboxKeys = array (
93 'notify_icon' => $sInboxIcon,
94 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=inbox">' . $sInboxC . '</a>',
95 'notify_text1' => $iInboxAllCnt . ' ' . $sLettersC,
96 'notify_text1_class' => 'smallInfoUnit',
97 'bx_if:allow_2nd_line' => array(
98 'condition' => true,
99 'content' => array(
100 'notify_text2' => $iInboxNewCnt . ' ' . $sUnreadC,
101 'notify_text2_class' => 'smallInfoUnit'
102 )
103 )
104 );
105 $sInbox = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aInboxKeys);
106
107 $aSentKeys = array (
108 'notify_icon' => $sSentIcon,
109 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=outbox">' . $sSentC . '</a>',
110 'notify_text1' => $iSentAllCnt . ' ' . $sLettersC,
111 'notify_text1_class' => 'smallInfoUnit',
112 'bx_if:allow_2nd_line' => array(
113 'condition' => true,
114 'content' => array(
115 'notify_text2' => $iSentNewCnt . ' ' . $sUnopenedC,
116 'notify_text2_class' => 'smallInfoUnit'
117 )
118 )
119 );
120 $sSent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aSentKeys);
121
122 $aWriteKeys = array (
123 'notify_icon' => $sWriteIcon,
124 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=compose">' . $sWriteC . '</a>',
125 'notify_text1' => $sComposeNewLetterC,
126 'notify_text1_class' => 'smallShortInfoUnit',
127 'bx_if:allow_2nd_line' => array(
128 'condition' => false,
129 'content' => array()
130 )
131 );
132 $sWrite = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aWriteKeys);
133
134 $aTrashKeys = array (
135 'notify_icon' => $sTrashIcon,
136 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=trash">' . $sTrashC . '</a>',
137 'notify_text1' => $iTrashAllCnt . ' ' . $sLettersC,
138 'notify_text1_class' => 'smallInfoUnit',
139 'bx_if:allow_2nd_line' => array(
140 'condition' => true,
141 'content' => array(
142 'notify_text2' => $iTrashNewCnt . ' ' . $sUnreadC,
143 'notify_text2_class' => 'smallInfoUnit'
144 )
145 )
146 );
147 $sTrash = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aTrashKeys);
148
149 $aContactsKeys = array (
150 'notify_icon' => $sContactsIcon,
151 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'communicator.php">' . $sContactsC . '</a>',
152 'notify_text1' => $sFriendsC . ', ' . $sFavesC . ', ' . $sContactedC,
153 'notify_text1_class' => 'smallShortInfoUnit',
154 'bx_if:allow_2nd_line' => array(
155 'condition' => false,
156 'content' => array()
157 )
158 );
159 $sContacts = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aContactsKeys);
160
161 $sInboxClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=inbox' . "'";
162 $sInboxBlock = $GLOBALS['oFunctions']->genNotifyMessage($sInbox, 'none', true, $sInboxClick);
163
164 $sOutboxClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=outbox' . "'";
165 $sSentBlock = $GLOBALS['oFunctions']->genNotifyMessage($sSent, 'none', true, $sOutboxClick);
166
167 $sComposeClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=compose' . "'";
168 $sWriteBlock = $GLOBALS['oFunctions']->genNotifyMessage($sWrite, 'none', true, $sComposeClick);
169
170 $sTrashClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=trash' . "'";
171 $sTrashBlock = $GLOBALS['oFunctions']->genNotifyMessage($sTrash, 'none', true, $sTrashClick);
172
173 $sContactsClick = "location.href='" . BX_DOL_URL_ROOT . 'communicator.php' . "'";
174 $sContactsBlock = $GLOBALS['oFunctions']->genNotifyMessage($sContacts, 'none', true, $sContactsClick);
175
176 $sMailboxButtons = '<div class="bx_sys_default_padding">'.$sInboxBlock.$sSentBlock.$sWriteBlock.$sTrashBlock.$sContactsBlock.'<div class="clear_both"></div></div><div class="clear_both"></div>';
177 return $sMailboxButtons;
178 //return $GLOBALS['oFunctions']->centerContent ($sMailboxButtons, '.notify_message');
179 }
180
181 function getBlockCode_Friends() {
182 $iLimit = 10;
183
184 $sAllFriends = 'viewFriends.php?iUser=' . $this->iMember;
185 $sOutputHtml = null;
186
187 // count all friends ;
188 $iCount = getFriendNumber($this->iMember);
189
190 $sPaginate = '';
191 if ($iCount) {
192 $iPages = ceil($iCount/ $iLimit);
193 $iPage = ( isset($_GET['page']) ) ? (int) $_GET['page'] : 1;
194
195 if ( $iPage < 1 ) {
196 $iPage = 1;
197 }
198 if ( $iPage > $iPages ) {
199 $iPage = $iPages;
200 }
201
202 $sqlFrom = ($iPage - 1) * $iLimit;
203 $sqlLimit = "LIMIT {$sqlFrom}, {$iLimit}";
204 } else {
205 return ;
206 }
207
208 $aAllFriends = getMyFriendsEx($this->iMember, '', 'image', $sqlLimit);
209 $iCurrCount = count($aAllFriends);
210 foreach ($aAllFriends as $iFriendID => $aFriendsPrm) {
211 $sOutputHtml .= '<div class="member_block">';
212 $sOutputHtml .= get_member_thumbnail( $iFriendID, 'none', true, 'visitor', array('is_online' => $aFriendsPrm[5]));
213 $sOutputHtml .= '</div>';
214 }
215
216 $sOutputHtml = $GLOBALS['oFunctions']->centerContent($sOutputHtml, '.member_block');
217 $oPaginate = new BxDolPaginate(array(
218 'page_url' => $_SERVER['PHP_SELF'],
219 'count' => $iCount,
220 'per_page' => $iLimit,
221 'page' => $iPage,
222 'per_page_changer' => true,
223 'page_reloader' => true,
224 'on_change_page' => 'return !loadDynamicBlock({id}, \'member.php?page={page}&per_page={per_page}\');',
225 'on_change_per_page' => ''
226 ));
227
228 $sPaginate = $oPaginate->getSimplePaginate($sAllFriends);
229 return array( $sOutputHtml, array(), $sPaginate);
230 }
231
232 function getBlockCode_AccountControl() {
233 global $oTemplConfig, $site, $aPreValues;
234
235 //--- Load cache of sys_account_custom_stat_elements ---//
236 $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
237 //--- Load cache of sys_stat_member ---//
238 $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
239 //--- end of loading caches ---//
240
241 //Labels
242 $sUsernameC = _t('_NickName');
243 $sProfileStatusC = _t('_Profile status');
244 $sPresenceC = _t('_Presence');
245 $sMembershipC = _t('_Membership2');
246 $sLastLoginC = _t('_Last login');
247 $sRegistrationC = _t('_Registration');
248 $sEmailC = _t('_Email');
249 $sGreetedC = _t('_greeted');
250 $sGreetedMeC = _t('_Greeted me');
251 $sBlockedC = _t('_blocked');
252 $sViewedMeC = _t('_Viewed me');
253 $sMembersC = ' ' . _t('_Members');
254 $sEditProfileInfoC = _t('_Edit profile info');
255 $sProfileC = _t('_Profile');
256 $sAccountInfoC = _t('_Account Info');
257 $sActivityC = _t('_Tracker');
258 $sCustomC = _t('_Custom');
259
260 $sMaleIcon = getTemplateIcon('male.png');
261 $sFemaleIcon = getTemplateIcon('female.png');
262
263 // Values
264 $sUsername = $this->aMemberInfo['NickName'];
265 $sUserLink = getProfileLink($this->aMemberInfo['ID']);
266 $sOwnerThumb = get_member_thumbnail($this->aMemberInfo['ID'], 'none', true);
267 $iYears = age($this->aMemberInfo['DateOfBirth']);
268 $sYearsOld = _t('_y/o', $iYears);
269 $sProfileIcon = ($this->aMemberInfo['Sex'] == 'male') ? $sMaleIcon : $sFemaleIcon;
270
271 $sCountryName = _t($aPreValues['Country'][ $this->aMemberInfo['Country'] ]['LKey']);
272 $sCityName = $this->aMemberInfo['City'];
273 $sCountryPic = ($this->aMemberInfo['Country']=='') ? '' : ' <img alt="'.$this->aMemberInfo['Country'].'" src="'.($site['flags'].strtolower($this->aMemberInfo['Country'])).'.gif"/>';
274
275 $sProfileStatus = _t( "__{$this->aMemberInfo['Status']}" );
276 $sProfileStatusMess = '';
277 switch ( $this->aMemberInfo['Status'] ) {
278 case 'Unconfirmed': $sProfileStatusMess = _t( "_ATT_UNCONFIRMED", $oTemplConfig -> popUpWindowWidth, $oTemplConfig -> popUpWindowHeight ); break;
279 case 'Approval': $sProfileStatusMess = _t( "_ATT_APPROVAL", $oTemplConfig -> popUpWindowWidth, $oTemplConfig -> popUpWindowHeight ); break;
280 case 'Active': $sProfileStatusMess = _t( "_ATT_ACTIVE", $oTemplConfig -> popUpWindowWidth, $oTemplConfig -> popUpWindowHeight ); break;
281 case 'Rejected': $sProfileStatusMess = _t( "_ATT_REJECTED", $oTemplConfig -> popUpWindowWidth, $oTemplConfig -> popUpWindowHeight ); break;
282 case 'Suspended': $sProfileStatusMess = _t( "_ATT_SUSPENDED", $oTemplConfig -> popUpWindowWidth, $oTemplConfig -> popUpWindowHeight ); break;
283 }
284
285 $sMembership = '';
286 $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
287 $sMembership = <<<EOF
288 <tr class="account_control_tr">
289 <td valign=top class="account_control_left">{$sMembershipC}:</td>
290 <td valign=top class="account_control_right">
291 {$sMembStatus}
292 </td>
293 </tr>
294EOF;
295
296 $oForm = bx_instance('BxDolFormCheckerHelper');
297
298 if ( !$this->aMemberInfo['DateLastLogin'] || $this->aMemberInfo['DateLastLogin'] == "0000-00-00 00:00:00" ) {
299 $sLastLogin = 'never';
300 } else {
301 $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
302 $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
303 }
304
305 if ( !$this->aMemberInfo['DateReg'] || $this->aMemberInfo['DateReg'] == "0000-00-00 00:00:00" ) {
306 $sRegistration = 'never';
307 } else {
308 $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
309 $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
310 }
311
312 $sEmail = $this->aMemberInfo['Email'];
313
314 $this->aMemberInfo = getProfileInfo($this->aMemberInfo['ID']);
315
316 //my greeted contacts
317 $sMGCSQL = $aPQStatisticsElements['mgc']['SQL'];
318 $sMGCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGCSQL);
319 $iGreetedContactsCnt = (int)db_value($sMGCSQL);
320
321 //my greeted me contacts
322 $sMGMCSQL = $aPQStatisticsElements['mgmc']['SQL'];
323 $sMGMCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGMCSQL);
324 $iGreetedMeContactsCnt = (int)db_value($sMGMCSQL);
325
326 //my blocked contacts
327 $sMBCSQL = $aPQStatisticsElements['mbc']['SQL'];
328 $sMBCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMBCSQL);
329 $iBlockedContactsCnt = (int)db_value($sMBCSQL);
330
331 $iViewedMeContactsCnt = (int)$this->aMemberInfo['Views'];
332
333 $bModuleExists = false;
334 $aCustomElements = array();
335 $aCustomElements['header5'] = array(
336 'type' => 'block_header',
337 'caption' => $sCustomC,
338 'collapsable' => true
339 );
340
341 foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
342 $sUnparsedLabel = $aMemberStats['Label'];
343 $sUnparsedValue = $aMemberStats['Value'];
344
345 $sLabel = _t($sUnparsedLabel);
346 $sUnparsedValue = str_replace('__site_url__', $site['url'], $sUnparsedValue);
347
348 //step 1 - replacements of keys
349 $sLblTmpl = '__l_';
350 $sTmpl = '__';
351 while ($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) {
352 $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
353 if ($iEndPos > $iStartPos) {
354 $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos-$iStartPos - strlen($sLblTmpl));
355 $sKeyValue = strtolower(_t('_' . $sSubstr));
356 $sUnparsedValue = str_replace($sLblTmpl.$sSubstr.$sTmpl, $sKeyValue, $sUnparsedValue);
357 } else {
358 break;
359 }
360 }
361
362 //step 2 - replacements of Stat keys
363 while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) >= 0) {
364 $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
365 if ($iEndPos > $iStartPos) {
366 $iCustomCnt = 0;
367 $sSubstr = process_db_input( substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos-$iStartPos - strlen($sTmpl)), BX_TAGS_STRIP);
368 if ($sSubstr) {
369 $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL'];
370 $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL);
371 $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL);
372 $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL);
373 $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL);
374 $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL);
375 $iCustomCnt = ($sCustomSQL!='') ? (int)db_value($sCustomSQL) : '';
376 }
377 $sUnparsedValue = str_replace($sTmpl.$sSubstr.$sTmpl, $iCustomCnt, $sUnparsedValue);
378 } else {
379 break;
380 }
381 }
382
383 $sCustomElements .= <<<EOF
384 <tr class="account_control_tr">
385 <td class="account_control_left">{$sLabel}: </td>
386 <td class="account_control_right">
387 {$sUnparsedValue}
388 </td>
389 </tr>
390EOF;
391
392 $sTrimmedLabel = trim($sUnparsedLabel, '_');
393 $aCustomElements[$sTrimmedLabel] = array(
394 'type' => 'custom',
395 'name' => $sTrimmedLabel,
396 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue,
397 'colspan' => true
398 );
399 if (! $bModuleExists) $bModuleExists = true;
400 }
401 $aCustomElements['header5_end'] = array(
402 'type' => 'block_end'
403 );
404
405 $sProfileInfoCont = <<<EOF
406<div class="infoMain">
407 <div class="memberPic" style="margin-left:0px;padding:0px;text-align:center;width:70px;">
408 {$sOwnerThumb}
409 </div>
410 <div class="infoText">
411 <div class="infoUnit">
412 <img src="{$sProfileIcon}" />
413 {$sYearsOld}
414 </div>
415 <div class="infoUnit">
416 {$sCountryPic} {$sCountryName}, {$sCityName}
417 </div>
418 <div class="infoUnit">
419 <a href="{$site['url']}pedit.php?ID={$this->aMemberInfo['ID']}">{$sEditProfileInfoC}</a>
420 </div>
421 </div>
422</div>
423<div class="clear_both"></div>
424EOF;
425
426 require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php' );
427 $oStatusView = new BxDolUserStatusView();
428 $sUserStatus = '';
429
430 if ($oStatusView -> aStatuses){
431 foreach($oStatusView -> aStatuses as $sKey => $aItems) {
432 $sTitle = _t($aItems['title']);
433 $sOnclick = (strtolower($this->aMemberInfo['UserStatus']) == strtolower($sKey)) ? "" : "onclick=\"if (typeof oBxUserStatus != 'undefined' ) { oBxUserStatus.setUserStatus('$sKey', $(this).parents('ul:first')); $('#user_status_ac .block_collapse_btn').attr('src', aDolImages['collapse_closed']); $('#user_status_ac').parent().toggleClass('collapsed').next('tbody').fadeOut(400); location.reload(); }return false\"";
434 $aTemplateKeys = array (
435 'bx_if:item_img' => array (
436 'condition' => ( true ),
437 'content' => array (
438 'item_img_src' => $GLOBALS['oFunctions'] -> getTemplateIcon($aItems['icon']),
439 'item_img_alt' => $sTitle,
440 'item_img_width' => 16,
441 'item_img_height' => 16,
442 ),
443 ),
444 'item_link' => 'javascript:void(0)',
445 'item_onclick' => $sOnclick,
446 'item_title' => $sTitle,
447 'extra_info' => null,
448 );
449 $sUserStatus .= $GLOBALS['oSysTemplate'] -> parseHtmlByName( 'account_control_member_status.html', $aTemplateKeys );
450 }
451 }
452
453 $aForm = array(
454 'form_attrs' => array(
455 'action' => '',
456 'method' => 'post',
457 ),
458 'params' => array(
459 'remove_form' => true,
460 ),
461 'inputs' => array(
462 'header1' => array(
463 'type' => 'block_header',
464 'caption' => $sProfileC,
465 'collapsable' => true
466 ),
467 'Info' => array(
468 'type' => 'custom',
469 'name' => 'Info',
470 'content' => $sProfileInfoCont,
471 'colspan' => true
472 ),
473 'header1_end' => array(
474 'type' => 'block_end'
475 ),
476 'header2' => array(
477 'type' => 'block_header',
478 'caption' => $sPresenceC,
479 'collapsable' => true,
480 'collapsed' => true,
481 'attrs' => array (
482 'id' => 'user_status_ac',
483 ),
484 ),
485 'UserStatus' => array(
486 'type' => 'custom',
487 'name' => 'Info',
488 'content' => $sUserStatus,
489 'colspan' => true
490 ),
491 'header2_end' => array(
492 'type' => 'block_end'
493 ),
494 'header3' => array(
495 'type' => 'block_header',
496 'caption' => $sAccountInfoC,
497 'collapsable' => true
498 ),
499 'Username' => array(
500 'type' => 'custom',
501 'name' => 'Username',
502 'content' => '<b>' . $sUsernameC . ':</b> <a href="'.$sUserLink.'" >' . $sUsername . '</a>',
503 'colspan' => true
504 ),
505 'Email' => array(
506 'type' => 'custom',
507 'name' => 'Email',
508 'content' => '<b>' . $sEmailC . ':</b> ' . $sEmail,
509 'colspan' => true
510 ),
511 'Status' => array(
512 'type' => 'custom',
513 'name' => 'Status',
514 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . ' ' . $sProfileStatusMess,
515 'colspan' => true
516 ),
517 'Membership' => array(
518 'type' => 'custom',
519 'name' => 'Membership',
520 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus,
521 'colspan' => true
522 ),
523 'LastLogin' => array(
524 'type' => 'custom',
525 'name' => 'LastLogin',
526 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin,
527 'colspan' => true
528 ),
529 'Registration' => array(
530 'type' => 'custom',
531 'name' => 'Registration',
532 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration,
533 'colspan' => true
534 ),
535 'header3_end' => array(
536 'type' => 'block_end'
537 ),
538 'header4' => array(
539 'type' => 'block_header',
540 'caption' => $sActivityC,
541 'collapsable' => true
542 ),
543 'ViewedMe' => array(
544 'type' => 'custom',
545 'name' => 'ViewedMe',
546 'content' => '<b>' . $sViewedMeC . ':</b> ' . _t('_N times', $iViewedMeContactsCnt),
547 'colspan' => true
548 ),
549 'Blocked' => array(
550 'type' => 'custom',
551 'name' => 'Blocked',
552 'content' => '<b>' . $sBlockedC . ':</b> ' . $iBlockedContactsCnt . $sMembersC,
553 'colspan' => true
554 ),
555 'Greeted' => array(
556 'type' => 'custom',
557 'name' => 'Greeted',
558 'content' => '<b>' . $sGreetedC . ':</b> ' . _t('_N times', $iGreetedContactsCnt),
559 'colspan' => true
560 ),
561 'GreetedMe' => array(
562 'type' => 'custom',
563 'name' => 'GreetedMe',
564 'content' => '<b>' . $sGreetedMeC . ':</b> ' . $iGreetedMeContactsCnt . $sMembersC,
565 'colspan' => true
566 ),
567 'header4_end' => array(
568 'type' => 'block_end'
569 ),
570 ),
571 );
572
573 //custom
574 if ($bModuleExists) $aForm['inputs'] = array_merge($aForm['inputs'], $aCustomElements);
575
576 $oForm = new BxTemplFormView($aForm);
577 return '<div class="dbContent">' . $oForm->getCode() . '</div>';
578 }
579
580 function getBlockCode_QuickLinks() {
581 bx_import('BxTemplMenuQlinks2');
582 $oMenu = new BxTemplMenuQlinks2();
583 $sCodeBlock = $oMenu->getCode();
584 return $sCodeBlock;
585 }
586}
587//-------------------------------------------------------------------------------------------------------//
588
589// --------------- page variables and login
590$_page['name_index'] = 81;
591$_page['css_name'] = array(
592 'member_panel.css',
593 'categories.css',
594 'alert.css',
595);
596
597$_page['extra_js'] = "<script type=\"text/javascript\">urlIconLoading = \"".getTemplateIcon('loading.gif')."\";
598 $(document).ready( function() {
599
600 var sSendUrl = '".$site['url']."alerts.php';
601
602 $('input', '#alertsMenu').click(function(){
603 var sQuery = $('input', '#alertsMenu').serialize();
604 $.post(sSendUrl, sQuery, function(data) {
605 $('#alertsView').html(data);
606 }
607 );
608
609 } );})
610 </script>";
611
612$_page['header'] = _t( "_My Account" );
613
614// --------------- GET/POST actions
615
616$member['ID'] = process_pass_data($_POST['ID']);
617$member['Password'] = process_pass_data($_POST['Password']);
618
619$bAjxMode = ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) ? true : false;
620
621if ( !( $_POST['ID'] && $_POST['Password'] ) && ( $_COOKIE['memberID'] && $_COOKIE['memberPassword'] ) )
622{
623 if ( !( $logged['member'] = member_auth( 0, false ) ) )
624 login_form( _t( "_LOGIN_OBSOLETE" ), 0, $bAjxMode );
625}
626else
627{
628 if ( !isset($_POST['ID']) && !isset($_POST['Password']) )
629 {
630
631 // this is dynamic page - send headers to do not cache this page
632 send_headers_page_changed();
633
634 login_form('', 0, $bAjxMode);
635 } else {
636 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php');
637 $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $member['ID'], 'password' => $member['Password'], 'ip' => getVisitorIP()));
638 $oZ->alert();
639
640 if ((int)getParam('ipBlacklistMode') == 2) {
641 if (isIPLoggedBanned()) {
642 $_page['name_index'] = 55;
643 $_page['css_name'] = '';
644 $_ni = $_page['name_index'];
645 $_page_cont[$_ni]['page_main_code'] = MsgBox(_t('_Sorry, your IP been banned'));
646 PageCode();
647 exit;
648 }
649 }
650
651 $member['ID'] = getID($member['ID']);
652 if (isLoggedBanned($member['ID'])) {
653 $_page['name_index'] = 55;
654 $_page['css_name'] = '';
655 $_ni = $_page['name_index'];
656 $_page_cont[$_ni]['page_main_code'] = MsgBox(_t('_member_banned'));
657 PageCode();
658 exit;
659 }
660
661 // Ajaxy check
662 if ($bAjxMode) {
663 echo check_password($member['ID'], $member['Password'], BX_DOL_ROLE_MEMBER, false) ? 'OK' : 'Fail';
664 exit;
665 }
666
667 // Check if ID and Password are correct (addslashes already inside)
668 if ( check_password( $member['ID'], $member['Password'] ) ) {
669
670 //Storing IP Address
671 if (getParam('enable_member_store_ip')=='on') {
672 $iIP = getVisitorIP();
673 $sCurLongIP = ip2long($iIP);
674 $sVisitsSQL = "SELECT * FROM `sys_ip_members_visits` WHERE CURRENT_DATE() = DATE(`DateTime`) AND `From`='{$sCurLongIP}' LIMIT 1";
675 db_res($sVisitsSQL);
676 if (db_affected_rows()!=1) {
677 $sInsertSQL = "INSERT INTO `sys_ip_members_visits` SET `From`='{$sCurLongIP}', `DateTime`=NOW()";
678 db_res($sInsertSQL);
679 }
680 }
681
682 $p_arr = bx_login($member['ID'], (bool)$_POST['rememberMe']);
683
684 if( !$sUrlRelocate = $_REQUEST['relocate'] or $_REQUEST['relocate'] == $site['url'] or basename( $_REQUEST['relocate'] ) == 'join.php' )
685 $sUrlRelocate = $_SERVER['PHP_SELF'];
686
687 $_page['name_index'] = 150;
688 $_page['css_name'] = '';
689
690 $_ni = $_page['name_index'];
691 $_page_cont[$_ni]['page_main_code'] = MsgBox( _t( '_Please Wait' ) );
692 $_page_cont[$_ni]['url_relocate'] = htmlspecialchars( $sUrlRelocate );
693 PageCode();
694 }
695 exit;
696 }
697}
698/* ------------------ */
699
700$member['ID'] = (int)$_COOKIE['memberID'];
701$member['Password'] = $_COOKIE['memberPassword'];
702
703$_ni = $_page['name_index'];
704
705// --------------- [END] page components
706
707// --------------- page components functions
708
709// this is dynamic page - send headers to do not cache this page
710send_headers_page_changed();
711$oNew = new BxDolMember($member['ID'], $site, $dir);
712$_page_cont[$_ni]['page_main_code'] = $oNew->getCode();
713PageCode();
714
715?>
Note: See TracBrowser for help on using the repository browser.