source: trunk/administration/profiles.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 22.8 KB
Line 
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
21require_once( '../inc/header.inc.php' );
22
23$GLOBALS['iAdminPage'] = 1;
24
25require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
26require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
27require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
28require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
29require_once( BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php' );
30
31bx_import('BxTemplSearchResult');
32bx_import('BxTemplBrowse');
33bx_import('BxTemplTags');
34bx_import('BxTemplFunctions');
35bx_import('BxDolAlerts');
36
37define('BX_DOL_ADM_MP_CTL', 'qlinks');
38define('BX_DOL_ADM_MP_VIEW', 'geeky');
39define('BX_DOL_ADM_MP_JS_NAME', 'oMP');
40define('BX_DOL_ADM_MP_PER_PAGE', 32);
41define('BX_DOL_ADM_MP_PER_PAGE_STEP', 16);
42
43$logged['admin'] = member_auth( 1, true, true );
44
45$sCtlType = isset($_POST['adm-mp-members-ctl-type']) && in_array($_POST['adm-mp-members-ctl-type'], array('qlinks', 'browse', 'calendar', 'tags', 'search')) ? $_POST['adm-mp-members-ctl-type'] : BX_DOL_ADM_MP_CTL;
46$sViewType = isset($_POST['adm-mp-members-view-type']) && in_array($_POST['adm-mp-members-view-type'], array('geeky', 'simple', 'extended')) ? $_POST['adm-mp-members-view-type'] : BX_DOL_ADM_MP_VIEW;
47
48//--- Process Actions ---//
49if(isset($_POST['adm-mp-activate']) && (bool)$_POST['members']) {
50 $GLOBALS['MySQL']->query("UPDATE `Profiles` SET `Status`='Active' WHERE `ID` IN ('" . implode("','", $_POST['members']) . "')");
51 foreach($_POST['members'] as $iId) {
52 createUserDataFile((int)$iId);
53 reparseObjTags('profile', (int)$iId);
54 $oAlert = new BxDolAlerts('profile', 'change_status', (int)$iId, 0, array('status' => 'Active'));
55 $oAlert->alert();
56 }
57} else if(isset($_POST['adm-mp-deactivate']) && (bool)$_POST['members']) {
58 $GLOBALS['MySQL']->query("UPDATE `Profiles` SET `Status`='Approval' WHERE `ID` IN ('" . implode("','", $_POST['members']) . "')");
59 foreach($_POST['members'] as $iId) {
60 createUserDataFile((int)$iId);
61 reparseObjTags('profile', (int)$iId);
62 $oAlert = new BxDolAlerts('profile', 'change_status', (int)$iId, 0, array('status' => 'Approval'));
63 $oAlert->alert();
64 }
65} else if(isset($_POST['adm-mp-ban']) && (bool)$_POST['members']) {
66 foreach($_POST['members'] as $iId)
67 $GLOBALS['MySQL']->query("REPLACE INTO `sys_admin_ban_list` SET `ProfID`='" . $iId . "', `Time`='0', `DateTime`=NOW()");
68} else if(isset($_POST['adm-mp-unban']) && (bool)$_POST['members']) {
69 $GLOBALS['MySQL']->query("DELETE FROM `sys_admin_ban_list` WHERE `ProfID` IN ('" . implode("','", $_POST['members']) . "')");
70} else if(isset($_POST['adm-mp-delete']) && (bool)$_POST['members']) {
71 foreach($_POST['members'] as $iId)
72 $bResult = profile_delete((int)$iId);
73} else if(isset($_POST['adm-mp-confirm']) && (bool)$_POST['members']) {
74 foreach($_POST['members'] as $iId)
75 activation_mail((int)$iId, 0);
76}
77else if(isset($_POST['action']) && $_POST['action'] == 'get_members') {
78 $aParams = array();
79 if(is_array($_POST['ctl_value']))
80 foreach($_POST['ctl_value'] as $sValue) {
81 $aValue = explode('=', $sValue);
82 $aParams[$aValue[0]] = $aValue[1];
83 }
84
85 $oJson = new Services_JSON();
86 echo $oJson->encode(array('code' => 0, 'content' => getMembers(array(
87 'view_type' => $_POST['view_type'],
88 'view_start' => (int)$_POST['view_start'],
89 'view_per_page' => (int)$_POST['view_per_page'],
90 'view_order' => $_POST['view_order'],
91 'ctl_type' => $_POST['ctl_type'],
92 'ctl_params' => $aParams
93 ))));
94 exit;
95}
96
97$iNameIndex = 10;
98$_page = array(
99 'name_index' => $iNameIndex,
100 'css_name' => array('forms_adv.css', 'profiles.css'),
101 'js_name' => array('profiles.js'),
102 'header' => _t('_adm_page_cpt_manage_members')
103);
104$_page_cont[$iNameIndex] = array(
105 'page_code_controls' => PageCodeControls($sCtlType),
106 'page_code_members' => PageCodeMembers($sCtlType, $sViewType),
107 'obj_name' => BX_DOL_ADM_MP_JS_NAME,
108 'actions_url' => $GLOBALS['site']['url_admin'] . 'profiles.php',
109 'sel_control' => $sCtlType,
110 'sel_view' => $sViewType,
111 'per_page' => BX_DOL_ADM_MP_PER_PAGE,
112 'order_by' => ''
113);
114
115PageCodeAdmin();
116
117function PageCodeControls($sDefault = BX_DOL_ADM_MP_CTL) {
118 global $oAdmTemplate;
119
120 $aContentQlinks = getBlockQlinks();
121 $sContentBrowse = '';
122 $sContentCalendar = '';
123 $sContentTags = getBlockTags();
124 $sContentSearch = getBlockSearch();
125
126 $aTopMenu = array(
127 'ctl-type-qlinks' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeControl(this);', 'title' => _t('_adm_btn_mp_qlinks'), 'active' => $sDefault == 'qlinks' ? 1 : 0),
128 //'ctl-type-browse' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeControl(this);', 'title' => _t('_adm_btn_mp_browse'), 'active' => $sDefault == 'browse' ? 1 : 0),
129 //'ctl-type-calendar' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeControl(this);', 'title' => _t('_adm_btn_mp_calendar'), 'active' => $sDefault == 'calendar' ? 1 : 0),
130 'ctl-type-tags' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeControl(this);', 'title' => _t('_adm_btn_mp_tags'), 'active' => $sDefault == 'tags' ? 1 : 0),
131 'ctl-type-search' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeControl(this);', 'title' => _t('_adm_btn_mp_search'), 'active' => $sDefault == 'search' ? 1 : 0)
132 );
133
134 return DesignBoxAdmin(_t('_adm_box_cpt_mp_controls'), $oAdmTemplate->parseHtmlByName('mp_controls.html', array(
135 'styles_qlinks' => $sDefault != 'qlinks' ? "display: none;" : "",
136 'bx_repeat:content_qlinks' => $aContentQlinks,
137 'styles_browse' => $sDefault != 'browse' ? "display: none;" : "",
138 'content_browse' => $sContentBrowse,
139 'styles_calendar' => $sDefault != 'calendar' ? "display: none;" : "",
140 'content_calendar' => $sContentCalendar,
141 'styles_tags' => $sDefault != 'tags' ? "display: none;" : "",
142 'content_tags' => $sContentTags,
143 'styles_search' => $sDefault != 'search' ? "display: none;" : "",
144 'content_search' => $sContentSearch
145 )), $aTopMenu);
146}
147function getBlockQlinks() {
148 global $MySQL;
149
150 $aResult = array();
151 $sBaseUrl = $GLOBALS['site']['url_admin'] . 'profiles.php?type=qlinks&value=';
152
153 $aItems = array();
154 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'all' AS `by`, 'all' AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE 1 AND (`Couple`='0' OR `Couple`>`ID`)"));
155 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'status' AS `by`, `Status` AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE 1 AND (`Couple`='0' OR `Couple`>`ID`) GROUP BY `Status`"));
156 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'featured' AS `by`, 'featured' AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Featured`='1'"));
157 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'banned' AS `by`, 'banned' AS `value`, COUNT(`ProfID`) AS `count` FROM `sys_admin_ban_list` WHERE `Time`='0' OR (`Time`<>'0' AND DATE_ADD(`DateTime`, INTERVAL `Time` HOUR)>NOW())"));
158 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'membership' AS `by`, `tl`.`Name` AS `value`, COUNT(`tlm`.`IDMember`) AS `count` FROM `sys_acl_levels` AS `tl` LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tl`.`ID`=`tlm`.`IDLevel` WHERE `tl`.`Active`='yes' AND `tl`.`Purchasable`='yes' AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) GROUP BY `tl`.`ID`"));
159 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'sex' AS `by`, `Sex` AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE NOT ISNULL(`Sex`) AND `Sex` <> '' GROUP BY `Sex`"));
160 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'type' AS `by`, 'single' AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Couple`='0'"));
161 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'type' AS `by`, 'couple' AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Couple`<>'0' AND `Couple`>`ID`"));
162 $aItems = array_merge($aItems, $MySQL->getAll("SELECT 'role' AS `by`, 'admins' AS `value`, COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Role` & " . BX_DOL_ROLE_ADMIN . ""));
163
164 foreach($aItems as $aItem)
165 $aResult[] = array('link' => 'javascript:void(0)', 'on_click' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeFilterQlinks(\'' . strtolower($aItem['by']) . '\', \'' . strtolower($aItem['value']) . '\')', 'title' => _t('_adm_txt_mp_' . strtolower($aItem['value'])), 'count' => $aItem['count']);
166
167 return $aResult;
168}
169function getBlockTags() {
170 $oTags = new BxTemplTags();
171 $oTags->setTemplateContent('<span class="one_tag" style="font-size:__tagSize__px;"><a href="javascript:void(0)" onclick="javascript:__tagHref__" title="__countCapt__: __countNum__">__tag__</a></span>');
172
173 $aTags = $oTags->getTagList(array('type' => 'profile'));
174 return $oTags->getTagsView($aTags, BX_DOL_ADM_MP_JS_NAME . '.changeFilterTags(\'{tag}\')');
175}
176function getBlockSearch() {
177 $aForm = array(
178 'form_attrs' => array(
179 'id' => 'adm-mp-search',
180 'action' => $_SERVER['PHP_SELF'],
181 'method' => 'post',
182 'enctype' => 'multipart/form-data',
183 ),
184 'inputs' => array (
185 'adm-mp-filter' => array(
186 'type' => 'text',
187 'name' => 'adm-mp-filter',
188 'caption' => _t('_adm_txt_mp_filter'),
189 'value' => '',
190 ),
191 'search' => array(
192 'type' => 'button',
193 'name' => 'search',
194 'value' => _t('_adm_btn_mp_search'),
195 'attrs' => array(
196 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeFilterSearch()'
197 )
198 ),
199 )
200 );
201
202 $oForm = new BxTemplFormView($aForm);
203 return $oForm->getCode();
204}
205
206function PageCodeMembers($sDefaultCtl = BX_DOL_ADM_MP_CTL, $sDefaultView = BX_DOL_ADM_MP_VIEW) {
207 //--- Get Controls ---//
208 $aButtons = array(
209 'adm-mp-activate' => _t('_adm_btn_mp_activate'),
210 'adm-mp-deactivate' => _t('_adm_btn_mp_deactivate'),
211 'adm-mp-ban' => _t('_adm_btn_mp_ban'),
212 'adm-mp-unban' => _t('_adm_btn_mp_unban'),
213 'adm-mp-confirm' => _t('_adm_btn_mp_confirm'),
214 'adm-mp-delete' => _t('_adm_btn_mp_delete'),
215 );
216 $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-mp-members-form', $aButtons, 'members');
217
218 $aTopMenu = array(
219 'view-type-simple' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_simple'), 'active' => $sDefaultView == 'simple' ? 1 : 0),
220 'view-type-extended' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_extended'), 'active' => $sDefaultView == 'extended' ? 1 : 0),
221 'view-type-geeky' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript:' . BX_DOL_ADM_MP_JS_NAME . '.changeTypeView(this);', 'title' => _t('_adm_btn_mp_geeky'), 'active' => $sDefaultView == 'geeky' ? 1 : 0)
222 );
223
224 $oPaginate = new BxDolPaginate(array(
225 'per_page' => BX_DOL_ADM_MP_PER_PAGE,
226 'per_page_step' => BX_DOL_ADM_MP_PER_PAGE_STEP,
227 'on_change_per_page' => BX_DOL_ADM_MP_JS_NAME . '.changePerPage(this);'
228 ));
229
230 $aResult = array(
231 'ctl_type' => $sDefaultCtl,
232 'view_type' => $sDefaultView,
233 'change_order' => BX_DOL_ADM_MP_JS_NAME . '.changeOrder(this);',
234 'per_page' => $oPaginate->getPages(),
235 'control' => $sControls,
236 'loading' => LoadingBox('adm-mp-members-loading')
237 );
238
239 foreach(array('simple', 'extended', 'geeky') as $sType)
240 if($sType == $sDefaultView)
241 $aResult = array_merge($aResult, array('style_' . $sType => '', 'content_' . $sType => getMembers(array('view_type' => $sType))));
242 else
243 $aResult = array_merge($aResult, array('style_' . $sType => 'display: none;', 'content_' . $sType => ''));
244
245 return DesignBoxAdmin(_t('_adm_box_cpt_mp_members'), $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members.html', $aResult), $aTopMenu);
246}
247
248function getMembers($aParams) {
249 if(!isset($aParams['view_start']) || empty($aParams['view_start']))
250 $aParams['view_start'] = 0;
251
252 if(!isset($aParams['view_per_page']) || empty($aParams['view_per_page']))
253 $aParams['view_per_page'] = BX_DOL_ADM_MP_PER_PAGE;
254
255 $aParams['view_order_way'] = 'ASC';
256 if(!isset($aParams['view_order']) || empty($aParams['view_order']))
257 $aParams['view_order'] = 'ID';
258 else {
259 $aOrder = explode(' ', $aParams['view_order']);
260 if(count($aOrder) > 1) {
261 $aParams['view_order'] = $aOrder[0];
262 $aParams['view_order_way'] = $aOrder[1];
263 }
264 }
265
266 $sDateFormat = getLocaleFormat(BX_DOL_LOCALE_DATE, BX_DOL_LOCALE_DB);
267
268 $sSelectClause = $sJoinClause = $sWhereClause = $sGroupClause = '';
269 switch($aParams['ctl_type']) {
270 case 'qlinks':
271 switch($aParams['ctl_params']['by']) {
272 case 'status':
273 $sWhereClause .= " AND `tp`.`Status`='" . ucfirst($aParams['ctl_params']['value']) . "'";
274 break;
275 case 'featured':
276 $sWhereClause .= " AND `tp`.`Featured`='1'";
277 break;
278 case 'banned':
279 $sWhereClause .= " AND (`tbl`.`Time`='0' OR (`tbl`.`Time`<>'0' AND DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW()))";
280 break;
281 case 'type':
282 $sWhereClause .= $aParams['ctl_params']['value'] == 'single' ? " AND `tp`.`Couple`='0'" : " AND `tp`.`Couple`<>'0' AND `tp`.`Couple`>`tp`.`ID`";
283 break;
284 case 'role':
285 $iRole = BX_DOL_ROLE_MEMBER;
286 if($aParams['ctl_params']['value'] == 'admins')
287 $iRole = BX_DOL_ROLE_ADMIN;
288
289 $sWhereClause .= " AND `tp`.`Role` & " . $iRole . "";
290 break;
291 case 'sex':
292 $sWhereClause .= " AND LOWER(`tp`.`Sex`)='" . strtolower($aParams['ctl_params']['value']) . "'";
293 break;
294 case 'membership':
295 $sWhereClause .= " AND LOWER(`tl`.`Name`)='" . strtolower($aParams['ctl_params']['value']) . "'";
296 break;
297 }
298 break;
299
300 case 'tags':
301 $sWhereClause .= " AND `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%'";
302 break;
303
304 case 'search':
305 $sWhereClause .= " AND (
306 `tp`.`NickName` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
307 `tp`.`Email` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
308 `tp`.`Headline` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
309 `tp`.`DescriptionMe` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
310 `tp`.`Tags` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
311 `tp`.`DateReg` LIKE '%" . $aParams['ctl_params']['value'] . "%' OR
312 `tp`.`DateLastLogin` LIKE '%" . $aParams['ctl_params']['value'] . "%'
313 )";
314 break;
315 }
316
317 //--- Get Paginate ---//
318 $oPaginate = new BxDolPaginate(array(
319 'start' => $aParams['view_start'],
320 'count' => (int)db_value("SELECT COUNT(`tp`.`ID`) FROM `Profiles` AS `tp` LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID` LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`)) LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID` " . $sJoinClause . " WHERE 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause),
321 'per_page' => $aParams['view_per_page'],
322 'page_url' => $_SERVER['PHP_SELF'] . '?start={start}',
323 'on_change_page' => BX_DOL_ADM_MP_JS_NAME . '.changePage({start})'
324 ));
325 $sPaginate = $oPaginate->getPaginate();
326
327 //--- Get Items ---//
328 $sQuery = "
329 SELECT
330 `tp`.`ID` as `id`,
331 `tp`.`NickName` AS `username`,
332 `tp`.`Headline` AS `headline`,
333 `tp`.`Sex` AS `sex`,
334 `tp`.`DateOfBirth` AS `date_of_birth`,
335 `tp`.`Country` AS `country`,
336 `tp`.`City` AS `city`,
337 `tp`.`DescriptionMe` AS `description`,
338 `tp`.`Email` AS `email`,
339 DATE_FORMAT(`tp`.`DateReg`, '" . $sDateFormat . "' ) AS `registration`,
340 DATE_FORMAT(`tp`.`DateLastLogin`, '" . $sDateFormat . "' ) AS `last_login`,
341 `tp`.`Status` AS `status`,
342 IF(`tbl`.`Time`='0' OR DATE_ADD(`tbl`.`DateTime`, INTERVAL `tbl`.`Time` HOUR)>NOW(), 1, 0) AS `banned`,
343 `tl`.`ID` AS `ml_id`,
344 IF(ISNULL(`tl`.`Name`),'', `tl`.`Name`) AS `ml_name`
345 " . $sSelectClause . "
346 FROM `Profiles` AS `tp`
347 LEFT JOIN `sys_admin_ban_list` AS `tbl` ON `tp`.`ID`=`tbl`.`ProfID`
348 LEFT JOIN `sys_acl_levels_members` AS `tlm` ON `tp`.`ID`=`tlm`.`IDMember` AND `tlm`.`DateStarts` < NOW() AND (`tlm`.`DateExpires`>NOW() || ISNULL(`tlm`.`DateExpires`))
349 LEFT JOIN `sys_acl_levels` AS `tl` ON `tlm`.`IDLevel`=`tl`.`ID`
350 " . $sJoinClause . "
351 WHERE
352 1 AND (`tp`.`Couple`=0 OR `tp`.`Couple`>`tp`.`ID`)" . $sWhereClause . "
353 " . $sGroupClause . "
354 ORDER BY `tp`.`" . $aParams['view_order'] . "` " . $aParams['view_order_way'] . "
355 LIMIT " . $aParams['view_start'] . ", " . $aParams['view_per_page'];
356 $aProfiles = $GLOBALS['MySQL']->getAll($sQuery);
357
358 //--- Display ---//
359 $sFunction = 'getMembers' . ucfirst($aParams['view_type']);
360 return $sFunction($aProfiles, $sPaginate);
361}
362
363function getMembersGeeky($aProfiles, $sPaginate) {
364 $iEmailLength = 20;
365 $aItems = array();
366 foreach($aProfiles as $aProfile){
367 $sEmail = ( mb_strlen($aProfile['email']) > $iEmailLength ) ? mb_substr($aProfile['email'], 0, $iEmailLength) . '...' : $aProfile['email'];
368
369 $aItems[$aProfile['id']] = array(
370 'id' => $aProfile['id'],
371 'username' => $aProfile['username'],
372 'email' => $sEmail,
373 'full_email' => $aProfile['email'],
374 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'],
375 'edit_class' => (int)$aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'),
376 'registration' => $aProfile['registration'],
377 'last_login' => $aProfile['last_login'],
378 'status' => $aProfile['status'],
379 'ml_id' => !empty($aProfile['ml_id']) ? (int)$aProfile['ml_id'] : 2,
380 'ml_name' => !empty($aProfile['ml_name']) ? $aProfile['ml_name'] : 'Standard'
381 );
382 }
383
384 return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_geeky.html', array(
385 'bx_repeat:items' => array_values($aItems),
386 'paginate' => $sPaginate
387 ));
388}
389function getMembersSimple($aProfiles, $sPaginate) {
390 $aItems = array();
391 foreach($aProfiles as $aProfile)
392 $aItems[$aProfile['id']] = array(
393 'id' => $aProfile['id'],
394 'thumbnail' => get_member_thumbnail($aProfile['id'], 'none'),
395 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'],
396 'edit_class' => (int)$aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'),
397 'edit_width' => defined('BX_AVA_W') ? BX_AVA_W : 70,
398 'username' => $aProfile['username']
399 );
400
401 return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_simple.html', array(
402 'bx_repeat:items' => array_values($aItems),
403 'paginate' => $sPaginate
404 ));
405}
406function getMembersExtended($aProfiles, $sPaginate) {
407 $aItems = array();
408 foreach($aProfiles as $aProfile)
409 $aItems[$aProfile['id']] = array(
410 'id' => $aProfile['id'],
411 'thumbnail' => get_member_thumbnail($aProfile['id'], 'none'),
412 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'],
413 'edit_class' => (int)$aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'),
414 'username' => $aProfile['username'],
415 'headline' => $aProfile['headline'],
416 'sex_link' => $GLOBALS['oFunctions']->genSexIcon($aProfile['sex']),
417 'age' => $aProfile['date_of_birth'] != "0000-00-00" ? _t("_y/o", age($aProfile['date_of_birth'])) : "",
418 'bx_if:flag' => array(
419 'condition' => !empty($aProfile['country']),
420 'content' => array(
421 'flag_link' => $GLOBALS['site']['flags'] . strtolower($aProfile['country']) . '.gif'
422 )
423 ),
424 'city' => $aProfile['city'],
425 'country' => _t($GLOBALS['aPreValues']['Country'][$aProfile['country']]['LKey']),
426 'description' => $aProfile['description'],
427 );
428 return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_extended.html', array(
429 'bx_repeat:items' => array_values($aItems),
430 'paginate' => $sPaginate
431 ));
432}
433?>
Note: See TracBrowser for help on using the repository browser.